diff --git a/Dockerfile b/Dockerfile index 0010fe7..1ccf098 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM xena/go-mini:1.9.2 +FROM xena/go-mini:1.9.3 ENV CGO_ENABLED=0 ENV PATH=$PATH:/root/go/bin diff --git a/Gopkg.lock b/Gopkg.lock index b5781c2..3caae11 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -1,24 +1,6 @@ # This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'. -[[projects]] - branch = "master" - name = "github.com/ThomasRooney/gexpect" - packages = ["."] - revision = "5482f03509440585d13d8f648989e05903001842" - -[[projects]] - branch = "master" - name = "github.com/Xe/eclier" - packages = ["."] - revision = "3cde6c5f47044f4875c4b7fe6b12e4e6000608ea" - -[[projects]] - branch = "master" - name = "github.com/Xe/gluanetrc" - packages = ["."] - revision = "af26c7928995089c19896bcc5d0f8ba48a7930a9" - [[projects]] branch = "master" name = "github.com/Xe/gopreload" @@ -40,15 +22,6 @@ packages = ["."] revision = "62b230097e9c9534ca2074782b25d738c4b68964" -[[projects]] - branch = "master" - name = "github.com/Xe/x" - packages = [ - "tools/glue/libs/gluaexpect", - "tools/glue/libs/gluasimplebox" - ] - revision = "860ea0dedb8beb93b60717510eabca2ef5ffe150" - [[projects]] branch = "master" name = "github.com/aclements/go-moremath" @@ -64,18 +37,6 @@ ] revision = "8d6ce0550041f9d97e7f15ec27ed489f8bbbb0fb" -[[projects]] - name = "github.com/agext/levenshtein" - packages = ["."] - revision = "5f10fee965225ac1eecdc234c09daf5cd9e7f7b6" - version = "v1.2.1" - -[[projects]] - branch = "master" - name = "github.com/ailncode/gluaxmlpath" - packages = ["."] - revision = "6ce478ecb4a60c4fc8929838e0b21b7fb7ca7440" - [[projects]] branch = "master" name = "github.com/alecthomas/template" @@ -91,24 +52,6 @@ packages = ["."] revision = "2efee857e7cfd4f3d0138cc3cbb1b4966962b93a" -[[projects]] - branch = "master" - name = "github.com/apparentlymart/go-cidr" - packages = ["cidr"] - revision = "2bd8b58cf4275aeb086ade613de226773e29e853" - -[[projects]] - branch = "master" - name = "github.com/apparentlymart/go-textseg" - packages = ["textseg"] - revision = "b836f5c4d331d1945a2fead7188db25432d73b69" - -[[projects]] - branch = "master" - name = "github.com/armon/go-radix" - packages = ["."] - revision = "1fca145dffbcaa8fe914309b1ec0cfc67500fe61" - [[projects]] name = "github.com/asdine/storm" packages = [ @@ -122,50 +65,6 @@ revision = "68fc73b635f890fe7ba2f3b15ce80c85b28a744f" version = "v2.0.2" -[[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/query", - "private/protocol/query/queryutil", - "private/protocol/rest", - "private/protocol/restxml", - "private/protocol/xml/xmlutil", - "service/s3", - "service/sts" - ] - revision = "9ed0c8de252f04ac45a65358377103d5a1aa2d92" - version = "v1.12.66" - -[[projects]] - branch = "master" - name = "github.com/bgentry/go-netrc" - packages = ["netrc"] - revision = "9fd32a8b3d3d3f9d43c341bfe098430e07609480" - -[[projects]] - name = "github.com/bgentry/speakeasy" - packages = ["."] - revision = "4aabc24848ce5fd31929f7d1e4ea74d3709c14cd" - version = "v0.1.0" - [[projects]] branch = "master" name = "github.com/bifurcation/mint" @@ -175,12 +74,6 @@ ] revision = "350f685c15fb6b89af795dafe64fad68950948e0" -[[projects]] - name = "github.com/blang/semver" - packages = ["."] - revision = "2ee87856327ba09384cabd113bc6b5d174e9ec0f" - version = "v3.5.1" - [[projects]] branch = "master" name = "github.com/brandur/simplebox" @@ -193,18 +86,6 @@ revision = "7cd7992b3bc86f920394f8de92c13900da1a46b7" version = "v3.2.0" -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluahttp" - packages = ["."] - revision = "b4bfe0c50fea948dcbf3966e120996d6607bbd89" - -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluaurl" - packages = ["."] - revision = "31cbb9bef199454415879f2e6d609d1136d60cad" - [[projects]] name = "github.com/coreos/bbolt" packages = ["."] @@ -241,18 +122,6 @@ revision = "5487b6a5fc12870425fc14d9e05a3fabddd91d7e" version = "v0.1.0" -[[projects]] - name = "github.com/go-ini/ini" - packages = ["."] - revision = "32e4c1e6bc4e7d0d8451aa6b75200d19e37a536a" - version = "v1.32.0" - -[[projects]] - branch = "master" - name = "github.com/go-serve/bindatafs" - packages = ["."] - revision = "1f30d36183f010db5e83986b3554c1a1d9f32d47" - [[projects]] branch = "master" name = "github.com/golang/protobuf" @@ -277,57 +146,6 @@ revision = "57e77c5c37da1f4e1af49f9d1fe760f146c1579e" version = "v0.3.2" -[[projects]] - branch = "master" - name = "github.com/hashicorp/errwrap" - packages = ["."] - revision = "7554cd9344cec97297fa6649b055a8c98c2a1e55" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-cleanhttp" - packages = ["."] - revision = "d5fe4b57a186c716b0e00b8c301cbd9b4182694d" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-getter" - packages = [ - ".", - "helper/url" - ] - revision = "961f56d2e93379b7d9c578e998d09257509a6f97" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-hclog" - packages = ["."] - revision = "ca137eb4b4389c9bc6f1a6d887f056bf16c00510" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-multierror" - packages = ["."] - revision = "b7773ae218740a7be65057fc60b366a49b538a44" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-plugin" - packages = ["."] - revision = "1fc09c47b843b73705f51ffb0520e3ac1bfecf99" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-uuid" - packages = ["."] - revision = "64130c7a86d732268a38cb04cfbaf0cc987fda98" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/go-version" - packages = ["."] - revision = "4fe82ae3040f80a03d04d2cccb5606a626b8e1ee" - [[projects]] branch = "master" name = "github.com/hashicorp/golang-lru" @@ -337,91 +155,6 @@ ] revision = "0a025b7e63adc15a622f29b0b2c4c3848243bbf6" -[[projects]] - branch = "master" - name = "github.com/hashicorp/hcl" - packages = [ - ".", - "hcl/ast", - "hcl/parser", - "hcl/scanner", - "hcl/strconv", - "hcl/token", - "json/parser", - "json/scanner", - "json/token" - ] - revision = "23c074d0eceb2b8a5bfdbb271ab780cde70f05a8" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/hcl2" - packages = [ - "gohcl", - "hcl", - "hcl/hclsyntax", - "hcl/json", - "hcldec", - "hclparse" - ] - revision = "613331e829930a2321c1de7227c9483d9c76c3f4" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/hil" - packages = [ - ".", - "ast", - "parser", - "scanner" - ] - revision = "fa9f258a92500514cc8e9c67020487709df92432" - -[[projects]] - name = "github.com/hashicorp/terraform" - packages = [ - "config", - "config/configschema", - "config/hcl2shim", - "config/module", - "dag", - "flatmap", - "helper/hashcode", - "helper/hilmapstructure", - "helper/schema", - "moduledeps", - "plugin", - "plugin/discovery", - "registry", - "registry/regsrc", - "registry/response", - "svchost", - "svchost/auth", - "svchost/disco", - "terraform", - "tfdiags", - "version" - ] - revision = "a6008b8a48a749c7c167453b9cf55ffd572b9a5d" - version = "v0.11.2" - -[[projects]] - branch = "master" - name = "github.com/hashicorp/yamux" - packages = ["."] - revision = "683f49123a33db61abfb241b7ac5e4af4dc54d55" - -[[projects]] - branch = "master" - name = "github.com/howeyc/gopass" - packages = ["."] - revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8" - -[[projects]] - name = "github.com/jmespath/go-jmespath" - packages = ["."] - revision = "0b12d6b5" - [[projects]] name = "github.com/joho/godotenv" packages = [ @@ -443,12 +176,6 @@ packages = ["."] revision = "ae77be60afb1dcacde03767a8c37337fad28ac14" -[[projects]] - branch = "master" - name = "github.com/kballard/go-shellquote" - packages = ["."] - revision = "cd60e84ee657ff3dc51de0b4f55dd299a3e136f2" - [[projects]] name = "github.com/klauspost/cpuid" packages = ["."] @@ -461,42 +188,6 @@ revision = "6bb6130ff6a76a904c1841707d65603aec9cc288" version = "v1.6" -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaenv" - packages = ["."] - revision = "2888db6bbe38923d59c42e443895875cc8ce0820" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluafs" - packages = ["."] - revision = "01391ed2d7ab89dc80157605b073403f960aa223" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaquestion" - packages = ["."] - revision = "311437c29ba54d027ad2af383661725ae2bfdcdc" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluassh" - packages = ["."] - revision = "2a7bd48d7568de8230c87ac1ef4a4c481e45814d" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluatemplate" - packages = ["."] - revision = "d9e2c9d6b00f069a9da377a9ac529c827c1c7d71" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluayaml" - packages = ["."] - revision = "6fe413d49d73d785510ecf1529991ab0573e96c7" - [[projects]] branch = "master" name = "github.com/kr/fs" @@ -509,12 +200,6 @@ packages = ["."] revision = "cfb55aafdaf3ec08f0db22699ab822c50091b1c4" -[[projects]] - name = "github.com/kr/pty" - packages = ["."] - revision = "282ce0e5322c82529687d609ee670fac7c7d917c" - version = "v1.1.1" - [[projects]] branch = "master" name = "github.com/kr/text" @@ -592,78 +277,18 @@ revision = "035c07716cd373d88456ec4d701402df52584cb4" version = "v3.0.1" -[[projects]] - name = "github.com/mattn/go-isatty" - packages = ["."] - revision = "0360b2af4f38e8d38c7fce2a9f4e702702d73a39" - version = "v0.0.3" - [[projects]] name = "github.com/mattn/go-runewidth" packages = ["."] revision = "9e777a8366cce605130a531d2cd6363d07ad7317" version = "v0.0.2" -[[projects]] - branch = "master" - name = "github.com/mitchellh/cli" - packages = ["."] - revision = "518dc677a1e1222682f4e7db06721942cb8e9e4c" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/copystructure" - packages = ["."] - revision = "d23ffcb85de31694d6ccaa23ccb4a03e55c1303f" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/go-homedir" - packages = ["."] - revision = "b8bc1bf767474819792c23f32d8286a45736f1c6" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/go-testing-interface" - packages = ["."] - revision = "a61a99592b77c9ba629d254a693acffaeb4b7e28" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/go-wordwrap" - packages = ["."] - revision = "ad45545899c7b13c020ea92b2072220eefad42b8" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/hashstructure" - packages = ["."] - revision = "2bca23e0e452137f789efbc8610126fd8b94f73b" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "b4575eea38cca1123ec2dc90c26529b5c5acfcff" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/reflectwalk" - packages = ["."] - revision = "63d60e9d0dbc60cf9164e6510889b0db6683d98c" - [[projects]] branch = "master" name = "github.com/mtneug/pkg" packages = ["ulid"] revision = "b270c2c35fc775243f87c58cf3f6969c5d9369d6" -[[projects]] - name = "github.com/oklog/run" - packages = ["."] - revision = "4dadeb3030eda0273a12382bb2348ffc7c9d1a39" - version = "v1.0.0" - [[projects]] name = "github.com/oklog/ulid" packages = ["."] @@ -676,47 +301,12 @@ packages = ["."] revision = "96aac992fc8b1a4c83841a6c3e7178d20d989625" -[[projects]] - branch = "master" - name = "github.com/otm/gluaflag" - packages = ["."] - revision = "078088de689148194436293886e8e39809167332" - -[[projects]] - branch = "master" - name = "github.com/otm/gluash" - packages = ["."] - revision = "e145c563986f0b91f740a758a84bca46c163aec7" - [[projects]] name = "github.com/pkg/errors" packages = ["."] revision = "645ef00459ed84a119197bfb8d8205042c6df63d" version = "v0.8.0" -[[projects]] - name = "github.com/pkg/sftp" - packages = ["."] - revision = "f6a9258a0f570c3a76681b897b6ded57cb0dfa88" - version = "1.2.0" - -[[projects]] - name = "github.com/posener/complete" - packages = [ - ".", - "cmd", - "cmd/install", - "match" - ] - revision = "dc2bc5a81accba8782bebea28628224643a8286a" - version = "v1.1" - -[[projects]] - name = "github.com/satori/go.uuid" - packages = ["."] - revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3" - version = "v1.2.0" - [[projects]] branch = "master" name = "github.com/streamrail/concurrent-map" @@ -751,17 +341,6 @@ revision = "db96cdf354e8dc053e5ee5fe890bb0a7f18123ab" version = "v5.0.0" -[[projects]] - name = "github.com/ulikunitz/xz" - packages = [ - ".", - "internal/hash", - "internal/xlog", - "lzma" - ] - revision = "0c6b41e72360850ca4f98dc341fd999726ea007f" - version = "v0.5.4" - [[projects]] name = "github.com/xtaci/kcp-go" packages = ["."] @@ -774,24 +353,6 @@ revision = "ebec7ef2574b42a7088cd7751176483e0a27d458" version = "v1.0.6" -[[projects]] - branch = "master" - name = "github.com/yookoala/realpath" - packages = ["."] - revision = "d19ef9c409d9817c1e685775e53d361b03eabbc8" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluamapper" - packages = ["."] - revision = "d836955830e75240d46ce9f0e6d148d94f2e1d3a" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluare" - packages = ["."] - revision = "d7c94f1a80ede93a621ed100866e6d4745ca8c22" - [[projects]] branch = "master" name = "github.com/yuin/gopher-lua" @@ -803,20 +364,6 @@ ] revision = "7d7bc8747e3f614c5c587729a341fe7d8903cdb8" -[[projects]] - branch = "master" - name = "github.com/zclconf/go-cty" - packages = [ - "cty", - "cty/convert", - "cty/function", - "cty/function/stdlib", - "cty/gocty", - "cty/json", - "cty/set" - ] - revision = "709e4033eeb037dc543dbc2048065dfb814ce316" - [[projects]] name = "go.uber.org/atomic" packages = ["."] @@ -829,28 +376,15 @@ packages = [ "acme", "acme/autocert", - "bcrypt", "blowfish", "cast5", "curve25519", - "ed25519", - "ed25519/internal/edwards25519", "hkdf", - "internal/chacha20", "nacl/secretbox", - "openpgp", - "openpgp/armor", - "openpgp/elgamal", - "openpgp/errors", - "openpgp/packet", - "openpgp/s2k", "pbkdf2", "poly1305", "salsa20", "salsa20/salsa", - "ssh", - "ssh/agent", - "ssh/terminal", "tea", "twofish", "xtea" @@ -863,8 +397,6 @@ packages = [ "bpf", "context", - "html", - "html/atom", "http2", "http2/hpack", "idna", @@ -880,10 +412,7 @@ [[projects]] branch = "master" name = "golang.org/x/sys" - packages = [ - "unix", - "windows" - ] + packages = ["unix"] revision = "2c42eef0765b9837fbdab12011af7830f55f88f0" [[projects]] @@ -907,15 +436,6 @@ ] revision = "e19ae1496984b1c655b8044a65c0300a3c878dd3" -[[projects]] - branch = "master" - name = "golang.org/x/tools" - packages = [ - "godoc/vfs", - "godoc/vfs/httpfs" - ] - revision = "99037e3760ed7d9c772c980caee42b17779b80ce" - [[projects]] branch = "master" name = "google.golang.org/genproto" @@ -925,30 +445,8 @@ [[projects]] name = "google.golang.org/grpc" packages = [ - ".", - "balancer", - "balancer/base", - "balancer/roundrobin", "codes", - "connectivity", - "credentials", - "encoding", - "grpclb/grpc_lb_v1/messages", - "grpclog", - "health", - "health/grpc_health_v1", - "internal", - "keepalive", - "metadata", - "naming", - "peer", - "resolver", - "resolver/dns", - "resolver/passthrough", - "stats", - "status", - "tap", - "transport" + "status" ] revision = "6b51017f791ae1cfbec89c52efdf444b13b550ef" version = "v1.9.2" @@ -959,30 +457,12 @@ revision = "947dcec5ba9c011838740e680966fd7087a71d0d" version = "v2.2.6" -[[projects]] - branch = "v2" - name = "gopkg.in/xmlpath.v2" - packages = ["."] - revision = "860cbeca3ebcc600db0b213c0e83ad6ce91f5739" - -[[projects]] - branch = "v2" - name = "gopkg.in/yaml.v2" - packages = ["."] - revision = "d670f9405373e636a5a2765eea47fac0c9bc91a4" - [[projects]] branch = "master" name = "layeh.com/asar" packages = ["."] revision = "0ec214a4ae0d21fa761591e8cb8f0bbf162ef3e5" -[[projects]] - branch = "master" - name = "layeh.com/gopher-json" - packages = ["."] - revision = "1aab82196e3b418b56866938f28b6a693f2c6b18" - [[projects]] name = "layeh.com/gopher-luar" packages = ["."] @@ -992,6 +472,6 @@ [solve-meta] analyzer-name = "dep" analyzer-version = 1 - inputs-digest = "d000c14171581755a2ee37649cb969d019d9c197928028a87e83e3ec729421aa" + inputs-digest = "00989279709617d81211e843f6f2803e3af15e1a363c2976d11a5f9d78e0e040" solver-name = "gps-cdcl" solver-version = 1 diff --git a/cmd/construct/builtin.go b/cmd/construct/builtin.go deleted file mode 100644 index 0591051..0000000 --- a/cmd/construct/builtin.go +++ /dev/null @@ -1,69 +0,0 @@ -package main - -import ( - "context" - "flag" - "fmt" - "log" - "net/http" - "os" - "runtime" - - "github.com/kr/pretty" - "go.uber.org/atomic" -) - -var ( - hits *atomic.Int64 -) - -func init() { - hits = atomic.NewInt64(0) -} - -func demoServerHandler(msg string) http.Handler { - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, "Route is go!") - fmt.Fprintf(w, "%s\n", pretty.Sprintf("%s", r.Header)) - hn, _ := os.Hostname() - fmt.Fprintf(w, "message: %s\n", msg) - fmt.Fprintf(w, "Served by %s running %s\n", hn, runtime.GOOS) - fmt.Fprintf(w, "Hit count: %d", hits.Inc()) - - ip := r.Header.Get("X-Remote-Ip") - if ip != "" { - log.Printf("Hit from %s: %s", ip, r.RequestURI) - } - }) -} - -func demoServer(ctx context.Context, args []string) error { - fs := flag.NewFlagSet("server", flag.ContinueOnError) - - addr := fs.String("addr", ":9090", "http address to listen on") - msg := fs.String("msg", "now here's a little lesson in trickery...", "custom message to add to each page render") - - err := fs.Parse(args) - if err != nil { - return err - } - - hs := &http.Server{ - Addr: *addr, - Handler: demoServerHandler(*msg), - } - - go hs.ListenAndServe() - - log.Printf("listening on %s", *addr) - - for { - select { - case <-ctx.Done(): - sctx := context.Background() - hs.Shutdown(sctx) - - return nil - } - } -} diff --git a/cmd/construct/main.go b/cmd/construct/main.go deleted file mode 100644 index 01425a1..0000000 --- a/cmd/construct/main.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -import ( - "context" - "flag" - "log" - "net/http" - "os" - "path/filepath" - - "git.xeserv.us/xena/route/internal/gluaroute" - edata "git.xeserv.us/xena/route/proto/eclier" - "github.com/Xe/eclier" - "github.com/Xe/gluanetrc" - "github.com/Xe/x/tools/glue/libs/gluaexpect" - "github.com/Xe/x/tools/glue/libs/gluasimplebox" - "github.com/ailncode/gluaxmlpath" - "github.com/cjoudrey/gluahttp" - "github.com/cjoudrey/gluaurl" - "github.com/go-serve/bindatafs" - "github.com/kohkimakimoto/gluaenv" - "github.com/kohkimakimoto/gluafs" - "github.com/kohkimakimoto/gluaquestion" - "github.com/kohkimakimoto/gluassh" - "github.com/kohkimakimoto/gluatemplate" - "github.com/kohkimakimoto/gluayaml" - homedir "github.com/mitchellh/go-homedir" - "github.com/otm/gluaflag" - "github.com/otm/gluash" - "github.com/yuin/gluare" - lua "github.com/yuin/gopher-lua" - "golang.org/x/tools/godoc/vfs/httpfs" - json "layeh.com/gopher-json" -) - -var hDir string -var cfgHome *string -var netrcFile *string -var defaultServer *string - -func init() { - dir, err := homedir.Dir() - if err != nil { - log.Fatal(err) - } - - hDir = dir - - cfgHome = flag.String("home", filepath.Join(hDir, ".construct"), "construct's home directory") - netrcFile = flag.String("netrc", filepath.Join(hDir, ".netrc"), "location of netrc file to use for authentication") - defaultServer = flag.String("default-server", "https://api.route.xeserv.us:7268", "api server to connect to") - - log.SetFlags(log.LstdFlags | log.Llongfile) -} - -func main() { - flag.Parse() - - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - - pluginLoc := filepath.Join(*cfgHome, "plugins") - scriptsLoc := filepath.Join(*cfgHome, "local", "scripts") - - os.MkdirAll(pluginLoc, 0755) - os.MkdirAll(scriptsLoc, 0755) - - if _, err := os.Stat(*netrcFile); err != nil { - log.Printf("creating netrc file...") - fout, err := os.Create(*netrcFile) - if err != nil { - log.Fatal(err) - } - fout.Close() - } - - efs := bindatafs.New("core://", edata.Asset, edata.AssetDir, edata.AssetInfo) - - opts := []eclier.RouterOption{ - eclier.WithGluaCreationHook(preload), - eclier.WithScriptHome(scriptsLoc), - eclier.WithFilesystem("/bindata:core/", httpfs.New(efs)), - } - - err := filepath.Walk(pluginLoc, func(path string, info os.FileInfo, err error) error { - if info.IsDir() { - opts = append(opts, eclier.WithScriptHome(info.Name())) - } - - return nil - }) - if err != nil { - log.Fatal(err) - } - - r, err := eclier.NewRouter(opts...) - if err != nil { - log.Fatal(err) - } - - r.AddCommand(eclier.NewBuiltinCommand("server", "spawns a http server for testing", "[-addr host:port|-msg \"some message\"]", demoServer)) - - r.Run(ctx, flag.Args()) -} - -func preload(L *lua.LState) { - L.PreloadModule("re", gluare.Loader) - L.PreloadModule("sh", gluash.Loader) - L.PreloadModule("fs", gluafs.Loader) - L.PreloadModule("env", gluaenv.Loader) - L.PreloadModule("yaml", gluayaml.Loader) - L.PreloadModule("question", gluaquestion.Loader) - L.PreloadModule("ssh", gluassh.Loader) - L.PreloadModule("http", gluahttp.NewHttpModule(&http.Client{}).Loader) - L.PreloadModule("flag", gluaflag.Loader) - L.PreloadModule("template", gluatemplate.Loader) - L.PreloadModule("url", gluaurl.Loader) - gluaexpect.Preload(L) - gluasimplebox.Preload(L) - gluaxmlpath.Preload(L) - json.Preload(L) - gluanetrc.Preload(L) - gluaroute.Preload(L) -} diff --git a/cmd/route-cli/.gitignore b/cmd/routectl/.gitignore similarity index 100% rename from cmd/route-cli/.gitignore rename to cmd/routectl/.gitignore diff --git a/cmd/route-cli/gopreload.go b/cmd/routectl/gopreload.go similarity index 100% rename from cmd/route-cli/gopreload.go rename to cmd/routectl/gopreload.go diff --git a/cmd/route-cli/main.go b/cmd/routectl/main.go similarity index 100% rename from cmd/route-cli/main.go rename to cmd/routectl/main.go diff --git a/cmd/terraform-provider-route/main.go b/cmd/terraform-provider-route/main.go deleted file mode 100644 index c1fd760..0000000 --- a/cmd/terraform-provider-route/main.go +++ /dev/null @@ -1,54 +0,0 @@ -package main - -import ( - "log" - "net/http" - - "git.xeserv.us/xena/route/proto/route" - "github.com/hashicorp/terraform/helper/schema" - "github.com/hashicorp/terraform/plugin" - "github.com/hashicorp/terraform/terraform" -) - -func main() { - plugin.Serve(&plugin.ServeOpts{ - ProviderFunc: provider, - }) -} - -// provider returns a terraform.ResourceProvider. -func provider() terraform.ResourceProvider { - return &schema.Provider{ - Schema: map[string]*schema.Schema{ - "token": &schema.Schema{ - Type: schema.TypeString, - Optional: true, - DefaultFunc: schema.EnvDefaultFunc("ROUTE_TOKEN", nil), - }, - "host": &schema.Schema{ - Type: schema.TypeString, - Optional: false, - Required: true, - DefaultFunc: schema.EnvDefaultFunc("ROUTE_HOST", nil), - }, - }, - - ResourcesMap: map[string]*schema.Resource{ - "route_route": routeResource(), - "route_token": tokenResource(), - }, - - ConfigureFunc: providerConfigure, - } -} - -func providerConfigure(d *schema.ResourceData) (interface{}, error) { - token := d.Get("token").(string) - host := d.Get("host").(string) - - log.Printf("[INFO] Initializing route client connecting to %s", host) - - cl := route.New(host, token, &http.Client{}) - - return cl, nil -} diff --git a/cmd/terraform-provider-route/route.go b/cmd/terraform-provider-route/route.go deleted file mode 100644 index ba030dd..0000000 --- a/cmd/terraform-provider-route/route.go +++ /dev/null @@ -1,91 +0,0 @@ -package main - -import ( - "context" - "log" - - proto "git.xeserv.us/xena/route/proto" - "git.xeserv.us/xena/route/proto/route" - "github.com/hashicorp/terraform/helper/schema" -) - -func routeResource() *schema.Resource { - return &schema.Resource{ - Create: resourceRouteCreate, - Read: resourceRouteRead, - Delete: resourceRouteDelete, - Exists: resourceRouteExists, - - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - - Schema: map[string]*schema.Schema{ - "host": { - Type: schema.TypeString, - Required: true, - ForceNew: true, - }, - }, - } -} - -func resourceRouteCreate(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - rt, err := cli.Routes.Put(context.Background(), &proto.Route{ - Host: d.Get("host").(string), - }) - - if err != nil { - return err - } - - log.Printf("[INFO] created route for host %s with ID %s", rt.Host, rt.Id) - - return nil -} - -func resourceRouteDelete(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - rt, err := cli.Routes.Get(context.Background(), &proto.GetRouteRequest{Id: d.Id()}) - if err != nil { - return err - } - - _, err = cli.Routes.Delete(context.Background(), rt) - if err != nil { - return err - } - - log.Printf("[INFO] deleted route for host %s with ID %s", rt.Host, rt.Id) - - return nil -} - -func resourceRouteExists(d *schema.ResourceData, meta interface{}) (bool, error) { - cli := meta.(*route.Client) - - _, err := cli.Routes.Get(context.Background(), &proto.GetRouteRequest{Id: d.Id()}) - if err != nil { - return false, err - } - - return true, nil -} - -func resourceRouteRead(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - rt, err := cli.Routes.Get(context.Background(), &proto.GetRouteRequest{Id: d.Id()}) - if err != nil { - return err - } - - d.SetId(rt.Id) - d.Set("host", rt.Host) - d.Set("creator", rt.Creator) - - return nil -} diff --git a/cmd/terraform-provider-route/token.go b/cmd/terraform-provider-route/token.go deleted file mode 100644 index a0596e8..0000000 --- a/cmd/terraform-provider-route/token.go +++ /dev/null @@ -1,99 +0,0 @@ -package main - -import ( - "context" - "log" - - proto "git.xeserv.us/xena/route/proto" - "git.xeserv.us/xena/route/proto/route" - "github.com/hashicorp/terraform/helper/schema" -) - -func tokenResource() *schema.Resource { - return &schema.Resource{ - Create: resourceTokenCreate, - Read: resourceTokenRead, - Delete: resourceTokenDelete, - Exists: resourceTokenExists, - - Importer: &schema.ResourceImporter{ - State: schema.ImportStatePassthrough, - }, - - Schema: map[string]*schema.Schema{ - "scopes": { - Type: schema.TypeList, - Required: true, - ForceNew: true, - }, - }, - } -} - -func resourceTokenCreate(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - var scps []string - - for _, val := range d.Get("scopes").([]interface{}) { - sc, ok := val.(string) - if !ok { - log.Printf("[INFO] can't decode %#v", sc) - continue - } - - scps = append(scps, sc) - } - - tok, err := cli.Tokens.Put(context.Background(), &proto.Token{Scopes: scps}) - if err != nil { - return err - } - - log.Printf("[INFO] created token with scopes %v and ID %s", tok.Scopes, tok.Id) - - return nil -} - -func resourceTokenDelete(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - tok, err := cli.Tokens.Get(context.Background(), &proto.GetTokenRequest{Id: d.Id()}) - if err != nil { - return err - } - - _, err = cli.Tokens.Deactivate(context.Background(), tok) - if err != nil { - return err - } - - return nil -} - -func resourceTokenExists(d *schema.ResourceData, meta interface{}) (bool, error) { - cli := meta.(*route.Client) - - _, err := cli.Tokens.Get(context.Background(), &proto.GetTokenRequest{Id: d.Id()}) - if err != nil { - return false, err - } - - return true, nil -} - -func resourceTokenRead(d *schema.ResourceData, meta interface{}) error { - cli := meta.(*route.Client) - - tok, err := cli.Tokens.Get(context.Background(), &proto.GetTokenRequest{Id: d.Id()}) - if err != nil { - return err - } - - d.SetId(tok.Id) - d.Set("body", tok.Body) - d.Set("active", tok.Active) - d.Set("scopes", tok.Scopes) - - return nil -} diff --git a/mage.go b/mage.go index d83d6b7..429abb6 100644 --- a/mage.go +++ b/mage.go @@ -27,13 +27,11 @@ func init() { wd = lwd arches = []string{"amd64", "ppc64", "386", "arm", "arm64"} - bins = []string{"route-httpagent", "route-cli", "routed", "terraform-provider-route", "construct"} + bins = []string{"route-httpagent", "routectl", "routed"} tools = []string{ "github.com/golang/dep/cmd/dep", "github.com/golang/protobuf/protoc-gen-go", "github.com/twitchtv/twirp/protoc-gen-twirp", - "github.com/Xe/twirp-codegens/cmd/protoc-gen-twirp_eclier", - "github.com/jteeuwen/go-bindata/go-bindata", } } @@ -178,7 +176,6 @@ func Generate(ctx context.Context) { dir := filepath.Join(wd, "proto") shouldWork(ctx, nil, dir, "sh", "./regen.sh") - shouldWork(ctx, nil, filepath.Join(dir, "eclier"), "go-bindata", "-pkg", "edata", "-ignore", "bindata.go", ".") } // Vars shows the various variables that this magefile uses. @@ -191,6 +188,7 @@ func Vars() { table.Append([]string{"bins", fmt.Sprint(bins)}) table.Append([]string{"goarch", runtime.GOARCH}) table.Append([]string{"goos", runtime.GOOS}) + table.Append([]string{"gover", runtime.Version()}) table.Append([]string{"tools", fmt.Sprint(tools)}) table.Append([]string{"wd", wd}) diff --git a/proto/eclier/bindata.go b/proto/eclier/bindata.go deleted file mode 100644 index fd21d68..0000000 --- a/proto/eclier/bindata.go +++ /dev/null @@ -1,465 +0,0 @@ -// Code generated by go-bindata. -// sources: -// route_twirp_eclier_backends_kill.lua -// route_twirp_eclier_backends_list.lua -// route_twirp_eclier_routes_delete.lua -// route_twirp_eclier_routes_get.lua -// route_twirp_eclier_routes_get_all.lua -// route_twirp_eclier_routes_put.lua -// route_twirp_eclier_tokens_deactivate.lua -// route_twirp_eclier_tokens_delete.lua -// route_twirp_eclier_tokens_get.lua -// route_twirp_eclier_tokens_get_all.lua -// route_twirp_eclier_tokens_put.lua -// DO NOT EDIT! - -package edata - -import ( - "bytes" - "compress/gzip" - "fmt" - "io" - "io/ioutil" - "os" - "path/filepath" - "strings" - "time" -) - -func bindataRead(data []byte, name string) ([]byte, error) { - gz, err := gzip.NewReader(bytes.NewBuffer(data)) - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - - var buf bytes.Buffer - _, err = io.Copy(&buf, gz) - clErr := gz.Close() - - if err != nil { - return nil, fmt.Errorf("Read %q: %v", name, err) - } - if clErr != nil { - return nil, err - } - - return buf.Bytes(), nil -} - -type asset struct { - bytes []byte - info os.FileInfo -} - -type bindataFileInfo struct { - name string - size int64 - mode os.FileMode - modTime time.Time -} - -func (fi bindataFileInfo) Name() string { - return fi.name -} -func (fi bindataFileInfo) Size() int64 { - return fi.size -} -func (fi bindataFileInfo) Mode() os.FileMode { - return fi.mode -} -func (fi bindataFileInfo) ModTime() time.Time { - return fi.modTime -} -func (fi bindataFileInfo) IsDir() bool { - return false -} -func (fi bindataFileInfo) Sys() interface{} { - return nil -} - -var _route_twirp_eclier_backends_killLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x52\x4d\x6b\xdc\x30\x10\xbd\xeb\x57\x3c\x74\xb2\x21\x36\xdb\x43\x2f\x0b\xbe\xb4\xc9\x21\x50\x1a\x28\xe9\xa9\x84\xa2\x95\xc7\xb6\x58\xaf\xe4\xce\x48\x4e\xfa\xef\x8b\xe4\xec\x47\x73\x30\x58\x7a\xef\xcd\x7b\x33\xa3\xa6\xc1\xd7\xd0\x13\x46\xf2\xc4\x26\x52\x8f\xc3\x5f\x2c\x1c\x62\xb0\xcd\x48\xbe\x89\xaf\x8e\x97\xdf\x64\x67\x47\x8c\xf5\x73\xbb\x6b\x77\xf7\x4f\xf8\xfe\xf4\x8c\x87\xfb\xc7\x67\xd5\x34\x90\x90\xd8\xd2\x1e\x1c\x52\xa4\xb6\x48\x95\x12\xcb\x6e\x89\xed\x4a\x7c\x40\x07\x7d\x30\xf6\x48\xbe\x97\xfd\xd1\xcd\xb3\x3e\xa3\x13\xcd\x4b\x46\x1f\xde\xc8\xa6\x48\x82\x13\xc5\x29\xf4\xc8\x24\x04\x0f\x21\x5e\x9d\x25\x9c\xd5\x18\x02\xa3\x04\xc2\x62\xec\xd1\x8c\x84\x37\xca\xa4\x36\x49\xbb\xd9\x9f\xa9\x17\x0f\x93\xe2\x14\x38\xbb\x9c\x8c\x9d\x9c\xa7\xe6\xd2\xa9\xbe\x49\x29\x2e\xf8\x4c\xda\x3a\xbc\x20\x49\xb2\x49\x07\xad\x95\x9a\x83\x35\x33\x86\xd9\x8c\xe8\xc0\xf4\x27\x39\x26\xe8\x7c\xd6\xef\x98\xac\xf6\x16\x92\xd5\x5e\x65\x82\xae\x68\x5b\x4f\xaf\x55\xad\xf2\xe0\xf2\x71\xeb\xe9\xcb\x96\xfa\xb1\x57\x83\xec\x25\xb2\xf3\x63\xa5\x5d\xaf\xef\xa0\xf3\xb7\x9a\x39\x51\x21\x9e\x48\x4a\x22\xc3\x23\x5c\xaf\x6b\xf5\x31\xe8\x20\xfb\xf2\x9b\x2d\x86\xe4\x6d\xcc\x7d\x71\xf2\x95\xe1\xb1\x56\x80\x1b\xb2\xf6\xd7\xa7\x17\x74\x1d\x74\x93\x37\xa0\x11\xf8\xbf\xcb\xf7\xdb\x38\x91\x57\x00\xb0\xb0\xf3\xb1\xba\x56\xae\xcb\x2d\x53\x4c\x9c\x09\xe4\x7b\xa5\x50\x2a\xec\x5e\xd0\xe1\x66\xf5\x0a\xb8\x4e\x4d\xb6\x78\x8b\x61\xa1\x2d\xce\x05\x66\x92\xfc\x10\x64\xb5\x65\x3c\x66\x71\x3f\x7f\x7c\xbb\x43\x0c\x47\xf2\xf5\xfe\xbc\xd3\xaa\x2e\xcf\xa7\x2a\xc5\x6a\xa5\xb2\xf1\xbf\x00\x00\x00\xff\xff\x9b\x1b\x96\x37\xbf\x02\x00\x00") - -func route_twirp_eclier_backends_killLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_backends_killLua, - "route_twirp_eclier_backends_kill.lua", - ) -} - -func route_twirp_eclier_backends_killLua() (*asset, error) { - bytes, err := route_twirp_eclier_backends_killLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_backends_kill.lua", size: 703, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_backends_listLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\xc1\x6e\xdb\x3a\x10\xbc\xf3\x2b\x06\x3c\x59\x40\x24\xe4\x1d\xde\x45\x80\x2e\x6d\x72\x28\x50\x34\x40\x9b\x9e\x9a\xa0\xa0\xa9\x95\x4c\x44\x26\xd5\x5d\x52\x49\xff\xbe\x20\x65\xd9\x6e\x81\xf6\x60\xc0\xdc\x99\xd9\x9d\x5d\x4d\x5d\xe3\x7d\xe8\x09\x23\x79\x62\x13\xa9\xc7\xfe\x27\x66\x0e\x31\xd8\x7a\x24\x5f\xc7\x57\xc7\xf3\x77\xb2\x93\x23\xc6\xf2\x7f\x73\xdb\xdc\xde\x3d\xe0\xd3\xc3\x23\xee\xef\x3e\x3c\xaa\xba\x86\x84\xc4\x96\x5a\x70\x48\x91\x9a\x22\x55\x4a\x2c\xbb\x39\x36\x0b\xf1\x1e\x1d\xf4\xde\xd8\x17\xf2\xbd\xb4\x93\x93\xa8\x37\xf4\x40\xd3\x9c\xd1\xfb\x37\xb2\x29\x92\xe0\x48\xf1\x10\x7a\x64\x12\x82\x87\x10\x2f\xce\x12\x36\x35\x86\xc0\x28\x86\x30\x1b\xfb\x62\x46\xc2\x1b\x65\x52\x93\xa4\x59\xc7\x6f\xd4\xf3\x0c\x93\xe2\x21\x70\x9e\x72\x34\xf6\xe0\x3c\xd5\xe7\x4d\xf5\x95\x4b\x71\xc1\x67\xd2\xba\xe1\x19\x49\x92\x87\x74\xd0\x5a\xa9\x29\x58\x33\x61\x98\xcc\x88\x0e\x4c\x3f\x92\x63\x82\xce\x6f\x7d\xc2\x64\xb1\xd7\x90\x2c\xf6\x22\x13\x74\x45\xdb\x78\x7a\xdd\x55\x2a\x1f\x2e\x3f\xd7\x9d\xde\xad\xae\xbf\xd0\x44\x36\x06\x56\x83\xb4\x12\xd9\xf9\x71\xa7\xfb\x70\x34\xce\xeb\x1b\xe8\xfc\x5b\xcc\x94\xa8\x48\x8e\x24\xc5\x9b\xe1\x11\x27\x4e\x75\xad\x4b\x42\xfc\x6f\x55\x61\x54\xea\xcf\x55\x07\x69\xcb\xdf\x6c\x72\x48\xde\xc6\x7c\x19\x4e\x7e\x67\x78\xac\x14\xe0\x86\xac\xfe\xf6\xdf\x33\xba\x0e\xba\xce\xdf\x50\x23\xf0\x6f\xc5\x53\x35\x1e\xc8\x2b\x00\x98\xd9\xf9\xb8\xbb\x74\xae\x4a\x95\x29\x26\xce\x04\xf2\xbd\x52\x28\x1d\x6e\x9f\xd1\xe1\x2a\x3c\x0a\xb8\xdc\x5d\x56\x7b\xb3\x61\xa1\xd5\xce\x19\x66\x92\x1c\x25\x59\x6c\x39\xb0\x99\xdd\xd7\xcf\x1f\x6f\x10\xc3\x0b\xf9\xaa\xdd\x52\xb1\xab\x4a\x00\x77\xa5\x59\x51\xaf\xce\xf4\x5e\xda\xa7\xf8\x14\x35\x9a\x06\x31\x9c\x6e\x98\x7b\x36\x7b\x29\x6e\x37\xde\x96\xe3\xbf\xb1\x4f\x78\x55\xa9\xbc\xd4\xaf\x00\x00\x00\xff\xff\x5b\x4a\x7f\xf6\x5d\x03\x00\x00") - -func route_twirp_eclier_backends_listLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_backends_listLua, - "route_twirp_eclier_backends_list.lua", - ) -} - -func route_twirp_eclier_backends_listLua() (*asset, error) { - bytes, err := route_twirp_eclier_backends_listLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_backends_list.lua", size: 861, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_routes_deleteLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\x4f\x6b\xdc\x3e\x10\xbd\xeb\x53\x3c\x74\xb2\x21\x36\xfb\x3b\xfc\x2e\x06\x9f\x9a\x1c\x0a\xa5\x81\x90\x9e\x4a\x28\x8a\x3c\xb6\x45\xbc\x92\x3b\x23\x39\xe9\xb7\x2f\x92\x37\xbb\x9b\x1e\x72\x30\x58\xf3\xde\x9b\x79\xf3\xa7\x69\xf0\x25\x0c\x84\x89\x3c\xb1\x89\x34\xe0\xf9\x0f\x56\x0e\x31\xd8\x66\x22\xdf\xc4\x57\xc7\xeb\x2f\xb2\x8b\x23\xc6\xf6\x7f\x7b\x68\x0f\xb7\xf7\xf8\x7e\xff\x88\xbb\xdb\xaf\x8f\xaa\x69\x20\x21\xb1\xa5\x0e\x1c\x52\xa4\xb6\x48\x95\x12\xcb\x6e\x8d\xed\x46\xfc\x8c\x1e\xba\x60\xd2\x0d\xb4\x50\x24\xfd\x8e\xce\xb4\xac\x19\xbd\x7b\x23\x9b\x71\x1c\x29\xce\x61\xc0\x4e\x43\xf0\x10\xe2\xcd\x59\xda\x73\x0b\xc6\xc0\x28\x86\xb0\x1a\xfb\x62\x26\xc2\x1b\x65\x4a\x9b\xa4\xdd\xcb\xef\xc4\x73\x05\x93\xe2\x1c\x38\xd7\x38\x1a\x3b\x3b\x4f\xcd\xb9\x4f\x7d\xe5\x51\x5c\xf0\x99\xb4\xf7\x77\x46\x92\xe4\x12\x3d\xb4\x56\x6a\x09\xd6\x2c\x18\x17\x33\xa1\x07\xd3\xef\xe4\x98\xa0\xf3\x5b\x9f\x30\xd9\xec\x35\x24\x9b\xbd\xc8\x04\x7d\xd1\xb6\x9e\x5e\xab\x5a\xe5\xb1\xe5\xe7\xde\xd1\x43\xf6\xac\x46\xe9\x24\xb2\xf3\x53\xa5\xdd\xa0\x6f\xa0\xf3\xb7\x99\x25\x51\x21\x1d\x49\x8a\x1b\xc3\x13\xdc\xa0\xeb\x6b\xbe\x65\x32\x31\xf0\xe7\xa2\x77\xd2\x07\xe5\x1c\x24\x7e\x2e\x2b\x8c\x5a\xfd\x3b\x92\x51\xba\xf2\x9b\x9b\x19\x93\xb7\x31\x4f\x90\x93\xaf\x0c\x4f\xb5\x02\xdc\x98\xd5\x3f\xff\x7b\x42\xdf\x43\x37\x79\xd3\x1a\x81\x3f\x04\x4f\xd1\x38\x93\x57\x00\xb0\xb2\xf3\xb1\xba\x64\xae\x4b\x94\x29\x26\xce\x04\xf2\x83\x52\x28\x19\x0e\x4f\xe8\x71\x75\x62\x0a\xb8\xec\x47\x76\x7b\xab\x61\xa1\xdd\xce\x19\x66\x92\x7c\x70\xb2\xd9\xb2\x08\xb3\xba\x1f\x0f\xdf\x6e\x10\xc3\x0b\xf9\xba\xdb\x6f\xa7\xaa\x4f\x67\x5a\x95\x64\xb5\x52\xb9\xf0\xdf\x00\x00\x00\xff\xff\x75\x1a\x14\x61\x27\x03\x00\x00") - -func route_twirp_eclier_routes_deleteLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_routes_deleteLua, - "route_twirp_eclier_routes_delete.lua", - ) -} - -func route_twirp_eclier_routes_deleteLua() (*asset, error) { - bytes, err := route_twirp_eclier_routes_deleteLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_routes_delete.lua", size: 807, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_routes_getLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x84\x52\x4d\x6b\xdc\x30\x10\xbd\xeb\x57\x3c\x74\x5a\x43\x6c\xd2\x43\x2f\x06\x9f\x9a\x50\x0a\xa5\x81\x90\x9e\x9a\x50\x14\x79\x6c\x8b\x38\x92\x33\x92\x9c\xf4\xdf\x97\x91\xdd\xdd\x6d\x21\xf4\xb0\xb0\x9a\xf7\x31\x6f\xc6\x53\xd7\xf8\x14\x7a\xc2\x48\x9e\xd8\x24\xea\xf1\xf8\x0b\x0b\x87\x14\x6c\x3d\x92\xaf\xd3\xab\xe3\xe5\x27\xd9\xd9\x11\x63\xfd\xd8\x5c\x36\x97\x57\x37\xf8\x76\x73\x87\xeb\xab\x2f\x77\xaa\xae\x11\x43\x66\x4b\x2d\x38\xe4\x44\x4d\x91\x2a\x15\x2d\xbb\x25\x35\x2b\xf1\x23\x3a\xe8\x82\xc5\x76\xa4\xa4\xff\x40\x13\xcd\x8b\x40\xd7\x6f\x64\x05\xc4\x33\xa5\x29\xf4\x18\x29\x21\x78\x44\xe2\xd5\x59\xda\x5c\x23\x86\xc0\x28\x51\xb0\x18\xfb\x64\x46\xc2\x1b\x09\xa5\xc9\xb1\xd9\x1a\x6f\xc4\xa3\xbd\xc9\x69\x0a\x2c\x0d\x9e\x8d\x9d\x9c\xa7\xfa\x38\xa1\x3e\x4b\x17\x5d\xf0\x42\xda\x26\x3b\x22\x39\x4a\x8b\x0e\x5a\x2b\x35\x07\x6b\x66\x0c\xb3\x19\xd1\x81\xe9\x25\x3b\x26\x68\x79\xeb\x1d\x8b\xab\x3d\x87\xe2\x6a\x4f\xb2\x88\xae\x68\x1b\x4f\xaf\x87\x4a\xc9\xc2\xe4\xb9\x4d\xf4\x99\xd2\xad\xc4\xbe\xa5\x97\x4c\x31\xa9\x21\xb6\x31\xb1\xf3\xe3\x41\x67\x9f\x23\xf5\xfa\x02\x5a\x7e\xab\x99\x33\x15\xc9\x33\xc5\x92\xcd\xf0\x88\x9d\x53\x9d\xeb\xdc\x7f\x34\x4e\xf8\xff\x8e\x39\xc4\xb6\xfc\x95\x80\x43\xf6\x36\xc9\x56\x38\xfb\x83\xe1\xb1\x52\x80\x1b\x44\xfb\xe3\xc3\x03\xba\x0e\xba\x96\x4f\xa7\x11\xf8\xaf\xe2\x5e\x4d\x13\x79\x05\x00\x0b\x3b\x9f\x0e\x27\xe7\xaa\x54\x99\x52\x66\x21\x90\xef\x95\x42\x71\xb8\x7c\x40\x87\xb3\x83\x51\xc0\x69\xe7\x71\x8b\xb7\x18\x8e\xb4\xc5\x39\xc2\x4c\x51\x2e\x28\xae\xb6\x2c\xd7\x2c\xee\xfb\xed\xd7\x0b\xa4\xf0\x44\xbe\x6a\xb7\x7b\x38\x54\x72\x74\x87\xe2\x54\xa4\x5b\x2c\xed\xfa\xf6\x3e\xdd\x27\x8d\xa6\x41\x0a\xfb\xf2\xc4\xb0\x71\x7d\x89\xba\xf3\x2c\x93\x49\x81\xdf\x23\xef\xf0\xb9\x62\x0a\x31\xbd\x47\x17\xac\xaa\x94\xcc\xfe\x3b\x00\x00\xff\xff\x07\xd9\x95\x3a\x78\x03\x00\x00") - -func route_twirp_eclier_routes_getLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_routes_getLua, - "route_twirp_eclier_routes_get.lua", - ) -} - -func route_twirp_eclier_routes_getLua() (*asset, error) { - bytes, err := route_twirp_eclier_routes_getLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_routes_get.lua", size: 888, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_routes_get_allLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x52\x4d\x6f\xdd\x20\x10\xbc\xf3\x2b\x46\x9c\x6c\xa9\xb6\x5e\x0f\xbd\x3c\xc9\xa7\x26\x87\x4a\x55\x22\x55\xe9\xa9\x89\x22\xc2\x5b\xdb\x28\x0e\xb8\xcb\xe2\xa4\xff\xbe\x02\xde\x57\x7b\x83\x9d\xd9\xd9\x19\x96\xae\xc3\xd7\x70\x20\x4c\xe4\x89\x8d\xd0\x01\x2f\x7f\xb0\x72\x90\x60\xbb\x89\x7c\x27\xef\x8e\xd7\x67\xb2\x8b\x23\xc6\xf6\xa5\xdf\xf5\xbb\x9b\x7b\xdc\xdd\x3f\xe0\xf6\xe6\xdb\x83\xea\x3a\xc4\x90\xd8\xd2\x1e\x1c\x92\x50\x5f\x5a\x95\x8a\x96\xdd\x2a\xfd\x46\xfc\x82\x01\xba\x60\x71\x3f\x91\x3c\x9b\x65\xd1\x27\x78\xa6\x65\xcd\xf0\xed\x07\xd9\x4c\xc0\x1b\xc9\x1c\x0e\x38\xf2\x10\x3c\x22\xf1\xe6\x2c\x55\xf5\x88\x31\x30\x8a\x25\xac\xc6\xbe\x9a\x89\xf0\x41\x99\xd2\xa7\xd8\x57\x03\x95\x78\x1e\x61\x92\xcc\x81\xf3\x90\x37\x63\x67\xe7\xa9\x3b\x27\xd5\x57\x2e\xa3\x0b\x3e\x93\x6a\xc2\x33\x92\x62\x1e\x31\x40\x6b\xa5\x96\x60\xcd\x82\x71\x31\x13\x06\x30\xfd\x4e\x8e\x09\x3a\xdf\xf5\x11\x8b\x9b\xbd\x86\xe2\x66\x2f\x6d\x11\x43\xe9\xed\x3d\xbd\x37\xad\xca\x0f\x97\xaf\x35\xd1\x9d\x5b\xd4\xff\x23\xc7\xb8\x2f\xc7\x4c\x1e\x93\xb7\x92\x1d\x72\xf2\x8d\xe1\xa9\x55\x80\x1b\x61\x78\xfa\xf5\xf9\x09\xc3\x00\xdd\xe5\xa7\xd4\x08\xfc\x4f\xf1\x58\x95\x99\xbc\x02\x80\x95\x9d\x97\xe6\xa2\xdc\x96\x2a\x93\x24\xce\x04\xf2\x07\xa5\x50\x14\x76\x4f\x18\x70\xb5\x44\x05\x5c\xf2\xc7\x6a\x6f\x35\x1c\xa9\xda\x39\xc3\x4c\x31\x6f\x34\x6e\xb6\x04\x35\xab\xfb\xf9\xe3\xfb\x27\x48\x78\x25\xdf\xee\xeb\x6e\x9a\xf6\xf4\x11\x9a\xa2\x56\xda\xab\xb5\xd3\x47\x79\x94\x47\xd1\xe8\x7b\x48\x88\xc2\xce\x4f\x4d\x16\x3e\xee\xb6\x6d\x55\x76\xfa\x37\x00\x00\xff\xff\xd4\xa1\xe0\x99\xba\x02\x00\x00") - -func route_twirp_eclier_routes_get_allLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_routes_get_allLua, - "route_twirp_eclier_routes_get_all.lua", - ) -} - -func route_twirp_eclier_routes_get_allLua() (*asset, error) { - bytes, err := route_twirp_eclier_routes_get_allLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_routes_get_all.lua", size: 698, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_routes_putLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\xcd\x6a\xdc\x3c\x14\xdd\xeb\x29\x0e\x5a\x8d\x21\x36\xf9\x16\xdf\xc6\xe0\x55\x93\x45\xa1\x34\x10\xd2\x55\x13\x8a\x22\x5f\xdb\x22\x8e\xe4\x5e\x49\x4e\xfa\xf6\xe5\xca\xce\xcc\xa4\x90\x2c\x0c\x96\xce\x8f\xce\xfd\xa9\x6b\x7c\x09\x3d\x61\x24\x4f\x6c\x12\xf5\x78\xfc\x83\x85\x43\x0a\xb6\x1e\xc9\xd7\xe9\xc5\xf1\xf2\x8b\xec\xec\x88\xb1\xfe\xdf\x5c\x36\x97\x57\x37\xf8\x7e\x73\x87\xeb\xab\xaf\x77\xaa\xae\x11\x43\x66\x4b\x2d\x38\xe4\x44\x4d\x91\x2a\x15\x2d\xbb\x25\x35\x2b\xf1\x23\x3a\xe8\x82\xc5\x76\xc9\x49\xbf\x41\x13\xcd\x8b\x40\xd7\xaf\x64\x05\xc4\x33\xa5\x29\xf4\x58\x72\x42\xf0\x88\xc4\xab\xb3\xb4\xb9\x46\x0c\x81\x51\xa2\x60\x31\xf6\xc9\x8c\x84\x57\x12\x4a\x93\x63\xb3\x3d\xbc\x11\x8f\xf6\x26\xa7\x29\xb0\x3c\xf0\x6c\xec\xe4\x3c\xd5\xc7\x0a\xf5\x59\xba\xe8\x82\x17\xd2\x56\xd9\x11\xc9\x51\x9e\xe8\xa0\xb5\x52\x73\xb0\x66\xc6\x30\x9b\x11\x1d\x98\x7e\x67\xc7\x04\x2d\x67\xbd\x63\x71\xb5\xe7\x50\x5c\xed\x49\x16\xd1\x15\x6d\xe3\xe9\xe5\x50\x29\x69\x98\x1c\xb7\x8a\x6e\x25\xb3\x1a\x62\x1b\x13\x3b\x3f\x1e\xf4\x14\x62\xd2\x17\xd0\xf2\xad\x66\xce\x54\x68\xcf\x14\x4b\x1e\xc3\x23\x0a\xa3\x3a\xd7\xb8\xfe\x73\x85\xeb\xdf\xf3\x2d\x93\x49\x81\x3f\x17\xbd\x91\x2a\xf5\x6f\x4b\x86\xd8\x96\x5f\x29\x66\xc8\xde\x26\xe9\x20\x67\x7f\x30\x3c\x56\x0a\x70\x83\x18\xfc\xfc\xef\x01\x5d\x07\x5d\xcb\x98\x35\x02\xbf\xbb\xdc\x6f\xd3\x44\x5e\x01\xc0\xc2\xce\xa7\xc3\xc9\xb9\x2a\xb7\x4c\x29\xb3\x10\xc8\xf7\x4a\xa1\x38\x5c\x3e\xa0\xc3\xd9\x72\x29\xe0\x34\x9f\xb8\xc5\x5b\x0c\x47\xda\xe2\x1c\x61\xa6\x28\xdb\x16\x57\x5b\x06\x61\x16\xf7\xe3\xf6\xdb\x05\x52\x78\x22\x5f\xb5\xdb\xee\x1c\x2a\x59\xd0\x43\x71\x2a\xd2\x2d\x96\x76\x7d\x7b\x9f\xee\x93\x46\xd3\x20\x85\xbd\x8d\x62\xd8\xb8\xbe\x44\xdd\x79\x7b\xcf\x3e\x22\xef\xf0\xb9\x42\x86\xf9\x11\x5d\xb0\xaa\x52\x52\xfb\xdf\x00\x00\x00\xff\xff\x86\x08\x46\x8f\xa4\x03\x00\x00") - -func route_twirp_eclier_routes_putLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_routes_putLua, - "route_twirp_eclier_routes_put.lua", - ) -} - -func route_twirp_eclier_routes_putLua() (*asset, error) { - bytes, err := route_twirp_eclier_routes_putLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_routes_put.lua", size: 932, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_tokens_deactivateLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x92\x41\x6f\xdb\x30\x0c\x85\xef\xfa\x15\x0f\x3a\xd9\x40\x6c\x64\x87\x5d\x02\xf8\xb4\xf6\x30\x60\x58\x81\x21\x3b\x0d\xc5\xa0\xc8\xb4\x23\xd4\x91\x3c\x52\x72\xdb\x7f\x3f\x48\xce\x92\x74\x40\x7b\xb3\xc9\xef\x91\x8f\x14\x9b\x06\x5f\x42\x4f\x18\xc9\x13\x9b\x48\x3d\x0e\xaf\x98\x39\xc4\x60\x9b\x91\x7c\x13\x9f\x1d\xcf\xbf\xc9\x4e\x8e\x18\xcb\xe7\x76\xdb\x6e\xef\x1e\xf0\xfd\x61\x8f\xfb\xbb\xaf\x7b\xd5\x34\x90\x90\xd8\xd2\x0e\x1c\x52\xa4\xb6\x48\x95\x12\xcb\x6e\x8e\xed\x42\x7c\x40\x07\x1d\xc3\x13\x79\xd9\xf5\x64\x6c\x74\x8b\x89\xa4\xff\x11\x47\x9a\xe6\x4c\xdc\xbf\x90\x4d\x91\x04\x27\x8a\xc7\xd0\xe3\x8a\x22\x78\x08\xf1\xe2\x2c\x61\xad\x83\x21\x30\x8a\x31\xcc\xc6\x3e\x99\x91\xf0\x42\x19\x69\x93\xb4\xab\x8d\x15\xbc\x74\x31\x29\x1e\x03\xe7\x3e\x27\x63\x8f\xce\x53\x73\x99\x57\xdf\x78\x15\x17\x7c\x86\xd6\x39\x2f\x99\x24\xb9\x45\x07\xad\x95\x9a\x82\x35\x13\x86\xc9\x8c\xe8\xc0\xf4\x27\x39\x26\xe8\xfc\xaf\xcf\x39\x59\xec\x6d\x4a\x16\x7b\x95\x09\xba\xa2\x6d\x3d\x3d\x57\xb5\xca\xeb\xcb\xbf\xeb\x44\xfb\xec\x59\x0d\xb2\x3b\x84\x30\x55\xba\xcc\x4f\x7a\x83\xc1\x4c\x42\x1b\xe8\xc5\x4c\x89\x0a\x79\x22\x29\x96\x0c\x8f\x38\x63\x75\x16\x4a\x64\xe7\xc7\x4a\xbb\x5e\x6f\xa0\xf5\xbb\x1a\xd7\xbf\xe5\x0f\xa1\x7f\xfd\x58\x51\x88\x1b\x8d\x54\x5a\x6c\x98\x49\xde\x97\x9c\xf3\xb5\xfa\x7f\x8d\x83\xec\xca\x67\x5e\xc0\x90\xbc\x8d\x79\xeb\x9c\x7c\x65\x78\xac\x15\xe0\x86\xac\xff\xf5\xe9\x11\x5d\x07\xdd\xe4\x0b\xd1\x08\xfc\x26\x78\x8e\xc6\x23\x79\x05\x00\x33\x3b\x1f\xab\x6b\xe5\xba\x44\x99\x62\xe2\x0c\x90\xef\x95\x42\xa9\xb0\x7d\x44\x87\x9b\xf3\x54\xc0\xf5\x4d\x65\xb5\x37\x1b\x16\x5a\xed\x5c\xd2\x4c\x92\x0f\x55\x16\x5b\x1e\xcf\xcc\xee\xe7\x8f\x6f\x9b\xf5\x22\xeb\xdd\x7a\x6f\x55\x7d\x73\xe2\x55\x29\x58\x2b\x95\x9b\xff\x0d\x00\x00\xff\xff\x41\x42\x7e\x72\x67\x03\x00\x00") - -func route_twirp_eclier_tokens_deactivateLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_tokens_deactivateLua, - "route_twirp_eclier_tokens_deactivate.lua", - ) -} - -func route_twirp_eclier_tokens_deactivateLua() (*asset, error) { - bytes, err := route_twirp_eclier_tokens_deactivateLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_tokens_deactivate.lua", size: 871, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_tokens_deleteLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x52\xc1\x6a\xdc\x30\x10\xbd\xeb\x2b\x1e\x3a\xd9\x10\x9b\xed\xa1\x97\x05\x9f\x9a\x1c\x0a\xa5\x81\xb2\x3d\x95\x50\xb4\xf2\xd8\x2b\xe2\x95\xdc\x19\xc9\x49\xfe\xbe\x48\xde\xee\xba\x85\xf4\x60\xb0\xf4\xde\x9b\x79\x33\x7a\x4d\x83\x4f\xa1\x27\x8c\xe4\x89\x4d\xa4\x1e\xc7\x37\xcc\x1c\x62\xb0\xcd\x48\xbe\x89\x2f\x8e\xe7\x9f\x64\x27\x47\x8c\xe5\x63\xbb\x6b\x77\xf7\x8f\xf8\xfa\x78\xc0\xc3\xfd\xe7\x83\x6a\x1a\x48\x48\x6c\x69\x0f\x0e\x29\x52\x5b\xa4\x4a\x89\x65\x37\xc7\x76\x21\x3e\xa2\x83\x8e\xe1\x99\xbc\xec\x7b\x9a\x28\x92\xfe\x83\x9e\x68\x9a\x33\xfa\xf0\x4a\x36\x45\x12\x9c\x29\x9e\x42\x8f\x95\x86\xe0\x21\xc4\x8b\xb3\x84\x55\x8f\x21\x30\x8a\x21\xcc\xc6\x3e\x9b\x91\xf0\x4a\x99\xd2\x26\x69\xd7\xf6\x2b\xf1\xda\xc1\xa4\x78\x0a\x9c\x7b\x9c\x8d\x3d\x39\x4f\xcd\x75\x4e\xbd\xf1\x28\x2e\xf8\x4c\x5a\xe7\xbb\x22\x49\x72\x8b\x0e\x5a\x2b\x35\x05\x6b\x26\x0c\x93\x19\xd1\x81\xe9\x57\x72\x4c\xd0\xf9\xac\x2f\x98\x2c\x76\x0b\xc9\x62\x6f\x32\x41\x57\xb4\xad\xa7\x97\xaa\x56\x79\x6d\xf9\xb8\x4e\x74\xc8\x9e\xd5\x20\x7b\x89\xec\xfc\x58\x69\xd7\xeb\x3b\xe8\xfc\x2d\x66\x4a\x54\x48\x67\x92\xe2\xc6\xf0\x08\xd7\xeb\x7a\xcb\x3f\x86\xfe\xed\xff\x8a\xc2\xd8\x68\xa4\xd2\x62\xc3\x4c\xf2\xbe\xe4\x82\x17\xd1\x31\x84\xa9\xd2\xc6\x46\xb7\x90\xbe\xc3\x60\x26\xa1\x77\x85\x17\x5a\xad\xfe\x5d\xe3\x20\xfb\xf2\x9b\x17\x30\x24\x6f\x63\xde\x3a\x27\x5f\x19\x1e\x6b\x05\xb8\x21\xeb\x7f\x7c\x78\x42\xd7\x41\x37\x39\x1d\x1a\x81\xff\xba\xbc\xdc\xc6\x13\x79\x05\x00\x33\x3b\x1f\xab\x5b\xe5\xba\xdc\x32\xc5\xc4\x99\x40\xbe\x57\x0a\xa5\xc2\xee\x09\x1d\x36\xb1\x54\xc0\xed\x4d\x65\xb5\x37\x1b\x16\x5a\xed\x5c\x61\x26\xc9\x21\x95\xc5\x96\xc7\x33\xb3\xfb\xfe\xed\xcb\xdd\x9a\xc8\x7a\xbf\xe6\xad\xaa\x2f\xd1\xae\x4a\xb1\x5a\xa9\xdc\xf8\x77\x00\x00\x00\xff\xff\x50\xe4\x70\xe6\x5b\x03\x00\x00") - -func route_twirp_eclier_tokens_deleteLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_tokens_deleteLua, - "route_twirp_eclier_tokens_delete.lua", - ) -} - -func route_twirp_eclier_tokens_deleteLua() (*asset, error) { - bytes, err := route_twirp_eclier_tokens_deleteLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_tokens_delete.lua", size: 859, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_tokens_getLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x92\x41\x6b\xdc\x3e\x10\xc5\xef\xfa\x14\x0f\x9d\x6c\x88\x4d\xfe\x87\xff\xc5\xe0\x53\x13\x4a\xa1\x34\x10\xb6\xa7\x26\x14\xad\x3c\xf6\x8a\x78\x25\x67\x24\x39\xc9\xb7\x2f\x92\xb6\xbb\x6e\x61\x7b\x58\x58\xe9\xfd\xde\xe8\xcd\x78\x9a\x06\x9f\xdc\x40\x98\xc8\x12\xab\x40\x03\xf6\x1f\x58\xd8\x05\xa7\x9b\x89\x6c\x13\xde\x0c\x2f\x3f\x49\xcf\x86\x18\xeb\xff\xed\x6d\x7b\x7b\xf7\x80\x6f\x0f\x3b\xdc\xdf\x7d\xd9\x89\xa6\x81\x77\x91\x35\x75\x60\x17\x03\xb5\xd9\x2a\x84\xd7\x6c\x96\xd0\xae\xc4\x7b\xf4\x90\xc1\xbd\x90\xf5\xdd\x44\x41\xfe\x96\x0e\x34\x2f\x49\xba\x7f\x27\x1d\x03\x79\x1c\x29\x1c\xdc\x80\x89\x02\x9c\x85\x27\x5e\x8d\x26\x14\x27\x46\xc7\xc8\x51\xb0\x28\xfd\xa2\x26\xc2\x3b\x25\xa4\x8d\xbe\x2d\x0f\x17\xf0\x5c\x5e\xc5\x70\x70\x9c\x1e\x38\x2a\x7d\x30\x96\x9a\x73\x87\x72\x93\xce\x1b\x67\x13\x54\x3a\x3b\x2b\xd1\xa7\x27\x7a\x48\x29\xc4\xec\xb4\x9a\x31\xce\x6a\x42\x0f\xa6\xd7\x68\x98\x20\xd3\x59\x9e\x34\xbf\xea\xad\xe4\x57\x7d\xb1\x79\xf4\xd9\xdb\x5a\x7a\xab\x6a\x91\x06\x96\x8e\xa5\xa3\xcf\x14\x76\x29\xf6\x23\xbd\x46\xf2\x41\x8c\xbe\xf3\x81\x8d\x9d\x2a\x69\x06\x79\x03\x99\x7e\xab\x9a\x23\x65\xfc\x48\x3e\xe7\x52\x3c\xc1\x0c\xb2\xde\xf2\xb9\xfd\x7f\x5b\x0a\x52\x8b\xbf\x9b\x1c\x7d\x97\xff\xa6\x78\x63\xb4\x3a\xa4\x99\x70\xb4\x95\xe2\xa9\x16\x80\x19\x93\xfd\xc7\x7f\xcf\xe8\x7b\xc8\x26\x7d\x38\x09\xc7\x7f\x5c\x9e\x6e\xc3\x81\xac\x00\x80\x85\x8d\x0d\xd5\xa5\x72\x9d\x6f\x99\x42\xe4\x04\x90\x1d\x84\x40\xae\x70\xfb\x8c\x1e\x9b\x75\x11\xc0\x65\xe2\xbe\xc4\x5b\x14\x7b\x2a\x71\xce\x32\x93\x4f\xfb\xe3\x57\x9d\x47\xab\x16\xf3\xfd\xf1\xeb\x4d\x69\xb2\xee\xca\x36\x54\x75\x5a\xb9\x2a\x57\xca\xd6\x12\x4b\x9a\xa1\x7b\x0a\x4f\x41\xa2\x6d\x11\xdc\x69\x84\xa9\x60\x6b\x86\x1c\xf5\xc4\xed\xdd\xf0\x71\x8d\x4c\xda\x96\xf5\xda\x2d\xe4\xaf\xd1\x45\xdd\xf2\x4a\x07\xb3\xd2\x35\xbe\xa8\x75\x2d\xd2\xa4\x7e\x05\x00\x00\xff\xff\x6f\x53\x96\xcd\xa4\x03\x00\x00") - -func route_twirp_eclier_tokens_getLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_tokens_getLua, - "route_twirp_eclier_tokens_get.lua", - ) -} - -func route_twirp_eclier_tokens_getLua() (*asset, error) { - bytes, err := route_twirp_eclier_tokens_getLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_tokens_get.lua", size: 932, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_tokens_get_allLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x5c\x52\x4d\x6f\xdd\x20\x10\xbc\xf3\x2b\x46\x9c\x6c\xa9\xb6\x5e\x0f\xbd\x3c\xc9\xa7\x26\x87\x4a\x55\x22\x55\xe9\xa9\x89\x22\xc2\x5b\xdb\x28\x0e\xb8\xcb\xe2\xa4\xff\xbe\x02\xde\x57\x7b\x83\x9d\xd9\xdd\x19\x86\xae\xc3\xd7\x70\x20\x4c\xe4\x89\x8d\xd0\x01\x2f\x7f\xb0\x72\x90\x60\xbb\x89\x7c\x27\xef\x8e\xd7\x67\xb2\x8b\x23\xc6\xf6\xa5\xdf\xf5\xbb\x9b\x7b\xdc\xdd\x3f\xe0\xf6\xe6\xdb\x83\xea\x3a\xc4\x90\xd8\xd2\x1e\x1c\x92\x50\x5f\x5a\x95\x8a\x96\xdd\x2a\xfd\x46\xfc\x82\x01\x5a\xc2\x2b\xf9\xb8\x9f\x48\x9e\xcd\xb2\xe8\x13\x3c\xd3\xb2\x66\xf8\xf6\x83\x6c\x12\x8a\x78\x23\x99\xc3\x01\x47\x1e\x82\x47\x24\xde\x9c\x25\xd4\x09\x18\x03\xa3\x48\xc2\x6a\xec\xab\x99\x08\x1f\x94\x29\x7d\x8a\x7d\x15\x50\x89\xe7\x15\x26\xc9\x1c\x38\x2f\x79\x33\x76\x76\x9e\xba\xb3\x53\x7d\xa5\x32\xba\xe0\x33\xa9\x3a\x3c\x23\x29\xe6\x15\x03\xb4\x56\x6a\x09\xd6\x2c\x18\x17\x33\x61\x00\xd3\xef\xe4\x98\xa0\xf3\x5d\x1f\xb1\xb8\xd9\x6b\x28\x6e\xf6\xd2\x16\x31\x94\xde\xde\xd3\x7b\xd3\xaa\xfc\x70\xf9\x5a\x1d\xdd\xb9\x45\xfd\xbf\x72\x8c\xfb\x72\xcc\xe4\x31\x79\x2b\x59\x21\x27\xdf\x18\x9e\x5a\x05\xb8\x11\x86\xa7\x5f\x9f\x9f\x30\x0c\xd0\x5d\x7e\x4a\x8d\xc0\xff\x14\x8f\x55\x99\xc9\x2b\x00\x58\xd9\x79\x69\x2e\x93\xdb\x52\x65\x92\xc4\x99\x40\xfe\xa0\x14\xca\x84\xdd\x13\x06\x5c\x85\xa8\x80\x8b\xff\x58\xe5\xad\x86\x23\x55\x39\x67\x98\x29\xe6\x44\xe3\x66\x8b\x51\xb3\xba\x9f\x3f\xbe\x7f\xaa\xe9\xb5\xfb\x9a\x4d\xd3\x9e\x3e\x42\x53\xa6\x95\xf6\x2a\xed\xf4\x51\x1e\xe5\x51\x34\xfa\x1e\x12\xa2\xb0\xf3\x53\x93\x07\x1f\xb3\x6d\x5b\x95\x95\xfe\x0d\x00\x00\xff\xff\xe9\x8f\x90\xdc\xba\x02\x00\x00") - -func route_twirp_eclier_tokens_get_allLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_tokens_get_allLua, - "route_twirp_eclier_tokens_get_all.lua", - ) -} - -func route_twirp_eclier_tokens_get_allLua() (*asset, error) { - bytes, err := route_twirp_eclier_tokens_get_allLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_tokens_get_all.lua", size: 698, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -var _route_twirp_eclier_tokens_putLua = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x7c\x92\x41\x6b\xdc\x30\x10\x85\xef\xfa\x15\x0f\x9d\x6c\x88\x4d\x7a\xe8\xc5\xe0\x53\x93\x43\xa1\x34\x50\xd2\x53\x13\x8a\x56\x1e\x7b\x45\xbc\x92\xab\x91\x9c\xe4\xdf\x17\x49\xee\xae\x5b\xd8\x1e\x16\xd6\x7a\xdf\x1b\x3d\xcd\x4c\xd3\xe0\x93\x1b\x08\x13\x59\xf2\x2a\xd0\x80\xc3\x3b\x16\xef\x82\xd3\xcd\x44\xb6\x09\xaf\xc6\x2f\x3f\x49\xcf\x86\x3c\xd6\x8f\xed\x6d\x7b\x7b\xf7\x80\xaf\x0f\x8f\xb8\xbf\xfb\xfc\x28\x9a\x06\xec\xa2\xd7\xd4\xc1\xbb\x18\xa8\xcd\x56\x21\x58\x7b\xb3\x84\x76\x25\x7f\x40\x0f\x19\xdc\x0b\x59\xee\x96\x18\xe4\x1f\xe9\x48\xf3\x92\xa4\xfb\x37\xd2\x31\x10\xe3\x44\xe1\xe8\x06\x2c\x31\xc0\x59\x30\xf9\xd5\x68\x42\x71\x62\x74\x1e\x39\x0a\x16\xa5\x5f\xd4\x44\x78\xa3\x84\xb4\x91\xdb\x72\x71\x01\xcf\xe5\x55\x0c\x47\xe7\xd3\x05\x27\xa5\x8f\xc6\x52\x73\x7e\xa1\xdc\xa5\x63\xe3\x6c\x82\xca\xcb\xce\x4a\xe4\x74\x45\x0f\x29\x85\x98\x9d\x56\x33\xc6\x59\x4d\xe8\xe1\xe9\x57\x34\x9e\x20\xd3\xb7\xdc\x34\x5e\xf5\x5e\xe2\x55\x5f\x6c\x8c\x3e\x7b\x5b\x4b\xaf\x55\x2d\x52\xc3\xd2\x67\x79\xd1\x63\xca\x2c\x46\xee\x38\x78\x63\xa7\x4a\x9a\x41\xde\x40\xa6\xdf\xaa\xe6\x48\x19\x3a\x11\xe7\x34\xca\x4f\x30\x83\xac\xf7\xfc\xc1\x0d\xef\xff\x77\x64\x62\xe7\xe1\x4a\xb2\x76\x0b\xf1\x75\xcb\xa6\x67\xd3\xc1\xb9\xb9\x92\x4a\x07\xb3\x92\xbc\xc1\xa8\x66\xa6\xab\xc6\x0d\xab\xc5\xbf\x6d\x1c\xb9\xcb\x7f\x53\x03\xc6\x68\x75\x48\x5d\xf7\xd1\x56\xca\x4f\xb5\x00\xcc\x98\xfc\x3f\x3e\x3c\xa3\xef\x21\x9b\xb4\x1a\x12\xce\xff\x75\xb8\x9d\x86\x23\x59\x01\x00\x8b\x37\x36\x54\x97\xca\x75\x3e\xf5\x14\xa2\x4f\x00\xd9\x41\x08\xe4\x0a\xb7\xcf\xe8\xb1\x5b\x48\x01\x5c\x66\xca\x25\xde\xa2\x3c\x53\x89\x73\x96\x3d\x71\xda\x50\x5e\x75\x1e\x9e\x5a\xcc\xf7\x6f\x5f\x6e\xca\x46\xd6\x5d\xd9\xb7\xaa\x4e\x4b\x5d\xe5\x4a\xd9\x5a\x62\x49\x33\x74\x4f\xe1\x29\x48\xb4\x2d\x82\xdb\xc6\x95\x0a\xb6\x66\xc8\x51\x37\x2e\x8d\xe7\x1a\x99\xb4\x3d\x5b\xe6\x72\x8d\x2e\xea\x9e\x2f\xe3\xb8\xc6\x17\xb5\xae\x45\xea\xd4\xef\x00\x00\x00\xff\xff\x38\x3f\xda\x56\x06\x04\x00\x00") - -func route_twirp_eclier_tokens_putLuaBytes() ([]byte, error) { - return bindataRead( - _route_twirp_eclier_tokens_putLua, - "route_twirp_eclier_tokens_put.lua", - ) -} - -func route_twirp_eclier_tokens_putLua() (*asset, error) { - bytes, err := route_twirp_eclier_tokens_putLuaBytes() - if err != nil { - return nil, err - } - - info := bindataFileInfo{name: "route_twirp_eclier_tokens_put.lua", size: 1030, mode: os.FileMode(420), modTime: time.Unix(1516605524, 0)} - a := &asset{bytes: bytes, info: info} - return a, nil -} - -// Asset loads and returns the asset for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func Asset(name string) ([]byte, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("Asset %s can't read by error: %v", name, err) - } - return a.bytes, nil - } - return nil, fmt.Errorf("Asset %s not found", name) -} - -// MustAsset is like Asset but panics when Asset would return an error. -// It simplifies safe initialization of global variables. -func MustAsset(name string) []byte { - a, err := Asset(name) - if err != nil { - panic("asset: Asset(" + name + "): " + err.Error()) - } - - return a -} - -// AssetInfo loads and returns the asset info for the given name. -// It returns an error if the asset could not be found or -// could not be loaded. -func AssetInfo(name string) (os.FileInfo, error) { - cannonicalName := strings.Replace(name, "\\", "/", -1) - if f, ok := _bindata[cannonicalName]; ok { - a, err := f() - if err != nil { - return nil, fmt.Errorf("AssetInfo %s can't read by error: %v", name, err) - } - return a.info, nil - } - return nil, fmt.Errorf("AssetInfo %s not found", name) -} - -// AssetNames returns the names of the assets. -func AssetNames() []string { - names := make([]string, 0, len(_bindata)) - for name := range _bindata { - names = append(names, name) - } - return names -} - -// _bindata is a table, holding each asset generator, mapped to its name. -var _bindata = map[string]func() (*asset, error){ - "route_twirp_eclier_backends_kill.lua": route_twirp_eclier_backends_killLua, - "route_twirp_eclier_backends_list.lua": route_twirp_eclier_backends_listLua, - "route_twirp_eclier_routes_delete.lua": route_twirp_eclier_routes_deleteLua, - "route_twirp_eclier_routes_get.lua": route_twirp_eclier_routes_getLua, - "route_twirp_eclier_routes_get_all.lua": route_twirp_eclier_routes_get_allLua, - "route_twirp_eclier_routes_put.lua": route_twirp_eclier_routes_putLua, - "route_twirp_eclier_tokens_deactivate.lua": route_twirp_eclier_tokens_deactivateLua, - "route_twirp_eclier_tokens_delete.lua": route_twirp_eclier_tokens_deleteLua, - "route_twirp_eclier_tokens_get.lua": route_twirp_eclier_tokens_getLua, - "route_twirp_eclier_tokens_get_all.lua": route_twirp_eclier_tokens_get_allLua, - "route_twirp_eclier_tokens_put.lua": route_twirp_eclier_tokens_putLua, -} - -// AssetDir returns the file names below a certain -// directory embedded in the file by go-bindata. -// For example if you run go-bindata on data/... and data contains the -// following hierarchy: -// data/ -// foo.txt -// img/ -// a.png -// b.png -// then AssetDir("data") would return []string{"foo.txt", "img"} -// AssetDir("data/img") would return []string{"a.png", "b.png"} -// AssetDir("foo.txt") and AssetDir("notexist") would return an error -// AssetDir("") will return []string{"data"}. -func AssetDir(name string) ([]string, error) { - node := _bintree - if len(name) != 0 { - cannonicalName := strings.Replace(name, "\\", "/", -1) - pathList := strings.Split(cannonicalName, "/") - for _, p := range pathList { - node = node.Children[p] - if node == nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - } - } - if node.Func != nil { - return nil, fmt.Errorf("Asset %s not found", name) - } - rv := make([]string, 0, len(node.Children)) - for childName := range node.Children { - rv = append(rv, childName) - } - return rv, nil -} - -type bintree struct { - Func func() (*asset, error) - Children map[string]*bintree -} -var _bintree = &bintree{nil, map[string]*bintree{ - "route_twirp_eclier_backends_kill.lua": &bintree{route_twirp_eclier_backends_killLua, map[string]*bintree{}}, - "route_twirp_eclier_backends_list.lua": &bintree{route_twirp_eclier_backends_listLua, map[string]*bintree{}}, - "route_twirp_eclier_routes_delete.lua": &bintree{route_twirp_eclier_routes_deleteLua, map[string]*bintree{}}, - "route_twirp_eclier_routes_get.lua": &bintree{route_twirp_eclier_routes_getLua, map[string]*bintree{}}, - "route_twirp_eclier_routes_get_all.lua": &bintree{route_twirp_eclier_routes_get_allLua, map[string]*bintree{}}, - "route_twirp_eclier_routes_put.lua": &bintree{route_twirp_eclier_routes_putLua, map[string]*bintree{}}, - "route_twirp_eclier_tokens_deactivate.lua": &bintree{route_twirp_eclier_tokens_deactivateLua, map[string]*bintree{}}, - "route_twirp_eclier_tokens_delete.lua": &bintree{route_twirp_eclier_tokens_deleteLua, map[string]*bintree{}}, - "route_twirp_eclier_tokens_get.lua": &bintree{route_twirp_eclier_tokens_getLua, map[string]*bintree{}}, - "route_twirp_eclier_tokens_get_all.lua": &bintree{route_twirp_eclier_tokens_get_allLua, map[string]*bintree{}}, - "route_twirp_eclier_tokens_put.lua": &bintree{route_twirp_eclier_tokens_putLua, map[string]*bintree{}}, -}} - -// RestoreAsset restores an asset under the given directory -func RestoreAsset(dir, name string) error { - data, err := Asset(name) - if err != nil { - return err - } - info, err := AssetInfo(name) - if err != nil { - return err - } - err = os.MkdirAll(_filePath(dir, filepath.Dir(name)), os.FileMode(0755)) - if err != nil { - return err - } - err = ioutil.WriteFile(_filePath(dir, name), data, info.Mode()) - if err != nil { - return err - } - err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime()) - if err != nil { - return err - } - return nil -} - -// RestoreAssets restores an asset under the given directory recursively -func RestoreAssets(dir, name string) error { - children, err := AssetDir(name) - // File - if err != nil { - return RestoreAsset(dir, name) - } - // Dir - for _, child := range children { - err = RestoreAssets(dir, filepath.Join(name, child)) - if err != nil { - return err - } - } - return nil -} - -func _filePath(dir, name string) string { - cannonicalName := strings.Replace(name, "\\", "/", -1) - return filepath.Join(append([]string{dir}, strings.Split(cannonicalName, "/")...)...) -} - diff --git a/proto/eclier/route_twirp_eclier_backends_kill.lua b/proto/eclier/route_twirp_eclier_backends_kill.lua deleted file mode 100644 index e4029f0..0000000 --- a/proto/eclier/route_twirp_eclier_backends_kill.lua +++ /dev/null @@ -1,31 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "backends:kill" -script.help = "Executes method kill on service backends for twirp package xeserv.us.route.backends" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for BackendId -fs:string("id", "", "value for message arg id") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):backends():kill(flags) - -end diff --git a/proto/eclier/route_twirp_eclier_backends_list.lua b/proto/eclier/route_twirp_eclier_backends_list.lua deleted file mode 100644 index fc4cf50..0000000 --- a/proto/eclier/route_twirp_eclier_backends_list.lua +++ /dev/null @@ -1,34 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "backends:list" -script.help = "Executes method list on service backends for twirp package xeserv.us.route.backends" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for BackendSelector -fs:string("domain", "", "value for message arg domain") -fs:string("user", "", "value for message arg user") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):backends():list(flags) - - print("bs:\t\t" .. tostring(resp.bs)) - print("backends:\t\t" .. tostring(resp.backends)) -end diff --git a/proto/eclier/route_twirp_eclier_routes_delete.lua b/proto/eclier/route_twirp_eclier_routes_delete.lua deleted file mode 100644 index 7e417c9..0000000 --- a/proto/eclier/route_twirp_eclier_routes_delete.lua +++ /dev/null @@ -1,33 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "routes:delete" -script.help = "Executes method delete on service routes for twirp package xeserv.us.route.routes" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Route -fs:string("id", "", "value for message arg id") -fs:string("creator", "", "value for message arg creator") -fs:string("host", "", "value for message arg host") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):routes():delete(flags) - -end diff --git a/proto/eclier/route_twirp_eclier_routes_get.lua b/proto/eclier/route_twirp_eclier_routes_get.lua deleted file mode 100644 index 454fe06..0000000 --- a/proto/eclier/route_twirp_eclier_routes_get.lua +++ /dev/null @@ -1,35 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "routes:get" -script.help = "Executes method get on service routes for twirp package xeserv.us.route.routes" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for GetRouteRequest -fs:string("unused", "", "value for message arg unused") -fs:string("id", "", "value for message arg id") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):routes():get(flags) - - print("id:\t\t" .. tostring(resp.id)) - print("creator:\t\t" .. tostring(resp.creator)) - print("host:\t\t" .. tostring(resp.host)) -end diff --git a/proto/eclier/route_twirp_eclier_routes_get_all.lua b/proto/eclier/route_twirp_eclier_routes_get_all.lua deleted file mode 100644 index a29d64f..0000000 --- a/proto/eclier/route_twirp_eclier_routes_get_all.lua +++ /dev/null @@ -1,31 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "routes:get_all" -script.help = "Executes method get_all on service routes for twirp package xeserv.us.route.routes" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Nil - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):routes():get_all(flags) - - print("routes:\t\t" .. tostring(resp.routes)) -end diff --git a/proto/eclier/route_twirp_eclier_routes_put.lua b/proto/eclier/route_twirp_eclier_routes_put.lua deleted file mode 100644 index 21a5446..0000000 --- a/proto/eclier/route_twirp_eclier_routes_put.lua +++ /dev/null @@ -1,36 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "routes:put" -script.help = "Executes method put on service routes for twirp package xeserv.us.route.routes" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Route -fs:string("host", "", "value for message arg host") -fs:string("id", "", "value for message arg id") -fs:string("creator", "", "value for message arg creator") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):routes():put(flags) - - print("id:\t\t" .. tostring(resp.id)) - print("creator:\t\t" .. tostring(resp.creator)) - print("host:\t\t" .. tostring(resp.host)) -end diff --git a/proto/eclier/route_twirp_eclier_tokens_deactivate.lua b/proto/eclier/route_twirp_eclier_tokens_deactivate.lua deleted file mode 100644 index 7661224..0000000 --- a/proto/eclier/route_twirp_eclier_tokens_deactivate.lua +++ /dev/null @@ -1,34 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "tokens:deactivate" -script.help = "Executes method deactivate on service tokens for twirp package xeserv.us.route.tokens" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Token -fs:bool("active", false, "value for message arg active") -fs:string("id", "", "value for message arg id") -fs:string("body", "", "value for message arg body") -fs:strings("scopes", "value for message arg scopes") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):tokens():deactivate(flags) - -end diff --git a/proto/eclier/route_twirp_eclier_tokens_delete.lua b/proto/eclier/route_twirp_eclier_tokens_delete.lua deleted file mode 100644 index 66f1451..0000000 --- a/proto/eclier/route_twirp_eclier_tokens_delete.lua +++ /dev/null @@ -1,34 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "tokens:delete" -script.help = "Executes method delete on service tokens for twirp package xeserv.us.route.tokens" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Token -fs:string("id", "", "value for message arg id") -fs:string("body", "", "value for message arg body") -fs:strings("scopes", "value for message arg scopes") -fs:bool("active", false, "value for message arg active") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):tokens():delete(flags) - -end diff --git a/proto/eclier/route_twirp_eclier_tokens_get.lua b/proto/eclier/route_twirp_eclier_tokens_get.lua deleted file mode 100644 index cd3d3d4..0000000 --- a/proto/eclier/route_twirp_eclier_tokens_get.lua +++ /dev/null @@ -1,36 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "tokens:get" -script.help = "Executes method get on service tokens for twirp package xeserv.us.route.tokens" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for GetTokenRequest -fs:string("id", "", "value for message arg id") -fs:string("token", "", "value for message arg token") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):tokens():get(flags) - - print("id:\t\t" .. tostring(resp.id)) - print("body:\t\t" .. tostring(resp.body)) - print("scopes:\t\t" .. tostring(resp.scopes)) - print("active:\t\t" .. tostring(resp.active)) -end diff --git a/proto/eclier/route_twirp_eclier_tokens_get_all.lua b/proto/eclier/route_twirp_eclier_tokens_get_all.lua deleted file mode 100644 index 37ef46d..0000000 --- a/proto/eclier/route_twirp_eclier_tokens_get_all.lua +++ /dev/null @@ -1,31 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "tokens:get_all" -script.help = "Executes method get_all on service tokens for twirp package xeserv.us.route.tokens" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Nil - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):tokens():get_all(flags) - - print("tokens:\t\t" .. tostring(resp.tokens)) -end diff --git a/proto/eclier/route_twirp_eclier_tokens_put.lua b/proto/eclier/route_twirp_eclier_tokens_put.lua deleted file mode 100644 index 8a456b4..0000000 --- a/proto/eclier/route_twirp_eclier_tokens_put.lua +++ /dev/null @@ -1,38 +0,0 @@ --- Code generated by protoc-gen-twirp_eclier v5.0.0DO NOT EDIT --- source: route.proto - -script.verb = "tokens:put" -script.help = "Executes method put on service tokens for twirp package xeserv.us.route.tokens" -script.author = "machine-generated" -script.version = "v5.0.0" -script.usage = "" - -local flag = require "flag" -local svc = require "svc" - -local fs = flag.new() - --- flags for Token -fs:string("id", "", "value for message arg id") -fs:string("body", "", "value for message arg body") -fs:strings("scopes", "value for message arg scopes") -fs:bool("active", false, "value for message arg active") - -script.usage = fs:usage() - -function run(arg) - if arg[1] == "-help" or arg[1] == "--help" then - print(fs:usage()) - return - end - - arg[0] = script.verb - local flags = fs:parse(arg) - - local resp = svc.new(apiURL, token):tokens():put(flags) - - print("id:\t\t" .. tostring(resp.id)) - print("body:\t\t" .. tostring(resp.body)) - print("scopes:\t\t" .. tostring(resp.scopes)) - print("active:\t\t" .. tostring(resp.active)) -end diff --git a/proto/regen.sh b/proto/regen.sh index 20f7809..3e1ec53 100755 --- a/proto/regen.sh +++ b/proto/regen.sh @@ -3,5 +3,4 @@ protoc -I. \ --go_out=:. \ --twirp_out=. \ - --twirp_eclier_out=./eclier \ route.proto diff --git a/vendor/github.com/ThomasRooney/gexpect/LICENCE b/vendor/github.com/ThomasRooney/gexpect/LICENCE deleted file mode 100644 index 50adb0f..0000000 --- a/vendor/github.com/ThomasRooney/gexpect/LICENCE +++ /dev/null @@ -1,7 +0,0 @@ -Copyright (C) 2014 Thomas Rooney - -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. \ No newline at end of file diff --git a/vendor/github.com/ThomasRooney/gexpect/README.md b/vendor/github.com/ThomasRooney/gexpect/README.md deleted file mode 100644 index c30e0e2..0000000 --- a/vendor/github.com/ThomasRooney/gexpect/README.md +++ /dev/null @@ -1,64 +0,0 @@ -# Gexpect - -Gexpect is a pure golang expect-like module. - -It makes it simpler to create and control other terminal applications. - - child, err := gexpect.Spawn("python") - if err != nil { - panic(err) - } - child.Expect(">>>") - child.SendLine("print 'Hello World'") - child.Interact() - child.Close() - -## Examples - -`Spawn` handles the argument parsing from a string - - child.Spawn("/bin/sh -c 'echo \"my complicated command\" | tee log | cat > log2'") - child.ReadLine() // ReadLine() (string, error) - child.ReadUntil(' ') // ReadUntil(delim byte) ([]byte, error) - -`ReadLine`, `ReadUntil` and `SendLine` send strings from/to `stdout/stdin` respectively - - child, _ := gexpect.Spawn("cat") - child.SendLine("echoing process_stdin") // SendLine(command string) (error) - msg, _ := child.ReadLine() // msg = echoing process_stdin - -`Wait` and `Close` allow for graceful and ungraceful termination. - - child.Wait() // Waits until the child terminates naturally. - child.Close() // Sends a kill command - -`AsyncInteractChannels` spawns two go routines to pipe into and from `stdout`/`stdin`, allowing for some usecases to be a little simpler. - - child, _ := gexpect.Spawn("sh") - sender, receiver := child.AsyncInteractChannels() - sender <- "echo Hello World\n" // Send to stdin - line, open := <- receiver // Recieve a line from stdout/stderr - // When the subprocess stops (e.g. with child.Close()) , receiver is closed - if open { - fmt.Printf("Received %s", line) - } - -`ExpectRegex` uses golang's internal regex engine to wait until a match from the process with the given regular expression (or an error on process termination with no match). - - child, _ := gexpect.Spawn("echo accb") - match, _ := child.ExpectRegex("a..b") - // (match=true) - -`ExpectRegexFind` allows for groups to be extracted from process stdout. The first element is an array of containing the total matched text, followed by each subexpression group match. - - child, _ := gexpect.Spawn("echo 123 456 789") - result, _ := child.ExpectRegexFind("\d+ (\d+) (\d+)") - // result = []string{"123 456 789", "456", "789"} - -See `gexpect_test.go` and the `examples` folder for full syntax - -## Credits - - github.com/kballard/go-shellquote - github.com/kr/pty - KMP Algorithm: "http://blog.databigbang.com/searching-for-substrings-in-streams-a-slight-modification-of-the-knuth-morris-pratt-algorithm-in-haxe/" diff --git a/vendor/github.com/ThomasRooney/gexpect/gexpect.go b/vendor/github.com/ThomasRooney/gexpect/gexpect.go deleted file mode 100644 index 6e918cb..0000000 --- a/vendor/github.com/ThomasRooney/gexpect/gexpect.go +++ /dev/null @@ -1,449 +0,0 @@ -// +build !windows - -package gexpect - -import ( - "bytes" - "errors" - "fmt" - "io" - "os" - "os/exec" - "regexp" - "time" - "unicode/utf8" - - shell "github.com/kballard/go-shellquote" - "github.com/kr/pty" -) - -var ( - ErrEmptySearch = errors.New("empty search string") -) - -type ExpectSubprocess struct { - Cmd *exec.Cmd - buf *buffer - outputBuffer []byte -} - -type buffer struct { - f *os.File - b bytes.Buffer - collect bool - - collection bytes.Buffer -} - -func (buf *buffer) StartCollecting() { - buf.collect = true -} - -func (buf *buffer) StopCollecting() (result string) { - result = string(buf.collection.Bytes()) - buf.collect = false - buf.collection.Reset() - return result -} - -func (buf *buffer) Read(chunk []byte) (int, error) { - nread := 0 - if buf.b.Len() > 0 { - n, err := buf.b.Read(chunk) - if err != nil { - return n, err - } - if n == len(chunk) { - return n, nil - } - nread = n - } - fn, err := buf.f.Read(chunk[nread:]) - return fn + nread, err -} - -func (buf *buffer) ReadRune() (r rune, size int, err error) { - l := buf.b.Len() - - chunk := make([]byte, utf8.UTFMax) - if l > 0 { - n, err := buf.b.Read(chunk) - if err != nil { - return 0, 0, err - } - if utf8.FullRune(chunk[:n]) { - r, rL := utf8.DecodeRune(chunk) - if n > rL { - buf.PutBack(chunk[rL:n]) - } - if buf.collect { - buf.collection.WriteRune(r) - } - return r, rL, nil - } - } - // else add bytes from the file, then try that - for l < utf8.UTFMax { - fn, err := buf.f.Read(chunk[l : l+1]) - if err != nil { - return 0, 0, err - } - l = l + fn - - if utf8.FullRune(chunk[:l]) { - r, rL := utf8.DecodeRune(chunk) - if buf.collect { - buf.collection.WriteRune(r) - } - return r, rL, nil - } - } - return 0, 0, errors.New("File is not a valid UTF=8 encoding") -} - -func (buf *buffer) PutBack(chunk []byte) { - if len(chunk) == 0 { - return - } - if buf.b.Len() == 0 { - buf.b.Write(chunk) - return - } - d := make([]byte, 0, len(chunk)+buf.b.Len()) - d = append(d, chunk...) - d = append(d, buf.b.Bytes()...) - buf.b.Reset() - buf.b.Write(d) -} - -func SpawnAtDirectory(command string, directory string) (*ExpectSubprocess, error) { - expect, err := _spawn(command) - if err != nil { - return nil, err - } - expect.Cmd.Dir = directory - return _start(expect) -} - -func Command(command string) (*ExpectSubprocess, error) { - expect, err := _spawn(command) - if err != nil { - return nil, err - } - return expect, nil -} - -func (expect *ExpectSubprocess) Start() error { - _, err := _start(expect) - return err -} - -func Spawn(command string) (*ExpectSubprocess, error) { - expect, err := _spawn(command) - if err != nil { - return nil, err - } - return _start(expect) -} - -func (expect *ExpectSubprocess) Close() error { - if err := expect.Cmd.Process.Kill(); err != nil { - return err - } - if err := expect.buf.f.Close(); err != nil { - return err - } - return nil -} - -func (expect *ExpectSubprocess) AsyncInteractChannels() (send chan string, receive chan string) { - receive = make(chan string) - send = make(chan string) - - go func() { - for { - str, err := expect.ReadLine() - if err != nil { - close(receive) - return - } - receive <- str - } - }() - - go func() { - for { - select { - case sendCommand, exists := <-send: - { - if !exists { - return - } - err := expect.Send(sendCommand) - if err != nil { - receive <- "gexpect Error: " + err.Error() - return - } - } - } - } - }() - - return -} - -func (expect *ExpectSubprocess) ExpectRegex(regex string) (bool, error) { - return regexp.MatchReader(regex, expect.buf) -} - -func (expect *ExpectSubprocess) expectRegexFind(regex string, output bool) ([]string, string, error) { - re, err := regexp.Compile(regex) - if err != nil { - return nil, "", err - } - expect.buf.StartCollecting() - pairs := re.FindReaderSubmatchIndex(expect.buf) - stringIndexedInto := expect.buf.StopCollecting() - l := len(pairs) - numPairs := l / 2 - result := make([]string, numPairs) - for i := 0; i < numPairs; i += 1 { - result[i] = stringIndexedInto[pairs[i*2]:pairs[i*2+1]] - } - // convert indexes to strings - - if len(result) == 0 { - err = fmt.Errorf("ExpectRegex didn't find regex '%v'.", regex) - } else { - // The number in pairs[1] is an index of a first - // character outside the whole match - putBackIdx := pairs[1] - if len(stringIndexedInto) > putBackIdx { - stringToPutBack := stringIndexedInto[putBackIdx:] - stringIndexedInto = stringIndexedInto[:putBackIdx] - expect.buf.PutBack([]byte(stringToPutBack)) - } - } - return result, stringIndexedInto, err -} - -func (expect *ExpectSubprocess) expectTimeoutRegexFind(regex string, timeout time.Duration) (result []string, out string, err error) { - t := make(chan bool) - go func() { - result, out, err = expect.ExpectRegexFindWithOutput(regex) - t <- false - }() - go func() { - time.Sleep(timeout) - err = fmt.Errorf("ExpectRegex timed out after %v finding '%v'.\nOutput:\n%s", timeout, regex, expect.Collect()) - t <- true - }() - <-t - return result, out, err -} - -func (expect *ExpectSubprocess) ExpectRegexFind(regex string) ([]string, error) { - result, _, err := expect.expectRegexFind(regex, false) - return result, err -} - -func (expect *ExpectSubprocess) ExpectTimeoutRegexFind(regex string, timeout time.Duration) ([]string, error) { - result, _, err := expect.expectTimeoutRegexFind(regex, timeout) - return result, err -} - -func (expect *ExpectSubprocess) ExpectRegexFindWithOutput(regex string) ([]string, string, error) { - return expect.expectRegexFind(regex, true) -} - -func (expect *ExpectSubprocess) ExpectTimeoutRegexFindWithOutput(regex string, timeout time.Duration) ([]string, string, error) { - return expect.expectTimeoutRegexFind(regex, timeout) -} - -func buildKMPTable(searchString string) []int { - pos := 2 - cnd := 0 - length := len(searchString) - - var table []int - if length < 2 { - length = 2 - } - - table = make([]int, length) - table[0] = -1 - table[1] = 0 - - for pos < len(searchString) { - if searchString[pos-1] == searchString[cnd] { - cnd += 1 - table[pos] = cnd - pos += 1 - } else if cnd > 0 { - cnd = table[cnd] - } else { - table[pos] = 0 - pos += 1 - } - } - return table -} - -func (expect *ExpectSubprocess) ExpectTimeout(searchString string, timeout time.Duration) (e error) { - result := make(chan error) - go func() { - result <- expect.Expect(searchString) - }() - select { - case e = <-result: - case <-time.After(timeout): - e = fmt.Errorf("Expect timed out after %v waiting for '%v'.\nOutput:\n%s", timeout, searchString, expect.Collect()) - } - return e -} - -func (expect *ExpectSubprocess) Expect(searchString string) (e error) { - target := len(searchString) - if target < 1 { - return ErrEmptySearch - } - chunk := make([]byte, target*2) - if expect.outputBuffer != nil { - expect.outputBuffer = expect.outputBuffer[0:] - } - m := 0 - i := 0 - // Build KMP Table - table := buildKMPTable(searchString) - - for { - n, err := expect.buf.Read(chunk) - if n == 0 && err != nil { - return err - } - if expect.outputBuffer != nil { - expect.outputBuffer = append(expect.outputBuffer, chunk[:n]...) - } - offset := m + i - for m+i-offset < n { - if searchString[i] == chunk[m+i-offset] { - i += 1 - if i == target { - unreadIndex := m + i - offset - if len(chunk) > unreadIndex { - expect.buf.PutBack(chunk[unreadIndex:n]) - } - return nil - } - } else { - m += i - table[i] - if table[i] > -1 { - i = table[i] - } else { - i = 0 - } - } - } - } -} - -func (expect *ExpectSubprocess) Send(command string) error { - _, err := io.WriteString(expect.buf.f, command) - return err -} - -func (expect *ExpectSubprocess) Capture() { - if expect.outputBuffer == nil { - expect.outputBuffer = make([]byte, 0) - } -} - -func (expect *ExpectSubprocess) Collect() []byte { - collectOutput := make([]byte, len(expect.outputBuffer)) - copy(collectOutput, expect.outputBuffer) - expect.outputBuffer = nil - return collectOutput -} - -func (expect *ExpectSubprocess) SendLine(command string) error { - _, err := io.WriteString(expect.buf.f, command+"\r\n") - return err -} - -func (expect *ExpectSubprocess) Interact() { - defer expect.Cmd.Wait() - io.Copy(os.Stdout, &expect.buf.b) - go io.Copy(os.Stdout, expect.buf.f) - go io.Copy(expect.buf.f, os.Stdin) -} - -func (expect *ExpectSubprocess) ReadUntil(delim byte) ([]byte, error) { - join := make([]byte, 0, 512) - chunk := make([]byte, 255) - - for { - n, err := expect.buf.Read(chunk) - - for i := 0; i < n; i++ { - if chunk[i] == delim { - if len(chunk) > i+1 { - expect.buf.PutBack(chunk[i+1:n]) - } - return join, nil - } else { - join = append(join, chunk[i]) - } - } - - if err != nil { - return join, err - } - } -} - -func (expect *ExpectSubprocess) Wait() error { - return expect.Cmd.Wait() -} - -func (expect *ExpectSubprocess) ReadLine() (string, error) { - str, err := expect.ReadUntil('\n') - return string(str), err -} - -func _start(expect *ExpectSubprocess) (*ExpectSubprocess, error) { - f, err := pty.Start(expect.Cmd) - if err != nil { - return nil, err - } - expect.buf.f = f - - return expect, nil -} - -func _spawn(command string) (*ExpectSubprocess, error) { - wrapper := new(ExpectSubprocess) - - wrapper.outputBuffer = nil - - splitArgs, err := shell.Split(command) - if err != nil { - return nil, err - } - numArguments := len(splitArgs) - 1 - if numArguments < 0 { - return nil, errors.New("gexpect: No command given to spawn") - } - path, err := exec.LookPath(splitArgs[0]) - if err != nil { - return nil, err - } - - if numArguments >= 1 { - wrapper.Cmd = exec.Command(path, splitArgs[1:]...) - } else { - wrapper.Cmd = exec.Command(path) - } - wrapper.buf = new(buffer) - - return wrapper, nil -} diff --git a/vendor/github.com/ThomasRooney/gexpect/gexpect_test.go b/vendor/github.com/ThomasRooney/gexpect/gexpect_test.go deleted file mode 100644 index 8d3771a..0000000 --- a/vendor/github.com/ThomasRooney/gexpect/gexpect_test.go +++ /dev/null @@ -1,419 +0,0 @@ -// +build !windows - -package gexpect - -import ( - "bytes" - "fmt" - "io/ioutil" - "strings" - "testing" - "time" -) - -func TestEmptySearchString(t *testing.T) { - t.Logf("Testing empty search string...") - child, err := Spawn("echo Hello World") - if err != nil { - t.Fatal(err) - } - err = child.Expect("") - if err != ErrEmptySearch { - t.Fatalf("Expected empty search error, got %v", err) - } -} - -func TestHelloWorld(t *testing.T) { - t.Logf("Testing Hello World... ") - child, err := Spawn("echo \"Hello World\"") - if err != nil { - t.Fatal(err) - } - err = child.Expect("Hello World") - if err != nil { - t.Fatal(err) - } -} - -func TestDoubleHelloWorld(t *testing.T) { - t.Logf("Testing Double Hello World... ") - child, err := Spawn(`sh -c "echo Hello World ; echo Hello ; echo Hi"`) - if err != nil { - t.Fatal(err) - } - err = child.Expect("Hello World") - if err != nil { - t.Fatal(err) - } - err = child.Expect("Hello") - if err != nil { - t.Fatal(err) - } - err = child.Expect("Hi") - if err != nil { - t.Fatal(err) - } -} - -func TestHelloWorldFailureCase(t *testing.T) { - t.Logf("Testing Hello World Failure case... ") - child, err := Spawn("echo \"Hello World\"") - if err != nil { - t.Fatal(err) - } - err = child.Expect("YOU WILL NEVER FIND ME") - if err != nil { - return - } - t.Fatal("Expected an error for TestHelloWorldFailureCase") -} - -func TestBiChannel(t *testing.T) { - - t.Logf("Testing BiChannel screen... ") - child, err := Spawn("cat") - if err != nil { - t.Fatal(err) - } - sender, receiver := child.AsyncInteractChannels() - wait := func(str string) { - for { - msg, open := <-receiver - if !open { - return - } - if strings.Contains(msg, str) { - return - } - } - } - - endlChar := fmt.Sprintln("") - sender <- fmt.Sprintf("echo%v", endlChar) - wait("echo") - sender <- fmt.Sprintf("echo2%v", endlChar) - wait("echo2") - child.Close() - child.Wait() -} - -func TestCommandStart(t *testing.T) { - t.Logf("Testing Command... ") - - // Doing this allows you to modify the cmd struct prior to execution, for example to add environment variables - child, err := Command("echo 'Hello World'") - if err != nil { - t.Fatal(err) - } - child.Start() - child.Expect("Hello World") -} - -var regexMatchTests = []struct { - re string - good string - bad string -}{ - {`a`, `a`, `b`}, - {`.b`, `ab`, `ac`}, - {`a+hello`, `aaaahello`, `bhello`}, - {`(hello|world)`, `hello`, `unknown`}, - {`(hello|world)`, `world`, `unknown`}, - {"\u00a9", "\u00a9", `unknown`}, // 2 bytes long unicode character "copyright sign" -} - -func TestRegexMatch(t *testing.T) { - t.Logf("Testing Regular Expression Matching... ") - for _, tt := range regexMatchTests { - runTest := func(input string) bool { - var match bool - child, err := Spawn("echo \"" + input + "\"") - if err != nil { - t.Fatal(err) - } - match, err = child.ExpectRegex(tt.re) - if err != nil { - t.Fatal(err) - } - return match - } - if !runTest(tt.good) { - t.Errorf("Regex Not matching [%#q] with pattern [%#q]", tt.good, tt.re) - } - if runTest(tt.bad) { - t.Errorf("Regex Matching [%#q] with pattern [%#q]", tt.bad, tt.re) - } - } -} - -var regexFindTests = []struct { - re string - input string - matches []string -}{ - {`he(l)lo wo(r)ld`, `hello world`, []string{"hello world", "l", "r"}}, - {`(a)`, `a`, []string{"a", "a"}}, - {`so.. (hello|world)`, `so.. hello`, []string{"so.. hello", "hello"}}, - {`(a+)hello`, `aaaahello`, []string{"aaaahello", "aaaa"}}, - {`\d+ (\d+) (\d+)`, `123 456 789`, []string{"123 456 789", "456", "789"}}, - {`\d+ (\d+) (\d+)`, "\u00a9 123 456 789 \u00a9", []string{"123 456 789", "456", "789"}}, // check unicode characters -} - -func TestRegexFind(t *testing.T) { - t.Logf("Testing Regular Expression Search... ") - for _, tt := range regexFindTests { - runTest := func(input string) []string { - child, err := Spawn("echo \"" + input + "\"") - if err != nil { - t.Fatal(err) - } - matches, err := child.ExpectRegexFind(tt.re) - if err != nil { - t.Fatal(err) - } - return matches - } - matches := runTest(tt.input) - if len(matches) != len(tt.matches) { - t.Fatalf("Regex not producing the expected number of patterns.. got[%d] ([%s]) expected[%d] ([%s])", - len(matches), strings.Join(matches, ","), - len(tt.matches), strings.Join(tt.matches, ",")) - } - for i, _ := range matches { - if matches[i] != tt.matches[i] { - t.Errorf("Regex Expected group [%s] and got group [%s] with pattern [%#q] and input [%s]", - tt.matches[i], matches[i], tt.re, tt.input) - } - } - } -} - -func TestReadLine(t *testing.T) { - t.Logf("Testing ReadLine...") - - child, err := Spawn("echo \"foo\nbar\"") - - if err != nil { - t.Fatal(err) - } - s, err := child.ReadLine() - - if err != nil { - t.Fatal(err) - } - if s != "foo\r" { - t.Fatalf("expected 'foo\\r', got '%s'", s) - } - s, err = child.ReadLine() - if err != nil { - t.Fatal(err) - } - if s != "bar\r" { - t.Fatalf("expected 'bar\\r', got '%s'", s) - } -} - -func TestRegexWithOutput(t *testing.T) { - t.Logf("Testing Regular Expression search with output...") - - s := "You will not find me" - p, err := Spawn("echo -n " + s) - if err != nil { - t.Fatalf("Cannot exec rkt: %v", err) - } - searchPattern := `I should not find you` - result, out, err := p.ExpectRegexFindWithOutput(searchPattern) - if err == nil { - t.Fatalf("Shouldn't have found `%v` in `%v`", searchPattern, out) - } - if s != out { - t.Fatalf("Child output didn't match: %s", out) - } - - err = p.Wait() - if err != nil { - t.Fatalf("Child didn't terminate correctly: %v", err) - } - - p, err = Spawn("echo You will find me") - if err != nil { - t.Fatalf("Cannot exec rkt: %v", err) - } - searchPattern = `.*(You will).*` - result, out, err = p.ExpectRegexFindWithOutput(searchPattern) - if err != nil || result[1] != "You will" { - t.Fatalf("Did not find pattern `%v` in `%v'\n", searchPattern, out) - } - err = p.Wait() - if err != nil { - t.Fatalf("Child didn't terminate correctly: %v", err) - } -} - -func TestRegexTimeoutWithOutput(t *testing.T) { - t.Logf("Testing Regular Expression search with timeout and output...") - - seconds := 2 - timeout := time.Duration(seconds-1) * time.Second - - p, err := Spawn(fmt.Sprintf("sh -c 'sleep %d && echo You find me'", seconds)) - if err != nil { - t.Fatalf("Cannot exec rkt: %v", err) - } - searchPattern := `find me` - result, out, err := p.ExpectTimeoutRegexFindWithOutput(searchPattern, timeout) - if err == nil { - t.Fatalf("Shouldn't have finished call with result: %v", result) - } - - seconds = 2 - timeout = time.Duration(seconds+1) * time.Second - - p, err = Spawn(fmt.Sprintf("sh -c 'sleep %d && echo You find me'", seconds)) - if err != nil { - t.Fatalf("Cannot exec rkt: %v", err) - } - searchPattern = `find me` - result, out, err = p.ExpectTimeoutRegexFindWithOutput(searchPattern, timeout) - if err != nil { - t.Fatalf("Didn't find %v in output: %v", searchPattern, out) - } -} - -func TestRegexFindNoExcessBytes(t *testing.T) { - t.Logf("Testing Regular Expressions returning output with no excess strings") - repeats := 50 - tests := []struct { - desc string - loopBody string - searchPattern string - expectFullTmpl string - unmatchedData string - }{ - { - desc: `matching lines line by line with $ at the end of the regexp`, - loopBody: `echo "prefix: ${i} line"`, - searchPattern: `(?m)^prefix:\s+(\d+) line\s??$`, - expectFullTmpl: `prefix: %d line`, - unmatchedData: "\n", - // the "$" char at the end of regexp does not - // match the \n, so it is left as an unmatched - // data - }, - { - desc: `matching lines line by line with \n at the end of the regexp`, - loopBody: `echo "prefix: ${i} line"`, - searchPattern: `(?m)^prefix:\s+(\d+) line\s??\n`, - expectFullTmpl: `prefix: %d line`, - unmatchedData: "", - }, - { - desc: `matching chunks in single line chunk by chunk`, - loopBody: `printf "a ${i} b"`, - searchPattern: `a\s+(\d+)\s+b`, - expectFullTmpl: `a %d b`, - unmatchedData: "", - }, - } - seqCmd := fmt.Sprintf("`seq 1 %d`", repeats) - shCmdTmpl := fmt.Sprintf(`sh -c 'for i in %s; do %%s; done'`, seqCmd) - for _, tt := range tests { - t.Logf("Test: %s", tt.desc) - shCmd := fmt.Sprintf(shCmdTmpl, tt.loopBody) - t.Logf("Running command: %s", shCmd) - p, err := Spawn(shCmd) - if err != nil { - t.Fatalf("Cannot exec shell script: %v", err) - } - defer func() { - if err := p.Wait(); err != nil { - t.Fatalf("shell script didn't terminate correctly: %v", err) - } - }() - for i := 1; i <= repeats; i++ { - matches, output, err := p.ExpectRegexFindWithOutput(tt.searchPattern) - if err != nil { - t.Fatalf("Failed to get the match number %d: %v", i, err) - } - if len(matches) != 2 { - t.Fatalf("Expected only 2 matches, got %d", len(matches)) - } - full := strings.TrimSpace(matches[0]) - expFull := fmt.Sprintf(tt.expectFullTmpl, i) - partial := matches[1] - expPartial := fmt.Sprintf("%d", i) - if full != expFull { - t.Fatalf("Did not the expected full match %q, got %q", expFull, full) - } - if partial != expPartial { - t.Fatalf("Did not the expected partial match %q, got %q", expPartial, partial) - } - // The output variable usually contains the - // unmatched data followed by the whole match. - // The first line is special as it has no data - // preceding it. - var expectedOutput string - if i == 1 || tt.unmatchedData == "" { - expectedOutput = matches[0] - } else { - expectedOutput = fmt.Sprintf("%s%s", tt.unmatchedData, matches[0]) - } - if output != expectedOutput { - t.Fatalf("The collected output %q should be the same as the whole match %q", output, expectedOutput) - } - } - } -} - -func TestBufferReadRune(t *testing.T) { - tests := []struct { - bufferContent []byte - fileContent []byte - expectedRune rune - }{ - // unicode "copyright char" is \u00a9 is encoded as two bytes in utf8 0xc2 0xa9 - {[]byte{0xc2, 0xa9}, []byte{}, '\u00a9'}, // whole rune is already in buffer.b - {[]byte{0xc2}, []byte{0xa9}, '\u00a9'}, // half of is in the buffer.b and another half still in buffer.f (file) - {[]byte{}, []byte{0xc2, 0xa9}, '\u00a9'}, // whole rune is the file - // some random noise in the end of file - {[]byte{0xc2, 0xa9}, []byte{0x20, 0x20, 0x20, 0x20}, '\u00a9'}, - {[]byte{0xc2}, []byte{0xa9, 0x20, 0x20, 0x20, 0x20}, '\u00a9'}, - {[]byte{}, []byte{0xc2, 0xa9, 0x20, 0x20, 0x20, 0x20}, '\u00a9'}, - } - - for i, tt := range tests { - - // prepare tmp file with fileContent - f, err := ioutil.TempFile("", "") - if err != nil { - t.Fatal(err) - } - n, err := f.Write(tt.fileContent) - if err != nil { - t.Fatal(err) - } - if n != len(tt.fileContent) { - t.Fatal("expected fileContent written to temp file") - } - _, err = f.Seek(0, 0) - if err != nil { - t.Fatal(err) - } - - // new buffer - buf := buffer{f: f, b: *bytes.NewBuffer(tt.bufferContent)} - - // call ReadRune - r, size, err := buf.ReadRune() - - if r != tt.expectedRune { - t.Fatalf("#%d: expected rune %+q but go is %+q", i, tt.expectedRune, r) - } - - if size != len(string(tt.expectedRune)) { - t.Fatalf("#%d: expected rune %d bytes long but got just %d bytes long", i, len(string(tt.expectedRune)), size) - } - - } - -} diff --git a/vendor/github.com/Xe/eclier/.gitignore b/vendor/github.com/Xe/eclier/.gitignore deleted file mode 100644 index 28f7b7d..0000000 --- a/vendor/github.com/Xe/eclier/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.DS_Store -doc \ No newline at end of file diff --git a/vendor/github.com/Xe/eclier/Gopkg.lock b/vendor/github.com/Xe/eclier/Gopkg.lock deleted file mode 100644 index 4e650ea..0000000 --- a/vendor/github.com/Xe/eclier/Gopkg.lock +++ /dev/null @@ -1,223 +0,0 @@ -memo = "b40e77e679fec09015bfda27b7d1fc37f4ba6240cbe95cf9fb88b5c56e40ebdf" - -[[projects]] - branch = "master" - name = "github.com/ThomasRooney/gexpect" - packages = ["."] - revision = "5482f03509440585d13d8f648989e05903001842" - -[[projects]] - branch = "master" - name = "github.com/Xe/x" - packages = ["tools/glue/libs/gluaexpect","tools/glue/libs/gluasimplebox"] - revision = "d0ebe3970f361daa31a135f1e0c7304eb1442f61" - -[[projects]] - branch = "master" - name = "github.com/ailncode/gluaxmlpath" - packages = ["."] - revision = "6ce478ecb4a60c4fc8929838e0b21b7fb7ca7440" - -[[projects]] - branch = "master" - name = "github.com/brandur/simplebox" - packages = ["."] - revision = "84e9865bb03ad38c464043bf5382ce8c68ca5f0c" - -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluahttp" - packages = ["."] - revision = "b4bfe0c50fea948dcbf3966e120996d6607bbd89" - -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluaurl" - packages = ["."] - revision = "31cbb9bef199454415879f2e6d609d1136d60cad" - -[[projects]] - branch = "master" - name = "github.com/cyberdelia/heroku-go" - packages = ["v3"] - revision = "bb8b6b1e9656ec0728638961f8e8b4211fee735d" - -[[projects]] - branch = "master" - name = "github.com/dickeyxxx/netrc" - packages = ["."] - revision = "3acf1b3de25d89c7688c63bb45f6b07f566555ec" - -[[projects]] - branch = "master" - name = "github.com/google/go-querystring" - packages = ["query"] - revision = "53e6ce116135b80d037921a7fdd5138cf32d7a8a" - -[[projects]] - branch = "master" - name = "github.com/howeyc/gopass" - packages = ["."] - revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8" - -[[projects]] - branch = "master" - name = "github.com/kballard/go-shellquote" - packages = ["."] - revision = "d8ec1a69a250a17bb0e419c386eac1f3711dc142" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaenv" - packages = ["."] - revision = "2888db6bbe38923d59c42e443895875cc8ce0820" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluafs" - packages = ["."] - revision = "01391ed2d7ab89dc80157605b073403f960aa223" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaquestion" - packages = ["."] - revision = "311437c29ba54d027ad2af383661725ae2bfdcdc" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluassh" - packages = ["."] - revision = "2a7bd48d7568de8230c87ac1ef4a4c481e45814d" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluatemplate" - packages = ["."] - revision = "d9e2c9d6b00f069a9da377a9ac529c827c1c7d71" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluayaml" - packages = ["."] - revision = "6fe413d49d73d785510ecf1529991ab0573e96c7" - -[[projects]] - branch = "master" - name = "github.com/kr/fs" - packages = ["."] - revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b" - -[[projects]] - branch = "master" - name = "github.com/kr/pty" - packages = ["."] - revision = "ce7fa45920dc37a92de8377972e52bc55ffa8d57" - -[[projects]] - branch = "master" - name = "github.com/mattn/go-runewidth" - packages = ["."] - revision = "737072b4e32b7a5018b4a7125da8d12de90e8045" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "cc8532a8e9a55ea36402aa21efdf403a60d34096" - -[[projects]] - branch = "master" - name = "github.com/olekukonko/tablewriter" - packages = ["."] - revision = "44e365d423f4f06769182abfeeae2b91be9d529b" - -[[projects]] - branch = "master" - name = "github.com/otm/gluaflag" - packages = ["."] - revision = "078088de689148194436293886e8e39809167332" - -[[projects]] - branch = "master" - name = "github.com/otm/gluash" - packages = ["."] - revision = "e145c563986f0b91f740a758a84bca46c163aec7" - -[[projects]] - name = "github.com/pborman/uuid" - packages = ["."] - revision = "e790cca94e6cc75c7064b1332e63811d4aae1a53" - version = "v1.1" - -[[projects]] - branch = "master" - name = "github.com/pkg/sftp" - packages = ["."] - revision = "e84cc8c755ca39b7b64f510fe1fffc1b51f210a5" - -[[projects]] - branch = "master" - name = "github.com/yookoala/realpath" - packages = ["."] - revision = "c416d99ab5ed256fa30c1f3bab73152deb59bb69" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluamapper" - packages = ["."] - revision = "d836955830e75240d46ce9f0e6d148d94f2e1d3a" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluare" - packages = ["."] - revision = "8e2742cd1bf2b904720ac66eca3c2091b2ea0720" - -[[projects]] - branch = "master" - name = "github.com/yuin/gopher-lua" - packages = [".","ast","parse","pm"] - revision = "33ebc07735566cd0c3c4b69e2839d522cc389852" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["curve25519","ed25519","ed25519/internal/edwards25519","nacl/secretbox","poly1305","salsa20/salsa","ssh","ssh/agent","ssh/terminal"] - revision = "dd85ac7e6a88fc6ca420478e934de5f1a42dd3c6" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["html","html/atom"] - revision = "66aacef3dd8a676686c7ae3716979581e8b03c47" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix"] - revision = "9ccfe848b9db8435a24c424abbc07a921adf1df5" - -[[projects]] - branch = "v2" - name = "gopkg.in/xmlpath.v2" - packages = ["."] - revision = "860cbeca3ebcc600db0b213c0e83ad6ce91f5739" - -[[projects]] - branch = "master" - name = "gopkg.in/yaml.v2" - packages = ["."] - revision = "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b" - -[[projects]] - branch = "master" - name = "layeh.com/gopher-json" - packages = ["."] - revision = "c128cc74278be889c4381681712931976fe0d88b" - -[[projects]] - branch = "master" - name = "layeh.com/gopher-luar" - packages = ["."] - revision = "80196fe2abc5682963fc7a5261f5a5d77509938b" diff --git a/vendor/github.com/Xe/eclier/Gopkg.toml b/vendor/github.com/Xe/eclier/Gopkg.toml deleted file mode 100644 index 4219096..0000000 --- a/vendor/github.com/Xe/eclier/Gopkg.toml +++ /dev/null @@ -1,72 +0,0 @@ - -[[dependencies]] - branch = "master" - name = "github.com/Xe/x" - -[[dependencies]] - branch = "master" - name = "github.com/ailncode/gluaxmlpath" - -[[dependencies]] - branch = "master" - name = "github.com/cjoudrey/gluahttp" - -[[dependencies]] - branch = "master" - name = "github.com/cjoudrey/gluaurl" - -[[dependencies]] - branch = "master" - name = "github.com/dickeyxxx/netrc" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluaenv" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluafs" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluaquestion" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluassh" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluatemplate" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluayaml" - -[[dependencies]] - branch = "master" - name = "github.com/olekukonko/tablewriter" - -[[dependencies]] - branch = "master" - name = "github.com/otm/gluaflag" - -[[dependencies]] - branch = "master" - name = "github.com/otm/gluash" - -[[dependencies]] - branch = "master" - name = "github.com/yuin/gluare" - -[[dependencies]] - branch = "master" - name = "github.com/yuin/gopher-lua" - -[[dependencies]] - branch = "master" - name = "layeh.com/gopher-json" - -[[dependencies]] - branch = "master" - name = "layeh.com/gopher-luar" diff --git a/vendor/github.com/Xe/eclier/LICENSE b/vendor/github.com/Xe/eclier/LICENSE deleted file mode 100644 index 1625c17..0000000 --- a/vendor/github.com/Xe/eclier/LICENSE +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. \ No newline at end of file diff --git a/vendor/github.com/Xe/eclier/README.md b/vendor/github.com/Xe/eclier/README.md deleted file mode 100644 index 7f99158..0000000 --- a/vendor/github.com/Xe/eclier/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# eclier - -Pronounced like eclair - -The core of a command line application allowing for trivial user extension. - -Every command and subcommand is its own `.lua` file that is either shipped as -part of the built-in cartridge of commands or a plugin that the user installs. - -The core contains the following: - -- A module loading system for preparing different commands for use -- The core subcommand router - -## How to write plugins - -Create a new file in the script home named after the plugin subcommand, for -example: `scripts/hello.lua`: - -```lua -script.verb = "hello" -script.help = "prints everyone's favorite hello world message" -script.author = "Xe" -- put your github username here -script.version = "1.0" -script.usage = "" - -function(run) - print "Hello, world!" -end -``` - -And then run it using the example shell cli: - -```console -~/go/src/github.com/Xe/eclier:master λ go run ./example/main.go hello -Hello, world! -``` - diff --git a/vendor/github.com/Xe/eclier/builtin.go b/vendor/github.com/Xe/eclier/builtin.go deleted file mode 100644 index 20cac55..0000000 --- a/vendor/github.com/Xe/eclier/builtin.go +++ /dev/null @@ -1,119 +0,0 @@ -package eclier - -import ( - "context" - "flag" - "os" - - "github.com/olekukonko/tablewriter" -) - -// Constants for built-in commands. -const ( - BuiltinScriptPath = "" - BuiltinAuthor = "" - BuiltinVersion = "" -) - -type pluginCommand struct { - r *Router - fs *flag.FlagSet - - dontShowBuiltin *bool -} - -// Close is a no-op. -func (p *pluginCommand) Close() error { return nil } - -// Init sets up the flags for this command. -func (p *pluginCommand) Init() { - p.fs = flag.NewFlagSet(p.Verb(), flag.ExitOnError) - - p.dontShowBuiltin = p.fs.Bool("no-builtin", false, "if set, don't show built-in commands") -} - -// ScriptPath returns the built-in script path. -func (p *pluginCommand) ScriptPath() string { return BuiltinScriptPath } - -// Verb returns the command verb. -func (p *pluginCommand) Verb() string { return "plugins" } - -// Help returns the command help -func (p *pluginCommand) Help() string { - return `plugin lists all of the loaded commands and their script paths.` -} - -func (p *pluginCommand) Usage() string { - return ` -no-builtin - if set, don't show built-in commands` -} - -func (p *pluginCommand) Author() string { return BuiltinAuthor } - -func (p *pluginCommand) Version() string { return BuiltinVersion } - -// Run executes the command. -func (p *pluginCommand) Run(ctx context.Context, arg []string) error { - p.fs.Parse(arg) - - table := tablewriter.NewWriter(os.Stdout) - table.SetHeader([]string{"Verb", "Path"}) - - for _, c := range p.r.cmds { - if c.ScriptPath() == BuiltinScriptPath && *p.dontShowBuiltin { - continue - } - - table.Append([]string{c.Verb(), c.ScriptPath()}) - } - - table.Render() - return nil -} - -// NewBuiltinCommand makes it easier to write core commands for eclier. -func NewBuiltinCommand(verb, help, usage string, doer func(context.Context, []string) error) Command { - return &commandFunc{ - verb: verb, - help: help, - usage: usage, - doer: doer, - } -} - -// commandFunc is a simple alias for creating builtin commands. -type commandFunc struct { - verb string - help string - usage string - doer func(context.Context, []string) error -} - -// Close deallocates resources set up by the initialization of the command. -func (c *commandFunc) Close() error { return nil } - -// Init is a no-op. -func (c *commandFunc) Init() {} - -// ScriptPath returns the built-in script path. -func (c *commandFunc) ScriptPath() string { return BuiltinScriptPath } - -// Verb returns the command verb. -func (c *commandFunc) Verb() string { return c.verb } - -// Help returns the command help. -func (c *commandFunc) Help() string { return c.help } - -// Usage returns the command usage. -func (c *commandFunc) Usage() string { return c.usage } - -// Author returns the built-in author. -func (c *commandFunc) Author() string { return BuiltinAuthor } - -// Version returns the built-in version. -func (c *commandFunc) Version() string { return BuiltinVersion } - -// Run runs the command handler. -func (c *commandFunc) Run(ctx context.Context, arg []string) error { - return c.doer(ctx, arg) -} diff --git a/vendor/github.com/Xe/eclier/command.go b/vendor/github.com/Xe/eclier/command.go deleted file mode 100644 index 9a20031..0000000 --- a/vendor/github.com/Xe/eclier/command.go +++ /dev/null @@ -1,18 +0,0 @@ -package eclier - -import ( - "context" -) - -// Command is an individual subcommand. -type Command interface { - Close() error - Init() - ScriptPath() string - Verb() string - Help() string - Usage() string - Author() string - Version() string - Run(ctx context.Context, arg []string) error -} diff --git a/vendor/github.com/Xe/eclier/config.ld b/vendor/github.com/Xe/eclier/config.ld deleted file mode 100644 index 3ccf99c..0000000 --- a/vendor/github.com/Xe/eclier/config.ld +++ /dev/null @@ -1,8 +0,0 @@ -file = { - "./internal/gluanetrc/netrc.lua", - "./internal/gluaheroku/heroku.lua", -} - -title = "eclier lua libraries" -project = "eclier" -description = "The lua libraries created for eclier demos and common utility." diff --git a/vendor/github.com/Xe/eclier/router.go b/vendor/github.com/Xe/eclier/router.go deleted file mode 100644 index 1ed610e..0000000 --- a/vendor/github.com/Xe/eclier/router.go +++ /dev/null @@ -1,214 +0,0 @@ -package eclier - -import ( - "context" - "fmt" - "log" - "net/http" - "os" - "path/filepath" - "strings" - "sync" - - "github.com/olekukonko/tablewriter" - lua "github.com/yuin/gopher-lua" - "layeh.com/asar" -) - -// Router is the main subcommand router for eclier. At a high level what this is -// doing is similar to http.ServeMux, but for CLI commands instead of HTTP handlers. -type Router struct { - lock sync.Mutex - cmds map[string]Command - - // configured data - gluaCreationHook func(*lua.LState) - scriptHomes []string - cartridge map[string]string -} - -// NewRouter creates a new instance of Router and sets it up for use. -func NewRouter(opts ...RouterOption) (*Router, error) { - r := &Router{ - cmds: map[string]Command{}, - cartridge: map[string]string{}, - } - - for _, opt := range opts { - opt(r) - } - - // scan r.scriptHome for lua scripts, load them into their own lua states and - // make a wrapper around them for the Command type. - - for _, home := range r.scriptHomes { - err := filepath.Walk(home, func(path string, info os.FileInfo, err error) error { - if err != nil { - log.Printf("error in arg: %v", err) - return err - } - - if strings.HasSuffix(info.Name(), ".lua") { - fname := filepath.Join(home, info.Name()) - fin, err := os.Open(fname) - if err != nil { - return err - } - defer fin.Close() - - c := newGluaCommand(r.gluaCreationHook, fname, fin) - r.cmds[c.Verb()] = c - } - - return nil - }) - - if err != nil { - return nil, err - } - } - - var helpCommand Command = NewBuiltinCommand("help", "shows help for subcommands", "help [subcommand]", func(ctx context.Context, arg []string) error { - if len(arg) == 0 { - table := tablewriter.NewWriter(os.Stdout) - table.SetHeader([]string{"Verb", "Author", "Version", "Help"}) - - for _, cmd := range r.cmds { - table.Append([]string{cmd.Verb(), cmd.Author(), cmd.Version(), cmd.Help()}) - } - - table.Render() - return nil - } - - cmd, ok := r.cmds[arg[0]] - if !ok { - fmt.Printf("can't find help for %s", arg[0]) - os.Exit(2) - } - - fmt.Printf("Verb: %s\nAuthor: %s\nVersion: %s\nHelp: %s\nUsage: %s %s\n", cmd.Verb(), cmd.Author(), cmd.Version(), cmd.Help(), cmd.Verb(), cmd.Usage()) - return nil - }) - - r.cmds["plugins"] = &pluginCommand{r: r} - r.cmds["help"] = helpCommand - - return r, nil -} - -// AddCommand adds a given command instance to the eclier router. -func (r *Router) AddCommand(cmd Command) { - r.lock.Lock() - defer r.lock.Unlock() - - r.cmds[cmd.Verb()] = cmd -} - -// Run executes a single command given in slot 0 of the argument array. -func (r *Router) Run(ctx context.Context, arg []string) error { - r.lock.Lock() - defer r.lock.Unlock() - - if len(arg) == 0 { - fmt.Printf("please specify a subcommand, such as `%s help`\n", filepath.Base(os.Args[0])) - os.Exit(2) - } - - cmd := arg[0] - arg = arg[1:] - - ci, ok := r.cmds[cmd] - if !ok { - fmt.Printf("No such command %s could be run.\n", cmd) - os.Exit(2) - } - - ci.Init() - return ci.Run(ctx, arg) -} - -// RouterOption is a functional option for Router. -type RouterOption func(*Router) - -// WithScriptHome sets the router's script home to the given directory. This is -// where lua files will be walked and parsed. -func WithScriptHome(dir string) RouterOption { - return func(r *Router) { - r.scriptHomes = append(r.scriptHomes, dir) - } -} - -// WithGluaCreationHook adds a custom bit of code that runs every time a new -// gopher-lua LState is created. This allows users of this library to register -// custom libraries to the pile of states. -func WithGluaCreationHook(hook func(*lua.LState)) RouterOption { - return func(r *Router) { - r.gluaCreationHook = hook - } -} - -// WithFilesystem loads a http.FileSystem full of lua scripts into this eclier -// router. -func WithFilesystem(shortName string, fs http.FileSystem) RouterOption { - return func(r *Router) { - fin, err := fs.Open("/") - if err != nil { - log.Fatal(err) - } - defer fin.Close() - - childs, err := fin.Readdir(-1) - if err != nil { - log.Fatal(err) - } - - for _, chl := range childs { - if strings.HasSuffix(chl.Name(), ".lua") { - fname := filepath.Join(shortName, chl.Name()) - sFin, err := fs.Open(chl.Name()) - if err != nil { - log.Fatal(err) - } - defer sFin.Close() - - c := newGluaCommand(r.gluaCreationHook, fname, sFin) - r.cmds[c.Verb()] = c - } - } - } -} - -// WithAsarFile loads an asar file full of lua scripts into this eclier router. -func WithAsarFile(shortName, fname string) RouterOption { - return func(r *Router) { - fin, err := os.Open(fname) - if err != nil { - log.Fatal(err) - } - defer fin.Close() - - e, err := asar.Decode(fin) - if err != nil { - log.Fatal(err) - } - - err = e.Walk(func(path string, info os.FileInfo, err error) error { - if strings.HasSuffix(info.Name(), ".lua") { - fname := filepath.Join(shortName, "::", path) - fin := e.Find(path) - if fin == nil { - return nil - } - - c := newGluaCommand(r.gluaCreationHook, fname, fin.Open()) - r.cmds[c.Verb()] = c - } - - return nil - }) - if err != nil { - log.Fatal(err) - } - } -} diff --git a/vendor/github.com/Xe/eclier/script.go b/vendor/github.com/Xe/eclier/script.go deleted file mode 100644 index d4b88b2..0000000 --- a/vendor/github.com/Xe/eclier/script.go +++ /dev/null @@ -1,92 +0,0 @@ -package eclier - -import ( - "context" - "errors" - "io" - "io/ioutil" - "sync" - - lua "github.com/yuin/gopher-lua" - luar "layeh.com/gopher-luar" -) - -type Script struct { - Verb string - Help string - Usage string - Author string - Version string -} - -type gluaCommand struct { - sync.Mutex - script *Script - L *lua.LState - - filename string -} - -func newGluaCommand(preload func(*lua.LState), filename string, r io.Reader) Command { - L := lua.NewState() - preload(L) - - script := &Script{} - L.SetGlobal("script", luar.New(L, script)) - - data, err := ioutil.ReadAll(r) - if err != nil { - panic(err) - } - - err = L.DoString(string(data)) - if err != nil { - panic(err) - } - - return &gluaCommand{script: script, L: L, filename: filename} -} - -func (g *gluaCommand) Close() error { - g.L.Close() - return nil -} - -func (g *gluaCommand) Init() {} - -func (g *gluaCommand) ScriptPath() string { return g.filename } - -func (g *gluaCommand) Verb() string { return g.script.Verb } - -func (g *gluaCommand) Help() string { return g.script.Help } - -func (g *gluaCommand) Usage() string { return g.script.Usage } - -func (g *gluaCommand) Author() string { return g.script.Author } - -func (g *gluaCommand) Version() string { return g.script.Version } - -func (g *gluaCommand) Run(ctx context.Context, arg []string) error { - runf := g.L.GetGlobal("run") - - if runf.Type() == lua.LTNil { - return errors.New("no global function run in this script") - } - - tab := g.L.NewTable() - - for _, a := range arg { - tab.Append(lua.LString(a)) - } - - err := g.L.CallByParam(lua.P{ - Fn: runf, - NRet: 0, - Protect: false, - }, tab) - if err != nil { - panic(err) - } - - return nil -} diff --git a/vendor/github.com/Xe/gluanetrc/LICENSE b/vendor/github.com/Xe/gluanetrc/LICENSE deleted file mode 100644 index 82248fe..0000000 --- a/vendor/github.com/Xe/gluanetrc/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2017 Christine Dodrill - -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. \ No newline at end of file diff --git a/vendor/github.com/Xe/gluanetrc/config.ld b/vendor/github.com/Xe/gluanetrc/config.ld deleted file mode 100644 index 50dfad6..0000000 --- a/vendor/github.com/Xe/gluanetrc/config.ld +++ /dev/null @@ -1,7 +0,0 @@ -file = { - "./netrc.lua", -} - -title = "gluanetrc" -project = "Xe/gluanetrc" -description = "netrc offers a simple interface to a user's netrc file in their home directory" diff --git a/vendor/github.com/Xe/gluanetrc/netrc.go b/vendor/github.com/Xe/gluanetrc/netrc.go deleted file mode 100644 index c2dcd07..0000000 --- a/vendor/github.com/Xe/gluanetrc/netrc.go +++ /dev/null @@ -1,81 +0,0 @@ -package gluanetrc - -import ( - "os" - "path/filepath" - - "github.com/dickeyxxx/netrc" - lua "github.com/yuin/gopher-lua" - luar "layeh.com/gopher-luar" -) - -var n *netrc.Netrc - -func init() { - var err error - - fname := filepath.Join(os.Getenv("HOME"), ".netrc") - - fout, err := os.Create(fname) - if err != nil { - panic(err) - } - fout.Close() - - n, err = netrc.Parse(filepath.Join(fname)) - if err != nil { - panic(err) - } -} - -var exports = map[string]lua.LGFunction{ - "machine": machine, - "save": save, - "remove_machine": removeMachine, - "add_machine": addMachine, -} - -func addMachine(L *lua.LState) int { - name := L.ToString(1) - login := L.ToString(2) - password := L.ToString(3) - - n.AddMachine(name, login, password) - - L.Push(luar.New(L, n.Machine(name))) - return 1 -} - -func removeMachine(L *lua.LState) int { - name := L.ToString(1) - - n.RemoveMachine(name) - - return 0 -} - -func machine(L *lua.LState) int { - name := L.ToString(1) - - m := n.Machine(string(name)) - - L.Push(luar.New(L, m)) - return 1 -} - -func save(L *lua.LState) int { - n.Save() - return 0 -} - -// Preload loads netrc into a gopher-lua's LState module registry. -func Preload(L *lua.LState) { - L.PreloadModule("netrc", Loader) -} - -// Loader loads the netrc modules. -func Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), exports) - L.Push(mod) - return 1 -} diff --git a/vendor/github.com/Xe/gluanetrc/netrc.lua b/vendor/github.com/Xe/gluanetrc/netrc.lua deleted file mode 100644 index 18139b2..0000000 --- a/vendor/github.com/Xe/gluanetrc/netrc.lua +++ /dev/null @@ -1,59 +0,0 @@ ---- Module netrc offers a simple interface to a user's netrc file in their home directory. --- @module netrc - -local netrc = {} - ---- add_machine adds a machine to the netrc manifest with a username and password. --- @param name string the domain name of the machine --- @param login string the user name to log in as --- @param password string the password or similar secret for the machine --- @return Machine -function netrc.add_machine(name, login, password) -end - ---- machine loads netrc data for a given machine by domain name. --- Any changes made with the `set` method of a machine will be saved to the disk --- when the module's `save` function is called. If the given machine does not --- exist in the netrc file, this function will return nil. --- @param name string --- @return Machine --- @usage local creds = netrc.machine("api.foobar.com") --- @usage print(creds:get("username"), creds:get("password")) -function netrc.machine(name) - return nil -end - ---- remove_machine removes a single machine from the netrc manifest by name. --- @param name string the name of the machine to remove from the netrc manifest --- @usage netrc.remove_machine("api.digg.com") -function netrc.remove_machine(name) -end - ---- save writes all changes made in machine `set` methods to the disk at $HOME/.netrc. --- This function will raise a lua error if the save fails. This function should --- not fail in the course of normal operation. --- @usage netrc.save() -function netrc.save() -end - ---- Machine is a userdata wrapper around the go netrc.Machine type. --- https://godoc.org/github.com/dickeyxxx/netrc#Machine --- @type Machine - -local Machine = {} - ---- get gets a Machine value by key. --- @param key the netrc key to get --- @return string the value from the netrc --- @usage local cli = api.new(m:get("login"), m:get("password")) -function Machine:get(key) -end - ---- set updates information in this Machine by a key, value pair. --- @param key the netrc key to set --- @param value the value to set the above key to --- @usage m:set("password", "hunter2") -function Machine:set(key, value) -end - -return netrc diff --git a/vendor/github.com/Xe/x/.gitignore b/vendor/github.com/Xe/x/.gitignore deleted file mode 100644 index 3c7b11e..0000000 --- a/vendor/github.com/Xe/x/.gitignore +++ /dev/null @@ -1,26 +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 -*.test -*.prof - -.env diff --git a/vendor/github.com/Xe/x/BLESSING b/vendor/github.com/Xe/x/BLESSING deleted file mode 100644 index 4504e70..0000000 --- a/vendor/github.com/Xe/x/BLESSING +++ /dev/null @@ -1,6 +0,0 @@ -The author disclaims copyright to this source code. In place of -a legal notice, here is a blessing: - - May you do good and not evil. - May you find forgiveness for yourself and forgive others. - May you share freely, never taking more than you give. \ No newline at end of file diff --git a/vendor/github.com/Xe/x/LICENSE b/vendor/github.com/Xe/x/LICENSE deleted file mode 100644 index 1625c17..0000000 --- a/vendor/github.com/Xe/x/LICENSE +++ /dev/null @@ -1,121 +0,0 @@ -Creative Commons Legal Code - -CC0 1.0 Universal - - CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE - LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN - ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS - INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES - REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS - PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM - THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED - HEREUNDER. - -Statement of Purpose - -The laws of most jurisdictions throughout the world automatically confer -exclusive Copyright and Related Rights (defined below) upon the creator -and subsequent owner(s) (each and all, an "owner") of an original work of -authorship and/or a database (each, a "Work"). - -Certain owners wish to permanently relinquish those rights to a Work for -the purpose of contributing to a commons of creative, cultural and -scientific works ("Commons") that the public can reliably and without fear -of later claims of infringement build upon, modify, incorporate in other -works, reuse and redistribute as freely as possible in any form whatsoever -and for any purposes, including without limitation commercial purposes. -These owners may contribute to the Commons to promote the ideal of a free -culture and the further production of creative, cultural and scientific -works, or to gain reputation or greater distribution for their Work in -part through the use and efforts of others. - -For these and/or other purposes and motivations, and without any -expectation of additional consideration or compensation, the person -associating CC0 with a Work (the "Affirmer"), to the extent that he or she -is an owner of Copyright and Related Rights in the Work, voluntarily -elects to apply CC0 to the Work and publicly distribute the Work under its -terms, with knowledge of his or her Copyright and Related Rights in the -Work and the meaning and intended legal effect of CC0 on those rights. - -1. Copyright and Related Rights. A Work made available under CC0 may be -protected by copyright and related or neighboring rights ("Copyright and -Related Rights"). Copyright and Related Rights include, but are not -limited to, the following: - - i. the right to reproduce, adapt, distribute, perform, display, - communicate, and translate a Work; - ii. moral rights retained by the original author(s) and/or performer(s); -iii. publicity and privacy rights pertaining to a person's image or - likeness depicted in a Work; - iv. rights protecting against unfair competition in regards to a Work, - subject to the limitations in paragraph 4(a), below; - v. rights protecting the extraction, dissemination, use and reuse of data - in a Work; - vi. database rights (such as those arising under Directive 96/9/EC of the - European Parliament and of the Council of 11 March 1996 on the legal - protection of databases, and under any national implementation - thereof, including any amended or successor version of such - directive); and -vii. other similar, equivalent or corresponding rights throughout the - world based on applicable law or treaty, and any national - implementations thereof. - -2. Waiver. To the greatest extent permitted by, but not in contravention -of, applicable law, Affirmer hereby overtly, fully, permanently, -irrevocably and unconditionally waives, abandons, and surrenders all of -Affirmer's Copyright and Related Rights and associated claims and causes -of action, whether now known or unknown (including existing as well as -future claims and causes of action), in the Work (i) in all territories -worldwide, (ii) for the maximum duration provided by applicable law or -treaty (including future time extensions), (iii) in any current or future -medium and for any number of copies, and (iv) for any purpose whatsoever, -including without limitation commercial, advertising or promotional -purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each -member of the public at large and to the detriment of Affirmer's heirs and -successors, fully intending that such Waiver shall not be subject to -revocation, rescission, cancellation, termination, or any other legal or -equitable action to disrupt the quiet enjoyment of the Work by the public -as contemplated by Affirmer's express Statement of Purpose. - -3. Public License Fallback. Should any part of the Waiver for any reason -be judged legally invalid or ineffective under applicable law, then the -Waiver shall be preserved to the maximum extent permitted taking into -account Affirmer's express Statement of Purpose. In addition, to the -extent the Waiver is so judged Affirmer hereby grants to each affected -person a royalty-free, non transferable, non sublicensable, non exclusive, -irrevocable and unconditional license to exercise Affirmer's Copyright and -Related Rights in the Work (i) in all territories worldwide, (ii) for the -maximum duration provided by applicable law or treaty (including future -time extensions), (iii) in any current or future medium and for any number -of copies, and (iv) for any purpose whatsoever, including without -limitation commercial, advertising or promotional purposes (the -"License"). The License shall be deemed effective as of the date CC0 was -applied by Affirmer to the Work. Should any part of the License for any -reason be judged legally invalid or ineffective under applicable law, such -partial invalidity or ineffectiveness shall not invalidate the remainder -of the License, and in such case Affirmer hereby affirms that he or she -will not (i) exercise any of his or her remaining Copyright and Related -Rights in the Work or (ii) assert any associated claims and causes of -action with respect to the Work, in either case contrary to Affirmer's -express Statement of Purpose. - -4. Limitations and Disclaimers. - - a. No trademark or patent rights held by Affirmer are waived, abandoned, - surrendered, licensed or otherwise affected by this document. - b. Affirmer offers the Work as-is and makes no representations or - warranties of any kind concerning the Work, express, implied, - statutory or otherwise, including without limitation warranties of - title, merchantability, fitness for a particular purpose, non - infringement, or the absence of latent or other defects, accuracy, or - the present or absence of errors, whether or not discoverable, all to - the greatest extent permissible under applicable law. - c. Affirmer disclaims responsibility for clearing rights of other persons - that may apply to the Work or any use thereof, including without - limitation any person's Copyright and Related Rights in the Work. - Further, Affirmer disclaims responsibility for obtaining any necessary - consents, permissions or other rights required for any use of the - Work. - d. Affirmer understands and acknowledges that Creative Commons is not a - party to this document and has no duty or obligation with respect to - this CC0 or use of the Work. \ No newline at end of file diff --git a/vendor/github.com/Xe/x/README.md b/vendor/github.com/Xe/x/README.md deleted file mode 100644 index a197485..0000000 --- a/vendor/github.com/Xe/x/README.md +++ /dev/null @@ -1,126 +0,0 @@ -# tools -Various tools of mine in Go - -Installing these tools ----------------------- - -To install any of these tools, type in: - -```console -$ go get christine.website/go/tools/$toolname -``` - -For example: - -```console -$ go get christine.website/go/tools/license -``` - -`dokku` -------- - -This is a simple command line tool to interface with Dokku servers. This is -a port of my shell extension -[`dokku.zsh`](https://github.com/Xe/dotfiles/blob/master/.zsh/dokku.zsh) to -a nice Go binary. - -This takes a configuration file for defining multiple servers: - -```ini -[server "default"] -user = dokku -host = panel.apps.xeserv.us -sshkey = /.ssh/id_rsa -``` - -By default it will imply that the SSH key is `~/.ssh/id_rsa` and that the -username is `dokku`. By default the server named `default` will be used for -command execution. - -### TODO - -- [ ] Allow interactive commands -- [ ] Directly pipe stdin and stdout to the ssh connection - ---- - -`license` ---------- - -This is a simple command line tool to help users generate a license file based -on information they have already given their system and is easy for the system -to figure out on its own. - -```console -$ license -Usage of license: -license [options] - - -email="": email of the person licensing the software - -name="": name of the person licensing the software - -out=false: write to a file instead of stdout - -show=false: show all licenses instead of generating one - -By default the name and email are scraped from `git config` -``` - -```console -$ license -show -Licenses available: - zlib - unlicense - mit - apache - bsd-2 - gpl-2 -``` - -```console -$ license zlib -Copyright (c) 2015 Christine Dodrill - -This software is provided 'as-is', without any express or implied -warranty. In no event will the authors be held liable for any damages -arising from the use of this software. - -Permission is granted to anyone to use this software for any purpose, -including commercial applications, and to alter it and redistribute it -freely, subject to the following restrictions: - -1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgement in the product documentation would be - appreciated but is not required. - -2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - -3. This notice may not be removed or altered from any source distribution. -``` - ---- - -`ghstat` --------- - -Command ghstat shows the status of GitHub via their status API. - - Usage of ./ghstat: - -message=false: show last message? - -This follows https://status.github.com/api for all but the list of all recent -status messages. - -```console -$ ghstat -Status: minor (Fri Mar 27 15:24:57 2015) -``` - -```console -$ ghstat -message -Last message: -Status: minor -Message: We've deployed our volumetric attack defenses against an extremely -large amount of traffic. Performance is stabilizing. -Time: Fri Mar 27 15:04:59 2015 -``` diff --git a/vendor/github.com/Xe/x/tools/glue/CHEATSHEET.md b/vendor/github.com/Xe/x/tools/glue/CHEATSHEET.md deleted file mode 100644 index 0536567..0000000 --- a/vendor/github.com/Xe/x/tools/glue/CHEATSHEET.md +++ /dev/null @@ -1,661 +0,0 @@ -## `json` - -```lua -local json = require "json" -``` - -Json encoder/decoder - -The following functions are exposed by the library: - - decode(string): Decodes a JSON string. Returns nil and an error string if - the string could not be decoded. - encode(value): Encodes a value into a JSON string. Returns nil and an error - string if the value could not be encoded. - -## `xmlpath` - -```lua -local xmlpath = require "xmlpath" -``` - -XMLPath style iteration - - xml ="x1x2x3" - local xmlpath = require("xmlpath") - node,err = xmlpath.loadxml(xml) - path,err = xmlpath.compile("//book") - - it = path:iter(node) - for k,v in pairs(it) do - print(k,v:string()) - end - -## `http` - -```lua -local http = require("http") -``` - -HTTP client library - -### API - -- [`http.delete(url [, options])`](#httpdeleteurl--options) -- [`http.get(url [, options])`](#httpgeturl--options) -- [`http.head(url [, options])`](#httpheadurl--options) -- [`http.patch(url [, options])`](#httppatchurl--options) -- [`http.post(url [, options])`](#httpposturl--options) -- [`http.put(url [, options])`](#httpputurl--options) -- [`http.request(method, url [, options])`](#httprequestmethod-url--options) -- [`http.request_batch(requests)`](#httprequest_batchrequests) -- [`http.response`](#httpresponse) - -#### http.delete(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.get(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.head(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.patch(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.post(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.put(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.request(method, url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| method | String | The HTTP request method | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -#### http.request_batch(requests) - -**Attributes** - -| Name | Type | Description | -| -------- | ----- | ----------- | -| requests | Table | A table of requests to send. Each request item is by itself a table containing [http.request](#httprequestmethod-url--options) parameters for the request | - -**Returns** - -[[http.response](#httpresponse)] or ([[http.response](#httpresponse)], [error message]) - -#### http.response - -The `http.response` table contains information about a completed HTTP request. - -**Attributes** - -| Name | Type | Description | -| ----------- | ------ | ----------- | -| body | String | The HTTP response body | -| body_size | Number | The size of the HTTP reponse body in bytes | -| headers | Table | The HTTP response headers | -| cookies | Table | The cookies sent by the server in the HTTP response | -| status_code | Number | The HTTP response status code | -| url | String | The final URL the request ended pointing to after redirects | - -## `url` - -```lua -local url = require "url" -``` - -URL parsing library - -### API - -- [`url.parse(url)`](#urlparseurl) -- [`url.build(options)`](#urlbuildoptions) -- [`url.build_query_string(query_params)`](#urlbuild_query_stringquery_params) -- [`url.resolve(from, to)`](#urlresolvefrom-to) - -#### url.parse(url) - -Parse URL into a table of key/value components. - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL to parsed | - -**Returns** - -Table with parsed URL or (nil, error message) - -| Name | Type | Description | -| -------- | ------ | ----------- | -| scheme | String | Scheme of the URL | -| username | String | Username | -| password | String | Password | -| host | String | Host and port of the URL | -| path | String | Path | -| query | String | Query string | -| fragment | String | Fragment | - -#### url.build(options) - -Assemble a URL string from a table of URL components. - -**Attributes** - -| Name | Type | Description | -| ------- | ----- | ----------- | -| options | Table | Table with URL components, see [`url.parse`](#urlparseurl) for list of valid components | - -**Returns** - -String - -#### url.build_query_string(query_params) - -Assemble table of query string parameters into a string. - -**Attributes** - -| Name | Type | Description | -| ------------ | ----- | ----------- | -| query_params | Table | Table with query parameters | - -**Returns** - -String - -#### url.resolve(from, to) - -Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag. - -| Name | Type | Description | -| ---- | ------ | ----------- | -| from | String | base URL | -| to | String | href URL | - -**Returns** - -String or (nil, error message) - -## `env` - -```lua -local env = require "env" -``` - -Environment manipulation - -### API - -#### `env.set(key, value)` - -Same `os.setenv` - -#### `env.get(key)` - -Same `os.getenv` - -#### `env.loadfile(file)` - -Loads environment variables from a file. The file is as the following: - -``` -AAA=BBB -CCC=DDD -``` - -If this function fails, it returns `nil`, plus a string describing the error. - -## `fs` - -```lua -local fs = require "fs" -``` - -Filesystem manipulation - -### API - -#### `fs.exists(file)` - -Returns true if the file exists. - -#### `fs.read(file)` - -Reads file content and return it. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.write(file, content, [mode])` - -Writes content to the file. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.mkdir(path, [mode, recursive])` - -Create directory. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.remove(path, [recursive])` - -Remove path. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.symlink(target, link)` - -Create symbolic link. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.dirname(path)` - -Returns all but the last element of path. - -#### `fs.basename(path)` - -Returns the last element of path. - -#### `fs.realpath(path)` - -Returns the real path of a given path in the os. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.getcwd()` - -Returns the current working directory. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.chdir(path)` - -Changes the current working directory. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.file()` - -Returns the script file path. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.dir()` - -Returns the directory path that is parent of the script file. If this function fails, it returns `nil`, plus a string describing the error. - -#### `fs.glob(pattern, function)` - -Run the callback function with the files matching pattern. See below example: - -```lua -local fs = require("fs") -local ret, err = fs.glob("/tmp/*", function(file) - print(file.path) - print(file.realpath) -end) -``` - -## `markdown` - -```lua -local markdown = require "markdown" -``` - -Markdown -> HTML for string and file - -### API - -#### `markdown.dostring(text)` - -Returns HTML string generated from the markdown text. - -#### `markdown.dofile(file)` - -Returns HTML string generated from the markdown text file. If this function fails, it returns `nil`, plus a string describing the error. - -## `question` - -```lua -local question = require "question" -``` - -Prompt library - -### API - -* `question.ask(text)` -* `question.secret(text)` - -## `ssh` - -```lua -local ssh = require "ssh" -``` - -SSH client library - -https://github.com/kohkimakimoto/gluassh/blob/master/gluassh_test.go - -## `template` - -```lua -local template = require "template" -``` - -Go text templates - -### API - -#### `template.dostring(text, table)` - -Returns string generated by text template with the table values. If this function fails, it returns `nil`, plus a string describing the error. - -#### `template.dofile(file, table)` - -Returns string generated by file template with the table values. If this function fails, it returns `nil`, plus a string describing the error. - -## `yaml` - -```lua -local yaml = require "yaml" -``` - -Yaml -> table parser - -### API - -#### `yaml.parse(string)` - -Parses yaml formatted string and returns a table. If this function fails, it returns `nil`, plus a string describing the error. - -## `flag` - -```lua -local flag = require "flag" -``` - -Command line flag parsing. - -See the tests here: https://github.com/otm/gluaflag - -```lua -local flag = require "flag" - -fs = flag.new() - -fs:string("name", "foo", "String help string") -fs:intArg("title", 1, "Title") -fs:numberArg("title", 1, "Title") - -flags = fs:parse(arg) -- arg is the remaining command line arguments -assert(flags.title == 2, "expected title to be 2") -assert(flags.title == 2.32, "expected title to be 2.32") -``` - -## `sh` - -```lua -local sh = require "sh" -``` - -gluash is a interface to call any program as it were a function. Programs are executed asynchronously to enable streaming of data in pipes. - -In all discussions bellow the imported module will be referred to as `sh`. - -Commands are called just like functions, executed on the sh module. - -```lua -sh.ls("/") -``` - -For commands that have exotic names, names that are reserved words, or to execute absolute or relative paths call the sh module directly. - -```lua -sh("/bin/ls", "/") -``` - -#### Multiple Arguments -Commands with multiple arguments have to be invoked with a separate string for each argument. - -```lua --- this works -sh.ls("-la", "/") - --- this does not work -sh.ls("-la /") -``` - -#### Piping -Piping in sh is done almost like piping in the shell. Just call next command as a method on the previous command. - -```lua -sh.du("-sb"):sort("-rn"):print() -``` - -If the command has a exotic name, or a reserved word, call the command through `cmd(path, ...args)`. The first argument in `cmd` is the path. - -```lua -sh.du("-sb"):cmd("sort", "-rn"):print() -``` - -### Waiting for Processes -All commands are executed by default in the background, so one have to explicitly wait for a process to finish. There are several ways to wait for the command to finish. - -* `print()` - write stdout and stderr to stdout. -* `ok()` - aborts execution if the command's exit code is not zero -* `success()` - returns true of the commands exit code is zero -* `exitcode()` - returns the exit code of the command - -### Abort by Default -It is possible to set the module to abort on errors without checking. It can be practical in some occasions, however performance will be degraded. When global exit code checks are done the commands are run in series, even in pipes, and output is saved in memory buffers. - -To enable global exit code settings call the sh module with an table with the key `abort` set to true. - -```lua -sh{abort=true} -``` - -To read current settings in the module call the module with an empty table. -```lua -configuration = sh{} -print("abort:", configuration.abort) -``` - -### Analyzing Output -There are several options to analyze the output of a command. - -#### lines() -An iterator is accessible by calling the method `lines()` on the command. - -```lua -for line in sh.cat("/etc/hosts"):lines() do - print(line) -end -``` - -#### stdout([filename]), stderr([filename]), combinedOutput([filename]) -`stdout()`, `stderr()`, and `combinedOutput()` all returns the output of the command as a string. An optional `filename` can be given to the method, in that case the output is also written to the file. The file will be truncated. - -```lua --- print output of command -output = sh.echo("hello world"):combinedOutput("/tmp/output") -print(output) -``` - -In the example above will print `hello world` and it will write it to `/tmp/output` - -### Glob Expansion -There is no glob expansion done on arguments, however there is a glob functionality in sh. - -```lua -sh.ls(sh.glob("*.go")) -``` - -## `re` - -```lua -local re = require "re" -``` - -Regular Expressions - -### API - -re.find , re.gsub, re.match, re.gmatch are available. These functions have the same API as Lua pattern match. -gluare uses the Go regexp package, so you can use regular expressions that are supported in the Go regexp package. - -In addition, the following functions are defined: -``` -gluare.quote(s string) -> string -Arguments: - -s string: a string value to escape meta characters - -Returns: - -string: escaped string -gluare.quote returns a string that quotes all regular expression metacharacters inside the given text. -``` - -## `simplebox` - -```lua -local simplebox = require "simplebox" -``` - -Simple encryption - -### API - -#### Create a new instance of simplebox with a newly generated key - -```lua -local simplebox = require "simplebox" -local key = simplebox.genkey() -print("key is: " .. key) -local sb = simplebox.new() - - -``` diff --git a/vendor/github.com/Xe/x/tools/glue/Dockerfile b/vendor/github.com/Xe/x/tools/glue/Dockerfile deleted file mode 100644 index 23ddabe..0000000 --- a/vendor/github.com/Xe/x/tools/glue/Dockerfile +++ /dev/null @@ -1,4 +0,0 @@ -FROM busybox - -ADD glue /glue -CMD /glue diff --git a/vendor/github.com/Xe/x/tools/glue/Gopkg.lock b/vendor/github.com/Xe/x/tools/glue/Gopkg.lock deleted file mode 100644 index 966fa45..0000000 --- a/vendor/github.com/Xe/x/tools/glue/Gopkg.lock +++ /dev/null @@ -1,181 +0,0 @@ -memo = "" - -[[projects]] - branch = "master" - name = "github.com/ThomasRooney/gexpect" - packages = ["."] - revision = "5482f03509440585d13d8f648989e05903001842" - -[[projects]] - branch = "master" - name = "github.com/ailncode/gluaxmlpath" - packages = ["."] - revision = "6ce478ecb4a60c4fc8929838e0b21b7fb7ca7440" - -[[projects]] - branch = "master" - name = "github.com/brandur/simplebox" - packages = ["."] - revision = "84e9865bb03ad38c464043bf5382ce8c68ca5f0c" - -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluahttp" - packages = ["."] - revision = "b4bfe0c50fea948dcbf3966e120996d6607bbd89" - -[[projects]] - branch = "master" - name = "github.com/cjoudrey/gluaurl" - packages = ["."] - revision = "31cbb9bef199454415879f2e6d609d1136d60cad" - -[[projects]] - branch = "master" - name = "github.com/howeyc/gopass" - packages = ["."] - revision = "bf9dde6d0d2c004a008c27aaee91170c786f6db8" - -[[projects]] - branch = "master" - name = "github.com/kballard/go-shellquote" - packages = ["."] - revision = "d8ec1a69a250a17bb0e419c386eac1f3711dc142" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaenv" - packages = ["."] - revision = "2888db6bbe38923d59c42e443895875cc8ce0820" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluafs" - packages = ["."] - revision = "01391ed2d7ab89dc80157605b073403f960aa223" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluaquestion" - packages = ["."] - revision = "311437c29ba54d027ad2af383661725ae2bfdcdc" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluassh" - packages = ["."] - revision = "2a7bd48d7568de8230c87ac1ef4a4c481e45814d" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluatemplate" - packages = ["."] - revision = "d9e2c9d6b00f069a9da377a9ac529c827c1c7d71" - -[[projects]] - branch = "master" - name = "github.com/kohkimakimoto/gluayaml" - packages = ["."] - revision = "6fe413d49d73d785510ecf1529991ab0573e96c7" - -[[projects]] - branch = "master" - name = "github.com/kr/fs" - packages = ["."] - revision = "2788f0dbd16903de03cb8186e5c7d97b69ad387b" - -[[projects]] - branch = "master" - name = "github.com/kr/pty" - packages = ["."] - revision = "ce7fa45920dc37a92de8377972e52bc55ffa8d57" - -[[projects]] - branch = "master" - name = "github.com/mitchellh/mapstructure" - packages = ["."] - revision = "cc8532a8e9a55ea36402aa21efdf403a60d34096" - -[[projects]] - branch = "master" - name = "github.com/otm/gluaflag" - packages = ["."] - revision = "078088de689148194436293886e8e39809167332" - -[[projects]] - branch = "master" - name = "github.com/otm/gluash" - packages = ["."] - revision = "e145c563986f0b91f740a758a84bca46c163aec7" - -[[projects]] - branch = "master" - name = "github.com/pkg/sftp" - packages = ["."] - revision = "e84cc8c755ca39b7b64f510fe1fffc1b51f210a5" - -[[projects]] - branch = "master" - name = "github.com/yookoala/realpath" - packages = ["."] - revision = "c416d99ab5ed256fa30c1f3bab73152deb59bb69" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluamapper" - packages = ["."] - revision = "d836955830e75240d46ce9f0e6d148d94f2e1d3a" - -[[projects]] - branch = "master" - name = "github.com/yuin/gluare" - packages = ["."] - revision = "8e2742cd1bf2b904720ac66eca3c2091b2ea0720" - -[[projects]] - branch = "master" - name = "github.com/yuin/gopher-lua" - packages = [".","parse"] - revision = "33ebc07735566cd0c3c4b69e2839d522cc389852" - -[[projects]] - branch = "master" - name = "golang.org/x/crypto" - packages = ["nacl/secretbox","ssh/terminal","ssh","ssh/agent"] - revision = "dd85ac7e6a88fc6ca420478e934de5f1a42dd3c6" - -[[projects]] - branch = "master" - name = "golang.org/x/net" - packages = ["html"] - revision = "66aacef3dd8a676686c7ae3716979581e8b03c47" - -[[projects]] - branch = "master" - name = "golang.org/x/sys" - packages = ["unix"] - revision = "9ccfe848b9db8435a24c424abbc07a921adf1df5" - -[[projects]] - branch = "v2" - name = "gopkg.in/xmlpath.v2" - packages = ["."] - revision = "860cbeca3ebcc600db0b213c0e83ad6ce91f5739" - -[[projects]] - branch = "master" - name = "gopkg.in/yaml.v2" - packages = ["."] - revision = "cd8b52f8269e0feb286dfeef29f8fe4d5b397e0b" - -[[projects]] - branch = "master" - name = "layeh.com/gopher-json" - packages = ["."] - revision = "c128cc74278be889c4381681712931976fe0d88b" - -[[projects]] - branch = "master" - name = "layeh.com/gopher-luar" - packages = ["."] - revision = "80196fe2abc5682963fc7a5261f5a5d77509938b" diff --git a/vendor/github.com/Xe/x/tools/glue/Gopkg.toml b/vendor/github.com/Xe/x/tools/glue/Gopkg.toml deleted file mode 100644 index 243127a..0000000 --- a/vendor/github.com/Xe/x/tools/glue/Gopkg.toml +++ /dev/null @@ -1,68 +0,0 @@ - -[[dependencies]] - branch = "master" - name = "github.com/ThomasRooney/gexpect" - -[[dependencies]] - branch = "master" - name = "github.com/ailncode/gluaxmlpath" - -[[dependencies]] - branch = "master" - name = "github.com/brandur/simplebox" - -[[dependencies]] - branch = "master" - name = "github.com/cjoudrey/gluahttp" - -[[dependencies]] - branch = "master" - name = "github.com/cjoudrey/gluaurl" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluaenv" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluafs" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluaquestion" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluassh" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluatemplate" - -[[dependencies]] - branch = "master" - name = "github.com/kohkimakimoto/gluayaml" - -[[dependencies]] - branch = "master" - name = "github.com/otm/gluaflag" - -[[dependencies]] - branch = "master" - name = "github.com/otm/gluash" - -[[dependencies]] - branch = "master" - name = "github.com/yuin/gluare" - -[[dependencies]] - branch = "master" - name = "github.com/yuin/gopher-lua" - -[[dependencies]] - branch = "master" - name = "layeh.com/gopher-json" - -[[dependencies]] - branch = "master" - name = "layeh.com/gopher-luar" diff --git a/vendor/github.com/Xe/x/tools/glue/README.md b/vendor/github.com/Xe/x/tools/glue/README.md deleted file mode 100644 index dd33582..0000000 --- a/vendor/github.com/Xe/x/tools/glue/README.md +++ /dev/null @@ -1,18 +0,0 @@ -glue -==== - -Basically gopher-lua's cmd/glua with the following modules imported: -- https://godoc.org/layeh.com/gopher-json -- https://github.com/ailncode/gluaxmlpath -- https://github.com/cjoudrey/gluahttp -- https://github.com/cjoudrey/gluaurl -- https://github.com/kohkimakimoto/gluaenv -- https://github.com/kohkimakimoto/gluafs -- https://github.com/kohkimakimoto/gluamarkdown -- https://github.com/kohkimakimoto/gluaquestion -- https://github.com/kohkimakimoto/gluassh -- https://github.com/kohkimakimoto/gluatemplate -- https://github.com/kohkimakimoto/gluayaml -- https://github.com/otm/gluaflag -- https://github.com/otm/gluash -- https://github.com/yuin/gluare diff --git a/vendor/github.com/Xe/x/tools/glue/box.rb b/vendor/github.com/Xe/x/tools/glue/box.rb deleted file mode 100644 index 3b4d18e..0000000 --- a/vendor/github.com/Xe/x/tools/glue/box.rb +++ /dev/null @@ -1,6 +0,0 @@ -from "alpine:edge" - -copy "glue", "/glue" -cmd "/glue" -flatten -tag "xena/glue" diff --git a/vendor/github.com/Xe/x/tools/glue/build.lua b/vendor/github.com/Xe/x/tools/glue/build.lua deleted file mode 100644 index 31fe844..0000000 --- a/vendor/github.com/Xe/x/tools/glue/build.lua +++ /dev/null @@ -1,20 +0,0 @@ --- expects glue, $ go get -u github.com/Xe/tools/glue -local sh = require "sh" -sh { abort = true } - -if os.getenv("CGO_ENABLED") ~= "0" then - error("CGO_ENABLED must be set to 1") -end - -print "building glue..." -sh.go("build"):print() -sh.upx("--ultra-brute", "glue"):print() -sh.box("box.rb"):print() - -print "releasing to docker hub" -sh.docker("push", "xena/glue"):print() - -print "moving glue binary to $GOPATH/bin" -sh.mv("glue", (os.getenv("GOPATH") .. "/bin/glue")) - -print "build/release complete" diff --git a/vendor/github.com/Xe/x/tools/glue/glue b/vendor/github.com/Xe/x/tools/glue/glue deleted file mode 100755 index f2112bb..0000000 Binary files a/vendor/github.com/Xe/x/tools/glue/glue and /dev/null differ diff --git a/vendor/github.com/Xe/x/tools/glue/glue.go b/vendor/github.com/Xe/x/tools/glue/glue.go deleted file mode 100644 index e6e80dd..0000000 --- a/vendor/github.com/Xe/x/tools/glue/glue.go +++ /dev/null @@ -1,213 +0,0 @@ -package main - -import ( - "bufio" - "flag" - "fmt" - "net/http" - "os" - "runtime/pprof" - - "github.com/Xe/x/tools/glue/libs/gluaexpect" - "github.com/Xe/x/tools/glue/libs/gluasimplebox" - "github.com/ailncode/gluaxmlpath" - "github.com/cjoudrey/gluahttp" - "github.com/cjoudrey/gluaurl" - "github.com/kohkimakimoto/gluaenv" - "github.com/kohkimakimoto/gluafs" - "github.com/kohkimakimoto/gluaquestion" - "github.com/kohkimakimoto/gluassh" - "github.com/kohkimakimoto/gluatemplate" - "github.com/kohkimakimoto/gluayaml" - "github.com/otm/gluaflag" - "github.com/otm/gluash" - "github.com/yuin/gluare" - "github.com/yuin/gopher-lua" - "github.com/yuin/gopher-lua/parse" - json "layeh.com/gopher-json" -) - -func main() { - os.Exit(mainAux()) -} - -func mainAux() int { - var opt_e, opt_l, opt_p string - var opt_i, opt_v, opt_dt, opt_dc bool - var opt_m int - flag.StringVar(&opt_e, "e", "", "") - flag.StringVar(&opt_l, "l", "", "") - flag.StringVar(&opt_p, "p", "", "") - flag.IntVar(&opt_m, "mx", 0, "") - flag.BoolVar(&opt_i, "i", false, "") - flag.BoolVar(&opt_v, "v", false, "") - flag.BoolVar(&opt_dt, "dt", false, "") - flag.BoolVar(&opt_dc, "dc", false, "") - flag.Usage = func() { - fmt.Println(`Usage: glue [options] [script [args]]. -Available options are: - -e stat execute string 'stat' - -l name require library 'name' - -mx MB memory limit(default: unlimited) - -dt dump AST trees - -dc dump VM codes - -i enter interactive mode after executing 'script' - -p file write cpu profiles to the file - -v show version information -`) - } - flag.Parse() - if len(opt_p) != 0 { - f, err := os.Create(opt_p) - if err != nil { - fmt.Println(err.Error()) - os.Exit(1) - } - pprof.StartCPUProfile(f) - defer pprof.StopCPUProfile() - } - if len(opt_e) == 0 && !opt_i && !opt_v && flag.NArg() == 0 { - opt_i = true - } - - status := 0 - - L := lua.NewState() - defer L.Close() - if opt_m > 0 { - L.SetMx(opt_m) - } - - preload(L) - - if opt_v || opt_i { - fmt.Println(lua.PackageCopyRight) - } - - if len(opt_l) > 0 { - if err := L.DoFile(opt_l); err != nil { - fmt.Println(err.Error()) - } - } - - if nargs := flag.NArg(); nargs > 0 { - script := flag.Arg(0) - argtb := L.NewTable() - for i := 1; i < nargs; i++ { - L.RawSet(argtb, lua.LNumber(i), lua.LString(flag.Arg(i))) - } - L.SetGlobal("arg", argtb) - if opt_dt || opt_dc { - file, err := os.Open(script) - if err != nil { - fmt.Println(err.Error()) - return 1 - } - chunk, err2 := parse.Parse(file, script) - if err2 != nil { - fmt.Println(err2.Error()) - return 1 - } - if opt_dt { - fmt.Println(parse.Dump(chunk)) - } - if opt_dc { - proto, err3 := lua.Compile(chunk, script) - if err3 != nil { - fmt.Println(err3.Error()) - return 1 - } - fmt.Println(proto.String()) - } - } - - if err := L.DoFile(script); err != nil { - fmt.Println(err.Error()) - status = 1 - } - } - - if len(opt_e) > 0 { - if err := L.DoString(opt_e); err != nil { - fmt.Println(err.Error()) - status = 1 - } - } - - if opt_i { - doREPL(L) - } - return status -} - -func preload(L *lua.LState) { - L.PreloadModule("re", gluare.Loader) - L.PreloadModule("sh", gluash.Loader) - L.PreloadModule("fs", gluafs.Loader) - L.PreloadModule("env", gluaenv.Loader) - L.PreloadModule("yaml", gluayaml.Loader) - L.PreloadModule("question", gluaquestion.Loader) - L.PreloadModule("ssh", gluassh.Loader) - L.PreloadModule("http", gluahttp.NewHttpModule(&http.Client{}).Loader) - L.PreloadModule("flag", gluaflag.Loader) - L.PreloadModule("template", gluatemplate.Loader) - L.PreloadModule("url", gluaurl.Loader) - gluaexpect.Preload(L) - gluasimplebox.Preload(L) - gluaxmlpath.Preload(L) - json.Preload(L) -} - -// do read/eval/print/loop -func doREPL(L *lua.LState) { - reader := bufio.NewReader(os.Stdin) - for { - if str, err := loadline(reader, L); err == nil { - if err := L.DoString(str); err != nil { - fmt.Println(err) - } - } else { // error on loadline - fmt.Println(err) - return - } - } -} - -func incomplete(err error) bool { - if lerr, ok := err.(*lua.ApiError); ok { - if perr, ok := lerr.Cause.(*parse.Error); ok { - return perr.Pos.Line == parse.EOF - } - } - return false -} - -func loadline(reader *bufio.Reader, L *lua.LState) (string, error) { - fmt.Print("> ") - if line, err := reader.ReadString('\n'); err == nil { - if _, err := L.LoadString("return " + line); err == nil { // try add return <...> then compile - return line, nil - } else { - return multiline(line, reader, L) - } - } else { - return "", err - } -} - -func multiline(ml string, reader *bufio.Reader, L *lua.LState) (string, error) { - for { - if _, err := L.LoadString(ml); err == nil { // try compile - return ml, nil - } else if !incomplete(err) { // syntax error , but not EOF - return ml, nil - } else { - fmt.Print(">> ") - if line, err := reader.ReadString('\n'); err == nil { - ml = ml + "\n" + line - } else { - return "", err - } - } - } -} diff --git a/vendor/github.com/Xe/x/tools/glue/libs/gluaexpect/expect.go b/vendor/github.com/Xe/x/tools/glue/libs/gluaexpect/expect.go deleted file mode 100644 index cc33597..0000000 --- a/vendor/github.com/Xe/x/tools/glue/libs/gluaexpect/expect.go +++ /dev/null @@ -1,35 +0,0 @@ -package gluaexpect - -import ( - "github.com/ThomasRooney/gexpect" - lua "github.com/yuin/gopher-lua" - luar "layeh.com/gopher-luar" -) - -func Preload(L *lua.LState) { - L.PreloadModule("expect", Loader) -} - -// Loader is the module loader function. -func Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), api) - L.Push(mod) - return 1 -} - -var api = map[string]lua.LGFunction{ - "spawn": spawn, -} - -func spawn(L *lua.LState) int { - cmd := L.CheckString(1) - child, err := gexpect.Spawn(cmd) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - - L.Push(luar.New(L, child)) - return 1 -} diff --git a/vendor/github.com/Xe/x/tools/glue/libs/gluasimplebox/sb.go b/vendor/github.com/Xe/x/tools/glue/libs/gluasimplebox/sb.go deleted file mode 100644 index 5641782..0000000 --- a/vendor/github.com/Xe/x/tools/glue/libs/gluasimplebox/sb.go +++ /dev/null @@ -1,100 +0,0 @@ -package gluasimplebox - -import ( - "crypto/rand" - "encoding/base64" - "encoding/hex" - "errors" - - "github.com/brandur/simplebox" - lua "github.com/yuin/gopher-lua" - luar "layeh.com/gopher-luar" -) - -func Preload(L *lua.LState) { - L.PreloadModule("simplebox", Loader) -} - -// Loader is the module loader function. -func Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), api) - L.Push(mod) - return 1 -} - -var api = map[string]lua.LGFunction{ - "new": newSecretBox, - "genkey": genKey, -} - -func newSecretBox(L *lua.LState) int { - key := L.CheckString(1) - - k, err := parseKey(key) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - - sb := simplebox.NewFromSecretKey(k) - - L.Push(luar.New(L, &box{sb: sb})) - return 1 -} - -func genKey(L *lua.LState) int { - key, err := generateKey() - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - - L.Push(lua.LString(base64.URLEncoding.EncodeToString(key[:]))) - return 1 -} - -func generateKey() (*[32]byte, error) { - var k [32]byte - _, err := rand.Read(k[:]) - if err != nil { - return nil, err - } - return &k, nil -} - -func parseKey(s string) (*[32]byte, error) { - k := &[32]byte{} - raw, err := base64.URLEncoding.DecodeString(s) - if err != nil { - return nil, err - } - if n := copy(k[:], raw); n < len(k) { - return nil, errors.New("not valid") - } - return k, nil -} - -type box struct { - sb *simplebox.SimpleBox -} - -func (b *box) Encrypt(data string) string { - result := b.sb.Encrypt([]byte(data)) - return hex.EncodeToString(result) -} - -func (b *box) Decrypt(data string) (string, error) { - d, err := hex.DecodeString(data) - if err != nil { - return "", err - } - - plain, err := b.sb.Decrypt([]byte(d)) - if err != nil { - return "", err - } - - return string(plain), nil -} diff --git a/vendor/github.com/agext/levenshtein/.gitignore b/vendor/github.com/agext/levenshtein/.gitignore deleted file mode 100644 index 404365f..0000000 --- a/vendor/github.com/agext/levenshtein/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -README.html -coverage.out diff --git a/vendor/github.com/agext/levenshtein/.travis.yml b/vendor/github.com/agext/levenshtein/.travis.yml deleted file mode 100644 index 95be94a..0000000 --- a/vendor/github.com/agext/levenshtein/.travis.yml +++ /dev/null @@ -1,70 +0,0 @@ -language: go -sudo: false -go: - - 1.8 - - 1.7.5 - - 1.7.4 - - 1.7.3 - - 1.7.2 - - 1.7.1 - - 1.7 - - tip - - 1.6.4 - - 1.6.3 - - 1.6.2 - - 1.6.1 - - 1.6 - - 1.5.4 - - 1.5.3 - - 1.5.2 - - 1.5.1 - - 1.5 - - 1.4.3 - - 1.4.2 - - 1.4.1 - - 1.4 - - 1.3.3 - - 1.3.2 - - 1.3.1 - - 1.3 - - 1.2.2 - - 1.2.1 - - 1.2 - - 1.1.2 - - 1.1.1 - - 1.1 -before_install: - - go get github.com/mattn/goveralls -script: - - $HOME/gopath/bin/goveralls -service=travis-ci -notifications: - email: - on_success: never -matrix: - fast_finish: true - allow_failures: - - go: tip - - go: 1.6.4 - - go: 1.6.3 - - go: 1.6.2 - - go: 1.6.1 - - go: 1.6 - - go: 1.5.4 - - go: 1.5.3 - - go: 1.5.2 - - go: 1.5.1 - - go: 1.5 - - go: 1.4.3 - - go: 1.4.2 - - go: 1.4.1 - - go: 1.4 - - go: 1.3.3 - - go: 1.3.2 - - go: 1.3.1 - - go: 1.3 - - go: 1.2.2 - - go: 1.2.1 - - go: 1.2 - - go: 1.1.2 - - go: 1.1.1 - - go: 1.1 diff --git a/vendor/github.com/agext/levenshtein/DCO b/vendor/github.com/agext/levenshtein/DCO deleted file mode 100644 index 716561d..0000000 --- a/vendor/github.com/agext/levenshtein/DCO +++ /dev/null @@ -1,36 +0,0 @@ -Developer Certificate of Origin -Version 1.1 - -Copyright (C) 2004, 2006 The Linux Foundation and its contributors. -660 York Street, Suite 102, -San Francisco, CA 94110 USA - -Everyone is permitted to copy and distribute verbatim copies of this -license document, but changing it is not allowed. - - -Developer's Certificate of Origin 1.1 - -By making a contribution to this project, I certify that: - -(a) The contribution was created in whole or in part by me and I - have the right to submit it under the open source license - indicated in the file; or - -(b) The contribution is based upon previous work that, to the best - of my knowledge, is covered under an appropriate open source - license and I have the right under that license to submit that - work with modifications, whether created in whole or in part - by me, under the same open source license (unless I am - permitted to submit under a different license), as indicated - in the file; or - -(c) The contribution was provided directly to me by some other - person who certified (a), (b) or (c) and I have not modified - it. - -(d) I understand and agree that this project and the contribution - are public and that a record of the contribution (including all - personal information I submit with it, including my sign-off) is - maintained indefinitely and may be redistributed consistent with - this project or the open source license(s) involved. diff --git a/vendor/github.com/agext/levenshtein/LICENSE b/vendor/github.com/agext/levenshtein/LICENSE deleted file mode 100644 index 261eeb9..0000000 --- a/vendor/github.com/agext/levenshtein/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 [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/agext/levenshtein/MAINTAINERS b/vendor/github.com/agext/levenshtein/MAINTAINERS deleted file mode 100644 index 726c2af..0000000 --- a/vendor/github.com/agext/levenshtein/MAINTAINERS +++ /dev/null @@ -1 +0,0 @@ -Alex Bucataru (@AlexBucataru) diff --git a/vendor/github.com/agext/levenshtein/NOTICE b/vendor/github.com/agext/levenshtein/NOTICE deleted file mode 100644 index eaffaab..0000000 --- a/vendor/github.com/agext/levenshtein/NOTICE +++ /dev/null @@ -1,5 +0,0 @@ -Alrux Go EXTensions (AGExt) - package levenshtein -Copyright 2016 ALRUX Inc. - -This product includes software developed at ALRUX Inc. -(http://www.alrux.com/). diff --git a/vendor/github.com/agext/levenshtein/README.md b/vendor/github.com/agext/levenshtein/README.md deleted file mode 100644 index 90509c2..0000000 --- a/vendor/github.com/agext/levenshtein/README.md +++ /dev/null @@ -1,38 +0,0 @@ -# A Go package for calculating the Levenshtein distance between two strings - -[![Release](https://img.shields.io/github/release/agext/levenshtein.svg?style=flat)](https://github.com/agext/levenshtein/releases/latest) -[![GoDoc](https://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/agext/levenshtein)  -[![Build Status](https://travis-ci.org/agext/levenshtein.svg?branch=master&style=flat)](https://travis-ci.org/agext/levenshtein) -[![Coverage Status](https://coveralls.io/repos/github/agext/levenshtein/badge.svg?style=flat)](https://coveralls.io/github/agext/levenshtein) -[![Go Report Card](https://goreportcard.com/badge/github.com/agext/levenshtein?style=flat)](https://goreportcard.com/report/github.com/agext/levenshtein) - - -This package implements distance and similarity metrics for strings, based on the Levenshtein measure, in [Go](http://golang.org). - -## Project Status - -v1.2.1 Stable: Guaranteed no breaking changes to the API in future v1.x releases. Probably safe to use in production, though provided on "AS IS" basis. - -This package is being actively maintained. If you encounter any problems or have any suggestions for improvement, please [open an issue](https://github.com/agext/levenshtein/issues). Pull requests are welcome. - -## Overview - -The Levenshtein `Distance` between two strings is the minimum total cost of edits that would convert the first string into the second. The allowed edit operations are insertions, deletions, and substitutions, all at character (one UTF-8 code point) level. Each operation has a default cost of 1, but each can be assigned its own cost equal to or greater than 0. - -A `Distance` of 0 means the two strings are identical, and the higher the value the more different the strings. Since in practice we are interested in finding if the two strings are "close enough", it often does not make sense to continue the calculation once the result is mathematically guaranteed to exceed a desired threshold. Providing this value to the `Distance` function allows it to take a shortcut and return a lower bound instead of an exact cost when the threshold is exceeded. - -The `Similarity` function calculates the distance, then converts it into a normalized metric within the range 0..1, with 1 meaning the strings are identical, and 0 that they have nothing in common. A minimum similarity threshold can be provided to speed up the calculation of the metric for strings that are far too dissimilar for the purpose at hand. All values under this threshold are rounded down to 0. - -The `Match` function provides a similarity metric, with the same range and meaning as `Similarity`, but with a bonus for string pairs that share a common prefix and have a similarity above a "bonus threshold". It uses the same method as proposed by Winkler for the Jaro distance, and the reasoning behind it is that these string pairs are very likely spelling variations or errors, and they are more closely linked than the edit distance alone would suggest. - -The underlying `Calculate` function is also exported, to allow the building of other derivative metrics, if needed. - -## Installation - -``` -go get github.com/agext/levenshtein -``` - -## License - -Package levenshtein is released under the Apache 2.0 license. See the [LICENSE](LICENSE) file for details. diff --git a/vendor/github.com/agext/levenshtein/levenshtein.go b/vendor/github.com/agext/levenshtein/levenshtein.go deleted file mode 100644 index df69ce7..0000000 --- a/vendor/github.com/agext/levenshtein/levenshtein.go +++ /dev/null @@ -1,290 +0,0 @@ -// Copyright 2016 ALRUX 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. - -/* -Package levenshtein implements distance and similarity metrics for strings, based on the Levenshtein measure. - -The Levenshtein `Distance` between two strings is the minimum total cost of edits that would convert the first string into the second. The allowed edit operations are insertions, deletions, and substitutions, all at character (one UTF-8 code point) level. Each operation has a default cost of 1, but each can be assigned its own cost equal to or greater than 0. - -A `Distance` of 0 means the two strings are identical, and the higher the value the more different the strings. Since in practice we are interested in finding if the two strings are "close enough", it often does not make sense to continue the calculation once the result is mathematically guaranteed to exceed a desired threshold. Providing this value to the `Distance` function allows it to take a shortcut and return a lower bound instead of an exact cost when the threshold is exceeded. - -The `Similarity` function calculates the distance, then converts it into a normalized metric within the range 0..1, with 1 meaning the strings are identical, and 0 that they have nothing in common. A minimum similarity threshold can be provided to speed up the calculation of the metric for strings that are far too dissimilar for the purpose at hand. All values under this threshold are rounded down to 0. - -The `Match` function provides a similarity metric, with the same range and meaning as `Similarity`, but with a bonus for string pairs that share a common prefix and have a similarity above a "bonus threshold". It uses the same method as proposed by Winkler for the Jaro distance, and the reasoning behind it is that these string pairs are very likely spelling variations or errors, and they are more closely linked than the edit distance alone would suggest. - -The underlying `Calculate` function is also exported, to allow the building of other derivative metrics, if needed. -*/ -package levenshtein - -// Calculate determines the Levenshtein distance between two strings, using -// the given costs for each edit operation. It returns the distance along with -// the lengths of the longest common prefix and suffix. -// -// If maxCost is non-zero, the calculation stops as soon as the distance is determined -// to be greater than maxCost. Therefore, any return value higher than maxCost is a -// lower bound for the actual distance. -func Calculate(str1, str2 []rune, maxCost, insCost, subCost, delCost int) (dist, prefixLen, suffixLen int) { - l1, l2 := len(str1), len(str2) - // trim common prefix, if any, as it doesn't affect the distance - for ; prefixLen < l1 && prefixLen < l2; prefixLen++ { - if str1[prefixLen] != str2[prefixLen] { - break - } - } - str1, str2 = str1[prefixLen:], str2[prefixLen:] - l1 -= prefixLen - l2 -= prefixLen - // trim common suffix, if any, as it doesn't affect the distance - for 0 < l1 && 0 < l2 { - if str1[l1-1] != str2[l2-1] { - str1, str2 = str1[:l1], str2[:l2] - break - } - l1-- - l2-- - suffixLen++ - } - // if the first string is empty, the distance is the length of the second string times the cost of insertion - if l1 == 0 { - dist = l2 * insCost - return - } - // if the second string is empty, the distance is the length of the first string times the cost of deletion - if l2 == 0 { - dist = l1 * delCost - return - } - - // variables used in inner "for" loops - var y, dy, c, l int - - // if maxCost is greater than or equal to the maximum possible distance, it's equivalent to 'unlimited' - if maxCost > 0 { - if subCost < delCost+insCost { - if maxCost >= l1*subCost+(l2-l1)*insCost { - maxCost = 0 - } - } else { - if maxCost >= l1*delCost+l2*insCost { - maxCost = 0 - } - } - } - - if maxCost > 0 { - // prefer the longer string first, to minimize time; - // a swap also transposes the meanings of insertion and deletion. - if l1 < l2 { - str1, str2, l1, l2, insCost, delCost = str2, str1, l2, l1, delCost, insCost - } - - // the length differential times cost of deletion is a lower bound for the cost; - // if it is higher than the maxCost, there is no point going into the main calculation. - if dist = (l1 - l2) * delCost; dist > maxCost { - return - } - - d := make([]int, l1+1) - - // offset and length of d in the current row - doff, dlen := 0, 1 - for y, dy = 1, delCost; y <= l1 && dy <= maxCost; dlen++ { - d[y] = dy - y++ - dy = y * delCost - } - // fmt.Printf("%q -> %q: init doff=%d dlen=%d d[%d:%d]=%v\n", str1, str2, doff, dlen, doff, doff+dlen, d[doff:doff+dlen]) - - for x := 0; x < l2; x++ { - dy, d[doff] = d[doff], d[doff]+insCost - for d[doff] > maxCost && dlen > 0 { - if str1[doff] != str2[x] { - dy += subCost - } - doff++ - dlen-- - if c = d[doff] + insCost; c < dy { - dy = c - } - dy, d[doff] = d[doff], dy - } - for y, l = doff, doff+dlen-1; y < l; dy, d[y] = d[y], dy { - if str1[y] != str2[x] { - dy += subCost - } - if c = d[y] + delCost; c < dy { - dy = c - } - y++ - if c = d[y] + insCost; c < dy { - dy = c - } - } - if y < l1 { - if str1[y] != str2[x] { - dy += subCost - } - if c = d[y] + delCost; c < dy { - dy = c - } - for ; dy <= maxCost && y < l1; dy, d[y] = dy+delCost, dy { - y++ - dlen++ - } - } - // fmt.Printf("%q -> %q: x=%d doff=%d dlen=%d d[%d:%d]=%v\n", str1, str2, x, doff, dlen, doff, doff+dlen, d[doff:doff+dlen]) - if dlen == 0 { - dist = maxCost + 1 - return - } - } - if doff+dlen-1 < l1 { - dist = maxCost + 1 - return - } - dist = d[l1] - } else { - // ToDo: This is O(l1*l2) time and O(min(l1,l2)) space; investigate if it is - // worth to implement diagonal approach - O(l1*(1+dist)) time, up to O(l1*l2) space - // http://www.csse.monash.edu.au/~lloyd/tildeStrings/Alignment/92.IPL.html - - // prefer the shorter string first, to minimize space; time is O(l1*l2) anyway; - // a swap also transposes the meanings of insertion and deletion. - if l1 > l2 { - str1, str2, l1, l2, insCost, delCost = str2, str1, l2, l1, delCost, insCost - } - d := make([]int, l1+1) - - for y = 1; y <= l1; y++ { - d[y] = y * delCost - } - for x := 0; x < l2; x++ { - dy, d[0] = d[0], d[0]+insCost - for y = 0; y < l1; dy, d[y] = d[y], dy { - if str1[y] != str2[x] { - dy += subCost - } - if c = d[y] + delCost; c < dy { - dy = c - } - y++ - if c = d[y] + insCost; c < dy { - dy = c - } - } - } - dist = d[l1] - } - - return -} - -// Distance returns the Levenshtein distance between str1 and str2, using the -// default or provided cost values. Pass nil for the third argument to use the -// default cost of 1 for all three operations, with no maximum. -func Distance(str1, str2 string, p *Params) int { - if p == nil { - p = defaultParams - } - dist, _, _ := Calculate([]rune(str1), []rune(str2), p.maxCost, p.insCost, p.subCost, p.delCost) - return dist -} - -// Similarity returns a score in the range of 0..1 for how similar the two strings are. -// A score of 1 means the strings are identical, and 0 means they have nothing in common. -// -// A nil third argument uses the default cost of 1 for all three operations. -// -// If a non-zero MinScore value is provided in the parameters, scores lower than it -// will be returned as 0. -func Similarity(str1, str2 string, p *Params) float64 { - return Match(str1, str2, p.Clone().BonusThreshold(1.1)) // guaranteed no bonus -} - -// Match returns a similarity score adjusted by the same method as proposed by Winkler for -// the Jaro distance - giving a bonus to string pairs that share a common prefix, only if their -// similarity score is already over a threshold. -// -// The score is in the range of 0..1, with 1 meaning the strings are identical, -// and 0 meaning they have nothing in common. -// -// A nil third argument uses the default cost of 1 for all three operations, maximum length of -// common prefix to consider for bonus of 4, scaling factor of 0.1, and bonus threshold of 0.7. -// -// If a non-zero MinScore value is provided in the parameters, scores lower than it -// will be returned as 0. -func Match(str1, str2 string, p *Params) float64 { - s1, s2 := []rune(str1), []rune(str2) - l1, l2 := len(s1), len(s2) - // two empty strings are identical; shortcut also avoids divByZero issues later on. - if l1 == 0 && l2 == 0 { - return 1 - } - - if p == nil { - p = defaultParams - } - - // a min over 1 can never be satisfied, so the score is 0. - if p.minScore > 1 { - return 0 - } - - insCost, delCost, maxDist, max := p.insCost, p.delCost, 0, 0 - if l1 > l2 { - l1, l2, insCost, delCost = l2, l1, delCost, insCost - } - - if p.subCost < delCost+insCost { - maxDist = l1*p.subCost + (l2-l1)*insCost - } else { - maxDist = l1*delCost + l2*insCost - } - - // a zero min is always satisfied, so no need to set a max cost. - if p.minScore > 0 { - // if p.minScore is lower than p.bonusThreshold, we can use a simplified formula - // for the max cost, because a sim score below min cannot receive a bonus. - if p.minScore < p.bonusThreshold { - // round down the max - a cost equal to a rounded up max would already be under min. - max = int((1 - p.minScore) * float64(maxDist)) - } else { - // p.minScore <= sim + p.bonusPrefix*p.bonusScale*(1-sim) - // p.minScore <= (1-dist/maxDist) + p.bonusPrefix*p.bonusScale*(1-(1-dist/maxDist)) - // p.minScore <= 1 - dist/maxDist + p.bonusPrefix*p.bonusScale*dist/maxDist - // 1 - p.minScore >= dist/maxDist - p.bonusPrefix*p.bonusScale*dist/maxDist - // (1-p.minScore)*maxDist/(1-p.bonusPrefix*p.bonusScale) >= dist - max = int((1 - p.minScore) * float64(maxDist) / (1 - float64(p.bonusPrefix)*p.bonusScale)) - } - } - - dist, pl, _ := Calculate(s1, s2, max, p.insCost, p.subCost, p.delCost) - if max > 0 && dist > max { - return 0 - } - sim := 1 - float64(dist)/float64(maxDist) - - if sim >= p.bonusThreshold && sim < 1 && p.bonusPrefix > 0 && p.bonusScale > 0 { - if pl > p.bonusPrefix { - pl = p.bonusPrefix - } - sim += float64(pl) * p.bonusScale * (1 - sim) - } - - if sim < p.minScore { - return 0 - } - - return sim -} diff --git a/vendor/github.com/agext/levenshtein/levenshtein_test.go b/vendor/github.com/agext/levenshtein/levenshtein_test.go deleted file mode 100644 index 7a16548..0000000 --- a/vendor/github.com/agext/levenshtein/levenshtein_test.go +++ /dev/null @@ -1,213 +0,0 @@ -// Copyright 2016 ALRUX 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. - -package levenshtein - -import ( - "testing" -) - -type e struct { - cost, lp, ls int - sim, match float64 -} - -func Test_Metrics(t *testing.T) { - var ( - cases = []struct { - s1 string - s2 string - desc string - p *Params - exp e - }{ - // When the values are the same... - {"", "", "", nil, e{0, 0, 0, 1, 1}}, - {"1", "1", "", nil, e{0, 1, 0, 1, 1}}, - {"12", "12", "", nil, e{0, 2, 0, 1, 1}}, - {"123", "123", "", nil, e{0, 3, 0, 1, 1}}, - {"1234", "1234", "", nil, e{0, 4, 0, 1, 1}}, - {"12345", "12345", "", nil, e{0, 5, 0, 1, 1}}, - {"password", "password", "", nil, e{0, 8, 0, 1, 1}}, - - // When one of the values is empty... - {"", "1", "", nil, e{1, 0, 0, 0, 0}}, - {"", "12", "", nil, e{2, 0, 0, 0, 0}}, - {"", "123", "", nil, e{3, 0, 0, 0, 0}}, - {"", "1234", "", nil, e{4, 0, 0, 0, 0}}, - {"", "12345", "", nil, e{5, 0, 0, 0, 0}}, - {"", "password", "", nil, e{8, 0, 0, 0, 0}}, - {"1", "", "", nil, e{1, 0, 0, 0, 0}}, - {"12", "", "", nil, e{2, 0, 0, 0, 0}}, - {"123", "", "", nil, e{3, 0, 0, 0, 0}}, - {"1234", "", "", nil, e{4, 0, 0, 0, 0}}, - {"12345", "", "", nil, e{5, 0, 0, 0, 0}}, - {"password", "", "", nil, e{8, 0, 0, 0, 0}}, - - // When a single character is inserted or removed... - {"password", "1password", "", nil, e{1, 0, 8, 8.0 / 9, 8.0 / 9}}, - {"password", "p1assword", "", nil, e{1, 1, 7, 8.0 / 9, 8.1 / 9}}, - {"password", "pa1ssword", "", nil, e{1, 2, 6, 8.0 / 9, 8.2 / 9}}, - {"password", "pas1sword", "", nil, e{1, 3, 5, 8.0 / 9, 8.3 / 9}}, - {"password", "pass1word", "", nil, e{1, 4, 4, 8.0 / 9, 8.4 / 9}}, - {"password", "passw1ord", "", nil, e{1, 5, 3, 8.0 / 9, 8.4 / 9}}, - {"password", "passwo1rd", "", nil, e{1, 6, 2, 8.0 / 9, 8.4 / 9}}, - {"password", "passwor1d", "", nil, e{1, 7, 1, 8.0 / 9, 8.4 / 9}}, - {"password", "password1", "", nil, e{1, 8, 0, 8.0 / 9, 8.4 / 9}}, - {"password", "assword", "", nil, e{1, 0, 7, 7.0 / 8, 7.0 / 8}}, - {"password", "pssword", "", nil, e{1, 1, 6, 7.0 / 8, 7.1 / 8}}, - {"password", "pasword", "", nil, e{1, 3, 4, 7.0 / 8, 7.3 / 8}}, - {"password", "passord", "", nil, e{1, 4, 3, 7.0 / 8, 7.4 / 8}}, - {"password", "passwrd", "", nil, e{1, 5, 2, 7.0 / 8, 7.4 / 8}}, - {"password", "passwod", "", nil, e{1, 6, 1, 7.0 / 8, 7.4 / 8}}, - {"password", "passwor", "", nil, e{1, 7, 0, 7.0 / 8, 7.4 / 8}}, - - // When a single character is replaced... - {"password", "Xassword", "", nil, e{1, 0, 7, 7.0 / 8, 7.0 / 8}}, - {"password", "pXssword", "", nil, e{1, 1, 6, 7.0 / 8, 7.1 / 8}}, - {"password", "paXsword", "", nil, e{1, 2, 5, 7.0 / 8, 7.2 / 8}}, - {"password", "pasXword", "", nil, e{1, 3, 4, 7.0 / 8, 7.3 / 8}}, - {"password", "passXord", "", nil, e{1, 4, 3, 7.0 / 8, 7.4 / 8}}, - {"password", "passwXrd", "", nil, e{1, 5, 2, 7.0 / 8, 7.4 / 8}}, - {"password", "passwoXd", "", nil, e{1, 6, 1, 7.0 / 8, 7.4 / 8}}, - {"password", "passworX", "", nil, e{1, 7, 0, 7.0 / 8, 7.4 / 8}}, - - // If characters are taken off the front and added to the back and all of - // the characters are unique, then the distance is two times the number of - // characters shifted, until you get halfway (and then it becomes easier - // to shift from the other direction). - {"12345678", "23456781", "", nil, e{2, 0, 0, 6. / 8, 6. / 8}}, - {"12345678", "34567812", "", nil, e{4, 0, 0, 4. / 8, 4. / 8}}, - {"12345678", "45678123", "", nil, e{6, 0, 0, 2. / 8, 2. / 8}}, - {"12345678", "56781234", "", nil, e{8, 0, 0, 0, 0}}, - {"12345678", "67812345", "", nil, e{6, 0, 0, 2. / 8, 2. / 8}}, - {"12345678", "78123456", "", nil, e{4, 0, 0, 4. / 8, 4. / 8}}, - {"12345678", "81234567", "", nil, e{2, 0, 0, 6. / 8, 6. / 8}}, - - // If all the characters are unique and the values are reversed, then the - // distance is the number of characters for an even number of characters, - // and one less for an odd number of characters (since the middle - // character will stay the same). - {"12", "21", "", nil, e{2, 0, 0, 0, 0}}, - {"123", "321", "", nil, e{2, 0, 0, 1. / 3, 1. / 3}}, - {"1234", "4321", "", nil, e{4, 0, 0, 0, 0}}, - {"12345", "54321", "", nil, e{4, 0, 0, 1. / 5, 1. / 5}}, - {"123456", "654321", "", nil, e{6, 0, 0, 0, 0}}, - {"1234567", "7654321", "", nil, e{6, 0, 0, 1. / 7, 1. / 7}}, - {"12345678", "87654321", "", nil, e{8, 0, 0, 0, 0}}, - - // The results are the same regardless of the string order, - // with the default parameters... - {"password", "1234", "", nil, e{8, 0, 0, 0, 0}}, - {"1234", "password", "", nil, e{8, 0, 0, 0, 0}}, - {"password", "pass1", "", nil, e{4, 4, 0, 4. / 8, 4. / 8}}, - {"pass1", "password", "", nil, e{4, 4, 0, 4. / 8, 4. / 8}}, - {"password", "passwor", "", nil, e{1, 7, 0, 7.0 / 8, 7.4 / 8}}, - {"passwor", "password", "", nil, e{1, 7, 0, 7.0 / 8, 7.4 / 8}}, - // ... but not necessarily so with custom costs: - {"password", "1234", " (D=2)", NewParams().DelCost(2), e{12, 0, 0, 0, 0}}, - {"1234", "password", " (D=2)", NewParams().DelCost(2), e{8, 0, 0, 0, 0}}, - {"password", "pass1", " (D=2)", NewParams().DelCost(2), e{7, 4, 0, 4. / 11, 4. / 11}}, - {"pass1", "password", " (D=2)", NewParams().DelCost(2), e{4, 4, 0, 4. / 8, 4. / 8}}, - {"password", "pass1", " (S=3)", NewParams().SubCost(3), e{5, 4, 0, 8. / 13, 8. / 13}}, - {"password", "passwor", " (D=2)", NewParams().DelCost(2), e{2, 7, 0, 7.0 / 9, 7.8 / 9}}, - {"passwor", "password", " (D=2)", NewParams().DelCost(2), e{1, 7, 0, 7.0 / 8, 7.4 / 8}}, - - // When setting a maxCost (should not affect Similarity() and Match())... - {"password", "1password2", "(maxCost=6)", NewParams().MaxCost(6), e{2, 0, 0, 8. / 10, 8. / 10}}, - {"password", "pass1234", "(maxCost=1)", NewParams().MaxCost(1), e{2, 4, 0, 4. / 8, 4. / 8}}, - {"pass1word", "passwords1", "(maxCost=2)", NewParams().MaxCost(2), e{3, 4, 0, 7. / 10, 8.2 / 10}}, - {"password", "1passwo", " (D=2,maxCost=1)", NewParams().DelCost(2).MaxCost(1), e{2, 0, 0, 4. / 9, 4. / 9}}, - {"pwd", "password", " (I=0,maxCost=0)", NewParams().InsCost(0).MaxCost(0), e{0, 1, 1, 1, 1}}, - {"passXword", "password", "(maxCost=10)", NewParams().MaxCost(10), e{1, 4, 4, 8. / 9, 8.4 / 9}}, - {"passXord", "password", "(S=3,maxCost=17)", NewParams().SubCost(3).MaxCost(17), e{2, 4, 3, 14. / 16, 14.8 / 16}}, - // ... no change because the Calculate is calculated without getting into the main algorithm: - {"password", "pass", "(maxCost=1)", NewParams().MaxCost(1), e{4, 4, 0, 4. / 8, 4. / 8}}, - {"password", "1234", " (D=2,maxCost=1)", NewParams().DelCost(2).MaxCost(1), e{8, 0, 0, 0, 0}}, - - // When setting a minScore (should not affect Calculate() and Distance())... - {"password", "pass1", "(minScore=0.3)", NewParams().MinScore(.3), e{4, 4, 0, 4. / 8, 4. / 8}}, - {"password", "pass1", "(minScore=0.6)", NewParams().MinScore(.6), e{4, 4, 0, 0, 0}}, - {"password", "pass1wor", "(minScore=0.9)", NewParams().MinScore(.9), e{2, 4, 0, 0, 0}}, - {"password", "password", "(minScore=1.1)", NewParams().MinScore(1.1), e{0, 8, 0, 0, 0}}, - - // The rest of these are miscellaneous examples. They will - // be illustrated using the following key: - // = (the characters are equal) - // + (the character is inserted) - // - (the character is removed) - // # (the character is replaced) - - // Mississippi - // ippississiM - // -=##====##=+ --> 6 - {"Mississippi", "ippississiM", "", nil, e{6, 0, 0, 5. / 11, 5. / 11}}, - - // eieio - // oieie - // #===# --> 2 - {"eieio", "oieie", "", nil, e{2, 0, 0, 3. / 5, 3. / 5}}, - - // brad+angelina - // bra ngelina - // ===+++======= --> 3 - {"brad+angelina", "brangelina", "", nil, e{3, 3, 7, 10. / 13, 10.9 / 13}}, - - // test international chars - // naive - // naïve - // ==#== --> 1 - {"naive", "naïve", "", nil, e{1, 2, 2, 4. / 5, 4.2 / 5}}, - } - ) - for _, c := range cases { - par := c.p - if par == nil { - par = defaultParams - } - cost, lp, ls := Calculate([]rune(c.s1), []rune(c.s2), par.maxCost, par.insCost, par.subCost, par.delCost) - if cost != c.exp.cost { - t.Errorf("Cost: %q -> %q%s: got %d, want %d", c.s1, c.s2, c.desc, cost, c.exp.cost) - } - if lp != c.exp.lp { - t.Errorf("Prefix: %q -> %q%s: got %d, want %d", c.s1, c.s2, c.desc, lp, c.exp.lp) - } - if ls != c.exp.ls { - t.Errorf("Suffix: %q -> %q%s: got %d, want %d", c.s1, c.s2, c.desc, ls, c.exp.ls) - } - - dist := Distance(c.s1, c.s2, c.p) - if dist != c.exp.cost { - t.Errorf("Distance: %q -> %q%s: got %d, want %d", c.s1, c.s2, c.desc, dist, c.exp.cost) - } - - sim := Similarity(c.s1, c.s2, c.p) - off := sim - c.exp.sim - if off < 0 { - off = -off - } - if off > 1e-15 { - t.Errorf("Similarity: %q -> %q%s: got %f, want %f (off %g)", c.s1, c.s2, c.desc, sim, c.exp.sim, off) - } - - match := Match(c.s1, c.s2, c.p) - off = match - c.exp.match - if off < 0 { - off = -off - } - if off > 1e-15 { - t.Errorf("Match: %q -> %q%s: got %f, want %f (off %g)", c.s1, c.s2, c.desc, match, c.exp.match, off) - } - } -} diff --git a/vendor/github.com/agext/levenshtein/params.go b/vendor/github.com/agext/levenshtein/params.go deleted file mode 100644 index a85727b..0000000 --- a/vendor/github.com/agext/levenshtein/params.go +++ /dev/null @@ -1,152 +0,0 @@ -// Copyright 2016 ALRUX 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. - -package levenshtein - -// Params represents a set of parameter values for the various formulas involved -// in the calculation of the Levenshtein string metrics. -type Params struct { - insCost int - subCost int - delCost int - maxCost int - minScore float64 - bonusPrefix int - bonusScale float64 - bonusThreshold float64 -} - -var ( - defaultParams = NewParams() -) - -// NewParams creates a new set of parameters and initializes it with the default values. -func NewParams() *Params { - return &Params{ - insCost: 1, - subCost: 1, - delCost: 1, - maxCost: 0, - minScore: 0, - bonusPrefix: 4, - bonusScale: .1, - bonusThreshold: .7, - } -} - -// Clone returns a pointer to a copy of the receiver parameter set, or of a new -// default parameter set if the receiver is nil. -func (p *Params) Clone() *Params { - if p == nil { - return NewParams() - } - return &Params{ - insCost: p.insCost, - subCost: p.subCost, - delCost: p.delCost, - maxCost: p.maxCost, - minScore: p.minScore, - bonusPrefix: p.bonusPrefix, - bonusScale: p.bonusScale, - bonusThreshold: p.bonusThreshold, - } -} - -// InsCost overrides the default value of 1 for the cost of insertion. -// The new value must be zero or positive. -func (p *Params) InsCost(v int) *Params { - if v >= 0 { - p.insCost = v - } - return p -} - -// SubCost overrides the default value of 1 for the cost of substitution. -// The new value must be zero or positive. -func (p *Params) SubCost(v int) *Params { - if v >= 0 { - p.subCost = v - } - return p -} - -// DelCost overrides the default value of 1 for the cost of deletion. -// The new value must be zero or positive. -func (p *Params) DelCost(v int) *Params { - if v >= 0 { - p.delCost = v - } - return p -} - -// MaxCost overrides the default value of 0 (meaning unlimited) for the maximum cost. -// The calculation of Distance() stops when the result is guaranteed to exceed -// this maximum, returning a lower-bound rather than exact value. -// The new value must be zero or positive. -func (p *Params) MaxCost(v int) *Params { - if v >= 0 { - p.maxCost = v - } - return p -} - -// MinScore overrides the default value of 0 for the minimum similarity score. -// Scores below this threshold are returned as 0 by Similarity() and Match(). -// The new value must be zero or positive. Note that a minimum greater than 1 -// can never be satisfied, resulting in a score of 0 for any pair of strings. -func (p *Params) MinScore(v float64) *Params { - if v >= 0 { - p.minScore = v - } - return p -} - -// BonusPrefix overrides the default value for the maximum length of -// common prefix to be considered for bonus by Match(). -// The new value must be zero or positive. -func (p *Params) BonusPrefix(v int) *Params { - if v >= 0 { - p.bonusPrefix = v - } - return p -} - -// BonusScale overrides the default value for the scaling factor used by Match() -// in calculating the bonus. -// The new value must be zero or positive. To guarantee that the similarity score -// remains in the interval 0..1, this scaling factor is not allowed to exceed -// 1 / BonusPrefix. -func (p *Params) BonusScale(v float64) *Params { - if v >= 0 { - p.bonusScale = v - } - - // the bonus cannot exceed (1-sim), or the score may become greater than 1. - if float64(p.bonusPrefix)*p.bonusScale > 1 { - p.bonusScale = 1 / float64(p.bonusPrefix) - } - - return p -} - -// BonusThreshold overrides the default value for the minimum similarity score -// for which Match() can assign a bonus. -// The new value must be zero or positive. Note that a threshold greater than 1 -// effectively makes Match() become the equivalent of Similarity(). -func (p *Params) BonusThreshold(v float64) *Params { - if v >= 0 { - p.bonusThreshold = v - } - return p -} diff --git a/vendor/github.com/agext/levenshtein/params_test.go b/vendor/github.com/agext/levenshtein/params_test.go deleted file mode 100644 index 5b21291..0000000 --- a/vendor/github.com/agext/levenshtein/params_test.go +++ /dev/null @@ -1,145 +0,0 @@ -// Copyright 2016 ALRUX 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. - -package levenshtein - -import ( - "testing" -) - -func Test_Params(t *testing.T) { - // Different allocations should not be equal. - if NewParams() == NewParams() { - t.Errorf(`NewParams() == NewParams()`) - } - - // Clone should not be equal to original allocation. - p := NewParams() - if p == p.Clone() { - t.Errorf(`p == p.Clone()`) - } - - // Defaults - if p.insCost != 1 { - t.Errorf(`NewParams().insCost == %v, want %v`, p.insCost, 1) - } - if p.subCost != 1 { - t.Errorf(`NewParams().subCost == %v, want %v`, p.subCost, 1) - } - if p.delCost != 1 { - t.Errorf(`NewParams().delCost == %v, want %v`, p.delCost, 1) - } - if p.maxCost != 0 { - t.Errorf(`NewParams().maxCost == %v, want %v`, p.maxCost, 0) - } - if p.minScore != 0 { - t.Errorf(`NewParams().minScore == %v, want %v`, p.minScore, 0) - } - if p.bonusPrefix != 4 { - t.Errorf(`NewParams().bonusPrefix == %v, want %v`, p.bonusPrefix, 4) - } - if p.bonusScale != .1 { - t.Errorf(`NewParams().bonusScale == %v, want %v`, p.bonusScale, .1) - } - if p.bonusThreshold != .7 { - t.Errorf(`NewParams().bonusThreshold == %v, want %v`, p.bonusThreshold, .7) - } - - // Setters - if p = NewParams().InsCost(2); p.insCost != 2 { - t.Errorf(`NewParams().InsCost(2).insCost == %v, want %v`, p.insCost, 2) - } - if p = NewParams().InsCost(-2); p.insCost != 1 { - t.Errorf(`NewParams().InsCost(-2).insCost == %v, want %v`, p.insCost, 1) - } - if p = NewParams().SubCost(3); p.subCost != 3 { - t.Errorf(`NewParams().SubCost(3).subCost == %v, want %v`, p.subCost, 3) - } - if p = NewParams().SubCost(-3); p.subCost != 1 { - t.Errorf(`NewParams().SubCost(-3).subCost == %v, want %v`, p.subCost, 1) - } - if p = NewParams().DelCost(5); p.delCost != 5 { - t.Errorf(`NewParams().DelCost(5).delCost == %v, want %v`, p.delCost, 5) - } - if p = NewParams().DelCost(-1); p.delCost != 1 { - t.Errorf(`NewParams().DelCost(-1).delCost == %v, want %v`, p.delCost, 1) - } - if p = NewParams().MaxCost(7); p.maxCost != 7 { - t.Errorf(`NewParams().MaxCost(7).maxCost == %v, want %v`, p.maxCost, 7) - } - if p = NewParams().MaxCost(-5); p.maxCost != 0 { - t.Errorf(`NewParams().MaxCost(-5).maxCost == %v, want %v`, p.maxCost, 0) - } - if p = NewParams().MinScore(.5); p.minScore != .5 { - t.Errorf(`NewParams().MinScore(.5).minScore == %v, want %v`, p.minScore, .5) - } - if p = NewParams().MinScore(3); p.minScore != 3 { - t.Errorf(`NewParams().MinScore(3).minScore == %v, want %v`, p.minScore, 3) - } - if p = NewParams().MinScore(-5); p.minScore != 0 { - t.Errorf(`NewParams().MinScore(-5).minScore == %v, want %v`, p.minScore, 0) - } - if p = NewParams().BonusPrefix(7); p.bonusPrefix != 7 { - t.Errorf(`NewParams().BonusPrefix(7).bonusPrefix == %v, want %v`, p.bonusPrefix, 7) - } - if p = NewParams().BonusPrefix(-5); p.bonusPrefix != 4 { - t.Errorf(`NewParams().BonusPrefix(-5).bonusPrefix == %v, want %v`, p.bonusPrefix, 4) - } - if p = NewParams().BonusScale(.2); p.bonusScale != .2 { - t.Errorf(`NewParams().BonusScale(.2).bonusScale == %v, want %v`, p.bonusScale, .2) - } - if p = NewParams().BonusScale(-.3); p.bonusScale != .1 { - t.Errorf(`NewParams().BonusScale(-.3).bonusScale == %v, want %v`, p.bonusScale, .1) - } - if p = NewParams().BonusScale(7); p.bonusScale != 1/float64(p.bonusPrefix) { - t.Errorf(`NewParams().BonusScale(7).bonusScale == %v, want %v`, p.bonusScale, 1/float64(p.bonusPrefix)) - } - if p = NewParams().BonusThreshold(.3); p.bonusThreshold != .3 { - t.Errorf(`NewParams().BonusThreshold(.3).bonusThreshold == %v, want %v`, p.bonusThreshold, .3) - } - if p = NewParams().BonusThreshold(7); p.bonusThreshold != 7 { - t.Errorf(`NewParams().BonusThreshold(7).bonusThreshold == %v, want %v`, p.bonusThreshold, 7) - } - if p = NewParams().BonusThreshold(-7); p.bonusThreshold != .7 { - t.Errorf(`NewParams().BonusThreshold(-7).bonusThreshold == %v, want %v`, p.bonusThreshold, .7) - } - - // Cloning nil pointer should initiate with default values - var p1 *Params - p2 := p1.Clone() - if p2.insCost != 1 { - t.Errorf(`nil.Clone().insCost == %v, want %v`, p2.insCost, 1) - } - if p2.subCost != 1 { - t.Errorf(`nil.Clone().subCost == %v, want %v`, p2.subCost, 1) - } - if p2.delCost != 1 { - t.Errorf(`nil.Clone().delCost == %v, want %v`, p2.delCost, 1) - } - if p2.maxCost != 0 { - t.Errorf(`nil.Clone().maxCost == %v, want %v`, p2.maxCost, 0) - } - if p2.minScore != 0 { - t.Errorf(`nil.Clone().minScore == %v, want %v`, p2.minScore, 0) - } - if p2.bonusPrefix != 4 { - t.Errorf(`nil.Clone().bonusPrefix == %v, want %v`, p2.bonusPrefix, 4) - } - if p2.bonusScale != .1 { - t.Errorf(`nil.Clone().bonusScale == %v, want %v`, p2.bonusScale, .1) - } - if p2.bonusThreshold != .7 { - t.Errorf(`nil.Clone().bonusThreshold == %v, want %v`, p2.bonusThreshold, .7) - } -} diff --git a/vendor/github.com/ailncode/gluaxmlpath/README.md b/vendor/github.com/ailncode/gluaxmlpath/README.md deleted file mode 100644 index 913cc4f..0000000 --- a/vendor/github.com/ailncode/gluaxmlpath/README.md +++ /dev/null @@ -1,40 +0,0 @@ -# gluaxmlpath - -gluaxmlpath provides an easy way to use [xmlpath](https://github.com/go-xmlpath/xmlpath) from within [GopherLua](https://github.com/yuin/gopher-lua). - -## Installation - -``` -go get github.com/ailncode/gluaxmlpath -``` - -## Usage - -```go -package main - -import ( - "github.com/ailncode/gluaxmlpath" - "github.com/yuin/gopher-lua" -) - -func main() { - L := lua.NewState() - defer L.Close() - - gluaxmlpath.Preload(L) - - if err := L.DoString(` - xml ="x1x2x3" - local xmlpath = require("xmlpath") - node,err = xmlpath.loadxml(xml) - path,err = xmlpath.compile("//book") - it = path:iter(node) - for k,v in pairs(it) do - print(k,v:string()) - end - `); err != nil { - panic(err) - } -} -``` diff --git a/vendor/github.com/ailncode/gluaxmlpath/api.go b/vendor/github.com/ailncode/gluaxmlpath/api.go deleted file mode 100644 index 6163d47..0000000 --- a/vendor/github.com/ailncode/gluaxmlpath/api.go +++ /dev/null @@ -1,37 +0,0 @@ -package gluaxmlpath - -import ( - "bytes" - "github.com/yuin/gopher-lua" - xmlpath "gopkg.in/xmlpath.v2" -) - -var api = map[string]lua.LGFunction{ - "loadxml": loadXml, - "compile": compile, -} - -func loadXml(L *lua.LState) int { - xmlStr := L.CheckString(1) - r := bytes.NewReader([]byte(xmlStr)) - node, err := xmlpath.ParseHTML(r) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - L.Push(newNode(L, node)) - return 1 -} - -func compile(L *lua.LState) int { - xpathStr := L.CheckString(1) - path, err := xmlpath.Compile(xpathStr) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - L.Push(newPath(L, path)) - return 1 -} diff --git a/vendor/github.com/ailncode/gluaxmlpath/xmlpath.go b/vendor/github.com/ailncode/gluaxmlpath/xmlpath.go deleted file mode 100644 index ab52baa..0000000 --- a/vendor/github.com/ailncode/gluaxmlpath/xmlpath.go +++ /dev/null @@ -1,21 +0,0 @@ -package gluaxmlpath - -import ( - "github.com/yuin/gopher-lua" -) - -// Preload adds xmlpath to the given Lua state's package.preload table. After it -// has been preloaded, it can be loaded using require: -// -// local xmlpath = require("xmlpath") -func Preload(L *lua.LState) { - L.PreloadModule("xmlpath", Loader) -} - -// Loader is the module loader function. -func Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), api) - registerType(L, mod) - L.Push(mod) - return 1 -} diff --git a/vendor/github.com/ailncode/gluaxmlpath/xmlpathtype.go b/vendor/github.com/ailncode/gluaxmlpath/xmlpathtype.go deleted file mode 100644 index e2e7dc8..0000000 --- a/vendor/github.com/ailncode/gluaxmlpath/xmlpathtype.go +++ /dev/null @@ -1,135 +0,0 @@ -package gluaxmlpath - -import ( - "github.com/yuin/gopher-lua" - xmlpath "gopkg.in/xmlpath.v2" -) - -type Node struct { - base *xmlpath.Node -} -type Path struct { - base *xmlpath.Path -} - -type Iter struct { - base *xmlpath.Iter -} - -const luaNodeTypeName = "xmlpath.node" -const luaPathTypeName = "xmlpath.path" -const luaIterTypeName = "xmlpath.iter" - -func registerType(L *lua.LState, module *lua.LTable) { - //reg node - nodemt := L.NewTypeMetatable(luaNodeTypeName) - L.SetField(module, "node", nodemt) - L.SetField(nodemt, "__index", L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ - "string": nodeString, - })) - //reg path - pathmt := L.NewTypeMetatable(luaPathTypeName) - L.SetField(module, "path", pathmt) - L.SetField(pathmt, "__index", L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ - "iter": iter, - })) - //reg iter - itermt := L.NewTypeMetatable(luaIterTypeName) - L.SetField(module, "iter", itermt) - L.SetField(itermt, "__index", L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ - //"next": next, - "node": node, - })) -} -func newNode(L *lua.LState, n *xmlpath.Node) *lua.LUserData { - ud := L.NewUserData() - ud.Value = &Node{ - n, - } - L.SetMetatable(ud, L.GetTypeMetatable(luaNodeTypeName)) - return ud -} -func checkNode(L *lua.LState) *Node { - ud := L.CheckUserData(1) - if v, ok := ud.Value.(*Node); ok { - return v - } - L.ArgError(1, "node expected") - return nil -} -func newPath(L *lua.LState, p *xmlpath.Path) *lua.LUserData { - ud := L.NewUserData() - ud.Value = &Path{ - p, - } - L.SetMetatable(ud, L.GetTypeMetatable(luaPathTypeName)) - return ud -} -func checkPath(L *lua.LState) *Path { - ud := L.CheckUserData(1) - if v, ok := ud.Value.(*Path); ok { - return v - } - L.ArgError(1, "path expected") - return nil -} -func newIter(L *lua.LState, i *xmlpath.Iter) *lua.LUserData { - ud := L.NewUserData() - ud.Value = &Iter{ - i, - } - L.SetMetatable(ud, L.GetTypeMetatable(luaIterTypeName)) - return ud -} -func checkIter(L *lua.LState) *Iter { - ud := L.CheckUserData(1) - if v, ok := ud.Value.(*Iter); ok { - return v - } - L.ArgError(1, "iter expected") - return nil -} - -//iter := path.iter(node) -func iter(L *lua.LState) int { - path := checkPath(L) - if L.GetTop() == 2 { - ut := L.CheckUserData(2) - if node, ok := ut.Value.(*Node); ok { - it := path.base.Iter(node.base) - ltab := L.NewTable() - i := 1 - for it.Next() { - L.RawSetInt(ltab, i, newNode(L, it.Node())) - i++ - } - L.Push(ltab) - //L.Push(newIter(L, it)) - return 1 - } - } - L.ArgError(1, "node expected") - return 0 -} - -//support lua standard iterator -//hasNext := iter.next() -// func next(L *lua.LState) int { -// iter := checkIter(L) -// L.Push(lua.LBool(iter.base.Next())) -// return 1 -// } - -//node := iter.node() -func node(L *lua.LState) int { - iter := checkIter(L) - L.Push(newNode(L, iter.base.Node())) - return 1 -} - -//string := node.string() -func nodeString(L *lua.LState) int { - node := checkNode(L) - L.Push(lua.LString(node.base.String())) - return 1 -} diff --git a/vendor/github.com/apparentlymart/go-cidr/.travis.yml b/vendor/github.com/apparentlymart/go-cidr/.travis.yml deleted file mode 100644 index 1bd6b33..0000000 --- a/vendor/github.com/apparentlymart/go-cidr/.travis.yml +++ /dev/null @@ -1,7 +0,0 @@ -language: go - -go: - - 1.x - - 1.7.x - - 1.8.x - - master diff --git a/vendor/github.com/apparentlymart/go-cidr/LICENSE b/vendor/github.com/apparentlymart/go-cidr/LICENSE deleted file mode 100644 index 2125378..0000000 --- a/vendor/github.com/apparentlymart/go-cidr/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2015 Martin Atkins - -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/apparentlymart/go-cidr/cidr/cidr.go b/vendor/github.com/apparentlymart/go-cidr/cidr/cidr.go deleted file mode 100644 index 7534473..0000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr.go +++ /dev/null @@ -1,210 +0,0 @@ -// Package cidr is a collection of assorted utilities for computing -// network and host addresses within network ranges. -// -// It expects a CIDR-type address structure where addresses are divided into -// some number of prefix bits representing the network and then the remaining -// suffix bits represent the host. -// -// For example, it can help to calculate addresses for sub-networks of a -// parent network, or to calculate host addresses within a particular prefix. -// -// At present this package is prioritizing simplicity of implementation and -// de-prioritizing speed and memory usage. Thus caution is advised before -// using this package in performance-critical applications or hot codepaths. -// Patches to improve the speed and memory usage may be accepted as long as -// they do not result in a significant increase in code complexity. -package cidr - -import ( - "fmt" - "math/big" - "net" -) - -// Subnet takes a parent CIDR range and creates a subnet within it -// with the given number of additional prefix bits and the given -// network number. -// -// For example, 10.3.0.0/16, extended by 8 bits, with a network number -// of 5, becomes 10.3.5.0/24 . -func Subnet(base *net.IPNet, newBits int, num int) (*net.IPNet, error) { - ip := base.IP - mask := base.Mask - - parentLen, addrLen := mask.Size() - newPrefixLen := parentLen + newBits - - if newPrefixLen > addrLen { - return nil, fmt.Errorf("insufficient address space to extend prefix of %d by %d", parentLen, newBits) - } - - maxNetNum := uint64(1< maxNetNum { - return nil, fmt.Errorf("prefix extension of %d does not accommodate a subnet numbered %d", newBits, num) - } - - return &net.IPNet{ - IP: insertNumIntoIP(ip, num, newPrefixLen), - Mask: net.CIDRMask(newPrefixLen, addrLen), - }, nil -} - -// Host takes a parent CIDR range and turns it into a host IP address with -// the given host number. -// -// For example, 10.3.0.0/16 with a host number of 2 gives 10.3.0.2. -func Host(base *net.IPNet, num int) (net.IP, error) { - ip := base.IP - mask := base.Mask - - parentLen, addrLen := mask.Size() - hostLen := addrLen - parentLen - - maxHostNum := uint64(1< maxHostNum { - return nil, fmt.Errorf("prefix of %d does not accommodate a host numbered %d", parentLen, num) - } - var bitlength int - if ip.To4() != nil { - bitlength = 32 - } else { - bitlength = 128 - } - return insertNumIntoIP(ip, num, bitlength), nil -} - -// AddressRange returns the first and last addresses in the given CIDR range. -func AddressRange(network *net.IPNet) (net.IP, net.IP) { - // the first IP is easy - firstIP := network.IP - - // the last IP is the network address OR NOT the mask address - prefixLen, bits := network.Mask.Size() - if prefixLen == bits { - // Easy! - // But make sure that our two slices are distinct, since they - // would be in all other cases. - lastIP := make([]byte, len(firstIP)) - copy(lastIP, firstIP) - return firstIP, lastIP - } - - firstIPInt, bits := ipToInt(firstIP) - hostLen := uint(bits) - uint(prefixLen) - lastIPInt := big.NewInt(1) - lastIPInt.Lsh(lastIPInt, hostLen) - lastIPInt.Sub(lastIPInt, big.NewInt(1)) - lastIPInt.Or(lastIPInt, firstIPInt) - - return firstIP, intToIP(lastIPInt, bits) -} - -// AddressCount returns the number of distinct host addresses within the given -// CIDR range. -// -// Since the result is a uint64, this function returns meaningful information -// only for IPv4 ranges and IPv6 ranges with a prefix size of at least 65. -func AddressCount(network *net.IPNet) uint64 { - prefixLen, bits := network.Mask.Size() - return 1 << (uint64(bits) - uint64(prefixLen)) -} - -//VerifyNoOverlap takes a list subnets and supernet (CIDRBlock) and verifies -//none of the subnets overlap and all subnets are in the supernet -//it returns an error if any of those conditions are not satisfied -func VerifyNoOverlap(subnets []*net.IPNet, CIDRBlock *net.IPNet) error { - firstLastIP := make([][]net.IP, len(subnets)) - for i, s := range subnets { - first, last := AddressRange(s) - firstLastIP[i] = []net.IP{first, last} - } - for i, s := range subnets { - if !CIDRBlock.Contains(firstLastIP[i][0]) || !CIDRBlock.Contains(firstLastIP[i][1]) { - return fmt.Errorf("%s does not fully contain %s", CIDRBlock.String(), s.String()) - } - for j := i + 1; j < len(subnets); j++ { - first := firstLastIP[j][0] - last := firstLastIP[j][1] - if s.Contains(first) || s.Contains(last) { - return fmt.Errorf("%s overlaps with %s", subnets[j].String(), s.String()) - } - } - } - return nil -} - -// PreviousSubnet returns the subnet of the desired mask in the IP space -// just lower than the start of IPNet provided. If the IP space rolls over -// then the second return value is true -func PreviousSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool) { - startIP := checkIPv4(network.IP) - previousIP := make(net.IP, len(startIP)) - copy(previousIP, startIP) - cMask := net.CIDRMask(prefixLen, 8*len(previousIP)) - previousIP = Dec(previousIP) - previous := &net.IPNet{IP: previousIP.Mask(cMask), Mask: cMask} - if startIP.Equal(net.IPv4zero) || startIP.Equal(net.IPv6zero) { - return previous, true - } - return previous, false -} - -// NextSubnet returns the next available subnet of the desired mask size -// starting for the maximum IP of the offset subnet -// If the IP exceeds the maxium IP then the second return value is true -func NextSubnet(network *net.IPNet, prefixLen int) (*net.IPNet, bool) { - _, currentLast := AddressRange(network) - mask := net.CIDRMask(prefixLen, 8*len(currentLast)) - currentSubnet := &net.IPNet{IP: currentLast.Mask(mask), Mask: mask} - _, last := AddressRange(currentSubnet) - last = Inc(last) - next := &net.IPNet{IP: last.Mask(mask), Mask: mask} - if last.Equal(net.IPv4zero) || last.Equal(net.IPv6zero) { - return next, true - } - return next, false -} - -//Inc increases the IP by one this returns a new []byte for the IP -func Inc(IP net.IP) net.IP { - IP = checkIPv4(IP) - incIP := make([]byte, len(IP)) - copy(incIP, IP) - for j := len(incIP) - 1; j >= 0; j-- { - incIP[j]++ - if incIP[j] > 0 { - break - } - } - return incIP -} - -//Dec decreases the IP by one this returns a new []byte for the IP -func Dec(IP net.IP) net.IP { - IP = checkIPv4(IP) - decIP := make([]byte, len(IP)) - copy(decIP, IP) - decIP = checkIPv4(decIP) - for j := len(decIP) - 1; j >= 0; j-- { - decIP[j]-- - if decIP[j] < 255 { - break - } - } - return decIP -} - -func checkIPv4(ip net.IP) net.IP { - // Go for some reason allocs IPv6len for IPv4 so we have to correct it - if v4 := ip.To4(); v4 != nil { - return v4 - } - return ip -} diff --git a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go b/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go deleted file mode 100644 index 64fdce8..0000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/cidr_test.go +++ /dev/null @@ -1,438 +0,0 @@ -package cidr - -import ( - "bytes" - "fmt" - "net" - "strconv" - "testing" -) - -func TestSubnet(t *testing.T) { - type Case struct { - Base string - Bits int - Num int - Output string - Error bool - } - - cases := []Case{ - Case{ - Base: "192.168.2.0/20", - Bits: 4, - Num: 6, - Output: "192.168.6.0/24", - }, - Case{ - Base: "192.168.2.0/20", - Bits: 4, - Num: 0, - Output: "192.168.0.0/24", - }, - Case{ - Base: "192.168.0.0/31", - Bits: 1, - Num: 1, - Output: "192.168.0.1/32", - }, - Case{ - Base: "192.168.0.0/21", - Bits: 4, - Num: 7, - Output: "192.168.3.128/25", - }, - Case{ - Base: "fe80::/48", - Bits: 16, - Num: 6, - Output: "fe80:0:0:6::/64", - }, - Case{ - Base: "fe80::/49", - Bits: 16, - Num: 7, - Output: "fe80:0:0:3:8000::/65", - }, - Case{ - Base: "192.168.2.0/31", - Bits: 2, - Num: 0, - Error: true, // not enough bits to expand into - }, - Case{ - Base: "fe80::/126", - Bits: 4, - Num: 0, - Error: true, // not enough bits to expand into - }, - Case{ - Base: "192.168.2.0/24", - Bits: 4, - Num: 16, - Error: true, // can't fit 16 into 4 bits - }, - } - - for _, testCase := range cases { - _, base, _ := net.ParseCIDR(testCase.Base) - gotNet, err := Subnet(base, testCase.Bits, testCase.Num) - desc := fmt.Sprintf("Subnet(%#v,%#v,%#v)", testCase.Base, testCase.Bits, testCase.Num) - if err != nil { - if !testCase.Error { - t.Errorf("%s failed: %s", desc, err.Error()) - } - } else { - got := gotNet.String() - if testCase.Error { - t.Errorf("%s = %s; want error", desc, got) - } else { - if got != testCase.Output { - t.Errorf("%s = %s; want %s", desc, got, testCase.Output) - } - } - } - } -} - -func TestHost(t *testing.T) { - type Case struct { - Range string - Num int - Output string - Error bool - } - - cases := []Case{ - Case{ - Range: "192.168.2.0/20", - Num: 6, - Output: "192.168.0.6", - }, - Case{ - Range: "192.168.0.0/20", - Num: 257, - Output: "192.168.1.1", - }, - Case{ - Range: "2001:db8::/32", - Num: 1, - Output: "2001:db8::1", - }, - Case{ - Range: "192.168.1.0/24", - Num: 256, - Error: true, // only 0-255 will fit in 8 bits - }, - Case{ - Range: "192.168.0.0/30", - Num: -3, - Output: "192.168.0.1", // 4 address (0-3) in 2 bits; 3rd from end = 1 - }, - Case{ - Range: "192.168.0.0/30", - Num: -4, - Output: "192.168.0.0", // 4 address (0-3) in 2 bits; 4th from end = 0 - }, - Case{ - Range: "192.168.0.0/30", - Num: -5, - Error: true, // 4 address (0-3) in 2 bits; cannot accomodate 5 - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - gotIP, err := Host(network, testCase.Num) - desc := fmt.Sprintf("Host(%#v,%#v)", testCase.Range, testCase.Num) - if err != nil { - if !testCase.Error { - t.Errorf("%s failed: %s", desc, err.Error()) - } - } else { - got := gotIP.String() - if testCase.Error { - t.Errorf("%s = %s; want error", desc, got) - } else { - if got != testCase.Output { - t.Errorf("%s = %s; want %s", desc, got, testCase.Output) - } - } - } - } -} - -func TestAddressRange(t *testing.T) { - type Case struct { - Range string - First string - Last string - } - - cases := []Case{ - Case{ - Range: "192.168.0.0/16", - First: "192.168.0.0", - Last: "192.168.255.255", - }, - Case{ - Range: "192.168.0.0/17", - First: "192.168.0.0", - Last: "192.168.127.255", - }, - Case{ - Range: "fe80::/64", - First: "fe80::", - Last: "fe80::ffff:ffff:ffff:ffff", - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - firstIP, lastIP := AddressRange(network) - desc := fmt.Sprintf("AddressRange(%#v)", testCase.Range) - gotFirstIP := firstIP.String() - gotLastIP := lastIP.String() - if gotFirstIP != testCase.First { - t.Errorf("%s first is %s; want %s", desc, gotFirstIP, testCase.First) - } - if gotLastIP != testCase.Last { - t.Errorf("%s last is %s; want %s", desc, gotLastIP, testCase.Last) - } - } - -} - -func TestAddressCount(t *testing.T) { - type Case struct { - Range string - Count uint64 - } - - cases := []Case{ - Case{ - Range: "192.168.0.0/16", - Count: 65536, - }, - Case{ - Range: "192.168.0.0/17", - Count: 32768, - }, - Case{ - Range: "192.168.0.0/32", - Count: 1, - }, - Case{ - Range: "192.168.0.0/31", - Count: 2, - }, - Case{ - Range: "0.0.0.0/0", - Count: 4294967296, - }, - Case{ - Range: "0.0.0.0/1", - Count: 2147483648, - }, - Case{ - Range: "::/65", - Count: 9223372036854775808, - }, - Case{ - Range: "::/128", - Count: 1, - }, - Case{ - Range: "::/127", - Count: 2, - }, - } - - for _, testCase := range cases { - _, network, _ := net.ParseCIDR(testCase.Range) - gotCount := AddressCount(network) - desc := fmt.Sprintf("AddressCount(%#v)", testCase.Range) - if gotCount != testCase.Count { - t.Errorf("%s = %d; want %d", desc, gotCount, testCase.Count) - } - } - -} - -func TestIncDec(t *testing.T) { - - testCase := [][]string{ - []string{"0.0.0.0", "0.0.0.1"}, - []string{"10.0.0.0", "10.0.0.1"}, - []string{"9.255.255.255", "10.0.0.0"}, - []string{"255.255.255.255", "0.0.0.0"}, - []string{"::", "::1"}, - []string{"ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", "::"}, - []string{"2001:db8:c001:ba00::", "2001:db8:c001:ba00::1"}, - } - - for _, tc := range testCase { - ip1 := net.ParseIP(tc[0]) - ip2 := net.ParseIP(tc[1]) - iIP := Inc(ip1) - if !iIP.Equal(ip2) { - t.Logf("%s should inc to equal %s\n", tc[0], tc[1]) - t.Errorf("%v should equal %v\n", iIP, ip2) - } - if ip1.Equal(ip2) { - t.Errorf("[%v] should not have been modified to [%v]", ip2, iIP) - } - } - for _, tc := range testCase { - ip1 := net.ParseIP(tc[0]) - ip2 := net.ParseIP(tc[1]) - dIP := Dec(ip2) - if !ip1.Equal(dIP) { - t.Logf("%s should dec equal %s\n", tc[0], tc[1]) - t.Errorf("%v should equal %v\n", ip1, dIP) - } - if ip2.Equal(dIP) { - t.Errorf("[%v] should not have been modified to [%v]", ip2, dIP) - } - } -} - -func TestPreviousSubnet(t *testing.T) { - - testCases := [][]string{ - []string{"10.0.0.0/24", "9.255.255.0/24", "false"}, - []string{"100.0.0.0/26", "99.255.255.192/26", "false"}, - []string{"0.0.0.0/26", "255.255.255.192/26", "true"}, - []string{"2001:db8:e000::/36", "2001:db8:d000::/36", "false"}, - []string{"::/64", "ffff:ffff:ffff:ffff::/64", "true"}, - } - for _, tc := range testCases { - _, c1, _ := net.ParseCIDR(tc[0]) - _, c2, _ := net.ParseCIDR(tc[1]) - mask, _ := c1.Mask.Size() - p1, rollback := PreviousSubnet(c1, mask) - if !p1.IP.Equal(c2.IP) { - t.Errorf("IP expected %v, got %v\n", c2.IP, p1.IP) - } - if !bytes.Equal(p1.Mask, c2.Mask) { - t.Errorf("Mask expected %v, got %v\n", c2.Mask, p1.Mask) - } - if p1.String() != c2.String() { - t.Errorf("%s should have been equal %s\n", p1.String(), c2.String()) - } - if check, _ := strconv.ParseBool(tc[2]); rollback != check { - t.Errorf("%s to %s should have rolled\n", tc[0], tc[1]) - } - } - for _, tc := range testCases { - _, c1, _ := net.ParseCIDR(tc[0]) - _, c2, _ := net.ParseCIDR(tc[1]) - mask, _ := c1.Mask.Size() - n1, rollover := NextSubnet(c2, mask) - if !n1.IP.Equal(c1.IP) { - t.Errorf("IP expected %v, got %v\n", c1.IP, n1.IP) - } - if !bytes.Equal(n1.Mask, c1.Mask) { - t.Errorf("Mask expected %v, got %v\n", c1.Mask, n1.Mask) - } - if n1.String() != c1.String() { - t.Errorf("%s should have been equal %s\n", n1.String(), c1.String()) - } - if check, _ := strconv.ParseBool(tc[2]); rollover != check { - t.Errorf("%s to %s should have rolled\n", tc[0], tc[1]) - } - } -} - -func TestVerifyNetowrk(t *testing.T) { - - type testVerifyNetwork struct { - CIDRBlock string - CIDRList []string - } - - testCases := []*testVerifyNetwork{ - &testVerifyNetwork{ - CIDRBlock: "192.168.8.0/21", - CIDRList: []string{ - "192.168.8.0/24", - "192.168.9.0/24", - "192.168.10.0/24", - "192.168.11.0/25", - "192.168.11.128/25", - "192.168.12.0/25", - "192.168.12.128/26", - "192.168.12.192/26", - "192.168.13.0/26", - "192.168.13.64/27", - "192.168.13.96/27", - "192.168.13.128/27", - }, - }, - } - failCases := []*testVerifyNetwork{ - &testVerifyNetwork{ - CIDRBlock: "192.168.8.0/21", - CIDRList: []string{ - "192.168.8.0/24", - "192.168.9.0/24", - "192.168.10.0/24", - "192.168.11.0/25", - "192.168.11.128/25", - "192.168.12.0/25", - "192.168.12.64/26", - "192.168.12.128/26", - }, - }, - &testVerifyNetwork{ - CIDRBlock: "192.168.8.0/21", - CIDRList: []string{ - "192.168.7.0/24", - "192.168.9.0/24", - "192.168.10.0/24", - "192.168.11.0/25", - "192.168.11.128/25", - "192.168.12.0/25", - "192.168.12.64/26", - "192.168.12.128/26", - }, - }, - } - - for _, tc := range testCases { - subnets := make([]*net.IPNet, len(tc.CIDRList)) - for i, s := range tc.CIDRList { - _, n, err := net.ParseCIDR(s) - if err != nil { - t.Errorf("Bad test data %s\n", s) - } - subnets[i] = n - } - _, CIDRBlock, perr := net.ParseCIDR(tc.CIDRBlock) - if perr != nil { - t.Errorf("Bad test data %s\n", tc.CIDRBlock) - } - test := VerifyNoOverlap(subnets, CIDRBlock) - if test != nil { - t.Errorf("Failed test with %v\n", test) - } - } - for _, tc := range failCases { - subnets := make([]*net.IPNet, len(tc.CIDRList)) - for i, s := range tc.CIDRList { - _, n, err := net.ParseCIDR(s) - if err != nil { - t.Errorf("Bad test data %s\n", s) - } - subnets[i] = n - } - _, CIDRBlock, perr := net.ParseCIDR(tc.CIDRBlock) - if perr != nil { - t.Errorf("Bad test data %s\n", tc.CIDRBlock) - } - test := VerifyNoOverlap(subnets, CIDRBlock) - if test == nil { - t.Errorf("Test should have failed with CIDR %s\n", tc.CIDRBlock) - } - } -} diff --git a/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go b/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go deleted file mode 100644 index 861a5f6..0000000 --- a/vendor/github.com/apparentlymart/go-cidr/cidr/wrangling.go +++ /dev/null @@ -1,38 +0,0 @@ -package cidr - -import ( - "fmt" - "math/big" - "net" -) - -func ipToInt(ip net.IP) (*big.Int, int) { - val := &big.Int{} - val.SetBytes([]byte(ip)) - if len(ip) == net.IPv4len { - return val, 32 - } else if len(ip) == net.IPv6len { - return val, 128 - } else { - panic(fmt.Errorf("Unsupported address length %d", len(ip))) - } -} - -func intToIP(ipInt *big.Int, bits int) net.IP { - ipBytes := ipInt.Bytes() - ret := make([]byte, bits/8) - // Pack our IP bytes into the end of the return array, - // since big.Int.Bytes() removes front zero padding. - for i := 1; i <= len(ipBytes); i++ { - ret[len(ret)-i] = ipBytes[len(ipBytes)-i] - } - return net.IP(ret) -} - -func insertNumIntoIP(ip net.IP, num int, prefixLen int) net.IP { - ipInt, totalBits := ipToInt(ip) - bigNum := big.NewInt(int64(num)) - bigNum.Lsh(bigNum, uint(totalBits-prefixLen)) - ipInt.Or(ipInt, bigNum) - return intToIP(ipInt, totalBits) -} diff --git a/vendor/github.com/apparentlymart/go-textseg/.travis.yml b/vendor/github.com/apparentlymart/go-textseg/.travis.yml deleted file mode 100644 index 50cd9af..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/.travis.yml +++ /dev/null @@ -1,19 +0,0 @@ -language: go - -go: - - 1.8.x - - tip - -matrix: - fast_finish: true - allow_failures: - - go: tip - -before_install: - - go get -t -v ./... - -script: - - go test -coverprofile=coverage.txt -covermode=atomic ./textseg - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/apparentlymart/go-textseg/LICENSE b/vendor/github.com/apparentlymart/go-textseg/LICENSE deleted file mode 100644 index 684b03b..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/LICENSE +++ /dev/null @@ -1,95 +0,0 @@ -Copyright (c) 2017 Martin Atkins - -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. - ---------- - -Unicode table generation programs are under a separate copyright and license: - -Copyright (c) 2014 Couchbase, 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. - ---------- - -Grapheme break data is provided as part of the Unicode character database, -copright 2016 Unicode, Inc, which is provided with the following license: - -Unicode Data Files include all data files under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -Unicode Data Files do not include PDF online code charts under the -directory http://www.unicode.org/Public/. - -Software includes any source code published in the Unicode Standard -or under the directories -http://www.unicode.org/Public/, http://www.unicode.org/reports/, -http://www.unicode.org/cldr/data/, http://source.icu-project.org/repos/icu/, and -http://www.unicode.org/utility/trac/browser/. - -NOTICE TO USER: Carefully read the following legal agreement. -BY DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S -DATA FILES ("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), -YOU UNEQUIVOCALLY ACCEPT, AND AGREE TO BE BOUND BY, ALL OF THE -TERMS AND CONDITIONS OF THIS AGREEMENT. -IF YOU DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE -THE DATA FILES OR SOFTWARE. - -COPYRIGHT AND PERMISSION NOTICE - -Copyright © 1991-2017 Unicode, Inc. All rights reserved. -Distributed under the Terms of Use in http://www.unicode.org/copyright.html. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of the Unicode data files and any associated documentation -(the "Data Files") or Unicode software and any associated documentation -(the "Software") to deal in the Data Files or Software -without restriction, including without limitation the rights to use, -copy, modify, merge, publish, distribute, and/or sell copies of -the Data Files or Software, and to permit persons to whom the Data Files -or Software are furnished to do so, provided that either -(a) this copyright and permission notice appear with all copies -of the Data Files or Software, or -(b) this copyright and permission notice appear in associated -Documentation. - -THE DATA FILES AND SOFTWARE ARE 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 OF THIRD PARTY RIGHTS. -IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS -NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL -DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, -DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER -TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR -PERFORMANCE OF THE DATA FILES OR SOFTWARE. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, -use or other dealings in these Data Files or Software without prior -written authorization of the copyright holder. diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens.go b/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens.go deleted file mode 100644 index 5752e9e..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens.go +++ /dev/null @@ -1,30 +0,0 @@ -package textseg - -import ( - "bufio" - "bytes" -) - -// AllTokens is a utility that uses a bufio.SplitFunc to produce a slice of -// all of the recognized tokens in the given buffer. -func AllTokens(buf []byte, splitFunc bufio.SplitFunc) ([][]byte, error) { - scanner := bufio.NewScanner(bytes.NewReader(buf)) - scanner.Split(splitFunc) - var ret [][]byte - for scanner.Scan() { - ret = append(ret, scanner.Bytes()) - } - return ret, scanner.Err() -} - -// TokenCount is a utility that uses a bufio.SplitFunc to count the number of -// recognized tokens in the given buffer. -func TokenCount(buf []byte, splitFunc bufio.SplitFunc) (int, error) { - scanner := bufio.NewScanner(bytes.NewReader(buf)) - scanner.Split(splitFunc) - var ret int - for scanner.Scan() { - ret++ - } - return ret, scanner.Err() -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens_test.go b/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens_test.go deleted file mode 100644 index e26a68a..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/all_tokens_test.go +++ /dev/null @@ -1,68 +0,0 @@ -package textseg - -import ( - "bufio" - "reflect" - "testing" -) - -func TestAllTokens(t *testing.T) { - tests := []struct { - input string - want []string - }{ - { - ``, - []string{}, - }, - { - `hello`, - []string{ - `hello`, - }, - }, - { - `hello world`, - []string{ - `hello`, - `world`, - }, - }, - { - `hello worldly world`, - []string{ - `hello`, - `worldly`, - `world`, - }, - }, - } - - for _, test := range tests { - t.Run(test.input, func(t *testing.T) { - gotBytes, err := AllTokens([]byte(test.input), bufio.ScanWords) - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - - got := make([]string, len(gotBytes)) - for i, buf := range gotBytes { - got[i] = string(buf) - } - - if !reflect.DeepEqual(got, test.want) { - wantBytes := make([][]byte, len(test.want)) - for i, str := range test.want { - wantBytes[i] = []byte(str) - } - - t.Errorf( - "wrong result\ninput: %s\ngot: %s\nwant: %s", - formatBytes([]byte(test.input)), - formatByteRanges(gotBytes), - formatByteRanges(wantBytes), - ) - } - }) - } -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go b/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go deleted file mode 100644 index 81f3a74..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/generate.go +++ /dev/null @@ -1,7 +0,0 @@ -package textseg - -//go:generate go run make_tables.go -output tables.go -//go:generate go run make_test_tables.go -output tables_test.go -//go:generate ruby unicode2ragel.rb --url=http://www.unicode.org/Public/9.0.0/ucd/auxiliary/GraphemeBreakProperty.txt -m GraphemeCluster -p "Prepend,CR,LF,Control,Extend,Regional_Indicator,SpacingMark,L,V,T,LV,LVT,E_Base,E_Modifier,ZWJ,Glue_After_Zwj,E_Base_GAZ" -o grapheme_clusters_table.rl -//go:generate ragel -Z grapheme_clusters.rl -//go:generate gofmt -w grapheme_clusters.go diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go b/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go deleted file mode 100644 index 012bc69..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.go +++ /dev/null @@ -1,5276 +0,0 @@ - -// line 1 "grapheme_clusters.rl" -package textseg - -import ( - "errors" - "unicode/utf8" -) - -// Generated from grapheme_clusters.rl. DO NOT EDIT - -// line 13 "grapheme_clusters.go" -var _graphclust_actions []byte = []byte{ - 0, 1, 0, 1, 4, 1, 9, 1, 10, - 1, 11, 1, 12, 1, 13, 1, 14, - 1, 15, 1, 16, 1, 17, 1, 18, - 1, 19, 1, 20, 1, 21, 2, 1, - 7, 2, 1, 8, 2, 2, 3, 2, - 5, 1, 3, 0, 1, 8, 3, 5, - 0, 1, 3, 5, 1, 6, -} - -var _graphclust_key_offsets []int16 = []int16{ - 0, 0, 1, 3, 5, 7, 10, 15, - 17, 20, 28, 31, 33, 35, 37, 67, - 75, 77, 81, 84, 89, 94, 104, 116, - 122, 127, 137, 140, 147, 151, 159, 169, - 173, 181, 183, 191, 194, 196, 201, 203, - 210, 212, 220, 221, 242, 246, 252, 257, - 259, 263, 267, 269, 273, 275, 278, 282, - 284, 291, 293, 297, 301, 305, 307, 309, - 318, 322, 327, 329, 335, 337, 338, 340, - 341, 343, 345, 347, 349, 364, 368, 370, - 372, 377, 381, 385, 387, 389, 393, 397, - 399, 403, 410, 415, 419, 422, 423, 427, - 434, 439, 440, 441, 443, 452, 454, 477, - 481, 483, 487, 491, 492, 496, 500, 503, - 505, 510, 523, 525, 527, 529, 531, 535, - 539, 541, 543, 545, 549, 553, 557, 559, - 561, 563, 565, 566, 568, 574, 580, 586, - 588, 592, 596, 601, 604, 614, 616, 618, - 621, 623, 625, 627, 629, 632, 637, 639, - 642, 650, 653, 655, 657, 659, 690, 698, - 700, 704, 711, 723, 730, 744, 750, 768, - 779, 785, 797, 800, 809, 814, 824, 830, - 844, 850, 862, 874, 878, 880, 886, 888, - 895, 898, 906, 907, 928, 937, 945, 951, - 953, 957, 961, 966, 972, 974, 977, 990, - 995, 1009, 1011, 1020, 1027, 1038, 1048, 1056, - 1067, 1071, 1076, 1078, 1080, 1082, 1083, 1085, - 1087, 1089, 1091, 1106, 1110, 1112, 1114, 1122, - 1130, 1132, 1136, 1147, 1150, 1160, 1164, 1171, - 1179, 1185, 1188, 1189, 1193, 1200, 1205, 1206, - 1207, 1209, 1218, 1220, 1243, 1248, 1250, 1259, - 1264, 1265, 1274, 1280, 1290, 1295, 1302, 1316, - 1320, 1325, 1336, 1339, 1349, 1353, 1362, 1364, - 1372, 1379, 1385, 1392, 1396, 1398, 1400, 1402, - 1403, 1405, 1411, 1419, 1425, 1427, 1431, 1435, - 1440, 1443, 1453, 1455, 1457, 1458, 1460, 1461, - 1467, 1469, 1471, 1471, 1472, 1473, 1474, 1480, - 1482, 1484, 1484, 1490, 1492, 1497, 1502, 1504, - 1506, 1508, 1511, 1516, 1518, 1521, 1529, 1532, - 1534, 1536, 1538, 1568, 1576, 1578, 1582, 1585, - 1590, 1595, 1605, 1617, 1623, 1628, 1638, 1641, - 1648, 1652, 1660, 1670, 1674, 1682, 1684, 1692, - 1695, 1697, 1702, 1704, 1711, 1713, 1721, 1722, - 1743, 1747, 1753, 1758, 1760, 1764, 1768, 1770, - 1774, 1776, 1779, 1783, 1785, 1792, 1794, 1798, - 1802, 1806, 1808, 1810, 1819, 1823, 1828, 1830, - 1836, 1838, 1839, 1841, 1842, 1844, 1846, 1848, - 1850, 1865, 1869, 1871, 1873, 1878, 1882, 1886, - 1888, 1890, 1894, 1898, 1900, 1904, 1911, 1916, - 1920, 1923, 1924, 1928, 1935, 1940, 1941, 1942, - 1944, 1953, 1955, 1978, 1982, 1984, 1988, 1992, - 1993, 1997, 2001, 2004, 2006, 2011, 2024, 2026, - 2028, 2030, 2032, 2036, 2040, 2042, 2044, 2046, - 2050, 2054, 2058, 2060, 2062, 2064, 2066, 2067, - 2069, 2075, 2081, 2087, 2089, 2093, 2097, 2102, - 2105, 2115, 2117, 2119, 2122, 2124, 2126, 2128, - 2130, 2133, 2138, 2140, 2143, 2151, 2154, 2156, - 2158, 2160, 2191, 2199, 2201, 2205, 2212, 2224, - 2231, 2245, 2251, 2269, 2280, 2286, 2298, 2301, - 2310, 2315, 2325, 2331, 2345, 2351, 2363, 2375, - 2379, 2381, 2387, 2389, 2396, 2399, 2407, 2408, - 2429, 2438, 2446, 2452, 2454, 2458, 2462, 2467, - 2473, 2475, 2478, 2491, 2496, 2510, 2512, 2521, - 2528, 2539, 2549, 2557, 2568, 2572, 2577, 2579, - 2581, 2583, 2584, 2586, 2588, 2590, 2592, 2607, - 2611, 2613, 2615, 2623, 2631, 2633, 2637, 2648, - 2651, 2661, 2665, 2672, 2680, 2686, 2689, 2690, - 2694, 2701, 2706, 2707, 2708, 2710, 2719, 2721, - 2744, 2749, 2751, 2760, 2765, 2766, 2775, 2781, - 2791, 2796, 2803, 2817, 2821, 2826, 2837, 2840, - 2850, 2854, 2863, 2865, 2873, 2880, 2886, 2893, - 2897, 2899, 2901, 2903, 2904, 2906, 2912, 2920, - 2926, 2928, 2932, 2936, 2941, 2944, 2954, 2956, - 2958, 2959, 2961, 2962, 2968, 2970, 2972, 2972, - 2973, 2974, 2975, 2981, 2983, 2985, 2985, 2991, - 2993, 2997, 3003, 3006, 3009, 3013, 3016, 3019, - 3026, 3028, 3052, 3054, 3078, 3080, 3082, 3105, - 3107, 3109, 3110, 3112, 3114, 3116, 3122, 3124, - 3156, 3160, 3165, 3188, 3190, 3192, 3194, 3196, - 3199, 3201, 3203, 3207, 3207, 3263, 3319, 3350, - 3355, 3359, 3366, 3374, 3378, 3381, 3384, 3390, - 3392, 3412, 3418, 3423, 3425, 3427, 3430, 3432, - 3434, 3438, 3494, 3550, 3581, 3586, 3594, 3598, - 3600, 3605, 3611, 3615, 3618, 3624, 3627, 3631, - 3634, 3638, 3651, 3655, 3662, 3663, 3665, 3668, - 3678, 3698, 3705, 3709, 3716, 3726, 3733, 3736, - 3751, 3753, 3756, 3761, 3763, 3766, 3769, 3773, - 3776, 3779, 3786, 3788, 3790, 3792, 3794, 3797, - 3802, 3804, 3807, 3815, 3818, 3820, 3822, 3824, - 3854, 3862, 3864, 3868, 3871, 3876, 3881, 3891, - 3903, 3909, 3914, 3924, 3927, 3934, 3938, 3946, - 3956, 3960, 3968, 3970, 3978, 3981, 3983, 3988, - 3990, 3997, 3999, 4007, 4008, 4029, 4033, 4039, - 4044, 4046, 4050, 4054, 4056, 4060, 4062, 4065, - 4069, 4071, 4078, 4080, 4084, 4088, 4092, 4094, - 4096, 4105, 4109, 4114, 4116, 4122, 4124, 4125, - 4127, 4128, 4130, 4132, 4134, 4136, 4151, 4155, - 4157, 4159, 4164, 4168, 4172, 4174, 4176, 4180, - 4184, 4186, 4190, 4197, 4202, 4206, 4209, 4210, - 4214, 4221, 4226, 4227, 4228, 4230, 4239, 4241, - 4264, 4268, 4270, 4274, 4278, 4279, 4283, 4287, - 4290, 4292, 4297, 4310, 4312, 4314, 4316, 4318, - 4322, 4326, 4328, 4330, 4332, 4336, 4340, 4344, - 4346, 4348, 4350, 4352, 4353, 4355, 4361, 4367, - 4373, 4375, 4379, 4383, 4388, 4391, 4401, 4403, - 4405, 4408, 4410, 4412, 4414, 4416, 4419, 4424, - 4426, 4429, 4437, 4440, 4442, 4444, 4446, 4477, - 4485, 4487, 4491, 4498, 4510, 4517, 4531, 4537, - 4555, 4566, 4572, 4584, 4587, 4596, 4601, 4611, - 4617, 4631, 4637, 4649, 4661, 4665, 4667, 4673, - 4675, 4682, 4685, 4693, 4694, 4715, 4724, 4732, - 4738, 4740, 4744, 4748, 4753, 4759, 4761, 4764, - 4777, 4782, 4796, 4798, 4807, 4814, 4825, 4835, - 4843, 4854, 4858, 4863, 4865, 4867, 4869, 4870, - 4872, 4874, 4876, 4878, 4893, 4897, 4899, 4901, - 4909, 4917, 4919, 4923, 4934, 4937, 4947, 4951, - 4958, 4966, 4972, 4975, 4976, 4980, 4987, 4992, - 4993, 4994, 4996, 5005, 5007, 5030, 5035, 5037, - 5046, 5051, 5052, 5061, 5067, 5077, 5082, 5089, - 5103, 5107, 5112, 5123, 5126, 5136, 5140, 5149, - 5151, 5159, 5166, 5172, 5179, 5183, 5185, 5187, - 5189, 5190, 5192, 5198, 5206, 5212, 5214, 5218, - 5222, 5227, 5230, 5240, 5242, 5244, 5245, 5247, - 5248, 5254, 5256, 5258, 5258, 5259, 5260, 5261, - 5267, 5269, 5271, 5271, 5277, 5301, 5303, 5327, - 5329, 5331, 5354, 5356, 5358, 5359, 5361, 5363, - 5365, 5371, 5373, 5405, 5409, 5414, 5437, 5439, - 5441, 5443, 5445, 5448, 5450, 5452, 5456, 5456, - 5512, 5568, 5599, 5604, 5607, 5614, 5626, 5628, - 5630, 5632, 5635, 5640, 5642, 5645, 5653, 5656, - 5658, 5660, 5662, 5692, 5700, 5702, 5706, 5709, - 5714, 5719, 5729, 5741, 5747, 5752, 5762, 5765, - 5772, 5776, 5784, 5794, 5798, 5806, 5808, 5816, - 5819, 5821, 5826, 5828, 5835, 5837, 5845, 5846, - 5867, 5871, 5877, 5882, 5884, 5888, 5892, 5894, - 5898, 5900, 5903, 5907, 5909, 5916, 5918, 5922, - 5926, 5930, 5932, 5934, 5943, 5947, 5952, 5954, - 5956, 5958, 5959, 5961, 5963, 5965, 5967, 5982, - 5986, 5988, 5990, 5995, 5999, 6003, 6005, 6007, - 6011, 6015, 6017, 6021, 6028, 6033, 6037, 6040, - 6041, 6045, 6051, 6056, 6057, 6058, 6060, 6069, - 6071, 6094, 6098, 6100, 6104, 6108, 6109, 6113, - 6117, 6120, 6122, 6127, 6140, 6142, 6144, 6146, - 6148, 6152, 6156, 6158, 6160, 6162, 6166, 6170, - 6174, 6176, 6178, 6180, 6182, 6183, 6185, 6191, - 6197, 6203, 6205, 6209, 6213, 6218, 6221, 6231, - 6233, 6235, 6236, 6242, 6244, 6246, 6246, 6252, - 6253, 6260, 6263, 6265, 6267, 6269, 6271, 6274, - 6279, 6281, 6284, 6292, 6295, 6297, 6299, 6301, - 6332, 6340, 6342, 6346, 6353, 6365, 6372, 6386, - 6392, 6410, 6421, 6427, 6439, 6442, 6451, 6456, - 6466, 6472, 6486, 6492, 6504, 6516, 6520, 6522, - 6528, 6530, 6537, 6540, 6548, 6549, 6570, 6579, - 6587, 6593, 6595, 6599, 6603, 6608, 6614, 6616, - 6619, 6632, 6637, 6651, 6653, 6662, 6669, 6680, - 6690, 6698, 6709, 6713, 6718, 6720, 6722, 6724, - 6725, 6727, 6729, 6731, 6733, 6748, 6752, 6754, - 6756, 6764, 6772, 6774, 6778, 6789, 6792, 6802, - 6806, 6813, 6821, 6827, 6830, 6831, 6835, 6842, - 6847, 6848, 6849, 6851, 6860, 6862, 6885, 6890, - 6892, 6901, 6906, 6907, 6916, 6922, 6932, 6937, - 6944, 6958, 6962, 6967, 6978, 6981, 6991, 6995, - 7004, 7006, 7014, 7021, 7027, 7034, 7038, 7040, - 7042, 7044, 7045, 7047, 7053, 7061, 7067, 7069, - 7073, 7077, 7082, 7085, 7095, 7097, 7099, 7100, - 7102, 7103, 7109, 7111, 7113, 7113, 7114, 7115, - 7121, 7124, 7126, 7128, 7130, 7133, 7138, 7140, - 7143, 7151, 7154, 7156, 7158, 7160, 7191, 7199, - 7201, 7205, 7212, 7214, 7216, 7218, 7221, 7226, - 7228, 7231, 7239, 7242, 7244, 7246, 7248, 7278, - 7286, 7288, 7292, 7295, 7300, 7305, 7315, 7327, - 7333, 7338, 7348, 7351, 7358, 7362, 7370, 7380, - 7384, 7392, 7394, 7402, 7405, 7407, 7412, 7414, - 7421, 7423, 7431, 7432, 7453, 7457, 7463, 7468, - 7470, 7474, 7478, 7480, 7484, 7486, 7489, 7493, - 7495, 7502, 7504, 7508, 7512, 7516, 7518, 7520, - 7529, 7533, 7538, 7540, 7546, 7548, 7549, 7551, - 7552, 7554, 7556, 7558, 7560, 7575, 7579, 7581, - 7583, 7588, 7592, 7596, 7598, 7600, 7604, 7608, - 7610, 7614, 7621, 7626, 7630, 7633, 7634, 7638, - 7645, 7650, 7651, 7652, 7654, 7663, 7665, 7688, - 7692, 7694, 7698, 7702, 7703, 7707, 7711, 7714, - 7716, 7721, 7734, 7736, 7738, 7740, 7742, 7746, - 7750, 7752, 7754, 7756, 7760, 7764, 7768, 7770, - 7772, 7774, 7776, 7777, 7779, 7785, 7791, 7797, - 7799, 7803, 7807, 7812, 7815, 7825, 7827, 7829, - 7832, 7834, 7835, 7836, 7837, 7843, 7845, 7847, - 7847, 7853, 7865, 7872, 7886, 7892, 7910, 7921, - 7927, 7939, 7942, 7951, 7956, 7966, 7972, 7986, - 7992, 8004, 8016, 8020, 8022, 8028, 8030, 8037, - 8040, 8048, 8049, 8070, 8079, 8087, 8093, 8095, - 8099, 8103, 8108, 8114, 8116, 8119, 8132, 8137, - 8151, 8153, 8162, 8169, 8180, 8190, 8198, 8209, - 8213, 8218, 8220, 8222, 8224, 8225, 8227, 8229, - 8231, 8233, 8248, 8252, 8254, 8256, 8264, 8272, - 8274, 8278, 8289, 8292, 8302, 8306, 8313, 8321, - 8327, 8330, 8331, 8335, 8342, 8347, 8348, 8349, - 8351, 8360, 8362, 8385, 8390, 8392, 8401, 8406, - 8407, 8416, 8422, 8432, 8437, 8444, 8458, 8462, - 8467, 8478, 8481, 8491, 8495, 8504, 8506, 8514, - 8521, 8527, 8534, 8538, 8540, 8542, 8544, 8545, - 8547, 8553, 8561, 8567, 8569, 8573, 8577, 8582, - 8585, 8595, 8597, 8599, 8600, 8602, 8603, 8609, - 8611, 8613, 8613, 8616, 8622, 8624, 8644, 8650, - 8655, 8657, 8659, 8662, 8664, 8666, 8670, 8726, - 8782, 8817, 8822, 8830, 8832, 8832, 8834, 8838, - 8841, 8848, 8854, 8858, 8861, 8867, 8870, 8876, - 8879, 8885, 8898, 8902, 8904, 8906, 8908, 8911, - 8916, 8918, 8921, 8929, 8932, 8934, 8936, 8938, - 8968, 8976, 8978, 8982, 8985, 8990, 8995, 9005, - 9017, 9023, 9028, 9038, 9041, 9048, 9052, 9060, - 9070, 9074, 9082, 9084, 9092, 9095, 9097, 9102, - 9104, 9111, 9113, 9121, 9122, 9143, 9147, 9153, - 9158, 9160, 9164, 9168, 9170, 9174, 9176, 9179, - 9183, 9185, 9192, 9194, 9198, 9202, 9206, 9208, - 9210, 9219, 9223, 9228, 9230, 9236, 9238, 9239, - 9241, 9242, 9244, 9246, 9248, 9250, 9265, 9269, - 9271, 9273, 9278, 9282, 9286, 9288, 9290, 9294, - 9298, 9300, 9304, 9311, 9316, 9320, 9323, 9324, - 9328, 9335, 9340, 9341, 9342, 9344, 9353, 9355, - 9378, 9382, 9384, 9388, 9392, 9393, 9397, 9401, - 9404, 9406, 9411, 9424, 9426, 9428, 9430, 9432, - 9436, 9440, 9442, 9444, 9446, 9450, 9454, 9458, - 9460, 9462, 9464, 9466, 9467, 9469, 9475, 9481, - 9487, 9489, 9493, 9497, 9502, 9505, 9515, 9517, - 9519, 9522, 9524, 9526, 9528, 9530, 9533, 9538, - 9540, 9543, 9551, 9554, 9556, 9558, 9560, 9591, - 9599, 9601, 9605, 9612, 9624, 9631, 9645, 9651, - 9669, 9680, 9686, 9698, 9701, 9710, 9715, 9725, - 9731, 9745, 9751, 9763, 9775, 9779, 9781, 9787, - 9789, 9796, 9799, 9807, 9808, 9829, 9838, 9846, - 9852, 9854, 9858, 9862, 9867, 9873, 9875, 9878, - 9891, 9896, 9910, 9912, 9921, 9928, 9939, 9949, - 9957, 9968, 9972, 9977, 9979, 9981, 9983, 9984, - 9986, 9988, 9990, 9992, 10007, 10011, 10013, 10015, - 10023, 10031, 10033, 10037, 10048, 10051, 10061, 10065, - 10072, 10080, 10086, 10089, 10090, 10094, 10101, 10106, - 10107, 10108, 10110, 10119, 10121, 10144, 10149, 10151, - 10160, 10165, 10166, 10175, 10181, 10191, 10196, 10203, - 10217, 10221, 10226, 10237, 10240, 10250, 10254, 10263, - 10265, 10273, 10280, 10286, 10293, 10297, 10299, 10301, - 10303, 10304, 10306, 10312, 10320, 10326, 10328, 10332, - 10336, 10341, 10344, 10354, 10356, 10358, 10359, 10361, - 10362, 10368, 10370, 10372, 10372, 10373, 10374, 10375, - 10381, 10383, 10385, 10385, 10391, 10398, 10399, 10401, - 10404, 10414, 10434, 10441, 10445, 10452, 10462, 10469, - 10472, 10487, 10489, 10492, 10501, 10505, 10509, 10538, - 10558, 10578, 10598, 10620, 10640, 10660, 10680, 10703, - 10724, 10745, 10766, 10786, 10809, 10829, 10849, 10869, - 10890, 10911, 10932, 10952, 10972, 10992, 11012, 11032, - 11052, 11072, 11092, 11112, -} - -var _graphclust_trans_keys []byte = []byte{ - 10, 128, 255, 176, 255, 131, 137, 191, - 145, 189, 135, 129, 130, 132, 133, 144, - 154, 176, 139, 159, 150, 156, 159, 164, - 167, 168, 170, 173, 145, 176, 255, 139, - 255, 166, 176, 171, 179, 160, 161, 163, - 164, 165, 167, 169, 171, 173, 174, 175, - 176, 177, 179, 180, 181, 182, 183, 184, - 185, 186, 187, 188, 189, 190, 191, 166, - 170, 172, 178, 150, 153, 155, 163, 165, - 167, 169, 173, 153, 155, 148, 161, 163, - 255, 189, 132, 185, 144, 152, 161, 164, - 255, 188, 129, 131, 190, 255, 133, 134, - 137, 138, 142, 150, 152, 161, 164, 255, - 131, 134, 137, 138, 142, 144, 146, 175, - 178, 180, 182, 255, 134, 138, 142, 161, - 164, 255, 188, 129, 131, 190, 191, 128, - 132, 135, 136, 139, 141, 150, 151, 162, - 163, 130, 190, 191, 151, 128, 130, 134, - 136, 138, 141, 128, 131, 190, 255, 133, - 137, 142, 148, 151, 161, 164, 255, 128, - 132, 134, 136, 138, 141, 149, 150, 162, - 163, 129, 131, 190, 255, 133, 137, 142, - 150, 152, 161, 164, 255, 130, 131, 138, - 150, 143, 148, 152, 159, 178, 179, 177, - 179, 186, 135, 142, 177, 179, 185, 187, - 188, 136, 141, 181, 183, 185, 152, 153, - 190, 191, 177, 191, 128, 132, 134, 135, - 141, 151, 153, 188, 134, 128, 129, 130, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 173, 183, 185, 190, 150, 153, - 158, 160, 177, 180, 130, 141, 157, 132, - 134, 157, 159, 146, 148, 178, 180, 146, - 147, 178, 179, 180, 255, 148, 156, 158, - 255, 139, 141, 169, 133, 134, 160, 171, - 176, 187, 151, 155, 160, 162, 191, 149, - 158, 165, 188, 176, 190, 128, 132, 180, - 255, 133, 170, 180, 255, 128, 130, 161, - 173, 166, 179, 164, 183, 173, 144, 146, - 148, 168, 178, 180, 184, 185, 128, 181, - 187, 191, 128, 131, 179, 181, 183, 140, - 141, 128, 131, 157, 179, 181, 183, 144, - 176, 164, 175, 177, 191, 160, 191, 128, - 130, 170, 175, 153, 154, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 175, 178, 180, 189, - 158, 159, 176, 177, 130, 134, 139, 163, - 167, 128, 129, 180, 255, 134, 159, 178, - 255, 166, 173, 135, 147, 128, 131, 179, - 255, 129, 164, 166, 255, 169, 182, 131, - 188, 140, 141, 176, 178, 180, 183, 184, - 190, 191, 129, 171, 175, 181, 182, 163, - 170, 172, 173, 172, 184, 190, 158, 128, - 143, 160, 175, 144, 145, 150, 155, 157, - 158, 159, 135, 139, 141, 168, 171, 189, - 160, 182, 186, 191, 129, 131, 133, 134, - 140, 143, 184, 186, 165, 166, 128, 129, - 130, 132, 133, 134, 135, 136, 139, 140, - 141, 144, 145, 146, 147, 150, 151, 152, - 153, 154, 156, 176, 178, 128, 130, 184, - 255, 135, 190, 131, 175, 187, 255, 128, - 130, 167, 180, 179, 128, 130, 179, 255, - 129, 137, 141, 255, 190, 172, 183, 159, - 170, 188, 128, 131, 190, 191, 151, 128, - 132, 135, 136, 139, 141, 162, 163, 166, - 172, 176, 180, 181, 191, 128, 134, 176, - 255, 132, 255, 175, 181, 184, 255, 129, - 155, 158, 255, 129, 255, 171, 183, 157, - 171, 175, 182, 184, 191, 146, 167, 169, - 182, 171, 172, 189, 190, 176, 180, 176, - 182, 145, 190, 143, 146, 178, 157, 158, - 133, 134, 137, 168, 169, 170, 165, 169, - 173, 178, 187, 255, 131, 132, 140, 169, - 174, 255, 130, 132, 128, 182, 187, 255, - 173, 180, 182, 255, 132, 155, 159, 161, - 175, 128, 163, 165, 128, 134, 136, 152, - 155, 161, 163, 164, 166, 170, 144, 150, - 132, 138, 145, 146, 151, 166, 169, 0, - 127, 176, 255, 131, 137, 191, 145, 189, - 135, 129, 130, 132, 133, 144, 154, 176, - 139, 159, 150, 156, 159, 164, 167, 168, - 170, 173, 145, 176, 255, 139, 255, 166, - 176, 171, 179, 160, 161, 163, 164, 165, - 166, 167, 169, 171, 172, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 168, 170, 150, 153, 155, 163, 165, 167, - 169, 173, 153, 155, 148, 161, 163, 255, - 131, 187, 189, 132, 185, 190, 255, 141, - 144, 129, 136, 145, 151, 152, 161, 162, - 163, 164, 255, 129, 188, 190, 130, 131, - 191, 255, 141, 151, 129, 132, 133, 134, - 137, 138, 142, 161, 162, 163, 164, 255, - 131, 188, 129, 130, 190, 255, 145, 181, - 129, 130, 131, 134, 135, 136, 137, 138, - 139, 141, 142, 175, 176, 177, 178, 255, - 134, 138, 141, 129, 136, 142, 161, 162, - 163, 164, 255, 129, 188, 130, 131, 190, - 191, 128, 141, 129, 132, 135, 136, 139, - 140, 150, 151, 162, 163, 130, 190, 191, - 128, 141, 151, 129, 130, 134, 136, 138, - 140, 128, 129, 131, 190, 255, 133, 137, - 129, 132, 142, 148, 151, 161, 164, 255, - 129, 188, 190, 191, 130, 131, 130, 134, - 128, 132, 135, 136, 138, 139, 140, 141, - 149, 150, 162, 163, 129, 190, 130, 131, - 191, 255, 133, 137, 141, 151, 129, 132, - 142, 161, 162, 163, 164, 255, 138, 143, - 150, 159, 144, 145, 146, 148, 152, 158, - 178, 179, 177, 179, 180, 186, 135, 142, - 177, 179, 180, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 191, - 177, 190, 128, 132, 134, 135, 141, 151, - 153, 188, 134, 128, 129, 130, 141, 156, - 157, 158, 159, 160, 162, 164, 168, 169, - 170, 172, 173, 174, 175, 176, 179, 183, - 177, 173, 183, 185, 186, 187, 188, 189, - 190, 150, 151, 152, 153, 158, 160, 177, - 180, 130, 132, 141, 157, 133, 134, 157, - 159, 146, 148, 178, 180, 146, 147, 178, - 179, 182, 180, 189, 190, 255, 134, 157, - 137, 147, 148, 255, 139, 141, 169, 133, - 134, 178, 160, 162, 163, 166, 167, 168, - 169, 171, 176, 184, 185, 187, 155, 151, - 152, 153, 154, 150, 160, 162, 191, 149, - 151, 152, 158, 165, 172, 173, 178, 179, - 188, 176, 190, 132, 181, 187, 128, 131, - 180, 188, 189, 255, 130, 133, 170, 171, - 179, 180, 255, 130, 161, 170, 128, 129, - 162, 165, 166, 167, 168, 173, 167, 173, - 166, 169, 170, 174, 175, 177, 178, 179, - 164, 171, 172, 179, 180, 181, 182, 183, - 161, 173, 180, 144, 146, 148, 168, 178, - 179, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 144, 176, - 175, 177, 191, 160, 191, 128, 130, 170, - 175, 153, 154, 153, 154, 155, 160, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 175, 175, 178, 180, 189, 158, 159, - 176, 177, 130, 134, 139, 167, 163, 164, - 165, 166, 132, 133, 134, 159, 160, 177, - 178, 255, 166, 173, 135, 145, 146, 147, - 131, 179, 188, 128, 130, 180, 181, 182, - 185, 186, 255, 165, 129, 255, 169, 174, - 175, 176, 177, 178, 179, 180, 181, 182, - 131, 140, 141, 188, 176, 178, 180, 183, - 184, 190, 191, 129, 171, 181, 182, 172, - 173, 174, 175, 165, 168, 172, 173, 163, - 170, 172, 184, 190, 158, 128, 143, 160, - 175, 144, 145, 150, 155, 157, 158, 159, - 135, 139, 141, 168, 171, 189, 160, 182, - 186, 191, 129, 131, 133, 134, 140, 143, - 184, 186, 165, 166, 128, 129, 130, 132, - 133, 134, 135, 136, 139, 140, 141, 144, - 145, 146, 147, 150, 151, 152, 153, 154, - 156, 176, 178, 129, 128, 130, 184, 255, - 135, 190, 130, 131, 175, 176, 178, 183, - 184, 187, 255, 172, 128, 130, 167, 180, - 179, 130, 128, 129, 179, 181, 182, 190, - 191, 255, 129, 137, 138, 140, 141, 255, - 180, 190, 172, 174, 175, 177, 178, 181, - 182, 183, 159, 160, 162, 163, 170, 188, - 190, 191, 128, 129, 130, 131, 128, 151, - 129, 132, 135, 136, 139, 141, 162, 163, - 166, 172, 176, 180, 181, 183, 184, 191, - 133, 128, 129, 130, 134, 176, 185, 189, - 177, 178, 179, 186, 187, 190, 191, 255, - 129, 132, 255, 175, 190, 176, 177, 178, - 181, 184, 187, 188, 255, 129, 155, 158, - 255, 189, 176, 178, 179, 186, 187, 190, - 191, 255, 129, 255, 172, 182, 171, 173, - 174, 175, 176, 183, 166, 157, 159, 160, - 161, 162, 171, 175, 190, 176, 182, 184, - 191, 169, 177, 180, 146, 167, 170, 182, - 171, 172, 189, 190, 176, 180, 176, 182, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 166, 173, 165, 169, 174, - 178, 187, 255, 131, 132, 140, 169, 174, - 255, 130, 132, 128, 182, 187, 255, 173, - 180, 182, 255, 132, 155, 159, 161, 175, - 128, 163, 165, 128, 134, 136, 152, 155, - 161, 163, 164, 166, 170, 144, 150, 132, - 138, 143, 187, 191, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 139, - 168, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 144, 145, 150, 155, - 157, 158, 128, 191, 173, 128, 159, 160, - 191, 156, 128, 133, 134, 191, 0, 127, - 176, 255, 131, 137, 191, 145, 189, 135, - 129, 130, 132, 133, 144, 154, 176, 139, - 159, 150, 156, 159, 164, 167, 168, 170, - 173, 145, 176, 255, 139, 255, 166, 176, - 171, 179, 160, 161, 163, 164, 165, 167, - 169, 171, 173, 174, 175, 176, 177, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 166, 170, 172, 178, - 150, 153, 155, 163, 165, 167, 169, 173, - 153, 155, 148, 161, 163, 255, 189, 132, - 185, 144, 152, 161, 164, 255, 188, 129, - 131, 190, 255, 133, 134, 137, 138, 142, - 150, 152, 161, 164, 255, 131, 134, 137, - 138, 142, 144, 146, 175, 178, 180, 182, - 255, 134, 138, 142, 161, 164, 255, 188, - 129, 131, 190, 191, 128, 132, 135, 136, - 139, 141, 150, 151, 162, 163, 130, 190, - 191, 151, 128, 130, 134, 136, 138, 141, - 128, 131, 190, 255, 133, 137, 142, 148, - 151, 161, 164, 255, 128, 132, 134, 136, - 138, 141, 149, 150, 162, 163, 129, 131, - 190, 255, 133, 137, 142, 150, 152, 161, - 164, 255, 130, 131, 138, 150, 143, 148, - 152, 159, 178, 179, 177, 179, 186, 135, - 142, 177, 179, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 177, - 191, 128, 132, 134, 135, 141, 151, 153, - 188, 134, 128, 129, 130, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 173, - 183, 185, 190, 150, 153, 158, 160, 177, - 180, 130, 141, 157, 132, 134, 157, 159, - 146, 148, 178, 180, 146, 147, 178, 179, - 180, 255, 148, 156, 158, 255, 139, 141, - 169, 133, 134, 160, 171, 176, 187, 151, - 155, 160, 162, 191, 149, 158, 165, 188, - 176, 190, 128, 132, 180, 255, 133, 170, - 180, 255, 128, 130, 161, 173, 166, 179, - 164, 183, 173, 144, 146, 148, 168, 178, - 180, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 128, 131, - 157, 179, 181, 183, 144, 176, 164, 175, - 177, 191, 160, 191, 128, 130, 170, 175, - 153, 154, 153, 154, 155, 160, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 175, 175, 178, 180, 189, 158, 159, 176, - 177, 130, 134, 139, 163, 167, 128, 129, - 180, 255, 134, 159, 178, 255, 166, 173, - 135, 147, 128, 131, 179, 255, 129, 164, - 166, 255, 169, 182, 131, 188, 140, 141, - 176, 178, 180, 183, 184, 190, 191, 129, - 171, 175, 181, 182, 163, 170, 172, 173, - 172, 184, 190, 158, 128, 143, 160, 175, - 144, 145, 150, 155, 157, 158, 159, 135, - 139, 141, 168, 171, 189, 160, 182, 186, - 191, 129, 131, 133, 134, 140, 143, 184, - 186, 165, 166, 128, 129, 130, 132, 133, - 134, 135, 136, 139, 140, 141, 144, 145, - 146, 147, 150, 151, 152, 153, 154, 156, - 176, 178, 128, 130, 184, 255, 135, 190, - 131, 175, 187, 255, 128, 130, 167, 180, - 179, 128, 130, 179, 255, 129, 137, 141, - 255, 190, 172, 183, 159, 170, 188, 128, - 131, 190, 191, 151, 128, 132, 135, 136, - 139, 141, 162, 163, 166, 172, 176, 180, - 181, 191, 128, 134, 176, 255, 132, 255, - 175, 181, 184, 255, 129, 155, 158, 255, - 129, 255, 171, 183, 157, 171, 175, 182, - 184, 191, 146, 167, 169, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 145, 190, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 165, 169, 173, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 145, - 146, 151, 166, 169, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 141, 144, 129, 136, - 145, 151, 152, 161, 162, 163, 164, 255, - 129, 188, 190, 130, 131, 191, 255, 141, - 151, 129, 132, 133, 134, 137, 138, 142, - 161, 162, 163, 164, 255, 131, 188, 129, - 130, 190, 255, 145, 181, 129, 130, 131, - 134, 135, 136, 137, 138, 139, 141, 142, - 175, 176, 177, 178, 255, 134, 138, 141, - 129, 136, 142, 161, 162, 163, 164, 255, - 129, 188, 130, 131, 190, 191, 128, 141, - 129, 132, 135, 136, 139, 140, 150, 151, - 162, 163, 130, 190, 191, 128, 141, 151, - 129, 130, 134, 136, 138, 140, 128, 129, - 131, 190, 255, 133, 137, 129, 132, 142, - 148, 151, 161, 164, 255, 129, 188, 190, - 191, 130, 131, 130, 134, 128, 132, 135, - 136, 138, 139, 140, 141, 149, 150, 162, - 163, 129, 190, 130, 131, 191, 255, 133, - 137, 141, 151, 129, 132, 142, 161, 162, - 163, 164, 255, 138, 143, 150, 159, 144, - 145, 146, 148, 152, 158, 178, 179, 177, - 179, 180, 186, 135, 142, 177, 179, 180, - 185, 187, 188, 136, 141, 181, 183, 185, - 152, 153, 190, 191, 191, 177, 190, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 177, 173, 183, - 185, 186, 187, 188, 189, 190, 150, 151, - 152, 153, 158, 160, 177, 180, 130, 132, - 141, 157, 133, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 182, 180, - 189, 190, 255, 134, 157, 137, 147, 148, - 255, 139, 141, 169, 133, 134, 178, 160, - 162, 163, 166, 167, 168, 169, 171, 176, - 184, 185, 187, 155, 151, 152, 153, 154, - 150, 160, 162, 191, 149, 151, 152, 158, - 165, 172, 173, 178, 179, 188, 176, 190, - 132, 181, 187, 128, 131, 180, 188, 189, - 255, 130, 133, 170, 171, 179, 180, 255, - 130, 161, 170, 128, 129, 162, 165, 166, - 167, 168, 173, 167, 173, 166, 169, 170, - 174, 175, 177, 178, 179, 164, 171, 172, - 179, 180, 181, 182, 183, 161, 173, 180, - 144, 146, 148, 168, 178, 179, 184, 185, - 128, 181, 187, 191, 128, 131, 179, 181, - 183, 140, 141, 144, 176, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 167, 163, 164, 165, 166, 132, - 133, 134, 159, 160, 177, 178, 255, 166, - 173, 135, 145, 146, 147, 131, 179, 188, - 128, 130, 180, 181, 182, 185, 186, 255, - 165, 129, 255, 169, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 131, 140, 141, - 188, 176, 178, 180, 183, 184, 190, 191, - 129, 171, 181, 182, 172, 173, 174, 175, - 165, 168, 172, 173, 163, 170, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 129, 128, 130, 184, 255, 135, 190, 130, - 131, 175, 176, 178, 183, 184, 187, 255, - 172, 128, 130, 167, 180, 179, 130, 128, - 129, 179, 181, 182, 190, 191, 255, 129, - 137, 138, 140, 141, 255, 180, 190, 172, - 174, 175, 177, 178, 181, 182, 183, 159, - 160, 162, 163, 170, 188, 190, 191, 128, - 129, 130, 131, 128, 151, 129, 132, 135, - 136, 139, 141, 162, 163, 166, 172, 176, - 180, 181, 183, 184, 191, 133, 128, 129, - 130, 134, 176, 185, 189, 177, 178, 179, - 186, 187, 190, 191, 255, 129, 132, 255, - 175, 190, 176, 177, 178, 181, 184, 187, - 188, 255, 129, 155, 158, 255, 189, 176, - 178, 179, 186, 187, 190, 191, 255, 129, - 255, 172, 182, 171, 173, 174, 175, 176, - 183, 166, 157, 159, 160, 161, 162, 171, - 175, 190, 176, 182, 184, 191, 169, 177, - 180, 146, 167, 170, 182, 171, 172, 189, - 190, 176, 180, 176, 182, 143, 146, 178, - 157, 158, 133, 134, 137, 168, 169, 170, - 166, 173, 165, 169, 174, 178, 187, 255, - 131, 132, 140, 169, 174, 255, 130, 132, - 128, 182, 187, 255, 173, 180, 182, 255, - 132, 155, 159, 161, 175, 128, 163, 165, - 128, 134, 136, 152, 155, 161, 163, 164, - 166, 170, 144, 150, 132, 138, 143, 187, - 191, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 139, 168, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 144, 145, 150, 155, 157, 158, 128, - 191, 160, 172, 174, 191, 128, 133, 134, - 155, 157, 191, 157, 128, 191, 143, 128, - 191, 163, 181, 128, 191, 162, 128, 191, - 142, 128, 191, 132, 133, 134, 135, 160, - 128, 191, 128, 255, 128, 129, 130, 132, - 133, 134, 141, 156, 157, 158, 159, 160, - 162, 164, 168, 169, 170, 172, 173, 174, - 175, 176, 179, 183, 160, 255, 128, 129, - 130, 133, 134, 135, 141, 156, 157, 158, - 159, 160, 162, 164, 168, 169, 170, 172, - 173, 174, 175, 176, 179, 183, 160, 255, - 168, 255, 128, 129, 130, 134, 135, 141, - 156, 157, 158, 159, 160, 162, 164, 168, - 169, 170, 172, 173, 174, 175, 176, 179, - 183, 168, 255, 192, 255, 159, 139, 187, - 158, 159, 176, 255, 135, 138, 139, 187, - 188, 255, 168, 255, 153, 154, 155, 160, - 162, 163, 164, 165, 166, 167, 168, 169, - 170, 171, 175, 177, 178, 179, 180, 181, - 182, 184, 185, 186, 187, 188, 189, 191, - 176, 190, 192, 255, 135, 147, 160, 188, - 128, 156, 184, 129, 255, 128, 129, 130, - 133, 134, 141, 156, 157, 158, 159, 160, - 162, 164, 168, 169, 170, 172, 173, 174, - 175, 176, 179, 183, 158, 159, 135, 255, - 148, 176, 140, 168, 132, 160, 188, 152, - 180, 144, 172, 136, 164, 192, 255, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 160, 161, 162, 164, 165, 166, - 167, 168, 169, 171, 172, 173, 174, 175, - 176, 178, 179, 180, 181, 182, 183, 185, - 186, 187, 188, 189, 190, 128, 191, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 160, 161, 162, 164, 165, 166, - 167, 168, 169, 171, 172, 173, 174, 175, - 176, 178, 179, 180, 181, 182, 183, 185, - 186, 187, 188, 189, 190, 128, 191, 129, - 130, 131, 132, 133, 134, 136, 137, 138, - 139, 140, 141, 143, 144, 145, 146, 147, - 148, 150, 151, 152, 153, 154, 155, 157, - 158, 159, 128, 156, 160, 255, 136, 164, - 175, 176, 255, 128, 141, 143, 191, 128, - 129, 152, 155, 156, 130, 191, 140, 141, - 128, 138, 144, 167, 175, 191, 128, 159, - 176, 191, 157, 128, 191, 185, 128, 191, - 128, 137, 138, 141, 142, 191, 128, 191, - 165, 177, 178, 179, 180, 181, 182, 184, - 185, 186, 187, 188, 189, 191, 128, 175, - 176, 190, 192, 255, 128, 159, 160, 188, - 189, 191, 128, 156, 184, 129, 255, 148, - 176, 140, 168, 132, 160, 188, 152, 180, - 144, 172, 136, 164, 192, 255, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 128, 156, 160, 255, 136, 164, 175, - 176, 255, 135, 138, 139, 187, 188, 191, - 192, 255, 187, 191, 128, 190, 128, 190, - 188, 128, 175, 190, 191, 145, 155, 157, - 159, 128, 191, 130, 135, 128, 191, 189, - 128, 191, 128, 129, 130, 131, 132, 191, - 178, 128, 191, 128, 159, 164, 191, 133, - 128, 191, 128, 178, 187, 191, 135, 142, - 143, 145, 146, 149, 150, 153, 154, 155, - 164, 128, 191, 128, 165, 166, 191, 144, - 145, 150, 155, 157, 158, 159, 135, 166, - 191, 133, 128, 191, 128, 130, 131, 132, - 133, 137, 138, 139, 140, 191, 174, 188, - 128, 129, 130, 131, 132, 133, 134, 144, - 145, 165, 166, 169, 170, 175, 176, 184, - 185, 191, 128, 132, 170, 129, 135, 136, - 191, 181, 186, 128, 191, 144, 128, 148, - 149, 150, 151, 191, 128, 132, 133, 135, - 136, 138, 139, 143, 144, 191, 163, 128, - 179, 180, 182, 183, 191, 128, 129, 191, - 166, 176, 191, 128, 151, 152, 158, 159, - 178, 179, 185, 186, 187, 188, 190, 128, - 191, 160, 128, 191, 128, 129, 135, 132, - 134, 128, 175, 157, 128, 191, 143, 128, - 191, 163, 181, 128, 191, 162, 128, 191, - 142, 128, 191, 132, 133, 134, 135, 160, - 128, 191, 0, 127, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 167, 169, 171, - 173, 174, 175, 176, 177, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 166, 170, 172, 178, 150, 153, - 155, 163, 165, 167, 169, 173, 153, 155, - 148, 161, 163, 255, 189, 132, 185, 144, - 152, 161, 164, 255, 188, 129, 131, 190, - 255, 133, 134, 137, 138, 142, 150, 152, - 161, 164, 255, 131, 134, 137, 138, 142, - 144, 146, 175, 178, 180, 182, 255, 134, - 138, 142, 161, 164, 255, 188, 129, 131, - 190, 191, 128, 132, 135, 136, 139, 141, - 150, 151, 162, 163, 130, 190, 191, 151, - 128, 130, 134, 136, 138, 141, 128, 131, - 190, 255, 133, 137, 142, 148, 151, 161, - 164, 255, 128, 132, 134, 136, 138, 141, - 149, 150, 162, 163, 129, 131, 190, 255, - 133, 137, 142, 150, 152, 161, 164, 255, - 130, 131, 138, 150, 143, 148, 152, 159, - 178, 179, 177, 179, 186, 135, 142, 177, - 179, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 177, 191, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 173, 183, 185, - 190, 150, 153, 158, 160, 177, 180, 130, - 141, 157, 132, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 180, 255, - 148, 156, 158, 255, 139, 141, 169, 133, - 134, 160, 171, 176, 187, 151, 155, 160, - 162, 191, 149, 158, 165, 188, 176, 190, - 128, 132, 180, 255, 133, 170, 180, 255, - 128, 130, 161, 173, 166, 179, 164, 183, - 173, 144, 146, 148, 168, 178, 180, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 128, 131, 157, 179, - 181, 183, 144, 176, 164, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 163, 167, 128, 129, 180, 255, - 134, 159, 178, 255, 166, 173, 135, 147, - 128, 131, 179, 255, 129, 164, 166, 255, - 169, 182, 131, 188, 140, 141, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 175, - 181, 182, 163, 170, 172, 173, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 128, 130, 184, 255, 135, 190, 131, 175, - 187, 255, 128, 130, 167, 180, 179, 128, - 130, 179, 255, 129, 137, 141, 255, 190, - 172, 183, 159, 170, 188, 128, 131, 190, - 191, 151, 128, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 191, - 128, 134, 176, 255, 132, 255, 175, 181, - 184, 255, 129, 155, 158, 255, 129, 255, - 171, 183, 157, 171, 175, 182, 184, 191, - 146, 167, 169, 182, 171, 172, 189, 190, - 176, 180, 176, 182, 145, 190, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 165, 169, 173, 178, 187, 255, 131, - 132, 140, 169, 174, 255, 130, 132, 128, - 182, 187, 255, 173, 180, 182, 255, 132, - 155, 159, 161, 175, 128, 163, 165, 128, - 134, 136, 152, 155, 161, 163, 164, 166, - 170, 144, 150, 132, 138, 145, 146, 151, - 166, 169, 128, 255, 176, 255, 131, 137, - 191, 145, 189, 135, 129, 130, 132, 133, - 144, 154, 176, 139, 159, 150, 156, 159, - 164, 167, 168, 170, 173, 145, 176, 255, - 139, 255, 166, 176, 171, 179, 160, 161, - 163, 164, 165, 166, 167, 169, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 168, 170, 150, 153, 155, - 163, 165, 167, 169, 173, 153, 155, 148, - 161, 163, 255, 131, 187, 189, 132, 185, - 190, 255, 141, 144, 129, 136, 145, 151, - 152, 161, 162, 163, 164, 255, 129, 188, - 190, 130, 131, 191, 255, 141, 151, 129, - 132, 133, 134, 137, 138, 142, 161, 162, - 163, 164, 255, 131, 188, 129, 130, 190, - 255, 145, 181, 129, 130, 131, 134, 135, - 136, 137, 138, 139, 141, 142, 175, 176, - 177, 178, 255, 134, 138, 141, 129, 136, - 142, 161, 162, 163, 164, 255, 129, 188, - 130, 131, 190, 191, 128, 141, 129, 132, - 135, 136, 139, 140, 150, 151, 162, 163, - 130, 190, 191, 128, 141, 151, 129, 130, - 134, 136, 138, 140, 128, 129, 131, 190, - 255, 133, 137, 129, 132, 142, 148, 151, - 161, 164, 255, 129, 188, 190, 191, 130, - 131, 130, 134, 128, 132, 135, 136, 138, - 139, 140, 141, 149, 150, 162, 163, 129, - 190, 130, 131, 191, 255, 133, 137, 141, - 151, 129, 132, 142, 161, 162, 163, 164, - 255, 138, 143, 150, 159, 144, 145, 146, - 148, 152, 158, 178, 179, 177, 179, 180, - 186, 135, 142, 177, 179, 180, 185, 187, - 188, 136, 141, 181, 183, 185, 152, 153, - 190, 191, 191, 177, 190, 128, 132, 134, - 135, 141, 151, 153, 188, 134, 128, 129, - 130, 141, 156, 157, 158, 159, 160, 162, - 164, 168, 169, 170, 172, 173, 174, 175, - 176, 179, 183, 177, 173, 183, 185, 186, - 187, 188, 189, 190, 150, 151, 152, 153, - 158, 160, 177, 180, 130, 132, 141, 157, - 133, 134, 157, 159, 146, 148, 178, 180, - 146, 147, 178, 179, 182, 180, 189, 190, - 255, 134, 157, 137, 147, 148, 255, 139, - 141, 169, 133, 134, 178, 160, 162, 163, - 166, 167, 168, 169, 171, 176, 184, 185, - 187, 155, 151, 152, 153, 154, 150, 160, - 162, 191, 149, 151, 152, 158, 165, 172, - 173, 178, 179, 188, 176, 190, 132, 181, - 187, 128, 131, 180, 188, 189, 255, 130, - 133, 170, 171, 179, 180, 255, 130, 161, - 170, 128, 129, 162, 165, 166, 167, 168, - 173, 167, 173, 166, 169, 170, 174, 175, - 177, 178, 179, 164, 171, 172, 179, 180, - 181, 182, 183, 161, 173, 180, 144, 146, - 148, 168, 178, 179, 184, 185, 128, 181, - 187, 191, 128, 131, 179, 181, 183, 140, - 141, 144, 176, 175, 177, 191, 160, 191, - 128, 130, 170, 175, 153, 154, 153, 154, - 155, 160, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 175, 175, 178, 180, - 189, 158, 159, 176, 177, 130, 134, 139, - 167, 163, 164, 165, 166, 132, 133, 134, - 159, 160, 177, 178, 255, 166, 173, 135, - 145, 146, 147, 131, 179, 188, 128, 130, - 180, 181, 182, 185, 186, 255, 165, 129, - 255, 169, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 131, 140, 141, 188, 176, - 178, 180, 183, 184, 190, 191, 129, 171, - 181, 182, 172, 173, 174, 175, 165, 168, - 172, 173, 163, 170, 172, 184, 190, 158, - 128, 143, 160, 175, 144, 145, 150, 155, - 157, 158, 159, 135, 139, 141, 168, 171, - 189, 160, 182, 186, 191, 129, 131, 133, - 134, 140, 143, 184, 186, 165, 166, 128, - 129, 130, 132, 133, 134, 135, 136, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 156, 176, 178, 129, 128, - 130, 184, 255, 135, 190, 130, 131, 175, - 176, 178, 183, 184, 187, 255, 172, 128, - 130, 167, 180, 179, 130, 128, 129, 179, - 181, 182, 190, 191, 255, 129, 137, 138, - 140, 141, 255, 180, 190, 172, 174, 175, - 177, 178, 181, 182, 183, 159, 160, 162, - 163, 170, 188, 190, 191, 128, 129, 130, - 131, 128, 151, 129, 132, 135, 136, 139, - 141, 162, 163, 166, 172, 176, 180, 181, - 183, 184, 191, 133, 128, 129, 130, 134, - 176, 185, 189, 177, 178, 179, 186, 187, - 190, 191, 255, 129, 132, 255, 175, 190, - 176, 177, 178, 181, 184, 187, 188, 255, - 129, 155, 158, 255, 189, 176, 178, 179, - 186, 187, 190, 191, 255, 129, 255, 172, - 182, 171, 173, 174, 175, 176, 183, 166, - 157, 159, 160, 161, 162, 171, 175, 190, - 176, 182, 184, 191, 169, 177, 180, 146, - 167, 170, 182, 171, 172, 189, 190, 176, - 180, 176, 182, 143, 146, 178, 157, 158, - 133, 134, 137, 168, 169, 170, 166, 173, - 165, 169, 174, 178, 187, 255, 131, 132, - 140, 169, 174, 255, 130, 132, 128, 182, - 187, 255, 173, 180, 182, 255, 132, 155, - 159, 161, 175, 128, 163, 165, 128, 134, - 136, 152, 155, 161, 163, 164, 166, 170, - 144, 150, 132, 138, 143, 187, 191, 160, - 128, 129, 132, 135, 133, 134, 160, 255, - 192, 255, 139, 168, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 144, - 145, 150, 155, 157, 158, 128, 129, 130, - 132, 133, 134, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 160, 255, 128, - 129, 130, 133, 134, 135, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 160, - 255, 168, 255, 128, 129, 130, 134, 135, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 168, 255, 192, 255, 159, 139, - 187, 158, 159, 176, 255, 135, 138, 139, - 187, 188, 255, 168, 255, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 177, 178, 179, 180, - 181, 182, 184, 185, 186, 187, 188, 189, - 191, 176, 190, 192, 255, 135, 147, 160, - 188, 128, 156, 184, 129, 255, 128, 129, - 130, 133, 134, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 158, 159, 135, - 255, 148, 176, 140, 168, 132, 160, 188, - 152, 180, 144, 172, 136, 164, 192, 255, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 160, 161, 162, 164, 165, - 166, 167, 168, 169, 171, 172, 173, 174, - 175, 176, 178, 179, 180, 181, 182, 183, - 185, 186, 187, 188, 189, 190, 128, 191, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 160, 161, 162, 164, 165, - 166, 167, 168, 169, 171, 172, 173, 174, - 175, 176, 178, 179, 180, 181, 182, 183, - 185, 186, 187, 188, 189, 190, 128, 191, - 129, 130, 131, 132, 133, 134, 136, 137, - 138, 139, 140, 141, 143, 144, 145, 146, - 147, 148, 150, 151, 152, 153, 154, 155, - 157, 158, 159, 128, 156, 160, 255, 136, - 164, 175, 176, 255, 142, 128, 191, 128, - 129, 152, 155, 156, 130, 191, 139, 141, - 128, 140, 142, 143, 144, 167, 168, 174, - 175, 191, 128, 255, 176, 255, 131, 137, - 191, 145, 189, 135, 129, 130, 132, 133, - 144, 154, 176, 139, 159, 150, 156, 159, - 164, 167, 168, 170, 173, 145, 176, 255, - 139, 255, 166, 176, 171, 179, 160, 161, - 163, 164, 165, 167, 169, 171, 173, 174, - 175, 176, 177, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 166, 170, 172, 178, 150, 153, 155, 163, - 165, 167, 169, 173, 153, 155, 148, 161, - 163, 255, 189, 132, 185, 144, 152, 161, - 164, 255, 188, 129, 131, 190, 255, 133, - 134, 137, 138, 142, 150, 152, 161, 164, - 255, 131, 134, 137, 138, 142, 144, 146, - 175, 178, 180, 182, 255, 134, 138, 142, - 161, 164, 255, 188, 129, 131, 190, 191, - 128, 132, 135, 136, 139, 141, 150, 151, - 162, 163, 130, 190, 191, 151, 128, 130, - 134, 136, 138, 141, 128, 131, 190, 255, - 133, 137, 142, 148, 151, 161, 164, 255, - 128, 132, 134, 136, 138, 141, 149, 150, - 162, 163, 129, 131, 190, 255, 133, 137, - 142, 150, 152, 161, 164, 255, 130, 131, - 138, 150, 143, 148, 152, 159, 178, 179, - 177, 179, 186, 135, 142, 177, 179, 185, - 187, 188, 136, 141, 181, 183, 185, 152, - 153, 190, 191, 177, 191, 128, 132, 134, - 135, 141, 151, 153, 188, 134, 128, 129, - 130, 141, 156, 157, 158, 159, 160, 162, - 164, 168, 169, 170, 172, 173, 174, 175, - 176, 179, 183, 173, 183, 185, 190, 150, - 153, 158, 160, 177, 180, 130, 141, 157, - 132, 134, 157, 159, 146, 148, 178, 180, - 146, 147, 178, 179, 180, 255, 148, 156, - 158, 255, 139, 141, 169, 133, 134, 160, - 171, 176, 187, 151, 155, 160, 162, 191, - 149, 158, 165, 188, 176, 190, 128, 132, - 180, 255, 133, 170, 180, 255, 128, 130, - 161, 173, 166, 179, 164, 183, 173, 144, - 146, 148, 168, 178, 180, 184, 185, 128, - 181, 187, 191, 128, 131, 179, 181, 183, - 140, 141, 144, 176, 175, 177, 191, 160, - 191, 128, 130, 170, 175, 153, 154, 153, - 154, 155, 160, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 175, 175, 178, - 180, 189, 158, 159, 176, 177, 130, 134, - 139, 163, 167, 128, 129, 180, 255, 134, - 159, 178, 255, 166, 173, 135, 147, 128, - 131, 179, 255, 129, 164, 166, 255, 169, - 182, 131, 188, 140, 141, 176, 178, 180, - 183, 184, 190, 191, 129, 171, 175, 181, - 182, 163, 170, 172, 173, 172, 184, 190, - 158, 128, 143, 160, 175, 144, 145, 150, - 155, 157, 158, 135, 139, 141, 168, 171, - 189, 160, 182, 186, 191, 129, 131, 133, - 134, 140, 143, 184, 186, 165, 166, 128, - 129, 130, 132, 133, 134, 135, 136, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 156, 176, 178, 128, 130, - 184, 255, 135, 190, 131, 175, 187, 255, - 128, 130, 167, 180, 179, 128, 130, 179, - 255, 129, 137, 141, 255, 190, 172, 183, - 159, 170, 188, 128, 131, 190, 191, 151, - 128, 132, 135, 136, 139, 141, 162, 163, - 166, 172, 176, 180, 181, 191, 128, 134, - 176, 255, 132, 255, 175, 181, 184, 255, - 129, 155, 158, 255, 129, 255, 171, 183, - 157, 171, 175, 182, 184, 191, 146, 167, - 169, 182, 171, 172, 189, 190, 176, 180, - 176, 182, 145, 190, 143, 146, 178, 157, - 158, 133, 134, 137, 168, 169, 170, 165, - 169, 173, 178, 187, 255, 131, 132, 140, - 169, 174, 255, 130, 132, 128, 182, 187, - 255, 173, 180, 182, 255, 132, 155, 159, - 161, 175, 128, 163, 165, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 144, - 150, 132, 138, 160, 128, 129, 132, 135, - 133, 134, 160, 255, 192, 255, 128, 131, - 157, 179, 181, 183, 164, 144, 145, 150, - 155, 157, 158, 159, 145, 146, 151, 166, - 169, 128, 255, 176, 255, 131, 137, 191, - 145, 189, 135, 129, 130, 132, 133, 144, - 154, 176, 139, 159, 150, 156, 159, 164, - 167, 168, 170, 173, 145, 176, 255, 139, - 255, 166, 176, 171, 179, 160, 161, 163, - 164, 165, 166, 167, 169, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 168, 170, 150, 153, 155, 163, - 165, 167, 169, 173, 153, 155, 148, 161, - 163, 255, 131, 187, 189, 132, 185, 190, - 255, 141, 144, 129, 136, 145, 151, 152, - 161, 162, 163, 164, 255, 129, 188, 190, - 130, 131, 191, 255, 141, 151, 129, 132, - 133, 134, 137, 138, 142, 161, 162, 163, - 164, 255, 131, 188, 129, 130, 190, 255, - 145, 181, 129, 130, 131, 134, 135, 136, - 137, 138, 139, 141, 142, 175, 176, 177, - 178, 255, 134, 138, 141, 129, 136, 142, - 161, 162, 163, 164, 255, 129, 188, 130, - 131, 190, 191, 128, 141, 129, 132, 135, - 136, 139, 140, 150, 151, 162, 163, 130, - 190, 191, 128, 141, 151, 129, 130, 134, - 136, 138, 140, 128, 129, 131, 190, 255, - 133, 137, 129, 132, 142, 148, 151, 161, - 164, 255, 129, 188, 190, 191, 130, 131, - 130, 134, 128, 132, 135, 136, 138, 139, - 140, 141, 149, 150, 162, 163, 129, 190, - 130, 131, 191, 255, 133, 137, 141, 151, - 129, 132, 142, 161, 162, 163, 164, 255, - 138, 143, 150, 159, 144, 145, 146, 148, - 152, 158, 178, 179, 177, 179, 180, 186, - 135, 142, 177, 179, 180, 185, 187, 188, - 136, 141, 181, 183, 185, 152, 153, 190, - 191, 191, 177, 190, 128, 132, 134, 135, - 141, 151, 153, 188, 134, 128, 129, 130, - 141, 156, 157, 158, 159, 160, 162, 164, - 168, 169, 170, 172, 173, 174, 175, 176, - 179, 183, 177, 173, 183, 185, 186, 187, - 188, 189, 190, 150, 151, 152, 153, 158, - 160, 177, 180, 130, 132, 141, 157, 133, - 134, 157, 159, 146, 148, 178, 180, 146, - 147, 178, 179, 182, 180, 189, 190, 255, - 134, 157, 137, 147, 148, 255, 139, 141, - 169, 133, 134, 178, 160, 162, 163, 166, - 167, 168, 169, 171, 176, 184, 185, 187, - 155, 151, 152, 153, 154, 150, 160, 162, - 191, 149, 151, 152, 158, 165, 172, 173, - 178, 179, 188, 176, 190, 132, 181, 187, - 128, 131, 180, 188, 189, 255, 130, 133, - 170, 171, 179, 180, 255, 130, 161, 170, - 128, 129, 162, 165, 166, 167, 168, 173, - 167, 173, 166, 169, 170, 174, 175, 177, - 178, 179, 164, 171, 172, 179, 180, 181, - 182, 183, 161, 173, 180, 144, 146, 148, - 168, 178, 179, 184, 185, 128, 181, 187, - 191, 128, 131, 179, 181, 183, 140, 141, - 144, 176, 175, 177, 191, 160, 191, 128, - 130, 170, 175, 153, 154, 153, 154, 155, - 160, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 175, 175, 178, 180, 189, - 158, 159, 176, 177, 130, 134, 139, 167, - 163, 164, 165, 166, 132, 133, 134, 159, - 160, 177, 178, 255, 166, 173, 135, 145, - 146, 147, 131, 179, 188, 128, 130, 180, - 181, 182, 185, 186, 255, 165, 129, 255, - 169, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 131, 140, 141, 188, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 181, - 182, 172, 173, 174, 175, 165, 168, 172, - 173, 163, 170, 172, 184, 190, 158, 128, - 143, 160, 175, 144, 145, 150, 155, 157, - 158, 159, 135, 139, 141, 168, 171, 189, - 160, 182, 186, 191, 129, 131, 133, 134, - 140, 143, 184, 186, 165, 166, 128, 129, - 130, 132, 133, 134, 135, 136, 139, 140, - 141, 144, 145, 146, 147, 150, 151, 152, - 153, 154, 156, 176, 178, 129, 128, 130, - 184, 255, 135, 190, 130, 131, 175, 176, - 178, 183, 184, 187, 255, 172, 128, 130, - 167, 180, 179, 130, 128, 129, 179, 181, - 182, 190, 191, 255, 129, 137, 138, 140, - 141, 255, 180, 190, 172, 174, 175, 177, - 178, 181, 182, 183, 159, 160, 162, 163, - 170, 188, 190, 191, 128, 129, 130, 131, - 128, 151, 129, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 183, - 184, 191, 133, 128, 129, 130, 134, 176, - 185, 189, 177, 178, 179, 186, 187, 190, - 191, 255, 129, 132, 255, 175, 190, 176, - 177, 178, 181, 184, 187, 188, 255, 129, - 155, 158, 255, 189, 176, 178, 179, 186, - 187, 190, 191, 255, 129, 255, 172, 182, - 171, 173, 174, 175, 176, 183, 166, 157, - 159, 160, 161, 162, 171, 175, 190, 176, - 182, 184, 191, 169, 177, 180, 146, 167, - 170, 182, 171, 172, 189, 190, 176, 180, - 176, 182, 143, 146, 178, 157, 158, 133, - 134, 137, 168, 169, 170, 166, 173, 165, - 169, 174, 178, 187, 255, 131, 132, 140, - 169, 174, 255, 130, 132, 128, 182, 187, - 255, 173, 180, 182, 255, 132, 155, 159, - 161, 175, 128, 163, 165, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 144, - 150, 132, 138, 143, 187, 191, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 139, 168, 128, 159, 160, 175, 176, - 191, 157, 128, 191, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 167, 169, 171, - 173, 174, 175, 176, 177, 179, 180, 181, - 182, 183, 184, 185, 186, 187, 188, 189, - 190, 191, 166, 170, 172, 178, 150, 153, - 155, 163, 165, 167, 169, 173, 153, 155, - 148, 161, 163, 255, 189, 132, 185, 144, - 152, 161, 164, 255, 188, 129, 131, 190, - 255, 133, 134, 137, 138, 142, 150, 152, - 161, 164, 255, 131, 134, 137, 138, 142, - 144, 146, 175, 178, 180, 182, 255, 134, - 138, 142, 161, 164, 255, 188, 129, 131, - 190, 191, 128, 132, 135, 136, 139, 141, - 150, 151, 162, 163, 130, 190, 191, 151, - 128, 130, 134, 136, 138, 141, 128, 131, - 190, 255, 133, 137, 142, 148, 151, 161, - 164, 255, 128, 132, 134, 136, 138, 141, - 149, 150, 162, 163, 129, 131, 190, 255, - 133, 137, 142, 150, 152, 161, 164, 255, - 130, 131, 138, 150, 143, 148, 152, 159, - 178, 179, 177, 179, 186, 135, 142, 177, - 179, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 177, 191, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 173, 183, 185, - 190, 150, 153, 158, 160, 177, 180, 130, - 141, 157, 132, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 180, 255, - 148, 156, 158, 255, 139, 141, 169, 133, - 134, 160, 171, 176, 187, 151, 155, 160, - 162, 191, 149, 158, 165, 188, 176, 190, - 128, 132, 180, 255, 133, 170, 180, 255, - 128, 130, 161, 173, 166, 179, 164, 183, - 173, 144, 146, 148, 168, 178, 180, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 128, 131, 157, 179, - 181, 183, 144, 176, 164, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 163, 167, 128, 129, 180, 255, - 134, 159, 178, 255, 166, 173, 135, 147, - 128, 131, 179, 255, 129, 164, 166, 255, - 169, 182, 131, 188, 140, 141, 176, 178, - 180, 183, 184, 190, 191, 129, 171, 175, - 181, 182, 163, 170, 172, 173, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 128, 130, 184, 255, 135, 190, 131, 175, - 187, 255, 128, 130, 167, 180, 179, 128, - 130, 179, 255, 129, 137, 141, 255, 190, - 172, 183, 159, 170, 188, 128, 131, 190, - 191, 151, 128, 132, 135, 136, 139, 141, - 162, 163, 166, 172, 176, 180, 181, 191, - 128, 134, 176, 255, 132, 255, 175, 181, - 184, 255, 129, 155, 158, 255, 129, 255, - 171, 183, 157, 171, 175, 182, 184, 191, - 146, 167, 169, 182, 171, 172, 189, 190, - 176, 180, 176, 182, 145, 190, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 165, 169, 173, 178, 187, 255, 131, - 132, 140, 169, 174, 255, 130, 132, 128, - 182, 187, 255, 173, 180, 182, 255, 132, - 155, 159, 161, 175, 128, 163, 165, 128, - 134, 136, 152, 155, 161, 163, 164, 166, - 170, 144, 150, 132, 138, 145, 146, 151, - 166, 169, 139, 168, 160, 128, 129, 132, - 135, 133, 134, 160, 255, 192, 255, 144, - 145, 150, 155, 157, 158, 141, 144, 129, - 136, 145, 151, 152, 161, 162, 163, 164, - 255, 129, 188, 190, 130, 131, 191, 255, - 141, 151, 129, 132, 133, 134, 137, 138, - 142, 161, 162, 163, 164, 255, 131, 188, - 129, 130, 190, 255, 145, 181, 129, 130, - 131, 134, 135, 136, 137, 138, 139, 141, - 142, 175, 176, 177, 178, 255, 134, 138, - 141, 129, 136, 142, 161, 162, 163, 164, - 255, 129, 188, 130, 131, 190, 191, 128, - 141, 129, 132, 135, 136, 139, 140, 150, - 151, 162, 163, 130, 190, 191, 128, 141, - 151, 129, 130, 134, 136, 138, 140, 128, - 129, 131, 190, 255, 133, 137, 129, 132, - 142, 148, 151, 161, 164, 255, 129, 188, - 190, 191, 130, 131, 130, 134, 128, 132, - 135, 136, 138, 139, 140, 141, 149, 150, - 162, 163, 129, 190, 130, 131, 191, 255, - 133, 137, 141, 151, 129, 132, 142, 161, - 162, 163, 164, 255, 138, 143, 150, 159, - 144, 145, 146, 148, 152, 158, 178, 179, - 177, 179, 180, 186, 135, 142, 177, 179, - 180, 185, 187, 188, 136, 141, 181, 183, - 185, 152, 153, 190, 191, 191, 177, 190, - 128, 132, 134, 135, 141, 151, 153, 188, - 134, 128, 129, 130, 141, 156, 157, 158, - 159, 160, 162, 164, 168, 169, 170, 172, - 173, 174, 175, 176, 179, 183, 177, 173, - 183, 185, 186, 187, 188, 189, 190, 150, - 151, 152, 153, 158, 160, 177, 180, 130, - 132, 141, 157, 133, 134, 157, 159, 146, - 148, 178, 180, 146, 147, 178, 179, 182, - 180, 189, 190, 255, 134, 157, 137, 147, - 148, 255, 139, 141, 169, 133, 134, 178, - 160, 162, 163, 166, 167, 168, 169, 171, - 176, 184, 185, 187, 155, 151, 152, 153, - 154, 150, 160, 162, 191, 149, 151, 152, - 158, 165, 172, 173, 178, 179, 188, 176, - 190, 132, 181, 187, 128, 131, 180, 188, - 189, 255, 130, 133, 170, 171, 179, 180, - 255, 130, 161, 170, 128, 129, 162, 165, - 166, 167, 168, 173, 167, 173, 166, 169, - 170, 174, 175, 177, 178, 179, 164, 171, - 172, 179, 180, 181, 182, 183, 161, 173, - 180, 144, 146, 148, 168, 178, 179, 184, - 185, 128, 181, 187, 191, 128, 131, 179, - 181, 183, 140, 141, 144, 176, 175, 177, - 191, 160, 191, 128, 130, 170, 175, 153, - 154, 153, 154, 155, 160, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 175, - 175, 178, 180, 189, 158, 159, 176, 177, - 130, 134, 139, 167, 163, 164, 165, 166, - 132, 133, 134, 159, 160, 177, 178, 255, - 166, 173, 135, 145, 146, 147, 131, 179, - 188, 128, 130, 180, 181, 182, 185, 186, - 255, 165, 129, 255, 169, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 131, 140, - 141, 188, 176, 178, 180, 183, 184, 190, - 191, 129, 171, 181, 182, 172, 173, 174, - 175, 165, 168, 172, 173, 163, 170, 172, - 184, 190, 158, 128, 143, 160, 175, 144, - 145, 150, 155, 157, 158, 159, 135, 139, - 141, 168, 171, 189, 160, 182, 186, 191, - 129, 131, 133, 134, 140, 143, 184, 186, - 165, 166, 128, 129, 130, 132, 133, 134, - 135, 136, 139, 140, 141, 144, 145, 146, - 147, 150, 151, 152, 153, 154, 156, 176, - 178, 129, 128, 130, 184, 255, 135, 190, - 130, 131, 175, 176, 178, 183, 184, 187, - 255, 172, 128, 130, 167, 180, 179, 130, - 128, 129, 179, 181, 182, 190, 191, 255, - 129, 137, 138, 140, 141, 255, 180, 190, - 172, 174, 175, 177, 178, 181, 182, 183, - 159, 160, 162, 163, 170, 188, 190, 191, - 128, 129, 130, 131, 128, 151, 129, 132, - 135, 136, 139, 141, 162, 163, 166, 172, - 176, 180, 181, 183, 184, 191, 133, 128, - 129, 130, 134, 176, 185, 189, 177, 178, - 179, 186, 187, 190, 191, 255, 129, 132, - 255, 175, 190, 176, 177, 178, 181, 184, - 187, 188, 255, 129, 155, 158, 255, 189, - 176, 178, 179, 186, 187, 190, 191, 255, - 129, 255, 172, 182, 171, 173, 174, 175, - 176, 183, 166, 157, 159, 160, 161, 162, - 171, 175, 190, 176, 182, 184, 191, 169, - 177, 180, 146, 167, 170, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 143, 146, - 178, 157, 158, 133, 134, 137, 168, 169, - 170, 166, 173, 165, 169, 174, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 143, - 187, 191, 160, 128, 129, 132, 135, 133, - 134, 160, 255, 192, 255, 185, 128, 191, - 128, 137, 138, 141, 142, 191, 128, 191, - 165, 177, 178, 179, 180, 181, 182, 184, - 185, 186, 187, 188, 189, 191, 128, 175, - 176, 190, 192, 255, 128, 159, 160, 188, - 189, 191, 128, 156, 184, 129, 255, 148, - 176, 140, 168, 132, 160, 188, 152, 180, - 144, 172, 136, 164, 192, 255, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 161, 162, 164, 165, 166, 167, - 168, 169, 171, 172, 173, 174, 175, 176, - 178, 179, 180, 181, 182, 183, 185, 186, - 187, 188, 189, 190, 128, 191, 129, 130, - 131, 132, 133, 134, 136, 137, 138, 139, - 140, 141, 143, 144, 145, 146, 147, 148, - 150, 151, 152, 153, 154, 155, 157, 158, - 159, 160, 191, 128, 156, 161, 190, 192, - 255, 136, 164, 175, 176, 255, 135, 138, - 139, 187, 188, 191, 192, 255, 0, 127, - 192, 255, 187, 191, 128, 190, 191, 128, - 190, 188, 128, 175, 176, 189, 190, 191, - 145, 155, 157, 159, 128, 191, 130, 135, - 128, 191, 189, 128, 191, 128, 129, 130, - 131, 132, 191, 178, 128, 191, 128, 159, - 160, 163, 164, 191, 133, 128, 191, 128, - 178, 179, 186, 187, 191, 135, 142, 143, - 145, 146, 149, 150, 153, 154, 155, 164, - 128, 191, 128, 165, 166, 191, 128, 255, - 176, 255, 131, 137, 191, 145, 189, 135, - 129, 130, 132, 133, 144, 154, 176, 139, - 159, 150, 156, 159, 164, 167, 168, 170, - 173, 145, 176, 255, 139, 255, 166, 176, - 171, 179, 160, 161, 163, 164, 165, 167, - 169, 171, 173, 174, 175, 176, 177, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 166, 170, 172, 178, - 150, 153, 155, 163, 165, 167, 169, 173, - 153, 155, 148, 161, 163, 255, 189, 132, - 185, 144, 152, 161, 164, 255, 188, 129, - 131, 190, 255, 133, 134, 137, 138, 142, - 150, 152, 161, 164, 255, 131, 134, 137, - 138, 142, 144, 146, 175, 178, 180, 182, - 255, 134, 138, 142, 161, 164, 255, 188, - 129, 131, 190, 191, 128, 132, 135, 136, - 139, 141, 150, 151, 162, 163, 130, 190, - 191, 151, 128, 130, 134, 136, 138, 141, - 128, 131, 190, 255, 133, 137, 142, 148, - 151, 161, 164, 255, 128, 132, 134, 136, - 138, 141, 149, 150, 162, 163, 129, 131, - 190, 255, 133, 137, 142, 150, 152, 161, - 164, 255, 130, 131, 138, 150, 143, 148, - 152, 159, 178, 179, 177, 179, 186, 135, - 142, 177, 179, 185, 187, 188, 136, 141, - 181, 183, 185, 152, 153, 190, 191, 177, - 191, 128, 132, 134, 135, 141, 151, 153, - 188, 134, 128, 129, 130, 141, 156, 157, - 158, 159, 160, 162, 164, 168, 169, 170, - 172, 173, 174, 175, 176, 179, 183, 173, - 183, 185, 190, 150, 153, 158, 160, 177, - 180, 130, 141, 157, 132, 134, 157, 159, - 146, 148, 178, 180, 146, 147, 178, 179, - 180, 255, 148, 156, 158, 255, 139, 141, - 169, 133, 134, 160, 171, 176, 187, 151, - 155, 160, 162, 191, 149, 158, 165, 188, - 176, 190, 128, 132, 180, 255, 133, 170, - 180, 255, 128, 130, 161, 173, 166, 179, - 164, 183, 173, 144, 146, 148, 168, 178, - 180, 184, 185, 128, 181, 187, 191, 128, - 131, 179, 181, 183, 140, 141, 128, 131, - 157, 179, 181, 183, 144, 176, 164, 175, - 177, 191, 160, 191, 128, 130, 170, 175, - 153, 154, 153, 154, 155, 160, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 175, 175, 178, 180, 189, 158, 159, 176, - 177, 130, 134, 139, 163, 167, 128, 129, - 180, 255, 134, 159, 178, 255, 166, 173, - 135, 147, 128, 131, 179, 255, 129, 164, - 166, 255, 169, 182, 131, 188, 140, 141, - 176, 178, 180, 183, 184, 190, 191, 129, - 171, 175, 181, 182, 163, 170, 172, 173, - 172, 184, 190, 158, 128, 143, 160, 175, - 144, 145, 150, 155, 157, 158, 159, 135, - 139, 141, 168, 171, 189, 160, 182, 186, - 191, 129, 131, 133, 134, 140, 143, 184, - 186, 165, 166, 128, 129, 130, 132, 133, - 134, 135, 136, 139, 140, 141, 144, 145, - 146, 147, 150, 151, 152, 153, 154, 156, - 176, 178, 128, 130, 184, 255, 135, 190, - 131, 175, 187, 255, 128, 130, 167, 180, - 179, 128, 130, 179, 255, 129, 137, 141, - 255, 190, 172, 183, 159, 170, 188, 128, - 131, 190, 191, 151, 128, 132, 135, 136, - 139, 141, 162, 163, 166, 172, 176, 180, - 181, 191, 128, 134, 176, 255, 132, 255, - 175, 181, 184, 255, 129, 155, 158, 255, - 129, 255, 171, 183, 157, 171, 175, 182, - 184, 191, 146, 167, 169, 182, 171, 172, - 189, 190, 176, 180, 176, 182, 145, 190, - 143, 146, 178, 157, 158, 133, 134, 137, - 168, 169, 170, 165, 169, 173, 178, 187, - 255, 131, 132, 140, 169, 174, 255, 130, - 132, 128, 182, 187, 255, 173, 180, 182, - 255, 132, 155, 159, 161, 175, 128, 163, - 165, 128, 134, 136, 152, 155, 161, 163, - 164, 166, 170, 144, 150, 132, 138, 145, - 146, 151, 166, 169, 128, 255, 176, 255, - 131, 137, 191, 145, 189, 135, 129, 130, - 132, 133, 144, 154, 176, 139, 159, 150, - 156, 159, 164, 167, 168, 170, 173, 145, - 176, 255, 139, 255, 166, 176, 171, 179, - 160, 161, 163, 164, 165, 166, 167, 169, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 187, 188, 189, 190, 191, 168, 170, 150, - 153, 155, 163, 165, 167, 169, 173, 153, - 155, 148, 161, 163, 255, 131, 187, 189, - 132, 185, 190, 255, 141, 144, 129, 136, - 145, 151, 152, 161, 162, 163, 164, 255, - 129, 188, 190, 130, 131, 191, 255, 141, - 151, 129, 132, 133, 134, 137, 138, 142, - 161, 162, 163, 164, 255, 131, 188, 129, - 130, 190, 255, 145, 181, 129, 130, 131, - 134, 135, 136, 137, 138, 139, 141, 142, - 175, 176, 177, 178, 255, 134, 138, 141, - 129, 136, 142, 161, 162, 163, 164, 255, - 129, 188, 130, 131, 190, 191, 128, 141, - 129, 132, 135, 136, 139, 140, 150, 151, - 162, 163, 130, 190, 191, 128, 141, 151, - 129, 130, 134, 136, 138, 140, 128, 129, - 131, 190, 255, 133, 137, 129, 132, 142, - 148, 151, 161, 164, 255, 129, 188, 190, - 191, 130, 131, 130, 134, 128, 132, 135, - 136, 138, 139, 140, 141, 149, 150, 162, - 163, 129, 190, 130, 131, 191, 255, 133, - 137, 141, 151, 129, 132, 142, 161, 162, - 163, 164, 255, 138, 143, 150, 159, 144, - 145, 146, 148, 152, 158, 178, 179, 177, - 179, 180, 186, 135, 142, 177, 179, 180, - 185, 187, 188, 136, 141, 181, 183, 185, - 152, 153, 190, 191, 191, 177, 190, 128, - 132, 134, 135, 141, 151, 153, 188, 134, - 128, 129, 130, 141, 156, 157, 158, 159, - 160, 162, 164, 168, 169, 170, 172, 173, - 174, 175, 176, 179, 183, 177, 173, 183, - 185, 186, 187, 188, 189, 190, 150, 151, - 152, 153, 158, 160, 177, 180, 130, 132, - 141, 157, 133, 134, 157, 159, 146, 148, - 178, 180, 146, 147, 178, 179, 182, 180, - 189, 190, 255, 134, 157, 137, 147, 148, - 255, 139, 141, 169, 133, 134, 178, 160, - 162, 163, 166, 167, 168, 169, 171, 176, - 184, 185, 187, 155, 151, 152, 153, 154, - 150, 160, 162, 191, 149, 151, 152, 158, - 165, 172, 173, 178, 179, 188, 176, 190, - 132, 181, 187, 128, 131, 180, 188, 189, - 255, 130, 133, 170, 171, 179, 180, 255, - 130, 161, 170, 128, 129, 162, 165, 166, - 167, 168, 173, 167, 173, 166, 169, 170, - 174, 175, 177, 178, 179, 164, 171, 172, - 179, 180, 181, 182, 183, 161, 173, 180, - 144, 146, 148, 168, 178, 179, 184, 185, - 128, 181, 187, 191, 128, 131, 179, 181, - 183, 140, 141, 144, 176, 175, 177, 191, - 160, 191, 128, 130, 170, 175, 153, 154, - 153, 154, 155, 160, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 175, 175, - 178, 180, 189, 158, 159, 176, 177, 130, - 134, 139, 167, 163, 164, 165, 166, 132, - 133, 134, 159, 160, 177, 178, 255, 166, - 173, 135, 145, 146, 147, 131, 179, 188, - 128, 130, 180, 181, 182, 185, 186, 255, - 165, 129, 255, 169, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 131, 140, 141, - 188, 176, 178, 180, 183, 184, 190, 191, - 129, 171, 181, 182, 172, 173, 174, 175, - 165, 168, 172, 173, 163, 170, 172, 184, - 190, 158, 128, 143, 160, 175, 144, 145, - 150, 155, 157, 158, 159, 135, 139, 141, - 168, 171, 189, 160, 182, 186, 191, 129, - 131, 133, 134, 140, 143, 184, 186, 165, - 166, 128, 129, 130, 132, 133, 134, 135, - 136, 139, 140, 141, 144, 145, 146, 147, - 150, 151, 152, 153, 154, 156, 176, 178, - 129, 128, 130, 184, 255, 135, 190, 130, - 131, 175, 176, 178, 183, 184, 187, 255, - 172, 128, 130, 167, 180, 179, 130, 128, - 129, 179, 181, 182, 190, 191, 255, 129, - 137, 138, 140, 141, 255, 180, 190, 172, - 174, 175, 177, 178, 181, 182, 183, 159, - 160, 162, 163, 170, 188, 190, 191, 128, - 129, 130, 131, 128, 151, 129, 132, 135, - 136, 139, 141, 162, 163, 166, 172, 176, - 180, 181, 183, 184, 191, 133, 128, 129, - 130, 134, 176, 185, 189, 177, 178, 179, - 186, 187, 190, 191, 255, 129, 132, 255, - 175, 190, 176, 177, 178, 181, 184, 187, - 188, 255, 129, 155, 158, 255, 189, 176, - 178, 179, 186, 187, 190, 191, 255, 129, - 255, 172, 182, 171, 173, 174, 175, 176, - 183, 166, 157, 159, 160, 161, 162, 171, - 175, 190, 176, 182, 184, 191, 169, 177, - 180, 146, 167, 170, 182, 171, 172, 189, - 190, 176, 180, 176, 182, 143, 146, 178, - 157, 158, 133, 134, 137, 168, 169, 170, - 166, 173, 165, 169, 174, 178, 187, 255, - 131, 132, 140, 169, 174, 255, 130, 132, - 128, 182, 187, 255, 173, 180, 182, 255, - 132, 155, 159, 161, 175, 128, 163, 165, - 128, 134, 136, 152, 155, 161, 163, 164, - 166, 170, 144, 150, 132, 138, 143, 187, - 191, 160, 128, 129, 132, 135, 133, 134, - 160, 255, 192, 255, 139, 168, 160, 128, - 129, 132, 135, 133, 134, 160, 255, 192, - 255, 144, 145, 150, 155, 157, 158, 144, - 145, 150, 155, 157, 158, 159, 135, 166, - 191, 133, 128, 191, 128, 130, 131, 132, - 133, 137, 138, 139, 140, 191, 174, 188, - 128, 129, 130, 131, 132, 133, 134, 144, - 145, 165, 166, 169, 170, 175, 176, 184, - 185, 191, 128, 132, 170, 129, 135, 136, - 191, 181, 186, 128, 191, 144, 128, 148, - 149, 150, 151, 191, 128, 132, 133, 135, - 136, 138, 139, 143, 144, 191, 163, 128, - 179, 180, 182, 183, 191, 128, 129, 191, - 166, 176, 191, 128, 151, 152, 158, 159, - 178, 179, 185, 186, 187, 188, 190, 128, - 191, 160, 128, 191, 128, 130, 131, 135, - 191, 129, 134, 136, 190, 128, 159, 160, - 191, 128, 175, 176, 255, 10, 13, 127, - 194, 216, 219, 220, 224, 225, 226, 234, - 235, 236, 237, 239, 240, 243, 0, 31, - 128, 191, 192, 223, 227, 238, 241, 247, - 248, 255, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 239, 240, 243, 204, 205, - 210, 214, 215, 216, 217, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 234, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 239, 240, 243, 194, 216, - 219, 220, 224, 225, 226, 234, 235, 236, - 237, 239, 240, 243, 32, 126, 192, 223, - 227, 238, 241, 247, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 235, 236, 237, 239, 240, 243, 204, - 205, 210, 214, 215, 216, 217, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 234, - 237, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 237, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 237, 239, 240, 243, 204, 205, - 210, 214, 215, 216, 217, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 234, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 235, 236, 237, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 239, 240, 243, 204, 205, 210, - 214, 215, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 234, 239, 240, - 243, 204, 205, 210, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 234, 239, 240, 243, 204, 205, 210, - 214, 215, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 234, 237, 239, - 240, 243, 204, 205, 210, 214, 215, 216, - 217, 219, 220, 221, 222, 223, 224, 225, - 226, 227, 234, 237, 239, 240, 243, 204, - 205, 210, 214, 215, 216, 217, 219, 220, - 221, 222, 223, 224, 225, 226, 227, 234, - 237, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, 204, 205, 210, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 234, 239, 240, 243, - 204, 205, 210, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 234, 239, 240, 243, -} - -var _graphclust_single_lengths []byte = []byte{ - 0, 1, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 26, 0, - 0, 0, 1, 1, 1, 0, 0, 2, - 1, 0, 1, 1, 0, 2, 0, 0, - 2, 0, 2, 1, 0, 1, 0, 3, - 0, 0, 1, 21, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 1, - 0, 5, 2, 6, 0, 1, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 2, 1, 1, 0, 3, 1, 0, 7, - 5, 1, 1, 0, 1, 0, 23, 0, - 0, 0, 0, 1, 0, 0, 1, 0, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 0, 1, 0, 6, 0, 0, 0, - 0, 0, 1, 3, 0, 0, 0, 3, - 0, 0, 0, 0, 1, 1, 0, 1, - 0, 1, 0, 0, 0, 29, 0, 0, - 0, 3, 2, 3, 2, 2, 2, 3, - 2, 2, 3, 3, 1, 2, 4, 2, - 2, 4, 4, 2, 0, 2, 0, 3, - 1, 0, 1, 21, 1, 0, 4, 0, - 0, 0, 1, 2, 0, 1, 1, 1, - 4, 0, 3, 1, 3, 2, 0, 3, - 0, 5, 2, 0, 0, 1, 0, 2, - 0, 0, 15, 0, 0, 0, 4, 0, - 0, 0, 3, 1, 0, 4, 1, 4, - 4, 3, 1, 0, 7, 5, 1, 1, - 0, 1, 0, 23, 1, 0, 1, 1, - 1, 1, 0, 2, 1, 3, 2, 0, - 1, 3, 1, 2, 0, 1, 0, 2, - 1, 2, 3, 4, 0, 0, 0, 1, - 0, 6, 2, 0, 0, 0, 0, 1, - 3, 0, 0, 0, 1, 0, 1, 4, - 0, 0, 0, 1, 1, 1, 4, 0, - 0, 0, 6, 0, 1, 1, 0, 0, - 0, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 26, 0, 0, 0, 1, 1, - 1, 0, 0, 2, 1, 0, 1, 1, - 0, 2, 0, 0, 2, 0, 2, 1, - 0, 1, 0, 3, 0, 0, 1, 21, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 1, 0, 5, 2, 6, - 0, 1, 0, 1, 0, 2, 0, 0, - 15, 0, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 0, 2, 1, 1, 0, - 3, 1, 0, 7, 5, 1, 1, 0, - 1, 0, 23, 0, 0, 0, 0, 1, - 0, 0, 1, 0, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 4, 0, 0, 0, 0, 1, 0, - 6, 0, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 3, 0, 0, 0, 0, - 1, 1, 0, 1, 0, 1, 0, 0, - 0, 29, 0, 0, 0, 3, 2, 3, - 2, 2, 2, 3, 2, 2, 3, 3, - 1, 2, 4, 2, 2, 4, 4, 2, - 0, 2, 0, 3, 1, 0, 1, 21, - 1, 0, 4, 0, 0, 0, 1, 2, - 0, 1, 1, 1, 4, 0, 3, 1, - 3, 2, 0, 3, 0, 5, 2, 0, - 0, 1, 0, 2, 0, 0, 15, 0, - 0, 0, 4, 0, 0, 0, 3, 1, - 0, 4, 1, 4, 4, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 1, 0, 1, 1, 1, 1, 0, 2, - 1, 3, 2, 0, 1, 3, 1, 2, - 0, 1, 0, 2, 1, 2, 3, 4, - 0, 0, 0, 1, 0, 6, 2, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 1, 0, 1, 4, 0, 0, 0, 1, - 1, 1, 4, 0, 0, 0, 6, 0, - 0, 0, 1, 1, 2, 1, 1, 5, - 0, 24, 0, 24, 0, 0, 23, 0, - 0, 1, 0, 2, 0, 0, 0, 28, - 0, 3, 23, 2, 0, 2, 2, 3, - 2, 2, 2, 0, 54, 54, 27, 1, - 0, 5, 2, 0, 1, 1, 0, 0, - 14, 0, 3, 2, 2, 3, 2, 2, - 2, 54, 54, 27, 1, 0, 2, 0, - 1, 4, 2, 1, 0, 1, 0, 1, - 0, 11, 0, 7, 1, 0, 1, 0, - 2, 3, 2, 1, 0, 1, 1, 3, - 0, 1, 3, 0, 1, 1, 2, 1, - 1, 5, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 26, - 0, 0, 0, 1, 1, 1, 0, 0, - 2, 1, 0, 1, 1, 0, 2, 0, - 0, 2, 0, 2, 1, 0, 1, 0, - 3, 0, 0, 1, 21, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 1, 0, 5, 2, 6, 0, 1, 0, - 1, 0, 2, 0, 0, 15, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 2, 1, 1, 0, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 0, 0, 0, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 1, 0, 6, 0, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 3, 0, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 29, 0, - 0, 0, 3, 2, 3, 2, 2, 2, - 3, 2, 2, 3, 3, 1, 2, 4, - 2, 2, 4, 4, 2, 0, 2, 0, - 3, 1, 0, 1, 21, 1, 0, 4, - 0, 0, 0, 1, 2, 0, 1, 1, - 1, 4, 0, 3, 1, 3, 2, 0, - 3, 0, 5, 2, 0, 0, 1, 0, - 2, 0, 0, 15, 0, 0, 0, 4, - 0, 0, 0, 3, 1, 0, 4, 1, - 4, 4, 3, 1, 0, 7, 5, 1, - 1, 0, 1, 0, 23, 1, 0, 1, - 1, 1, 1, 0, 2, 1, 3, 2, - 0, 1, 3, 1, 2, 0, 1, 0, - 2, 1, 2, 3, 4, 0, 0, 0, - 1, 0, 6, 2, 0, 0, 0, 0, - 1, 3, 0, 0, 0, 1, 0, 1, - 4, 0, 0, 0, 1, 1, 1, 4, - 0, 0, 0, 6, 24, 0, 24, 0, - 0, 23, 0, 0, 1, 0, 2, 0, - 0, 0, 28, 0, 3, 23, 2, 0, - 2, 2, 3, 2, 2, 2, 0, 54, - 54, 27, 1, 1, 5, 2, 0, 0, - 0, 1, 1, 0, 1, 0, 1, 0, - 0, 0, 26, 0, 0, 0, 1, 1, - 1, 0, 0, 2, 1, 0, 1, 1, - 0, 2, 0, 0, 2, 0, 2, 1, - 0, 1, 0, 3, 0, 0, 1, 21, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 3, 0, 0, 0, - 0, 0, 0, 1, 0, 5, 2, 0, - 0, 1, 0, 2, 0, 0, 15, 0, - 0, 0, 3, 0, 0, 0, 0, 0, - 0, 0, 2, 1, 1, 0, 3, 1, - 0, 6, 5, 1, 1, 0, 1, 0, - 23, 0, 0, 0, 0, 1, 0, 0, - 1, 0, 1, 1, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 0, 0, 0, 0, 1, 0, 6, 0, - 0, 0, 0, 0, 1, 3, 0, 0, - 0, 1, 4, 0, 0, 0, 6, 1, - 7, 3, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 29, - 0, 0, 0, 3, 2, 3, 2, 2, - 2, 3, 2, 2, 3, 3, 1, 2, - 4, 2, 2, 4, 4, 2, 0, 2, - 0, 3, 1, 0, 1, 21, 1, 0, - 4, 0, 0, 0, 1, 2, 0, 1, - 1, 1, 4, 0, 3, 1, 3, 2, - 0, 3, 0, 5, 2, 0, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 4, 0, 0, 0, 3, 1, 0, 4, - 1, 4, 4, 3, 1, 0, 7, 5, - 1, 1, 0, 1, 0, 23, 1, 0, - 1, 1, 1, 1, 0, 2, 1, 3, - 2, 0, 1, 3, 1, 2, 0, 1, - 0, 2, 1, 2, 3, 4, 0, 0, - 0, 1, 0, 6, 2, 0, 0, 0, - 0, 1, 3, 0, 0, 0, 1, 0, - 1, 4, 0, 0, 0, 1, 1, 0, - 1, 0, 0, 0, 1, 1, 0, 1, - 0, 1, 0, 0, 0, 29, 0, 0, - 0, 3, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 26, 0, - 0, 0, 1, 1, 1, 0, 0, 2, - 1, 0, 1, 1, 0, 2, 0, 0, - 2, 0, 2, 1, 0, 1, 0, 3, - 0, 0, 1, 21, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 1, - 0, 5, 2, 6, 0, 1, 0, 1, - 0, 2, 0, 0, 15, 0, 0, 0, - 3, 0, 0, 0, 0, 0, 0, 0, - 2, 1, 1, 0, 3, 1, 0, 7, - 5, 1, 1, 0, 1, 0, 23, 0, - 0, 0, 0, 1, 0, 0, 1, 0, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 4, 0, 0, - 0, 0, 1, 0, 6, 0, 0, 0, - 0, 0, 1, 3, 0, 0, 0, 3, - 0, 1, 1, 1, 4, 0, 0, 0, - 6, 2, 3, 2, 2, 2, 3, 2, - 2, 3, 3, 1, 2, 4, 2, 2, - 4, 4, 2, 0, 2, 0, 3, 1, - 0, 1, 21, 1, 0, 4, 0, 0, - 0, 1, 2, 0, 1, 1, 1, 4, - 0, 3, 1, 3, 2, 0, 3, 0, - 5, 2, 0, 0, 1, 0, 2, 0, - 0, 15, 0, 0, 0, 4, 0, 0, - 0, 3, 1, 0, 4, 1, 4, 4, - 3, 1, 0, 7, 5, 1, 1, 0, - 1, 0, 23, 1, 0, 1, 1, 1, - 1, 0, 2, 1, 3, 2, 0, 1, - 3, 1, 2, 0, 1, 0, 2, 1, - 2, 3, 4, 0, 0, 0, 1, 0, - 6, 2, 0, 0, 0, 0, 1, 3, - 0, 0, 0, 1, 0, 1, 4, 0, - 0, 0, 1, 0, 0, 14, 0, 3, - 2, 2, 3, 2, 2, 2, 54, 54, - 29, 1, 0, 0, 0, 0, 2, 1, - 1, 4, 2, 1, 0, 1, 0, 1, - 0, 11, 0, 0, 0, 0, 1, 1, - 0, 1, 0, 1, 0, 0, 0, 26, - 0, 0, 0, 1, 1, 1, 0, 0, - 2, 1, 0, 1, 1, 0, 2, 0, - 0, 2, 0, 2, 1, 0, 1, 0, - 3, 0, 0, 1, 21, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 1, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 1, 0, 5, 2, 6, 0, 1, 0, - 1, 0, 2, 0, 0, 15, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 2, 1, 1, 0, 3, 1, 0, - 7, 5, 1, 1, 0, 1, 0, 23, - 0, 0, 0, 0, 1, 0, 0, 1, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 4, 0, - 0, 0, 0, 1, 0, 6, 0, 0, - 0, 0, 0, 1, 3, 0, 0, 0, - 3, 0, 0, 0, 0, 1, 1, 0, - 1, 0, 1, 0, 0, 0, 29, 0, - 0, 0, 3, 2, 3, 2, 2, 2, - 3, 2, 2, 3, 3, 1, 2, 4, - 2, 2, 4, 4, 2, 0, 2, 0, - 3, 1, 0, 1, 21, 1, 0, 4, - 0, 0, 0, 1, 2, 0, 1, 1, - 1, 4, 0, 3, 1, 3, 2, 0, - 3, 0, 5, 2, 0, 0, 1, 0, - 2, 0, 0, 15, 0, 0, 0, 4, - 0, 0, 0, 3, 1, 0, 4, 1, - 4, 4, 3, 1, 0, 7, 5, 1, - 1, 0, 1, 0, 23, 1, 0, 1, - 1, 1, 1, 0, 2, 1, 3, 2, - 0, 1, 3, 1, 2, 0, 1, 0, - 2, 1, 2, 3, 4, 0, 0, 0, - 1, 0, 6, 2, 0, 0, 0, 0, - 1, 3, 0, 0, 0, 1, 0, 1, - 4, 0, 0, 0, 1, 1, 1, 4, - 0, 0, 0, 6, 7, 1, 0, 1, - 0, 2, 3, 2, 1, 0, 1, 1, - 3, 0, 1, 5, 0, 0, 17, 20, - 20, 20, 14, 20, 20, 20, 23, 21, - 21, 21, 20, 23, 20, 20, 20, 21, - 21, 21, 20, 20, 20, 20, 20, 20, - 20, 20, 20, 20, -} - -var _graphclust_range_lengths []byte = []byte{ - 0, 0, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 2, 4, - 1, 2, 1, 2, 2, 5, 6, 2, - 2, 5, 1, 3, 2, 3, 5, 2, - 3, 1, 3, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 2, 3, 1, 1, - 2, 2, 1, 2, 1, 1, 2, 1, - 2, 1, 2, 2, 2, 1, 1, 4, - 2, 0, 0, 0, 1, 0, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 1, 2, 2, 1, 1, 2, 2, 1, - 1, 3, 2, 2, 0, 0, 2, 0, - 0, 0, 0, 1, 4, 1, 0, 2, - 1, 2, 2, 0, 2, 2, 1, 1, - 2, 6, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 2, 2, 0, 1, 1, - 1, 1, 0, 1, 0, 3, 3, 1, - 2, 2, 2, 0, 5, 1, 1, 0, - 1, 1, 1, 1, 1, 2, 1, 1, - 4, 1, 1, 1, 1, 1, 4, 1, - 2, 2, 5, 2, 6, 2, 8, 4, - 2, 5, 0, 3, 2, 4, 1, 6, - 2, 4, 4, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 4, 4, 1, 1, - 2, 2, 2, 2, 1, 1, 6, 2, - 5, 1, 3, 3, 4, 4, 4, 4, - 2, 0, 0, 1, 1, 0, 1, 0, - 1, 1, 0, 2, 1, 1, 2, 4, - 1, 2, 4, 1, 5, 0, 3, 2, - 1, 0, 0, 2, 0, 0, 0, 0, - 1, 4, 1, 0, 2, 1, 4, 2, - 0, 4, 3, 4, 2, 2, 6, 2, - 2, 4, 1, 4, 2, 4, 1, 3, - 3, 2, 2, 0, 1, 1, 1, 0, - 1, 0, 3, 3, 1, 2, 2, 2, - 0, 5, 1, 1, 0, 1, 0, 1, - 1, 1, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 1, 2, 2, 1, 1, - 1, 1, 2, 1, 1, 4, 1, 1, - 1, 1, 2, 4, 1, 2, 1, 2, - 2, 5, 6, 2, 2, 5, 1, 3, - 2, 3, 5, 2, 3, 1, 3, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 2, 3, 1, 1, 2, 2, 1, 2, - 1, 1, 2, 1, 2, 1, 2, 2, - 2, 1, 1, 4, 2, 0, 0, 0, - 1, 0, 1, 0, 1, 0, 1, 1, - 0, 2, 1, 1, 1, 2, 2, 1, - 1, 2, 2, 1, 1, 3, 2, 2, - 0, 0, 2, 0, 0, 0, 0, 1, - 4, 1, 0, 2, 1, 2, 2, 0, - 2, 2, 1, 1, 2, 6, 1, 1, - 1, 1, 2, 2, 1, 1, 1, 2, - 2, 0, 1, 1, 1, 1, 0, 1, - 0, 3, 3, 1, 2, 2, 2, 0, - 5, 1, 1, 0, 1, 1, 1, 1, - 1, 2, 1, 1, 4, 1, 1, 1, - 1, 1, 4, 1, 2, 2, 5, 2, - 6, 2, 8, 4, 2, 5, 0, 3, - 2, 4, 1, 6, 2, 4, 4, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 4, 4, 1, 1, 2, 2, 2, 2, - 1, 1, 6, 2, 5, 1, 3, 3, - 4, 4, 4, 4, 2, 0, 0, 1, - 1, 0, 1, 0, 1, 1, 0, 2, - 1, 1, 2, 4, 1, 2, 4, 1, - 5, 0, 3, 2, 1, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 4, 2, 0, 4, 3, 4, - 2, 2, 6, 2, 2, 4, 1, 4, - 2, 4, 1, 3, 3, 2, 2, 0, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 0, 1, 1, 1, 0, 0, - 0, 0, 1, 1, 1, 0, 0, 1, - 2, 3, 1, 1, 1, 1, 1, 1, - 1, 0, 1, 0, 1, 1, 0, 1, - 1, 0, 1, 0, 1, 3, 1, 2, - 2, 1, 0, 0, 1, 0, 0, 0, - 0, 0, 1, 0, 1, 1, 2, 2, - 2, 1, 3, 2, 1, 1, 3, 1, - 3, 3, 1, 0, 0, 0, 0, 0, - 1, 1, 1, 2, 2, 4, 1, 1, - 2, 1, 1, 1, 3, 1, 2, 1, - 2, 1, 2, 0, 0, 1, 1, 5, - 9, 2, 1, 3, 5, 3, 1, 6, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 2, - 4, 1, 2, 1, 2, 2, 5, 6, - 2, 2, 5, 1, 3, 2, 3, 5, - 2, 3, 1, 3, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 2, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 2, - 1, 2, 1, 2, 2, 2, 1, 1, - 4, 2, 0, 0, 0, 1, 0, 1, - 0, 1, 0, 1, 1, 0, 2, 1, - 1, 1, 2, 2, 1, 1, 2, 2, - 1, 1, 3, 2, 2, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 2, 2, 0, 2, 2, 1, - 1, 2, 6, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 2, 2, 0, 1, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 1, 4, - 1, 2, 2, 5, 2, 6, 2, 8, - 4, 2, 5, 0, 3, 2, 4, 1, - 6, 2, 4, 4, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 4, 4, 1, - 1, 2, 2, 2, 2, 1, 1, 6, - 2, 5, 1, 3, 3, 4, 4, 4, - 4, 2, 0, 0, 1, 1, 0, 1, - 0, 1, 1, 0, 2, 1, 1, 2, - 4, 1, 2, 4, 1, 5, 0, 3, - 2, 1, 0, 0, 2, 0, 0, 0, - 0, 1, 4, 1, 0, 2, 1, 4, - 2, 0, 4, 3, 4, 2, 2, 6, - 2, 2, 4, 1, 4, 2, 4, 1, - 3, 3, 2, 2, 0, 1, 1, 1, - 0, 1, 0, 3, 3, 1, 2, 2, - 2, 0, 5, 1, 1, 0, 1, 0, - 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 1, 0, 1, - 1, 0, 1, 1, 0, 1, 0, 1, - 3, 1, 2, 2, 1, 0, 0, 1, - 0, 0, 0, 0, 0, 1, 0, 1, - 1, 2, 2, 1, 1, 5, 1, 1, - 1, 1, 2, 1, 1, 4, 1, 1, - 1, 1, 2, 4, 1, 2, 1, 2, - 2, 5, 6, 2, 2, 5, 1, 3, - 2, 3, 5, 2, 3, 1, 3, 1, - 1, 2, 1, 2, 1, 4, 0, 0, - 2, 3, 1, 1, 2, 2, 1, 2, - 1, 1, 2, 1, 2, 1, 2, 2, - 2, 1, 1, 4, 2, 0, 0, 1, - 1, 0, 1, 0, 1, 1, 0, 2, - 1, 1, 1, 2, 2, 1, 1, 2, - 2, 1, 1, 3, 2, 2, 0, 0, - 2, 0, 0, 0, 0, 1, 4, 1, - 0, 2, 1, 2, 2, 0, 2, 2, - 1, 1, 2, 6, 1, 1, 1, 1, - 2, 2, 1, 1, 1, 2, 2, 0, - 1, 1, 1, 1, 0, 1, 0, 3, - 3, 1, 2, 2, 2, 0, 5, 1, - 1, 0, 1, 1, 1, 0, 0, 0, - 0, 0, 1, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 1, - 4, 1, 2, 2, 5, 2, 6, 2, - 8, 4, 2, 5, 0, 3, 2, 4, - 1, 6, 2, 4, 4, 1, 1, 2, - 1, 2, 1, 4, 0, 0, 4, 4, - 1, 1, 2, 2, 2, 2, 1, 1, - 6, 2, 5, 1, 3, 3, 4, 4, - 4, 4, 2, 0, 0, 1, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 2, 4, 1, 2, 4, 1, 5, 0, - 3, 2, 1, 0, 0, 2, 0, 0, - 0, 0, 1, 4, 1, 0, 2, 1, - 4, 2, 0, 4, 3, 4, 2, 2, - 6, 2, 2, 4, 1, 4, 2, 4, - 1, 3, 3, 2, 2, 0, 1, 1, - 1, 0, 1, 0, 3, 3, 1, 2, - 2, 2, 0, 5, 1, 1, 0, 1, - 0, 1, 1, 1, 0, 0, 0, 3, - 1, 1, 1, 1, 1, 2, 1, 1, - 4, 1, 1, 1, 1, 1, 4, 1, - 2, 2, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 2, 4, - 1, 2, 1, 2, 2, 5, 6, 2, - 2, 5, 1, 3, 2, 3, 5, 2, - 3, 1, 3, 1, 1, 2, 1, 2, - 1, 4, 0, 0, 2, 3, 1, 1, - 2, 2, 1, 2, 1, 1, 2, 1, - 2, 1, 2, 2, 2, 1, 1, 4, - 2, 0, 0, 0, 1, 0, 1, 0, - 1, 0, 1, 1, 0, 2, 1, 1, - 1, 2, 2, 1, 1, 2, 2, 1, - 1, 3, 2, 2, 0, 0, 2, 0, - 0, 0, 0, 1, 4, 1, 0, 2, - 1, 2, 2, 0, 2, 2, 1, 1, - 2, 6, 1, 1, 1, 1, 2, 2, - 1, 1, 1, 2, 2, 0, 1, 1, - 1, 1, 0, 1, 0, 3, 3, 1, - 2, 2, 2, 0, 5, 1, 1, 0, - 1, 0, 0, 0, 1, 1, 1, 0, - 0, 5, 2, 6, 2, 8, 4, 2, - 5, 0, 3, 2, 4, 1, 6, 2, - 4, 4, 1, 1, 2, 1, 2, 1, - 4, 0, 0, 4, 4, 1, 1, 2, - 2, 2, 2, 1, 1, 6, 2, 5, - 1, 3, 3, 4, 4, 4, 4, 2, - 0, 0, 1, 1, 0, 1, 0, 1, - 1, 0, 2, 1, 1, 2, 4, 1, - 2, 4, 1, 5, 0, 3, 2, 1, - 0, 0, 2, 0, 0, 0, 0, 1, - 4, 1, 0, 2, 1, 4, 2, 0, - 4, 3, 4, 2, 2, 6, 2, 2, - 4, 1, 4, 2, 4, 1, 3, 3, - 2, 2, 0, 1, 1, 1, 0, 1, - 0, 3, 3, 1, 2, 2, 2, 0, - 5, 1, 1, 0, 1, 0, 1, 1, - 1, 0, 1, 3, 1, 3, 3, 1, - 0, 0, 0, 0, 0, 1, 1, 1, - 3, 2, 4, 1, 0, 1, 1, 1, - 3, 1, 1, 1, 3, 1, 3, 1, - 3, 1, 2, 1, 1, 1, 1, 2, - 1, 1, 4, 1, 1, 1, 1, 2, - 4, 1, 2, 1, 2, 2, 5, 6, - 2, 2, 5, 1, 3, 2, 3, 5, - 2, 3, 1, 3, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 2, 3, 1, - 1, 2, 2, 1, 2, 1, 1, 2, - 1, 2, 1, 2, 2, 2, 1, 1, - 4, 2, 0, 0, 0, 1, 0, 1, - 0, 1, 0, 1, 1, 0, 2, 1, - 1, 1, 2, 2, 1, 1, 2, 2, - 1, 1, 3, 2, 2, 0, 0, 2, - 0, 0, 0, 0, 1, 4, 1, 0, - 2, 1, 2, 2, 0, 2, 2, 1, - 1, 2, 6, 1, 1, 1, 1, 2, - 2, 1, 1, 1, 2, 2, 0, 1, - 1, 1, 1, 0, 1, 0, 3, 3, - 1, 2, 2, 2, 0, 5, 1, 1, - 0, 1, 1, 1, 1, 1, 2, 1, - 1, 4, 1, 1, 1, 1, 1, 4, - 1, 2, 2, 5, 2, 6, 2, 8, - 4, 2, 5, 0, 3, 2, 4, 1, - 6, 2, 4, 4, 1, 1, 2, 1, - 2, 1, 4, 0, 0, 4, 4, 1, - 1, 2, 2, 2, 2, 1, 1, 6, - 2, 5, 1, 3, 3, 4, 4, 4, - 4, 2, 0, 0, 1, 1, 0, 1, - 0, 1, 1, 0, 2, 1, 1, 2, - 4, 1, 2, 4, 1, 5, 0, 3, - 2, 1, 0, 0, 2, 0, 0, 0, - 0, 1, 4, 1, 0, 2, 1, 4, - 2, 0, 4, 3, 4, 2, 2, 6, - 2, 2, 4, 1, 4, 2, 4, 1, - 3, 3, 2, 2, 0, 1, 1, 1, - 0, 1, 0, 3, 3, 1, 2, 2, - 2, 0, 5, 1, 1, 0, 1, 0, - 1, 1, 1, 0, 0, 0, 0, 1, - 1, 1, 0, 0, 0, 0, 1, 1, - 5, 9, 2, 1, 3, 5, 3, 1, - 6, 1, 1, 2, 2, 2, 6, 0, - 0, 0, 4, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_index_offsets []int16 = []int16{ - 0, 0, 2, 4, 6, 8, 11, 15, - 17, 20, 25, 28, 30, 32, 34, 63, - 68, 70, 73, 76, 80, 84, 90, 97, - 102, 106, 112, 115, 120, 123, 129, 135, - 138, 144, 146, 152, 155, 157, 161, 163, - 169, 171, 176, 178, 200, 203, 207, 212, - 214, 217, 220, 222, 225, 227, 230, 233, - 235, 241, 243, 246, 249, 252, 254, 256, - 262, 265, 271, 274, 281, 283, 285, 287, - 289, 291, 294, 296, 298, 314, 317, 319, - 321, 326, 329, 332, 334, 336, 339, 342, - 344, 348, 353, 357, 360, 364, 366, 369, - 377, 383, 385, 387, 389, 395, 397, 421, - 424, 426, 429, 432, 434, 437, 440, 443, - 445, 449, 457, 459, 461, 463, 465, 468, - 471, 473, 475, 477, 480, 483, 488, 490, - 492, 494, 496, 498, 500, 507, 511, 515, - 517, 520, 523, 527, 531, 537, 539, 541, - 545, 547, 549, 551, 553, 556, 560, 562, - 565, 570, 573, 575, 577, 579, 610, 615, - 617, 620, 626, 634, 640, 649, 654, 665, - 673, 678, 686, 690, 697, 701, 708, 714, - 723, 728, 737, 746, 750, 752, 757, 759, - 765, 768, 773, 775, 797, 803, 808, 814, - 816, 819, 822, 826, 831, 833, 836, 844, - 848, 858, 860, 867, 872, 880, 887, 892, - 900, 903, 909, 912, 914, 916, 918, 920, - 923, 925, 927, 943, 946, 948, 950, 957, - 962, 964, 967, 975, 978, 984, 989, 994, - 1001, 1007, 1011, 1013, 1016, 1024, 1030, 1032, - 1034, 1036, 1042, 1044, 1068, 1072, 1074, 1080, - 1084, 1086, 1092, 1096, 1103, 1107, 1113, 1122, - 1125, 1129, 1137, 1140, 1147, 1150, 1156, 1158, - 1164, 1169, 1174, 1180, 1185, 1187, 1189, 1191, - 1193, 1195, 1202, 1208, 1212, 1214, 1217, 1220, - 1224, 1228, 1234, 1236, 1238, 1240, 1242, 1244, - 1250, 1252, 1254, 1255, 1257, 1259, 1261, 1267, - 1269, 1271, 1272, 1279, 1281, 1285, 1289, 1291, - 1293, 1295, 1298, 1302, 1304, 1307, 1312, 1315, - 1317, 1319, 1321, 1350, 1355, 1357, 1360, 1363, - 1367, 1371, 1377, 1384, 1389, 1393, 1399, 1402, - 1407, 1410, 1416, 1422, 1425, 1431, 1433, 1439, - 1442, 1444, 1448, 1450, 1456, 1458, 1463, 1465, - 1487, 1490, 1494, 1499, 1501, 1504, 1507, 1509, - 1512, 1514, 1517, 1520, 1522, 1528, 1530, 1533, - 1536, 1539, 1541, 1543, 1549, 1552, 1558, 1561, - 1568, 1570, 1572, 1574, 1576, 1578, 1581, 1583, - 1585, 1601, 1604, 1606, 1608, 1613, 1616, 1619, - 1621, 1623, 1626, 1629, 1631, 1635, 1640, 1644, - 1647, 1651, 1653, 1656, 1664, 1670, 1672, 1674, - 1676, 1682, 1684, 1708, 1711, 1713, 1716, 1719, - 1721, 1724, 1727, 1730, 1732, 1736, 1744, 1746, - 1748, 1750, 1752, 1755, 1758, 1760, 1762, 1764, - 1767, 1770, 1775, 1777, 1779, 1781, 1783, 1785, - 1787, 1794, 1798, 1802, 1804, 1807, 1810, 1814, - 1818, 1824, 1826, 1828, 1832, 1834, 1836, 1838, - 1840, 1843, 1847, 1849, 1852, 1857, 1860, 1862, - 1864, 1866, 1897, 1902, 1904, 1907, 1913, 1921, - 1927, 1936, 1941, 1952, 1960, 1965, 1973, 1977, - 1984, 1988, 1995, 2001, 2010, 2015, 2024, 2033, - 2037, 2039, 2044, 2046, 2052, 2055, 2060, 2062, - 2084, 2090, 2095, 2101, 2103, 2106, 2109, 2113, - 2118, 2120, 2123, 2131, 2135, 2145, 2147, 2154, - 2159, 2167, 2174, 2179, 2187, 2190, 2196, 2199, - 2201, 2203, 2205, 2207, 2210, 2212, 2214, 2230, - 2233, 2235, 2237, 2244, 2249, 2251, 2254, 2262, - 2265, 2271, 2276, 2281, 2288, 2294, 2298, 2300, - 2303, 2311, 2317, 2319, 2321, 2323, 2329, 2331, - 2355, 2359, 2361, 2367, 2371, 2373, 2379, 2383, - 2390, 2394, 2400, 2409, 2412, 2416, 2424, 2427, - 2434, 2437, 2443, 2445, 2451, 2456, 2461, 2467, - 2472, 2474, 2476, 2478, 2480, 2482, 2489, 2495, - 2499, 2501, 2504, 2507, 2511, 2515, 2521, 2523, - 2525, 2527, 2529, 2531, 2537, 2539, 2541, 2542, - 2544, 2546, 2548, 2554, 2556, 2558, 2559, 2566, - 2568, 2571, 2575, 2578, 2581, 2585, 2588, 2591, - 2598, 2600, 2625, 2627, 2652, 2654, 2656, 2680, - 2682, 2684, 2686, 2688, 2691, 2693, 2697, 2699, - 2730, 2733, 2738, 2762, 2765, 2767, 2770, 2773, - 2777, 2780, 2783, 2787, 2788, 2844, 2900, 2930, - 2934, 2937, 2944, 2950, 2953, 2956, 2959, 2963, - 2965, 2983, 2987, 2992, 2995, 2998, 3002, 3005, - 3008, 3012, 3068, 3124, 3154, 3158, 3163, 3167, - 3169, 3173, 3179, 3183, 3186, 3190, 3193, 3196, - 3199, 3202, 3215, 3218, 3226, 3228, 3230, 3233, - 3239, 3251, 3257, 3261, 3266, 3272, 3277, 3280, - 3290, 3292, 3295, 3300, 3302, 3305, 3308, 3312, - 3315, 3318, 3325, 3327, 3329, 3331, 3333, 3336, - 3340, 3342, 3345, 3350, 3353, 3355, 3357, 3359, - 3388, 3393, 3395, 3398, 3401, 3405, 3409, 3415, - 3422, 3427, 3431, 3437, 3440, 3445, 3448, 3454, - 3460, 3463, 3469, 3471, 3477, 3480, 3482, 3486, - 3488, 3494, 3496, 3501, 3503, 3525, 3528, 3532, - 3537, 3539, 3542, 3545, 3547, 3550, 3552, 3555, - 3558, 3560, 3566, 3568, 3571, 3574, 3577, 3579, - 3581, 3587, 3590, 3596, 3599, 3606, 3608, 3610, - 3612, 3614, 3616, 3619, 3621, 3623, 3639, 3642, - 3644, 3646, 3651, 3654, 3657, 3659, 3661, 3664, - 3667, 3669, 3673, 3678, 3682, 3685, 3689, 3691, - 3694, 3702, 3708, 3710, 3712, 3714, 3720, 3722, - 3746, 3749, 3751, 3754, 3757, 3759, 3762, 3765, - 3768, 3770, 3774, 3782, 3784, 3786, 3788, 3790, - 3793, 3796, 3798, 3800, 3802, 3805, 3808, 3813, - 3815, 3817, 3819, 3821, 3823, 3825, 3832, 3836, - 3840, 3842, 3845, 3848, 3852, 3856, 3862, 3864, - 3866, 3870, 3872, 3874, 3876, 3878, 3881, 3885, - 3887, 3890, 3895, 3898, 3900, 3902, 3904, 3935, - 3940, 3942, 3945, 3951, 3959, 3965, 3974, 3979, - 3990, 3998, 4003, 4011, 4015, 4022, 4026, 4033, - 4039, 4048, 4053, 4062, 4071, 4075, 4077, 4082, - 4084, 4090, 4093, 4098, 4100, 4122, 4128, 4133, - 4139, 4141, 4144, 4147, 4151, 4156, 4158, 4161, - 4169, 4173, 4183, 4185, 4192, 4197, 4205, 4212, - 4217, 4225, 4228, 4234, 4237, 4239, 4241, 4243, - 4245, 4248, 4250, 4252, 4268, 4271, 4273, 4275, - 4282, 4287, 4289, 4292, 4300, 4303, 4309, 4314, - 4319, 4326, 4332, 4336, 4338, 4341, 4349, 4355, - 4357, 4359, 4361, 4367, 4369, 4393, 4397, 4399, - 4405, 4409, 4411, 4417, 4421, 4428, 4432, 4438, - 4447, 4450, 4454, 4462, 4465, 4472, 4475, 4481, - 4483, 4489, 4494, 4499, 4505, 4510, 4512, 4514, - 4516, 4518, 4520, 4527, 4533, 4537, 4539, 4542, - 4545, 4549, 4553, 4559, 4561, 4563, 4565, 4567, - 4569, 4575, 4577, 4579, 4580, 4582, 4584, 4586, - 4592, 4594, 4596, 4597, 4604, 4629, 4631, 4656, - 4658, 4660, 4684, 4686, 4688, 4690, 4692, 4695, - 4697, 4701, 4703, 4734, 4737, 4742, 4766, 4769, - 4771, 4774, 4777, 4781, 4784, 4787, 4791, 4792, - 4848, 4904, 4934, 4938, 4941, 4948, 4956, 4958, - 4960, 4962, 4965, 4969, 4971, 4974, 4979, 4982, - 4984, 4986, 4988, 5017, 5022, 5024, 5027, 5030, - 5034, 5038, 5044, 5051, 5056, 5060, 5066, 5069, - 5074, 5077, 5083, 5089, 5092, 5098, 5100, 5106, - 5109, 5111, 5115, 5117, 5123, 5125, 5130, 5132, - 5154, 5157, 5161, 5166, 5168, 5171, 5174, 5176, - 5179, 5181, 5184, 5187, 5189, 5195, 5197, 5200, - 5203, 5206, 5208, 5210, 5216, 5219, 5225, 5228, - 5230, 5232, 5234, 5236, 5239, 5241, 5243, 5259, - 5262, 5264, 5266, 5271, 5274, 5277, 5279, 5281, - 5284, 5287, 5289, 5293, 5298, 5302, 5305, 5309, - 5311, 5314, 5321, 5327, 5329, 5331, 5333, 5339, - 5341, 5365, 5368, 5370, 5373, 5376, 5378, 5381, - 5384, 5387, 5389, 5393, 5401, 5403, 5405, 5407, - 5409, 5412, 5415, 5417, 5419, 5421, 5424, 5427, - 5432, 5434, 5436, 5438, 5440, 5442, 5444, 5451, - 5455, 5459, 5461, 5464, 5467, 5471, 5475, 5481, - 5483, 5485, 5487, 5493, 5495, 5497, 5498, 5505, - 5507, 5515, 5519, 5521, 5523, 5525, 5527, 5530, - 5534, 5536, 5539, 5544, 5547, 5549, 5551, 5553, - 5584, 5589, 5591, 5594, 5600, 5608, 5614, 5623, - 5628, 5639, 5647, 5652, 5660, 5664, 5671, 5675, - 5682, 5688, 5697, 5702, 5711, 5720, 5724, 5726, - 5731, 5733, 5739, 5742, 5747, 5749, 5771, 5777, - 5782, 5788, 5790, 5793, 5796, 5800, 5805, 5807, - 5810, 5818, 5822, 5832, 5834, 5841, 5846, 5854, - 5861, 5866, 5874, 5877, 5883, 5886, 5888, 5890, - 5892, 5894, 5897, 5899, 5901, 5917, 5920, 5922, - 5924, 5931, 5936, 5938, 5941, 5949, 5952, 5958, - 5963, 5968, 5975, 5981, 5985, 5987, 5990, 5998, - 6004, 6006, 6008, 6010, 6016, 6018, 6042, 6046, - 6048, 6054, 6058, 6060, 6066, 6070, 6077, 6081, - 6087, 6096, 6099, 6103, 6111, 6114, 6121, 6124, - 6130, 6132, 6138, 6143, 6148, 6154, 6159, 6161, - 6163, 6165, 6167, 6169, 6176, 6182, 6186, 6188, - 6191, 6194, 6198, 6202, 6208, 6210, 6212, 6214, - 6216, 6218, 6224, 6226, 6228, 6229, 6231, 6233, - 6237, 6240, 6242, 6244, 6246, 6249, 6253, 6255, - 6258, 6263, 6266, 6268, 6270, 6272, 6303, 6308, - 6310, 6313, 6319, 6321, 6323, 6325, 6328, 6332, - 6334, 6337, 6342, 6345, 6347, 6349, 6351, 6380, - 6385, 6387, 6390, 6393, 6397, 6401, 6407, 6414, - 6419, 6423, 6429, 6432, 6437, 6440, 6446, 6452, - 6455, 6461, 6463, 6469, 6472, 6474, 6478, 6480, - 6486, 6488, 6493, 6495, 6517, 6520, 6524, 6529, - 6531, 6534, 6537, 6539, 6542, 6544, 6547, 6550, - 6552, 6558, 6560, 6563, 6566, 6569, 6571, 6573, - 6579, 6582, 6588, 6591, 6598, 6600, 6602, 6604, - 6606, 6608, 6611, 6613, 6615, 6631, 6634, 6636, - 6638, 6643, 6646, 6649, 6651, 6653, 6656, 6659, - 6661, 6665, 6670, 6674, 6677, 6681, 6683, 6686, - 6694, 6700, 6702, 6704, 6706, 6712, 6714, 6738, - 6741, 6743, 6746, 6749, 6751, 6754, 6757, 6760, - 6762, 6766, 6774, 6776, 6778, 6780, 6782, 6785, - 6788, 6790, 6792, 6794, 6797, 6800, 6805, 6807, - 6809, 6811, 6813, 6815, 6817, 6824, 6828, 6832, - 6834, 6837, 6840, 6844, 6848, 6854, 6856, 6858, - 6862, 6864, 6866, 6868, 6870, 6876, 6878, 6880, - 6881, 6888, 6896, 6902, 6911, 6916, 6927, 6935, - 6940, 6948, 6952, 6959, 6963, 6970, 6976, 6985, - 6990, 6999, 7008, 7012, 7014, 7019, 7021, 7027, - 7030, 7035, 7037, 7059, 7065, 7070, 7076, 7078, - 7081, 7084, 7088, 7093, 7095, 7098, 7106, 7110, - 7120, 7122, 7129, 7134, 7142, 7149, 7154, 7162, - 7165, 7171, 7174, 7176, 7178, 7180, 7182, 7185, - 7187, 7189, 7205, 7208, 7210, 7212, 7219, 7224, - 7226, 7229, 7237, 7240, 7246, 7251, 7256, 7263, - 7269, 7273, 7275, 7278, 7286, 7292, 7294, 7296, - 7298, 7304, 7306, 7330, 7334, 7336, 7342, 7346, - 7348, 7354, 7358, 7365, 7369, 7375, 7384, 7387, - 7391, 7399, 7402, 7409, 7412, 7418, 7420, 7426, - 7431, 7436, 7442, 7447, 7449, 7451, 7453, 7455, - 7457, 7464, 7470, 7474, 7476, 7479, 7482, 7486, - 7490, 7496, 7498, 7500, 7502, 7504, 7506, 7512, - 7514, 7516, 7517, 7520, 7524, 7526, 7544, 7548, - 7553, 7556, 7559, 7563, 7566, 7569, 7573, 7629, - 7685, 7718, 7722, 7727, 7729, 7730, 7732, 7736, - 7739, 7744, 7750, 7754, 7757, 7761, 7764, 7768, - 7771, 7775, 7788, 7791, 7793, 7795, 7797, 7800, - 7804, 7806, 7809, 7814, 7817, 7819, 7821, 7823, - 7852, 7857, 7859, 7862, 7865, 7869, 7873, 7879, - 7886, 7891, 7895, 7901, 7904, 7909, 7912, 7918, - 7924, 7927, 7933, 7935, 7941, 7944, 7946, 7950, - 7952, 7958, 7960, 7965, 7967, 7989, 7992, 7996, - 8001, 8003, 8006, 8009, 8011, 8014, 8016, 8019, - 8022, 8024, 8030, 8032, 8035, 8038, 8041, 8043, - 8045, 8051, 8054, 8060, 8063, 8070, 8072, 8074, - 8076, 8078, 8080, 8083, 8085, 8087, 8103, 8106, - 8108, 8110, 8115, 8118, 8121, 8123, 8125, 8128, - 8131, 8133, 8137, 8142, 8146, 8149, 8153, 8155, - 8158, 8166, 8172, 8174, 8176, 8178, 8184, 8186, - 8210, 8213, 8215, 8218, 8221, 8223, 8226, 8229, - 8232, 8234, 8238, 8246, 8248, 8250, 8252, 8254, - 8257, 8260, 8262, 8264, 8266, 8269, 8272, 8277, - 8279, 8281, 8283, 8285, 8287, 8289, 8296, 8300, - 8304, 8306, 8309, 8312, 8316, 8320, 8326, 8328, - 8330, 8334, 8336, 8338, 8340, 8342, 8345, 8349, - 8351, 8354, 8359, 8362, 8364, 8366, 8368, 8399, - 8404, 8406, 8409, 8415, 8423, 8429, 8438, 8443, - 8454, 8462, 8467, 8475, 8479, 8486, 8490, 8497, - 8503, 8512, 8517, 8526, 8535, 8539, 8541, 8546, - 8548, 8554, 8557, 8562, 8564, 8586, 8592, 8597, - 8603, 8605, 8608, 8611, 8615, 8620, 8622, 8625, - 8633, 8637, 8647, 8649, 8656, 8661, 8669, 8676, - 8681, 8689, 8692, 8698, 8701, 8703, 8705, 8707, - 8709, 8712, 8714, 8716, 8732, 8735, 8737, 8739, - 8746, 8751, 8753, 8756, 8764, 8767, 8773, 8778, - 8783, 8790, 8796, 8800, 8802, 8805, 8813, 8819, - 8821, 8823, 8825, 8831, 8833, 8857, 8861, 8863, - 8869, 8873, 8875, 8881, 8885, 8892, 8896, 8902, - 8911, 8914, 8918, 8926, 8929, 8936, 8939, 8945, - 8947, 8953, 8958, 8963, 8969, 8974, 8976, 8978, - 8980, 8982, 8984, 8991, 8997, 9001, 9003, 9006, - 9009, 9013, 9017, 9023, 9025, 9027, 9029, 9031, - 9033, 9039, 9041, 9043, 9044, 9046, 9048, 9050, - 9056, 9058, 9060, 9061, 9068, 9076, 9078, 9080, - 9083, 9089, 9101, 9107, 9111, 9116, 9122, 9127, - 9130, 9140, 9142, 9145, 9153, 9156, 9159, 9183, - 9204, 9225, 9246, 9265, 9286, 9307, 9328, 9352, - 9374, 9396, 9418, 9439, 9463, 9484, 9505, 9526, - 9548, 9570, 9592, 9613, 9634, 9655, 9676, 9697, - 9718, 9739, 9760, 9781, -} - -var _graphclust_indicies []int16 = []int16{ - 0, 1, 3, 2, 2, 3, 3, 2, - 3, 3, 2, 3, 3, 3, 2, 3, - 2, 3, 3, 2, 3, 3, 3, 3, - 2, 3, 3, 2, 2, 3, 3, 2, - 3, 2, 4, 5, 6, 7, 8, 10, - 11, 12, 14, 15, 16, 17, 18, 19, - 20, 21, 22, 23, 24, 25, 26, 27, - 28, 29, 30, 31, 9, 13, 2, 3, - 3, 3, 3, 2, 3, 2, 3, 3, - 2, 2, 2, 3, 2, 2, 2, 3, - 3, 3, 3, 2, 2, 2, 2, 2, - 2, 3, 2, 2, 2, 2, 2, 2, - 3, 2, 2, 2, 2, 3, 3, 3, - 3, 2, 3, 3, 3, 3, 3, 2, - 3, 3, 2, 3, 3, 3, 3, 2, - 3, 3, 2, 2, 2, 2, 2, 2, - 3, 3, 3, 3, 3, 3, 2, 3, - 3, 2, 2, 2, 2, 2, 2, 3, - 3, 2, 3, 3, 3, 3, 3, 2, - 3, 3, 2, 3, 2, 3, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 2, - 3, 2, 32, 33, 34, 35, 36, 37, - 38, 39, 40, 41, 42, 43, 44, 45, - 46, 47, 48, 49, 50, 51, 52, 2, - 3, 3, 2, 3, 3, 3, 2, 3, - 3, 3, 3, 2, 3, 2, 3, 3, - 2, 3, 3, 2, 3, 2, 2, 2, - 3, 3, 2, 3, 3, 2, 3, 3, - 2, 3, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 3, 2, 2, 2, - 3, 3, 3, 2, 3, 2, 3, 2, - 3, 3, 3, 3, 3, 2, 3, 3, - 2, 53, 54, 55, 56, 57, 2, 3, - 58, 2, 53, 54, 59, 55, 56, 57, - 2, 3, 2, 3, 2, 3, 2, 3, - 2, 3, 2, 60, 61, 2, 3, 2, - 3, 2, 62, 63, 64, 65, 66, 67, - 68, 69, 70, 71, 72, 73, 74, 75, - 76, 2, 3, 3, 2, 3, 2, 3, - 2, 3, 3, 3, 3, 2, 3, 3, - 2, 2, 2, 3, 3, 2, 3, 2, - 3, 3, 2, 2, 2, 3, 3, 2, - 3, 3, 3, 2, 3, 3, 3, 3, - 2, 3, 3, 3, 2, 3, 3, 2, - 77, 78, 63, 2, 3, 2, 3, 3, - 2, 79, 80, 81, 82, 83, 84, 85, - 2, 86, 87, 88, 89, 90, 2, 3, - 2, 3, 2, 3, 2, 3, 3, 3, - 3, 3, 2, 3, 2, 91, 92, 93, - 94, 95, 96, 97, 98, 99, 100, 101, - 102, 103, 104, 105, 106, 107, 104, 108, - 109, 110, 111, 112, 2, 3, 3, 2, - 2, 3, 2, 2, 3, 3, 3, 2, - 3, 2, 3, 3, 2, 2, 2, 3, - 3, 3, 2, 3, 2, 3, 3, 3, - 2, 3, 3, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 2, 3, 2, 2, - 3, 3, 3, 2, 2, 2, 3, 2, - 3, 3, 2, 3, 2, 3, 3, 2, - 3, 3, 2, 113, 114, 115, 116, 2, - 3, 2, 3, 2, 3, 2, 3, 2, - 117, 2, 3, 2, 118, 119, 120, 121, - 122, 123, 2, 3, 3, 3, 2, 2, - 2, 2, 3, 3, 2, 3, 3, 2, - 2, 2, 3, 3, 3, 3, 2, 124, - 125, 126, 2, 3, 3, 3, 3, 3, - 2, 3, 2, 3, 2, 127, 128, 129, - 2, 130, 2, 2, 130, 2, 130, 130, - 2, 130, 130, 2, 130, 130, 130, 2, - 130, 2, 130, 130, 2, 130, 130, 130, - 130, 2, 130, 130, 2, 2, 130, 130, - 2, 130, 2, 131, 132, 133, 134, 135, - 136, 137, 139, 140, 141, 142, 143, 144, - 145, 146, 147, 148, 149, 150, 22, 151, - 152, 153, 154, 155, 156, 157, 158, 159, - 138, 2, 130, 130, 130, 130, 2, 130, - 2, 130, 130, 2, 3, 3, 2, 2, - 3, 130, 130, 2, 130, 130, 2, 130, - 2, 3, 130, 130, 130, 3, 3, 2, - 130, 130, 130, 2, 2, 2, 130, 2, - 3, 3, 130, 130, 3, 2, 130, 130, - 130, 2, 130, 2, 130, 2, 130, 2, - 3, 2, 2, 130, 130, 2, 130, 2, - 3, 130, 130, 3, 130, 2, 3, 130, - 130, 3, 3, 130, 130, 2, 130, 130, - 3, 2, 130, 130, 130, 3, 3, 3, - 2, 130, 3, 130, 2, 2, 2, 3, - 2, 2, 2, 130, 130, 130, 3, 130, - 3, 2, 130, 130, 3, 3, 3, 130, - 130, 130, 2, 130, 130, 3, 3, 2, - 2, 2, 130, 130, 130, 2, 130, 2, - 3, 130, 130, 130, 130, 3, 130, 3, - 3, 2, 130, 3, 130, 2, 130, 2, - 130, 3, 130, 130, 2, 130, 2, 130, - 130, 130, 130, 3, 2, 3, 130, 2, - 130, 130, 130, 130, 2, 130, 2, 160, - 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 2, 3, 130, 130, - 3, 130, 2, 3, 130, 130, 130, 2, - 130, 3, 130, 130, 130, 2, 130, 2, - 130, 130, 2, 130, 130, 2, 3, 130, - 3, 2, 130, 130, 130, 2, 3, 130, - 2, 130, 130, 2, 130, 130, 3, 130, - 3, 3, 130, 2, 130, 130, 3, 2, - 130, 130, 130, 130, 3, 130, 130, 3, - 130, 2, 130, 2, 3, 3, 3, 130, - 130, 3, 2, 130, 2, 130, 2, 3, - 3, 3, 3, 130, 130, 3, 130, 2, - 3, 130, 130, 3, 130, 3, 2, 3, - 130, 3, 130, 2, 3, 130, 130, 130, - 130, 3, 130, 2, 130, 130, 2, 181, - 182, 183, 184, 185, 2, 130, 58, 2, - 130, 2, 130, 2, 130, 2, 130, 2, - 186, 187, 2, 130, 2, 130, 2, 188, - 189, 190, 191, 66, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 2, 130, - 130, 2, 130, 2, 130, 2, 130, 130, - 130, 3, 3, 130, 2, 130, 2, 130, - 2, 3, 130, 2, 130, 3, 2, 3, - 130, 130, 130, 3, 130, 3, 2, 130, - 2, 3, 130, 3, 130, 3, 130, 2, - 130, 130, 3, 130, 2, 130, 130, 130, - 130, 2, 130, 3, 3, 130, 130, 3, - 2, 130, 130, 3, 130, 3, 2, 202, - 203, 189, 2, 130, 2, 130, 130, 2, - 204, 205, 206, 207, 208, 209, 210, 2, - 211, 212, 213, 214, 215, 2, 130, 2, - 130, 2, 130, 2, 130, 130, 130, 130, - 130, 2, 130, 2, 216, 217, 218, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 228, 229, 230, 231, 232, 233, 234, 235, - 236, 237, 238, 2, 130, 3, 130, 2, - 2, 130, 3, 2, 3, 3, 2, 130, - 3, 130, 130, 2, 130, 2, 3, 130, - 3, 130, 3, 2, 2, 130, 2, 3, - 130, 130, 3, 130, 3, 130, 2, 130, - 3, 130, 2, 130, 130, 3, 130, 3, - 2, 130, 130, 3, 3, 3, 3, 130, - 130, 2, 3, 130, 2, 3, 3, 130, - 2, 130, 3, 130, 3, 130, 3, 130, - 2, 3, 2, 130, 130, 3, 3, 130, - 3, 130, 2, 2, 2, 130, 130, 3, - 130, 3, 130, 2, 2, 130, 3, 3, - 130, 3, 130, 2, 3, 130, 3, 130, - 2, 3, 3, 130, 130, 2, 3, 3, - 3, 130, 130, 2, 239, 240, 115, 241, - 2, 130, 2, 130, 2, 130, 2, 242, - 2, 130, 2, 243, 244, 245, 246, 247, - 248, 2, 3, 3, 130, 130, 130, 2, - 2, 2, 2, 130, 130, 2, 130, 130, - 2, 2, 2, 130, 130, 130, 130, 2, - 249, 250, 251, 2, 130, 130, 130, 130, - 130, 2, 130, 2, 130, 2, 252, 2, - 3, 2, 253, 2, 254, 255, 256, 258, - 257, 2, 130, 2, 2, 130, 130, 3, - 2, 3, 2, 259, 2, 260, 261, 262, - 264, 263, 2, 3, 2, 2, 3, 3, - 79, 80, 81, 82, 83, 84, 2, 3, - 1, 265, 265, 3, 1, 265, 266, 3, - 1, 267, 268, 267, 268, 268, 267, 268, - 268, 267, 268, 268, 268, 267, 268, 267, - 268, 268, 267, 268, 268, 268, 268, 267, - 268, 268, 267, 267, 268, 268, 267, 268, - 267, 269, 270, 271, 272, 273, 275, 276, - 277, 279, 280, 281, 282, 283, 284, 285, - 286, 287, 288, 289, 290, 291, 292, 293, - 294, 295, 296, 274, 278, 267, 268, 268, - 268, 268, 267, 268, 267, 268, 268, 267, - 267, 267, 268, 267, 267, 267, 268, 268, - 268, 268, 267, 267, 267, 267, 267, 267, - 268, 267, 267, 267, 267, 267, 267, 268, - 267, 267, 267, 267, 268, 268, 268, 268, - 267, 268, 268, 268, 268, 268, 267, 268, - 268, 267, 268, 268, 268, 268, 267, 268, - 268, 267, 267, 267, 267, 267, 267, 268, - 268, 268, 268, 268, 268, 267, 268, 268, - 267, 267, 267, 267, 267, 267, 268, 268, - 267, 268, 268, 268, 268, 268, 267, 268, - 268, 267, 268, 267, 268, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 267, 268, - 267, 297, 298, 299, 300, 301, 302, 303, - 304, 305, 306, 307, 308, 309, 310, 311, - 312, 313, 314, 315, 316, 317, 267, 268, - 268, 267, 268, 268, 268, 267, 268, 268, - 268, 268, 267, 268, 267, 268, 268, 267, - 268, 268, 267, 268, 267, 267, 267, 268, - 268, 267, 268, 268, 267, 268, 268, 267, - 268, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 268, 267, 267, 267, 268, - 268, 268, 267, 268, 267, 268, 267, 268, - 268, 268, 268, 268, 267, 268, 268, 267, - 318, 319, 320, 321, 322, 267, 268, 323, - 267, 318, 319, 324, 320, 321, 322, 267, - 268, 267, 268, 267, 268, 267, 268, 267, - 268, 267, 325, 326, 267, 268, 267, 268, - 267, 327, 328, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, - 267, 268, 268, 267, 268, 267, 268, 267, - 268, 268, 268, 268, 267, 268, 268, 267, - 267, 267, 268, 268, 267, 268, 267, 268, - 268, 267, 267, 267, 268, 268, 267, 268, - 268, 268, 267, 268, 268, 268, 268, 267, - 268, 268, 268, 267, 268, 268, 267, 342, - 343, 328, 267, 268, 267, 268, 268, 267, - 344, 345, 346, 347, 348, 349, 350, 267, - 351, 352, 353, 354, 355, 267, 268, 267, - 268, 267, 268, 267, 268, 268, 268, 268, - 268, 267, 268, 267, 356, 357, 358, 359, - 360, 361, 362, 363, 364, 365, 366, 367, - 368, 369, 370, 371, 372, 369, 373, 374, - 375, 376, 377, 267, 268, 268, 267, 267, - 268, 267, 267, 268, 268, 268, 267, 268, - 267, 268, 268, 267, 267, 267, 268, 268, - 268, 267, 268, 267, 268, 268, 268, 267, - 268, 268, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 267, 268, 267, 267, 268, - 268, 268, 267, 267, 267, 268, 267, 268, - 268, 267, 268, 267, 268, 268, 267, 268, - 268, 267, 378, 379, 380, 381, 267, 268, - 267, 268, 267, 268, 267, 268, 267, 382, - 267, 268, 267, 383, 384, 385, 386, 387, - 388, 267, 268, 268, 268, 267, 267, 267, - 267, 268, 268, 267, 268, 268, 267, 267, - 267, 268, 268, 268, 268, 267, 389, 390, - 391, 267, 268, 268, 268, 268, 268, 267, - 268, 267, 268, 267, 392, 393, 394, 267, - 395, 267, 395, 267, 267, 395, 395, 267, - 395, 395, 267, 395, 395, 395, 267, 395, - 267, 395, 395, 267, 395, 395, 395, 395, - 267, 395, 395, 267, 267, 395, 395, 267, - 395, 267, 396, 397, 398, 399, 400, 401, - 402, 404, 405, 406, 407, 408, 409, 410, - 411, 412, 413, 414, 415, 287, 416, 417, - 418, 419, 420, 421, 422, 423, 424, 403, - 267, 395, 395, 395, 395, 267, 395, 267, - 395, 395, 267, 268, 268, 267, 267, 268, - 395, 395, 267, 395, 395, 267, 395, 267, - 268, 395, 395, 395, 268, 268, 267, 395, - 395, 395, 267, 267, 267, 395, 267, 268, - 268, 395, 395, 268, 267, 395, 395, 395, - 267, 395, 267, 395, 267, 395, 267, 268, - 267, 267, 395, 395, 267, 395, 267, 268, - 395, 395, 268, 395, 267, 268, 395, 395, - 268, 268, 395, 395, 267, 395, 395, 268, - 267, 395, 395, 395, 268, 268, 268, 267, - 395, 268, 395, 267, 267, 267, 268, 267, - 267, 267, 395, 395, 395, 268, 395, 268, - 267, 395, 395, 268, 268, 268, 395, 395, - 395, 267, 395, 395, 268, 268, 267, 267, - 267, 395, 395, 395, 267, 395, 267, 268, - 395, 395, 395, 395, 268, 395, 268, 268, - 267, 395, 268, 395, 267, 395, 267, 395, - 268, 395, 395, 267, 395, 267, 395, 395, - 395, 395, 268, 267, 268, 395, 267, 395, - 395, 395, 395, 267, 395, 267, 425, 426, - 427, 428, 429, 430, 431, 432, 433, 434, - 435, 436, 437, 438, 439, 440, 441, 442, - 443, 444, 445, 267, 268, 395, 395, 268, - 395, 267, 268, 395, 395, 395, 267, 395, - 268, 395, 395, 395, 267, 395, 267, 395, - 395, 267, 395, 395, 267, 268, 395, 268, - 267, 395, 395, 395, 267, 268, 395, 267, - 395, 395, 267, 395, 395, 268, 395, 268, - 268, 395, 267, 395, 395, 268, 267, 395, - 395, 395, 395, 268, 395, 395, 268, 395, - 267, 395, 267, 268, 268, 268, 395, 395, - 268, 267, 395, 267, 395, 267, 268, 268, - 268, 268, 395, 395, 268, 395, 267, 268, - 395, 395, 268, 395, 268, 267, 268, 395, - 268, 395, 267, 268, 395, 395, 395, 395, - 268, 395, 267, 395, 395, 267, 446, 447, - 448, 449, 450, 267, 395, 323, 267, 395, - 267, 395, 267, 395, 267, 395, 267, 451, - 452, 267, 395, 267, 395, 267, 453, 454, - 455, 456, 331, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 267, 395, 395, - 267, 395, 267, 395, 267, 395, 395, 395, - 268, 268, 395, 267, 395, 267, 395, 267, - 268, 395, 267, 395, 268, 267, 268, 395, - 395, 395, 268, 395, 268, 267, 395, 267, - 268, 395, 268, 395, 268, 395, 267, 395, - 395, 268, 395, 267, 395, 395, 395, 395, - 267, 395, 268, 268, 395, 395, 268, 267, - 395, 395, 268, 395, 268, 267, 467, 468, - 454, 267, 395, 267, 395, 395, 267, 469, - 470, 471, 472, 473, 474, 475, 267, 476, - 477, 478, 479, 480, 267, 395, 267, 395, - 267, 395, 267, 395, 395, 395, 395, 395, - 267, 395, 267, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 490, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, - 502, 503, 267, 395, 268, 395, 267, 267, - 395, 268, 267, 268, 268, 267, 395, 268, - 395, 395, 267, 395, 267, 268, 395, 268, - 395, 268, 267, 267, 395, 267, 268, 395, - 395, 268, 395, 268, 395, 267, 395, 268, - 395, 267, 395, 395, 268, 395, 268, 267, - 395, 395, 268, 268, 268, 268, 395, 395, - 267, 268, 395, 267, 268, 268, 395, 267, - 395, 268, 395, 268, 395, 268, 395, 267, - 268, 267, 395, 395, 268, 268, 395, 268, - 395, 267, 267, 267, 395, 395, 268, 395, - 268, 395, 267, 267, 395, 268, 268, 395, - 268, 395, 267, 268, 395, 268, 395, 267, - 268, 268, 395, 395, 267, 268, 268, 268, - 395, 395, 267, 504, 505, 380, 506, 267, - 395, 267, 395, 267, 395, 267, 507, 267, - 395, 267, 508, 509, 510, 511, 512, 513, - 267, 268, 268, 395, 395, 395, 267, 267, - 267, 267, 395, 395, 267, 395, 395, 267, - 267, 267, 395, 395, 395, 395, 267, 514, - 515, 516, 267, 395, 395, 395, 395, 395, - 267, 395, 267, 395, 267, 517, 267, 268, - 267, 518, 267, 519, 520, 521, 523, 522, - 267, 395, 267, 267, 395, 395, 268, 267, - 268, 267, 524, 267, 525, 526, 527, 529, - 528, 267, 268, 267, 267, 268, 268, 344, - 345, 346, 347, 348, 349, 267, 268, 267, - 268, 268, 267, 266, 268, 268, 267, 266, - 268, 267, 266, 268, 267, 531, 532, 530, - 267, 266, 268, 267, 266, 268, 267, 533, - 534, 535, 536, 537, 530, 267, 538, 267, - 297, 298, 299, 533, 534, 539, 300, 301, - 302, 303, 304, 305, 306, 307, 308, 309, - 310, 311, 312, 313, 314, 315, 316, 317, - 267, 540, 538, 297, 298, 299, 541, 535, - 536, 300, 301, 302, 303, 304, 305, 306, - 307, 308, 309, 310, 311, 312, 313, 314, - 315, 316, 317, 267, 540, 267, 542, 540, - 297, 298, 299, 543, 536, 300, 301, 302, - 303, 304, 305, 306, 307, 308, 309, 310, - 311, 312, 313, 314, 315, 316, 317, 267, - 542, 267, 267, 542, 544, 267, 542, 267, - 545, 546, 267, 540, 267, 267, 542, 267, - 540, 267, 540, 327, 328, 329, 330, 331, - 332, 333, 547, 335, 336, 337, 338, 339, - 340, 341, 549, 550, 551, 552, 553, 554, - 549, 550, 551, 552, 553, 554, 549, 548, - 555, 267, 268, 538, 267, 556, 556, 556, - 542, 267, 297, 298, 299, 541, 539, 300, - 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, - 317, 267, 545, 557, 267, 267, 540, 556, - 556, 542, 556, 556, 542, 556, 556, 556, - 542, 556, 556, 542, 556, 556, 542, 556, - 556, 267, 542, 542, 551, 552, 553, 554, - 548, 549, 551, 552, 553, 554, 548, 549, - 551, 552, 553, 554, 548, 549, 551, 552, - 553, 554, 548, 549, 551, 552, 553, 554, - 548, 549, 551, 552, 553, 554, 548, 549, - 551, 552, 553, 554, 548, 549, 551, 552, - 553, 554, 548, 549, 551, 552, 553, 554, - 548, 549, 550, 555, 552, 553, 554, 548, - 549, 550, 552, 553, 554, 548, 549, 550, - 552, 553, 554, 548, 549, 550, 552, 553, - 554, 548, 549, 550, 552, 553, 554, 548, - 549, 550, 552, 553, 554, 548, 549, 550, - 552, 553, 554, 548, 549, 550, 552, 553, - 554, 548, 549, 550, 552, 553, 554, 548, - 549, 550, 551, 555, 553, 554, 548, 549, - 550, 551, 553, 554, 548, 549, 550, 551, - 553, 554, 548, 549, 550, 551, 553, 554, - 548, 549, 550, 551, 553, 558, 557, 552, - 267, 555, 556, 267, 540, 542, 268, 268, - 267, 559, 560, 561, 562, 563, 530, 267, - 268, 323, 268, 268, 268, 267, 268, 268, - 267, 395, 268, 267, 395, 268, 267, 268, - 395, 268, 267, 530, 267, 564, 566, 567, - 568, 569, 570, 571, 566, 567, 568, 569, - 570, 571, 566, 530, 565, 555, 267, 268, - 538, 268, 267, 540, 540, 540, 542, 267, - 540, 540, 542, 540, 540, 542, 540, 540, - 540, 542, 540, 540, 542, 540, 540, 542, - 540, 540, 267, 542, 568, 569, 570, 571, - 565, 566, 568, 569, 570, 571, 565, 566, - 568, 569, 570, 571, 565, 566, 568, 569, - 570, 571, 565, 566, 568, 569, 570, 571, - 565, 566, 568, 569, 570, 571, 565, 566, - 568, 569, 570, 571, 565, 566, 568, 569, - 570, 571, 565, 566, 568, 569, 570, 571, - 565, 566, 567, 555, 569, 570, 571, 565, - 566, 567, 569, 570, 571, 565, 566, 567, - 569, 570, 571, 565, 566, 567, 569, 570, - 571, 565, 566, 567, 569, 570, 571, 565, - 566, 567, 569, 570, 571, 565, 566, 567, - 569, 570, 571, 565, 566, 567, 569, 570, - 571, 565, 566, 567, 569, 570, 571, 565, - 566, 567, 568, 555, 570, 571, 565, 566, - 567, 568, 570, 571, 565, 566, 567, 568, - 570, 571, 565, 566, 567, 568, 570, 571, - 565, 566, 567, 568, 570, 572, 573, 569, - 267, 555, 540, 268, 540, 542, 268, 542, - 268, 267, 540, 574, 575, 530, 267, 268, - 267, 268, 268, 268, 267, 577, 578, 579, - 580, 576, 267, 581, 582, 530, 267, 266, - 268, 267, 268, 266, 268, 267, 583, 530, - 267, 268, 268, 267, 584, 530, 267, 268, - 268, 267, 585, 586, 587, 588, 589, 590, - 591, 592, 593, 594, 595, 530, 267, 268, - 596, 267, 344, 345, 346, 347, 348, 349, - 597, 267, 598, 267, 268, 267, 395, 268, - 267, 268, 395, 268, 395, 268, 267, 395, - 395, 268, 395, 268, 395, 268, 395, 268, - 395, 268, 267, 268, 268, 395, 395, 268, - 267, 395, 395, 268, 267, 395, 268, 395, - 268, 267, 268, 395, 268, 395, 268, 267, - 395, 268, 395, 268, 267, 395, 268, 267, - 395, 395, 268, 268, 395, 268, 395, 268, - 395, 267, 576, 267, 599, 576, 267, 322, - 530, 600, 530, 267, 268, 267, 266, 3, - 1, 266, 3, 1, 602, 603, 601, 1, - 266, 3, 1, 266, 3, 1, 604, 605, - 606, 607, 608, 601, 1, 609, 610, 612, - 611, 611, 612, 612, 611, 612, 612, 611, - 612, 612, 612, 611, 612, 611, 612, 612, - 611, 612, 612, 612, 612, 611, 612, 612, - 611, 611, 612, 612, 611, 612, 611, 613, - 614, 615, 616, 617, 619, 620, 621, 623, - 624, 625, 626, 627, 628, 629, 630, 631, - 632, 633, 634, 635, 636, 637, 638, 639, - 640, 618, 622, 611, 612, 612, 612, 612, - 611, 612, 611, 612, 612, 611, 611, 611, - 612, 611, 611, 611, 612, 612, 612, 612, - 611, 611, 611, 611, 611, 611, 612, 611, - 611, 611, 611, 611, 611, 612, 611, 611, - 611, 611, 612, 612, 612, 612, 611, 612, - 612, 612, 612, 612, 611, 612, 612, 611, - 612, 612, 612, 612, 611, 612, 612, 611, - 611, 611, 611, 611, 611, 612, 612, 612, - 612, 612, 612, 611, 612, 612, 611, 611, - 611, 611, 611, 611, 612, 612, 611, 612, - 612, 612, 612, 612, 611, 612, 612, 611, - 612, 611, 612, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 611, 612, 611, 641, - 642, 643, 644, 645, 646, 647, 648, 649, - 650, 651, 652, 653, 654, 655, 656, 657, - 658, 659, 660, 661, 611, 612, 612, 611, - 612, 612, 612, 611, 612, 612, 612, 612, - 611, 612, 611, 612, 612, 611, 612, 612, - 611, 612, 611, 611, 611, 612, 612, 611, - 612, 612, 611, 612, 612, 611, 612, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 612, 611, 611, 611, 612, 612, 612, - 611, 612, 611, 612, 611, 612, 612, 612, - 612, 612, 611, 612, 612, 611, 662, 663, - 664, 665, 666, 611, 612, 667, 611, 662, - 663, 668, 664, 665, 666, 611, 612, 611, - 612, 611, 612, 611, 612, 611, 612, 611, - 669, 670, 611, 612, 611, 612, 611, 671, - 672, 673, 674, 675, 676, 677, 678, 679, - 680, 681, 682, 683, 684, 685, 611, 612, - 612, 611, 612, 611, 612, 611, 612, 612, - 612, 612, 611, 612, 612, 611, 611, 611, - 612, 612, 611, 612, 611, 612, 612, 611, - 611, 611, 612, 612, 611, 612, 612, 612, - 611, 612, 612, 612, 612, 611, 612, 612, - 612, 611, 612, 612, 611, 686, 687, 672, - 611, 612, 611, 612, 612, 611, 688, 689, - 690, 691, 692, 693, 694, 611, 695, 696, - 697, 698, 699, 611, 612, 611, 612, 611, - 612, 611, 612, 612, 612, 612, 612, 611, - 612, 611, 700, 701, 702, 703, 704, 705, - 706, 707, 708, 709, 710, 711, 712, 713, - 714, 715, 716, 713, 717, 718, 719, 720, - 721, 611, 612, 612, 611, 611, 612, 611, - 611, 612, 612, 612, 611, 612, 611, 612, - 612, 611, 611, 611, 612, 612, 612, 611, - 612, 611, 612, 612, 612, 611, 612, 612, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 611, 612, 611, 611, 612, 612, 612, - 611, 611, 611, 612, 611, 612, 612, 611, - 612, 611, 612, 612, 611, 612, 612, 611, - 722, 723, 724, 725, 611, 612, 611, 612, - 611, 612, 611, 612, 611, 726, 611, 612, - 611, 727, 728, 729, 730, 731, 732, 611, - 612, 612, 612, 611, 611, 611, 611, 612, - 612, 611, 612, 612, 611, 611, 611, 612, - 612, 612, 612, 611, 733, 734, 735, 611, - 612, 612, 612, 612, 612, 611, 612, 611, - 612, 611, 736, 737, 738, 611, 739, 611, - 739, 611, 611, 739, 739, 611, 739, 739, - 611, 739, 739, 739, 611, 739, 611, 739, - 739, 611, 739, 739, 739, 739, 611, 739, - 739, 611, 611, 739, 739, 611, 739, 611, - 740, 741, 742, 743, 744, 745, 746, 748, - 749, 750, 751, 752, 753, 754, 755, 756, - 757, 758, 759, 631, 760, 761, 762, 763, - 764, 765, 766, 767, 768, 747, 611, 739, - 739, 739, 739, 611, 739, 611, 739, 739, - 611, 612, 612, 611, 611, 612, 739, 739, - 611, 739, 739, 611, 739, 611, 612, 739, - 739, 739, 612, 612, 611, 739, 739, 739, - 611, 611, 611, 739, 611, 612, 612, 739, - 739, 612, 611, 739, 739, 739, 611, 739, - 611, 739, 611, 739, 611, 612, 611, 611, - 739, 739, 611, 739, 611, 612, 739, 739, - 612, 739, 611, 612, 739, 739, 612, 612, - 739, 739, 611, 739, 739, 612, 611, 739, - 739, 739, 612, 612, 612, 611, 739, 612, - 739, 611, 611, 611, 612, 611, 611, 611, - 739, 739, 739, 612, 739, 612, 611, 739, - 739, 612, 612, 612, 739, 739, 739, 611, - 739, 739, 612, 612, 611, 611, 611, 739, - 739, 739, 611, 739, 611, 612, 739, 739, - 739, 739, 612, 739, 612, 612, 611, 739, - 612, 739, 611, 739, 611, 739, 612, 739, - 739, 611, 739, 611, 739, 739, 739, 739, - 612, 611, 612, 739, 611, 739, 739, 739, - 739, 611, 739, 611, 769, 770, 771, 772, - 773, 774, 775, 776, 777, 778, 779, 780, - 781, 782, 783, 784, 785, 786, 787, 788, - 789, 611, 612, 739, 739, 612, 739, 611, - 612, 739, 739, 739, 611, 739, 612, 739, - 739, 739, 611, 739, 611, 739, 739, 611, - 739, 739, 611, 612, 739, 612, 611, 739, - 739, 739, 611, 612, 739, 611, 739, 739, - 611, 739, 739, 612, 739, 612, 612, 739, - 611, 739, 739, 612, 611, 739, 739, 739, - 739, 612, 739, 739, 612, 739, 611, 739, - 611, 612, 612, 612, 739, 739, 612, 611, - 739, 611, 739, 611, 612, 612, 612, 612, - 739, 739, 612, 739, 611, 612, 739, 739, - 612, 739, 612, 611, 612, 739, 612, 739, - 611, 612, 739, 739, 739, 739, 612, 739, - 611, 739, 739, 611, 790, 791, 792, 793, - 794, 611, 739, 667, 611, 739, 611, 739, - 611, 739, 611, 739, 611, 795, 796, 611, - 739, 611, 739, 611, 797, 798, 799, 800, - 675, 801, 802, 803, 804, 805, 806, 807, - 808, 809, 810, 611, 739, 739, 611, 739, - 611, 739, 611, 739, 739, 739, 612, 612, - 739, 611, 739, 611, 739, 611, 612, 739, - 611, 739, 612, 611, 612, 739, 739, 739, - 612, 739, 612, 611, 739, 611, 612, 739, - 612, 739, 612, 739, 611, 739, 739, 612, - 739, 611, 739, 739, 739, 739, 611, 739, - 612, 612, 739, 739, 612, 611, 739, 739, - 612, 739, 612, 611, 811, 812, 798, 611, - 739, 611, 739, 739, 611, 813, 814, 815, - 816, 817, 818, 819, 611, 820, 821, 822, - 823, 824, 611, 739, 611, 739, 611, 739, - 611, 739, 739, 739, 739, 739, 611, 739, - 611, 825, 826, 827, 828, 829, 830, 831, - 832, 833, 834, 835, 836, 837, 838, 839, - 840, 841, 842, 843, 844, 845, 846, 847, - 611, 739, 612, 739, 611, 611, 739, 612, - 611, 612, 612, 611, 739, 612, 739, 739, - 611, 739, 611, 612, 739, 612, 739, 612, - 611, 611, 739, 611, 612, 739, 739, 612, - 739, 612, 739, 611, 739, 612, 739, 611, - 739, 739, 612, 739, 612, 611, 739, 739, - 612, 612, 612, 612, 739, 739, 611, 612, - 739, 611, 612, 612, 739, 611, 739, 612, - 739, 612, 739, 612, 739, 611, 612, 611, - 739, 739, 612, 612, 739, 612, 739, 611, - 611, 611, 739, 739, 612, 739, 612, 739, - 611, 611, 739, 612, 612, 739, 612, 739, - 611, 612, 739, 612, 739, 611, 612, 612, - 739, 739, 611, 612, 612, 612, 739, 739, - 611, 848, 849, 724, 850, 611, 739, 611, - 739, 611, 739, 611, 851, 611, 739, 611, - 852, 853, 854, 855, 856, 857, 611, 612, - 612, 739, 739, 739, 611, 611, 611, 611, - 739, 739, 611, 739, 739, 611, 611, 611, - 739, 739, 739, 739, 611, 858, 859, 860, - 611, 739, 739, 739, 739, 739, 611, 739, - 611, 739, 611, 861, 611, 612, 611, 862, - 611, 863, 864, 865, 867, 866, 611, 739, - 611, 611, 739, 739, 612, 611, 612, 611, - 868, 611, 869, 870, 871, 873, 872, 611, - 612, 611, 611, 612, 612, 688, 689, 690, - 691, 692, 693, 611, 641, 642, 643, 604, - 605, 874, 644, 645, 646, 647, 648, 649, - 650, 651, 652, 653, 654, 655, 656, 657, - 658, 659, 660, 661, 611, 875, 610, 641, - 642, 643, 876, 606, 607, 644, 645, 646, - 647, 648, 649, 650, 651, 652, 653, 654, - 655, 656, 657, 658, 659, 660, 661, 611, - 875, 611, 877, 875, 641, 642, 643, 878, - 607, 644, 645, 646, 647, 648, 649, 650, - 651, 652, 653, 654, 655, 656, 657, 658, - 659, 660, 661, 611, 877, 611, 609, 877, - 879, 611, 877, 611, 880, 881, 611, 875, - 611, 611, 877, 611, 875, 611, 875, 671, - 672, 673, 674, 675, 676, 677, 882, 679, - 680, 681, 682, 683, 684, 685, 884, 885, - 886, 887, 888, 889, 884, 885, 886, 887, - 888, 889, 884, 883, 890, 611, 612, 610, - 611, 891, 891, 891, 877, 611, 641, 642, - 643, 876, 874, 644, 645, 646, 647, 648, - 649, 650, 651, 652, 653, 654, 655, 656, - 657, 658, 659, 660, 661, 611, 880, 892, - 611, 611, 875, 891, 891, 877, 891, 891, - 877, 891, 891, 891, 877, 891, 891, 877, - 891, 891, 877, 891, 891, 611, 877, 877, - 886, 887, 888, 889, 883, 884, 886, 887, - 888, 889, 883, 884, 886, 887, 888, 889, - 883, 884, 886, 887, 888, 889, 883, 884, - 886, 887, 888, 889, 883, 884, 886, 887, - 888, 889, 883, 884, 886, 887, 888, 889, - 883, 884, 886, 887, 888, 889, 883, 884, - 886, 887, 888, 889, 883, 884, 885, 890, - 887, 888, 889, 883, 884, 885, 887, 888, - 889, 883, 884, 885, 887, 888, 889, 883, - 884, 885, 887, 888, 889, 883, 884, 885, - 887, 888, 889, 883, 884, 885, 887, 888, - 889, 883, 884, 885, 887, 888, 889, 883, - 884, 885, 887, 888, 889, 883, 884, 885, - 887, 888, 889, 883, 884, 885, 886, 890, - 888, 889, 883, 884, 885, 886, 888, 889, - 883, 884, 885, 886, 888, 889, 883, 884, - 885, 886, 888, 889, 883, 884, 885, 886, - 888, 893, 892, 887, 611, 890, 891, 611, - 875, 877, 265, 3, 1, 894, 895, 896, - 897, 898, 601, 1, 265, 899, 3, 265, - 3, 265, 3, 1, 901, 900, 900, 901, - 901, 900, 901, 901, 900, 901, 901, 901, - 900, 901, 900, 901, 901, 900, 901, 901, - 901, 901, 900, 901, 901, 900, 900, 901, - 901, 900, 901, 900, 902, 903, 904, 905, - 906, 908, 909, 910, 912, 913, 914, 915, - 916, 917, 918, 919, 920, 921, 922, 923, - 924, 925, 926, 927, 928, 929, 907, 911, - 900, 901, 901, 901, 901, 900, 901, 900, - 901, 901, 900, 900, 900, 901, 900, 900, - 900, 901, 901, 901, 901, 900, 900, 900, - 900, 900, 900, 901, 900, 900, 900, 900, - 900, 900, 901, 900, 900, 900, 900, 901, - 901, 901, 901, 900, 901, 901, 901, 901, - 901, 900, 901, 901, 900, 901, 901, 901, - 901, 900, 901, 901, 900, 900, 900, 900, - 900, 900, 901, 901, 901, 901, 901, 901, - 900, 901, 901, 900, 900, 900, 900, 900, - 900, 901, 901, 900, 901, 901, 901, 901, - 901, 900, 901, 901, 900, 901, 900, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 900, 901, 900, 930, 931, 932, 933, - 934, 935, 936, 937, 938, 939, 940, 941, - 942, 943, 944, 945, 946, 947, 948, 949, - 950, 900, 901, 901, 900, 901, 901, 901, - 900, 901, 901, 901, 901, 900, 901, 900, - 901, 901, 900, 901, 901, 900, 901, 900, - 900, 900, 901, 901, 900, 901, 901, 900, - 901, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 901, 901, 900, - 900, 900, 901, 901, 901, 900, 901, 900, - 901, 900, 901, 901, 901, 901, 901, 900, - 901, 901, 900, 951, 952, 953, 954, 955, - 900, 901, 899, 900, 901, 900, 901, 900, - 901, 900, 901, 900, 956, 957, 900, 901, - 900, 901, 900, 958, 959, 960, 961, 962, - 963, 964, 965, 966, 967, 968, 969, 970, - 971, 972, 900, 901, 901, 900, 901, 900, - 901, 900, 901, 901, 901, 901, 900, 901, - 901, 900, 900, 900, 901, 901, 900, 901, - 900, 901, 901, 900, 900, 900, 901, 901, - 900, 901, 901, 901, 900, 901, 901, 901, - 901, 900, 901, 901, 901, 900, 901, 901, - 900, 973, 974, 959, 900, 901, 900, 901, - 901, 900, 975, 976, 977, 978, 979, 980, - 900, 981, 982, 983, 984, 985, 900, 901, - 900, 901, 900, 901, 900, 901, 901, 901, - 901, 901, 900, 901, 900, 986, 987, 988, - 989, 990, 991, 992, 993, 994, 995, 996, - 997, 998, 999, 1000, 1001, 1002, 999, 1003, - 1004, 1005, 1006, 1007, 900, 901, 901, 900, - 900, 901, 900, 900, 901, 901, 901, 900, - 901, 900, 901, 901, 900, 900, 900, 901, - 901, 901, 900, 901, 900, 901, 901, 901, - 900, 901, 901, 901, 901, 901, 901, 901, - 900, 901, 900, 901, 900, 901, 900, 900, - 901, 901, 901, 900, 900, 900, 901, 900, - 901, 901, 900, 901, 900, 901, 901, 900, - 901, 901, 900, 1008, 1009, 1010, 1011, 900, - 901, 900, 901, 900, 901, 900, 901, 900, - 1012, 900, 901, 900, 1013, 1014, 1015, 1016, - 1017, 1018, 900, 901, 901, 901, 900, 900, - 900, 900, 901, 901, 900, 901, 901, 900, - 900, 900, 901, 901, 901, 901, 900, 1019, - 1020, 1021, 900, 901, 901, 901, 901, 901, - 900, 901, 900, 901, 900, 1022, 900, 1023, - 1024, 1025, 1027, 1026, 900, 901, 900, 900, - 901, 901, 951, 952, 1028, 953, 954, 955, - 900, 901, 900, 975, 976, 977, 978, 979, - 980, 1029, 900, 1030, 1031, 1032, 900, 1033, - 900, 1033, 900, 900, 1033, 1033, 900, 1033, - 1033, 900, 1033, 1033, 1033, 900, 1033, 900, - 1033, 1033, 900, 1033, 1033, 1033, 1033, 900, - 1033, 1033, 900, 900, 1033, 1033, 900, 1033, - 900, 1034, 1035, 1036, 1037, 1038, 1039, 1040, - 1042, 1043, 1044, 1045, 1046, 1047, 1048, 1049, - 1050, 1051, 1052, 1053, 920, 1054, 1055, 1056, - 1057, 1058, 1059, 1060, 1061, 1062, 1041, 900, - 1033, 1033, 1033, 1033, 900, 1033, 900, 1033, - 1033, 900, 901, 901, 900, 900, 901, 1033, - 1033, 900, 1033, 1033, 900, 1033, 900, 901, - 1033, 1033, 1033, 901, 901, 900, 1033, 1033, - 1033, 900, 900, 900, 1033, 900, 901, 901, - 1033, 1033, 901, 900, 1033, 1033, 1033, 900, - 1033, 900, 1033, 900, 1033, 900, 901, 900, - 900, 1033, 1033, 900, 1033, 900, 901, 1033, - 1033, 901, 1033, 900, 901, 1033, 1033, 901, - 901, 1033, 1033, 900, 1033, 1033, 901, 900, - 1033, 1033, 1033, 901, 901, 901, 900, 1033, - 901, 1033, 900, 900, 900, 901, 900, 900, - 900, 1033, 1033, 1033, 901, 1033, 901, 900, - 1033, 1033, 901, 901, 901, 1033, 1033, 1033, - 900, 1033, 1033, 901, 901, 900, 900, 900, - 1033, 1033, 1033, 900, 1033, 900, 901, 1033, - 1033, 1033, 1033, 901, 1033, 901, 901, 900, - 1033, 901, 1033, 900, 1033, 900, 1033, 901, - 1033, 1033, 900, 1033, 900, 1033, 1033, 1033, - 1033, 901, 900, 901, 1033, 900, 1033, 1033, - 1033, 1033, 900, 1033, 900, 1063, 1064, 1065, - 1066, 1067, 1068, 1069, 1070, 1071, 1072, 1073, - 1074, 1075, 1076, 1077, 1078, 1079, 1080, 1081, - 1082, 1083, 900, 901, 1033, 1033, 901, 1033, - 900, 901, 1033, 1033, 1033, 900, 1033, 901, - 1033, 1033, 1033, 900, 1033, 900, 1033, 1033, - 900, 1033, 1033, 900, 901, 1033, 901, 900, - 1033, 1033, 1033, 900, 901, 1033, 900, 1033, - 1033, 900, 1033, 1033, 901, 1033, 901, 901, - 1033, 900, 1033, 1033, 901, 900, 1033, 1033, - 1033, 1033, 901, 1033, 1033, 901, 1033, 900, - 1033, 900, 901, 901, 901, 1033, 1033, 901, - 900, 1033, 900, 1033, 900, 901, 901, 901, - 901, 1033, 1033, 901, 1033, 900, 901, 1033, - 1033, 901, 1033, 901, 900, 901, 1033, 901, - 1033, 900, 901, 1033, 1033, 1033, 1033, 901, - 1033, 900, 1033, 1033, 900, 1084, 1085, 1086, - 1087, 1088, 900, 1033, 899, 900, 1033, 900, - 1033, 900, 1033, 900, 1033, 900, 1089, 1090, - 900, 1033, 900, 1033, 900, 1091, 1092, 1093, - 1094, 962, 1095, 1096, 1097, 1098, 1099, 1100, - 1101, 1102, 1103, 1104, 900, 1033, 1033, 900, - 1033, 900, 1033, 900, 1033, 1033, 1033, 901, - 901, 1033, 900, 1033, 900, 1033, 900, 901, - 1033, 900, 1033, 901, 900, 901, 1033, 1033, - 1033, 901, 1033, 901, 900, 1033, 900, 901, - 1033, 901, 1033, 901, 1033, 900, 1033, 1033, - 901, 1033, 900, 1033, 1033, 1033, 1033, 900, - 1033, 901, 901, 1033, 1033, 901, 900, 1033, - 1033, 901, 1033, 901, 900, 1105, 1106, 1092, - 900, 1033, 900, 1033, 1033, 900, 1107, 1108, - 1109, 1110, 1111, 1112, 1113, 900, 1114, 1115, - 1116, 1117, 1118, 900, 1033, 900, 1033, 900, - 1033, 900, 1033, 1033, 1033, 1033, 1033, 900, - 1033, 900, 1119, 1120, 1121, 1122, 1123, 1124, - 1125, 1126, 1127, 1128, 1129, 1130, 1131, 1132, - 1133, 1134, 1135, 1136, 1137, 1138, 1139, 1140, - 1141, 900, 1033, 901, 1033, 900, 900, 1033, - 901, 900, 901, 901, 900, 1033, 901, 1033, - 1033, 900, 1033, 900, 901, 1033, 901, 1033, - 901, 900, 900, 1033, 900, 901, 1033, 1033, - 901, 1033, 901, 1033, 900, 1033, 901, 1033, - 900, 1033, 1033, 901, 1033, 901, 900, 1033, - 1033, 901, 901, 901, 901, 1033, 1033, 900, - 901, 1033, 900, 901, 901, 1033, 900, 1033, - 901, 1033, 901, 1033, 901, 1033, 900, 901, - 900, 1033, 1033, 901, 901, 1033, 901, 1033, - 900, 900, 900, 1033, 1033, 901, 1033, 901, - 1033, 900, 900, 1033, 901, 901, 1033, 901, - 1033, 900, 901, 1033, 901, 1033, 900, 901, - 901, 1033, 1033, 900, 901, 901, 901, 1033, - 1033, 900, 1142, 1143, 1010, 1144, 900, 1033, - 900, 1033, 900, 1033, 900, 1145, 900, 1033, - 900, 1146, 1147, 1148, 1149, 1150, 1151, 900, - 901, 901, 1033, 1033, 1033, 900, 900, 900, - 900, 1033, 1033, 900, 1033, 1033, 900, 900, - 900, 1033, 1033, 1033, 1033, 900, 1152, 1153, - 1154, 900, 1033, 1033, 1033, 1033, 1033, 900, - 1033, 900, 1033, 900, 1155, 900, 901, 900, - 1156, 900, 1157, 1158, 1159, 1161, 1160, 900, - 1033, 900, 900, 1033, 1033, 901, 900, 901, - 900, 3, 265, 3, 1, 1162, 3, 1, - 1162, 1163, 1163, 1162, 1162, 1163, 1162, 1162, - 1163, 1162, 1162, 1162, 1163, 1162, 1163, 1162, - 1162, 1163, 1162, 1162, 1162, 1162, 1163, 1162, - 1162, 1163, 1163, 1162, 1162, 1163, 1162, 1163, - 1164, 1165, 1166, 1167, 1168, 1169, 1170, 1172, - 1173, 1174, 1175, 1176, 1177, 1178, 1179, 1180, - 1181, 1182, 1183, 1184, 1185, 1186, 1187, 1188, - 1189, 1190, 1191, 1192, 1193, 1171, 1163, 1162, - 1162, 1162, 1162, 1163, 1162, 1163, 1162, 1162, - 1163, 1194, 1194, 1163, 1163, 1194, 1162, 1194, - 1163, 1163, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1163, 1194, 1163, 1194, 1194, - 1163, 1194, 1194, 1194, 1194, 1163, 1194, 1194, - 1163, 1163, 1194, 1194, 1163, 1194, 1163, 1195, - 1196, 1197, 1198, 1199, 1201, 1202, 1203, 1205, - 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1184, - 1213, 1214, 1215, 1216, 1217, 1218, 1219, 1220, - 1221, 1200, 1204, 1163, 1194, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1194, 1163, 1163, 1163, - 1194, 1163, 1163, 1163, 1194, 1194, 1194, 1194, - 1163, 1163, 1163, 1163, 1163, 1163, 1194, 1163, - 1163, 1163, 1163, 1163, 1163, 1194, 1163, 1163, - 1163, 1163, 1194, 1194, 1194, 1194, 1163, 1194, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1163, 1163, 1163, 1163, 1163, 1194, 1194, 1194, - 1194, 1194, 1194, 1163, 1194, 1194, 1163, 1163, - 1163, 1163, 1163, 1163, 1194, 1194, 1163, 1194, - 1194, 1194, 1194, 1194, 1163, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1163, 1194, 1163, 1222, - 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, - 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, - 1239, 1240, 1241, 1242, 1163, 1194, 1194, 1163, - 1194, 1194, 1194, 1163, 1194, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1194, 1163, 1194, 1194, - 1163, 1194, 1163, 1163, 1163, 1194, 1194, 1163, - 1194, 1194, 1163, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1194, 1163, 1163, 1163, 1194, 1194, 1194, - 1163, 1194, 1163, 1194, 1163, 1194, 1194, 1194, - 1194, 1194, 1163, 1194, 1194, 1163, 1243, 1244, - 1245, 1246, 1247, 1163, 1194, 1248, 1163, 1243, - 1244, 1249, 1245, 1246, 1247, 1163, 1194, 1163, - 1194, 1163, 1194, 1163, 1194, 1163, 1194, 1163, - 1250, 1251, 1163, 1194, 1163, 1194, 1163, 1252, - 1253, 1254, 1255, 1256, 1257, 1258, 1259, 1260, - 1261, 1262, 1263, 1264, 1265, 1266, 1163, 1194, - 1194, 1163, 1194, 1163, 1194, 1163, 1194, 1194, - 1194, 1194, 1163, 1194, 1194, 1163, 1163, 1163, - 1194, 1194, 1163, 1194, 1163, 1194, 1194, 1163, - 1163, 1163, 1194, 1194, 1163, 1194, 1194, 1194, - 1163, 1194, 1194, 1194, 1194, 1163, 1194, 1194, - 1194, 1163, 1194, 1194, 1163, 1267, 1268, 1253, - 1163, 1194, 1163, 1194, 1194, 1163, 1269, 1270, - 1271, 1272, 1273, 1274, 1275, 1163, 1276, 1277, - 1278, 1279, 1280, 1163, 1194, 1163, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1194, 1194, 1163, - 1194, 1163, 1281, 1282, 1283, 1284, 1285, 1286, - 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, - 1295, 1296, 1297, 1294, 1298, 1299, 1300, 1301, - 1302, 1163, 1194, 1194, 1163, 1163, 1194, 1163, - 1163, 1194, 1194, 1194, 1163, 1194, 1163, 1194, - 1194, 1163, 1163, 1163, 1194, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1194, 1163, 1194, 1194, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1163, 1194, 1163, 1163, 1194, 1194, 1194, - 1163, 1163, 1163, 1194, 1163, 1194, 1194, 1163, - 1194, 1163, 1194, 1194, 1163, 1194, 1194, 1163, - 1303, 1304, 1305, 1306, 1163, 1194, 1163, 1194, - 1163, 1194, 1163, 1194, 1163, 1307, 1163, 1194, - 1163, 1308, 1309, 1310, 1311, 1312, 1313, 1163, - 1194, 1194, 1194, 1163, 1163, 1163, 1163, 1194, - 1194, 1163, 1194, 1194, 1163, 1163, 1163, 1194, - 1194, 1194, 1194, 1163, 1314, 1315, 1316, 1163, - 1194, 1194, 1194, 1194, 1194, 1163, 1194, 1163, - 1194, 1163, 1317, 1318, 1319, 1163, 1162, 1163, - 1194, 1163, 1194, 1163, 1320, 1163, 1321, 1322, - 1323, 1325, 1324, 1163, 1194, 1163, 1163, 1194, - 1194, 1269, 1270, 1271, 1272, 1273, 1274, 1163, - 1162, 1163, 1162, 1162, 1163, 1162, 1163, 1194, - 1162, 1162, 1162, 1194, 1194, 1163, 1162, 1162, - 1162, 1163, 1163, 1163, 1162, 1163, 1194, 1194, - 1162, 1162, 1194, 1163, 1162, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1163, 1194, 1163, - 1163, 1162, 1162, 1163, 1162, 1163, 1194, 1162, - 1162, 1194, 1162, 1163, 1194, 1162, 1162, 1194, - 1194, 1162, 1162, 1163, 1162, 1162, 1194, 1163, - 1162, 1162, 1162, 1194, 1194, 1194, 1163, 1162, - 1194, 1162, 1163, 1163, 1163, 1194, 1163, 1163, - 1163, 1162, 1162, 1162, 1194, 1162, 1194, 1163, - 1162, 1162, 1194, 1194, 1194, 1162, 1162, 1162, - 1163, 1162, 1162, 1194, 1194, 1163, 1163, 1163, - 1162, 1162, 1162, 1163, 1162, 1163, 1194, 1162, - 1162, 1162, 1162, 1194, 1162, 1194, 1194, 1163, - 1162, 1194, 1162, 1163, 1162, 1163, 1162, 1194, - 1162, 1162, 1163, 1162, 1163, 1162, 1162, 1162, - 1162, 1194, 1163, 1194, 1162, 1163, 1162, 1162, - 1162, 1162, 1163, 1162, 1163, 1326, 1327, 1328, - 1329, 1330, 1331, 1332, 1333, 1334, 1335, 1336, - 1337, 1338, 1339, 1340, 1341, 1342, 1343, 1344, - 1345, 1346, 1163, 1194, 1162, 1162, 1194, 1162, - 1163, 1194, 1162, 1162, 1162, 1163, 1162, 1194, - 1162, 1162, 1162, 1163, 1162, 1163, 1162, 1162, - 1163, 1162, 1162, 1163, 1194, 1162, 1194, 1163, - 1162, 1162, 1162, 1163, 1194, 1162, 1163, 1162, - 1162, 1163, 1162, 1162, 1194, 1162, 1194, 1194, - 1162, 1163, 1162, 1162, 1194, 1163, 1162, 1162, - 1162, 1162, 1194, 1162, 1162, 1194, 1162, 1163, - 1162, 1163, 1194, 1194, 1194, 1162, 1162, 1194, - 1163, 1162, 1163, 1162, 1163, 1194, 1194, 1194, - 1194, 1162, 1162, 1194, 1162, 1163, 1194, 1162, - 1162, 1194, 1162, 1194, 1163, 1194, 1162, 1194, - 1162, 1163, 1194, 1162, 1162, 1162, 1162, 1194, - 1162, 1163, 1162, 1162, 1163, 1347, 1348, 1349, - 1350, 1351, 1163, 1162, 1248, 1163, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1163, 1352, 1353, - 1163, 1162, 1163, 1162, 1163, 1354, 1355, 1356, - 1357, 1256, 1358, 1359, 1360, 1361, 1362, 1363, - 1364, 1365, 1366, 1367, 1163, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1162, 1162, 1162, 1194, - 1194, 1162, 1163, 1162, 1163, 1162, 1163, 1194, - 1162, 1163, 1162, 1194, 1163, 1194, 1162, 1162, - 1162, 1194, 1162, 1194, 1163, 1162, 1163, 1194, - 1162, 1194, 1162, 1194, 1162, 1163, 1162, 1162, - 1194, 1162, 1163, 1162, 1162, 1162, 1162, 1163, - 1162, 1194, 1194, 1162, 1162, 1194, 1163, 1162, - 1162, 1194, 1162, 1194, 1163, 1368, 1369, 1355, - 1163, 1162, 1163, 1162, 1162, 1163, 1370, 1371, - 1372, 1373, 1374, 1375, 1376, 1163, 1377, 1378, - 1379, 1380, 1381, 1163, 1162, 1163, 1162, 1163, - 1162, 1163, 1162, 1162, 1162, 1162, 1162, 1163, - 1162, 1163, 1382, 1383, 1384, 1385, 1386, 1387, - 1388, 1389, 1390, 1391, 1392, 1393, 1394, 1395, - 1396, 1397, 1398, 1399, 1400, 1401, 1402, 1403, - 1404, 1163, 1162, 1194, 1162, 1163, 1163, 1162, - 1194, 1163, 1194, 1194, 1163, 1162, 1194, 1162, - 1162, 1163, 1162, 1163, 1194, 1162, 1194, 1162, - 1194, 1163, 1163, 1162, 1163, 1194, 1162, 1162, - 1194, 1162, 1194, 1162, 1163, 1162, 1194, 1162, - 1163, 1162, 1162, 1194, 1162, 1194, 1163, 1162, - 1162, 1194, 1194, 1194, 1194, 1162, 1162, 1163, - 1194, 1162, 1163, 1194, 1194, 1162, 1163, 1162, - 1194, 1162, 1194, 1162, 1194, 1162, 1163, 1194, - 1163, 1162, 1162, 1194, 1194, 1162, 1194, 1162, - 1163, 1163, 1163, 1162, 1162, 1194, 1162, 1194, - 1162, 1163, 1163, 1162, 1194, 1194, 1162, 1194, - 1162, 1163, 1194, 1162, 1194, 1162, 1163, 1194, - 1194, 1162, 1162, 1163, 1194, 1194, 1194, 1162, - 1162, 1163, 1405, 1406, 1305, 1407, 1163, 1162, - 1163, 1162, 1163, 1162, 1163, 1408, 1163, 1162, - 1163, 1409, 1410, 1411, 1412, 1413, 1414, 1163, - 1194, 1194, 1162, 1162, 1162, 1163, 1163, 1163, - 1163, 1162, 1162, 1163, 1162, 1162, 1163, 1163, - 1163, 1162, 1162, 1162, 1162, 1163, 1415, 1416, - 1417, 1163, 1162, 1162, 1162, 1162, 1162, 1163, - 1162, 1163, 1162, 1163, 1418, 1163, 1194, 1163, - 1419, 1163, 1420, 1421, 1422, 1424, 1423, 1163, - 1162, 1163, 1163, 1162, 1162, 1162, 3, 1, - 3, 1162, 3, 1, 601, 1, 1425, 1427, - 1428, 1429, 1430, 1431, 1432, 1427, 1428, 1429, - 1430, 1431, 1432, 1427, 601, 1426, 890, 1, - 3, 610, 3, 1, 875, 875, 875, 877, - 1, 875, 875, 877, 875, 875, 877, 875, - 875, 875, 877, 875, 875, 877, 875, 875, - 877, 875, 875, 1, 877, 1429, 1430, 1431, - 1432, 1426, 1427, 1429, 1430, 1431, 1432, 1426, - 1427, 1429, 1430, 1431, 1432, 1426, 1427, 1429, - 1430, 1431, 1432, 1426, 1427, 1429, 1430, 1431, - 1432, 1426, 1427, 1429, 1430, 1431, 1432, 1426, - 1427, 1429, 1430, 1431, 1432, 1426, 1427, 1429, - 1430, 1431, 1432, 1426, 1427, 1429, 1430, 1431, - 1432, 1426, 1427, 1428, 890, 1430, 1431, 1432, - 1426, 1427, 1428, 1430, 1431, 1432, 1426, 1427, - 1428, 1430, 1431, 1432, 1426, 1427, 1428, 1430, - 1431, 1432, 1426, 1427, 1428, 1430, 1431, 1432, - 1426, 1427, 1428, 1430, 1431, 1432, 1426, 1427, - 1428, 1430, 1431, 1432, 1426, 1427, 1428, 1430, - 1431, 1432, 1426, 1427, 1428, 1430, 1431, 1432, - 1426, 1427, 1428, 1429, 890, 1431, 1432, 1426, - 1427, 1428, 1429, 1431, 1432, 1426, 1427, 1428, - 1429, 1431, 1432, 1426, 1427, 1428, 1429, 1431, - 1432, 1426, 1427, 1428, 1429, 1431, 1433, 1434, - 1435, 1437, 1430, 1436, 1, 890, 875, 3, - 875, 877, 3, 877, 3, 1, 875, 1, - 265, 265, 1, 265, 1438, 1439, 601, 1, - 265, 3, 1, 3, 3, 265, 3, 1, - 1441, 1442, 1443, 1444, 1440, 1, 1445, 1446, - 601, 1, 266, 3, 1, 3, 266, 3, - 1, 1447, 601, 1, 3, 265, 3, 1, - 1448, 601, 1, 3, 265, 3, 1, 1449, - 1450, 1451, 1452, 1453, 1454, 1455, 1456, 1457, - 1458, 1459, 601, 1, 3, 1460, 1, 1462, - 1461, 1461, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1461, 1462, 1461, 1462, 1462, - 1461, 1462, 1462, 1462, 1462, 1461, 1462, 1462, - 1461, 1461, 1462, 1462, 1461, 1462, 1461, 1463, - 1464, 1465, 1466, 1467, 1469, 1470, 1471, 1473, - 1474, 1475, 1476, 1477, 1478, 1479, 1480, 1481, - 1482, 1483, 1484, 1485, 1486, 1487, 1488, 1489, - 1490, 1468, 1472, 1461, 1462, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1462, 1461, 1461, 1461, - 1462, 1461, 1461, 1461, 1462, 1462, 1462, 1462, - 1461, 1461, 1461, 1461, 1461, 1461, 1462, 1461, - 1461, 1461, 1461, 1461, 1461, 1462, 1461, 1461, - 1461, 1461, 1462, 1462, 1462, 1462, 1461, 1462, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1461, 1461, 1461, 1461, 1461, 1462, 1462, 1462, - 1462, 1462, 1462, 1461, 1462, 1462, 1461, 1461, - 1461, 1461, 1461, 1461, 1462, 1462, 1461, 1462, - 1462, 1462, 1462, 1462, 1461, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1461, 1462, 1461, 1491, - 1492, 1493, 1494, 1495, 1496, 1497, 1498, 1499, - 1500, 1501, 1502, 1503, 1504, 1505, 1506, 1507, - 1508, 1509, 1510, 1511, 1461, 1462, 1462, 1461, - 1462, 1462, 1462, 1461, 1462, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1462, 1461, 1462, 1462, - 1461, 1462, 1461, 1461, 1461, 1462, 1462, 1461, - 1462, 1462, 1461, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1462, 1461, 1461, 1461, 1462, 1462, 1462, - 1461, 1462, 1461, 1462, 1461, 1462, 1462, 1462, - 1462, 1462, 1461, 1462, 1462, 1461, 1512, 1513, - 1514, 1515, 1516, 1461, 1462, 1517, 1461, 1512, - 1513, 1518, 1514, 1515, 1516, 1461, 1462, 1461, - 1462, 1461, 1462, 1461, 1462, 1461, 1462, 1461, - 1519, 1520, 1461, 1462, 1461, 1462, 1461, 1521, - 1522, 1523, 1524, 1525, 1526, 1527, 1528, 1529, - 1530, 1531, 1532, 1533, 1534, 1535, 1461, 1462, - 1462, 1461, 1462, 1461, 1462, 1461, 1462, 1462, - 1462, 1462, 1461, 1462, 1462, 1461, 1461, 1461, - 1462, 1462, 1461, 1462, 1461, 1462, 1462, 1461, - 1461, 1461, 1462, 1462, 1461, 1462, 1462, 1462, - 1461, 1462, 1462, 1462, 1462, 1461, 1462, 1462, - 1462, 1461, 1462, 1462, 1461, 1536, 1537, 1522, - 1461, 1462, 1461, 1462, 1462, 1461, 1538, 1539, - 1540, 1541, 1542, 1543, 1544, 1461, 1545, 1546, - 1547, 1548, 1549, 1461, 1462, 1461, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1462, 1462, 1461, - 1462, 1461, 1550, 1551, 1552, 1553, 1554, 1555, - 1556, 1557, 1558, 1559, 1560, 1561, 1562, 1563, - 1564, 1565, 1566, 1563, 1567, 1568, 1569, 1570, - 1571, 1461, 1462, 1462, 1461, 1461, 1462, 1461, - 1461, 1462, 1462, 1462, 1461, 1462, 1461, 1462, - 1462, 1461, 1461, 1461, 1462, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1462, 1461, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1461, 1462, 1461, 1461, 1462, 1462, 1462, - 1461, 1461, 1461, 1462, 1461, 1462, 1462, 1461, - 1462, 1461, 1462, 1462, 1461, 1462, 1462, 1461, - 1572, 1573, 1574, 1575, 1461, 1462, 1461, 1462, - 1461, 1462, 1461, 1462, 1461, 1576, 1461, 1462, - 1461, 1577, 1578, 1579, 1580, 1581, 1582, 1461, - 1462, 1462, 1462, 1461, 1461, 1461, 1461, 1462, - 1462, 1461, 1462, 1462, 1461, 1461, 1461, 1462, - 1462, 1462, 1462, 1461, 1583, 1584, 1585, 1461, - 1462, 1462, 1462, 1462, 1462, 1461, 1462, 1461, - 1462, 1461, 1586, 1587, 1588, 1461, 1589, 1461, - 1589, 1461, 1461, 1589, 1589, 1461, 1589, 1589, - 1461, 1589, 1589, 1589, 1461, 1589, 1461, 1589, - 1589, 1461, 1589, 1589, 1589, 1589, 1461, 1589, - 1589, 1461, 1461, 1589, 1589, 1461, 1589, 1461, - 1590, 1591, 1592, 1593, 1594, 1595, 1596, 1598, - 1599, 1600, 1601, 1602, 1603, 1604, 1605, 1606, - 1607, 1608, 1609, 1481, 1610, 1611, 1612, 1613, - 1614, 1615, 1616, 1617, 1618, 1597, 1461, 1589, - 1589, 1589, 1589, 1461, 1589, 1461, 1589, 1589, - 1461, 1462, 1462, 1461, 1461, 1462, 1589, 1589, - 1461, 1589, 1589, 1461, 1589, 1461, 1462, 1589, - 1589, 1589, 1462, 1462, 1461, 1589, 1589, 1589, - 1461, 1461, 1461, 1589, 1461, 1462, 1462, 1589, - 1589, 1462, 1461, 1589, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1461, 1462, 1461, 1461, - 1589, 1589, 1461, 1589, 1461, 1462, 1589, 1589, - 1462, 1589, 1461, 1462, 1589, 1589, 1462, 1462, - 1589, 1589, 1461, 1589, 1589, 1462, 1461, 1589, - 1589, 1589, 1462, 1462, 1462, 1461, 1589, 1462, - 1589, 1461, 1461, 1461, 1462, 1461, 1461, 1461, - 1589, 1589, 1589, 1462, 1589, 1462, 1461, 1589, - 1589, 1462, 1462, 1462, 1589, 1589, 1589, 1461, - 1589, 1589, 1462, 1462, 1461, 1461, 1461, 1589, - 1589, 1589, 1461, 1589, 1461, 1462, 1589, 1589, - 1589, 1589, 1462, 1589, 1462, 1462, 1461, 1589, - 1462, 1589, 1461, 1589, 1461, 1589, 1462, 1589, - 1589, 1461, 1589, 1461, 1589, 1589, 1589, 1589, - 1462, 1461, 1462, 1589, 1461, 1589, 1589, 1589, - 1589, 1461, 1589, 1461, 1619, 1620, 1621, 1622, - 1623, 1624, 1625, 1626, 1627, 1628, 1629, 1630, - 1631, 1632, 1633, 1634, 1635, 1636, 1637, 1638, - 1639, 1461, 1462, 1589, 1589, 1462, 1589, 1461, - 1462, 1589, 1589, 1589, 1461, 1589, 1462, 1589, - 1589, 1589, 1461, 1589, 1461, 1589, 1589, 1461, - 1589, 1589, 1461, 1462, 1589, 1462, 1461, 1589, - 1589, 1589, 1461, 1462, 1589, 1461, 1589, 1589, - 1461, 1589, 1589, 1462, 1589, 1462, 1462, 1589, - 1461, 1589, 1589, 1462, 1461, 1589, 1589, 1589, - 1589, 1462, 1589, 1589, 1462, 1589, 1461, 1589, - 1461, 1462, 1462, 1462, 1589, 1589, 1462, 1461, - 1589, 1461, 1589, 1461, 1462, 1462, 1462, 1462, - 1589, 1589, 1462, 1589, 1461, 1462, 1589, 1589, - 1462, 1589, 1462, 1461, 1462, 1589, 1462, 1589, - 1461, 1462, 1589, 1589, 1589, 1589, 1462, 1589, - 1461, 1589, 1589, 1461, 1640, 1641, 1642, 1643, - 1644, 1461, 1589, 1517, 1461, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1461, 1645, 1646, 1461, - 1589, 1461, 1589, 1461, 1647, 1648, 1649, 1650, - 1525, 1651, 1652, 1653, 1654, 1655, 1656, 1657, - 1658, 1659, 1660, 1461, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1589, 1589, 1589, 1462, 1462, - 1589, 1461, 1589, 1461, 1589, 1461, 1462, 1589, - 1461, 1589, 1462, 1461, 1462, 1589, 1589, 1589, - 1462, 1589, 1462, 1461, 1589, 1461, 1462, 1589, - 1462, 1589, 1462, 1589, 1461, 1589, 1589, 1462, - 1589, 1461, 1589, 1589, 1589, 1589, 1461, 1589, - 1462, 1462, 1589, 1589, 1462, 1461, 1589, 1589, - 1462, 1589, 1462, 1461, 1661, 1662, 1648, 1461, - 1589, 1461, 1589, 1589, 1461, 1663, 1664, 1665, - 1666, 1667, 1668, 1669, 1461, 1670, 1671, 1672, - 1673, 1674, 1461, 1589, 1461, 1589, 1461, 1589, - 1461, 1589, 1589, 1589, 1589, 1589, 1461, 1589, - 1461, 1675, 1676, 1677, 1678, 1679, 1680, 1681, - 1682, 1683, 1684, 1685, 1686, 1687, 1688, 1689, - 1690, 1691, 1692, 1693, 1694, 1695, 1696, 1697, - 1461, 1589, 1462, 1589, 1461, 1461, 1589, 1462, - 1461, 1462, 1462, 1461, 1589, 1462, 1589, 1589, - 1461, 1589, 1461, 1462, 1589, 1462, 1589, 1462, - 1461, 1461, 1589, 1461, 1462, 1589, 1589, 1462, - 1589, 1462, 1589, 1461, 1589, 1462, 1589, 1461, - 1589, 1589, 1462, 1589, 1462, 1461, 1589, 1589, - 1462, 1462, 1462, 1462, 1589, 1589, 1461, 1462, - 1589, 1461, 1462, 1462, 1589, 1461, 1589, 1462, - 1589, 1462, 1589, 1462, 1589, 1461, 1462, 1461, - 1589, 1589, 1462, 1462, 1589, 1462, 1589, 1461, - 1461, 1461, 1589, 1589, 1462, 1589, 1462, 1589, - 1461, 1461, 1589, 1462, 1462, 1589, 1462, 1589, - 1461, 1462, 1589, 1462, 1589, 1461, 1462, 1462, - 1589, 1589, 1461, 1462, 1462, 1462, 1589, 1589, - 1461, 1698, 1699, 1574, 1700, 1461, 1589, 1461, - 1589, 1461, 1589, 1461, 1701, 1461, 1589, 1461, - 1702, 1703, 1704, 1705, 1706, 1707, 1461, 1462, - 1462, 1589, 1589, 1589, 1461, 1461, 1461, 1461, - 1589, 1589, 1461, 1589, 1589, 1461, 1461, 1461, - 1589, 1589, 1589, 1589, 1461, 1708, 1709, 1710, - 1461, 1589, 1589, 1589, 1589, 1589, 1461, 1589, - 1461, 1589, 1461, 1711, 1461, 1462, 1461, 1712, - 1461, 1713, 1714, 1715, 1717, 1716, 1461, 1589, - 1461, 1461, 1589, 1589, 1462, 1461, 1462, 1461, - 1718, 1461, 1719, 1720, 1721, 1723, 1722, 1461, - 1462, 1461, 1461, 1462, 1462, 1538, 1539, 1540, - 1541, 1542, 1543, 1461, 1538, 1539, 1540, 1541, - 1542, 1543, 1724, 1461, 1725, 1461, 1462, 1461, - 1162, 3, 1, 3, 1162, 3, 1162, 3, - 1, 1162, 1162, 3, 1162, 3, 1162, 3, - 1162, 3, 1162, 3, 1, 3, 3, 1162, - 1162, 3, 1, 1162, 1162, 3, 1, 1162, - 3, 1162, 3, 1, 3, 1162, 3, 1162, - 3, 1, 1162, 3, 1162, 3, 1, 1162, - 3, 1, 1162, 1162, 3, 3, 1162, 3, - 1162, 3, 1162, 1, 1440, 1, 1726, 1440, - 1, 1727, 1435, 1437, 1728, 1437, 601, 1436, - 1, 265, 3, 1, 3, 265, 1, 1, - 1730, 1729, 1733, 1734, 1735, 1736, 1737, 1738, - 1739, 1741, 1742, 1743, 1744, 1745, 1746, 1748, - 1729, 1, 1732, 1740, 1747, 1, 1731, 262, - 264, 1750, 1751, 1752, 1753, 1754, 1755, 1756, - 1757, 1758, 1759, 1760, 1761, 1762, 1763, 1764, - 1765, 1766, 1767, 1749, 262, 264, 1750, 1751, - 1752, 1753, 1754, 1755, 1756, 1757, 1758, 1759, - 1760, 1761, 1768, 1763, 1764, 1765, 1769, 1767, - 1749, 256, 258, 1770, 1771, 1772, 1773, 1774, - 1775, 1776, 1777, 1778, 1779, 1780, 1781, 1782, - 1783, 1784, 1785, 1786, 1787, 1749, 1789, 1790, - 1791, 1792, 1793, 1794, 1795, 1796, 1797, 1798, - 1799, 1800, 1801, 1803, 268, 530, 576, 1802, - 1788, 527, 529, 1804, 1805, 1806, 1807, 1808, - 1809, 1810, 1811, 1812, 1813, 1814, 1815, 1816, - 1817, 1818, 1819, 1820, 1821, 1788, 527, 529, - 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, - 1812, 1813, 1814, 1815, 1822, 1817, 1818, 1819, - 1823, 1821, 1788, 521, 523, 1824, 1825, 1826, - 1827, 1828, 1829, 1830, 1831, 1832, 1833, 1834, - 1835, 1836, 1837, 1838, 1839, 1840, 1841, 1788, - 527, 529, 1804, 1805, 1806, 1807, 1808, 1809, - 1810, 1811, 1812, 1813, 1814, 1842, 1816, 1817, - 1843, 1844, 1845, 1846, 1819, 1820, 1821, 1788, - 527, 529, 1804, 1805, 1806, 1807, 1808, 1809, - 1810, 1811, 1812, 1813, 1814, 1847, 1816, 1817, - 1818, 1848, 1819, 1820, 1821, 1788, 527, 529, - 1804, 1805, 1806, 1807, 1808, 1809, 1810, 1811, - 1812, 1813, 1814, 1849, 1816, 1817, 1818, 1850, - 1819, 1820, 1821, 1788, 527, 529, 1804, 1805, - 1806, 1807, 1808, 1809, 1810, 1811, 1812, 1813, - 1814, 1851, 1816, 1817, 1818, 1852, 1819, 1820, - 1821, 1788, 527, 529, 1804, 1805, 1806, 1807, - 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1815, - 1816, 1817, 1818, 1819, 1853, 1821, 1788, 871, - 873, 1855, 1856, 1857, 1858, 1859, 1860, 1861, - 1862, 1863, 1864, 1865, 1866, 1867, 1868, 1869, - 1870, 1871, 1872, 1873, 1874, 1875, 1854, 871, - 873, 1855, 1856, 1857, 1858, 1859, 1860, 1861, - 1862, 1863, 1864, 1865, 1876, 1867, 1868, 1877, - 1873, 1874, 1875, 1854, 871, 873, 1855, 1856, - 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, - 1865, 1876, 1878, 1868, 1877, 1873, 1879, 1875, - 1854, 865, 867, 1880, 1881, 1882, 1883, 1884, - 1885, 1886, 1887, 1888, 1889, 1890, 1891, 1892, - 1893, 1894, 1895, 1896, 1897, 1854, 871, 873, - 1855, 1856, 1857, 1858, 1859, 1860, 1861, 1862, - 1863, 1864, 1865, 1898, 1867, 1868, 1877, 1899, - 1873, 1874, 1875, 1854, 871, 873, 1855, 1856, - 1857, 1858, 1859, 1860, 1861, 1862, 1863, 1864, - 1865, 1900, 1867, 1868, 1877, 1901, 1873, 1874, - 1875, 1854, 871, 873, 1855, 1856, 1857, 1858, - 1859, 1860, 1861, 1862, 1863, 1864, 1865, 1902, - 1867, 1868, 1877, 1903, 1873, 1874, 1875, 1854, - 1025, 1027, 1905, 1906, 1907, 1908, 1909, 1910, - 1911, 1912, 1913, 1914, 1915, 1916, 1917, 1918, - 1919, 1920, 1921, 1922, 1904, 1025, 1027, 1905, - 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, - 1914, 1915, 1916, 1923, 1918, 1919, 1920, 1924, - 1922, 1904, 1159, 1161, 1925, 1926, 1927, 1928, - 1929, 1930, 1931, 1932, 1933, 1934, 1935, 1936, - 1937, 1938, 1939, 1940, 1941, 1942, 1904, 1422, - 1424, 1944, 1945, 1946, 1947, 1948, 1949, 1950, - 1951, 1952, 1953, 1954, 1955, 1956, 1957, 1958, - 1959, 1960, 1961, 1943, 1323, 1325, 1962, 1963, - 1964, 1965, 1966, 1967, 1968, 1969, 1970, 1971, - 1972, 1973, 1974, 1975, 1976, 1977, 1978, 1979, - 1943, 1323, 1325, 1962, 1963, 1964, 1965, 1966, - 1967, 1968, 1969, 1970, 1971, 1972, 1973, 1980, - 1975, 1976, 1977, 1981, 1979, 1943, 1721, 1723, - 1983, 1984, 1985, 1986, 1987, 1988, 1989, 1990, - 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, - 1999, 2000, 1982, 1721, 1723, 1983, 1984, 1985, - 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, - 1994, 1995, 1996, 1997, 1998, 2001, 2000, 1982, - 1721, 1723, 1983, 1984, 1985, 1986, 1987, 1988, - 1989, 1990, 1991, 1992, 1993, 1994, 2002, 1996, - 1997, 1998, 2003, 2000, 1982, 1715, 1717, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012, - 2013, 2014, 2015, 2016, 2017, 2018, 2019, 2020, - 2021, 1982, -} - -var _graphclust_trans_targs []int16 = []int16{ - 1974, 0, 1974, 1975, 15, 16, 17, 18, - 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 41, 42, - 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 66, 68, 70, - 71, 72, 1976, 69, 74, 75, 77, 78, - 79, 80, 81, 82, 83, 84, 85, 86, - 87, 88, 89, 90, 91, 93, 94, 96, - 102, 125, 130, 132, 139, 143, 97, 98, - 99, 100, 101, 103, 104, 105, 106, 107, - 108, 109, 110, 111, 112, 113, 114, 115, - 116, 117, 118, 119, 120, 121, 122, 123, - 124, 126, 127, 128, 129, 131, 133, 134, - 135, 136, 137, 138, 140, 141, 142, 144, - 291, 292, 1977, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 177, 178, - 179, 180, 181, 182, 183, 184, 185, 186, - 188, 189, 190, 191, 192, 193, 194, 195, - 196, 197, 198, 199, 200, 201, 202, 203, - 204, 205, 206, 207, 208, 210, 211, 212, - 213, 214, 216, 217, 219, 220, 221, 222, - 223, 224, 225, 226, 227, 228, 229, 230, - 231, 232, 234, 235, 237, 243, 267, 271, - 273, 280, 284, 238, 239, 240, 241, 242, - 244, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 254, 255, 256, 257, 258, 259, - 260, 261, 262, 263, 264, 265, 266, 268, - 269, 270, 272, 274, 275, 276, 277, 278, - 279, 281, 282, 283, 285, 287, 288, 289, - 145, 290, 146, 294, 295, 296, 2, 297, - 3, 1974, 1978, 1974, 1979, 315, 316, 317, - 318, 319, 320, 321, 322, 323, 324, 325, - 326, 327, 328, 329, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, - 342, 344, 345, 346, 347, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 358, - 359, 360, 361, 362, 363, 364, 366, 368, - 370, 371, 372, 1980, 369, 374, 375, 377, - 378, 379, 380, 381, 382, 383, 384, 385, - 386, 387, 388, 389, 390, 391, 393, 394, - 396, 402, 425, 430, 432, 439, 443, 397, - 398, 399, 400, 401, 403, 404, 405, 406, - 407, 408, 409, 410, 411, 412, 413, 414, - 415, 416, 417, 418, 419, 420, 421, 422, - 423, 424, 426, 427, 428, 429, 431, 433, - 434, 435, 436, 437, 438, 440, 441, 442, - 444, 591, 592, 1981, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, - 486, 488, 489, 490, 491, 492, 493, 494, - 495, 496, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 506, 507, 508, 510, 511, - 512, 513, 514, 516, 517, 519, 520, 521, - 522, 523, 524, 525, 526, 527, 528, 529, - 530, 531, 532, 534, 535, 537, 543, 567, - 571, 573, 580, 584, 538, 539, 540, 541, - 542, 544, 545, 546, 547, 548, 549, 550, - 551, 552, 553, 554, 555, 556, 557, 558, - 559, 560, 561, 562, 563, 564, 565, 566, - 568, 569, 570, 572, 574, 575, 576, 577, - 578, 579, 581, 582, 583, 585, 587, 588, - 589, 445, 590, 446, 594, 595, 596, 302, - 597, 303, 599, 605, 606, 608, 610, 613, - 616, 640, 1982, 622, 1983, 612, 1984, 615, - 618, 620, 621, 624, 625, 629, 630, 631, - 632, 633, 634, 635, 1985, 628, 639, 642, - 643, 644, 645, 646, 649, 650, 651, 652, - 653, 654, 655, 656, 660, 661, 663, 664, - 647, 666, 669, 671, 673, 667, 668, 670, - 672, 674, 678, 679, 680, 681, 682, 683, - 684, 685, 686, 687, 1986, 676, 677, 690, - 691, 299, 695, 696, 698, 997, 1000, 1003, - 1027, 1974, 1987, 1974, 1988, 712, 713, 714, - 715, 716, 717, 718, 719, 720, 721, 722, - 723, 724, 725, 726, 727, 728, 729, 730, - 731, 732, 733, 734, 735, 736, 737, 738, - 739, 741, 742, 743, 744, 745, 746, 747, - 748, 749, 750, 751, 752, 753, 754, 755, - 756, 757, 758, 759, 760, 761, 763, 765, - 767, 768, 769, 1989, 766, 771, 772, 774, - 775, 776, 777, 778, 779, 780, 781, 782, - 783, 784, 785, 786, 787, 788, 790, 791, - 793, 799, 822, 827, 829, 836, 840, 794, - 795, 796, 797, 798, 800, 801, 802, 803, - 804, 805, 806, 807, 808, 809, 810, 811, - 812, 813, 814, 815, 816, 817, 818, 819, - 820, 821, 823, 824, 825, 826, 828, 830, - 831, 832, 833, 834, 835, 837, 838, 839, - 841, 988, 989, 1990, 855, 856, 857, 858, - 859, 860, 861, 862, 863, 864, 865, 866, - 867, 868, 869, 870, 871, 872, 873, 874, - 875, 876, 877, 878, 879, 880, 881, 882, - 883, 885, 886, 887, 888, 889, 890, 891, - 892, 893, 894, 895, 896, 897, 898, 899, - 900, 901, 902, 903, 904, 905, 907, 908, - 909, 910, 911, 913, 914, 916, 917, 918, - 919, 920, 921, 922, 923, 924, 925, 926, - 927, 928, 929, 931, 932, 934, 940, 964, - 968, 970, 977, 981, 935, 936, 937, 938, - 939, 941, 942, 943, 944, 945, 946, 947, - 948, 949, 950, 951, 952, 953, 954, 955, - 956, 957, 958, 959, 960, 961, 962, 963, - 965, 966, 967, 969, 971, 972, 973, 974, - 975, 976, 978, 979, 980, 982, 984, 985, - 986, 842, 987, 843, 991, 992, 993, 699, - 994, 700, 1009, 1991, 999, 1992, 1002, 1005, - 1007, 1008, 1011, 1012, 1016, 1017, 1018, 1019, - 1020, 1021, 1022, 1993, 1015, 1026, 1029, 1327, - 1328, 1626, 1627, 1994, 1974, 1995, 1043, 1044, - 1045, 1046, 1047, 1048, 1049, 1050, 1051, 1052, - 1053, 1054, 1055, 1056, 1057, 1058, 1059, 1060, - 1061, 1062, 1063, 1064, 1065, 1066, 1067, 1068, - 1069, 1070, 1072, 1073, 1074, 1075, 1076, 1077, - 1078, 1079, 1080, 1081, 1082, 1083, 1084, 1085, - 1086, 1087, 1088, 1089, 1090, 1091, 1092, 1094, - 1095, 1096, 1097, 1098, 1100, 1101, 1103, 1104, - 1105, 1106, 1107, 1108, 1109, 1110, 1111, 1112, - 1113, 1114, 1115, 1116, 1117, 1119, 1120, 1122, - 1128, 1151, 1156, 1158, 1165, 1123, 1124, 1125, - 1126, 1127, 1129, 1130, 1131, 1132, 1133, 1134, - 1135, 1136, 1137, 1138, 1139, 1140, 1141, 1142, - 1143, 1144, 1145, 1146, 1147, 1148, 1149, 1150, - 1152, 1153, 1154, 1155, 1157, 1159, 1160, 1161, - 1162, 1163, 1164, 1166, 1167, 1168, 1170, 1171, - 1172, 1030, 1173, 1031, 1175, 1177, 1178, 1325, - 1326, 1996, 1192, 1193, 1194, 1195, 1196, 1197, - 1198, 1199, 1200, 1201, 1202, 1203, 1204, 1205, - 1206, 1207, 1208, 1209, 1210, 1211, 1212, 1213, - 1214, 1215, 1216, 1217, 1218, 1219, 1220, 1222, - 1223, 1224, 1225, 1226, 1227, 1228, 1229, 1230, - 1231, 1232, 1233, 1234, 1235, 1236, 1237, 1238, - 1239, 1240, 1241, 1242, 1244, 1245, 1246, 1247, - 1248, 1250, 1251, 1253, 1254, 1255, 1256, 1257, - 1258, 1259, 1260, 1261, 1262, 1263, 1264, 1265, - 1266, 1268, 1269, 1271, 1277, 1301, 1305, 1307, - 1314, 1318, 1272, 1273, 1274, 1275, 1276, 1278, - 1279, 1280, 1281, 1282, 1283, 1284, 1285, 1286, - 1287, 1288, 1289, 1290, 1291, 1292, 1293, 1294, - 1295, 1296, 1297, 1298, 1299, 1300, 1302, 1303, - 1304, 1306, 1308, 1309, 1310, 1311, 1312, 1313, - 1315, 1316, 1317, 1319, 1321, 1322, 1323, 1179, - 1324, 1180, 1997, 1974, 1342, 1343, 1344, 1345, - 1497, 1498, 1499, 1500, 1501, 1502, 1503, 1504, - 1505, 1506, 1507, 1508, 1509, 1510, 1511, 1512, - 1377, 1513, 1514, 1515, 1516, 1517, 1518, 1519, - 1520, 1521, 1998, 1359, 1360, 1361, 1362, 1363, - 1364, 1365, 1366, 1367, 1368, 1369, 1370, 1371, - 1372, 1373, 1374, 1375, 1376, 1378, 1379, 1380, - 1381, 1382, 1383, 1384, 1385, 1386, 1388, 1389, - 1390, 1391, 1392, 1393, 1394, 1395, 1396, 1397, - 1398, 1399, 1400, 1401, 1402, 1403, 1404, 1405, - 1406, 1407, 1408, 1410, 1412, 1414, 1415, 1416, - 1999, 1413, 1418, 1419, 1421, 1422, 1423, 1424, - 1425, 1426, 1427, 1428, 1429, 1430, 1431, 1432, - 1433, 1434, 1435, 1437, 1438, 1440, 1446, 1469, - 1474, 1476, 1483, 1487, 1441, 1442, 1443, 1444, - 1445, 1447, 1448, 1449, 1450, 1451, 1452, 1453, - 1454, 1455, 1456, 1457, 1458, 1459, 1460, 1461, - 1462, 1463, 1464, 1465, 1466, 1467, 1468, 1470, - 1471, 1472, 1473, 1475, 1477, 1478, 1479, 1480, - 1481, 1482, 1484, 1485, 1486, 1488, 1489, 1490, - 1492, 1493, 1494, 1346, 1495, 1347, 1523, 1524, - 1525, 1526, 1527, 1528, 1529, 1530, 1531, 1532, - 1533, 1534, 1535, 1536, 1537, 1538, 1539, 1540, - 1541, 1542, 1543, 1545, 1546, 1547, 1548, 1549, - 1551, 1552, 1554, 1555, 1556, 1557, 1558, 1559, - 1560, 1561, 1562, 1563, 1564, 1565, 1566, 1567, - 1569, 1570, 1572, 1578, 1602, 1606, 1608, 1615, - 1619, 1573, 1574, 1575, 1576, 1577, 1579, 1580, - 1581, 1582, 1583, 1584, 1585, 1586, 1587, 1588, - 1589, 1590, 1591, 1592, 1593, 1594, 1595, 1596, - 1597, 1598, 1599, 1600, 1601, 1603, 1604, 1605, - 1607, 1609, 1610, 1611, 1612, 1613, 1614, 1616, - 1617, 1618, 1620, 1622, 1623, 1624, 1329, 1625, - 1330, 1630, 1631, 1632, 1633, 1634, 1635, 1636, - 1637, 1641, 1642, 1643, 1644, 1645, 1647, 1648, - 1628, 1650, 1653, 1655, 1657, 1651, 1652, 1654, - 1656, 1658, 1959, 1960, 1961, 1962, 1963, 1964, - 1965, 1966, 1967, 1968, 2000, 1974, 2001, 1672, - 1673, 1674, 1675, 1676, 1677, 1678, 1679, 1680, - 1681, 1682, 1683, 1684, 1685, 1686, 1687, 1688, - 1689, 1690, 1691, 1692, 1693, 1694, 1695, 1696, - 1697, 1698, 1699, 1701, 1702, 1703, 1704, 1705, - 1706, 1707, 1708, 1709, 1710, 1711, 1712, 1713, - 1714, 1715, 1716, 1717, 1718, 1719, 1720, 1721, - 1723, 1725, 1727, 1728, 1729, 2002, 1726, 1731, - 1732, 1734, 1735, 1736, 1737, 1738, 1739, 1740, - 1741, 1742, 1743, 1744, 1745, 1746, 1747, 1748, - 1750, 1751, 1753, 1759, 1782, 1787, 1789, 1796, - 1800, 1754, 1755, 1756, 1757, 1758, 1760, 1761, - 1762, 1763, 1764, 1765, 1766, 1767, 1768, 1769, - 1770, 1771, 1772, 1773, 1774, 1775, 1776, 1777, - 1778, 1779, 1780, 1781, 1783, 1784, 1785, 1786, - 1788, 1790, 1791, 1792, 1793, 1794, 1795, 1797, - 1798, 1799, 1801, 1948, 1949, 2003, 1815, 1816, - 1817, 1818, 1819, 1820, 1821, 1822, 1823, 1824, - 1825, 1826, 1827, 1828, 1829, 1830, 1831, 1832, - 1833, 1834, 1835, 1836, 1837, 1838, 1839, 1840, - 1841, 1842, 1843, 1845, 1846, 1847, 1848, 1849, - 1850, 1851, 1852, 1853, 1854, 1855, 1856, 1857, - 1858, 1859, 1860, 1861, 1862, 1863, 1864, 1865, - 1867, 1868, 1869, 1870, 1871, 1873, 1874, 1876, - 1877, 1878, 1879, 1880, 1881, 1882, 1883, 1884, - 1885, 1886, 1887, 1888, 1889, 1891, 1892, 1894, - 1900, 1924, 1928, 1930, 1937, 1941, 1895, 1896, - 1897, 1898, 1899, 1901, 1902, 1903, 1904, 1905, - 1906, 1907, 1908, 1909, 1910, 1911, 1912, 1913, - 1914, 1915, 1916, 1917, 1918, 1919, 1920, 1921, - 1922, 1923, 1925, 1926, 1927, 1929, 1931, 1932, - 1933, 1934, 1935, 1936, 1938, 1939, 1940, 1942, - 1944, 1945, 1946, 1802, 1947, 1803, 1951, 1952, - 1953, 1659, 1954, 1660, 1957, 1958, 1971, 1972, - 1973, 1974, 1, 1975, 299, 300, 301, 692, - 693, 694, 697, 1028, 1628, 1629, 1638, 1639, - 1640, 1646, 1649, 1969, 1970, 1974, 4, 5, - 6, 7, 8, 9, 10, 11, 12, 13, - 14, 43, 65, 73, 76, 92, 298, 293, - 67, 95, 147, 148, 149, 150, 151, 152, - 153, 154, 155, 156, 157, 187, 209, 215, - 218, 233, 236, 286, 1974, 600, 601, 602, - 603, 604, 607, 641, 648, 657, 658, 659, - 662, 665, 688, 689, 304, 305, 306, 307, - 308, 309, 310, 311, 312, 313, 314, 343, - 365, 373, 376, 392, 598, 593, 367, 395, - 447, 448, 449, 450, 451, 452, 453, 454, - 455, 456, 457, 487, 509, 515, 518, 533, - 536, 586, 609, 623, 636, 637, 638, 611, - 619, 614, 617, 626, 627, 675, 1974, 701, - 702, 703, 704, 705, 706, 707, 708, 709, - 710, 711, 996, 762, 770, 1010, 1023, 1024, - 1025, 789, 995, 990, 740, 773, 764, 792, - 844, 845, 846, 847, 848, 849, 850, 851, - 852, 853, 854, 884, 906, 912, 915, 930, - 933, 983, 998, 1006, 1001, 1004, 1013, 1014, - 1974, 1032, 1033, 1034, 1035, 1036, 1037, 1038, - 1039, 1040, 1041, 1042, 1071, 1174, 1099, 1102, - 1118, 1176, 1169, 1093, 1121, 1181, 1182, 1183, - 1184, 1185, 1186, 1187, 1188, 1189, 1190, 1191, - 1221, 1243, 1249, 1252, 1267, 1270, 1320, 1974, - 1331, 1332, 1333, 1334, 1335, 1336, 1337, 1338, - 1339, 1340, 1341, 1522, 1544, 1550, 1553, 1568, - 1571, 1621, 1348, 1349, 1350, 1351, 1352, 1353, - 1354, 1355, 1356, 1357, 1358, 1387, 1409, 1417, - 1420, 1436, 1496, 1491, 1411, 1439, 1974, 1661, - 1662, 1663, 1664, 1665, 1666, 1667, 1668, 1669, - 1670, 1671, 1700, 1722, 1730, 1733, 1749, 1956, - 1950, 1955, 1724, 1752, 1804, 1805, 1806, 1807, - 1808, 1809, 1810, 1811, 1812, 1813, 1814, 1844, - 1866, 1872, 1875, 1890, 1893, 1943, -} - -var _graphclust_trans_actions []byte = []byte{ - 31, 0, 27, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 34, 40, 25, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 40, 0, 40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 29, 51, 17, 40, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 51, 0, 51, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 40, 0, 0, 0, 0, - 0, 0, 0, 40, 21, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 40, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 19, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 40, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 40, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 40, 23, 40, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 40, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 43, 1, 47, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 1, 1, 1, - 1, 1, 1, 1, 1, 15, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 13, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 5, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 9, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 7, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 11, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, -} - -var _graphclust_to_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 37, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_from_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, -} - -var _graphclust_eof_trans []int16 = []int16{ - 0, 0, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 3, 3, 0, 0, 0, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 268, 268, 268, 268, - 268, 268, 268, 268, 0, 0, 0, 0, - 0, 0, 610, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 610, 612, 612, - 610, 612, 612, 610, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 612, 612, - 612, 612, 612, 612, 612, 612, 610, 612, - 612, 612, 612, 0, 0, 0, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 901, - 901, 901, 901, 901, 901, 901, 901, 0, - 0, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 1164, 1164, 1164, 1164, 1164, 1164, - 1164, 1164, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 1462, - 1462, 1462, 1462, 1462, 1462, 1462, 1462, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1750, - 1750, 1750, 1789, 1789, 1789, 1789, 1789, 1789, - 1789, 1789, 1789, 1855, 1855, 1855, 1855, 1855, - 1855, 1855, 1905, 1905, 1905, 1944, 1944, 1944, - 1983, 1983, 1983, 1983, -} - -const graphclust_start int = 1974 -const graphclust_first_final int = 1974 -const graphclust_error int = 0 - -const graphclust_en_main int = 1974 - - -// line 14 "grapheme_clusters.rl" - - -var Error = errors.New("invalid UTF8 text") - -// ScanGraphemeClusters is a split function for bufio.Scanner that splits -// on grapheme cluster boundaries. -func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { - if len(data) == 0 { - return 0, nil, nil - } - - // Ragel state - cs := 0 // Current State - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - startPos := 0 - endPos := 0 - - -// line 4976 "grapheme_clusters.go" - { - cs = graphclust_start - ts = 0 - te = 0 - act = 0 - } - -// line 4984 "grapheme_clusters.go" - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } -_resume: - _acts = int(_graphclust_from_state_actions[cs]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts - 1] { - case 4: -// line 1 "NONE" - -ts = p - -// line 5008 "grapheme_clusters.go" - } - } - - _keys = int(_graphclust_key_offsets[cs]) - _trans = int(_graphclust_index_offsets[cs]) - - _klen = int(_graphclust_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _graphclust_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _graphclust_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_graphclust_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _graphclust_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _graphclust_trans_keys[_mid + 1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - -_match: - _trans = int(_graphclust_indicies[_trans]) -_eof_trans: - cs = int(_graphclust_trans_targs[_trans]) - - if _graphclust_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_graphclust_trans_actions[_trans]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts-1] { - case 0: -// line 46 "grapheme_clusters.rl" - - - startPos = p - - case 1: -// line 50 "grapheme_clusters.rl" - - - endPos = p - - case 5: -// line 1 "NONE" - -te = p+1 - - case 6: -// line 54 "grapheme_clusters.rl" - -act = 3; - case 7: -// line 54 "grapheme_clusters.rl" - -te = p+1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 8: -// line 54 "grapheme_clusters.rl" - -te = p+1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 9: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 10: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 11: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 12: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 13: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 14: -// line 54 "grapheme_clusters.rl" - -te = p -p-- -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 15: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 16: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 17: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 18: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 19: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 20: -// line 54 "grapheme_clusters.rl" - -p = (te) - 1 -{ - return endPos+1, data[startPos:endPos+1], nil - } - case 21: -// line 1 "NONE" - - switch act { - case 0: - {cs = 0 -goto _again -} - case 3: - {p = (te) - 1 - - return endPos+1, data[startPos:endPos+1], nil - } - } - -// line 5218 "grapheme_clusters.go" - } - } - -_again: - _acts = int(_graphclust_to_state_actions[cs]) - _nacts = uint(_graphclust_actions[_acts]); _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _graphclust_actions[_acts-1] { - case 2: -// line 1 "NONE" - -ts = 0 - - case 3: -// line 1 "NONE" - -act = 0 - -// line 5238 "grapheme_clusters.go" - } - } - - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: {} - if p == eof { - if _graphclust_eof_trans[cs] > 0 { - _trans = int(_graphclust_eof_trans[cs] - 1) - goto _eof_trans - } - } - - _out: {} - } - -// line 116 "grapheme_clusters.rl" - - - // If we fall out here then we were unable to complete a sequence. - // If we weren't able to complete a sequence then either we've - // reached the end of a partial buffer (so there's more data to come) - // or we have an isolated symbol that would normally be part of a - // grapheme cluster but has appeared in isolation here. - - if !atEOF { - // Request more - return 0, nil, nil - } - - // Just take the first UTF-8 sequence and return that. - _, seqLen := utf8.DecodeRune(data) - return seqLen, data[:seqLen], nil -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl b/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl deleted file mode 100644 index 003ffbf..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters.rl +++ /dev/null @@ -1,132 +0,0 @@ -package textseg - -import ( - "errors" - "unicode/utf8" -) - -// Generated from grapheme_clusters.rl. DO NOT EDIT -%%{ - # (except you are actually in grapheme_clusters.rl here, so edit away!) - - machine graphclust; - write data; -}%% - -var Error = errors.New("invalid UTF8 text") - -// ScanGraphemeClusters is a split function for bufio.Scanner that splits -// on grapheme cluster boundaries. -func ScanGraphemeClusters(data []byte, atEOF bool) (int, []byte, error) { - if len(data) == 0 { - return 0, nil, nil - } - - // Ragel state - cs := 0 // Current State - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - startPos := 0 - endPos := 0 - - %%{ - include GraphemeCluster "grapheme_clusters_table.rl"; - - action start { - startPos = p - } - - action end { - endPos = p - } - - action emit { - return endPos+1, data[startPos:endPos+1], nil - } - - ZWJGlue = ZWJ (Glue_After_Zwj | E_Base_GAZ Extend* E_Modifier?)?; - AnyExtender = Extend | ZWJGlue | SpacingMark; - Extension = AnyExtender*; - ReplacementChar = (0xEF 0xBF 0xBD); - - CRLFSeq = CR LF; - ControlSeq = Control | ReplacementChar; - HangulSeq = ( - L+ (((LV? V+ | LVT) T*)?|LV?) | - LV V* T* | - V+ T* | - LVT T* | - T+ - ) Extension; - EmojiSeq = (E_Base | E_Base_GAZ) Extend* E_Modifier? Extension; - ZWJSeq = ZWJGlue Extension; - EmojiFlagSeq = Regional_Indicator Regional_Indicator? Extension; - - UTF8Cont = 0x80 .. 0xBF; - AnyUTF8 = ( - 0x00..0x7F | - 0xC0..0xDF . UTF8Cont | - 0xE0..0xEF . UTF8Cont . UTF8Cont | - 0xF0..0xF7 . UTF8Cont . UTF8Cont . UTF8Cont - ); - - # OtherSeq is any character that isn't at the start of one of the extended sequences above, followed by extension - OtherSeq = (AnyUTF8 - (CR|LF|Control|ReplacementChar|L|LV|V|LVT|T|E_Base|E_Base_GAZ|ZWJ|Regional_Indicator|Prepend)) Extension; - - # PrependSeq is prepend followed by any of the other patterns above, except control characters which explicitly break - PrependSeq = Prepend+ (HangulSeq|EmojiSeq|ZWJSeq|EmojiFlagSeq|OtherSeq)?; - - CRLFTok = CRLFSeq >start @end; - ControlTok = ControlSeq >start @end; - HangulTok = HangulSeq >start @end; - EmojiTok = EmojiSeq >start @end; - ZWJTok = ZWJSeq >start @end; - EmojiFlagTok = EmojiFlagSeq >start @end; - OtherTok = OtherSeq >start @end; - PrependTok = PrependSeq >start @end; - - main := |* - CRLFTok => emit; - ControlTok => emit; - HangulTok => emit; - EmojiTok => emit; - ZWJTok => emit; - EmojiFlagTok => emit; - PrependTok => emit; - OtherTok => emit; - - # any single valid UTF-8 character would also be valid per spec, - # but we'll handle that separately after the loop so we can deal - # with requesting more bytes if we're not at EOF. - *|; - - write init; - write exec; - }%% - - // If we fall out here then we were unable to complete a sequence. - // If we weren't able to complete a sequence then either we've - // reached the end of a partial buffer (so there's more data to come) - // or we have an isolated symbol that would normally be part of a - // grapheme cluster but has appeared in isolation here. - - if !atEOF { - // Request more - return 0, nil, nil - } - - // Just take the first UTF-8 sequence and return that. - _, seqLen := utf8.DecodeRune(data) - return seqLen, data[:seqLen], nil -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl b/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl deleted file mode 100644 index fb45118..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/grapheme_clusters_table.rl +++ /dev/null @@ -1,1583 +0,0 @@ -# The following Ragel file was autogenerated with unicode2ragel.rb -# from: http://www.unicode.org/Public/9.0.0/ucd/auxiliary/GraphemeBreakProperty.txt -# -# It defines ["Prepend", "CR", "LF", "Control", "Extend", "Regional_Indicator", "SpacingMark", "L", "V", "T", "LV", "LVT", "E_Base", "E_Modifier", "ZWJ", "Glue_After_Zwj", "E_Base_GAZ"]. -# -# To use this, make sure that your alphtype is set to byte, -# and that your input is in utf8. - -%%{ - machine GraphemeCluster; - - Prepend = - 0xD8 0x80..0x85 #Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER ... - | 0xDB 0x9D #Cf ARABIC END OF AYAH - | 0xDC 0x8F #Cf SYRIAC ABBREVIATION MARK - | 0xE0 0xA3 0xA2 #Cf ARABIC DISPUTED END OF AYAH - | 0xE0 0xB5 0x8E #Lo MALAYALAM LETTER DOT REPH - | 0xF0 0x91 0x82 0xBD #Cf KAITHI NUMBER SIGN - | 0xF0 0x91 0x87 0x82..0x83 #Lo [2] SHARADA SIGN JIHVAMULIYA..SHARA... - ; - - CR = - 0x0D #Cc - ; - - LF = - 0x0A #Cc - ; - - Control = - 0x00..0x09 #Cc [10] .. - | 0x0B..0x0C #Cc [2] .. - | 0x0E..0x1F #Cc [18] .. - | 0x7F #Cc [33] .. - | 0xC2 0x80..0x9F # - | 0xC2 0xAD #Cf SOFT HYPHEN - | 0xD8 0x9C #Cf ARABIC LETTER MARK - | 0xE1 0xA0 0x8E #Cf MONGOLIAN VOWEL SEPARATOR - | 0xE2 0x80 0x8B #Cf ZERO WIDTH SPACE - | 0xE2 0x80 0x8E..0x8F #Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT ... - | 0xE2 0x80 0xA8 #Zl LINE SEPARATOR - | 0xE2 0x80 0xA9 #Zp PARAGRAPH SEPARATOR - | 0xE2 0x80 0xAA..0xAE #Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-... - | 0xE2 0x81 0xA0..0xA4 #Cf [5] WORD JOINER..INVISIBLE PLUS - | 0xE2 0x81 0xA5 #Cn - | 0xE2 0x81 0xA6..0xAF #Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIG... - | 0xED 0xA0 0x80..0xFF #Cs [2048] .... - | 0xEF 0xBF 0xB9..0xBB #Cf [3] INTERLINEAR ANNOTATION ANCHOR..INT... - | 0xF0 0x9B 0xB2 0xA0..0xA3 #Cf [4] SHORTHAND FORMAT LETTER OVERLAP... - | 0xF0 0x9D 0x85 0xB3..0xBA #Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSI... - | 0xF3 0xA0 0x80 0x80 #Cn - | 0xF3 0xA0 0x80 0x81 #Cf LANGUAGE TAG - | 0xF3 0xA0 0x80 0x82..0x9F #Cn [30] .. - | 0xF3 0xA0 0x82 0x80..0xFF #Cn [128] .. - | 0xF3 0xA0 0x83 0x00..0xBF # - | 0xF3 0xA0 0x87 0xB0..0xFF #Cn [3600] .. 0 { - r, size := utf8.DecodeRune(buf) - runes = append(runes, fmt.Sprintf("0x%04x", r)) - seqs = append(seqs, buf[:size]) - categories = append(categories, _GraphemeRuneType(r).String()) - buf = buf[size:] - } - - t.Errorf( - "wrong result\ninput: %s\nutf8s: %s\nrunes: %s\ncats: %s\ngot: %s\nwant: %s", - formatBytes(test.input), - formatByteRanges(seqs), - strings.Join(runes, " "), - strings.Join(categories, " "), - formatByteRanges(got), - formatByteRanges(test.output), - ) - } - }) - } -} - -func formatBytes(buf []byte) string { - strs := make([]string, len(buf)) - for i, b := range buf { - strs[i] = fmt.Sprintf("0x%02x", b) - } - return strings.Join(strs, " ") -} - -func formatByteRanges(bufs [][]byte) string { - strs := make([]string, len(bufs)) - for i, b := range bufs { - strs[i] = formatBytes(b) - } - return strings.Join(strs, " | ") -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/make_tables.go b/vendor/github.com/apparentlymart/go-textseg/textseg/make_tables.go deleted file mode 100644 index aad3d05..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/make_tables.go +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright (c) 2014 Couchbase, 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. - -// Modified by Martin Atkins to serve the needs of package textseg. - -// +build ignore - -package main - -import ( - "bufio" - "flag" - "fmt" - "io" - "log" - "net/http" - "os" - "os/exec" - "sort" - "strconv" - "strings" - "unicode" -) - -var url = flag.String("url", - "http://www.unicode.org/Public/"+unicode.Version+"/ucd/auxiliary/", - "URL of Unicode database directory") -var verbose = flag.Bool("verbose", - false, - "write data to stdout as it is parsed") -var localFiles = flag.Bool("local", - false, - "data files have been copied to the current directory; for debugging only") -var outputFile = flag.String("output", - "", - "output file for generated tables; default stdout") - -var output *bufio.Writer - -func main() { - flag.Parse() - setupOutput() - - graphemePropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("GraphemeBreakProperty.txt", graphemePropertyRanges) - wordPropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("WordBreakProperty.txt", wordPropertyRanges) - sentencePropertyRanges := make(map[string]*unicode.RangeTable) - loadUnicodeData("SentenceBreakProperty.txt", sentencePropertyRanges) - - fmt.Fprintf(output, fileHeader, *url) - generateTables("Grapheme", graphemePropertyRanges) - generateTables("Word", wordPropertyRanges) - generateTables("Sentence", sentencePropertyRanges) - - flushOutput() -} - -// WordBreakProperty.txt has the form: -// 05F0..05F2 ; Hebrew_Letter # Lo [3] HEBREW LIGATURE YIDDISH DOUBLE VAV..HEBREW LIGATURE YIDDISH DOUBLE YOD -// FB1D ; Hebrew_Letter # Lo HEBREW LETTER YOD WITH HIRIQ -func openReader(file string) (input io.ReadCloser) { - if *localFiles { - f, err := os.Open(file) - if err != nil { - log.Fatal(err) - } - input = f - } else { - path := *url + file - resp, err := http.Get(path) - if err != nil { - log.Fatal(err) - } - if resp.StatusCode != 200 { - log.Fatal("bad GET status for "+file, resp.Status) - } - input = resp.Body - } - return -} - -func loadUnicodeData(filename string, propertyRanges map[string]*unicode.RangeTable) { - f := openReader(filename) - defer f.Close() - bufioReader := bufio.NewReader(f) - line, err := bufioReader.ReadString('\n') - for err == nil { - parseLine(line, propertyRanges) - line, err = bufioReader.ReadString('\n') - } - // if the err was EOF still need to process last value - if err == io.EOF { - parseLine(line, propertyRanges) - } -} - -const comment = "#" -const sep = ";" -const rnge = ".." - -func parseLine(line string, propertyRanges map[string]*unicode.RangeTable) { - if strings.HasPrefix(line, comment) { - return - } - line = strings.TrimSpace(line) - if len(line) == 0 { - return - } - commentStart := strings.Index(line, comment) - if commentStart > 0 { - line = line[0:commentStart] - } - pieces := strings.Split(line, sep) - if len(pieces) != 2 { - log.Printf("unexpected %d pieces in %s", len(pieces), line) - return - } - - propertyName := strings.TrimSpace(pieces[1]) - - rangeTable, ok := propertyRanges[propertyName] - if !ok { - rangeTable = &unicode.RangeTable{ - LatinOffset: 0, - } - propertyRanges[propertyName] = rangeTable - } - - codepointRange := strings.TrimSpace(pieces[0]) - rngeIndex := strings.Index(codepointRange, rnge) - - if rngeIndex < 0 { - // single codepoint, not range - codepointInt, err := strconv.ParseUint(codepointRange, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - if codepointInt < 0x10000 { - r16 := unicode.Range16{ - Lo: uint16(codepointInt), - Hi: uint16(codepointInt), - Stride: 1, - } - addR16ToTable(rangeTable, r16) - } else { - r32 := unicode.Range32{ - Lo: uint32(codepointInt), - Hi: uint32(codepointInt), - Stride: 1, - } - addR32ToTable(rangeTable, r32) - } - } else { - rngeStart := codepointRange[0:rngeIndex] - rngeEnd := codepointRange[rngeIndex+2:] - rngeStartInt, err := strconv.ParseUint(rngeStart, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - rngeEndInt, err := strconv.ParseUint(rngeEnd, 16, 64) - if err != nil { - log.Printf("error parsing int: %v", err) - return - } - if rngeStartInt < 0x10000 && rngeEndInt < 0x10000 { - r16 := unicode.Range16{ - Lo: uint16(rngeStartInt), - Hi: uint16(rngeEndInt), - Stride: 1, - } - addR16ToTable(rangeTable, r16) - } else if rngeStartInt >= 0x10000 && rngeEndInt >= 0x10000 { - r32 := unicode.Range32{ - Lo: uint32(rngeStartInt), - Hi: uint32(rngeEndInt), - Stride: 1, - } - addR32ToTable(rangeTable, r32) - } else { - log.Printf("unexpected range") - } - } -} - -func addR16ToTable(r *unicode.RangeTable, r16 unicode.Range16) { - if r.R16 == nil { - r.R16 = make([]unicode.Range16, 0, 1) - } - r.R16 = append(r.R16, r16) - if r16.Hi <= unicode.MaxLatin1 { - r.LatinOffset++ - } -} - -func addR32ToTable(r *unicode.RangeTable, r32 unicode.Range32) { - if r.R32 == nil { - r.R32 = make([]unicode.Range32, 0, 1) - } - r.R32 = append(r.R32, r32) -} - -func generateTables(prefix string, propertyRanges map[string]*unicode.RangeTable) { - prNames := make([]string, 0, len(propertyRanges)) - for k := range propertyRanges { - prNames = append(prNames, k) - } - sort.Strings(prNames) - for _, key := range prNames { - rt := propertyRanges[key] - fmt.Fprintf(output, "var _%s%s = %s\n", prefix, key, generateRangeTable(rt)) - } - fmt.Fprintf(output, "type _%sRuneRange unicode.RangeTable\n", prefix) - - fmt.Fprintf(output, "func _%sRuneType(r rune) *_%sRuneRange {\n", prefix, prefix) - fmt.Fprintf(output, "\tswitch {\n") - for _, key := range prNames { - fmt.Fprintf(output, "\tcase unicode.Is(_%s%s, r):\n\t\treturn (*_%sRuneRange)(_%s%s)\n", prefix, key, prefix, prefix, key) - } - fmt.Fprintf(output, "\tdefault:\n\t\treturn nil\n") - fmt.Fprintf(output, "\t}\n") - fmt.Fprintf(output, "}\n") - - fmt.Fprintf(output, "func (rng *_%sRuneRange) String() string {\n", prefix) - fmt.Fprintf(output, "\tswitch (*unicode.RangeTable)(rng) {\n") - for _, key := range prNames { - fmt.Fprintf(output, "\tcase _%s%s:\n\t\treturn %q\n", prefix, key, key) - } - fmt.Fprintf(output, "\tdefault:\n\t\treturn \"Other\"\n") - fmt.Fprintf(output, "\t}\n") - fmt.Fprintf(output, "}\n") -} - -func generateRangeTable(rt *unicode.RangeTable) string { - rv := "&unicode.RangeTable{\n" - if rt.R16 != nil { - rv += "\tR16: []unicode.Range16{\n" - for _, r16 := range rt.R16 { - rv += fmt.Sprintf("\t\t%#v,\n", r16) - } - rv += "\t},\n" - } - if rt.R32 != nil { - rv += "\tR32: []unicode.Range32{\n" - for _, r32 := range rt.R32 { - rv += fmt.Sprintf("\t\t%#v,\n", r32) - } - rv += "\t},\n" - } - rv += fmt.Sprintf("\t\tLatinOffset: %d,\n", rt.LatinOffset) - rv += "}\n" - return rv -} - -const fileHeader = `// Generated by running -// maketables --url=%s -// DO NOT EDIT - -package textseg - -import( - "unicode" -) -` - -func setupOutput() { - output = bufio.NewWriter(startGofmt()) -} - -// startGofmt connects output to a gofmt process if -output is set. -func startGofmt() io.Writer { - if *outputFile == "" { - return os.Stdout - } - stdout, err := os.Create(*outputFile) - if err != nil { - log.Fatal(err) - } - // Pipe output to gofmt. - gofmt := exec.Command("gofmt") - fd, err := gofmt.StdinPipe() - if err != nil { - log.Fatal(err) - } - gofmt.Stdout = stdout - gofmt.Stderr = os.Stderr - err = gofmt.Start() - if err != nil { - log.Fatal(err) - } - return fd -} - -func flushOutput() { - err := output.Flush() - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/make_test_tables.go b/vendor/github.com/apparentlymart/go-textseg/textseg/make_test_tables.go deleted file mode 100644 index ac42002..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/make_test_tables.go +++ /dev/null @@ -1,212 +0,0 @@ -// Copyright (c) 2014 Couchbase, 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. - -// +build ignore - -package main - -import ( - "bufio" - "bytes" - "flag" - "fmt" - "io" - "log" - "net/http" - "os" - "os/exec" - "strconv" - "strings" - "unicode" -) - -var url = flag.String("url", - "http://www.unicode.org/Public/"+unicode.Version+"/ucd/auxiliary/", - "URL of Unicode database directory") -var verbose = flag.Bool("verbose", - false, - "write data to stdout as it is parsed") -var localFiles = flag.Bool("local", - false, - "data files have been copied to the current directory; for debugging only") - -var outputFile = flag.String("output", - "", - "output file for generated tables; default stdout") - -var output *bufio.Writer - -func main() { - flag.Parse() - setupOutput() - - graphemeTests := make([]test, 0) - graphemeTests = loadUnicodeData("GraphemeBreakTest.txt", graphemeTests) - wordTests := make([]test, 0) - wordTests = loadUnicodeData("WordBreakTest.txt", wordTests) - sentenceTests := make([]test, 0) - sentenceTests = loadUnicodeData("SentenceBreakTest.txt", sentenceTests) - - fmt.Fprintf(output, fileHeader, *url) - generateTestTables("Grapheme", graphemeTests) - generateTestTables("Word", wordTests) - generateTestTables("Sentence", sentenceTests) - - flushOutput() -} - -// WordBreakProperty.txt has the form: -// 05F0..05F2 ; Hebrew_Letter # Lo [3] HEBREW LIGATURE YIDDISH DOUBLE VAV..HEBREW LIGATURE YIDDISH DOUBLE YOD -// FB1D ; Hebrew_Letter # Lo HEBREW LETTER YOD WITH HIRIQ -func openReader(file string) (input io.ReadCloser) { - if *localFiles { - f, err := os.Open(file) - if err != nil { - log.Fatal(err) - } - input = f - } else { - path := *url + file - resp, err := http.Get(path) - if err != nil { - log.Fatal(err) - } - if resp.StatusCode != 200 { - log.Fatal("bad GET status for "+file, resp.Status) - } - input = resp.Body - } - return -} - -func loadUnicodeData(filename string, tests []test) []test { - f := openReader(filename) - defer f.Close() - bufioReader := bufio.NewReader(f) - line, err := bufioReader.ReadString('\n') - for err == nil { - tests = parseLine(line, tests) - line, err = bufioReader.ReadString('\n') - } - // if the err was EOF still need to process last value - if err == io.EOF { - tests = parseLine(line, tests) - } - return tests -} - -const comment = "#" -const brk = "÷" -const nbrk = "×" - -type test [][]byte - -func parseLine(line string, tests []test) []test { - if strings.HasPrefix(line, comment) { - return tests - } - line = strings.TrimSpace(line) - if len(line) == 0 { - return tests - } - commentStart := strings.Index(line, comment) - if commentStart > 0 { - line = line[0:commentStart] - } - pieces := strings.Split(line, brk) - t := make(test, 0) - for _, piece := range pieces { - piece = strings.TrimSpace(piece) - if len(piece) > 0 { - codePoints := strings.Split(piece, nbrk) - word := "" - for _, codePoint := range codePoints { - codePoint = strings.TrimSpace(codePoint) - r, err := strconv.ParseInt(codePoint, 16, 64) - if err != nil { - log.Printf("err: %v for '%s'", err, string(r)) - return tests - } - - word += string(r) - } - t = append(t, []byte(word)) - } - } - tests = append(tests, t) - return tests -} - -func generateTestTables(prefix string, tests []test) { - fmt.Fprintf(output, testHeader, prefix) - for _, t := range tests { - fmt.Fprintf(output, "\t\t{\n") - fmt.Fprintf(output, "\t\t\tinput: %#v,\n", bytes.Join(t, []byte{})) - fmt.Fprintf(output, "\t\t\toutput: %s,\n", generateTest(t)) - fmt.Fprintf(output, "\t\t},\n") - } - fmt.Fprintf(output, "}\n") -} - -func generateTest(t test) string { - rv := "[][]byte{" - for _, te := range t { - rv += fmt.Sprintf("%#v,", te) - } - rv += "}" - return rv -} - -const fileHeader = `// Generated by running -// maketesttables --url=%s -// DO NOT EDIT - -package textseg -` - -const testHeader = `var unicode%sTests = []struct { - input []byte - output [][]byte - }{ -` - -func setupOutput() { - output = bufio.NewWriter(startGofmt()) -} - -// startGofmt connects output to a gofmt process if -output is set. -func startGofmt() io.Writer { - if *outputFile == "" { - return os.Stdout - } - stdout, err := os.Create(*outputFile) - if err != nil { - log.Fatal(err) - } - // Pipe output to gofmt. - gofmt := exec.Command("gofmt") - fd, err := gofmt.StdinPipe() - if err != nil { - log.Fatal(err) - } - gofmt.Stdout = stdout - gofmt.Stderr = os.Stderr - err = gofmt.Start() - if err != nil { - log.Fatal(err) - } - return fd -} - -func flushOutput() { - err := output.Flush() - if err != nil { - log.Fatal(err) - } -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go b/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go deleted file mode 100644 index fab7e84..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/tables.go +++ /dev/null @@ -1,5700 +0,0 @@ -// Generated by running -// maketables --url=http://www.unicode.org/Public/9.0.0/ucd/auxiliary/ -// DO NOT EDIT - -package textseg - -import ( - "unicode" -) - -var _GraphemeCR = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xd, Hi: 0xd, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _GraphemeControl = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x0, Hi: 0x9, Stride: 0x1}, - unicode.Range16{Lo: 0xb, Hi: 0xc, Stride: 0x1}, - unicode.Range16{Lo: 0xe, Hi: 0x1f, Stride: 0x1}, - unicode.Range16{Lo: 0x7f, Hi: 0x9f, Stride: 0x1}, - unicode.Range16{Lo: 0xad, Hi: 0xad, Stride: 0x1}, - unicode.Range16{Lo: 0x61c, Hi: 0x61c, Stride: 0x1}, - unicode.Range16{Lo: 0x180e, Hi: 0x180e, Stride: 0x1}, - unicode.Range16{Lo: 0x200b, Hi: 0x200b, Stride: 0x1}, - unicode.Range16{Lo: 0x200e, Hi: 0x200f, Stride: 0x1}, - unicode.Range16{Lo: 0x2028, Hi: 0x2028, Stride: 0x1}, - unicode.Range16{Lo: 0x2029, Hi: 0x2029, Stride: 0x1}, - unicode.Range16{Lo: 0x202a, Hi: 0x202e, Stride: 0x1}, - unicode.Range16{Lo: 0x2060, Hi: 0x2064, Stride: 0x1}, - unicode.Range16{Lo: 0x2065, Hi: 0x2065, Stride: 0x1}, - unicode.Range16{Lo: 0x2066, Hi: 0x206f, Stride: 0x1}, - unicode.Range16{Lo: 0xd800, Hi: 0xdfff, Stride: 0x1}, - unicode.Range16{Lo: 0xfeff, Hi: 0xfeff, Stride: 0x1}, - unicode.Range16{Lo: 0xfff0, Hi: 0xfff8, Stride: 0x1}, - unicode.Range16{Lo: 0xfff9, Hi: 0xfffb, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0000, Hi: 0xe0000, Stride: 0x1}, - unicode.Range32{Lo: 0xe0001, Hi: 0xe0001, Stride: 0x1}, - unicode.Range32{Lo: 0xe0002, Hi: 0xe001f, Stride: 0x1}, - unicode.Range32{Lo: 0xe0080, Hi: 0xe00ff, Stride: 0x1}, - unicode.Range32{Lo: 0xe01f0, Hi: 0xe0fff, Stride: 0x1}, - }, - LatinOffset: 5, -} - -var _GraphemeE_Base = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x261d, Hi: 0x261d, Stride: 0x1}, - unicode.Range16{Lo: 0x26f9, Hi: 0x26f9, Stride: 0x1}, - unicode.Range16{Lo: 0x270a, Hi: 0x270d, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f385, Hi: 0x1f385, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3c3, Hi: 0x1f3c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3ca, Hi: 0x1f3cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1f442, Hi: 0x1f443, Stride: 0x1}, - unicode.Range32{Lo: 0x1f446, Hi: 0x1f450, Stride: 0x1}, - unicode.Range32{Lo: 0x1f46e, Hi: 0x1f46e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f470, Hi: 0x1f478, Stride: 0x1}, - unicode.Range32{Lo: 0x1f47c, Hi: 0x1f47c, Stride: 0x1}, - unicode.Range32{Lo: 0x1f481, Hi: 0x1f483, Stride: 0x1}, - unicode.Range32{Lo: 0x1f485, Hi: 0x1f487, Stride: 0x1}, - unicode.Range32{Lo: 0x1f4aa, Hi: 0x1f4aa, Stride: 0x1}, - unicode.Range32{Lo: 0x1f575, Hi: 0x1f575, Stride: 0x1}, - unicode.Range32{Lo: 0x1f57a, Hi: 0x1f57a, Stride: 0x1}, - unicode.Range32{Lo: 0x1f590, Hi: 0x1f590, Stride: 0x1}, - unicode.Range32{Lo: 0x1f595, Hi: 0x1f596, Stride: 0x1}, - unicode.Range32{Lo: 0x1f645, Hi: 0x1f647, Stride: 0x1}, - unicode.Range32{Lo: 0x1f64b, Hi: 0x1f64f, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6a3, Hi: 0x1f6a3, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6b4, Hi: 0x1f6b6, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6c0, Hi: 0x1f6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1f918, Hi: 0x1f91e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f926, Hi: 0x1f926, Stride: 0x1}, - unicode.Range32{Lo: 0x1f930, Hi: 0x1f930, Stride: 0x1}, - unicode.Range32{Lo: 0x1f933, Hi: 0x1f939, Stride: 0x1}, - unicode.Range32{Lo: 0x1f93c, Hi: 0x1f93e, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeE_Base_GAZ = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f466, Hi: 0x1f469, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeE_Modifier = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeExtend = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x300, Hi: 0x36f, Stride: 0x1}, - unicode.Range16{Lo: 0x483, Hi: 0x487, Stride: 0x1}, - unicode.Range16{Lo: 0x488, Hi: 0x489, Stride: 0x1}, - unicode.Range16{Lo: 0x591, Hi: 0x5bd, Stride: 0x1}, - unicode.Range16{Lo: 0x5bf, Hi: 0x5bf, Stride: 0x1}, - unicode.Range16{Lo: 0x5c1, Hi: 0x5c2, Stride: 0x1}, - unicode.Range16{Lo: 0x5c4, Hi: 0x5c5, Stride: 0x1}, - unicode.Range16{Lo: 0x5c7, Hi: 0x5c7, Stride: 0x1}, - unicode.Range16{Lo: 0x610, Hi: 0x61a, Stride: 0x1}, - unicode.Range16{Lo: 0x64b, Hi: 0x65f, Stride: 0x1}, - unicode.Range16{Lo: 0x670, Hi: 0x670, Stride: 0x1}, - unicode.Range16{Lo: 0x6d6, Hi: 0x6dc, Stride: 0x1}, - unicode.Range16{Lo: 0x6df, Hi: 0x6e4, Stride: 0x1}, - unicode.Range16{Lo: 0x6e7, Hi: 0x6e8, Stride: 0x1}, - unicode.Range16{Lo: 0x6ea, Hi: 0x6ed, Stride: 0x1}, - unicode.Range16{Lo: 0x711, Hi: 0x711, Stride: 0x1}, - unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, - unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, - unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, - unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, - unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, - unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, - unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, - unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, - unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, - unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, - unicode.Range16{Lo: 0x93c, Hi: 0x93c, Stride: 0x1}, - unicode.Range16{Lo: 0x941, Hi: 0x948, Stride: 0x1}, - unicode.Range16{Lo: 0x94d, Hi: 0x94d, Stride: 0x1}, - unicode.Range16{Lo: 0x951, Hi: 0x957, Stride: 0x1}, - unicode.Range16{Lo: 0x962, Hi: 0x963, Stride: 0x1}, - unicode.Range16{Lo: 0x981, Hi: 0x981, Stride: 0x1}, - unicode.Range16{Lo: 0x9bc, Hi: 0x9bc, Stride: 0x1}, - unicode.Range16{Lo: 0x9be, Hi: 0x9be, Stride: 0x1}, - unicode.Range16{Lo: 0x9c1, Hi: 0x9c4, Stride: 0x1}, - unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, - unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, - unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, - unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, - unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, - unicode.Range16{Lo: 0xa41, Hi: 0xa42, Stride: 0x1}, - unicode.Range16{Lo: 0xa47, Hi: 0xa48, Stride: 0x1}, - unicode.Range16{Lo: 0xa4b, Hi: 0xa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xa51, Hi: 0xa51, Stride: 0x1}, - unicode.Range16{Lo: 0xa70, Hi: 0xa71, Stride: 0x1}, - unicode.Range16{Lo: 0xa75, Hi: 0xa75, Stride: 0x1}, - unicode.Range16{Lo: 0xa81, Hi: 0xa82, Stride: 0x1}, - unicode.Range16{Lo: 0xabc, Hi: 0xabc, Stride: 0x1}, - unicode.Range16{Lo: 0xac1, Hi: 0xac5, Stride: 0x1}, - unicode.Range16{Lo: 0xac7, Hi: 0xac8, Stride: 0x1}, - unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, - unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, - unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, - unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, - unicode.Range16{Lo: 0xb3e, Hi: 0xb3e, Stride: 0x1}, - unicode.Range16{Lo: 0xb3f, Hi: 0xb3f, Stride: 0x1}, - unicode.Range16{Lo: 0xb41, Hi: 0xb44, Stride: 0x1}, - unicode.Range16{Lo: 0xb4d, Hi: 0xb4d, Stride: 0x1}, - unicode.Range16{Lo: 0xb56, Hi: 0xb56, Stride: 0x1}, - unicode.Range16{Lo: 0xb57, Hi: 0xb57, Stride: 0x1}, - unicode.Range16{Lo: 0xb62, Hi: 0xb63, Stride: 0x1}, - unicode.Range16{Lo: 0xb82, Hi: 0xb82, Stride: 0x1}, - unicode.Range16{Lo: 0xbbe, Hi: 0xbbe, Stride: 0x1}, - unicode.Range16{Lo: 0xbc0, Hi: 0xbc0, Stride: 0x1}, - unicode.Range16{Lo: 0xbcd, Hi: 0xbcd, Stride: 0x1}, - unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, - unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, - unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, - unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, - unicode.Range16{Lo: 0xc4a, Hi: 0xc4d, Stride: 0x1}, - unicode.Range16{Lo: 0xc55, Hi: 0xc56, Stride: 0x1}, - unicode.Range16{Lo: 0xc62, Hi: 0xc63, Stride: 0x1}, - unicode.Range16{Lo: 0xc81, Hi: 0xc81, Stride: 0x1}, - unicode.Range16{Lo: 0xcbc, Hi: 0xcbc, Stride: 0x1}, - unicode.Range16{Lo: 0xcbf, Hi: 0xcbf, Stride: 0x1}, - unicode.Range16{Lo: 0xcc2, Hi: 0xcc2, Stride: 0x1}, - unicode.Range16{Lo: 0xcc6, Hi: 0xcc6, Stride: 0x1}, - unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, - unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, - unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, - unicode.Range16{Lo: 0xd3e, Hi: 0xd3e, Stride: 0x1}, - unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, - unicode.Range16{Lo: 0xd4d, Hi: 0xd4d, Stride: 0x1}, - unicode.Range16{Lo: 0xd57, Hi: 0xd57, Stride: 0x1}, - unicode.Range16{Lo: 0xd62, Hi: 0xd63, Stride: 0x1}, - unicode.Range16{Lo: 0xdca, Hi: 0xdca, Stride: 0x1}, - unicode.Range16{Lo: 0xdcf, Hi: 0xdcf, Stride: 0x1}, - unicode.Range16{Lo: 0xdd2, Hi: 0xdd4, Stride: 0x1}, - unicode.Range16{Lo: 0xdd6, Hi: 0xdd6, Stride: 0x1}, - unicode.Range16{Lo: 0xddf, Hi: 0xddf, Stride: 0x1}, - unicode.Range16{Lo: 0xe31, Hi: 0xe31, Stride: 0x1}, - unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, - unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, - unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, - unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, - unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, - unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, - unicode.Range16{Lo: 0xf37, Hi: 0xf37, Stride: 0x1}, - unicode.Range16{Lo: 0xf39, Hi: 0xf39, Stride: 0x1}, - unicode.Range16{Lo: 0xf71, Hi: 0xf7e, Stride: 0x1}, - unicode.Range16{Lo: 0xf80, Hi: 0xf84, Stride: 0x1}, - unicode.Range16{Lo: 0xf86, Hi: 0xf87, Stride: 0x1}, - unicode.Range16{Lo: 0xf8d, Hi: 0xf97, Stride: 0x1}, - unicode.Range16{Lo: 0xf99, Hi: 0xfbc, Stride: 0x1}, - unicode.Range16{Lo: 0xfc6, Hi: 0xfc6, Stride: 0x1}, - unicode.Range16{Lo: 0x102d, Hi: 0x1030, Stride: 0x1}, - unicode.Range16{Lo: 0x1032, Hi: 0x1037, Stride: 0x1}, - unicode.Range16{Lo: 0x1039, Hi: 0x103a, Stride: 0x1}, - unicode.Range16{Lo: 0x103d, Hi: 0x103e, Stride: 0x1}, - unicode.Range16{Lo: 0x1058, Hi: 0x1059, Stride: 0x1}, - unicode.Range16{Lo: 0x105e, Hi: 0x1060, Stride: 0x1}, - unicode.Range16{Lo: 0x1071, Hi: 0x1074, Stride: 0x1}, - unicode.Range16{Lo: 0x1082, Hi: 0x1082, Stride: 0x1}, - unicode.Range16{Lo: 0x1085, Hi: 0x1086, Stride: 0x1}, - unicode.Range16{Lo: 0x108d, Hi: 0x108d, Stride: 0x1}, - unicode.Range16{Lo: 0x109d, Hi: 0x109d, Stride: 0x1}, - unicode.Range16{Lo: 0x135d, Hi: 0x135f, Stride: 0x1}, - unicode.Range16{Lo: 0x1712, Hi: 0x1714, Stride: 0x1}, - unicode.Range16{Lo: 0x1732, Hi: 0x1734, Stride: 0x1}, - unicode.Range16{Lo: 0x1752, Hi: 0x1753, Stride: 0x1}, - unicode.Range16{Lo: 0x1772, Hi: 0x1773, Stride: 0x1}, - unicode.Range16{Lo: 0x17b4, Hi: 0x17b5, Stride: 0x1}, - unicode.Range16{Lo: 0x17b7, Hi: 0x17bd, Stride: 0x1}, - unicode.Range16{Lo: 0x17c6, Hi: 0x17c6, Stride: 0x1}, - unicode.Range16{Lo: 0x17c9, Hi: 0x17d3, Stride: 0x1}, - unicode.Range16{Lo: 0x17dd, Hi: 0x17dd, Stride: 0x1}, - unicode.Range16{Lo: 0x180b, Hi: 0x180d, Stride: 0x1}, - unicode.Range16{Lo: 0x1885, Hi: 0x1886, Stride: 0x1}, - unicode.Range16{Lo: 0x18a9, Hi: 0x18a9, Stride: 0x1}, - unicode.Range16{Lo: 0x1920, Hi: 0x1922, Stride: 0x1}, - unicode.Range16{Lo: 0x1927, Hi: 0x1928, Stride: 0x1}, - unicode.Range16{Lo: 0x1932, Hi: 0x1932, Stride: 0x1}, - unicode.Range16{Lo: 0x1939, Hi: 0x193b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a17, Hi: 0x1a18, Stride: 0x1}, - unicode.Range16{Lo: 0x1a1b, Hi: 0x1a1b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a56, Hi: 0x1a56, Stride: 0x1}, - unicode.Range16{Lo: 0x1a58, Hi: 0x1a5e, Stride: 0x1}, - unicode.Range16{Lo: 0x1a60, Hi: 0x1a60, Stride: 0x1}, - unicode.Range16{Lo: 0x1a62, Hi: 0x1a62, Stride: 0x1}, - unicode.Range16{Lo: 0x1a65, Hi: 0x1a6c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a73, Hi: 0x1a7c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a7f, Hi: 0x1a7f, Stride: 0x1}, - unicode.Range16{Lo: 0x1ab0, Hi: 0x1abd, Stride: 0x1}, - unicode.Range16{Lo: 0x1abe, Hi: 0x1abe, Stride: 0x1}, - unicode.Range16{Lo: 0x1b00, Hi: 0x1b03, Stride: 0x1}, - unicode.Range16{Lo: 0x1b34, Hi: 0x1b34, Stride: 0x1}, - unicode.Range16{Lo: 0x1b36, Hi: 0x1b3a, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3c, Hi: 0x1b3c, Stride: 0x1}, - unicode.Range16{Lo: 0x1b42, Hi: 0x1b42, Stride: 0x1}, - unicode.Range16{Lo: 0x1b6b, Hi: 0x1b73, Stride: 0x1}, - unicode.Range16{Lo: 0x1b80, Hi: 0x1b81, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba2, Hi: 0x1ba5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba8, Hi: 0x1ba9, Stride: 0x1}, - unicode.Range16{Lo: 0x1bab, Hi: 0x1bad, Stride: 0x1}, - unicode.Range16{Lo: 0x1be6, Hi: 0x1be6, Stride: 0x1}, - unicode.Range16{Lo: 0x1be8, Hi: 0x1be9, Stride: 0x1}, - unicode.Range16{Lo: 0x1bed, Hi: 0x1bed, Stride: 0x1}, - unicode.Range16{Lo: 0x1bef, Hi: 0x1bf1, Stride: 0x1}, - unicode.Range16{Lo: 0x1c2c, Hi: 0x1c33, Stride: 0x1}, - unicode.Range16{Lo: 0x1c36, Hi: 0x1c37, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd0, Hi: 0x1cd2, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd4, Hi: 0x1ce0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce2, Hi: 0x1ce8, Stride: 0x1}, - unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, - unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, - unicode.Range16{Lo: 0x200c, Hi: 0x200c, Stride: 0x1}, - unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, - unicode.Range16{Lo: 0x20dd, Hi: 0x20e0, Stride: 0x1}, - unicode.Range16{Lo: 0x20e1, Hi: 0x20e1, Stride: 0x1}, - unicode.Range16{Lo: 0x20e2, Hi: 0x20e4, Stride: 0x1}, - unicode.Range16{Lo: 0x20e5, Hi: 0x20f0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cef, Hi: 0x2cf1, Stride: 0x1}, - unicode.Range16{Lo: 0x2d7f, Hi: 0x2d7f, Stride: 0x1}, - unicode.Range16{Lo: 0x2de0, Hi: 0x2dff, Stride: 0x1}, - unicode.Range16{Lo: 0x302a, Hi: 0x302d, Stride: 0x1}, - unicode.Range16{Lo: 0x302e, Hi: 0x302f, Stride: 0x1}, - unicode.Range16{Lo: 0x3099, Hi: 0x309a, Stride: 0x1}, - unicode.Range16{Lo: 0xa66f, Hi: 0xa66f, Stride: 0x1}, - unicode.Range16{Lo: 0xa670, Hi: 0xa672, Stride: 0x1}, - unicode.Range16{Lo: 0xa674, Hi: 0xa67d, Stride: 0x1}, - unicode.Range16{Lo: 0xa69e, Hi: 0xa69f, Stride: 0x1}, - unicode.Range16{Lo: 0xa6f0, Hi: 0xa6f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa802, Hi: 0xa802, Stride: 0x1}, - unicode.Range16{Lo: 0xa806, Hi: 0xa806, Stride: 0x1}, - unicode.Range16{Lo: 0xa80b, Hi: 0xa80b, Stride: 0x1}, - unicode.Range16{Lo: 0xa825, Hi: 0xa826, Stride: 0x1}, - unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, - unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, - unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, - unicode.Range16{Lo: 0xa980, Hi: 0xa982, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b3, Hi: 0xa9b3, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, - unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, - unicode.Range16{Lo: 0xaa31, Hi: 0xaa32, Stride: 0x1}, - unicode.Range16{Lo: 0xaa35, Hi: 0xaa36, Stride: 0x1}, - unicode.Range16{Lo: 0xaa43, Hi: 0xaa43, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4c, Hi: 0xaa4c, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7c, Hi: 0xaa7c, Stride: 0x1}, - unicode.Range16{Lo: 0xaab0, Hi: 0xaab0, Stride: 0x1}, - unicode.Range16{Lo: 0xaab2, Hi: 0xaab4, Stride: 0x1}, - unicode.Range16{Lo: 0xaab7, Hi: 0xaab8, Stride: 0x1}, - unicode.Range16{Lo: 0xaabe, Hi: 0xaabf, Stride: 0x1}, - unicode.Range16{Lo: 0xaac1, Hi: 0xaac1, Stride: 0x1}, - unicode.Range16{Lo: 0xaaec, Hi: 0xaaed, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf6, Hi: 0xaaf6, Stride: 0x1}, - unicode.Range16{Lo: 0xabe5, Hi: 0xabe5, Stride: 0x1}, - unicode.Range16{Lo: 0xabe8, Hi: 0xabe8, Stride: 0x1}, - unicode.Range16{Lo: 0xabed, Hi: 0xabed, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1e, Hi: 0xfb1e, Stride: 0x1}, - unicode.Range16{Lo: 0xfe00, Hi: 0xfe0f, Stride: 0x1}, - unicode.Range16{Lo: 0xfe20, Hi: 0xfe2f, Stride: 0x1}, - unicode.Range16{Lo: 0xff9e, Hi: 0xff9f, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x101fd, Hi: 0x101fd, Stride: 0x1}, - unicode.Range32{Lo: 0x102e0, Hi: 0x102e0, Stride: 0x1}, - unicode.Range32{Lo: 0x10376, Hi: 0x1037a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a01, Hi: 0x10a03, Stride: 0x1}, - unicode.Range32{Lo: 0x10a05, Hi: 0x10a06, Stride: 0x1}, - unicode.Range32{Lo: 0x10a0c, Hi: 0x10a0f, Stride: 0x1}, - unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, - unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, - unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, - unicode.Range32{Lo: 0x11038, Hi: 0x11046, Stride: 0x1}, - unicode.Range32{Lo: 0x1107f, Hi: 0x11081, Stride: 0x1}, - unicode.Range32{Lo: 0x110b3, Hi: 0x110b6, Stride: 0x1}, - unicode.Range32{Lo: 0x110b9, Hi: 0x110ba, Stride: 0x1}, - unicode.Range32{Lo: 0x11100, Hi: 0x11102, Stride: 0x1}, - unicode.Range32{Lo: 0x11127, Hi: 0x1112b, Stride: 0x1}, - unicode.Range32{Lo: 0x1112d, Hi: 0x11134, Stride: 0x1}, - unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, - unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, - unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, - unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, - unicode.Range32{Lo: 0x11234, Hi: 0x11234, Stride: 0x1}, - unicode.Range32{Lo: 0x11236, Hi: 0x11237, Stride: 0x1}, - unicode.Range32{Lo: 0x1123e, Hi: 0x1123e, Stride: 0x1}, - unicode.Range32{Lo: 0x112df, Hi: 0x112df, Stride: 0x1}, - unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, - unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, - unicode.Range32{Lo: 0x1133e, Hi: 0x1133e, Stride: 0x1}, - unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, - unicode.Range32{Lo: 0x11357, Hi: 0x11357, Stride: 0x1}, - unicode.Range32{Lo: 0x11366, Hi: 0x1136c, Stride: 0x1}, - unicode.Range32{Lo: 0x11370, Hi: 0x11374, Stride: 0x1}, - unicode.Range32{Lo: 0x11438, Hi: 0x1143f, Stride: 0x1}, - unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, - unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, - unicode.Range32{Lo: 0x114b0, Hi: 0x114b0, Stride: 0x1}, - unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, - unicode.Range32{Lo: 0x114ba, Hi: 0x114ba, Stride: 0x1}, - unicode.Range32{Lo: 0x114bd, Hi: 0x114bd, Stride: 0x1}, - unicode.Range32{Lo: 0x114bf, Hi: 0x114c0, Stride: 0x1}, - unicode.Range32{Lo: 0x114c2, Hi: 0x114c3, Stride: 0x1}, - unicode.Range32{Lo: 0x115af, Hi: 0x115af, Stride: 0x1}, - unicode.Range32{Lo: 0x115b2, Hi: 0x115b5, Stride: 0x1}, - unicode.Range32{Lo: 0x115bc, Hi: 0x115bd, Stride: 0x1}, - unicode.Range32{Lo: 0x115bf, Hi: 0x115c0, Stride: 0x1}, - unicode.Range32{Lo: 0x115dc, Hi: 0x115dd, Stride: 0x1}, - unicode.Range32{Lo: 0x11633, Hi: 0x1163a, Stride: 0x1}, - unicode.Range32{Lo: 0x1163d, Hi: 0x1163d, Stride: 0x1}, - unicode.Range32{Lo: 0x1163f, Hi: 0x11640, Stride: 0x1}, - unicode.Range32{Lo: 0x116ab, Hi: 0x116ab, Stride: 0x1}, - unicode.Range32{Lo: 0x116ad, Hi: 0x116ad, Stride: 0x1}, - unicode.Range32{Lo: 0x116b0, Hi: 0x116b5, Stride: 0x1}, - unicode.Range32{Lo: 0x116b7, Hi: 0x116b7, Stride: 0x1}, - unicode.Range32{Lo: 0x1171d, Hi: 0x1171f, Stride: 0x1}, - unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, - unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, - unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, - unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3f, Hi: 0x11c3f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c92, Hi: 0x11ca7, Stride: 0x1}, - unicode.Range32{Lo: 0x11caa, Hi: 0x11cb0, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, - unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, - unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, - unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d165, Hi: 0x1d165, Stride: 0x1}, - unicode.Range32{Lo: 0x1d167, Hi: 0x1d169, Stride: 0x1}, - unicode.Range32{Lo: 0x1d16e, Hi: 0x1d172, Stride: 0x1}, - unicode.Range32{Lo: 0x1d17b, Hi: 0x1d182, Stride: 0x1}, - unicode.Range32{Lo: 0x1d185, Hi: 0x1d18b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d1aa, Hi: 0x1d1ad, Stride: 0x1}, - unicode.Range32{Lo: 0x1d242, Hi: 0x1d244, Stride: 0x1}, - unicode.Range32{Lo: 0x1da00, Hi: 0x1da36, Stride: 0x1}, - unicode.Range32{Lo: 0x1da3b, Hi: 0x1da6c, Stride: 0x1}, - unicode.Range32{Lo: 0x1da75, Hi: 0x1da75, Stride: 0x1}, - unicode.Range32{Lo: 0x1da84, Hi: 0x1da84, Stride: 0x1}, - unicode.Range32{Lo: 0x1da9b, Hi: 0x1da9f, Stride: 0x1}, - unicode.Range32{Lo: 0x1daa1, Hi: 0x1daaf, Stride: 0x1}, - unicode.Range32{Lo: 0x1e000, Hi: 0x1e006, Stride: 0x1}, - unicode.Range32{Lo: 0x1e008, Hi: 0x1e018, Stride: 0x1}, - unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, - unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, - unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, - unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, - unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, - unicode.Range32{Lo: 0xe0100, Hi: 0xe01ef, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeGlue_After_Zwj = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2764, Hi: 0x2764, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f48b, Hi: 0x1f48b, Stride: 0x1}, - unicode.Range32{Lo: 0x1f5e8, Hi: 0x1f5e8, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeL = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x1100, Hi: 0x115f, Stride: 0x1}, - unicode.Range16{Lo: 0xa960, Hi: 0xa97c, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeLF = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xa, Hi: 0xa, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _GraphemeLV = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xac00, Hi: 0xac00, Stride: 0x1}, - unicode.Range16{Lo: 0xac1c, Hi: 0xac1c, Stride: 0x1}, - unicode.Range16{Lo: 0xac38, Hi: 0xac38, Stride: 0x1}, - unicode.Range16{Lo: 0xac54, Hi: 0xac54, Stride: 0x1}, - unicode.Range16{Lo: 0xac70, Hi: 0xac70, Stride: 0x1}, - unicode.Range16{Lo: 0xac8c, Hi: 0xac8c, Stride: 0x1}, - unicode.Range16{Lo: 0xaca8, Hi: 0xaca8, Stride: 0x1}, - unicode.Range16{Lo: 0xacc4, Hi: 0xacc4, Stride: 0x1}, - unicode.Range16{Lo: 0xace0, Hi: 0xace0, Stride: 0x1}, - unicode.Range16{Lo: 0xacfc, Hi: 0xacfc, Stride: 0x1}, - unicode.Range16{Lo: 0xad18, Hi: 0xad18, Stride: 0x1}, - unicode.Range16{Lo: 0xad34, Hi: 0xad34, Stride: 0x1}, - unicode.Range16{Lo: 0xad50, Hi: 0xad50, Stride: 0x1}, - unicode.Range16{Lo: 0xad6c, Hi: 0xad6c, Stride: 0x1}, - unicode.Range16{Lo: 0xad88, Hi: 0xad88, Stride: 0x1}, - unicode.Range16{Lo: 0xada4, Hi: 0xada4, Stride: 0x1}, - unicode.Range16{Lo: 0xadc0, Hi: 0xadc0, Stride: 0x1}, - unicode.Range16{Lo: 0xaddc, Hi: 0xaddc, Stride: 0x1}, - unicode.Range16{Lo: 0xadf8, Hi: 0xadf8, Stride: 0x1}, - unicode.Range16{Lo: 0xae14, Hi: 0xae14, Stride: 0x1}, - unicode.Range16{Lo: 0xae30, Hi: 0xae30, Stride: 0x1}, - unicode.Range16{Lo: 0xae4c, Hi: 0xae4c, Stride: 0x1}, - unicode.Range16{Lo: 0xae68, Hi: 0xae68, Stride: 0x1}, - unicode.Range16{Lo: 0xae84, Hi: 0xae84, Stride: 0x1}, - unicode.Range16{Lo: 0xaea0, Hi: 0xaea0, Stride: 0x1}, - unicode.Range16{Lo: 0xaebc, Hi: 0xaebc, Stride: 0x1}, - unicode.Range16{Lo: 0xaed8, Hi: 0xaed8, Stride: 0x1}, - unicode.Range16{Lo: 0xaef4, Hi: 0xaef4, Stride: 0x1}, - unicode.Range16{Lo: 0xaf10, Hi: 0xaf10, Stride: 0x1}, - unicode.Range16{Lo: 0xaf2c, Hi: 0xaf2c, Stride: 0x1}, - unicode.Range16{Lo: 0xaf48, Hi: 0xaf48, Stride: 0x1}, - unicode.Range16{Lo: 0xaf64, Hi: 0xaf64, Stride: 0x1}, - unicode.Range16{Lo: 0xaf80, Hi: 0xaf80, Stride: 0x1}, - unicode.Range16{Lo: 0xaf9c, Hi: 0xaf9c, Stride: 0x1}, - unicode.Range16{Lo: 0xafb8, Hi: 0xafb8, Stride: 0x1}, - unicode.Range16{Lo: 0xafd4, Hi: 0xafd4, Stride: 0x1}, - unicode.Range16{Lo: 0xaff0, Hi: 0xaff0, Stride: 0x1}, - unicode.Range16{Lo: 0xb00c, Hi: 0xb00c, Stride: 0x1}, - unicode.Range16{Lo: 0xb028, Hi: 0xb028, Stride: 0x1}, - unicode.Range16{Lo: 0xb044, Hi: 0xb044, Stride: 0x1}, - unicode.Range16{Lo: 0xb060, Hi: 0xb060, Stride: 0x1}, - unicode.Range16{Lo: 0xb07c, Hi: 0xb07c, Stride: 0x1}, - unicode.Range16{Lo: 0xb098, Hi: 0xb098, Stride: 0x1}, - unicode.Range16{Lo: 0xb0b4, Hi: 0xb0b4, Stride: 0x1}, - unicode.Range16{Lo: 0xb0d0, Hi: 0xb0d0, Stride: 0x1}, - unicode.Range16{Lo: 0xb0ec, Hi: 0xb0ec, Stride: 0x1}, - unicode.Range16{Lo: 0xb108, Hi: 0xb108, Stride: 0x1}, - unicode.Range16{Lo: 0xb124, Hi: 0xb124, Stride: 0x1}, - unicode.Range16{Lo: 0xb140, Hi: 0xb140, Stride: 0x1}, - unicode.Range16{Lo: 0xb15c, Hi: 0xb15c, Stride: 0x1}, - unicode.Range16{Lo: 0xb178, Hi: 0xb178, Stride: 0x1}, - unicode.Range16{Lo: 0xb194, Hi: 0xb194, Stride: 0x1}, - unicode.Range16{Lo: 0xb1b0, Hi: 0xb1b0, Stride: 0x1}, - unicode.Range16{Lo: 0xb1cc, Hi: 0xb1cc, Stride: 0x1}, - unicode.Range16{Lo: 0xb1e8, Hi: 0xb1e8, Stride: 0x1}, - unicode.Range16{Lo: 0xb204, Hi: 0xb204, Stride: 0x1}, - unicode.Range16{Lo: 0xb220, Hi: 0xb220, Stride: 0x1}, - unicode.Range16{Lo: 0xb23c, Hi: 0xb23c, Stride: 0x1}, - unicode.Range16{Lo: 0xb258, Hi: 0xb258, Stride: 0x1}, - unicode.Range16{Lo: 0xb274, Hi: 0xb274, Stride: 0x1}, - unicode.Range16{Lo: 0xb290, Hi: 0xb290, Stride: 0x1}, - unicode.Range16{Lo: 0xb2ac, Hi: 0xb2ac, Stride: 0x1}, - unicode.Range16{Lo: 0xb2c8, Hi: 0xb2c8, Stride: 0x1}, - unicode.Range16{Lo: 0xb2e4, Hi: 0xb2e4, Stride: 0x1}, - unicode.Range16{Lo: 0xb300, Hi: 0xb300, Stride: 0x1}, - unicode.Range16{Lo: 0xb31c, Hi: 0xb31c, Stride: 0x1}, - unicode.Range16{Lo: 0xb338, Hi: 0xb338, Stride: 0x1}, - unicode.Range16{Lo: 0xb354, Hi: 0xb354, Stride: 0x1}, - unicode.Range16{Lo: 0xb370, Hi: 0xb370, Stride: 0x1}, - unicode.Range16{Lo: 0xb38c, Hi: 0xb38c, Stride: 0x1}, - unicode.Range16{Lo: 0xb3a8, Hi: 0xb3a8, Stride: 0x1}, - unicode.Range16{Lo: 0xb3c4, Hi: 0xb3c4, Stride: 0x1}, - unicode.Range16{Lo: 0xb3e0, Hi: 0xb3e0, Stride: 0x1}, - unicode.Range16{Lo: 0xb3fc, Hi: 0xb3fc, Stride: 0x1}, - unicode.Range16{Lo: 0xb418, Hi: 0xb418, Stride: 0x1}, - unicode.Range16{Lo: 0xb434, Hi: 0xb434, Stride: 0x1}, - unicode.Range16{Lo: 0xb450, Hi: 0xb450, Stride: 0x1}, - unicode.Range16{Lo: 0xb46c, Hi: 0xb46c, Stride: 0x1}, - unicode.Range16{Lo: 0xb488, Hi: 0xb488, Stride: 0x1}, - unicode.Range16{Lo: 0xb4a4, Hi: 0xb4a4, Stride: 0x1}, - unicode.Range16{Lo: 0xb4c0, Hi: 0xb4c0, Stride: 0x1}, - unicode.Range16{Lo: 0xb4dc, Hi: 0xb4dc, Stride: 0x1}, - unicode.Range16{Lo: 0xb4f8, Hi: 0xb4f8, Stride: 0x1}, - unicode.Range16{Lo: 0xb514, Hi: 0xb514, Stride: 0x1}, - unicode.Range16{Lo: 0xb530, Hi: 0xb530, Stride: 0x1}, - unicode.Range16{Lo: 0xb54c, Hi: 0xb54c, Stride: 0x1}, - unicode.Range16{Lo: 0xb568, Hi: 0xb568, Stride: 0x1}, - unicode.Range16{Lo: 0xb584, Hi: 0xb584, Stride: 0x1}, - unicode.Range16{Lo: 0xb5a0, Hi: 0xb5a0, Stride: 0x1}, - unicode.Range16{Lo: 0xb5bc, Hi: 0xb5bc, Stride: 0x1}, - unicode.Range16{Lo: 0xb5d8, Hi: 0xb5d8, Stride: 0x1}, - unicode.Range16{Lo: 0xb5f4, Hi: 0xb5f4, Stride: 0x1}, - unicode.Range16{Lo: 0xb610, Hi: 0xb610, Stride: 0x1}, - unicode.Range16{Lo: 0xb62c, Hi: 0xb62c, Stride: 0x1}, - unicode.Range16{Lo: 0xb648, Hi: 0xb648, Stride: 0x1}, - unicode.Range16{Lo: 0xb664, Hi: 0xb664, Stride: 0x1}, - unicode.Range16{Lo: 0xb680, Hi: 0xb680, Stride: 0x1}, - unicode.Range16{Lo: 0xb69c, Hi: 0xb69c, Stride: 0x1}, - unicode.Range16{Lo: 0xb6b8, Hi: 0xb6b8, Stride: 0x1}, - unicode.Range16{Lo: 0xb6d4, Hi: 0xb6d4, Stride: 0x1}, - unicode.Range16{Lo: 0xb6f0, Hi: 0xb6f0, Stride: 0x1}, - unicode.Range16{Lo: 0xb70c, Hi: 0xb70c, Stride: 0x1}, - unicode.Range16{Lo: 0xb728, Hi: 0xb728, Stride: 0x1}, - unicode.Range16{Lo: 0xb744, Hi: 0xb744, Stride: 0x1}, - unicode.Range16{Lo: 0xb760, Hi: 0xb760, Stride: 0x1}, - unicode.Range16{Lo: 0xb77c, Hi: 0xb77c, Stride: 0x1}, - unicode.Range16{Lo: 0xb798, Hi: 0xb798, Stride: 0x1}, - unicode.Range16{Lo: 0xb7b4, Hi: 0xb7b4, Stride: 0x1}, - unicode.Range16{Lo: 0xb7d0, Hi: 0xb7d0, Stride: 0x1}, - unicode.Range16{Lo: 0xb7ec, Hi: 0xb7ec, Stride: 0x1}, - unicode.Range16{Lo: 0xb808, Hi: 0xb808, Stride: 0x1}, - unicode.Range16{Lo: 0xb824, Hi: 0xb824, Stride: 0x1}, - unicode.Range16{Lo: 0xb840, Hi: 0xb840, Stride: 0x1}, - unicode.Range16{Lo: 0xb85c, Hi: 0xb85c, Stride: 0x1}, - unicode.Range16{Lo: 0xb878, Hi: 0xb878, Stride: 0x1}, - unicode.Range16{Lo: 0xb894, Hi: 0xb894, Stride: 0x1}, - unicode.Range16{Lo: 0xb8b0, Hi: 0xb8b0, Stride: 0x1}, - unicode.Range16{Lo: 0xb8cc, Hi: 0xb8cc, Stride: 0x1}, - unicode.Range16{Lo: 0xb8e8, Hi: 0xb8e8, Stride: 0x1}, - unicode.Range16{Lo: 0xb904, Hi: 0xb904, Stride: 0x1}, - unicode.Range16{Lo: 0xb920, Hi: 0xb920, Stride: 0x1}, - unicode.Range16{Lo: 0xb93c, Hi: 0xb93c, Stride: 0x1}, - unicode.Range16{Lo: 0xb958, Hi: 0xb958, Stride: 0x1}, - unicode.Range16{Lo: 0xb974, Hi: 0xb974, Stride: 0x1}, - unicode.Range16{Lo: 0xb990, Hi: 0xb990, Stride: 0x1}, - unicode.Range16{Lo: 0xb9ac, Hi: 0xb9ac, Stride: 0x1}, - unicode.Range16{Lo: 0xb9c8, Hi: 0xb9c8, Stride: 0x1}, - unicode.Range16{Lo: 0xb9e4, Hi: 0xb9e4, Stride: 0x1}, - unicode.Range16{Lo: 0xba00, Hi: 0xba00, Stride: 0x1}, - unicode.Range16{Lo: 0xba1c, Hi: 0xba1c, Stride: 0x1}, - unicode.Range16{Lo: 0xba38, Hi: 0xba38, Stride: 0x1}, - unicode.Range16{Lo: 0xba54, Hi: 0xba54, Stride: 0x1}, - unicode.Range16{Lo: 0xba70, Hi: 0xba70, Stride: 0x1}, - unicode.Range16{Lo: 0xba8c, Hi: 0xba8c, Stride: 0x1}, - unicode.Range16{Lo: 0xbaa8, Hi: 0xbaa8, Stride: 0x1}, - unicode.Range16{Lo: 0xbac4, Hi: 0xbac4, Stride: 0x1}, - unicode.Range16{Lo: 0xbae0, Hi: 0xbae0, Stride: 0x1}, - unicode.Range16{Lo: 0xbafc, Hi: 0xbafc, Stride: 0x1}, - unicode.Range16{Lo: 0xbb18, Hi: 0xbb18, Stride: 0x1}, - unicode.Range16{Lo: 0xbb34, Hi: 0xbb34, Stride: 0x1}, - unicode.Range16{Lo: 0xbb50, Hi: 0xbb50, Stride: 0x1}, - unicode.Range16{Lo: 0xbb6c, Hi: 0xbb6c, Stride: 0x1}, - unicode.Range16{Lo: 0xbb88, Hi: 0xbb88, Stride: 0x1}, - unicode.Range16{Lo: 0xbba4, Hi: 0xbba4, Stride: 0x1}, - unicode.Range16{Lo: 0xbbc0, Hi: 0xbbc0, Stride: 0x1}, - unicode.Range16{Lo: 0xbbdc, Hi: 0xbbdc, Stride: 0x1}, - unicode.Range16{Lo: 0xbbf8, Hi: 0xbbf8, Stride: 0x1}, - unicode.Range16{Lo: 0xbc14, Hi: 0xbc14, Stride: 0x1}, - unicode.Range16{Lo: 0xbc30, Hi: 0xbc30, Stride: 0x1}, - unicode.Range16{Lo: 0xbc4c, Hi: 0xbc4c, Stride: 0x1}, - unicode.Range16{Lo: 0xbc68, Hi: 0xbc68, Stride: 0x1}, - unicode.Range16{Lo: 0xbc84, Hi: 0xbc84, Stride: 0x1}, - unicode.Range16{Lo: 0xbca0, Hi: 0xbca0, Stride: 0x1}, - unicode.Range16{Lo: 0xbcbc, Hi: 0xbcbc, Stride: 0x1}, - unicode.Range16{Lo: 0xbcd8, Hi: 0xbcd8, Stride: 0x1}, - unicode.Range16{Lo: 0xbcf4, Hi: 0xbcf4, Stride: 0x1}, - unicode.Range16{Lo: 0xbd10, Hi: 0xbd10, Stride: 0x1}, - unicode.Range16{Lo: 0xbd2c, Hi: 0xbd2c, Stride: 0x1}, - unicode.Range16{Lo: 0xbd48, Hi: 0xbd48, Stride: 0x1}, - unicode.Range16{Lo: 0xbd64, Hi: 0xbd64, Stride: 0x1}, - unicode.Range16{Lo: 0xbd80, Hi: 0xbd80, Stride: 0x1}, - unicode.Range16{Lo: 0xbd9c, Hi: 0xbd9c, Stride: 0x1}, - unicode.Range16{Lo: 0xbdb8, Hi: 0xbdb8, Stride: 0x1}, - unicode.Range16{Lo: 0xbdd4, Hi: 0xbdd4, Stride: 0x1}, - unicode.Range16{Lo: 0xbdf0, Hi: 0xbdf0, Stride: 0x1}, - unicode.Range16{Lo: 0xbe0c, Hi: 0xbe0c, Stride: 0x1}, - unicode.Range16{Lo: 0xbe28, Hi: 0xbe28, Stride: 0x1}, - unicode.Range16{Lo: 0xbe44, Hi: 0xbe44, Stride: 0x1}, - unicode.Range16{Lo: 0xbe60, Hi: 0xbe60, Stride: 0x1}, - unicode.Range16{Lo: 0xbe7c, Hi: 0xbe7c, Stride: 0x1}, - unicode.Range16{Lo: 0xbe98, Hi: 0xbe98, Stride: 0x1}, - unicode.Range16{Lo: 0xbeb4, Hi: 0xbeb4, Stride: 0x1}, - unicode.Range16{Lo: 0xbed0, Hi: 0xbed0, Stride: 0x1}, - unicode.Range16{Lo: 0xbeec, Hi: 0xbeec, Stride: 0x1}, - unicode.Range16{Lo: 0xbf08, Hi: 0xbf08, Stride: 0x1}, - unicode.Range16{Lo: 0xbf24, Hi: 0xbf24, Stride: 0x1}, - unicode.Range16{Lo: 0xbf40, Hi: 0xbf40, Stride: 0x1}, - unicode.Range16{Lo: 0xbf5c, Hi: 0xbf5c, Stride: 0x1}, - unicode.Range16{Lo: 0xbf78, Hi: 0xbf78, Stride: 0x1}, - unicode.Range16{Lo: 0xbf94, Hi: 0xbf94, Stride: 0x1}, - unicode.Range16{Lo: 0xbfb0, Hi: 0xbfb0, Stride: 0x1}, - unicode.Range16{Lo: 0xbfcc, Hi: 0xbfcc, Stride: 0x1}, - unicode.Range16{Lo: 0xbfe8, Hi: 0xbfe8, Stride: 0x1}, - unicode.Range16{Lo: 0xc004, Hi: 0xc004, Stride: 0x1}, - unicode.Range16{Lo: 0xc020, Hi: 0xc020, Stride: 0x1}, - unicode.Range16{Lo: 0xc03c, Hi: 0xc03c, Stride: 0x1}, - unicode.Range16{Lo: 0xc058, Hi: 0xc058, Stride: 0x1}, - unicode.Range16{Lo: 0xc074, Hi: 0xc074, Stride: 0x1}, - unicode.Range16{Lo: 0xc090, Hi: 0xc090, Stride: 0x1}, - unicode.Range16{Lo: 0xc0ac, Hi: 0xc0ac, Stride: 0x1}, - unicode.Range16{Lo: 0xc0c8, Hi: 0xc0c8, Stride: 0x1}, - unicode.Range16{Lo: 0xc0e4, Hi: 0xc0e4, Stride: 0x1}, - unicode.Range16{Lo: 0xc100, Hi: 0xc100, Stride: 0x1}, - unicode.Range16{Lo: 0xc11c, Hi: 0xc11c, Stride: 0x1}, - unicode.Range16{Lo: 0xc138, Hi: 0xc138, Stride: 0x1}, - unicode.Range16{Lo: 0xc154, Hi: 0xc154, Stride: 0x1}, - unicode.Range16{Lo: 0xc170, Hi: 0xc170, Stride: 0x1}, - unicode.Range16{Lo: 0xc18c, Hi: 0xc18c, Stride: 0x1}, - unicode.Range16{Lo: 0xc1a8, Hi: 0xc1a8, Stride: 0x1}, - unicode.Range16{Lo: 0xc1c4, Hi: 0xc1c4, Stride: 0x1}, - unicode.Range16{Lo: 0xc1e0, Hi: 0xc1e0, Stride: 0x1}, - unicode.Range16{Lo: 0xc1fc, Hi: 0xc1fc, Stride: 0x1}, - unicode.Range16{Lo: 0xc218, Hi: 0xc218, Stride: 0x1}, - unicode.Range16{Lo: 0xc234, Hi: 0xc234, Stride: 0x1}, - unicode.Range16{Lo: 0xc250, Hi: 0xc250, Stride: 0x1}, - unicode.Range16{Lo: 0xc26c, Hi: 0xc26c, Stride: 0x1}, - unicode.Range16{Lo: 0xc288, Hi: 0xc288, Stride: 0x1}, - unicode.Range16{Lo: 0xc2a4, Hi: 0xc2a4, Stride: 0x1}, - unicode.Range16{Lo: 0xc2c0, Hi: 0xc2c0, Stride: 0x1}, - unicode.Range16{Lo: 0xc2dc, Hi: 0xc2dc, Stride: 0x1}, - unicode.Range16{Lo: 0xc2f8, Hi: 0xc2f8, Stride: 0x1}, - unicode.Range16{Lo: 0xc314, Hi: 0xc314, Stride: 0x1}, - unicode.Range16{Lo: 0xc330, Hi: 0xc330, Stride: 0x1}, - unicode.Range16{Lo: 0xc34c, Hi: 0xc34c, Stride: 0x1}, - unicode.Range16{Lo: 0xc368, Hi: 0xc368, Stride: 0x1}, - unicode.Range16{Lo: 0xc384, Hi: 0xc384, Stride: 0x1}, - unicode.Range16{Lo: 0xc3a0, Hi: 0xc3a0, Stride: 0x1}, - unicode.Range16{Lo: 0xc3bc, Hi: 0xc3bc, Stride: 0x1}, - unicode.Range16{Lo: 0xc3d8, Hi: 0xc3d8, Stride: 0x1}, - unicode.Range16{Lo: 0xc3f4, Hi: 0xc3f4, Stride: 0x1}, - unicode.Range16{Lo: 0xc410, Hi: 0xc410, Stride: 0x1}, - unicode.Range16{Lo: 0xc42c, Hi: 0xc42c, Stride: 0x1}, - unicode.Range16{Lo: 0xc448, Hi: 0xc448, Stride: 0x1}, - unicode.Range16{Lo: 0xc464, Hi: 0xc464, Stride: 0x1}, - unicode.Range16{Lo: 0xc480, Hi: 0xc480, Stride: 0x1}, - unicode.Range16{Lo: 0xc49c, Hi: 0xc49c, Stride: 0x1}, - unicode.Range16{Lo: 0xc4b8, Hi: 0xc4b8, Stride: 0x1}, - unicode.Range16{Lo: 0xc4d4, Hi: 0xc4d4, Stride: 0x1}, - unicode.Range16{Lo: 0xc4f0, Hi: 0xc4f0, Stride: 0x1}, - unicode.Range16{Lo: 0xc50c, Hi: 0xc50c, Stride: 0x1}, - unicode.Range16{Lo: 0xc528, Hi: 0xc528, Stride: 0x1}, - unicode.Range16{Lo: 0xc544, Hi: 0xc544, Stride: 0x1}, - unicode.Range16{Lo: 0xc560, Hi: 0xc560, Stride: 0x1}, - unicode.Range16{Lo: 0xc57c, Hi: 0xc57c, Stride: 0x1}, - unicode.Range16{Lo: 0xc598, Hi: 0xc598, Stride: 0x1}, - unicode.Range16{Lo: 0xc5b4, Hi: 0xc5b4, Stride: 0x1}, - unicode.Range16{Lo: 0xc5d0, Hi: 0xc5d0, Stride: 0x1}, - unicode.Range16{Lo: 0xc5ec, Hi: 0xc5ec, Stride: 0x1}, - unicode.Range16{Lo: 0xc608, Hi: 0xc608, Stride: 0x1}, - unicode.Range16{Lo: 0xc624, Hi: 0xc624, Stride: 0x1}, - unicode.Range16{Lo: 0xc640, Hi: 0xc640, Stride: 0x1}, - unicode.Range16{Lo: 0xc65c, Hi: 0xc65c, Stride: 0x1}, - unicode.Range16{Lo: 0xc678, Hi: 0xc678, Stride: 0x1}, - unicode.Range16{Lo: 0xc694, Hi: 0xc694, Stride: 0x1}, - unicode.Range16{Lo: 0xc6b0, Hi: 0xc6b0, Stride: 0x1}, - unicode.Range16{Lo: 0xc6cc, Hi: 0xc6cc, Stride: 0x1}, - unicode.Range16{Lo: 0xc6e8, Hi: 0xc6e8, Stride: 0x1}, - unicode.Range16{Lo: 0xc704, Hi: 0xc704, Stride: 0x1}, - unicode.Range16{Lo: 0xc720, Hi: 0xc720, Stride: 0x1}, - unicode.Range16{Lo: 0xc73c, Hi: 0xc73c, Stride: 0x1}, - unicode.Range16{Lo: 0xc758, Hi: 0xc758, Stride: 0x1}, - unicode.Range16{Lo: 0xc774, Hi: 0xc774, Stride: 0x1}, - unicode.Range16{Lo: 0xc790, Hi: 0xc790, Stride: 0x1}, - unicode.Range16{Lo: 0xc7ac, Hi: 0xc7ac, Stride: 0x1}, - unicode.Range16{Lo: 0xc7c8, Hi: 0xc7c8, Stride: 0x1}, - unicode.Range16{Lo: 0xc7e4, Hi: 0xc7e4, Stride: 0x1}, - unicode.Range16{Lo: 0xc800, Hi: 0xc800, Stride: 0x1}, - unicode.Range16{Lo: 0xc81c, Hi: 0xc81c, Stride: 0x1}, - unicode.Range16{Lo: 0xc838, Hi: 0xc838, Stride: 0x1}, - unicode.Range16{Lo: 0xc854, Hi: 0xc854, Stride: 0x1}, - unicode.Range16{Lo: 0xc870, Hi: 0xc870, Stride: 0x1}, - unicode.Range16{Lo: 0xc88c, Hi: 0xc88c, Stride: 0x1}, - unicode.Range16{Lo: 0xc8a8, Hi: 0xc8a8, Stride: 0x1}, - unicode.Range16{Lo: 0xc8c4, Hi: 0xc8c4, Stride: 0x1}, - unicode.Range16{Lo: 0xc8e0, Hi: 0xc8e0, Stride: 0x1}, - unicode.Range16{Lo: 0xc8fc, Hi: 0xc8fc, Stride: 0x1}, - unicode.Range16{Lo: 0xc918, Hi: 0xc918, Stride: 0x1}, - unicode.Range16{Lo: 0xc934, Hi: 0xc934, Stride: 0x1}, - unicode.Range16{Lo: 0xc950, Hi: 0xc950, Stride: 0x1}, - unicode.Range16{Lo: 0xc96c, Hi: 0xc96c, Stride: 0x1}, - unicode.Range16{Lo: 0xc988, Hi: 0xc988, Stride: 0x1}, - unicode.Range16{Lo: 0xc9a4, Hi: 0xc9a4, Stride: 0x1}, - unicode.Range16{Lo: 0xc9c0, Hi: 0xc9c0, Stride: 0x1}, - unicode.Range16{Lo: 0xc9dc, Hi: 0xc9dc, Stride: 0x1}, - unicode.Range16{Lo: 0xc9f8, Hi: 0xc9f8, Stride: 0x1}, - unicode.Range16{Lo: 0xca14, Hi: 0xca14, Stride: 0x1}, - unicode.Range16{Lo: 0xca30, Hi: 0xca30, Stride: 0x1}, - unicode.Range16{Lo: 0xca4c, Hi: 0xca4c, Stride: 0x1}, - unicode.Range16{Lo: 0xca68, Hi: 0xca68, Stride: 0x1}, - unicode.Range16{Lo: 0xca84, Hi: 0xca84, Stride: 0x1}, - unicode.Range16{Lo: 0xcaa0, Hi: 0xcaa0, Stride: 0x1}, - unicode.Range16{Lo: 0xcabc, Hi: 0xcabc, Stride: 0x1}, - unicode.Range16{Lo: 0xcad8, Hi: 0xcad8, Stride: 0x1}, - unicode.Range16{Lo: 0xcaf4, Hi: 0xcaf4, Stride: 0x1}, - unicode.Range16{Lo: 0xcb10, Hi: 0xcb10, Stride: 0x1}, - unicode.Range16{Lo: 0xcb2c, Hi: 0xcb2c, Stride: 0x1}, - unicode.Range16{Lo: 0xcb48, Hi: 0xcb48, Stride: 0x1}, - unicode.Range16{Lo: 0xcb64, Hi: 0xcb64, Stride: 0x1}, - unicode.Range16{Lo: 0xcb80, Hi: 0xcb80, Stride: 0x1}, - unicode.Range16{Lo: 0xcb9c, Hi: 0xcb9c, Stride: 0x1}, - unicode.Range16{Lo: 0xcbb8, Hi: 0xcbb8, Stride: 0x1}, - unicode.Range16{Lo: 0xcbd4, Hi: 0xcbd4, Stride: 0x1}, - unicode.Range16{Lo: 0xcbf0, Hi: 0xcbf0, Stride: 0x1}, - unicode.Range16{Lo: 0xcc0c, Hi: 0xcc0c, Stride: 0x1}, - unicode.Range16{Lo: 0xcc28, Hi: 0xcc28, Stride: 0x1}, - unicode.Range16{Lo: 0xcc44, Hi: 0xcc44, Stride: 0x1}, - unicode.Range16{Lo: 0xcc60, Hi: 0xcc60, Stride: 0x1}, - unicode.Range16{Lo: 0xcc7c, Hi: 0xcc7c, Stride: 0x1}, - unicode.Range16{Lo: 0xcc98, Hi: 0xcc98, Stride: 0x1}, - unicode.Range16{Lo: 0xccb4, Hi: 0xccb4, Stride: 0x1}, - unicode.Range16{Lo: 0xccd0, Hi: 0xccd0, Stride: 0x1}, - unicode.Range16{Lo: 0xccec, Hi: 0xccec, Stride: 0x1}, - unicode.Range16{Lo: 0xcd08, Hi: 0xcd08, Stride: 0x1}, - unicode.Range16{Lo: 0xcd24, Hi: 0xcd24, Stride: 0x1}, - unicode.Range16{Lo: 0xcd40, Hi: 0xcd40, Stride: 0x1}, - unicode.Range16{Lo: 0xcd5c, Hi: 0xcd5c, Stride: 0x1}, - unicode.Range16{Lo: 0xcd78, Hi: 0xcd78, Stride: 0x1}, - unicode.Range16{Lo: 0xcd94, Hi: 0xcd94, Stride: 0x1}, - unicode.Range16{Lo: 0xcdb0, Hi: 0xcdb0, Stride: 0x1}, - unicode.Range16{Lo: 0xcdcc, Hi: 0xcdcc, Stride: 0x1}, - unicode.Range16{Lo: 0xcde8, Hi: 0xcde8, Stride: 0x1}, - unicode.Range16{Lo: 0xce04, Hi: 0xce04, Stride: 0x1}, - unicode.Range16{Lo: 0xce20, Hi: 0xce20, Stride: 0x1}, - unicode.Range16{Lo: 0xce3c, Hi: 0xce3c, Stride: 0x1}, - unicode.Range16{Lo: 0xce58, Hi: 0xce58, Stride: 0x1}, - unicode.Range16{Lo: 0xce74, Hi: 0xce74, Stride: 0x1}, - unicode.Range16{Lo: 0xce90, Hi: 0xce90, Stride: 0x1}, - unicode.Range16{Lo: 0xceac, Hi: 0xceac, Stride: 0x1}, - unicode.Range16{Lo: 0xcec8, Hi: 0xcec8, Stride: 0x1}, - unicode.Range16{Lo: 0xcee4, Hi: 0xcee4, Stride: 0x1}, - unicode.Range16{Lo: 0xcf00, Hi: 0xcf00, Stride: 0x1}, - unicode.Range16{Lo: 0xcf1c, Hi: 0xcf1c, Stride: 0x1}, - unicode.Range16{Lo: 0xcf38, Hi: 0xcf38, Stride: 0x1}, - unicode.Range16{Lo: 0xcf54, Hi: 0xcf54, Stride: 0x1}, - unicode.Range16{Lo: 0xcf70, Hi: 0xcf70, Stride: 0x1}, - unicode.Range16{Lo: 0xcf8c, Hi: 0xcf8c, Stride: 0x1}, - unicode.Range16{Lo: 0xcfa8, Hi: 0xcfa8, Stride: 0x1}, - unicode.Range16{Lo: 0xcfc4, Hi: 0xcfc4, Stride: 0x1}, - unicode.Range16{Lo: 0xcfe0, Hi: 0xcfe0, Stride: 0x1}, - unicode.Range16{Lo: 0xcffc, Hi: 0xcffc, Stride: 0x1}, - unicode.Range16{Lo: 0xd018, Hi: 0xd018, Stride: 0x1}, - unicode.Range16{Lo: 0xd034, Hi: 0xd034, Stride: 0x1}, - unicode.Range16{Lo: 0xd050, Hi: 0xd050, Stride: 0x1}, - unicode.Range16{Lo: 0xd06c, Hi: 0xd06c, Stride: 0x1}, - unicode.Range16{Lo: 0xd088, Hi: 0xd088, Stride: 0x1}, - unicode.Range16{Lo: 0xd0a4, Hi: 0xd0a4, Stride: 0x1}, - unicode.Range16{Lo: 0xd0c0, Hi: 0xd0c0, Stride: 0x1}, - unicode.Range16{Lo: 0xd0dc, Hi: 0xd0dc, Stride: 0x1}, - unicode.Range16{Lo: 0xd0f8, Hi: 0xd0f8, Stride: 0x1}, - unicode.Range16{Lo: 0xd114, Hi: 0xd114, Stride: 0x1}, - unicode.Range16{Lo: 0xd130, Hi: 0xd130, Stride: 0x1}, - unicode.Range16{Lo: 0xd14c, Hi: 0xd14c, Stride: 0x1}, - unicode.Range16{Lo: 0xd168, Hi: 0xd168, Stride: 0x1}, - unicode.Range16{Lo: 0xd184, Hi: 0xd184, Stride: 0x1}, - unicode.Range16{Lo: 0xd1a0, Hi: 0xd1a0, Stride: 0x1}, - unicode.Range16{Lo: 0xd1bc, Hi: 0xd1bc, Stride: 0x1}, - unicode.Range16{Lo: 0xd1d8, Hi: 0xd1d8, Stride: 0x1}, - unicode.Range16{Lo: 0xd1f4, Hi: 0xd1f4, Stride: 0x1}, - unicode.Range16{Lo: 0xd210, Hi: 0xd210, Stride: 0x1}, - unicode.Range16{Lo: 0xd22c, Hi: 0xd22c, Stride: 0x1}, - unicode.Range16{Lo: 0xd248, Hi: 0xd248, Stride: 0x1}, - unicode.Range16{Lo: 0xd264, Hi: 0xd264, Stride: 0x1}, - unicode.Range16{Lo: 0xd280, Hi: 0xd280, Stride: 0x1}, - unicode.Range16{Lo: 0xd29c, Hi: 0xd29c, Stride: 0x1}, - unicode.Range16{Lo: 0xd2b8, Hi: 0xd2b8, Stride: 0x1}, - unicode.Range16{Lo: 0xd2d4, Hi: 0xd2d4, Stride: 0x1}, - unicode.Range16{Lo: 0xd2f0, Hi: 0xd2f0, Stride: 0x1}, - unicode.Range16{Lo: 0xd30c, Hi: 0xd30c, Stride: 0x1}, - unicode.Range16{Lo: 0xd328, Hi: 0xd328, Stride: 0x1}, - unicode.Range16{Lo: 0xd344, Hi: 0xd344, Stride: 0x1}, - unicode.Range16{Lo: 0xd360, Hi: 0xd360, Stride: 0x1}, - unicode.Range16{Lo: 0xd37c, Hi: 0xd37c, Stride: 0x1}, - unicode.Range16{Lo: 0xd398, Hi: 0xd398, Stride: 0x1}, - unicode.Range16{Lo: 0xd3b4, Hi: 0xd3b4, Stride: 0x1}, - unicode.Range16{Lo: 0xd3d0, Hi: 0xd3d0, Stride: 0x1}, - unicode.Range16{Lo: 0xd3ec, Hi: 0xd3ec, Stride: 0x1}, - unicode.Range16{Lo: 0xd408, Hi: 0xd408, Stride: 0x1}, - unicode.Range16{Lo: 0xd424, Hi: 0xd424, Stride: 0x1}, - unicode.Range16{Lo: 0xd440, Hi: 0xd440, Stride: 0x1}, - unicode.Range16{Lo: 0xd45c, Hi: 0xd45c, Stride: 0x1}, - unicode.Range16{Lo: 0xd478, Hi: 0xd478, Stride: 0x1}, - unicode.Range16{Lo: 0xd494, Hi: 0xd494, Stride: 0x1}, - unicode.Range16{Lo: 0xd4b0, Hi: 0xd4b0, Stride: 0x1}, - unicode.Range16{Lo: 0xd4cc, Hi: 0xd4cc, Stride: 0x1}, - unicode.Range16{Lo: 0xd4e8, Hi: 0xd4e8, Stride: 0x1}, - unicode.Range16{Lo: 0xd504, Hi: 0xd504, Stride: 0x1}, - unicode.Range16{Lo: 0xd520, Hi: 0xd520, Stride: 0x1}, - unicode.Range16{Lo: 0xd53c, Hi: 0xd53c, Stride: 0x1}, - unicode.Range16{Lo: 0xd558, Hi: 0xd558, Stride: 0x1}, - unicode.Range16{Lo: 0xd574, Hi: 0xd574, Stride: 0x1}, - unicode.Range16{Lo: 0xd590, Hi: 0xd590, Stride: 0x1}, - unicode.Range16{Lo: 0xd5ac, Hi: 0xd5ac, Stride: 0x1}, - unicode.Range16{Lo: 0xd5c8, Hi: 0xd5c8, Stride: 0x1}, - unicode.Range16{Lo: 0xd5e4, Hi: 0xd5e4, Stride: 0x1}, - unicode.Range16{Lo: 0xd600, Hi: 0xd600, Stride: 0x1}, - unicode.Range16{Lo: 0xd61c, Hi: 0xd61c, Stride: 0x1}, - unicode.Range16{Lo: 0xd638, Hi: 0xd638, Stride: 0x1}, - unicode.Range16{Lo: 0xd654, Hi: 0xd654, Stride: 0x1}, - unicode.Range16{Lo: 0xd670, Hi: 0xd670, Stride: 0x1}, - unicode.Range16{Lo: 0xd68c, Hi: 0xd68c, Stride: 0x1}, - unicode.Range16{Lo: 0xd6a8, Hi: 0xd6a8, Stride: 0x1}, - unicode.Range16{Lo: 0xd6c4, Hi: 0xd6c4, Stride: 0x1}, - unicode.Range16{Lo: 0xd6e0, Hi: 0xd6e0, Stride: 0x1}, - unicode.Range16{Lo: 0xd6fc, Hi: 0xd6fc, Stride: 0x1}, - unicode.Range16{Lo: 0xd718, Hi: 0xd718, Stride: 0x1}, - unicode.Range16{Lo: 0xd734, Hi: 0xd734, Stride: 0x1}, - unicode.Range16{Lo: 0xd750, Hi: 0xd750, Stride: 0x1}, - unicode.Range16{Lo: 0xd76c, Hi: 0xd76c, Stride: 0x1}, - unicode.Range16{Lo: 0xd788, Hi: 0xd788, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeLVT = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xac01, Hi: 0xac1b, Stride: 0x1}, - unicode.Range16{Lo: 0xac1d, Hi: 0xac37, Stride: 0x1}, - unicode.Range16{Lo: 0xac39, Hi: 0xac53, Stride: 0x1}, - unicode.Range16{Lo: 0xac55, Hi: 0xac6f, Stride: 0x1}, - unicode.Range16{Lo: 0xac71, Hi: 0xac8b, Stride: 0x1}, - unicode.Range16{Lo: 0xac8d, Hi: 0xaca7, Stride: 0x1}, - unicode.Range16{Lo: 0xaca9, Hi: 0xacc3, Stride: 0x1}, - unicode.Range16{Lo: 0xacc5, Hi: 0xacdf, Stride: 0x1}, - unicode.Range16{Lo: 0xace1, Hi: 0xacfb, Stride: 0x1}, - unicode.Range16{Lo: 0xacfd, Hi: 0xad17, Stride: 0x1}, - unicode.Range16{Lo: 0xad19, Hi: 0xad33, Stride: 0x1}, - unicode.Range16{Lo: 0xad35, Hi: 0xad4f, Stride: 0x1}, - unicode.Range16{Lo: 0xad51, Hi: 0xad6b, Stride: 0x1}, - unicode.Range16{Lo: 0xad6d, Hi: 0xad87, Stride: 0x1}, - unicode.Range16{Lo: 0xad89, Hi: 0xada3, Stride: 0x1}, - unicode.Range16{Lo: 0xada5, Hi: 0xadbf, Stride: 0x1}, - unicode.Range16{Lo: 0xadc1, Hi: 0xaddb, Stride: 0x1}, - unicode.Range16{Lo: 0xaddd, Hi: 0xadf7, Stride: 0x1}, - unicode.Range16{Lo: 0xadf9, Hi: 0xae13, Stride: 0x1}, - unicode.Range16{Lo: 0xae15, Hi: 0xae2f, Stride: 0x1}, - unicode.Range16{Lo: 0xae31, Hi: 0xae4b, Stride: 0x1}, - unicode.Range16{Lo: 0xae4d, Hi: 0xae67, Stride: 0x1}, - unicode.Range16{Lo: 0xae69, Hi: 0xae83, Stride: 0x1}, - unicode.Range16{Lo: 0xae85, Hi: 0xae9f, Stride: 0x1}, - unicode.Range16{Lo: 0xaea1, Hi: 0xaebb, Stride: 0x1}, - unicode.Range16{Lo: 0xaebd, Hi: 0xaed7, Stride: 0x1}, - unicode.Range16{Lo: 0xaed9, Hi: 0xaef3, Stride: 0x1}, - unicode.Range16{Lo: 0xaef5, Hi: 0xaf0f, Stride: 0x1}, - unicode.Range16{Lo: 0xaf11, Hi: 0xaf2b, Stride: 0x1}, - unicode.Range16{Lo: 0xaf2d, Hi: 0xaf47, Stride: 0x1}, - unicode.Range16{Lo: 0xaf49, Hi: 0xaf63, Stride: 0x1}, - unicode.Range16{Lo: 0xaf65, Hi: 0xaf7f, Stride: 0x1}, - unicode.Range16{Lo: 0xaf81, Hi: 0xaf9b, Stride: 0x1}, - unicode.Range16{Lo: 0xaf9d, Hi: 0xafb7, Stride: 0x1}, - unicode.Range16{Lo: 0xafb9, Hi: 0xafd3, Stride: 0x1}, - unicode.Range16{Lo: 0xafd5, Hi: 0xafef, Stride: 0x1}, - unicode.Range16{Lo: 0xaff1, Hi: 0xb00b, Stride: 0x1}, - unicode.Range16{Lo: 0xb00d, Hi: 0xb027, Stride: 0x1}, - unicode.Range16{Lo: 0xb029, Hi: 0xb043, Stride: 0x1}, - unicode.Range16{Lo: 0xb045, Hi: 0xb05f, Stride: 0x1}, - unicode.Range16{Lo: 0xb061, Hi: 0xb07b, Stride: 0x1}, - unicode.Range16{Lo: 0xb07d, Hi: 0xb097, Stride: 0x1}, - unicode.Range16{Lo: 0xb099, Hi: 0xb0b3, Stride: 0x1}, - unicode.Range16{Lo: 0xb0b5, Hi: 0xb0cf, Stride: 0x1}, - unicode.Range16{Lo: 0xb0d1, Hi: 0xb0eb, Stride: 0x1}, - unicode.Range16{Lo: 0xb0ed, Hi: 0xb107, Stride: 0x1}, - unicode.Range16{Lo: 0xb109, Hi: 0xb123, Stride: 0x1}, - unicode.Range16{Lo: 0xb125, Hi: 0xb13f, Stride: 0x1}, - unicode.Range16{Lo: 0xb141, Hi: 0xb15b, Stride: 0x1}, - unicode.Range16{Lo: 0xb15d, Hi: 0xb177, Stride: 0x1}, - unicode.Range16{Lo: 0xb179, Hi: 0xb193, Stride: 0x1}, - unicode.Range16{Lo: 0xb195, Hi: 0xb1af, Stride: 0x1}, - unicode.Range16{Lo: 0xb1b1, Hi: 0xb1cb, Stride: 0x1}, - unicode.Range16{Lo: 0xb1cd, Hi: 0xb1e7, Stride: 0x1}, - unicode.Range16{Lo: 0xb1e9, Hi: 0xb203, Stride: 0x1}, - unicode.Range16{Lo: 0xb205, Hi: 0xb21f, Stride: 0x1}, - unicode.Range16{Lo: 0xb221, Hi: 0xb23b, Stride: 0x1}, - unicode.Range16{Lo: 0xb23d, Hi: 0xb257, Stride: 0x1}, - unicode.Range16{Lo: 0xb259, Hi: 0xb273, Stride: 0x1}, - unicode.Range16{Lo: 0xb275, Hi: 0xb28f, Stride: 0x1}, - unicode.Range16{Lo: 0xb291, Hi: 0xb2ab, Stride: 0x1}, - unicode.Range16{Lo: 0xb2ad, Hi: 0xb2c7, Stride: 0x1}, - unicode.Range16{Lo: 0xb2c9, Hi: 0xb2e3, Stride: 0x1}, - unicode.Range16{Lo: 0xb2e5, Hi: 0xb2ff, Stride: 0x1}, - unicode.Range16{Lo: 0xb301, Hi: 0xb31b, Stride: 0x1}, - unicode.Range16{Lo: 0xb31d, Hi: 0xb337, Stride: 0x1}, - unicode.Range16{Lo: 0xb339, Hi: 0xb353, Stride: 0x1}, - unicode.Range16{Lo: 0xb355, Hi: 0xb36f, Stride: 0x1}, - unicode.Range16{Lo: 0xb371, Hi: 0xb38b, Stride: 0x1}, - unicode.Range16{Lo: 0xb38d, Hi: 0xb3a7, Stride: 0x1}, - unicode.Range16{Lo: 0xb3a9, Hi: 0xb3c3, Stride: 0x1}, - unicode.Range16{Lo: 0xb3c5, Hi: 0xb3df, Stride: 0x1}, - unicode.Range16{Lo: 0xb3e1, Hi: 0xb3fb, Stride: 0x1}, - unicode.Range16{Lo: 0xb3fd, Hi: 0xb417, Stride: 0x1}, - unicode.Range16{Lo: 0xb419, Hi: 0xb433, Stride: 0x1}, - unicode.Range16{Lo: 0xb435, Hi: 0xb44f, Stride: 0x1}, - unicode.Range16{Lo: 0xb451, Hi: 0xb46b, Stride: 0x1}, - unicode.Range16{Lo: 0xb46d, Hi: 0xb487, Stride: 0x1}, - unicode.Range16{Lo: 0xb489, Hi: 0xb4a3, Stride: 0x1}, - unicode.Range16{Lo: 0xb4a5, Hi: 0xb4bf, Stride: 0x1}, - unicode.Range16{Lo: 0xb4c1, Hi: 0xb4db, Stride: 0x1}, - unicode.Range16{Lo: 0xb4dd, Hi: 0xb4f7, Stride: 0x1}, - unicode.Range16{Lo: 0xb4f9, Hi: 0xb513, Stride: 0x1}, - unicode.Range16{Lo: 0xb515, Hi: 0xb52f, Stride: 0x1}, - unicode.Range16{Lo: 0xb531, Hi: 0xb54b, Stride: 0x1}, - unicode.Range16{Lo: 0xb54d, Hi: 0xb567, Stride: 0x1}, - unicode.Range16{Lo: 0xb569, Hi: 0xb583, Stride: 0x1}, - unicode.Range16{Lo: 0xb585, Hi: 0xb59f, Stride: 0x1}, - unicode.Range16{Lo: 0xb5a1, Hi: 0xb5bb, Stride: 0x1}, - unicode.Range16{Lo: 0xb5bd, Hi: 0xb5d7, Stride: 0x1}, - unicode.Range16{Lo: 0xb5d9, Hi: 0xb5f3, Stride: 0x1}, - unicode.Range16{Lo: 0xb5f5, Hi: 0xb60f, Stride: 0x1}, - unicode.Range16{Lo: 0xb611, Hi: 0xb62b, Stride: 0x1}, - unicode.Range16{Lo: 0xb62d, Hi: 0xb647, Stride: 0x1}, - unicode.Range16{Lo: 0xb649, Hi: 0xb663, Stride: 0x1}, - unicode.Range16{Lo: 0xb665, Hi: 0xb67f, Stride: 0x1}, - unicode.Range16{Lo: 0xb681, Hi: 0xb69b, Stride: 0x1}, - unicode.Range16{Lo: 0xb69d, Hi: 0xb6b7, Stride: 0x1}, - unicode.Range16{Lo: 0xb6b9, Hi: 0xb6d3, Stride: 0x1}, - unicode.Range16{Lo: 0xb6d5, Hi: 0xb6ef, Stride: 0x1}, - unicode.Range16{Lo: 0xb6f1, Hi: 0xb70b, Stride: 0x1}, - unicode.Range16{Lo: 0xb70d, Hi: 0xb727, Stride: 0x1}, - unicode.Range16{Lo: 0xb729, Hi: 0xb743, Stride: 0x1}, - unicode.Range16{Lo: 0xb745, Hi: 0xb75f, Stride: 0x1}, - unicode.Range16{Lo: 0xb761, Hi: 0xb77b, Stride: 0x1}, - unicode.Range16{Lo: 0xb77d, Hi: 0xb797, Stride: 0x1}, - unicode.Range16{Lo: 0xb799, Hi: 0xb7b3, Stride: 0x1}, - unicode.Range16{Lo: 0xb7b5, Hi: 0xb7cf, Stride: 0x1}, - unicode.Range16{Lo: 0xb7d1, Hi: 0xb7eb, Stride: 0x1}, - unicode.Range16{Lo: 0xb7ed, Hi: 0xb807, Stride: 0x1}, - unicode.Range16{Lo: 0xb809, Hi: 0xb823, Stride: 0x1}, - unicode.Range16{Lo: 0xb825, Hi: 0xb83f, Stride: 0x1}, - unicode.Range16{Lo: 0xb841, Hi: 0xb85b, Stride: 0x1}, - unicode.Range16{Lo: 0xb85d, Hi: 0xb877, Stride: 0x1}, - unicode.Range16{Lo: 0xb879, Hi: 0xb893, Stride: 0x1}, - unicode.Range16{Lo: 0xb895, Hi: 0xb8af, Stride: 0x1}, - unicode.Range16{Lo: 0xb8b1, Hi: 0xb8cb, Stride: 0x1}, - unicode.Range16{Lo: 0xb8cd, Hi: 0xb8e7, Stride: 0x1}, - unicode.Range16{Lo: 0xb8e9, Hi: 0xb903, Stride: 0x1}, - unicode.Range16{Lo: 0xb905, Hi: 0xb91f, Stride: 0x1}, - unicode.Range16{Lo: 0xb921, Hi: 0xb93b, Stride: 0x1}, - unicode.Range16{Lo: 0xb93d, Hi: 0xb957, Stride: 0x1}, - unicode.Range16{Lo: 0xb959, Hi: 0xb973, Stride: 0x1}, - unicode.Range16{Lo: 0xb975, Hi: 0xb98f, Stride: 0x1}, - unicode.Range16{Lo: 0xb991, Hi: 0xb9ab, Stride: 0x1}, - unicode.Range16{Lo: 0xb9ad, Hi: 0xb9c7, Stride: 0x1}, - unicode.Range16{Lo: 0xb9c9, Hi: 0xb9e3, Stride: 0x1}, - unicode.Range16{Lo: 0xb9e5, Hi: 0xb9ff, Stride: 0x1}, - unicode.Range16{Lo: 0xba01, Hi: 0xba1b, Stride: 0x1}, - unicode.Range16{Lo: 0xba1d, Hi: 0xba37, Stride: 0x1}, - unicode.Range16{Lo: 0xba39, Hi: 0xba53, Stride: 0x1}, - unicode.Range16{Lo: 0xba55, Hi: 0xba6f, Stride: 0x1}, - unicode.Range16{Lo: 0xba71, Hi: 0xba8b, Stride: 0x1}, - unicode.Range16{Lo: 0xba8d, Hi: 0xbaa7, Stride: 0x1}, - unicode.Range16{Lo: 0xbaa9, Hi: 0xbac3, Stride: 0x1}, - unicode.Range16{Lo: 0xbac5, Hi: 0xbadf, Stride: 0x1}, - unicode.Range16{Lo: 0xbae1, Hi: 0xbafb, Stride: 0x1}, - unicode.Range16{Lo: 0xbafd, Hi: 0xbb17, Stride: 0x1}, - unicode.Range16{Lo: 0xbb19, Hi: 0xbb33, Stride: 0x1}, - unicode.Range16{Lo: 0xbb35, Hi: 0xbb4f, Stride: 0x1}, - unicode.Range16{Lo: 0xbb51, Hi: 0xbb6b, Stride: 0x1}, - unicode.Range16{Lo: 0xbb6d, Hi: 0xbb87, Stride: 0x1}, - unicode.Range16{Lo: 0xbb89, Hi: 0xbba3, Stride: 0x1}, - unicode.Range16{Lo: 0xbba5, Hi: 0xbbbf, Stride: 0x1}, - unicode.Range16{Lo: 0xbbc1, Hi: 0xbbdb, Stride: 0x1}, - unicode.Range16{Lo: 0xbbdd, Hi: 0xbbf7, Stride: 0x1}, - unicode.Range16{Lo: 0xbbf9, Hi: 0xbc13, Stride: 0x1}, - unicode.Range16{Lo: 0xbc15, Hi: 0xbc2f, Stride: 0x1}, - unicode.Range16{Lo: 0xbc31, Hi: 0xbc4b, Stride: 0x1}, - unicode.Range16{Lo: 0xbc4d, Hi: 0xbc67, Stride: 0x1}, - unicode.Range16{Lo: 0xbc69, Hi: 0xbc83, Stride: 0x1}, - unicode.Range16{Lo: 0xbc85, Hi: 0xbc9f, Stride: 0x1}, - unicode.Range16{Lo: 0xbca1, Hi: 0xbcbb, Stride: 0x1}, - unicode.Range16{Lo: 0xbcbd, Hi: 0xbcd7, Stride: 0x1}, - unicode.Range16{Lo: 0xbcd9, Hi: 0xbcf3, Stride: 0x1}, - unicode.Range16{Lo: 0xbcf5, Hi: 0xbd0f, Stride: 0x1}, - unicode.Range16{Lo: 0xbd11, Hi: 0xbd2b, Stride: 0x1}, - unicode.Range16{Lo: 0xbd2d, Hi: 0xbd47, Stride: 0x1}, - unicode.Range16{Lo: 0xbd49, Hi: 0xbd63, Stride: 0x1}, - unicode.Range16{Lo: 0xbd65, Hi: 0xbd7f, Stride: 0x1}, - unicode.Range16{Lo: 0xbd81, Hi: 0xbd9b, Stride: 0x1}, - unicode.Range16{Lo: 0xbd9d, Hi: 0xbdb7, Stride: 0x1}, - unicode.Range16{Lo: 0xbdb9, Hi: 0xbdd3, Stride: 0x1}, - unicode.Range16{Lo: 0xbdd5, Hi: 0xbdef, Stride: 0x1}, - unicode.Range16{Lo: 0xbdf1, Hi: 0xbe0b, Stride: 0x1}, - unicode.Range16{Lo: 0xbe0d, Hi: 0xbe27, Stride: 0x1}, - unicode.Range16{Lo: 0xbe29, Hi: 0xbe43, Stride: 0x1}, - unicode.Range16{Lo: 0xbe45, Hi: 0xbe5f, Stride: 0x1}, - unicode.Range16{Lo: 0xbe61, Hi: 0xbe7b, Stride: 0x1}, - unicode.Range16{Lo: 0xbe7d, Hi: 0xbe97, Stride: 0x1}, - unicode.Range16{Lo: 0xbe99, Hi: 0xbeb3, Stride: 0x1}, - unicode.Range16{Lo: 0xbeb5, Hi: 0xbecf, Stride: 0x1}, - unicode.Range16{Lo: 0xbed1, Hi: 0xbeeb, Stride: 0x1}, - unicode.Range16{Lo: 0xbeed, Hi: 0xbf07, Stride: 0x1}, - unicode.Range16{Lo: 0xbf09, Hi: 0xbf23, Stride: 0x1}, - unicode.Range16{Lo: 0xbf25, Hi: 0xbf3f, Stride: 0x1}, - unicode.Range16{Lo: 0xbf41, Hi: 0xbf5b, Stride: 0x1}, - unicode.Range16{Lo: 0xbf5d, Hi: 0xbf77, Stride: 0x1}, - unicode.Range16{Lo: 0xbf79, Hi: 0xbf93, Stride: 0x1}, - unicode.Range16{Lo: 0xbf95, Hi: 0xbfaf, Stride: 0x1}, - unicode.Range16{Lo: 0xbfb1, Hi: 0xbfcb, Stride: 0x1}, - unicode.Range16{Lo: 0xbfcd, Hi: 0xbfe7, Stride: 0x1}, - unicode.Range16{Lo: 0xbfe9, Hi: 0xc003, Stride: 0x1}, - unicode.Range16{Lo: 0xc005, Hi: 0xc01f, Stride: 0x1}, - unicode.Range16{Lo: 0xc021, Hi: 0xc03b, Stride: 0x1}, - unicode.Range16{Lo: 0xc03d, Hi: 0xc057, Stride: 0x1}, - unicode.Range16{Lo: 0xc059, Hi: 0xc073, Stride: 0x1}, - unicode.Range16{Lo: 0xc075, Hi: 0xc08f, Stride: 0x1}, - unicode.Range16{Lo: 0xc091, Hi: 0xc0ab, Stride: 0x1}, - unicode.Range16{Lo: 0xc0ad, Hi: 0xc0c7, Stride: 0x1}, - unicode.Range16{Lo: 0xc0c9, Hi: 0xc0e3, Stride: 0x1}, - unicode.Range16{Lo: 0xc0e5, Hi: 0xc0ff, Stride: 0x1}, - unicode.Range16{Lo: 0xc101, Hi: 0xc11b, Stride: 0x1}, - unicode.Range16{Lo: 0xc11d, Hi: 0xc137, Stride: 0x1}, - unicode.Range16{Lo: 0xc139, Hi: 0xc153, Stride: 0x1}, - unicode.Range16{Lo: 0xc155, Hi: 0xc16f, Stride: 0x1}, - unicode.Range16{Lo: 0xc171, Hi: 0xc18b, Stride: 0x1}, - unicode.Range16{Lo: 0xc18d, Hi: 0xc1a7, Stride: 0x1}, - unicode.Range16{Lo: 0xc1a9, Hi: 0xc1c3, Stride: 0x1}, - unicode.Range16{Lo: 0xc1c5, Hi: 0xc1df, Stride: 0x1}, - unicode.Range16{Lo: 0xc1e1, Hi: 0xc1fb, Stride: 0x1}, - unicode.Range16{Lo: 0xc1fd, Hi: 0xc217, Stride: 0x1}, - unicode.Range16{Lo: 0xc219, Hi: 0xc233, Stride: 0x1}, - unicode.Range16{Lo: 0xc235, Hi: 0xc24f, Stride: 0x1}, - unicode.Range16{Lo: 0xc251, Hi: 0xc26b, Stride: 0x1}, - unicode.Range16{Lo: 0xc26d, Hi: 0xc287, Stride: 0x1}, - unicode.Range16{Lo: 0xc289, Hi: 0xc2a3, Stride: 0x1}, - unicode.Range16{Lo: 0xc2a5, Hi: 0xc2bf, Stride: 0x1}, - unicode.Range16{Lo: 0xc2c1, Hi: 0xc2db, Stride: 0x1}, - unicode.Range16{Lo: 0xc2dd, Hi: 0xc2f7, Stride: 0x1}, - unicode.Range16{Lo: 0xc2f9, Hi: 0xc313, Stride: 0x1}, - unicode.Range16{Lo: 0xc315, Hi: 0xc32f, Stride: 0x1}, - unicode.Range16{Lo: 0xc331, Hi: 0xc34b, Stride: 0x1}, - unicode.Range16{Lo: 0xc34d, Hi: 0xc367, Stride: 0x1}, - unicode.Range16{Lo: 0xc369, Hi: 0xc383, Stride: 0x1}, - unicode.Range16{Lo: 0xc385, Hi: 0xc39f, Stride: 0x1}, - unicode.Range16{Lo: 0xc3a1, Hi: 0xc3bb, Stride: 0x1}, - unicode.Range16{Lo: 0xc3bd, Hi: 0xc3d7, Stride: 0x1}, - unicode.Range16{Lo: 0xc3d9, Hi: 0xc3f3, Stride: 0x1}, - unicode.Range16{Lo: 0xc3f5, Hi: 0xc40f, Stride: 0x1}, - unicode.Range16{Lo: 0xc411, Hi: 0xc42b, Stride: 0x1}, - unicode.Range16{Lo: 0xc42d, Hi: 0xc447, Stride: 0x1}, - unicode.Range16{Lo: 0xc449, Hi: 0xc463, Stride: 0x1}, - unicode.Range16{Lo: 0xc465, Hi: 0xc47f, Stride: 0x1}, - unicode.Range16{Lo: 0xc481, Hi: 0xc49b, Stride: 0x1}, - unicode.Range16{Lo: 0xc49d, Hi: 0xc4b7, Stride: 0x1}, - unicode.Range16{Lo: 0xc4b9, Hi: 0xc4d3, Stride: 0x1}, - unicode.Range16{Lo: 0xc4d5, Hi: 0xc4ef, Stride: 0x1}, - unicode.Range16{Lo: 0xc4f1, Hi: 0xc50b, Stride: 0x1}, - unicode.Range16{Lo: 0xc50d, Hi: 0xc527, Stride: 0x1}, - unicode.Range16{Lo: 0xc529, Hi: 0xc543, Stride: 0x1}, - unicode.Range16{Lo: 0xc545, Hi: 0xc55f, Stride: 0x1}, - unicode.Range16{Lo: 0xc561, Hi: 0xc57b, Stride: 0x1}, - unicode.Range16{Lo: 0xc57d, Hi: 0xc597, Stride: 0x1}, - unicode.Range16{Lo: 0xc599, Hi: 0xc5b3, Stride: 0x1}, - unicode.Range16{Lo: 0xc5b5, Hi: 0xc5cf, Stride: 0x1}, - unicode.Range16{Lo: 0xc5d1, Hi: 0xc5eb, Stride: 0x1}, - unicode.Range16{Lo: 0xc5ed, Hi: 0xc607, Stride: 0x1}, - unicode.Range16{Lo: 0xc609, Hi: 0xc623, Stride: 0x1}, - unicode.Range16{Lo: 0xc625, Hi: 0xc63f, Stride: 0x1}, - unicode.Range16{Lo: 0xc641, Hi: 0xc65b, Stride: 0x1}, - unicode.Range16{Lo: 0xc65d, Hi: 0xc677, Stride: 0x1}, - unicode.Range16{Lo: 0xc679, Hi: 0xc693, Stride: 0x1}, - unicode.Range16{Lo: 0xc695, Hi: 0xc6af, Stride: 0x1}, - unicode.Range16{Lo: 0xc6b1, Hi: 0xc6cb, Stride: 0x1}, - unicode.Range16{Lo: 0xc6cd, Hi: 0xc6e7, Stride: 0x1}, - unicode.Range16{Lo: 0xc6e9, Hi: 0xc703, Stride: 0x1}, - unicode.Range16{Lo: 0xc705, Hi: 0xc71f, Stride: 0x1}, - unicode.Range16{Lo: 0xc721, Hi: 0xc73b, Stride: 0x1}, - unicode.Range16{Lo: 0xc73d, Hi: 0xc757, Stride: 0x1}, - unicode.Range16{Lo: 0xc759, Hi: 0xc773, Stride: 0x1}, - unicode.Range16{Lo: 0xc775, Hi: 0xc78f, Stride: 0x1}, - unicode.Range16{Lo: 0xc791, Hi: 0xc7ab, Stride: 0x1}, - unicode.Range16{Lo: 0xc7ad, Hi: 0xc7c7, Stride: 0x1}, - unicode.Range16{Lo: 0xc7c9, Hi: 0xc7e3, Stride: 0x1}, - unicode.Range16{Lo: 0xc7e5, Hi: 0xc7ff, Stride: 0x1}, - unicode.Range16{Lo: 0xc801, Hi: 0xc81b, Stride: 0x1}, - unicode.Range16{Lo: 0xc81d, Hi: 0xc837, Stride: 0x1}, - unicode.Range16{Lo: 0xc839, Hi: 0xc853, Stride: 0x1}, - unicode.Range16{Lo: 0xc855, Hi: 0xc86f, Stride: 0x1}, - unicode.Range16{Lo: 0xc871, Hi: 0xc88b, Stride: 0x1}, - unicode.Range16{Lo: 0xc88d, Hi: 0xc8a7, Stride: 0x1}, - unicode.Range16{Lo: 0xc8a9, Hi: 0xc8c3, Stride: 0x1}, - unicode.Range16{Lo: 0xc8c5, Hi: 0xc8df, Stride: 0x1}, - unicode.Range16{Lo: 0xc8e1, Hi: 0xc8fb, Stride: 0x1}, - unicode.Range16{Lo: 0xc8fd, Hi: 0xc917, Stride: 0x1}, - unicode.Range16{Lo: 0xc919, Hi: 0xc933, Stride: 0x1}, - unicode.Range16{Lo: 0xc935, Hi: 0xc94f, Stride: 0x1}, - unicode.Range16{Lo: 0xc951, Hi: 0xc96b, Stride: 0x1}, - unicode.Range16{Lo: 0xc96d, Hi: 0xc987, Stride: 0x1}, - unicode.Range16{Lo: 0xc989, Hi: 0xc9a3, Stride: 0x1}, - unicode.Range16{Lo: 0xc9a5, Hi: 0xc9bf, Stride: 0x1}, - unicode.Range16{Lo: 0xc9c1, Hi: 0xc9db, Stride: 0x1}, - unicode.Range16{Lo: 0xc9dd, Hi: 0xc9f7, Stride: 0x1}, - unicode.Range16{Lo: 0xc9f9, Hi: 0xca13, Stride: 0x1}, - unicode.Range16{Lo: 0xca15, Hi: 0xca2f, Stride: 0x1}, - unicode.Range16{Lo: 0xca31, Hi: 0xca4b, Stride: 0x1}, - unicode.Range16{Lo: 0xca4d, Hi: 0xca67, Stride: 0x1}, - unicode.Range16{Lo: 0xca69, Hi: 0xca83, Stride: 0x1}, - unicode.Range16{Lo: 0xca85, Hi: 0xca9f, Stride: 0x1}, - unicode.Range16{Lo: 0xcaa1, Hi: 0xcabb, Stride: 0x1}, - unicode.Range16{Lo: 0xcabd, Hi: 0xcad7, Stride: 0x1}, - unicode.Range16{Lo: 0xcad9, Hi: 0xcaf3, Stride: 0x1}, - unicode.Range16{Lo: 0xcaf5, Hi: 0xcb0f, Stride: 0x1}, - unicode.Range16{Lo: 0xcb11, Hi: 0xcb2b, Stride: 0x1}, - unicode.Range16{Lo: 0xcb2d, Hi: 0xcb47, Stride: 0x1}, - unicode.Range16{Lo: 0xcb49, Hi: 0xcb63, Stride: 0x1}, - unicode.Range16{Lo: 0xcb65, Hi: 0xcb7f, Stride: 0x1}, - unicode.Range16{Lo: 0xcb81, Hi: 0xcb9b, Stride: 0x1}, - unicode.Range16{Lo: 0xcb9d, Hi: 0xcbb7, Stride: 0x1}, - unicode.Range16{Lo: 0xcbb9, Hi: 0xcbd3, Stride: 0x1}, - unicode.Range16{Lo: 0xcbd5, Hi: 0xcbef, Stride: 0x1}, - unicode.Range16{Lo: 0xcbf1, Hi: 0xcc0b, Stride: 0x1}, - unicode.Range16{Lo: 0xcc0d, Hi: 0xcc27, Stride: 0x1}, - unicode.Range16{Lo: 0xcc29, Hi: 0xcc43, Stride: 0x1}, - unicode.Range16{Lo: 0xcc45, Hi: 0xcc5f, Stride: 0x1}, - unicode.Range16{Lo: 0xcc61, Hi: 0xcc7b, Stride: 0x1}, - unicode.Range16{Lo: 0xcc7d, Hi: 0xcc97, Stride: 0x1}, - unicode.Range16{Lo: 0xcc99, Hi: 0xccb3, Stride: 0x1}, - unicode.Range16{Lo: 0xccb5, Hi: 0xcccf, Stride: 0x1}, - unicode.Range16{Lo: 0xccd1, Hi: 0xcceb, Stride: 0x1}, - unicode.Range16{Lo: 0xcced, Hi: 0xcd07, Stride: 0x1}, - unicode.Range16{Lo: 0xcd09, Hi: 0xcd23, Stride: 0x1}, - unicode.Range16{Lo: 0xcd25, Hi: 0xcd3f, Stride: 0x1}, - unicode.Range16{Lo: 0xcd41, Hi: 0xcd5b, Stride: 0x1}, - unicode.Range16{Lo: 0xcd5d, Hi: 0xcd77, Stride: 0x1}, - unicode.Range16{Lo: 0xcd79, Hi: 0xcd93, Stride: 0x1}, - unicode.Range16{Lo: 0xcd95, Hi: 0xcdaf, Stride: 0x1}, - unicode.Range16{Lo: 0xcdb1, Hi: 0xcdcb, Stride: 0x1}, - unicode.Range16{Lo: 0xcdcd, Hi: 0xcde7, Stride: 0x1}, - unicode.Range16{Lo: 0xcde9, Hi: 0xce03, Stride: 0x1}, - unicode.Range16{Lo: 0xce05, Hi: 0xce1f, Stride: 0x1}, - unicode.Range16{Lo: 0xce21, Hi: 0xce3b, Stride: 0x1}, - unicode.Range16{Lo: 0xce3d, Hi: 0xce57, Stride: 0x1}, - unicode.Range16{Lo: 0xce59, Hi: 0xce73, Stride: 0x1}, - unicode.Range16{Lo: 0xce75, Hi: 0xce8f, Stride: 0x1}, - unicode.Range16{Lo: 0xce91, Hi: 0xceab, Stride: 0x1}, - unicode.Range16{Lo: 0xcead, Hi: 0xcec7, Stride: 0x1}, - unicode.Range16{Lo: 0xcec9, Hi: 0xcee3, Stride: 0x1}, - unicode.Range16{Lo: 0xcee5, Hi: 0xceff, Stride: 0x1}, - unicode.Range16{Lo: 0xcf01, Hi: 0xcf1b, Stride: 0x1}, - unicode.Range16{Lo: 0xcf1d, Hi: 0xcf37, Stride: 0x1}, - unicode.Range16{Lo: 0xcf39, Hi: 0xcf53, Stride: 0x1}, - unicode.Range16{Lo: 0xcf55, Hi: 0xcf6f, Stride: 0x1}, - unicode.Range16{Lo: 0xcf71, Hi: 0xcf8b, Stride: 0x1}, - unicode.Range16{Lo: 0xcf8d, Hi: 0xcfa7, Stride: 0x1}, - unicode.Range16{Lo: 0xcfa9, Hi: 0xcfc3, Stride: 0x1}, - unicode.Range16{Lo: 0xcfc5, Hi: 0xcfdf, Stride: 0x1}, - unicode.Range16{Lo: 0xcfe1, Hi: 0xcffb, Stride: 0x1}, - unicode.Range16{Lo: 0xcffd, Hi: 0xd017, Stride: 0x1}, - unicode.Range16{Lo: 0xd019, Hi: 0xd033, Stride: 0x1}, - unicode.Range16{Lo: 0xd035, Hi: 0xd04f, Stride: 0x1}, - unicode.Range16{Lo: 0xd051, Hi: 0xd06b, Stride: 0x1}, - unicode.Range16{Lo: 0xd06d, Hi: 0xd087, Stride: 0x1}, - unicode.Range16{Lo: 0xd089, Hi: 0xd0a3, Stride: 0x1}, - unicode.Range16{Lo: 0xd0a5, Hi: 0xd0bf, Stride: 0x1}, - unicode.Range16{Lo: 0xd0c1, Hi: 0xd0db, Stride: 0x1}, - unicode.Range16{Lo: 0xd0dd, Hi: 0xd0f7, Stride: 0x1}, - unicode.Range16{Lo: 0xd0f9, Hi: 0xd113, Stride: 0x1}, - unicode.Range16{Lo: 0xd115, Hi: 0xd12f, Stride: 0x1}, - unicode.Range16{Lo: 0xd131, Hi: 0xd14b, Stride: 0x1}, - unicode.Range16{Lo: 0xd14d, Hi: 0xd167, Stride: 0x1}, - unicode.Range16{Lo: 0xd169, Hi: 0xd183, Stride: 0x1}, - unicode.Range16{Lo: 0xd185, Hi: 0xd19f, Stride: 0x1}, - unicode.Range16{Lo: 0xd1a1, Hi: 0xd1bb, Stride: 0x1}, - unicode.Range16{Lo: 0xd1bd, Hi: 0xd1d7, Stride: 0x1}, - unicode.Range16{Lo: 0xd1d9, Hi: 0xd1f3, Stride: 0x1}, - unicode.Range16{Lo: 0xd1f5, Hi: 0xd20f, Stride: 0x1}, - unicode.Range16{Lo: 0xd211, Hi: 0xd22b, Stride: 0x1}, - unicode.Range16{Lo: 0xd22d, Hi: 0xd247, Stride: 0x1}, - unicode.Range16{Lo: 0xd249, Hi: 0xd263, Stride: 0x1}, - unicode.Range16{Lo: 0xd265, Hi: 0xd27f, Stride: 0x1}, - unicode.Range16{Lo: 0xd281, Hi: 0xd29b, Stride: 0x1}, - unicode.Range16{Lo: 0xd29d, Hi: 0xd2b7, Stride: 0x1}, - unicode.Range16{Lo: 0xd2b9, Hi: 0xd2d3, Stride: 0x1}, - unicode.Range16{Lo: 0xd2d5, Hi: 0xd2ef, Stride: 0x1}, - unicode.Range16{Lo: 0xd2f1, Hi: 0xd30b, Stride: 0x1}, - unicode.Range16{Lo: 0xd30d, Hi: 0xd327, Stride: 0x1}, - unicode.Range16{Lo: 0xd329, Hi: 0xd343, Stride: 0x1}, - unicode.Range16{Lo: 0xd345, Hi: 0xd35f, Stride: 0x1}, - unicode.Range16{Lo: 0xd361, Hi: 0xd37b, Stride: 0x1}, - unicode.Range16{Lo: 0xd37d, Hi: 0xd397, Stride: 0x1}, - unicode.Range16{Lo: 0xd399, Hi: 0xd3b3, Stride: 0x1}, - unicode.Range16{Lo: 0xd3b5, Hi: 0xd3cf, Stride: 0x1}, - unicode.Range16{Lo: 0xd3d1, Hi: 0xd3eb, Stride: 0x1}, - unicode.Range16{Lo: 0xd3ed, Hi: 0xd407, Stride: 0x1}, - unicode.Range16{Lo: 0xd409, Hi: 0xd423, Stride: 0x1}, - unicode.Range16{Lo: 0xd425, Hi: 0xd43f, Stride: 0x1}, - unicode.Range16{Lo: 0xd441, Hi: 0xd45b, Stride: 0x1}, - unicode.Range16{Lo: 0xd45d, Hi: 0xd477, Stride: 0x1}, - unicode.Range16{Lo: 0xd479, Hi: 0xd493, Stride: 0x1}, - unicode.Range16{Lo: 0xd495, Hi: 0xd4af, Stride: 0x1}, - unicode.Range16{Lo: 0xd4b1, Hi: 0xd4cb, Stride: 0x1}, - unicode.Range16{Lo: 0xd4cd, Hi: 0xd4e7, Stride: 0x1}, - unicode.Range16{Lo: 0xd4e9, Hi: 0xd503, Stride: 0x1}, - unicode.Range16{Lo: 0xd505, Hi: 0xd51f, Stride: 0x1}, - unicode.Range16{Lo: 0xd521, Hi: 0xd53b, Stride: 0x1}, - unicode.Range16{Lo: 0xd53d, Hi: 0xd557, Stride: 0x1}, - unicode.Range16{Lo: 0xd559, Hi: 0xd573, Stride: 0x1}, - unicode.Range16{Lo: 0xd575, Hi: 0xd58f, Stride: 0x1}, - unicode.Range16{Lo: 0xd591, Hi: 0xd5ab, Stride: 0x1}, - unicode.Range16{Lo: 0xd5ad, Hi: 0xd5c7, Stride: 0x1}, - unicode.Range16{Lo: 0xd5c9, Hi: 0xd5e3, Stride: 0x1}, - unicode.Range16{Lo: 0xd5e5, Hi: 0xd5ff, Stride: 0x1}, - unicode.Range16{Lo: 0xd601, Hi: 0xd61b, Stride: 0x1}, - unicode.Range16{Lo: 0xd61d, Hi: 0xd637, Stride: 0x1}, - unicode.Range16{Lo: 0xd639, Hi: 0xd653, Stride: 0x1}, - unicode.Range16{Lo: 0xd655, Hi: 0xd66f, Stride: 0x1}, - unicode.Range16{Lo: 0xd671, Hi: 0xd68b, Stride: 0x1}, - unicode.Range16{Lo: 0xd68d, Hi: 0xd6a7, Stride: 0x1}, - unicode.Range16{Lo: 0xd6a9, Hi: 0xd6c3, Stride: 0x1}, - unicode.Range16{Lo: 0xd6c5, Hi: 0xd6df, Stride: 0x1}, - unicode.Range16{Lo: 0xd6e1, Hi: 0xd6fb, Stride: 0x1}, - unicode.Range16{Lo: 0xd6fd, Hi: 0xd717, Stride: 0x1}, - unicode.Range16{Lo: 0xd719, Hi: 0xd733, Stride: 0x1}, - unicode.Range16{Lo: 0xd735, Hi: 0xd74f, Stride: 0x1}, - unicode.Range16{Lo: 0xd751, Hi: 0xd76b, Stride: 0x1}, - unicode.Range16{Lo: 0xd76d, Hi: 0xd787, Stride: 0x1}, - unicode.Range16{Lo: 0xd789, Hi: 0xd7a3, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemePrepend = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x600, Hi: 0x605, Stride: 0x1}, - unicode.Range16{Lo: 0x6dd, Hi: 0x6dd, Stride: 0x1}, - unicode.Range16{Lo: 0x70f, Hi: 0x70f, Stride: 0x1}, - unicode.Range16{Lo: 0x8e2, Hi: 0x8e2, Stride: 0x1}, - unicode.Range16{Lo: 0xd4e, Hi: 0xd4e, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, - unicode.Range32{Lo: 0x111c2, Hi: 0x111c3, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeRegional_Indicator = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f1e6, Hi: 0x1f1ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeSpacingMark = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x903, Hi: 0x903, Stride: 0x1}, - unicode.Range16{Lo: 0x93b, Hi: 0x93b, Stride: 0x1}, - unicode.Range16{Lo: 0x93e, Hi: 0x940, Stride: 0x1}, - unicode.Range16{Lo: 0x949, Hi: 0x94c, Stride: 0x1}, - unicode.Range16{Lo: 0x94e, Hi: 0x94f, Stride: 0x1}, - unicode.Range16{Lo: 0x982, Hi: 0x983, Stride: 0x1}, - unicode.Range16{Lo: 0x9bf, Hi: 0x9c0, Stride: 0x1}, - unicode.Range16{Lo: 0x9c7, Hi: 0x9c8, Stride: 0x1}, - unicode.Range16{Lo: 0x9cb, Hi: 0x9cc, Stride: 0x1}, - unicode.Range16{Lo: 0xa03, Hi: 0xa03, Stride: 0x1}, - unicode.Range16{Lo: 0xa3e, Hi: 0xa40, Stride: 0x1}, - unicode.Range16{Lo: 0xa83, Hi: 0xa83, Stride: 0x1}, - unicode.Range16{Lo: 0xabe, Hi: 0xac0, Stride: 0x1}, - unicode.Range16{Lo: 0xac9, Hi: 0xac9, Stride: 0x1}, - unicode.Range16{Lo: 0xacb, Hi: 0xacc, Stride: 0x1}, - unicode.Range16{Lo: 0xb02, Hi: 0xb03, Stride: 0x1}, - unicode.Range16{Lo: 0xb40, Hi: 0xb40, Stride: 0x1}, - unicode.Range16{Lo: 0xb47, Hi: 0xb48, Stride: 0x1}, - unicode.Range16{Lo: 0xb4b, Hi: 0xb4c, Stride: 0x1}, - unicode.Range16{Lo: 0xbbf, Hi: 0xbbf, Stride: 0x1}, - unicode.Range16{Lo: 0xbc1, Hi: 0xbc2, Stride: 0x1}, - unicode.Range16{Lo: 0xbc6, Hi: 0xbc8, Stride: 0x1}, - unicode.Range16{Lo: 0xbca, Hi: 0xbcc, Stride: 0x1}, - unicode.Range16{Lo: 0xc01, Hi: 0xc03, Stride: 0x1}, - unicode.Range16{Lo: 0xc41, Hi: 0xc44, Stride: 0x1}, - unicode.Range16{Lo: 0xc82, Hi: 0xc83, Stride: 0x1}, - unicode.Range16{Lo: 0xcbe, Hi: 0xcbe, Stride: 0x1}, - unicode.Range16{Lo: 0xcc0, Hi: 0xcc1, Stride: 0x1}, - unicode.Range16{Lo: 0xcc3, Hi: 0xcc4, Stride: 0x1}, - unicode.Range16{Lo: 0xcc7, Hi: 0xcc8, Stride: 0x1}, - unicode.Range16{Lo: 0xcca, Hi: 0xccb, Stride: 0x1}, - unicode.Range16{Lo: 0xd02, Hi: 0xd03, Stride: 0x1}, - unicode.Range16{Lo: 0xd3f, Hi: 0xd40, Stride: 0x1}, - unicode.Range16{Lo: 0xd46, Hi: 0xd48, Stride: 0x1}, - unicode.Range16{Lo: 0xd4a, Hi: 0xd4c, Stride: 0x1}, - unicode.Range16{Lo: 0xd82, Hi: 0xd83, Stride: 0x1}, - unicode.Range16{Lo: 0xdd0, Hi: 0xdd1, Stride: 0x1}, - unicode.Range16{Lo: 0xdd8, Hi: 0xdde, Stride: 0x1}, - unicode.Range16{Lo: 0xdf2, Hi: 0xdf3, Stride: 0x1}, - unicode.Range16{Lo: 0xe33, Hi: 0xe33, Stride: 0x1}, - unicode.Range16{Lo: 0xeb3, Hi: 0xeb3, Stride: 0x1}, - unicode.Range16{Lo: 0xf3e, Hi: 0xf3f, Stride: 0x1}, - unicode.Range16{Lo: 0xf7f, Hi: 0xf7f, Stride: 0x1}, - unicode.Range16{Lo: 0x1031, Hi: 0x1031, Stride: 0x1}, - unicode.Range16{Lo: 0x103b, Hi: 0x103c, Stride: 0x1}, - unicode.Range16{Lo: 0x1056, Hi: 0x1057, Stride: 0x1}, - unicode.Range16{Lo: 0x1084, Hi: 0x1084, Stride: 0x1}, - unicode.Range16{Lo: 0x17b6, Hi: 0x17b6, Stride: 0x1}, - unicode.Range16{Lo: 0x17be, Hi: 0x17c5, Stride: 0x1}, - unicode.Range16{Lo: 0x17c7, Hi: 0x17c8, Stride: 0x1}, - unicode.Range16{Lo: 0x1923, Hi: 0x1926, Stride: 0x1}, - unicode.Range16{Lo: 0x1929, Hi: 0x192b, Stride: 0x1}, - unicode.Range16{Lo: 0x1930, Hi: 0x1931, Stride: 0x1}, - unicode.Range16{Lo: 0x1933, Hi: 0x1938, Stride: 0x1}, - unicode.Range16{Lo: 0x1a19, Hi: 0x1a1a, Stride: 0x1}, - unicode.Range16{Lo: 0x1a55, Hi: 0x1a55, Stride: 0x1}, - unicode.Range16{Lo: 0x1a57, Hi: 0x1a57, Stride: 0x1}, - unicode.Range16{Lo: 0x1a6d, Hi: 0x1a72, Stride: 0x1}, - unicode.Range16{Lo: 0x1b04, Hi: 0x1b04, Stride: 0x1}, - unicode.Range16{Lo: 0x1b35, Hi: 0x1b35, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3b, Hi: 0x1b3b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3d, Hi: 0x1b41, Stride: 0x1}, - unicode.Range16{Lo: 0x1b43, Hi: 0x1b44, Stride: 0x1}, - unicode.Range16{Lo: 0x1b82, Hi: 0x1b82, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba1, Hi: 0x1ba1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba6, Hi: 0x1ba7, Stride: 0x1}, - unicode.Range16{Lo: 0x1baa, Hi: 0x1baa, Stride: 0x1}, - unicode.Range16{Lo: 0x1be7, Hi: 0x1be7, Stride: 0x1}, - unicode.Range16{Lo: 0x1bea, Hi: 0x1bec, Stride: 0x1}, - unicode.Range16{Lo: 0x1bee, Hi: 0x1bee, Stride: 0x1}, - unicode.Range16{Lo: 0x1bf2, Hi: 0x1bf3, Stride: 0x1}, - unicode.Range16{Lo: 0x1c24, Hi: 0x1c2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1c34, Hi: 0x1c35, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, - unicode.Range16{Lo: 0xa823, Hi: 0xa824, Stride: 0x1}, - unicode.Range16{Lo: 0xa827, Hi: 0xa827, Stride: 0x1}, - unicode.Range16{Lo: 0xa880, Hi: 0xa881, Stride: 0x1}, - unicode.Range16{Lo: 0xa8b4, Hi: 0xa8c3, Stride: 0x1}, - unicode.Range16{Lo: 0xa952, Hi: 0xa953, Stride: 0x1}, - unicode.Range16{Lo: 0xa983, Hi: 0xa983, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, - unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, - unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, - unicode.Range16{Lo: 0xaa33, Hi: 0xaa34, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4d, Hi: 0xaa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xaaeb, Hi: 0xaaeb, Stride: 0x1}, - unicode.Range16{Lo: 0xaaee, Hi: 0xaaef, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf5, Hi: 0xaaf5, Stride: 0x1}, - unicode.Range16{Lo: 0xabe3, Hi: 0xabe4, Stride: 0x1}, - unicode.Range16{Lo: 0xabe6, Hi: 0xabe7, Stride: 0x1}, - unicode.Range16{Lo: 0xabe9, Hi: 0xabea, Stride: 0x1}, - unicode.Range16{Lo: 0xabec, Hi: 0xabec, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x11000, Hi: 0x11000, Stride: 0x1}, - unicode.Range32{Lo: 0x11002, Hi: 0x11002, Stride: 0x1}, - unicode.Range32{Lo: 0x11082, Hi: 0x11082, Stride: 0x1}, - unicode.Range32{Lo: 0x110b0, Hi: 0x110b2, Stride: 0x1}, - unicode.Range32{Lo: 0x110b7, Hi: 0x110b8, Stride: 0x1}, - unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, - unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, - unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, - unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1122c, Hi: 0x1122e, Stride: 0x1}, - unicode.Range32{Lo: 0x11232, Hi: 0x11233, Stride: 0x1}, - unicode.Range32{Lo: 0x11235, Hi: 0x11235, Stride: 0x1}, - unicode.Range32{Lo: 0x112e0, Hi: 0x112e2, Stride: 0x1}, - unicode.Range32{Lo: 0x11302, Hi: 0x11303, Stride: 0x1}, - unicode.Range32{Lo: 0x1133f, Hi: 0x1133f, Stride: 0x1}, - unicode.Range32{Lo: 0x11341, Hi: 0x11344, Stride: 0x1}, - unicode.Range32{Lo: 0x11347, Hi: 0x11348, Stride: 0x1}, - unicode.Range32{Lo: 0x1134b, Hi: 0x1134d, Stride: 0x1}, - unicode.Range32{Lo: 0x11362, Hi: 0x11363, Stride: 0x1}, - unicode.Range32{Lo: 0x11435, Hi: 0x11437, Stride: 0x1}, - unicode.Range32{Lo: 0x11440, Hi: 0x11441, Stride: 0x1}, - unicode.Range32{Lo: 0x11445, Hi: 0x11445, Stride: 0x1}, - unicode.Range32{Lo: 0x114b1, Hi: 0x114b2, Stride: 0x1}, - unicode.Range32{Lo: 0x114b9, Hi: 0x114b9, Stride: 0x1}, - unicode.Range32{Lo: 0x114bb, Hi: 0x114bc, Stride: 0x1}, - unicode.Range32{Lo: 0x114be, Hi: 0x114be, Stride: 0x1}, - unicode.Range32{Lo: 0x114c1, Hi: 0x114c1, Stride: 0x1}, - unicode.Range32{Lo: 0x115b0, Hi: 0x115b1, Stride: 0x1}, - unicode.Range32{Lo: 0x115b8, Hi: 0x115bb, Stride: 0x1}, - unicode.Range32{Lo: 0x115be, Hi: 0x115be, Stride: 0x1}, - unicode.Range32{Lo: 0x11630, Hi: 0x11632, Stride: 0x1}, - unicode.Range32{Lo: 0x1163b, Hi: 0x1163c, Stride: 0x1}, - unicode.Range32{Lo: 0x1163e, Hi: 0x1163e, Stride: 0x1}, - unicode.Range32{Lo: 0x116ac, Hi: 0x116ac, Stride: 0x1}, - unicode.Range32{Lo: 0x116ae, Hi: 0x116af, Stride: 0x1}, - unicode.Range32{Lo: 0x116b6, Hi: 0x116b6, Stride: 0x1}, - unicode.Range32{Lo: 0x11720, Hi: 0x11721, Stride: 0x1}, - unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, - unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3e, Hi: 0x11c3e, Stride: 0x1}, - unicode.Range32{Lo: 0x11ca9, Hi: 0x11ca9, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb1, Hi: 0x11cb1, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d166, Hi: 0x1d166, Stride: 0x1}, - unicode.Range32{Lo: 0x1d16d, Hi: 0x1d16d, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeT = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x11a8, Hi: 0x11ff, Stride: 0x1}, - unicode.Range16{Lo: 0xd7cb, Hi: 0xd7fb, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeV = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x1160, Hi: 0x11a7, Stride: 0x1}, - unicode.Range16{Lo: 0xd7b0, Hi: 0xd7c6, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _GraphemeZWJ = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x200d, Hi: 0x200d, Stride: 0x1}, - }, - LatinOffset: 0, -} - -type _GraphemeRuneRange unicode.RangeTable - -func _GraphemeRuneType(r rune) *_GraphemeRuneRange { - switch { - case unicode.Is(_GraphemeCR, r): - return (*_GraphemeRuneRange)(_GraphemeCR) - case unicode.Is(_GraphemeControl, r): - return (*_GraphemeRuneRange)(_GraphemeControl) - case unicode.Is(_GraphemeE_Base, r): - return (*_GraphemeRuneRange)(_GraphemeE_Base) - case unicode.Is(_GraphemeE_Base_GAZ, r): - return (*_GraphemeRuneRange)(_GraphemeE_Base_GAZ) - case unicode.Is(_GraphemeE_Modifier, r): - return (*_GraphemeRuneRange)(_GraphemeE_Modifier) - case unicode.Is(_GraphemeExtend, r): - return (*_GraphemeRuneRange)(_GraphemeExtend) - case unicode.Is(_GraphemeGlue_After_Zwj, r): - return (*_GraphemeRuneRange)(_GraphemeGlue_After_Zwj) - case unicode.Is(_GraphemeL, r): - return (*_GraphemeRuneRange)(_GraphemeL) - case unicode.Is(_GraphemeLF, r): - return (*_GraphemeRuneRange)(_GraphemeLF) - case unicode.Is(_GraphemeLV, r): - return (*_GraphemeRuneRange)(_GraphemeLV) - case unicode.Is(_GraphemeLVT, r): - return (*_GraphemeRuneRange)(_GraphemeLVT) - case unicode.Is(_GraphemePrepend, r): - return (*_GraphemeRuneRange)(_GraphemePrepend) - case unicode.Is(_GraphemeRegional_Indicator, r): - return (*_GraphemeRuneRange)(_GraphemeRegional_Indicator) - case unicode.Is(_GraphemeSpacingMark, r): - return (*_GraphemeRuneRange)(_GraphemeSpacingMark) - case unicode.Is(_GraphemeT, r): - return (*_GraphemeRuneRange)(_GraphemeT) - case unicode.Is(_GraphemeV, r): - return (*_GraphemeRuneRange)(_GraphemeV) - case unicode.Is(_GraphemeZWJ, r): - return (*_GraphemeRuneRange)(_GraphemeZWJ) - default: - return nil - } -} -func (rng *_GraphemeRuneRange) String() string { - switch (*unicode.RangeTable)(rng) { - case _GraphemeCR: - return "CR" - case _GraphemeControl: - return "Control" - case _GraphemeE_Base: - return "E_Base" - case _GraphemeE_Base_GAZ: - return "E_Base_GAZ" - case _GraphemeE_Modifier: - return "E_Modifier" - case _GraphemeExtend: - return "Extend" - case _GraphemeGlue_After_Zwj: - return "Glue_After_Zwj" - case _GraphemeL: - return "L" - case _GraphemeLF: - return "LF" - case _GraphemeLV: - return "LV" - case _GraphemeLVT: - return "LVT" - case _GraphemePrepend: - return "Prepend" - case _GraphemeRegional_Indicator: - return "Regional_Indicator" - case _GraphemeSpacingMark: - return "SpacingMark" - case _GraphemeT: - return "T" - case _GraphemeV: - return "V" - case _GraphemeZWJ: - return "ZWJ" - default: - return "Other" - } -} - -var _WordALetter = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x41, Hi: 0x5a, Stride: 0x1}, - unicode.Range16{Lo: 0x61, Hi: 0x7a, Stride: 0x1}, - unicode.Range16{Lo: 0xaa, Hi: 0xaa, Stride: 0x1}, - unicode.Range16{Lo: 0xb5, Hi: 0xb5, Stride: 0x1}, - unicode.Range16{Lo: 0xba, Hi: 0xba, Stride: 0x1}, - unicode.Range16{Lo: 0xc0, Hi: 0xd6, Stride: 0x1}, - unicode.Range16{Lo: 0xd8, Hi: 0xf6, Stride: 0x1}, - unicode.Range16{Lo: 0xf8, Hi: 0x1ba, Stride: 0x1}, - unicode.Range16{Lo: 0x1bb, Hi: 0x1bb, Stride: 0x1}, - unicode.Range16{Lo: 0x1bc, Hi: 0x1bf, Stride: 0x1}, - unicode.Range16{Lo: 0x1c0, Hi: 0x1c3, Stride: 0x1}, - unicode.Range16{Lo: 0x1c4, Hi: 0x293, Stride: 0x1}, - unicode.Range16{Lo: 0x294, Hi: 0x294, Stride: 0x1}, - unicode.Range16{Lo: 0x295, Hi: 0x2af, Stride: 0x1}, - unicode.Range16{Lo: 0x2b0, Hi: 0x2c1, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6, Hi: 0x2d1, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0, Hi: 0x2e4, Stride: 0x1}, - unicode.Range16{Lo: 0x2ec, Hi: 0x2ec, Stride: 0x1}, - unicode.Range16{Lo: 0x2ee, Hi: 0x2ee, Stride: 0x1}, - unicode.Range16{Lo: 0x370, Hi: 0x373, Stride: 0x1}, - unicode.Range16{Lo: 0x374, Hi: 0x374, Stride: 0x1}, - unicode.Range16{Lo: 0x376, Hi: 0x377, Stride: 0x1}, - unicode.Range16{Lo: 0x37a, Hi: 0x37a, Stride: 0x1}, - unicode.Range16{Lo: 0x37b, Hi: 0x37d, Stride: 0x1}, - unicode.Range16{Lo: 0x37f, Hi: 0x37f, Stride: 0x1}, - unicode.Range16{Lo: 0x386, Hi: 0x386, Stride: 0x1}, - unicode.Range16{Lo: 0x388, Hi: 0x38a, Stride: 0x1}, - unicode.Range16{Lo: 0x38c, Hi: 0x38c, Stride: 0x1}, - unicode.Range16{Lo: 0x38e, Hi: 0x3a1, Stride: 0x1}, - unicode.Range16{Lo: 0x3a3, Hi: 0x3f5, Stride: 0x1}, - unicode.Range16{Lo: 0x3f7, Hi: 0x481, Stride: 0x1}, - unicode.Range16{Lo: 0x48a, Hi: 0x52f, Stride: 0x1}, - unicode.Range16{Lo: 0x531, Hi: 0x556, Stride: 0x1}, - unicode.Range16{Lo: 0x559, Hi: 0x559, Stride: 0x1}, - unicode.Range16{Lo: 0x561, Hi: 0x587, Stride: 0x1}, - unicode.Range16{Lo: 0x5f3, Hi: 0x5f3, Stride: 0x1}, - unicode.Range16{Lo: 0x620, Hi: 0x63f, Stride: 0x1}, - unicode.Range16{Lo: 0x640, Hi: 0x640, Stride: 0x1}, - unicode.Range16{Lo: 0x641, Hi: 0x64a, Stride: 0x1}, - unicode.Range16{Lo: 0x66e, Hi: 0x66f, Stride: 0x1}, - unicode.Range16{Lo: 0x671, Hi: 0x6d3, Stride: 0x1}, - unicode.Range16{Lo: 0x6d5, Hi: 0x6d5, Stride: 0x1}, - unicode.Range16{Lo: 0x6e5, Hi: 0x6e6, Stride: 0x1}, - unicode.Range16{Lo: 0x6ee, Hi: 0x6ef, Stride: 0x1}, - unicode.Range16{Lo: 0x6fa, Hi: 0x6fc, Stride: 0x1}, - unicode.Range16{Lo: 0x6ff, Hi: 0x6ff, Stride: 0x1}, - unicode.Range16{Lo: 0x710, Hi: 0x710, Stride: 0x1}, - unicode.Range16{Lo: 0x712, Hi: 0x72f, Stride: 0x1}, - unicode.Range16{Lo: 0x74d, Hi: 0x7a5, Stride: 0x1}, - unicode.Range16{Lo: 0x7b1, Hi: 0x7b1, Stride: 0x1}, - unicode.Range16{Lo: 0x7ca, Hi: 0x7ea, Stride: 0x1}, - unicode.Range16{Lo: 0x7f4, Hi: 0x7f5, Stride: 0x1}, - unicode.Range16{Lo: 0x7fa, Hi: 0x7fa, Stride: 0x1}, - unicode.Range16{Lo: 0x800, Hi: 0x815, Stride: 0x1}, - unicode.Range16{Lo: 0x81a, Hi: 0x81a, Stride: 0x1}, - unicode.Range16{Lo: 0x824, Hi: 0x824, Stride: 0x1}, - unicode.Range16{Lo: 0x828, Hi: 0x828, Stride: 0x1}, - unicode.Range16{Lo: 0x840, Hi: 0x858, Stride: 0x1}, - unicode.Range16{Lo: 0x8a0, Hi: 0x8b4, Stride: 0x1}, - unicode.Range16{Lo: 0x8b6, Hi: 0x8bd, Stride: 0x1}, - unicode.Range16{Lo: 0x904, Hi: 0x939, Stride: 0x1}, - unicode.Range16{Lo: 0x93d, Hi: 0x93d, Stride: 0x1}, - unicode.Range16{Lo: 0x950, Hi: 0x950, Stride: 0x1}, - unicode.Range16{Lo: 0x958, Hi: 0x961, Stride: 0x1}, - unicode.Range16{Lo: 0x971, Hi: 0x971, Stride: 0x1}, - unicode.Range16{Lo: 0x972, Hi: 0x980, Stride: 0x1}, - unicode.Range16{Lo: 0x985, Hi: 0x98c, Stride: 0x1}, - unicode.Range16{Lo: 0x98f, Hi: 0x990, Stride: 0x1}, - unicode.Range16{Lo: 0x993, Hi: 0x9a8, Stride: 0x1}, - unicode.Range16{Lo: 0x9aa, Hi: 0x9b0, Stride: 0x1}, - unicode.Range16{Lo: 0x9b2, Hi: 0x9b2, Stride: 0x1}, - unicode.Range16{Lo: 0x9b6, Hi: 0x9b9, Stride: 0x1}, - unicode.Range16{Lo: 0x9bd, Hi: 0x9bd, Stride: 0x1}, - unicode.Range16{Lo: 0x9ce, Hi: 0x9ce, Stride: 0x1}, - unicode.Range16{Lo: 0x9dc, Hi: 0x9dd, Stride: 0x1}, - unicode.Range16{Lo: 0x9df, Hi: 0x9e1, Stride: 0x1}, - unicode.Range16{Lo: 0x9f0, Hi: 0x9f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa05, Hi: 0xa0a, Stride: 0x1}, - unicode.Range16{Lo: 0xa0f, Hi: 0xa10, Stride: 0x1}, - unicode.Range16{Lo: 0xa13, Hi: 0xa28, Stride: 0x1}, - unicode.Range16{Lo: 0xa2a, Hi: 0xa30, Stride: 0x1}, - unicode.Range16{Lo: 0xa32, Hi: 0xa33, Stride: 0x1}, - unicode.Range16{Lo: 0xa35, Hi: 0xa36, Stride: 0x1}, - unicode.Range16{Lo: 0xa38, Hi: 0xa39, Stride: 0x1}, - unicode.Range16{Lo: 0xa59, Hi: 0xa5c, Stride: 0x1}, - unicode.Range16{Lo: 0xa5e, Hi: 0xa5e, Stride: 0x1}, - unicode.Range16{Lo: 0xa72, Hi: 0xa74, Stride: 0x1}, - unicode.Range16{Lo: 0xa85, Hi: 0xa8d, Stride: 0x1}, - unicode.Range16{Lo: 0xa8f, Hi: 0xa91, Stride: 0x1}, - unicode.Range16{Lo: 0xa93, Hi: 0xaa8, Stride: 0x1}, - unicode.Range16{Lo: 0xaaa, Hi: 0xab0, Stride: 0x1}, - unicode.Range16{Lo: 0xab2, Hi: 0xab3, Stride: 0x1}, - unicode.Range16{Lo: 0xab5, Hi: 0xab9, Stride: 0x1}, - unicode.Range16{Lo: 0xabd, Hi: 0xabd, Stride: 0x1}, - unicode.Range16{Lo: 0xad0, Hi: 0xad0, Stride: 0x1}, - unicode.Range16{Lo: 0xae0, Hi: 0xae1, Stride: 0x1}, - unicode.Range16{Lo: 0xaf9, Hi: 0xaf9, Stride: 0x1}, - unicode.Range16{Lo: 0xb05, Hi: 0xb0c, Stride: 0x1}, - unicode.Range16{Lo: 0xb0f, Hi: 0xb10, Stride: 0x1}, - unicode.Range16{Lo: 0xb13, Hi: 0xb28, Stride: 0x1}, - unicode.Range16{Lo: 0xb2a, Hi: 0xb30, Stride: 0x1}, - unicode.Range16{Lo: 0xb32, Hi: 0xb33, Stride: 0x1}, - unicode.Range16{Lo: 0xb35, Hi: 0xb39, Stride: 0x1}, - unicode.Range16{Lo: 0xb3d, Hi: 0xb3d, Stride: 0x1}, - unicode.Range16{Lo: 0xb5c, Hi: 0xb5d, Stride: 0x1}, - unicode.Range16{Lo: 0xb5f, Hi: 0xb61, Stride: 0x1}, - unicode.Range16{Lo: 0xb71, Hi: 0xb71, Stride: 0x1}, - unicode.Range16{Lo: 0xb83, Hi: 0xb83, Stride: 0x1}, - unicode.Range16{Lo: 0xb85, Hi: 0xb8a, Stride: 0x1}, - unicode.Range16{Lo: 0xb8e, Hi: 0xb90, Stride: 0x1}, - unicode.Range16{Lo: 0xb92, Hi: 0xb95, Stride: 0x1}, - unicode.Range16{Lo: 0xb99, Hi: 0xb9a, Stride: 0x1}, - unicode.Range16{Lo: 0xb9c, Hi: 0xb9c, Stride: 0x1}, - unicode.Range16{Lo: 0xb9e, Hi: 0xb9f, Stride: 0x1}, - unicode.Range16{Lo: 0xba3, Hi: 0xba4, Stride: 0x1}, - unicode.Range16{Lo: 0xba8, Hi: 0xbaa, Stride: 0x1}, - unicode.Range16{Lo: 0xbae, Hi: 0xbb9, Stride: 0x1}, - unicode.Range16{Lo: 0xbd0, Hi: 0xbd0, Stride: 0x1}, - unicode.Range16{Lo: 0xc05, Hi: 0xc0c, Stride: 0x1}, - unicode.Range16{Lo: 0xc0e, Hi: 0xc10, Stride: 0x1}, - unicode.Range16{Lo: 0xc12, Hi: 0xc28, Stride: 0x1}, - unicode.Range16{Lo: 0xc2a, Hi: 0xc39, Stride: 0x1}, - unicode.Range16{Lo: 0xc3d, Hi: 0xc3d, Stride: 0x1}, - unicode.Range16{Lo: 0xc58, Hi: 0xc5a, Stride: 0x1}, - unicode.Range16{Lo: 0xc60, Hi: 0xc61, Stride: 0x1}, - unicode.Range16{Lo: 0xc80, Hi: 0xc80, Stride: 0x1}, - unicode.Range16{Lo: 0xc85, Hi: 0xc8c, Stride: 0x1}, - unicode.Range16{Lo: 0xc8e, Hi: 0xc90, Stride: 0x1}, - unicode.Range16{Lo: 0xc92, Hi: 0xca8, Stride: 0x1}, - unicode.Range16{Lo: 0xcaa, Hi: 0xcb3, Stride: 0x1}, - unicode.Range16{Lo: 0xcb5, Hi: 0xcb9, Stride: 0x1}, - unicode.Range16{Lo: 0xcbd, Hi: 0xcbd, Stride: 0x1}, - unicode.Range16{Lo: 0xcde, Hi: 0xcde, Stride: 0x1}, - unicode.Range16{Lo: 0xce0, Hi: 0xce1, Stride: 0x1}, - unicode.Range16{Lo: 0xcf1, Hi: 0xcf2, Stride: 0x1}, - unicode.Range16{Lo: 0xd05, Hi: 0xd0c, Stride: 0x1}, - unicode.Range16{Lo: 0xd0e, Hi: 0xd10, Stride: 0x1}, - unicode.Range16{Lo: 0xd12, Hi: 0xd3a, Stride: 0x1}, - unicode.Range16{Lo: 0xd3d, Hi: 0xd3d, Stride: 0x1}, - unicode.Range16{Lo: 0xd4e, Hi: 0xd4e, Stride: 0x1}, - unicode.Range16{Lo: 0xd54, Hi: 0xd56, Stride: 0x1}, - unicode.Range16{Lo: 0xd5f, Hi: 0xd61, Stride: 0x1}, - unicode.Range16{Lo: 0xd7a, Hi: 0xd7f, Stride: 0x1}, - unicode.Range16{Lo: 0xd85, Hi: 0xd96, Stride: 0x1}, - unicode.Range16{Lo: 0xd9a, Hi: 0xdb1, Stride: 0x1}, - unicode.Range16{Lo: 0xdb3, Hi: 0xdbb, Stride: 0x1}, - unicode.Range16{Lo: 0xdbd, Hi: 0xdbd, Stride: 0x1}, - unicode.Range16{Lo: 0xdc0, Hi: 0xdc6, Stride: 0x1}, - unicode.Range16{Lo: 0xf00, Hi: 0xf00, Stride: 0x1}, - unicode.Range16{Lo: 0xf40, Hi: 0xf47, Stride: 0x1}, - unicode.Range16{Lo: 0xf49, Hi: 0xf6c, Stride: 0x1}, - unicode.Range16{Lo: 0xf88, Hi: 0xf8c, Stride: 0x1}, - unicode.Range16{Lo: 0x10a0, Hi: 0x10c5, Stride: 0x1}, - unicode.Range16{Lo: 0x10c7, Hi: 0x10c7, Stride: 0x1}, - unicode.Range16{Lo: 0x10cd, Hi: 0x10cd, Stride: 0x1}, - unicode.Range16{Lo: 0x10d0, Hi: 0x10fa, Stride: 0x1}, - unicode.Range16{Lo: 0x10fc, Hi: 0x10fc, Stride: 0x1}, - unicode.Range16{Lo: 0x10fd, Hi: 0x1248, Stride: 0x1}, - unicode.Range16{Lo: 0x124a, Hi: 0x124d, Stride: 0x1}, - unicode.Range16{Lo: 0x1250, Hi: 0x1256, Stride: 0x1}, - unicode.Range16{Lo: 0x1258, Hi: 0x1258, Stride: 0x1}, - unicode.Range16{Lo: 0x125a, Hi: 0x125d, Stride: 0x1}, - unicode.Range16{Lo: 0x1260, Hi: 0x1288, Stride: 0x1}, - unicode.Range16{Lo: 0x128a, Hi: 0x128d, Stride: 0x1}, - unicode.Range16{Lo: 0x1290, Hi: 0x12b0, Stride: 0x1}, - unicode.Range16{Lo: 0x12b2, Hi: 0x12b5, Stride: 0x1}, - unicode.Range16{Lo: 0x12b8, Hi: 0x12be, Stride: 0x1}, - unicode.Range16{Lo: 0x12c0, Hi: 0x12c0, Stride: 0x1}, - unicode.Range16{Lo: 0x12c2, Hi: 0x12c5, Stride: 0x1}, - unicode.Range16{Lo: 0x12c8, Hi: 0x12d6, Stride: 0x1}, - unicode.Range16{Lo: 0x12d8, Hi: 0x1310, Stride: 0x1}, - unicode.Range16{Lo: 0x1312, Hi: 0x1315, Stride: 0x1}, - unicode.Range16{Lo: 0x1318, Hi: 0x135a, Stride: 0x1}, - unicode.Range16{Lo: 0x1380, Hi: 0x138f, Stride: 0x1}, - unicode.Range16{Lo: 0x13a0, Hi: 0x13f5, Stride: 0x1}, - unicode.Range16{Lo: 0x13f8, Hi: 0x13fd, Stride: 0x1}, - unicode.Range16{Lo: 0x1401, Hi: 0x166c, Stride: 0x1}, - unicode.Range16{Lo: 0x166f, Hi: 0x167f, Stride: 0x1}, - unicode.Range16{Lo: 0x1681, Hi: 0x169a, Stride: 0x1}, - unicode.Range16{Lo: 0x16a0, Hi: 0x16ea, Stride: 0x1}, - unicode.Range16{Lo: 0x16ee, Hi: 0x16f0, Stride: 0x1}, - unicode.Range16{Lo: 0x16f1, Hi: 0x16f8, Stride: 0x1}, - unicode.Range16{Lo: 0x1700, Hi: 0x170c, Stride: 0x1}, - unicode.Range16{Lo: 0x170e, Hi: 0x1711, Stride: 0x1}, - unicode.Range16{Lo: 0x1720, Hi: 0x1731, Stride: 0x1}, - unicode.Range16{Lo: 0x1740, Hi: 0x1751, Stride: 0x1}, - unicode.Range16{Lo: 0x1760, Hi: 0x176c, Stride: 0x1}, - unicode.Range16{Lo: 0x176e, Hi: 0x1770, Stride: 0x1}, - unicode.Range16{Lo: 0x1820, Hi: 0x1842, Stride: 0x1}, - unicode.Range16{Lo: 0x1843, Hi: 0x1843, Stride: 0x1}, - unicode.Range16{Lo: 0x1844, Hi: 0x1877, Stride: 0x1}, - unicode.Range16{Lo: 0x1880, Hi: 0x1884, Stride: 0x1}, - unicode.Range16{Lo: 0x1887, Hi: 0x18a8, Stride: 0x1}, - unicode.Range16{Lo: 0x18aa, Hi: 0x18aa, Stride: 0x1}, - unicode.Range16{Lo: 0x18b0, Hi: 0x18f5, Stride: 0x1}, - unicode.Range16{Lo: 0x1900, Hi: 0x191e, Stride: 0x1}, - unicode.Range16{Lo: 0x1a00, Hi: 0x1a16, Stride: 0x1}, - unicode.Range16{Lo: 0x1b05, Hi: 0x1b33, Stride: 0x1}, - unicode.Range16{Lo: 0x1b45, Hi: 0x1b4b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b83, Hi: 0x1ba0, Stride: 0x1}, - unicode.Range16{Lo: 0x1bae, Hi: 0x1baf, Stride: 0x1}, - unicode.Range16{Lo: 0x1bba, Hi: 0x1be5, Stride: 0x1}, - unicode.Range16{Lo: 0x1c00, Hi: 0x1c23, Stride: 0x1}, - unicode.Range16{Lo: 0x1c4d, Hi: 0x1c4f, Stride: 0x1}, - unicode.Range16{Lo: 0x1c5a, Hi: 0x1c77, Stride: 0x1}, - unicode.Range16{Lo: 0x1c78, Hi: 0x1c7d, Stride: 0x1}, - unicode.Range16{Lo: 0x1c80, Hi: 0x1c88, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce9, Hi: 0x1cec, Stride: 0x1}, - unicode.Range16{Lo: 0x1cee, Hi: 0x1cf1, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf5, Hi: 0x1cf6, Stride: 0x1}, - unicode.Range16{Lo: 0x1d00, Hi: 0x1d2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1d2c, Hi: 0x1d6a, Stride: 0x1}, - unicode.Range16{Lo: 0x1d6b, Hi: 0x1d77, Stride: 0x1}, - unicode.Range16{Lo: 0x1d78, Hi: 0x1d78, Stride: 0x1}, - unicode.Range16{Lo: 0x1d79, Hi: 0x1d9a, Stride: 0x1}, - unicode.Range16{Lo: 0x1d9b, Hi: 0x1dbf, Stride: 0x1}, - unicode.Range16{Lo: 0x1e00, Hi: 0x1f15, Stride: 0x1}, - unicode.Range16{Lo: 0x1f18, Hi: 0x1f1d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f20, Hi: 0x1f45, Stride: 0x1}, - unicode.Range16{Lo: 0x1f48, Hi: 0x1f4d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f50, Hi: 0x1f57, Stride: 0x1}, - unicode.Range16{Lo: 0x1f59, Hi: 0x1f59, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5b, Hi: 0x1f5b, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5d, Hi: 0x1f5d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5f, Hi: 0x1f7d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f80, Hi: 0x1fb4, Stride: 0x1}, - unicode.Range16{Lo: 0x1fb6, Hi: 0x1fbc, Stride: 0x1}, - unicode.Range16{Lo: 0x1fbe, Hi: 0x1fbe, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc2, Hi: 0x1fc4, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc6, Hi: 0x1fcc, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd0, Hi: 0x1fd3, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd6, Hi: 0x1fdb, Stride: 0x1}, - unicode.Range16{Lo: 0x1fe0, Hi: 0x1fec, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff2, Hi: 0x1ff4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff6, Hi: 0x1ffc, Stride: 0x1}, - unicode.Range16{Lo: 0x2071, Hi: 0x2071, Stride: 0x1}, - unicode.Range16{Lo: 0x207f, Hi: 0x207f, Stride: 0x1}, - unicode.Range16{Lo: 0x2090, Hi: 0x209c, Stride: 0x1}, - unicode.Range16{Lo: 0x2102, Hi: 0x2102, Stride: 0x1}, - unicode.Range16{Lo: 0x2107, Hi: 0x2107, Stride: 0x1}, - unicode.Range16{Lo: 0x210a, Hi: 0x2113, Stride: 0x1}, - unicode.Range16{Lo: 0x2115, Hi: 0x2115, Stride: 0x1}, - unicode.Range16{Lo: 0x2119, Hi: 0x211d, Stride: 0x1}, - unicode.Range16{Lo: 0x2124, Hi: 0x2124, Stride: 0x1}, - unicode.Range16{Lo: 0x2126, Hi: 0x2126, Stride: 0x1}, - unicode.Range16{Lo: 0x2128, Hi: 0x2128, Stride: 0x1}, - unicode.Range16{Lo: 0x212a, Hi: 0x212d, Stride: 0x1}, - unicode.Range16{Lo: 0x212f, Hi: 0x2134, Stride: 0x1}, - unicode.Range16{Lo: 0x2135, Hi: 0x2138, Stride: 0x1}, - unicode.Range16{Lo: 0x2139, Hi: 0x2139, Stride: 0x1}, - unicode.Range16{Lo: 0x213c, Hi: 0x213f, Stride: 0x1}, - unicode.Range16{Lo: 0x2145, Hi: 0x2149, Stride: 0x1}, - unicode.Range16{Lo: 0x214e, Hi: 0x214e, Stride: 0x1}, - unicode.Range16{Lo: 0x2160, Hi: 0x2182, Stride: 0x1}, - unicode.Range16{Lo: 0x2183, Hi: 0x2184, Stride: 0x1}, - unicode.Range16{Lo: 0x2185, Hi: 0x2188, Stride: 0x1}, - unicode.Range16{Lo: 0x24b6, Hi: 0x24e9, Stride: 0x1}, - unicode.Range16{Lo: 0x2c00, Hi: 0x2c2e, Stride: 0x1}, - unicode.Range16{Lo: 0x2c30, Hi: 0x2c5e, Stride: 0x1}, - unicode.Range16{Lo: 0x2c60, Hi: 0x2c7b, Stride: 0x1}, - unicode.Range16{Lo: 0x2c7c, Hi: 0x2c7d, Stride: 0x1}, - unicode.Range16{Lo: 0x2c7e, Hi: 0x2ce4, Stride: 0x1}, - unicode.Range16{Lo: 0x2ceb, Hi: 0x2cee, Stride: 0x1}, - unicode.Range16{Lo: 0x2cf2, Hi: 0x2cf3, Stride: 0x1}, - unicode.Range16{Lo: 0x2d00, Hi: 0x2d25, Stride: 0x1}, - unicode.Range16{Lo: 0x2d27, Hi: 0x2d27, Stride: 0x1}, - unicode.Range16{Lo: 0x2d2d, Hi: 0x2d2d, Stride: 0x1}, - unicode.Range16{Lo: 0x2d30, Hi: 0x2d67, Stride: 0x1}, - unicode.Range16{Lo: 0x2d6f, Hi: 0x2d6f, Stride: 0x1}, - unicode.Range16{Lo: 0x2d80, Hi: 0x2d96, Stride: 0x1}, - unicode.Range16{Lo: 0x2da0, Hi: 0x2da6, Stride: 0x1}, - unicode.Range16{Lo: 0x2da8, Hi: 0x2dae, Stride: 0x1}, - unicode.Range16{Lo: 0x2db0, Hi: 0x2db6, Stride: 0x1}, - unicode.Range16{Lo: 0x2db8, Hi: 0x2dbe, Stride: 0x1}, - unicode.Range16{Lo: 0x2dc0, Hi: 0x2dc6, Stride: 0x1}, - unicode.Range16{Lo: 0x2dc8, Hi: 0x2dce, Stride: 0x1}, - unicode.Range16{Lo: 0x2dd0, Hi: 0x2dd6, Stride: 0x1}, - unicode.Range16{Lo: 0x2dd8, Hi: 0x2dde, Stride: 0x1}, - unicode.Range16{Lo: 0x2e2f, Hi: 0x2e2f, Stride: 0x1}, - unicode.Range16{Lo: 0x3005, Hi: 0x3005, Stride: 0x1}, - unicode.Range16{Lo: 0x303b, Hi: 0x303b, Stride: 0x1}, - unicode.Range16{Lo: 0x303c, Hi: 0x303c, Stride: 0x1}, - unicode.Range16{Lo: 0x3105, Hi: 0x312d, Stride: 0x1}, - unicode.Range16{Lo: 0x3131, Hi: 0x318e, Stride: 0x1}, - unicode.Range16{Lo: 0x31a0, Hi: 0x31ba, Stride: 0x1}, - unicode.Range16{Lo: 0xa000, Hi: 0xa014, Stride: 0x1}, - unicode.Range16{Lo: 0xa015, Hi: 0xa015, Stride: 0x1}, - unicode.Range16{Lo: 0xa016, Hi: 0xa48c, Stride: 0x1}, - unicode.Range16{Lo: 0xa4d0, Hi: 0xa4f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa4f8, Hi: 0xa4fd, Stride: 0x1}, - unicode.Range16{Lo: 0xa500, Hi: 0xa60b, Stride: 0x1}, - unicode.Range16{Lo: 0xa60c, Hi: 0xa60c, Stride: 0x1}, - unicode.Range16{Lo: 0xa610, Hi: 0xa61f, Stride: 0x1}, - unicode.Range16{Lo: 0xa62a, Hi: 0xa62b, Stride: 0x1}, - unicode.Range16{Lo: 0xa640, Hi: 0xa66d, Stride: 0x1}, - unicode.Range16{Lo: 0xa66e, Hi: 0xa66e, Stride: 0x1}, - unicode.Range16{Lo: 0xa67f, Hi: 0xa67f, Stride: 0x1}, - unicode.Range16{Lo: 0xa680, Hi: 0xa69b, Stride: 0x1}, - unicode.Range16{Lo: 0xa69c, Hi: 0xa69d, Stride: 0x1}, - unicode.Range16{Lo: 0xa6a0, Hi: 0xa6e5, Stride: 0x1}, - unicode.Range16{Lo: 0xa6e6, Hi: 0xa6ef, Stride: 0x1}, - unicode.Range16{Lo: 0xa717, Hi: 0xa71f, Stride: 0x1}, - unicode.Range16{Lo: 0xa722, Hi: 0xa76f, Stride: 0x1}, - unicode.Range16{Lo: 0xa770, Hi: 0xa770, Stride: 0x1}, - unicode.Range16{Lo: 0xa771, Hi: 0xa787, Stride: 0x1}, - unicode.Range16{Lo: 0xa788, Hi: 0xa788, Stride: 0x1}, - unicode.Range16{Lo: 0xa78b, Hi: 0xa78e, Stride: 0x1}, - unicode.Range16{Lo: 0xa78f, Hi: 0xa78f, Stride: 0x1}, - unicode.Range16{Lo: 0xa790, Hi: 0xa7ae, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b0, Hi: 0xa7b7, Stride: 0x1}, - unicode.Range16{Lo: 0xa7f7, Hi: 0xa7f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa7f8, Hi: 0xa7f9, Stride: 0x1}, - unicode.Range16{Lo: 0xa7fa, Hi: 0xa7fa, Stride: 0x1}, - unicode.Range16{Lo: 0xa7fb, Hi: 0xa801, Stride: 0x1}, - unicode.Range16{Lo: 0xa803, Hi: 0xa805, Stride: 0x1}, - unicode.Range16{Lo: 0xa807, Hi: 0xa80a, Stride: 0x1}, - unicode.Range16{Lo: 0xa80c, Hi: 0xa822, Stride: 0x1}, - unicode.Range16{Lo: 0xa840, Hi: 0xa873, Stride: 0x1}, - unicode.Range16{Lo: 0xa882, Hi: 0xa8b3, Stride: 0x1}, - unicode.Range16{Lo: 0xa8f2, Hi: 0xa8f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fb, Hi: 0xa8fb, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fd, Stride: 0x1}, - unicode.Range16{Lo: 0xa90a, Hi: 0xa925, Stride: 0x1}, - unicode.Range16{Lo: 0xa930, Hi: 0xa946, Stride: 0x1}, - unicode.Range16{Lo: 0xa960, Hi: 0xa97c, Stride: 0x1}, - unicode.Range16{Lo: 0xa984, Hi: 0xa9b2, Stride: 0x1}, - unicode.Range16{Lo: 0xa9cf, Hi: 0xa9cf, Stride: 0x1}, - unicode.Range16{Lo: 0xaa00, Hi: 0xaa28, Stride: 0x1}, - unicode.Range16{Lo: 0xaa40, Hi: 0xaa42, Stride: 0x1}, - unicode.Range16{Lo: 0xaa44, Hi: 0xaa4b, Stride: 0x1}, - unicode.Range16{Lo: 0xaae0, Hi: 0xaaea, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf2, Hi: 0xaaf2, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf3, Hi: 0xaaf4, Stride: 0x1}, - unicode.Range16{Lo: 0xab01, Hi: 0xab06, Stride: 0x1}, - unicode.Range16{Lo: 0xab09, Hi: 0xab0e, Stride: 0x1}, - unicode.Range16{Lo: 0xab11, Hi: 0xab16, Stride: 0x1}, - unicode.Range16{Lo: 0xab20, Hi: 0xab26, Stride: 0x1}, - unicode.Range16{Lo: 0xab28, Hi: 0xab2e, Stride: 0x1}, - unicode.Range16{Lo: 0xab30, Hi: 0xab5a, Stride: 0x1}, - unicode.Range16{Lo: 0xab5c, Hi: 0xab5f, Stride: 0x1}, - unicode.Range16{Lo: 0xab60, Hi: 0xab65, Stride: 0x1}, - unicode.Range16{Lo: 0xab70, Hi: 0xabbf, Stride: 0x1}, - unicode.Range16{Lo: 0xabc0, Hi: 0xabe2, Stride: 0x1}, - unicode.Range16{Lo: 0xac00, Hi: 0xd7a3, Stride: 0x1}, - unicode.Range16{Lo: 0xd7b0, Hi: 0xd7c6, Stride: 0x1}, - unicode.Range16{Lo: 0xd7cb, Hi: 0xd7fb, Stride: 0x1}, - unicode.Range16{Lo: 0xfb00, Hi: 0xfb06, Stride: 0x1}, - unicode.Range16{Lo: 0xfb13, Hi: 0xfb17, Stride: 0x1}, - unicode.Range16{Lo: 0xfb50, Hi: 0xfbb1, Stride: 0x1}, - unicode.Range16{Lo: 0xfbd3, Hi: 0xfd3d, Stride: 0x1}, - unicode.Range16{Lo: 0xfd50, Hi: 0xfd8f, Stride: 0x1}, - unicode.Range16{Lo: 0xfd92, Hi: 0xfdc7, Stride: 0x1}, - unicode.Range16{Lo: 0xfdf0, Hi: 0xfdfb, Stride: 0x1}, - unicode.Range16{Lo: 0xfe70, Hi: 0xfe74, Stride: 0x1}, - unicode.Range16{Lo: 0xfe76, Hi: 0xfefc, Stride: 0x1}, - unicode.Range16{Lo: 0xff21, Hi: 0xff3a, Stride: 0x1}, - unicode.Range16{Lo: 0xff41, Hi: 0xff5a, Stride: 0x1}, - unicode.Range16{Lo: 0xffa0, Hi: 0xffbe, Stride: 0x1}, - unicode.Range16{Lo: 0xffc2, Hi: 0xffc7, Stride: 0x1}, - unicode.Range16{Lo: 0xffca, Hi: 0xffcf, Stride: 0x1}, - unicode.Range16{Lo: 0xffd2, Hi: 0xffd7, Stride: 0x1}, - unicode.Range16{Lo: 0xffda, Hi: 0xffdc, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x10000, Hi: 0x1000b, Stride: 0x1}, - unicode.Range32{Lo: 0x1000d, Hi: 0x10026, Stride: 0x1}, - unicode.Range32{Lo: 0x10028, Hi: 0x1003a, Stride: 0x1}, - unicode.Range32{Lo: 0x1003c, Hi: 0x1003d, Stride: 0x1}, - unicode.Range32{Lo: 0x1003f, Hi: 0x1004d, Stride: 0x1}, - unicode.Range32{Lo: 0x10050, Hi: 0x1005d, Stride: 0x1}, - unicode.Range32{Lo: 0x10080, Hi: 0x100fa, Stride: 0x1}, - unicode.Range32{Lo: 0x10140, Hi: 0x10174, Stride: 0x1}, - unicode.Range32{Lo: 0x10280, Hi: 0x1029c, Stride: 0x1}, - unicode.Range32{Lo: 0x102a0, Hi: 0x102d0, Stride: 0x1}, - unicode.Range32{Lo: 0x10300, Hi: 0x1031f, Stride: 0x1}, - unicode.Range32{Lo: 0x10330, Hi: 0x10340, Stride: 0x1}, - unicode.Range32{Lo: 0x10341, Hi: 0x10341, Stride: 0x1}, - unicode.Range32{Lo: 0x10342, Hi: 0x10349, Stride: 0x1}, - unicode.Range32{Lo: 0x1034a, Hi: 0x1034a, Stride: 0x1}, - unicode.Range32{Lo: 0x10350, Hi: 0x10375, Stride: 0x1}, - unicode.Range32{Lo: 0x10380, Hi: 0x1039d, Stride: 0x1}, - unicode.Range32{Lo: 0x103a0, Hi: 0x103c3, Stride: 0x1}, - unicode.Range32{Lo: 0x103c8, Hi: 0x103cf, Stride: 0x1}, - unicode.Range32{Lo: 0x103d1, Hi: 0x103d5, Stride: 0x1}, - unicode.Range32{Lo: 0x10400, Hi: 0x1044f, Stride: 0x1}, - unicode.Range32{Lo: 0x10450, Hi: 0x1049d, Stride: 0x1}, - unicode.Range32{Lo: 0x104b0, Hi: 0x104d3, Stride: 0x1}, - unicode.Range32{Lo: 0x104d8, Hi: 0x104fb, Stride: 0x1}, - unicode.Range32{Lo: 0x10500, Hi: 0x10527, Stride: 0x1}, - unicode.Range32{Lo: 0x10530, Hi: 0x10563, Stride: 0x1}, - unicode.Range32{Lo: 0x10600, Hi: 0x10736, Stride: 0x1}, - unicode.Range32{Lo: 0x10740, Hi: 0x10755, Stride: 0x1}, - unicode.Range32{Lo: 0x10760, Hi: 0x10767, Stride: 0x1}, - unicode.Range32{Lo: 0x10800, Hi: 0x10805, Stride: 0x1}, - unicode.Range32{Lo: 0x10808, Hi: 0x10808, Stride: 0x1}, - unicode.Range32{Lo: 0x1080a, Hi: 0x10835, Stride: 0x1}, - unicode.Range32{Lo: 0x10837, Hi: 0x10838, Stride: 0x1}, - unicode.Range32{Lo: 0x1083c, Hi: 0x1083c, Stride: 0x1}, - unicode.Range32{Lo: 0x1083f, Hi: 0x10855, Stride: 0x1}, - unicode.Range32{Lo: 0x10860, Hi: 0x10876, Stride: 0x1}, - unicode.Range32{Lo: 0x10880, Hi: 0x1089e, Stride: 0x1}, - unicode.Range32{Lo: 0x108e0, Hi: 0x108f2, Stride: 0x1}, - unicode.Range32{Lo: 0x108f4, Hi: 0x108f5, Stride: 0x1}, - unicode.Range32{Lo: 0x10900, Hi: 0x10915, Stride: 0x1}, - unicode.Range32{Lo: 0x10920, Hi: 0x10939, Stride: 0x1}, - unicode.Range32{Lo: 0x10980, Hi: 0x109b7, Stride: 0x1}, - unicode.Range32{Lo: 0x109be, Hi: 0x109bf, Stride: 0x1}, - unicode.Range32{Lo: 0x10a00, Hi: 0x10a00, Stride: 0x1}, - unicode.Range32{Lo: 0x10a10, Hi: 0x10a13, Stride: 0x1}, - unicode.Range32{Lo: 0x10a15, Hi: 0x10a17, Stride: 0x1}, - unicode.Range32{Lo: 0x10a19, Hi: 0x10a33, Stride: 0x1}, - unicode.Range32{Lo: 0x10a60, Hi: 0x10a7c, Stride: 0x1}, - unicode.Range32{Lo: 0x10a80, Hi: 0x10a9c, Stride: 0x1}, - unicode.Range32{Lo: 0x10ac0, Hi: 0x10ac7, Stride: 0x1}, - unicode.Range32{Lo: 0x10ac9, Hi: 0x10ae4, Stride: 0x1}, - unicode.Range32{Lo: 0x10b00, Hi: 0x10b35, Stride: 0x1}, - unicode.Range32{Lo: 0x10b40, Hi: 0x10b55, Stride: 0x1}, - unicode.Range32{Lo: 0x10b60, Hi: 0x10b72, Stride: 0x1}, - unicode.Range32{Lo: 0x10b80, Hi: 0x10b91, Stride: 0x1}, - unicode.Range32{Lo: 0x10c00, Hi: 0x10c48, Stride: 0x1}, - unicode.Range32{Lo: 0x10c80, Hi: 0x10cb2, Stride: 0x1}, - unicode.Range32{Lo: 0x10cc0, Hi: 0x10cf2, Stride: 0x1}, - unicode.Range32{Lo: 0x11003, Hi: 0x11037, Stride: 0x1}, - unicode.Range32{Lo: 0x11083, Hi: 0x110af, Stride: 0x1}, - unicode.Range32{Lo: 0x110d0, Hi: 0x110e8, Stride: 0x1}, - unicode.Range32{Lo: 0x11103, Hi: 0x11126, Stride: 0x1}, - unicode.Range32{Lo: 0x11150, Hi: 0x11172, Stride: 0x1}, - unicode.Range32{Lo: 0x11176, Hi: 0x11176, Stride: 0x1}, - unicode.Range32{Lo: 0x11183, Hi: 0x111b2, Stride: 0x1}, - unicode.Range32{Lo: 0x111c1, Hi: 0x111c4, Stride: 0x1}, - unicode.Range32{Lo: 0x111da, Hi: 0x111da, Stride: 0x1}, - unicode.Range32{Lo: 0x111dc, Hi: 0x111dc, Stride: 0x1}, - unicode.Range32{Lo: 0x11200, Hi: 0x11211, Stride: 0x1}, - unicode.Range32{Lo: 0x11213, Hi: 0x1122b, Stride: 0x1}, - unicode.Range32{Lo: 0x11280, Hi: 0x11286, Stride: 0x1}, - unicode.Range32{Lo: 0x11288, Hi: 0x11288, Stride: 0x1}, - unicode.Range32{Lo: 0x1128a, Hi: 0x1128d, Stride: 0x1}, - unicode.Range32{Lo: 0x1128f, Hi: 0x1129d, Stride: 0x1}, - unicode.Range32{Lo: 0x1129f, Hi: 0x112a8, Stride: 0x1}, - unicode.Range32{Lo: 0x112b0, Hi: 0x112de, Stride: 0x1}, - unicode.Range32{Lo: 0x11305, Hi: 0x1130c, Stride: 0x1}, - unicode.Range32{Lo: 0x1130f, Hi: 0x11310, Stride: 0x1}, - unicode.Range32{Lo: 0x11313, Hi: 0x11328, Stride: 0x1}, - unicode.Range32{Lo: 0x1132a, Hi: 0x11330, Stride: 0x1}, - unicode.Range32{Lo: 0x11332, Hi: 0x11333, Stride: 0x1}, - unicode.Range32{Lo: 0x11335, Hi: 0x11339, Stride: 0x1}, - unicode.Range32{Lo: 0x1133d, Hi: 0x1133d, Stride: 0x1}, - unicode.Range32{Lo: 0x11350, Hi: 0x11350, Stride: 0x1}, - unicode.Range32{Lo: 0x1135d, Hi: 0x11361, Stride: 0x1}, - unicode.Range32{Lo: 0x11400, Hi: 0x11434, Stride: 0x1}, - unicode.Range32{Lo: 0x11447, Hi: 0x1144a, Stride: 0x1}, - unicode.Range32{Lo: 0x11480, Hi: 0x114af, Stride: 0x1}, - unicode.Range32{Lo: 0x114c4, Hi: 0x114c5, Stride: 0x1}, - unicode.Range32{Lo: 0x114c7, Hi: 0x114c7, Stride: 0x1}, - unicode.Range32{Lo: 0x11580, Hi: 0x115ae, Stride: 0x1}, - unicode.Range32{Lo: 0x115d8, Hi: 0x115db, Stride: 0x1}, - unicode.Range32{Lo: 0x11600, Hi: 0x1162f, Stride: 0x1}, - unicode.Range32{Lo: 0x11644, Hi: 0x11644, Stride: 0x1}, - unicode.Range32{Lo: 0x11680, Hi: 0x116aa, Stride: 0x1}, - unicode.Range32{Lo: 0x118a0, Hi: 0x118df, Stride: 0x1}, - unicode.Range32{Lo: 0x118ff, Hi: 0x118ff, Stride: 0x1}, - unicode.Range32{Lo: 0x11ac0, Hi: 0x11af8, Stride: 0x1}, - unicode.Range32{Lo: 0x11c00, Hi: 0x11c08, Stride: 0x1}, - unicode.Range32{Lo: 0x11c0a, Hi: 0x11c2e, Stride: 0x1}, - unicode.Range32{Lo: 0x11c40, Hi: 0x11c40, Stride: 0x1}, - unicode.Range32{Lo: 0x11c72, Hi: 0x11c8f, Stride: 0x1}, - unicode.Range32{Lo: 0x12000, Hi: 0x12399, Stride: 0x1}, - unicode.Range32{Lo: 0x12400, Hi: 0x1246e, Stride: 0x1}, - unicode.Range32{Lo: 0x12480, Hi: 0x12543, Stride: 0x1}, - unicode.Range32{Lo: 0x13000, Hi: 0x1342e, Stride: 0x1}, - unicode.Range32{Lo: 0x14400, Hi: 0x14646, Stride: 0x1}, - unicode.Range32{Lo: 0x16800, Hi: 0x16a38, Stride: 0x1}, - unicode.Range32{Lo: 0x16a40, Hi: 0x16a5e, Stride: 0x1}, - unicode.Range32{Lo: 0x16ad0, Hi: 0x16aed, Stride: 0x1}, - unicode.Range32{Lo: 0x16b00, Hi: 0x16b2f, Stride: 0x1}, - unicode.Range32{Lo: 0x16b40, Hi: 0x16b43, Stride: 0x1}, - unicode.Range32{Lo: 0x16b63, Hi: 0x16b77, Stride: 0x1}, - unicode.Range32{Lo: 0x16b7d, Hi: 0x16b8f, Stride: 0x1}, - unicode.Range32{Lo: 0x16f00, Hi: 0x16f44, Stride: 0x1}, - unicode.Range32{Lo: 0x16f50, Hi: 0x16f50, Stride: 0x1}, - unicode.Range32{Lo: 0x16f93, Hi: 0x16f9f, Stride: 0x1}, - unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe0, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc00, Hi: 0x1bc6a, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc70, Hi: 0x1bc7c, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc80, Hi: 0x1bc88, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc90, Hi: 0x1bc99, Stride: 0x1}, - unicode.Range32{Lo: 0x1d400, Hi: 0x1d454, Stride: 0x1}, - unicode.Range32{Lo: 0x1d456, Hi: 0x1d49c, Stride: 0x1}, - unicode.Range32{Lo: 0x1d49e, Hi: 0x1d49f, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a2, Hi: 0x1d4a2, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a5, Hi: 0x1d4a6, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a9, Hi: 0x1d4ac, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4ae, Hi: 0x1d4b9, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4bb, Hi: 0x1d4bb, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4bd, Hi: 0x1d4c3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4c5, Hi: 0x1d505, Stride: 0x1}, - unicode.Range32{Lo: 0x1d507, Hi: 0x1d50a, Stride: 0x1}, - unicode.Range32{Lo: 0x1d50d, Hi: 0x1d514, Stride: 0x1}, - unicode.Range32{Lo: 0x1d516, Hi: 0x1d51c, Stride: 0x1}, - unicode.Range32{Lo: 0x1d51e, Hi: 0x1d539, Stride: 0x1}, - unicode.Range32{Lo: 0x1d53b, Hi: 0x1d53e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d540, Hi: 0x1d544, Stride: 0x1}, - unicode.Range32{Lo: 0x1d546, Hi: 0x1d546, Stride: 0x1}, - unicode.Range32{Lo: 0x1d54a, Hi: 0x1d550, Stride: 0x1}, - unicode.Range32{Lo: 0x1d552, Hi: 0x1d6a5, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6a8, Hi: 0x1d6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6c2, Hi: 0x1d6da, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6dc, Hi: 0x1d6fa, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6fc, Hi: 0x1d714, Stride: 0x1}, - unicode.Range32{Lo: 0x1d716, Hi: 0x1d734, Stride: 0x1}, - unicode.Range32{Lo: 0x1d736, Hi: 0x1d74e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d750, Hi: 0x1d76e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d770, Hi: 0x1d788, Stride: 0x1}, - unicode.Range32{Lo: 0x1d78a, Hi: 0x1d7a8, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7aa, Hi: 0x1d7c2, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7c4, Hi: 0x1d7cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1e800, Hi: 0x1e8c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1e900, Hi: 0x1e943, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee00, Hi: 0x1ee03, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee05, Hi: 0x1ee1f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee21, Hi: 0x1ee22, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee24, Hi: 0x1ee24, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee27, Hi: 0x1ee27, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee29, Hi: 0x1ee32, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee34, Hi: 0x1ee37, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee39, Hi: 0x1ee39, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee3b, Hi: 0x1ee3b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee42, Hi: 0x1ee42, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee47, Hi: 0x1ee47, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee49, Hi: 0x1ee49, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee4b, Hi: 0x1ee4b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee4d, Hi: 0x1ee4f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee51, Hi: 0x1ee52, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee54, Hi: 0x1ee54, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee57, Hi: 0x1ee57, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee59, Hi: 0x1ee59, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5b, Hi: 0x1ee5b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5d, Hi: 0x1ee5d, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5f, Hi: 0x1ee5f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee61, Hi: 0x1ee62, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee64, Hi: 0x1ee64, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee67, Hi: 0x1ee6a, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee6c, Hi: 0x1ee72, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee74, Hi: 0x1ee77, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee79, Hi: 0x1ee7c, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee7e, Hi: 0x1ee7e, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee80, Hi: 0x1ee89, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee8b, Hi: 0x1ee9b, Stride: 0x1}, - unicode.Range32{Lo: 0x1eea1, Hi: 0x1eea3, Stride: 0x1}, - unicode.Range32{Lo: 0x1eea5, Hi: 0x1eea9, Stride: 0x1}, - unicode.Range32{Lo: 0x1eeab, Hi: 0x1eebb, Stride: 0x1}, - unicode.Range32{Lo: 0x1f130, Hi: 0x1f149, Stride: 0x1}, - unicode.Range32{Lo: 0x1f150, Hi: 0x1f169, Stride: 0x1}, - unicode.Range32{Lo: 0x1f170, Hi: 0x1f189, Stride: 0x1}, - }, - LatinOffset: 7, -} - -var _WordCR = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xd, Hi: 0xd, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordDouble_Quote = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x22, Hi: 0x22, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordE_Base = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x261d, Hi: 0x261d, Stride: 0x1}, - unicode.Range16{Lo: 0x26f9, Hi: 0x26f9, Stride: 0x1}, - unicode.Range16{Lo: 0x270a, Hi: 0x270d, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f385, Hi: 0x1f385, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3c3, Hi: 0x1f3c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1f3ca, Hi: 0x1f3cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1f442, Hi: 0x1f443, Stride: 0x1}, - unicode.Range32{Lo: 0x1f446, Hi: 0x1f450, Stride: 0x1}, - unicode.Range32{Lo: 0x1f46e, Hi: 0x1f46e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f470, Hi: 0x1f478, Stride: 0x1}, - unicode.Range32{Lo: 0x1f47c, Hi: 0x1f47c, Stride: 0x1}, - unicode.Range32{Lo: 0x1f481, Hi: 0x1f483, Stride: 0x1}, - unicode.Range32{Lo: 0x1f485, Hi: 0x1f487, Stride: 0x1}, - unicode.Range32{Lo: 0x1f4aa, Hi: 0x1f4aa, Stride: 0x1}, - unicode.Range32{Lo: 0x1f575, Hi: 0x1f575, Stride: 0x1}, - unicode.Range32{Lo: 0x1f57a, Hi: 0x1f57a, Stride: 0x1}, - unicode.Range32{Lo: 0x1f590, Hi: 0x1f590, Stride: 0x1}, - unicode.Range32{Lo: 0x1f595, Hi: 0x1f596, Stride: 0x1}, - unicode.Range32{Lo: 0x1f645, Hi: 0x1f647, Stride: 0x1}, - unicode.Range32{Lo: 0x1f64b, Hi: 0x1f64f, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6a3, Hi: 0x1f6a3, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6b4, Hi: 0x1f6b6, Stride: 0x1}, - unicode.Range32{Lo: 0x1f6c0, Hi: 0x1f6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1f918, Hi: 0x1f91e, Stride: 0x1}, - unicode.Range32{Lo: 0x1f926, Hi: 0x1f926, Stride: 0x1}, - unicode.Range32{Lo: 0x1f930, Hi: 0x1f930, Stride: 0x1}, - unicode.Range32{Lo: 0x1f933, Hi: 0x1f939, Stride: 0x1}, - unicode.Range32{Lo: 0x1f93c, Hi: 0x1f93e, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordE_Base_GAZ = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f466, Hi: 0x1f469, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordE_Modifier = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f3fb, Hi: 0x1f3ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordExtend = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x300, Hi: 0x36f, Stride: 0x1}, - unicode.Range16{Lo: 0x483, Hi: 0x487, Stride: 0x1}, - unicode.Range16{Lo: 0x488, Hi: 0x489, Stride: 0x1}, - unicode.Range16{Lo: 0x591, Hi: 0x5bd, Stride: 0x1}, - unicode.Range16{Lo: 0x5bf, Hi: 0x5bf, Stride: 0x1}, - unicode.Range16{Lo: 0x5c1, Hi: 0x5c2, Stride: 0x1}, - unicode.Range16{Lo: 0x5c4, Hi: 0x5c5, Stride: 0x1}, - unicode.Range16{Lo: 0x5c7, Hi: 0x5c7, Stride: 0x1}, - unicode.Range16{Lo: 0x610, Hi: 0x61a, Stride: 0x1}, - unicode.Range16{Lo: 0x64b, Hi: 0x65f, Stride: 0x1}, - unicode.Range16{Lo: 0x670, Hi: 0x670, Stride: 0x1}, - unicode.Range16{Lo: 0x6d6, Hi: 0x6dc, Stride: 0x1}, - unicode.Range16{Lo: 0x6df, Hi: 0x6e4, Stride: 0x1}, - unicode.Range16{Lo: 0x6e7, Hi: 0x6e8, Stride: 0x1}, - unicode.Range16{Lo: 0x6ea, Hi: 0x6ed, Stride: 0x1}, - unicode.Range16{Lo: 0x711, Hi: 0x711, Stride: 0x1}, - unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, - unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, - unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, - unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, - unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, - unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, - unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, - unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, - unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, - unicode.Range16{Lo: 0x903, Hi: 0x903, Stride: 0x1}, - unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, - unicode.Range16{Lo: 0x93b, Hi: 0x93b, Stride: 0x1}, - unicode.Range16{Lo: 0x93c, Hi: 0x93c, Stride: 0x1}, - unicode.Range16{Lo: 0x93e, Hi: 0x940, Stride: 0x1}, - unicode.Range16{Lo: 0x941, Hi: 0x948, Stride: 0x1}, - unicode.Range16{Lo: 0x949, Hi: 0x94c, Stride: 0x1}, - unicode.Range16{Lo: 0x94d, Hi: 0x94d, Stride: 0x1}, - unicode.Range16{Lo: 0x94e, Hi: 0x94f, Stride: 0x1}, - unicode.Range16{Lo: 0x951, Hi: 0x957, Stride: 0x1}, - unicode.Range16{Lo: 0x962, Hi: 0x963, Stride: 0x1}, - unicode.Range16{Lo: 0x981, Hi: 0x981, Stride: 0x1}, - unicode.Range16{Lo: 0x982, Hi: 0x983, Stride: 0x1}, - unicode.Range16{Lo: 0x9bc, Hi: 0x9bc, Stride: 0x1}, - unicode.Range16{Lo: 0x9be, Hi: 0x9c0, Stride: 0x1}, - unicode.Range16{Lo: 0x9c1, Hi: 0x9c4, Stride: 0x1}, - unicode.Range16{Lo: 0x9c7, Hi: 0x9c8, Stride: 0x1}, - unicode.Range16{Lo: 0x9cb, Hi: 0x9cc, Stride: 0x1}, - unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, - unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, - unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, - unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, - unicode.Range16{Lo: 0xa03, Hi: 0xa03, Stride: 0x1}, - unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, - unicode.Range16{Lo: 0xa3e, Hi: 0xa40, Stride: 0x1}, - unicode.Range16{Lo: 0xa41, Hi: 0xa42, Stride: 0x1}, - unicode.Range16{Lo: 0xa47, Hi: 0xa48, Stride: 0x1}, - unicode.Range16{Lo: 0xa4b, Hi: 0xa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xa51, Hi: 0xa51, Stride: 0x1}, - unicode.Range16{Lo: 0xa70, Hi: 0xa71, Stride: 0x1}, - unicode.Range16{Lo: 0xa75, Hi: 0xa75, Stride: 0x1}, - unicode.Range16{Lo: 0xa81, Hi: 0xa82, Stride: 0x1}, - unicode.Range16{Lo: 0xa83, Hi: 0xa83, Stride: 0x1}, - unicode.Range16{Lo: 0xabc, Hi: 0xabc, Stride: 0x1}, - unicode.Range16{Lo: 0xabe, Hi: 0xac0, Stride: 0x1}, - unicode.Range16{Lo: 0xac1, Hi: 0xac5, Stride: 0x1}, - unicode.Range16{Lo: 0xac7, Hi: 0xac8, Stride: 0x1}, - unicode.Range16{Lo: 0xac9, Hi: 0xac9, Stride: 0x1}, - unicode.Range16{Lo: 0xacb, Hi: 0xacc, Stride: 0x1}, - unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, - unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, - unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, - unicode.Range16{Lo: 0xb02, Hi: 0xb03, Stride: 0x1}, - unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, - unicode.Range16{Lo: 0xb3e, Hi: 0xb3e, Stride: 0x1}, - unicode.Range16{Lo: 0xb3f, Hi: 0xb3f, Stride: 0x1}, - unicode.Range16{Lo: 0xb40, Hi: 0xb40, Stride: 0x1}, - unicode.Range16{Lo: 0xb41, Hi: 0xb44, Stride: 0x1}, - unicode.Range16{Lo: 0xb47, Hi: 0xb48, Stride: 0x1}, - unicode.Range16{Lo: 0xb4b, Hi: 0xb4c, Stride: 0x1}, - unicode.Range16{Lo: 0xb4d, Hi: 0xb4d, Stride: 0x1}, - unicode.Range16{Lo: 0xb56, Hi: 0xb56, Stride: 0x1}, - unicode.Range16{Lo: 0xb57, Hi: 0xb57, Stride: 0x1}, - unicode.Range16{Lo: 0xb62, Hi: 0xb63, Stride: 0x1}, - unicode.Range16{Lo: 0xb82, Hi: 0xb82, Stride: 0x1}, - unicode.Range16{Lo: 0xbbe, Hi: 0xbbf, Stride: 0x1}, - unicode.Range16{Lo: 0xbc0, Hi: 0xbc0, Stride: 0x1}, - unicode.Range16{Lo: 0xbc1, Hi: 0xbc2, Stride: 0x1}, - unicode.Range16{Lo: 0xbc6, Hi: 0xbc8, Stride: 0x1}, - unicode.Range16{Lo: 0xbca, Hi: 0xbcc, Stride: 0x1}, - unicode.Range16{Lo: 0xbcd, Hi: 0xbcd, Stride: 0x1}, - unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, - unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, - unicode.Range16{Lo: 0xc01, Hi: 0xc03, Stride: 0x1}, - unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, - unicode.Range16{Lo: 0xc41, Hi: 0xc44, Stride: 0x1}, - unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, - unicode.Range16{Lo: 0xc4a, Hi: 0xc4d, Stride: 0x1}, - unicode.Range16{Lo: 0xc55, Hi: 0xc56, Stride: 0x1}, - unicode.Range16{Lo: 0xc62, Hi: 0xc63, Stride: 0x1}, - unicode.Range16{Lo: 0xc81, Hi: 0xc81, Stride: 0x1}, - unicode.Range16{Lo: 0xc82, Hi: 0xc83, Stride: 0x1}, - unicode.Range16{Lo: 0xcbc, Hi: 0xcbc, Stride: 0x1}, - unicode.Range16{Lo: 0xcbe, Hi: 0xcbe, Stride: 0x1}, - unicode.Range16{Lo: 0xcbf, Hi: 0xcbf, Stride: 0x1}, - unicode.Range16{Lo: 0xcc0, Hi: 0xcc4, Stride: 0x1}, - unicode.Range16{Lo: 0xcc6, Hi: 0xcc6, Stride: 0x1}, - unicode.Range16{Lo: 0xcc7, Hi: 0xcc8, Stride: 0x1}, - unicode.Range16{Lo: 0xcca, Hi: 0xccb, Stride: 0x1}, - unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, - unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, - unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, - unicode.Range16{Lo: 0xd02, Hi: 0xd03, Stride: 0x1}, - unicode.Range16{Lo: 0xd3e, Hi: 0xd40, Stride: 0x1}, - unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, - unicode.Range16{Lo: 0xd46, Hi: 0xd48, Stride: 0x1}, - unicode.Range16{Lo: 0xd4a, Hi: 0xd4c, Stride: 0x1}, - unicode.Range16{Lo: 0xd4d, Hi: 0xd4d, Stride: 0x1}, - unicode.Range16{Lo: 0xd57, Hi: 0xd57, Stride: 0x1}, - unicode.Range16{Lo: 0xd62, Hi: 0xd63, Stride: 0x1}, - unicode.Range16{Lo: 0xd82, Hi: 0xd83, Stride: 0x1}, - unicode.Range16{Lo: 0xdca, Hi: 0xdca, Stride: 0x1}, - unicode.Range16{Lo: 0xdcf, Hi: 0xdd1, Stride: 0x1}, - unicode.Range16{Lo: 0xdd2, Hi: 0xdd4, Stride: 0x1}, - unicode.Range16{Lo: 0xdd6, Hi: 0xdd6, Stride: 0x1}, - unicode.Range16{Lo: 0xdd8, Hi: 0xddf, Stride: 0x1}, - unicode.Range16{Lo: 0xdf2, Hi: 0xdf3, Stride: 0x1}, - unicode.Range16{Lo: 0xe31, Hi: 0xe31, Stride: 0x1}, - unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, - unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, - unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, - unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, - unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, - unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, - unicode.Range16{Lo: 0xf37, Hi: 0xf37, Stride: 0x1}, - unicode.Range16{Lo: 0xf39, Hi: 0xf39, Stride: 0x1}, - unicode.Range16{Lo: 0xf3e, Hi: 0xf3f, Stride: 0x1}, - unicode.Range16{Lo: 0xf71, Hi: 0xf7e, Stride: 0x1}, - unicode.Range16{Lo: 0xf7f, Hi: 0xf7f, Stride: 0x1}, - unicode.Range16{Lo: 0xf80, Hi: 0xf84, Stride: 0x1}, - unicode.Range16{Lo: 0xf86, Hi: 0xf87, Stride: 0x1}, - unicode.Range16{Lo: 0xf8d, Hi: 0xf97, Stride: 0x1}, - unicode.Range16{Lo: 0xf99, Hi: 0xfbc, Stride: 0x1}, - unicode.Range16{Lo: 0xfc6, Hi: 0xfc6, Stride: 0x1}, - unicode.Range16{Lo: 0x102b, Hi: 0x102c, Stride: 0x1}, - unicode.Range16{Lo: 0x102d, Hi: 0x1030, Stride: 0x1}, - unicode.Range16{Lo: 0x1031, Hi: 0x1031, Stride: 0x1}, - unicode.Range16{Lo: 0x1032, Hi: 0x1037, Stride: 0x1}, - unicode.Range16{Lo: 0x1038, Hi: 0x1038, Stride: 0x1}, - unicode.Range16{Lo: 0x1039, Hi: 0x103a, Stride: 0x1}, - unicode.Range16{Lo: 0x103b, Hi: 0x103c, Stride: 0x1}, - unicode.Range16{Lo: 0x103d, Hi: 0x103e, Stride: 0x1}, - unicode.Range16{Lo: 0x1056, Hi: 0x1057, Stride: 0x1}, - unicode.Range16{Lo: 0x1058, Hi: 0x1059, Stride: 0x1}, - unicode.Range16{Lo: 0x105e, Hi: 0x1060, Stride: 0x1}, - unicode.Range16{Lo: 0x1062, Hi: 0x1064, Stride: 0x1}, - unicode.Range16{Lo: 0x1067, Hi: 0x106d, Stride: 0x1}, - unicode.Range16{Lo: 0x1071, Hi: 0x1074, Stride: 0x1}, - unicode.Range16{Lo: 0x1082, Hi: 0x1082, Stride: 0x1}, - unicode.Range16{Lo: 0x1083, Hi: 0x1084, Stride: 0x1}, - unicode.Range16{Lo: 0x1085, Hi: 0x1086, Stride: 0x1}, - unicode.Range16{Lo: 0x1087, Hi: 0x108c, Stride: 0x1}, - unicode.Range16{Lo: 0x108d, Hi: 0x108d, Stride: 0x1}, - unicode.Range16{Lo: 0x108f, Hi: 0x108f, Stride: 0x1}, - unicode.Range16{Lo: 0x109a, Hi: 0x109c, Stride: 0x1}, - unicode.Range16{Lo: 0x109d, Hi: 0x109d, Stride: 0x1}, - unicode.Range16{Lo: 0x135d, Hi: 0x135f, Stride: 0x1}, - unicode.Range16{Lo: 0x1712, Hi: 0x1714, Stride: 0x1}, - unicode.Range16{Lo: 0x1732, Hi: 0x1734, Stride: 0x1}, - unicode.Range16{Lo: 0x1752, Hi: 0x1753, Stride: 0x1}, - unicode.Range16{Lo: 0x1772, Hi: 0x1773, Stride: 0x1}, - unicode.Range16{Lo: 0x17b4, Hi: 0x17b5, Stride: 0x1}, - unicode.Range16{Lo: 0x17b6, Hi: 0x17b6, Stride: 0x1}, - unicode.Range16{Lo: 0x17b7, Hi: 0x17bd, Stride: 0x1}, - unicode.Range16{Lo: 0x17be, Hi: 0x17c5, Stride: 0x1}, - unicode.Range16{Lo: 0x17c6, Hi: 0x17c6, Stride: 0x1}, - unicode.Range16{Lo: 0x17c7, Hi: 0x17c8, Stride: 0x1}, - unicode.Range16{Lo: 0x17c9, Hi: 0x17d3, Stride: 0x1}, - unicode.Range16{Lo: 0x17dd, Hi: 0x17dd, Stride: 0x1}, - unicode.Range16{Lo: 0x180b, Hi: 0x180d, Stride: 0x1}, - unicode.Range16{Lo: 0x1885, Hi: 0x1886, Stride: 0x1}, - unicode.Range16{Lo: 0x18a9, Hi: 0x18a9, Stride: 0x1}, - unicode.Range16{Lo: 0x1920, Hi: 0x1922, Stride: 0x1}, - unicode.Range16{Lo: 0x1923, Hi: 0x1926, Stride: 0x1}, - unicode.Range16{Lo: 0x1927, Hi: 0x1928, Stride: 0x1}, - unicode.Range16{Lo: 0x1929, Hi: 0x192b, Stride: 0x1}, - unicode.Range16{Lo: 0x1930, Hi: 0x1931, Stride: 0x1}, - unicode.Range16{Lo: 0x1932, Hi: 0x1932, Stride: 0x1}, - unicode.Range16{Lo: 0x1933, Hi: 0x1938, Stride: 0x1}, - unicode.Range16{Lo: 0x1939, Hi: 0x193b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a17, Hi: 0x1a18, Stride: 0x1}, - unicode.Range16{Lo: 0x1a19, Hi: 0x1a1a, Stride: 0x1}, - unicode.Range16{Lo: 0x1a1b, Hi: 0x1a1b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a55, Hi: 0x1a55, Stride: 0x1}, - unicode.Range16{Lo: 0x1a56, Hi: 0x1a56, Stride: 0x1}, - unicode.Range16{Lo: 0x1a57, Hi: 0x1a57, Stride: 0x1}, - unicode.Range16{Lo: 0x1a58, Hi: 0x1a5e, Stride: 0x1}, - unicode.Range16{Lo: 0x1a60, Hi: 0x1a60, Stride: 0x1}, - unicode.Range16{Lo: 0x1a61, Hi: 0x1a61, Stride: 0x1}, - unicode.Range16{Lo: 0x1a62, Hi: 0x1a62, Stride: 0x1}, - unicode.Range16{Lo: 0x1a63, Hi: 0x1a64, Stride: 0x1}, - unicode.Range16{Lo: 0x1a65, Hi: 0x1a6c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a6d, Hi: 0x1a72, Stride: 0x1}, - unicode.Range16{Lo: 0x1a73, Hi: 0x1a7c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a7f, Hi: 0x1a7f, Stride: 0x1}, - unicode.Range16{Lo: 0x1ab0, Hi: 0x1abd, Stride: 0x1}, - unicode.Range16{Lo: 0x1abe, Hi: 0x1abe, Stride: 0x1}, - unicode.Range16{Lo: 0x1b00, Hi: 0x1b03, Stride: 0x1}, - unicode.Range16{Lo: 0x1b04, Hi: 0x1b04, Stride: 0x1}, - unicode.Range16{Lo: 0x1b34, Hi: 0x1b34, Stride: 0x1}, - unicode.Range16{Lo: 0x1b35, Hi: 0x1b35, Stride: 0x1}, - unicode.Range16{Lo: 0x1b36, Hi: 0x1b3a, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3b, Hi: 0x1b3b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3c, Hi: 0x1b3c, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3d, Hi: 0x1b41, Stride: 0x1}, - unicode.Range16{Lo: 0x1b42, Hi: 0x1b42, Stride: 0x1}, - unicode.Range16{Lo: 0x1b43, Hi: 0x1b44, Stride: 0x1}, - unicode.Range16{Lo: 0x1b6b, Hi: 0x1b73, Stride: 0x1}, - unicode.Range16{Lo: 0x1b80, Hi: 0x1b81, Stride: 0x1}, - unicode.Range16{Lo: 0x1b82, Hi: 0x1b82, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba1, Hi: 0x1ba1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba2, Hi: 0x1ba5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba6, Hi: 0x1ba7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba8, Hi: 0x1ba9, Stride: 0x1}, - unicode.Range16{Lo: 0x1baa, Hi: 0x1baa, Stride: 0x1}, - unicode.Range16{Lo: 0x1bab, Hi: 0x1bad, Stride: 0x1}, - unicode.Range16{Lo: 0x1be6, Hi: 0x1be6, Stride: 0x1}, - unicode.Range16{Lo: 0x1be7, Hi: 0x1be7, Stride: 0x1}, - unicode.Range16{Lo: 0x1be8, Hi: 0x1be9, Stride: 0x1}, - unicode.Range16{Lo: 0x1bea, Hi: 0x1bec, Stride: 0x1}, - unicode.Range16{Lo: 0x1bed, Hi: 0x1bed, Stride: 0x1}, - unicode.Range16{Lo: 0x1bee, Hi: 0x1bee, Stride: 0x1}, - unicode.Range16{Lo: 0x1bef, Hi: 0x1bf1, Stride: 0x1}, - unicode.Range16{Lo: 0x1bf2, Hi: 0x1bf3, Stride: 0x1}, - unicode.Range16{Lo: 0x1c24, Hi: 0x1c2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1c2c, Hi: 0x1c33, Stride: 0x1}, - unicode.Range16{Lo: 0x1c34, Hi: 0x1c35, Stride: 0x1}, - unicode.Range16{Lo: 0x1c36, Hi: 0x1c37, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd0, Hi: 0x1cd2, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd4, Hi: 0x1ce0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce2, Hi: 0x1ce8, Stride: 0x1}, - unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, - unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, - unicode.Range16{Lo: 0x200c, Hi: 0x200c, Stride: 0x1}, - unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, - unicode.Range16{Lo: 0x20dd, Hi: 0x20e0, Stride: 0x1}, - unicode.Range16{Lo: 0x20e1, Hi: 0x20e1, Stride: 0x1}, - unicode.Range16{Lo: 0x20e2, Hi: 0x20e4, Stride: 0x1}, - unicode.Range16{Lo: 0x20e5, Hi: 0x20f0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cef, Hi: 0x2cf1, Stride: 0x1}, - unicode.Range16{Lo: 0x2d7f, Hi: 0x2d7f, Stride: 0x1}, - unicode.Range16{Lo: 0x2de0, Hi: 0x2dff, Stride: 0x1}, - unicode.Range16{Lo: 0x302a, Hi: 0x302d, Stride: 0x1}, - unicode.Range16{Lo: 0x302e, Hi: 0x302f, Stride: 0x1}, - unicode.Range16{Lo: 0x3099, Hi: 0x309a, Stride: 0x1}, - unicode.Range16{Lo: 0xa66f, Hi: 0xa66f, Stride: 0x1}, - unicode.Range16{Lo: 0xa670, Hi: 0xa672, Stride: 0x1}, - unicode.Range16{Lo: 0xa674, Hi: 0xa67d, Stride: 0x1}, - unicode.Range16{Lo: 0xa69e, Hi: 0xa69f, Stride: 0x1}, - unicode.Range16{Lo: 0xa6f0, Hi: 0xa6f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa802, Hi: 0xa802, Stride: 0x1}, - unicode.Range16{Lo: 0xa806, Hi: 0xa806, Stride: 0x1}, - unicode.Range16{Lo: 0xa80b, Hi: 0xa80b, Stride: 0x1}, - unicode.Range16{Lo: 0xa823, Hi: 0xa824, Stride: 0x1}, - unicode.Range16{Lo: 0xa825, Hi: 0xa826, Stride: 0x1}, - unicode.Range16{Lo: 0xa827, Hi: 0xa827, Stride: 0x1}, - unicode.Range16{Lo: 0xa880, Hi: 0xa881, Stride: 0x1}, - unicode.Range16{Lo: 0xa8b4, Hi: 0xa8c3, Stride: 0x1}, - unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, - unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, - unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, - unicode.Range16{Lo: 0xa952, Hi: 0xa953, Stride: 0x1}, - unicode.Range16{Lo: 0xa980, Hi: 0xa982, Stride: 0x1}, - unicode.Range16{Lo: 0xa983, Hi: 0xa983, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b3, Hi: 0xa9b3, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, - unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, - unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, - unicode.Range16{Lo: 0xaa31, Hi: 0xaa32, Stride: 0x1}, - unicode.Range16{Lo: 0xaa33, Hi: 0xaa34, Stride: 0x1}, - unicode.Range16{Lo: 0xaa35, Hi: 0xaa36, Stride: 0x1}, - unicode.Range16{Lo: 0xaa43, Hi: 0xaa43, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4c, Hi: 0xaa4c, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4d, Hi: 0xaa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7b, Hi: 0xaa7b, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7c, Hi: 0xaa7c, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7d, Hi: 0xaa7d, Stride: 0x1}, - unicode.Range16{Lo: 0xaab0, Hi: 0xaab0, Stride: 0x1}, - unicode.Range16{Lo: 0xaab2, Hi: 0xaab4, Stride: 0x1}, - unicode.Range16{Lo: 0xaab7, Hi: 0xaab8, Stride: 0x1}, - unicode.Range16{Lo: 0xaabe, Hi: 0xaabf, Stride: 0x1}, - unicode.Range16{Lo: 0xaac1, Hi: 0xaac1, Stride: 0x1}, - unicode.Range16{Lo: 0xaaeb, Hi: 0xaaeb, Stride: 0x1}, - unicode.Range16{Lo: 0xaaec, Hi: 0xaaed, Stride: 0x1}, - unicode.Range16{Lo: 0xaaee, Hi: 0xaaef, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf5, Hi: 0xaaf5, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf6, Hi: 0xaaf6, Stride: 0x1}, - unicode.Range16{Lo: 0xabe3, Hi: 0xabe4, Stride: 0x1}, - unicode.Range16{Lo: 0xabe5, Hi: 0xabe5, Stride: 0x1}, - unicode.Range16{Lo: 0xabe6, Hi: 0xabe7, Stride: 0x1}, - unicode.Range16{Lo: 0xabe8, Hi: 0xabe8, Stride: 0x1}, - unicode.Range16{Lo: 0xabe9, Hi: 0xabea, Stride: 0x1}, - unicode.Range16{Lo: 0xabec, Hi: 0xabec, Stride: 0x1}, - unicode.Range16{Lo: 0xabed, Hi: 0xabed, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1e, Hi: 0xfb1e, Stride: 0x1}, - unicode.Range16{Lo: 0xfe00, Hi: 0xfe0f, Stride: 0x1}, - unicode.Range16{Lo: 0xfe20, Hi: 0xfe2f, Stride: 0x1}, - unicode.Range16{Lo: 0xff9e, Hi: 0xff9f, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x101fd, Hi: 0x101fd, Stride: 0x1}, - unicode.Range32{Lo: 0x102e0, Hi: 0x102e0, Stride: 0x1}, - unicode.Range32{Lo: 0x10376, Hi: 0x1037a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a01, Hi: 0x10a03, Stride: 0x1}, - unicode.Range32{Lo: 0x10a05, Hi: 0x10a06, Stride: 0x1}, - unicode.Range32{Lo: 0x10a0c, Hi: 0x10a0f, Stride: 0x1}, - unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, - unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, - unicode.Range32{Lo: 0x11000, Hi: 0x11000, Stride: 0x1}, - unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, - unicode.Range32{Lo: 0x11002, Hi: 0x11002, Stride: 0x1}, - unicode.Range32{Lo: 0x11038, Hi: 0x11046, Stride: 0x1}, - unicode.Range32{Lo: 0x1107f, Hi: 0x11081, Stride: 0x1}, - unicode.Range32{Lo: 0x11082, Hi: 0x11082, Stride: 0x1}, - unicode.Range32{Lo: 0x110b0, Hi: 0x110b2, Stride: 0x1}, - unicode.Range32{Lo: 0x110b3, Hi: 0x110b6, Stride: 0x1}, - unicode.Range32{Lo: 0x110b7, Hi: 0x110b8, Stride: 0x1}, - unicode.Range32{Lo: 0x110b9, Hi: 0x110ba, Stride: 0x1}, - unicode.Range32{Lo: 0x11100, Hi: 0x11102, Stride: 0x1}, - unicode.Range32{Lo: 0x11127, Hi: 0x1112b, Stride: 0x1}, - unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, - unicode.Range32{Lo: 0x1112d, Hi: 0x11134, Stride: 0x1}, - unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, - unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, - unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, - unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, - unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, - unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, - unicode.Range32{Lo: 0x1122c, Hi: 0x1122e, Stride: 0x1}, - unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, - unicode.Range32{Lo: 0x11232, Hi: 0x11233, Stride: 0x1}, - unicode.Range32{Lo: 0x11234, Hi: 0x11234, Stride: 0x1}, - unicode.Range32{Lo: 0x11235, Hi: 0x11235, Stride: 0x1}, - unicode.Range32{Lo: 0x11236, Hi: 0x11237, Stride: 0x1}, - unicode.Range32{Lo: 0x1123e, Hi: 0x1123e, Stride: 0x1}, - unicode.Range32{Lo: 0x112df, Hi: 0x112df, Stride: 0x1}, - unicode.Range32{Lo: 0x112e0, Hi: 0x112e2, Stride: 0x1}, - unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, - unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, - unicode.Range32{Lo: 0x11302, Hi: 0x11303, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, - unicode.Range32{Lo: 0x1133e, Hi: 0x1133f, Stride: 0x1}, - unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, - unicode.Range32{Lo: 0x11341, Hi: 0x11344, Stride: 0x1}, - unicode.Range32{Lo: 0x11347, Hi: 0x11348, Stride: 0x1}, - unicode.Range32{Lo: 0x1134b, Hi: 0x1134d, Stride: 0x1}, - unicode.Range32{Lo: 0x11357, Hi: 0x11357, Stride: 0x1}, - unicode.Range32{Lo: 0x11362, Hi: 0x11363, Stride: 0x1}, - unicode.Range32{Lo: 0x11366, Hi: 0x1136c, Stride: 0x1}, - unicode.Range32{Lo: 0x11370, Hi: 0x11374, Stride: 0x1}, - unicode.Range32{Lo: 0x11435, Hi: 0x11437, Stride: 0x1}, - unicode.Range32{Lo: 0x11438, Hi: 0x1143f, Stride: 0x1}, - unicode.Range32{Lo: 0x11440, Hi: 0x11441, Stride: 0x1}, - unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, - unicode.Range32{Lo: 0x11445, Hi: 0x11445, Stride: 0x1}, - unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, - unicode.Range32{Lo: 0x114b0, Hi: 0x114b2, Stride: 0x1}, - unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, - unicode.Range32{Lo: 0x114b9, Hi: 0x114b9, Stride: 0x1}, - unicode.Range32{Lo: 0x114ba, Hi: 0x114ba, Stride: 0x1}, - unicode.Range32{Lo: 0x114bb, Hi: 0x114be, Stride: 0x1}, - unicode.Range32{Lo: 0x114bf, Hi: 0x114c0, Stride: 0x1}, - unicode.Range32{Lo: 0x114c1, Hi: 0x114c1, Stride: 0x1}, - unicode.Range32{Lo: 0x114c2, Hi: 0x114c3, Stride: 0x1}, - unicode.Range32{Lo: 0x115af, Hi: 0x115b1, Stride: 0x1}, - unicode.Range32{Lo: 0x115b2, Hi: 0x115b5, Stride: 0x1}, - unicode.Range32{Lo: 0x115b8, Hi: 0x115bb, Stride: 0x1}, - unicode.Range32{Lo: 0x115bc, Hi: 0x115bd, Stride: 0x1}, - unicode.Range32{Lo: 0x115be, Hi: 0x115be, Stride: 0x1}, - unicode.Range32{Lo: 0x115bf, Hi: 0x115c0, Stride: 0x1}, - unicode.Range32{Lo: 0x115dc, Hi: 0x115dd, Stride: 0x1}, - unicode.Range32{Lo: 0x11630, Hi: 0x11632, Stride: 0x1}, - unicode.Range32{Lo: 0x11633, Hi: 0x1163a, Stride: 0x1}, - unicode.Range32{Lo: 0x1163b, Hi: 0x1163c, Stride: 0x1}, - unicode.Range32{Lo: 0x1163d, Hi: 0x1163d, Stride: 0x1}, - unicode.Range32{Lo: 0x1163e, Hi: 0x1163e, Stride: 0x1}, - unicode.Range32{Lo: 0x1163f, Hi: 0x11640, Stride: 0x1}, - unicode.Range32{Lo: 0x116ab, Hi: 0x116ab, Stride: 0x1}, - unicode.Range32{Lo: 0x116ac, Hi: 0x116ac, Stride: 0x1}, - unicode.Range32{Lo: 0x116ad, Hi: 0x116ad, Stride: 0x1}, - unicode.Range32{Lo: 0x116ae, Hi: 0x116af, Stride: 0x1}, - unicode.Range32{Lo: 0x116b0, Hi: 0x116b5, Stride: 0x1}, - unicode.Range32{Lo: 0x116b6, Hi: 0x116b6, Stride: 0x1}, - unicode.Range32{Lo: 0x116b7, Hi: 0x116b7, Stride: 0x1}, - unicode.Range32{Lo: 0x1171d, Hi: 0x1171f, Stride: 0x1}, - unicode.Range32{Lo: 0x11720, Hi: 0x11721, Stride: 0x1}, - unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, - unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, - unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, - unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, - unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3e, Hi: 0x11c3e, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3f, Hi: 0x11c3f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c92, Hi: 0x11ca7, Stride: 0x1}, - unicode.Range32{Lo: 0x11ca9, Hi: 0x11ca9, Stride: 0x1}, - unicode.Range32{Lo: 0x11caa, Hi: 0x11cb0, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb1, Hi: 0x11cb1, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, - unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, - unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, - unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d165, Hi: 0x1d166, Stride: 0x1}, - unicode.Range32{Lo: 0x1d167, Hi: 0x1d169, Stride: 0x1}, - unicode.Range32{Lo: 0x1d16d, Hi: 0x1d172, Stride: 0x1}, - unicode.Range32{Lo: 0x1d17b, Hi: 0x1d182, Stride: 0x1}, - unicode.Range32{Lo: 0x1d185, Hi: 0x1d18b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d1aa, Hi: 0x1d1ad, Stride: 0x1}, - unicode.Range32{Lo: 0x1d242, Hi: 0x1d244, Stride: 0x1}, - unicode.Range32{Lo: 0x1da00, Hi: 0x1da36, Stride: 0x1}, - unicode.Range32{Lo: 0x1da3b, Hi: 0x1da6c, Stride: 0x1}, - unicode.Range32{Lo: 0x1da75, Hi: 0x1da75, Stride: 0x1}, - unicode.Range32{Lo: 0x1da84, Hi: 0x1da84, Stride: 0x1}, - unicode.Range32{Lo: 0x1da9b, Hi: 0x1da9f, Stride: 0x1}, - unicode.Range32{Lo: 0x1daa1, Hi: 0x1daaf, Stride: 0x1}, - unicode.Range32{Lo: 0x1e000, Hi: 0x1e006, Stride: 0x1}, - unicode.Range32{Lo: 0x1e008, Hi: 0x1e018, Stride: 0x1}, - unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, - unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, - unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, - unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, - unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, - unicode.Range32{Lo: 0xe0100, Hi: 0xe01ef, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordExtendNumLet = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x5f, Hi: 0x5f, Stride: 0x1}, - unicode.Range16{Lo: 0x202f, Hi: 0x202f, Stride: 0x1}, - unicode.Range16{Lo: 0x203f, Hi: 0x2040, Stride: 0x1}, - unicode.Range16{Lo: 0x2054, Hi: 0x2054, Stride: 0x1}, - unicode.Range16{Lo: 0xfe33, Hi: 0xfe34, Stride: 0x1}, - unicode.Range16{Lo: 0xfe4d, Hi: 0xfe4f, Stride: 0x1}, - unicode.Range16{Lo: 0xff3f, Hi: 0xff3f, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordFormat = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xad, Hi: 0xad, Stride: 0x1}, - unicode.Range16{Lo: 0x600, Hi: 0x605, Stride: 0x1}, - unicode.Range16{Lo: 0x61c, Hi: 0x61c, Stride: 0x1}, - unicode.Range16{Lo: 0x6dd, Hi: 0x6dd, Stride: 0x1}, - unicode.Range16{Lo: 0x70f, Hi: 0x70f, Stride: 0x1}, - unicode.Range16{Lo: 0x8e2, Hi: 0x8e2, Stride: 0x1}, - unicode.Range16{Lo: 0x180e, Hi: 0x180e, Stride: 0x1}, - unicode.Range16{Lo: 0x200e, Hi: 0x200f, Stride: 0x1}, - unicode.Range16{Lo: 0x202a, Hi: 0x202e, Stride: 0x1}, - unicode.Range16{Lo: 0x2060, Hi: 0x2064, Stride: 0x1}, - unicode.Range16{Lo: 0x2066, Hi: 0x206f, Stride: 0x1}, - unicode.Range16{Lo: 0xfeff, Hi: 0xfeff, Stride: 0x1}, - unicode.Range16{Lo: 0xfff9, Hi: 0xfffb, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, - unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0001, Hi: 0xe0001, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordGlue_After_Zwj = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2764, Hi: 0x2764, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f48b, Hi: 0x1f48b, Stride: 0x1}, - unicode.Range32{Lo: 0x1f5e8, Hi: 0x1f5e8, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordHebrew_Letter = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x5d0, Hi: 0x5ea, Stride: 0x1}, - unicode.Range16{Lo: 0x5f0, Hi: 0x5f2, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1d, Hi: 0xfb1d, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1f, Hi: 0xfb28, Stride: 0x1}, - unicode.Range16{Lo: 0xfb2a, Hi: 0xfb36, Stride: 0x1}, - unicode.Range16{Lo: 0xfb38, Hi: 0xfb3c, Stride: 0x1}, - unicode.Range16{Lo: 0xfb3e, Hi: 0xfb3e, Stride: 0x1}, - unicode.Range16{Lo: 0xfb40, Hi: 0xfb41, Stride: 0x1}, - unicode.Range16{Lo: 0xfb43, Hi: 0xfb44, Stride: 0x1}, - unicode.Range16{Lo: 0xfb46, Hi: 0xfb4f, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordKatakana = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x3031, Hi: 0x3035, Stride: 0x1}, - unicode.Range16{Lo: 0x309b, Hi: 0x309c, Stride: 0x1}, - unicode.Range16{Lo: 0x30a0, Hi: 0x30a0, Stride: 0x1}, - unicode.Range16{Lo: 0x30a1, Hi: 0x30fa, Stride: 0x1}, - unicode.Range16{Lo: 0x30fc, Hi: 0x30fe, Stride: 0x1}, - unicode.Range16{Lo: 0x30ff, Hi: 0x30ff, Stride: 0x1}, - unicode.Range16{Lo: 0x31f0, Hi: 0x31ff, Stride: 0x1}, - unicode.Range16{Lo: 0x32d0, Hi: 0x32fe, Stride: 0x1}, - unicode.Range16{Lo: 0x3300, Hi: 0x3357, Stride: 0x1}, - unicode.Range16{Lo: 0xff66, Hi: 0xff6f, Stride: 0x1}, - unicode.Range16{Lo: 0xff70, Hi: 0xff70, Stride: 0x1}, - unicode.Range16{Lo: 0xff71, Hi: 0xff9d, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1b000, Hi: 0x1b000, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordLF = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xa, Hi: 0xa, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordMidLetter = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x3a, Hi: 0x3a, Stride: 0x1}, - unicode.Range16{Lo: 0xb7, Hi: 0xb7, Stride: 0x1}, - unicode.Range16{Lo: 0x2d7, Hi: 0x2d7, Stride: 0x1}, - unicode.Range16{Lo: 0x387, Hi: 0x387, Stride: 0x1}, - unicode.Range16{Lo: 0x5f4, Hi: 0x5f4, Stride: 0x1}, - unicode.Range16{Lo: 0x2027, Hi: 0x2027, Stride: 0x1}, - unicode.Range16{Lo: 0xfe13, Hi: 0xfe13, Stride: 0x1}, - unicode.Range16{Lo: 0xfe55, Hi: 0xfe55, Stride: 0x1}, - unicode.Range16{Lo: 0xff1a, Hi: 0xff1a, Stride: 0x1}, - }, - LatinOffset: 2, -} - -var _WordMidNum = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2c, Hi: 0x2c, Stride: 0x1}, - unicode.Range16{Lo: 0x3b, Hi: 0x3b, Stride: 0x1}, - unicode.Range16{Lo: 0x37e, Hi: 0x37e, Stride: 0x1}, - unicode.Range16{Lo: 0x589, Hi: 0x589, Stride: 0x1}, - unicode.Range16{Lo: 0x60c, Hi: 0x60d, Stride: 0x1}, - unicode.Range16{Lo: 0x66c, Hi: 0x66c, Stride: 0x1}, - unicode.Range16{Lo: 0x7f8, Hi: 0x7f8, Stride: 0x1}, - unicode.Range16{Lo: 0x2044, Hi: 0x2044, Stride: 0x1}, - unicode.Range16{Lo: 0xfe10, Hi: 0xfe10, Stride: 0x1}, - unicode.Range16{Lo: 0xfe14, Hi: 0xfe14, Stride: 0x1}, - unicode.Range16{Lo: 0xfe50, Hi: 0xfe50, Stride: 0x1}, - unicode.Range16{Lo: 0xfe54, Hi: 0xfe54, Stride: 0x1}, - unicode.Range16{Lo: 0xff0c, Hi: 0xff0c, Stride: 0x1}, - unicode.Range16{Lo: 0xff1b, Hi: 0xff1b, Stride: 0x1}, - }, - LatinOffset: 2, -} - -var _WordMidNumLet = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2e, Hi: 0x2e, Stride: 0x1}, - unicode.Range16{Lo: 0x2018, Hi: 0x2018, Stride: 0x1}, - unicode.Range16{Lo: 0x2019, Hi: 0x2019, Stride: 0x1}, - unicode.Range16{Lo: 0x2024, Hi: 0x2024, Stride: 0x1}, - unicode.Range16{Lo: 0xfe52, Hi: 0xfe52, Stride: 0x1}, - unicode.Range16{Lo: 0xff07, Hi: 0xff07, Stride: 0x1}, - unicode.Range16{Lo: 0xff0e, Hi: 0xff0e, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordNewline = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xb, Hi: 0xc, Stride: 0x1}, - unicode.Range16{Lo: 0x85, Hi: 0x85, Stride: 0x1}, - unicode.Range16{Lo: 0x2028, Hi: 0x2028, Stride: 0x1}, - unicode.Range16{Lo: 0x2029, Hi: 0x2029, Stride: 0x1}, - }, - LatinOffset: 2, -} - -var _WordNumeric = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x30, Hi: 0x39, Stride: 0x1}, - unicode.Range16{Lo: 0x660, Hi: 0x669, Stride: 0x1}, - unicode.Range16{Lo: 0x66b, Hi: 0x66b, Stride: 0x1}, - unicode.Range16{Lo: 0x6f0, Hi: 0x6f9, Stride: 0x1}, - unicode.Range16{Lo: 0x7c0, Hi: 0x7c9, Stride: 0x1}, - unicode.Range16{Lo: 0x966, Hi: 0x96f, Stride: 0x1}, - unicode.Range16{Lo: 0x9e6, Hi: 0x9ef, Stride: 0x1}, - unicode.Range16{Lo: 0xa66, Hi: 0xa6f, Stride: 0x1}, - unicode.Range16{Lo: 0xae6, Hi: 0xaef, Stride: 0x1}, - unicode.Range16{Lo: 0xb66, Hi: 0xb6f, Stride: 0x1}, - unicode.Range16{Lo: 0xbe6, Hi: 0xbef, Stride: 0x1}, - unicode.Range16{Lo: 0xc66, Hi: 0xc6f, Stride: 0x1}, - unicode.Range16{Lo: 0xce6, Hi: 0xcef, Stride: 0x1}, - unicode.Range16{Lo: 0xd66, Hi: 0xd6f, Stride: 0x1}, - unicode.Range16{Lo: 0xde6, Hi: 0xdef, Stride: 0x1}, - unicode.Range16{Lo: 0xe50, Hi: 0xe59, Stride: 0x1}, - unicode.Range16{Lo: 0xed0, Hi: 0xed9, Stride: 0x1}, - unicode.Range16{Lo: 0xf20, Hi: 0xf29, Stride: 0x1}, - unicode.Range16{Lo: 0x1040, Hi: 0x1049, Stride: 0x1}, - unicode.Range16{Lo: 0x1090, Hi: 0x1099, Stride: 0x1}, - unicode.Range16{Lo: 0x17e0, Hi: 0x17e9, Stride: 0x1}, - unicode.Range16{Lo: 0x1810, Hi: 0x1819, Stride: 0x1}, - unicode.Range16{Lo: 0x1946, Hi: 0x194f, Stride: 0x1}, - unicode.Range16{Lo: 0x19d0, Hi: 0x19d9, Stride: 0x1}, - unicode.Range16{Lo: 0x1a80, Hi: 0x1a89, Stride: 0x1}, - unicode.Range16{Lo: 0x1a90, Hi: 0x1a99, Stride: 0x1}, - unicode.Range16{Lo: 0x1b50, Hi: 0x1b59, Stride: 0x1}, - unicode.Range16{Lo: 0x1bb0, Hi: 0x1bb9, Stride: 0x1}, - unicode.Range16{Lo: 0x1c40, Hi: 0x1c49, Stride: 0x1}, - unicode.Range16{Lo: 0x1c50, Hi: 0x1c59, Stride: 0x1}, - unicode.Range16{Lo: 0xa620, Hi: 0xa629, Stride: 0x1}, - unicode.Range16{Lo: 0xa8d0, Hi: 0xa8d9, Stride: 0x1}, - unicode.Range16{Lo: 0xa900, Hi: 0xa909, Stride: 0x1}, - unicode.Range16{Lo: 0xa9d0, Hi: 0xa9d9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9f0, Hi: 0xa9f9, Stride: 0x1}, - unicode.Range16{Lo: 0xaa50, Hi: 0xaa59, Stride: 0x1}, - unicode.Range16{Lo: 0xabf0, Hi: 0xabf9, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x104a0, Hi: 0x104a9, Stride: 0x1}, - unicode.Range32{Lo: 0x11066, Hi: 0x1106f, Stride: 0x1}, - unicode.Range32{Lo: 0x110f0, Hi: 0x110f9, Stride: 0x1}, - unicode.Range32{Lo: 0x11136, Hi: 0x1113f, Stride: 0x1}, - unicode.Range32{Lo: 0x111d0, Hi: 0x111d9, Stride: 0x1}, - unicode.Range32{Lo: 0x112f0, Hi: 0x112f9, Stride: 0x1}, - unicode.Range32{Lo: 0x11450, Hi: 0x11459, Stride: 0x1}, - unicode.Range32{Lo: 0x114d0, Hi: 0x114d9, Stride: 0x1}, - unicode.Range32{Lo: 0x11650, Hi: 0x11659, Stride: 0x1}, - unicode.Range32{Lo: 0x116c0, Hi: 0x116c9, Stride: 0x1}, - unicode.Range32{Lo: 0x11730, Hi: 0x11739, Stride: 0x1}, - unicode.Range32{Lo: 0x118e0, Hi: 0x118e9, Stride: 0x1}, - unicode.Range32{Lo: 0x11c50, Hi: 0x11c59, Stride: 0x1}, - unicode.Range32{Lo: 0x16a60, Hi: 0x16a69, Stride: 0x1}, - unicode.Range32{Lo: 0x16b50, Hi: 0x16b59, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7ce, Hi: 0x1d7ff, Stride: 0x1}, - unicode.Range32{Lo: 0x1e950, Hi: 0x1e959, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordRegional_Indicator = &unicode.RangeTable{ - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f1e6, Hi: 0x1f1ff, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _WordSingle_Quote = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x27, Hi: 0x27, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _WordZWJ = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x200d, Hi: 0x200d, Stride: 0x1}, - }, - LatinOffset: 0, -} - -type _WordRuneRange unicode.RangeTable - -func _WordRuneType(r rune) *_WordRuneRange { - switch { - case unicode.Is(_WordALetter, r): - return (*_WordRuneRange)(_WordALetter) - case unicode.Is(_WordCR, r): - return (*_WordRuneRange)(_WordCR) - case unicode.Is(_WordDouble_Quote, r): - return (*_WordRuneRange)(_WordDouble_Quote) - case unicode.Is(_WordE_Base, r): - return (*_WordRuneRange)(_WordE_Base) - case unicode.Is(_WordE_Base_GAZ, r): - return (*_WordRuneRange)(_WordE_Base_GAZ) - case unicode.Is(_WordE_Modifier, r): - return (*_WordRuneRange)(_WordE_Modifier) - case unicode.Is(_WordExtend, r): - return (*_WordRuneRange)(_WordExtend) - case unicode.Is(_WordExtendNumLet, r): - return (*_WordRuneRange)(_WordExtendNumLet) - case unicode.Is(_WordFormat, r): - return (*_WordRuneRange)(_WordFormat) - case unicode.Is(_WordGlue_After_Zwj, r): - return (*_WordRuneRange)(_WordGlue_After_Zwj) - case unicode.Is(_WordHebrew_Letter, r): - return (*_WordRuneRange)(_WordHebrew_Letter) - case unicode.Is(_WordKatakana, r): - return (*_WordRuneRange)(_WordKatakana) - case unicode.Is(_WordLF, r): - return (*_WordRuneRange)(_WordLF) - case unicode.Is(_WordMidLetter, r): - return (*_WordRuneRange)(_WordMidLetter) - case unicode.Is(_WordMidNum, r): - return (*_WordRuneRange)(_WordMidNum) - case unicode.Is(_WordMidNumLet, r): - return (*_WordRuneRange)(_WordMidNumLet) - case unicode.Is(_WordNewline, r): - return (*_WordRuneRange)(_WordNewline) - case unicode.Is(_WordNumeric, r): - return (*_WordRuneRange)(_WordNumeric) - case unicode.Is(_WordRegional_Indicator, r): - return (*_WordRuneRange)(_WordRegional_Indicator) - case unicode.Is(_WordSingle_Quote, r): - return (*_WordRuneRange)(_WordSingle_Quote) - case unicode.Is(_WordZWJ, r): - return (*_WordRuneRange)(_WordZWJ) - default: - return nil - } -} -func (rng *_WordRuneRange) String() string { - switch (*unicode.RangeTable)(rng) { - case _WordALetter: - return "ALetter" - case _WordCR: - return "CR" - case _WordDouble_Quote: - return "Double_Quote" - case _WordE_Base: - return "E_Base" - case _WordE_Base_GAZ: - return "E_Base_GAZ" - case _WordE_Modifier: - return "E_Modifier" - case _WordExtend: - return "Extend" - case _WordExtendNumLet: - return "ExtendNumLet" - case _WordFormat: - return "Format" - case _WordGlue_After_Zwj: - return "Glue_After_Zwj" - case _WordHebrew_Letter: - return "Hebrew_Letter" - case _WordKatakana: - return "Katakana" - case _WordLF: - return "LF" - case _WordMidLetter: - return "MidLetter" - case _WordMidNum: - return "MidNum" - case _WordMidNumLet: - return "MidNumLet" - case _WordNewline: - return "Newline" - case _WordNumeric: - return "Numeric" - case _WordRegional_Indicator: - return "Regional_Indicator" - case _WordSingle_Quote: - return "Single_Quote" - case _WordZWJ: - return "ZWJ" - default: - return "Other" - } -} - -var _SentenceATerm = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2e, Hi: 0x2e, Stride: 0x1}, - unicode.Range16{Lo: 0x2024, Hi: 0x2024, Stride: 0x1}, - unicode.Range16{Lo: 0xfe52, Hi: 0xfe52, Stride: 0x1}, - unicode.Range16{Lo: 0xff0e, Hi: 0xff0e, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceCR = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xd, Hi: 0xd, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceClose = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x22, Hi: 0x22, Stride: 0x1}, - unicode.Range16{Lo: 0x27, Hi: 0x27, Stride: 0x1}, - unicode.Range16{Lo: 0x28, Hi: 0x28, Stride: 0x1}, - unicode.Range16{Lo: 0x29, Hi: 0x29, Stride: 0x1}, - unicode.Range16{Lo: 0x5b, Hi: 0x5b, Stride: 0x1}, - unicode.Range16{Lo: 0x5d, Hi: 0x5d, Stride: 0x1}, - unicode.Range16{Lo: 0x7b, Hi: 0x7b, Stride: 0x1}, - unicode.Range16{Lo: 0x7d, Hi: 0x7d, Stride: 0x1}, - unicode.Range16{Lo: 0xab, Hi: 0xab, Stride: 0x1}, - unicode.Range16{Lo: 0xbb, Hi: 0xbb, Stride: 0x1}, - unicode.Range16{Lo: 0xf3a, Hi: 0xf3a, Stride: 0x1}, - unicode.Range16{Lo: 0xf3b, Hi: 0xf3b, Stride: 0x1}, - unicode.Range16{Lo: 0xf3c, Hi: 0xf3c, Stride: 0x1}, - unicode.Range16{Lo: 0xf3d, Hi: 0xf3d, Stride: 0x1}, - unicode.Range16{Lo: 0x169b, Hi: 0x169b, Stride: 0x1}, - unicode.Range16{Lo: 0x169c, Hi: 0x169c, Stride: 0x1}, - unicode.Range16{Lo: 0x2018, Hi: 0x2018, Stride: 0x1}, - unicode.Range16{Lo: 0x2019, Hi: 0x2019, Stride: 0x1}, - unicode.Range16{Lo: 0x201a, Hi: 0x201a, Stride: 0x1}, - unicode.Range16{Lo: 0x201b, Hi: 0x201c, Stride: 0x1}, - unicode.Range16{Lo: 0x201d, Hi: 0x201d, Stride: 0x1}, - unicode.Range16{Lo: 0x201e, Hi: 0x201e, Stride: 0x1}, - unicode.Range16{Lo: 0x201f, Hi: 0x201f, Stride: 0x1}, - unicode.Range16{Lo: 0x2039, Hi: 0x2039, Stride: 0x1}, - unicode.Range16{Lo: 0x203a, Hi: 0x203a, Stride: 0x1}, - unicode.Range16{Lo: 0x2045, Hi: 0x2045, Stride: 0x1}, - unicode.Range16{Lo: 0x2046, Hi: 0x2046, Stride: 0x1}, - unicode.Range16{Lo: 0x207d, Hi: 0x207d, Stride: 0x1}, - unicode.Range16{Lo: 0x207e, Hi: 0x207e, Stride: 0x1}, - unicode.Range16{Lo: 0x208d, Hi: 0x208d, Stride: 0x1}, - unicode.Range16{Lo: 0x208e, Hi: 0x208e, Stride: 0x1}, - unicode.Range16{Lo: 0x2308, Hi: 0x2308, Stride: 0x1}, - unicode.Range16{Lo: 0x2309, Hi: 0x2309, Stride: 0x1}, - unicode.Range16{Lo: 0x230a, Hi: 0x230a, Stride: 0x1}, - unicode.Range16{Lo: 0x230b, Hi: 0x230b, Stride: 0x1}, - unicode.Range16{Lo: 0x2329, Hi: 0x2329, Stride: 0x1}, - unicode.Range16{Lo: 0x232a, Hi: 0x232a, Stride: 0x1}, - unicode.Range16{Lo: 0x275b, Hi: 0x2760, Stride: 0x1}, - unicode.Range16{Lo: 0x2768, Hi: 0x2768, Stride: 0x1}, - unicode.Range16{Lo: 0x2769, Hi: 0x2769, Stride: 0x1}, - unicode.Range16{Lo: 0x276a, Hi: 0x276a, Stride: 0x1}, - unicode.Range16{Lo: 0x276b, Hi: 0x276b, Stride: 0x1}, - unicode.Range16{Lo: 0x276c, Hi: 0x276c, Stride: 0x1}, - unicode.Range16{Lo: 0x276d, Hi: 0x276d, Stride: 0x1}, - unicode.Range16{Lo: 0x276e, Hi: 0x276e, Stride: 0x1}, - unicode.Range16{Lo: 0x276f, Hi: 0x276f, Stride: 0x1}, - unicode.Range16{Lo: 0x2770, Hi: 0x2770, Stride: 0x1}, - unicode.Range16{Lo: 0x2771, Hi: 0x2771, Stride: 0x1}, - unicode.Range16{Lo: 0x2772, Hi: 0x2772, Stride: 0x1}, - unicode.Range16{Lo: 0x2773, Hi: 0x2773, Stride: 0x1}, - unicode.Range16{Lo: 0x2774, Hi: 0x2774, Stride: 0x1}, - unicode.Range16{Lo: 0x2775, Hi: 0x2775, Stride: 0x1}, - unicode.Range16{Lo: 0x27c5, Hi: 0x27c5, Stride: 0x1}, - unicode.Range16{Lo: 0x27c6, Hi: 0x27c6, Stride: 0x1}, - unicode.Range16{Lo: 0x27e6, Hi: 0x27e6, Stride: 0x1}, - unicode.Range16{Lo: 0x27e7, Hi: 0x27e7, Stride: 0x1}, - unicode.Range16{Lo: 0x27e8, Hi: 0x27e8, Stride: 0x1}, - unicode.Range16{Lo: 0x27e9, Hi: 0x27e9, Stride: 0x1}, - unicode.Range16{Lo: 0x27ea, Hi: 0x27ea, Stride: 0x1}, - unicode.Range16{Lo: 0x27eb, Hi: 0x27eb, Stride: 0x1}, - unicode.Range16{Lo: 0x27ec, Hi: 0x27ec, Stride: 0x1}, - unicode.Range16{Lo: 0x27ed, Hi: 0x27ed, Stride: 0x1}, - unicode.Range16{Lo: 0x27ee, Hi: 0x27ee, Stride: 0x1}, - unicode.Range16{Lo: 0x27ef, Hi: 0x27ef, Stride: 0x1}, - unicode.Range16{Lo: 0x2983, Hi: 0x2983, Stride: 0x1}, - unicode.Range16{Lo: 0x2984, Hi: 0x2984, Stride: 0x1}, - unicode.Range16{Lo: 0x2985, Hi: 0x2985, Stride: 0x1}, - unicode.Range16{Lo: 0x2986, Hi: 0x2986, Stride: 0x1}, - unicode.Range16{Lo: 0x2987, Hi: 0x2987, Stride: 0x1}, - unicode.Range16{Lo: 0x2988, Hi: 0x2988, Stride: 0x1}, - unicode.Range16{Lo: 0x2989, Hi: 0x2989, Stride: 0x1}, - unicode.Range16{Lo: 0x298a, Hi: 0x298a, Stride: 0x1}, - unicode.Range16{Lo: 0x298b, Hi: 0x298b, Stride: 0x1}, - unicode.Range16{Lo: 0x298c, Hi: 0x298c, Stride: 0x1}, - unicode.Range16{Lo: 0x298d, Hi: 0x298d, Stride: 0x1}, - unicode.Range16{Lo: 0x298e, Hi: 0x298e, Stride: 0x1}, - unicode.Range16{Lo: 0x298f, Hi: 0x298f, Stride: 0x1}, - unicode.Range16{Lo: 0x2990, Hi: 0x2990, Stride: 0x1}, - unicode.Range16{Lo: 0x2991, Hi: 0x2991, Stride: 0x1}, - unicode.Range16{Lo: 0x2992, Hi: 0x2992, Stride: 0x1}, - unicode.Range16{Lo: 0x2993, Hi: 0x2993, Stride: 0x1}, - unicode.Range16{Lo: 0x2994, Hi: 0x2994, Stride: 0x1}, - unicode.Range16{Lo: 0x2995, Hi: 0x2995, Stride: 0x1}, - unicode.Range16{Lo: 0x2996, Hi: 0x2996, Stride: 0x1}, - unicode.Range16{Lo: 0x2997, Hi: 0x2997, Stride: 0x1}, - unicode.Range16{Lo: 0x2998, Hi: 0x2998, Stride: 0x1}, - unicode.Range16{Lo: 0x29d8, Hi: 0x29d8, Stride: 0x1}, - unicode.Range16{Lo: 0x29d9, Hi: 0x29d9, Stride: 0x1}, - unicode.Range16{Lo: 0x29da, Hi: 0x29da, Stride: 0x1}, - unicode.Range16{Lo: 0x29db, Hi: 0x29db, Stride: 0x1}, - unicode.Range16{Lo: 0x29fc, Hi: 0x29fc, Stride: 0x1}, - unicode.Range16{Lo: 0x29fd, Hi: 0x29fd, Stride: 0x1}, - unicode.Range16{Lo: 0x2e00, Hi: 0x2e01, Stride: 0x1}, - unicode.Range16{Lo: 0x2e02, Hi: 0x2e02, Stride: 0x1}, - unicode.Range16{Lo: 0x2e03, Hi: 0x2e03, Stride: 0x1}, - unicode.Range16{Lo: 0x2e04, Hi: 0x2e04, Stride: 0x1}, - unicode.Range16{Lo: 0x2e05, Hi: 0x2e05, Stride: 0x1}, - unicode.Range16{Lo: 0x2e06, Hi: 0x2e08, Stride: 0x1}, - unicode.Range16{Lo: 0x2e09, Hi: 0x2e09, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0a, Hi: 0x2e0a, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0b, Hi: 0x2e0b, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0c, Hi: 0x2e0c, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0d, Hi: 0x2e0d, Stride: 0x1}, - unicode.Range16{Lo: 0x2e1c, Hi: 0x2e1c, Stride: 0x1}, - unicode.Range16{Lo: 0x2e1d, Hi: 0x2e1d, Stride: 0x1}, - unicode.Range16{Lo: 0x2e20, Hi: 0x2e20, Stride: 0x1}, - unicode.Range16{Lo: 0x2e21, Hi: 0x2e21, Stride: 0x1}, - unicode.Range16{Lo: 0x2e22, Hi: 0x2e22, Stride: 0x1}, - unicode.Range16{Lo: 0x2e23, Hi: 0x2e23, Stride: 0x1}, - unicode.Range16{Lo: 0x2e24, Hi: 0x2e24, Stride: 0x1}, - unicode.Range16{Lo: 0x2e25, Hi: 0x2e25, Stride: 0x1}, - unicode.Range16{Lo: 0x2e26, Hi: 0x2e26, Stride: 0x1}, - unicode.Range16{Lo: 0x2e27, Hi: 0x2e27, Stride: 0x1}, - unicode.Range16{Lo: 0x2e28, Hi: 0x2e28, Stride: 0x1}, - unicode.Range16{Lo: 0x2e29, Hi: 0x2e29, Stride: 0x1}, - unicode.Range16{Lo: 0x2e42, Hi: 0x2e42, Stride: 0x1}, - unicode.Range16{Lo: 0x3008, Hi: 0x3008, Stride: 0x1}, - unicode.Range16{Lo: 0x3009, Hi: 0x3009, Stride: 0x1}, - unicode.Range16{Lo: 0x300a, Hi: 0x300a, Stride: 0x1}, - unicode.Range16{Lo: 0x300b, Hi: 0x300b, Stride: 0x1}, - unicode.Range16{Lo: 0x300c, Hi: 0x300c, Stride: 0x1}, - unicode.Range16{Lo: 0x300d, Hi: 0x300d, Stride: 0x1}, - unicode.Range16{Lo: 0x300e, Hi: 0x300e, Stride: 0x1}, - unicode.Range16{Lo: 0x300f, Hi: 0x300f, Stride: 0x1}, - unicode.Range16{Lo: 0x3010, Hi: 0x3010, Stride: 0x1}, - unicode.Range16{Lo: 0x3011, Hi: 0x3011, Stride: 0x1}, - unicode.Range16{Lo: 0x3014, Hi: 0x3014, Stride: 0x1}, - unicode.Range16{Lo: 0x3015, Hi: 0x3015, Stride: 0x1}, - unicode.Range16{Lo: 0x3016, Hi: 0x3016, Stride: 0x1}, - unicode.Range16{Lo: 0x3017, Hi: 0x3017, Stride: 0x1}, - unicode.Range16{Lo: 0x3018, Hi: 0x3018, Stride: 0x1}, - unicode.Range16{Lo: 0x3019, Hi: 0x3019, Stride: 0x1}, - unicode.Range16{Lo: 0x301a, Hi: 0x301a, Stride: 0x1}, - unicode.Range16{Lo: 0x301b, Hi: 0x301b, Stride: 0x1}, - unicode.Range16{Lo: 0x301d, Hi: 0x301d, Stride: 0x1}, - unicode.Range16{Lo: 0x301e, Hi: 0x301f, Stride: 0x1}, - unicode.Range16{Lo: 0xfd3e, Hi: 0xfd3e, Stride: 0x1}, - unicode.Range16{Lo: 0xfd3f, Hi: 0xfd3f, Stride: 0x1}, - unicode.Range16{Lo: 0xfe17, Hi: 0xfe17, Stride: 0x1}, - unicode.Range16{Lo: 0xfe18, Hi: 0xfe18, Stride: 0x1}, - unicode.Range16{Lo: 0xfe35, Hi: 0xfe35, Stride: 0x1}, - unicode.Range16{Lo: 0xfe36, Hi: 0xfe36, Stride: 0x1}, - unicode.Range16{Lo: 0xfe37, Hi: 0xfe37, Stride: 0x1}, - unicode.Range16{Lo: 0xfe38, Hi: 0xfe38, Stride: 0x1}, - unicode.Range16{Lo: 0xfe39, Hi: 0xfe39, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3a, Hi: 0xfe3a, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3b, Hi: 0xfe3b, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3c, Hi: 0xfe3c, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3d, Hi: 0xfe3d, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3e, Hi: 0xfe3e, Stride: 0x1}, - unicode.Range16{Lo: 0xfe3f, Hi: 0xfe3f, Stride: 0x1}, - unicode.Range16{Lo: 0xfe40, Hi: 0xfe40, Stride: 0x1}, - unicode.Range16{Lo: 0xfe41, Hi: 0xfe41, Stride: 0x1}, - unicode.Range16{Lo: 0xfe42, Hi: 0xfe42, Stride: 0x1}, - unicode.Range16{Lo: 0xfe43, Hi: 0xfe43, Stride: 0x1}, - unicode.Range16{Lo: 0xfe44, Hi: 0xfe44, Stride: 0x1}, - unicode.Range16{Lo: 0xfe47, Hi: 0xfe47, Stride: 0x1}, - unicode.Range16{Lo: 0xfe48, Hi: 0xfe48, Stride: 0x1}, - unicode.Range16{Lo: 0xfe59, Hi: 0xfe59, Stride: 0x1}, - unicode.Range16{Lo: 0xfe5a, Hi: 0xfe5a, Stride: 0x1}, - unicode.Range16{Lo: 0xfe5b, Hi: 0xfe5b, Stride: 0x1}, - unicode.Range16{Lo: 0xfe5c, Hi: 0xfe5c, Stride: 0x1}, - unicode.Range16{Lo: 0xfe5d, Hi: 0xfe5d, Stride: 0x1}, - unicode.Range16{Lo: 0xfe5e, Hi: 0xfe5e, Stride: 0x1}, - unicode.Range16{Lo: 0xff08, Hi: 0xff08, Stride: 0x1}, - unicode.Range16{Lo: 0xff09, Hi: 0xff09, Stride: 0x1}, - unicode.Range16{Lo: 0xff3b, Hi: 0xff3b, Stride: 0x1}, - unicode.Range16{Lo: 0xff3d, Hi: 0xff3d, Stride: 0x1}, - unicode.Range16{Lo: 0xff5b, Hi: 0xff5b, Stride: 0x1}, - unicode.Range16{Lo: 0xff5d, Hi: 0xff5d, Stride: 0x1}, - unicode.Range16{Lo: 0xff5f, Hi: 0xff5f, Stride: 0x1}, - unicode.Range16{Lo: 0xff60, Hi: 0xff60, Stride: 0x1}, - unicode.Range16{Lo: 0xff62, Hi: 0xff62, Stride: 0x1}, - unicode.Range16{Lo: 0xff63, Hi: 0xff63, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x1f676, Hi: 0x1f678, Stride: 0x1}, - }, - LatinOffset: 10, -} - -var _SentenceExtend = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x300, Hi: 0x36f, Stride: 0x1}, - unicode.Range16{Lo: 0x483, Hi: 0x487, Stride: 0x1}, - unicode.Range16{Lo: 0x488, Hi: 0x489, Stride: 0x1}, - unicode.Range16{Lo: 0x591, Hi: 0x5bd, Stride: 0x1}, - unicode.Range16{Lo: 0x5bf, Hi: 0x5bf, Stride: 0x1}, - unicode.Range16{Lo: 0x5c1, Hi: 0x5c2, Stride: 0x1}, - unicode.Range16{Lo: 0x5c4, Hi: 0x5c5, Stride: 0x1}, - unicode.Range16{Lo: 0x5c7, Hi: 0x5c7, Stride: 0x1}, - unicode.Range16{Lo: 0x610, Hi: 0x61a, Stride: 0x1}, - unicode.Range16{Lo: 0x64b, Hi: 0x65f, Stride: 0x1}, - unicode.Range16{Lo: 0x670, Hi: 0x670, Stride: 0x1}, - unicode.Range16{Lo: 0x6d6, Hi: 0x6dc, Stride: 0x1}, - unicode.Range16{Lo: 0x6df, Hi: 0x6e4, Stride: 0x1}, - unicode.Range16{Lo: 0x6e7, Hi: 0x6e8, Stride: 0x1}, - unicode.Range16{Lo: 0x6ea, Hi: 0x6ed, Stride: 0x1}, - unicode.Range16{Lo: 0x711, Hi: 0x711, Stride: 0x1}, - unicode.Range16{Lo: 0x730, Hi: 0x74a, Stride: 0x1}, - unicode.Range16{Lo: 0x7a6, Hi: 0x7b0, Stride: 0x1}, - unicode.Range16{Lo: 0x7eb, Hi: 0x7f3, Stride: 0x1}, - unicode.Range16{Lo: 0x816, Hi: 0x819, Stride: 0x1}, - unicode.Range16{Lo: 0x81b, Hi: 0x823, Stride: 0x1}, - unicode.Range16{Lo: 0x825, Hi: 0x827, Stride: 0x1}, - unicode.Range16{Lo: 0x829, Hi: 0x82d, Stride: 0x1}, - unicode.Range16{Lo: 0x859, Hi: 0x85b, Stride: 0x1}, - unicode.Range16{Lo: 0x8d4, Hi: 0x8e1, Stride: 0x1}, - unicode.Range16{Lo: 0x8e3, Hi: 0x902, Stride: 0x1}, - unicode.Range16{Lo: 0x903, Hi: 0x903, Stride: 0x1}, - unicode.Range16{Lo: 0x93a, Hi: 0x93a, Stride: 0x1}, - unicode.Range16{Lo: 0x93b, Hi: 0x93b, Stride: 0x1}, - unicode.Range16{Lo: 0x93c, Hi: 0x93c, Stride: 0x1}, - unicode.Range16{Lo: 0x93e, Hi: 0x940, Stride: 0x1}, - unicode.Range16{Lo: 0x941, Hi: 0x948, Stride: 0x1}, - unicode.Range16{Lo: 0x949, Hi: 0x94c, Stride: 0x1}, - unicode.Range16{Lo: 0x94d, Hi: 0x94d, Stride: 0x1}, - unicode.Range16{Lo: 0x94e, Hi: 0x94f, Stride: 0x1}, - unicode.Range16{Lo: 0x951, Hi: 0x957, Stride: 0x1}, - unicode.Range16{Lo: 0x962, Hi: 0x963, Stride: 0x1}, - unicode.Range16{Lo: 0x981, Hi: 0x981, Stride: 0x1}, - unicode.Range16{Lo: 0x982, Hi: 0x983, Stride: 0x1}, - unicode.Range16{Lo: 0x9bc, Hi: 0x9bc, Stride: 0x1}, - unicode.Range16{Lo: 0x9be, Hi: 0x9c0, Stride: 0x1}, - unicode.Range16{Lo: 0x9c1, Hi: 0x9c4, Stride: 0x1}, - unicode.Range16{Lo: 0x9c7, Hi: 0x9c8, Stride: 0x1}, - unicode.Range16{Lo: 0x9cb, Hi: 0x9cc, Stride: 0x1}, - unicode.Range16{Lo: 0x9cd, Hi: 0x9cd, Stride: 0x1}, - unicode.Range16{Lo: 0x9d7, Hi: 0x9d7, Stride: 0x1}, - unicode.Range16{Lo: 0x9e2, Hi: 0x9e3, Stride: 0x1}, - unicode.Range16{Lo: 0xa01, Hi: 0xa02, Stride: 0x1}, - unicode.Range16{Lo: 0xa03, Hi: 0xa03, Stride: 0x1}, - unicode.Range16{Lo: 0xa3c, Hi: 0xa3c, Stride: 0x1}, - unicode.Range16{Lo: 0xa3e, Hi: 0xa40, Stride: 0x1}, - unicode.Range16{Lo: 0xa41, Hi: 0xa42, Stride: 0x1}, - unicode.Range16{Lo: 0xa47, Hi: 0xa48, Stride: 0x1}, - unicode.Range16{Lo: 0xa4b, Hi: 0xa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xa51, Hi: 0xa51, Stride: 0x1}, - unicode.Range16{Lo: 0xa70, Hi: 0xa71, Stride: 0x1}, - unicode.Range16{Lo: 0xa75, Hi: 0xa75, Stride: 0x1}, - unicode.Range16{Lo: 0xa81, Hi: 0xa82, Stride: 0x1}, - unicode.Range16{Lo: 0xa83, Hi: 0xa83, Stride: 0x1}, - unicode.Range16{Lo: 0xabc, Hi: 0xabc, Stride: 0x1}, - unicode.Range16{Lo: 0xabe, Hi: 0xac0, Stride: 0x1}, - unicode.Range16{Lo: 0xac1, Hi: 0xac5, Stride: 0x1}, - unicode.Range16{Lo: 0xac7, Hi: 0xac8, Stride: 0x1}, - unicode.Range16{Lo: 0xac9, Hi: 0xac9, Stride: 0x1}, - unicode.Range16{Lo: 0xacb, Hi: 0xacc, Stride: 0x1}, - unicode.Range16{Lo: 0xacd, Hi: 0xacd, Stride: 0x1}, - unicode.Range16{Lo: 0xae2, Hi: 0xae3, Stride: 0x1}, - unicode.Range16{Lo: 0xb01, Hi: 0xb01, Stride: 0x1}, - unicode.Range16{Lo: 0xb02, Hi: 0xb03, Stride: 0x1}, - unicode.Range16{Lo: 0xb3c, Hi: 0xb3c, Stride: 0x1}, - unicode.Range16{Lo: 0xb3e, Hi: 0xb3e, Stride: 0x1}, - unicode.Range16{Lo: 0xb3f, Hi: 0xb3f, Stride: 0x1}, - unicode.Range16{Lo: 0xb40, Hi: 0xb40, Stride: 0x1}, - unicode.Range16{Lo: 0xb41, Hi: 0xb44, Stride: 0x1}, - unicode.Range16{Lo: 0xb47, Hi: 0xb48, Stride: 0x1}, - unicode.Range16{Lo: 0xb4b, Hi: 0xb4c, Stride: 0x1}, - unicode.Range16{Lo: 0xb4d, Hi: 0xb4d, Stride: 0x1}, - unicode.Range16{Lo: 0xb56, Hi: 0xb56, Stride: 0x1}, - unicode.Range16{Lo: 0xb57, Hi: 0xb57, Stride: 0x1}, - unicode.Range16{Lo: 0xb62, Hi: 0xb63, Stride: 0x1}, - unicode.Range16{Lo: 0xb82, Hi: 0xb82, Stride: 0x1}, - unicode.Range16{Lo: 0xbbe, Hi: 0xbbf, Stride: 0x1}, - unicode.Range16{Lo: 0xbc0, Hi: 0xbc0, Stride: 0x1}, - unicode.Range16{Lo: 0xbc1, Hi: 0xbc2, Stride: 0x1}, - unicode.Range16{Lo: 0xbc6, Hi: 0xbc8, Stride: 0x1}, - unicode.Range16{Lo: 0xbca, Hi: 0xbcc, Stride: 0x1}, - unicode.Range16{Lo: 0xbcd, Hi: 0xbcd, Stride: 0x1}, - unicode.Range16{Lo: 0xbd7, Hi: 0xbd7, Stride: 0x1}, - unicode.Range16{Lo: 0xc00, Hi: 0xc00, Stride: 0x1}, - unicode.Range16{Lo: 0xc01, Hi: 0xc03, Stride: 0x1}, - unicode.Range16{Lo: 0xc3e, Hi: 0xc40, Stride: 0x1}, - unicode.Range16{Lo: 0xc41, Hi: 0xc44, Stride: 0x1}, - unicode.Range16{Lo: 0xc46, Hi: 0xc48, Stride: 0x1}, - unicode.Range16{Lo: 0xc4a, Hi: 0xc4d, Stride: 0x1}, - unicode.Range16{Lo: 0xc55, Hi: 0xc56, Stride: 0x1}, - unicode.Range16{Lo: 0xc62, Hi: 0xc63, Stride: 0x1}, - unicode.Range16{Lo: 0xc81, Hi: 0xc81, Stride: 0x1}, - unicode.Range16{Lo: 0xc82, Hi: 0xc83, Stride: 0x1}, - unicode.Range16{Lo: 0xcbc, Hi: 0xcbc, Stride: 0x1}, - unicode.Range16{Lo: 0xcbe, Hi: 0xcbe, Stride: 0x1}, - unicode.Range16{Lo: 0xcbf, Hi: 0xcbf, Stride: 0x1}, - unicode.Range16{Lo: 0xcc0, Hi: 0xcc4, Stride: 0x1}, - unicode.Range16{Lo: 0xcc6, Hi: 0xcc6, Stride: 0x1}, - unicode.Range16{Lo: 0xcc7, Hi: 0xcc8, Stride: 0x1}, - unicode.Range16{Lo: 0xcca, Hi: 0xccb, Stride: 0x1}, - unicode.Range16{Lo: 0xccc, Hi: 0xccd, Stride: 0x1}, - unicode.Range16{Lo: 0xcd5, Hi: 0xcd6, Stride: 0x1}, - unicode.Range16{Lo: 0xce2, Hi: 0xce3, Stride: 0x1}, - unicode.Range16{Lo: 0xd01, Hi: 0xd01, Stride: 0x1}, - unicode.Range16{Lo: 0xd02, Hi: 0xd03, Stride: 0x1}, - unicode.Range16{Lo: 0xd3e, Hi: 0xd40, Stride: 0x1}, - unicode.Range16{Lo: 0xd41, Hi: 0xd44, Stride: 0x1}, - unicode.Range16{Lo: 0xd46, Hi: 0xd48, Stride: 0x1}, - unicode.Range16{Lo: 0xd4a, Hi: 0xd4c, Stride: 0x1}, - unicode.Range16{Lo: 0xd4d, Hi: 0xd4d, Stride: 0x1}, - unicode.Range16{Lo: 0xd57, Hi: 0xd57, Stride: 0x1}, - unicode.Range16{Lo: 0xd62, Hi: 0xd63, Stride: 0x1}, - unicode.Range16{Lo: 0xd82, Hi: 0xd83, Stride: 0x1}, - unicode.Range16{Lo: 0xdca, Hi: 0xdca, Stride: 0x1}, - unicode.Range16{Lo: 0xdcf, Hi: 0xdd1, Stride: 0x1}, - unicode.Range16{Lo: 0xdd2, Hi: 0xdd4, Stride: 0x1}, - unicode.Range16{Lo: 0xdd6, Hi: 0xdd6, Stride: 0x1}, - unicode.Range16{Lo: 0xdd8, Hi: 0xddf, Stride: 0x1}, - unicode.Range16{Lo: 0xdf2, Hi: 0xdf3, Stride: 0x1}, - unicode.Range16{Lo: 0xe31, Hi: 0xe31, Stride: 0x1}, - unicode.Range16{Lo: 0xe34, Hi: 0xe3a, Stride: 0x1}, - unicode.Range16{Lo: 0xe47, Hi: 0xe4e, Stride: 0x1}, - unicode.Range16{Lo: 0xeb1, Hi: 0xeb1, Stride: 0x1}, - unicode.Range16{Lo: 0xeb4, Hi: 0xeb9, Stride: 0x1}, - unicode.Range16{Lo: 0xebb, Hi: 0xebc, Stride: 0x1}, - unicode.Range16{Lo: 0xec8, Hi: 0xecd, Stride: 0x1}, - unicode.Range16{Lo: 0xf18, Hi: 0xf19, Stride: 0x1}, - unicode.Range16{Lo: 0xf35, Hi: 0xf35, Stride: 0x1}, - unicode.Range16{Lo: 0xf37, Hi: 0xf37, Stride: 0x1}, - unicode.Range16{Lo: 0xf39, Hi: 0xf39, Stride: 0x1}, - unicode.Range16{Lo: 0xf3e, Hi: 0xf3f, Stride: 0x1}, - unicode.Range16{Lo: 0xf71, Hi: 0xf7e, Stride: 0x1}, - unicode.Range16{Lo: 0xf7f, Hi: 0xf7f, Stride: 0x1}, - unicode.Range16{Lo: 0xf80, Hi: 0xf84, Stride: 0x1}, - unicode.Range16{Lo: 0xf86, Hi: 0xf87, Stride: 0x1}, - unicode.Range16{Lo: 0xf8d, Hi: 0xf97, Stride: 0x1}, - unicode.Range16{Lo: 0xf99, Hi: 0xfbc, Stride: 0x1}, - unicode.Range16{Lo: 0xfc6, Hi: 0xfc6, Stride: 0x1}, - unicode.Range16{Lo: 0x102b, Hi: 0x102c, Stride: 0x1}, - unicode.Range16{Lo: 0x102d, Hi: 0x1030, Stride: 0x1}, - unicode.Range16{Lo: 0x1031, Hi: 0x1031, Stride: 0x1}, - unicode.Range16{Lo: 0x1032, Hi: 0x1037, Stride: 0x1}, - unicode.Range16{Lo: 0x1038, Hi: 0x1038, Stride: 0x1}, - unicode.Range16{Lo: 0x1039, Hi: 0x103a, Stride: 0x1}, - unicode.Range16{Lo: 0x103b, Hi: 0x103c, Stride: 0x1}, - unicode.Range16{Lo: 0x103d, Hi: 0x103e, Stride: 0x1}, - unicode.Range16{Lo: 0x1056, Hi: 0x1057, Stride: 0x1}, - unicode.Range16{Lo: 0x1058, Hi: 0x1059, Stride: 0x1}, - unicode.Range16{Lo: 0x105e, Hi: 0x1060, Stride: 0x1}, - unicode.Range16{Lo: 0x1062, Hi: 0x1064, Stride: 0x1}, - unicode.Range16{Lo: 0x1067, Hi: 0x106d, Stride: 0x1}, - unicode.Range16{Lo: 0x1071, Hi: 0x1074, Stride: 0x1}, - unicode.Range16{Lo: 0x1082, Hi: 0x1082, Stride: 0x1}, - unicode.Range16{Lo: 0x1083, Hi: 0x1084, Stride: 0x1}, - unicode.Range16{Lo: 0x1085, Hi: 0x1086, Stride: 0x1}, - unicode.Range16{Lo: 0x1087, Hi: 0x108c, Stride: 0x1}, - unicode.Range16{Lo: 0x108d, Hi: 0x108d, Stride: 0x1}, - unicode.Range16{Lo: 0x108f, Hi: 0x108f, Stride: 0x1}, - unicode.Range16{Lo: 0x109a, Hi: 0x109c, Stride: 0x1}, - unicode.Range16{Lo: 0x109d, Hi: 0x109d, Stride: 0x1}, - unicode.Range16{Lo: 0x135d, Hi: 0x135f, Stride: 0x1}, - unicode.Range16{Lo: 0x1712, Hi: 0x1714, Stride: 0x1}, - unicode.Range16{Lo: 0x1732, Hi: 0x1734, Stride: 0x1}, - unicode.Range16{Lo: 0x1752, Hi: 0x1753, Stride: 0x1}, - unicode.Range16{Lo: 0x1772, Hi: 0x1773, Stride: 0x1}, - unicode.Range16{Lo: 0x17b4, Hi: 0x17b5, Stride: 0x1}, - unicode.Range16{Lo: 0x17b6, Hi: 0x17b6, Stride: 0x1}, - unicode.Range16{Lo: 0x17b7, Hi: 0x17bd, Stride: 0x1}, - unicode.Range16{Lo: 0x17be, Hi: 0x17c5, Stride: 0x1}, - unicode.Range16{Lo: 0x17c6, Hi: 0x17c6, Stride: 0x1}, - unicode.Range16{Lo: 0x17c7, Hi: 0x17c8, Stride: 0x1}, - unicode.Range16{Lo: 0x17c9, Hi: 0x17d3, Stride: 0x1}, - unicode.Range16{Lo: 0x17dd, Hi: 0x17dd, Stride: 0x1}, - unicode.Range16{Lo: 0x180b, Hi: 0x180d, Stride: 0x1}, - unicode.Range16{Lo: 0x1885, Hi: 0x1886, Stride: 0x1}, - unicode.Range16{Lo: 0x18a9, Hi: 0x18a9, Stride: 0x1}, - unicode.Range16{Lo: 0x1920, Hi: 0x1922, Stride: 0x1}, - unicode.Range16{Lo: 0x1923, Hi: 0x1926, Stride: 0x1}, - unicode.Range16{Lo: 0x1927, Hi: 0x1928, Stride: 0x1}, - unicode.Range16{Lo: 0x1929, Hi: 0x192b, Stride: 0x1}, - unicode.Range16{Lo: 0x1930, Hi: 0x1931, Stride: 0x1}, - unicode.Range16{Lo: 0x1932, Hi: 0x1932, Stride: 0x1}, - unicode.Range16{Lo: 0x1933, Hi: 0x1938, Stride: 0x1}, - unicode.Range16{Lo: 0x1939, Hi: 0x193b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a17, Hi: 0x1a18, Stride: 0x1}, - unicode.Range16{Lo: 0x1a19, Hi: 0x1a1a, Stride: 0x1}, - unicode.Range16{Lo: 0x1a1b, Hi: 0x1a1b, Stride: 0x1}, - unicode.Range16{Lo: 0x1a55, Hi: 0x1a55, Stride: 0x1}, - unicode.Range16{Lo: 0x1a56, Hi: 0x1a56, Stride: 0x1}, - unicode.Range16{Lo: 0x1a57, Hi: 0x1a57, Stride: 0x1}, - unicode.Range16{Lo: 0x1a58, Hi: 0x1a5e, Stride: 0x1}, - unicode.Range16{Lo: 0x1a60, Hi: 0x1a60, Stride: 0x1}, - unicode.Range16{Lo: 0x1a61, Hi: 0x1a61, Stride: 0x1}, - unicode.Range16{Lo: 0x1a62, Hi: 0x1a62, Stride: 0x1}, - unicode.Range16{Lo: 0x1a63, Hi: 0x1a64, Stride: 0x1}, - unicode.Range16{Lo: 0x1a65, Hi: 0x1a6c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a6d, Hi: 0x1a72, Stride: 0x1}, - unicode.Range16{Lo: 0x1a73, Hi: 0x1a7c, Stride: 0x1}, - unicode.Range16{Lo: 0x1a7f, Hi: 0x1a7f, Stride: 0x1}, - unicode.Range16{Lo: 0x1ab0, Hi: 0x1abd, Stride: 0x1}, - unicode.Range16{Lo: 0x1abe, Hi: 0x1abe, Stride: 0x1}, - unicode.Range16{Lo: 0x1b00, Hi: 0x1b03, Stride: 0x1}, - unicode.Range16{Lo: 0x1b04, Hi: 0x1b04, Stride: 0x1}, - unicode.Range16{Lo: 0x1b34, Hi: 0x1b34, Stride: 0x1}, - unicode.Range16{Lo: 0x1b35, Hi: 0x1b35, Stride: 0x1}, - unicode.Range16{Lo: 0x1b36, Hi: 0x1b3a, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3b, Hi: 0x1b3b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3c, Hi: 0x1b3c, Stride: 0x1}, - unicode.Range16{Lo: 0x1b3d, Hi: 0x1b41, Stride: 0x1}, - unicode.Range16{Lo: 0x1b42, Hi: 0x1b42, Stride: 0x1}, - unicode.Range16{Lo: 0x1b43, Hi: 0x1b44, Stride: 0x1}, - unicode.Range16{Lo: 0x1b6b, Hi: 0x1b73, Stride: 0x1}, - unicode.Range16{Lo: 0x1b80, Hi: 0x1b81, Stride: 0x1}, - unicode.Range16{Lo: 0x1b82, Hi: 0x1b82, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba1, Hi: 0x1ba1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba2, Hi: 0x1ba5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba6, Hi: 0x1ba7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ba8, Hi: 0x1ba9, Stride: 0x1}, - unicode.Range16{Lo: 0x1baa, Hi: 0x1baa, Stride: 0x1}, - unicode.Range16{Lo: 0x1bab, Hi: 0x1bad, Stride: 0x1}, - unicode.Range16{Lo: 0x1be6, Hi: 0x1be6, Stride: 0x1}, - unicode.Range16{Lo: 0x1be7, Hi: 0x1be7, Stride: 0x1}, - unicode.Range16{Lo: 0x1be8, Hi: 0x1be9, Stride: 0x1}, - unicode.Range16{Lo: 0x1bea, Hi: 0x1bec, Stride: 0x1}, - unicode.Range16{Lo: 0x1bed, Hi: 0x1bed, Stride: 0x1}, - unicode.Range16{Lo: 0x1bee, Hi: 0x1bee, Stride: 0x1}, - unicode.Range16{Lo: 0x1bef, Hi: 0x1bf1, Stride: 0x1}, - unicode.Range16{Lo: 0x1bf2, Hi: 0x1bf3, Stride: 0x1}, - unicode.Range16{Lo: 0x1c24, Hi: 0x1c2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1c2c, Hi: 0x1c33, Stride: 0x1}, - unicode.Range16{Lo: 0x1c34, Hi: 0x1c35, Stride: 0x1}, - unicode.Range16{Lo: 0x1c36, Hi: 0x1c37, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd0, Hi: 0x1cd2, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd4, Hi: 0x1ce0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce1, Hi: 0x1ce1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce2, Hi: 0x1ce8, Stride: 0x1}, - unicode.Range16{Lo: 0x1ced, Hi: 0x1ced, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf2, Hi: 0x1cf3, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf4, Hi: 0x1cf4, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf8, Hi: 0x1cf9, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc0, Hi: 0x1df5, Stride: 0x1}, - unicode.Range16{Lo: 0x1dfb, Hi: 0x1dff, Stride: 0x1}, - unicode.Range16{Lo: 0x200c, Hi: 0x200d, Stride: 0x1}, - unicode.Range16{Lo: 0x20d0, Hi: 0x20dc, Stride: 0x1}, - unicode.Range16{Lo: 0x20dd, Hi: 0x20e0, Stride: 0x1}, - unicode.Range16{Lo: 0x20e1, Hi: 0x20e1, Stride: 0x1}, - unicode.Range16{Lo: 0x20e2, Hi: 0x20e4, Stride: 0x1}, - unicode.Range16{Lo: 0x20e5, Hi: 0x20f0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cef, Hi: 0x2cf1, Stride: 0x1}, - unicode.Range16{Lo: 0x2d7f, Hi: 0x2d7f, Stride: 0x1}, - unicode.Range16{Lo: 0x2de0, Hi: 0x2dff, Stride: 0x1}, - unicode.Range16{Lo: 0x302a, Hi: 0x302d, Stride: 0x1}, - unicode.Range16{Lo: 0x302e, Hi: 0x302f, Stride: 0x1}, - unicode.Range16{Lo: 0x3099, Hi: 0x309a, Stride: 0x1}, - unicode.Range16{Lo: 0xa66f, Hi: 0xa66f, Stride: 0x1}, - unicode.Range16{Lo: 0xa670, Hi: 0xa672, Stride: 0x1}, - unicode.Range16{Lo: 0xa674, Hi: 0xa67d, Stride: 0x1}, - unicode.Range16{Lo: 0xa69e, Hi: 0xa69f, Stride: 0x1}, - unicode.Range16{Lo: 0xa6f0, Hi: 0xa6f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa802, Hi: 0xa802, Stride: 0x1}, - unicode.Range16{Lo: 0xa806, Hi: 0xa806, Stride: 0x1}, - unicode.Range16{Lo: 0xa80b, Hi: 0xa80b, Stride: 0x1}, - unicode.Range16{Lo: 0xa823, Hi: 0xa824, Stride: 0x1}, - unicode.Range16{Lo: 0xa825, Hi: 0xa826, Stride: 0x1}, - unicode.Range16{Lo: 0xa827, Hi: 0xa827, Stride: 0x1}, - unicode.Range16{Lo: 0xa880, Hi: 0xa881, Stride: 0x1}, - unicode.Range16{Lo: 0xa8b4, Hi: 0xa8c3, Stride: 0x1}, - unicode.Range16{Lo: 0xa8c4, Hi: 0xa8c5, Stride: 0x1}, - unicode.Range16{Lo: 0xa8e0, Hi: 0xa8f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa926, Hi: 0xa92d, Stride: 0x1}, - unicode.Range16{Lo: 0xa947, Hi: 0xa951, Stride: 0x1}, - unicode.Range16{Lo: 0xa952, Hi: 0xa953, Stride: 0x1}, - unicode.Range16{Lo: 0xa980, Hi: 0xa982, Stride: 0x1}, - unicode.Range16{Lo: 0xa983, Hi: 0xa983, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b3, Hi: 0xa9b3, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b4, Hi: 0xa9b5, Stride: 0x1}, - unicode.Range16{Lo: 0xa9b6, Hi: 0xa9b9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9ba, Hi: 0xa9bb, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bc, Hi: 0xa9bc, Stride: 0x1}, - unicode.Range16{Lo: 0xa9bd, Hi: 0xa9c0, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e5, Hi: 0xa9e5, Stride: 0x1}, - unicode.Range16{Lo: 0xaa29, Hi: 0xaa2e, Stride: 0x1}, - unicode.Range16{Lo: 0xaa2f, Hi: 0xaa30, Stride: 0x1}, - unicode.Range16{Lo: 0xaa31, Hi: 0xaa32, Stride: 0x1}, - unicode.Range16{Lo: 0xaa33, Hi: 0xaa34, Stride: 0x1}, - unicode.Range16{Lo: 0xaa35, Hi: 0xaa36, Stride: 0x1}, - unicode.Range16{Lo: 0xaa43, Hi: 0xaa43, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4c, Hi: 0xaa4c, Stride: 0x1}, - unicode.Range16{Lo: 0xaa4d, Hi: 0xaa4d, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7b, Hi: 0xaa7b, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7c, Hi: 0xaa7c, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7d, Hi: 0xaa7d, Stride: 0x1}, - unicode.Range16{Lo: 0xaab0, Hi: 0xaab0, Stride: 0x1}, - unicode.Range16{Lo: 0xaab2, Hi: 0xaab4, Stride: 0x1}, - unicode.Range16{Lo: 0xaab7, Hi: 0xaab8, Stride: 0x1}, - unicode.Range16{Lo: 0xaabe, Hi: 0xaabf, Stride: 0x1}, - unicode.Range16{Lo: 0xaac1, Hi: 0xaac1, Stride: 0x1}, - unicode.Range16{Lo: 0xaaeb, Hi: 0xaaeb, Stride: 0x1}, - unicode.Range16{Lo: 0xaaec, Hi: 0xaaed, Stride: 0x1}, - unicode.Range16{Lo: 0xaaee, Hi: 0xaaef, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf5, Hi: 0xaaf5, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf6, Hi: 0xaaf6, Stride: 0x1}, - unicode.Range16{Lo: 0xabe3, Hi: 0xabe4, Stride: 0x1}, - unicode.Range16{Lo: 0xabe5, Hi: 0xabe5, Stride: 0x1}, - unicode.Range16{Lo: 0xabe6, Hi: 0xabe7, Stride: 0x1}, - unicode.Range16{Lo: 0xabe8, Hi: 0xabe8, Stride: 0x1}, - unicode.Range16{Lo: 0xabe9, Hi: 0xabea, Stride: 0x1}, - unicode.Range16{Lo: 0xabec, Hi: 0xabec, Stride: 0x1}, - unicode.Range16{Lo: 0xabed, Hi: 0xabed, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1e, Hi: 0xfb1e, Stride: 0x1}, - unicode.Range16{Lo: 0xfe00, Hi: 0xfe0f, Stride: 0x1}, - unicode.Range16{Lo: 0xfe20, Hi: 0xfe2f, Stride: 0x1}, - unicode.Range16{Lo: 0xff9e, Hi: 0xff9f, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x101fd, Hi: 0x101fd, Stride: 0x1}, - unicode.Range32{Lo: 0x102e0, Hi: 0x102e0, Stride: 0x1}, - unicode.Range32{Lo: 0x10376, Hi: 0x1037a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a01, Hi: 0x10a03, Stride: 0x1}, - unicode.Range32{Lo: 0x10a05, Hi: 0x10a06, Stride: 0x1}, - unicode.Range32{Lo: 0x10a0c, Hi: 0x10a0f, Stride: 0x1}, - unicode.Range32{Lo: 0x10a38, Hi: 0x10a3a, Stride: 0x1}, - unicode.Range32{Lo: 0x10a3f, Hi: 0x10a3f, Stride: 0x1}, - unicode.Range32{Lo: 0x10ae5, Hi: 0x10ae6, Stride: 0x1}, - unicode.Range32{Lo: 0x11000, Hi: 0x11000, Stride: 0x1}, - unicode.Range32{Lo: 0x11001, Hi: 0x11001, Stride: 0x1}, - unicode.Range32{Lo: 0x11002, Hi: 0x11002, Stride: 0x1}, - unicode.Range32{Lo: 0x11038, Hi: 0x11046, Stride: 0x1}, - unicode.Range32{Lo: 0x1107f, Hi: 0x11081, Stride: 0x1}, - unicode.Range32{Lo: 0x11082, Hi: 0x11082, Stride: 0x1}, - unicode.Range32{Lo: 0x110b0, Hi: 0x110b2, Stride: 0x1}, - unicode.Range32{Lo: 0x110b3, Hi: 0x110b6, Stride: 0x1}, - unicode.Range32{Lo: 0x110b7, Hi: 0x110b8, Stride: 0x1}, - unicode.Range32{Lo: 0x110b9, Hi: 0x110ba, Stride: 0x1}, - unicode.Range32{Lo: 0x11100, Hi: 0x11102, Stride: 0x1}, - unicode.Range32{Lo: 0x11127, Hi: 0x1112b, Stride: 0x1}, - unicode.Range32{Lo: 0x1112c, Hi: 0x1112c, Stride: 0x1}, - unicode.Range32{Lo: 0x1112d, Hi: 0x11134, Stride: 0x1}, - unicode.Range32{Lo: 0x11173, Hi: 0x11173, Stride: 0x1}, - unicode.Range32{Lo: 0x11180, Hi: 0x11181, Stride: 0x1}, - unicode.Range32{Lo: 0x11182, Hi: 0x11182, Stride: 0x1}, - unicode.Range32{Lo: 0x111b3, Hi: 0x111b5, Stride: 0x1}, - unicode.Range32{Lo: 0x111b6, Hi: 0x111be, Stride: 0x1}, - unicode.Range32{Lo: 0x111bf, Hi: 0x111c0, Stride: 0x1}, - unicode.Range32{Lo: 0x111ca, Hi: 0x111cc, Stride: 0x1}, - unicode.Range32{Lo: 0x1122c, Hi: 0x1122e, Stride: 0x1}, - unicode.Range32{Lo: 0x1122f, Hi: 0x11231, Stride: 0x1}, - unicode.Range32{Lo: 0x11232, Hi: 0x11233, Stride: 0x1}, - unicode.Range32{Lo: 0x11234, Hi: 0x11234, Stride: 0x1}, - unicode.Range32{Lo: 0x11235, Hi: 0x11235, Stride: 0x1}, - unicode.Range32{Lo: 0x11236, Hi: 0x11237, Stride: 0x1}, - unicode.Range32{Lo: 0x1123e, Hi: 0x1123e, Stride: 0x1}, - unicode.Range32{Lo: 0x112df, Hi: 0x112df, Stride: 0x1}, - unicode.Range32{Lo: 0x112e0, Hi: 0x112e2, Stride: 0x1}, - unicode.Range32{Lo: 0x112e3, Hi: 0x112ea, Stride: 0x1}, - unicode.Range32{Lo: 0x11300, Hi: 0x11301, Stride: 0x1}, - unicode.Range32{Lo: 0x11302, Hi: 0x11303, Stride: 0x1}, - unicode.Range32{Lo: 0x1133c, Hi: 0x1133c, Stride: 0x1}, - unicode.Range32{Lo: 0x1133e, Hi: 0x1133f, Stride: 0x1}, - unicode.Range32{Lo: 0x11340, Hi: 0x11340, Stride: 0x1}, - unicode.Range32{Lo: 0x11341, Hi: 0x11344, Stride: 0x1}, - unicode.Range32{Lo: 0x11347, Hi: 0x11348, Stride: 0x1}, - unicode.Range32{Lo: 0x1134b, Hi: 0x1134d, Stride: 0x1}, - unicode.Range32{Lo: 0x11357, Hi: 0x11357, Stride: 0x1}, - unicode.Range32{Lo: 0x11362, Hi: 0x11363, Stride: 0x1}, - unicode.Range32{Lo: 0x11366, Hi: 0x1136c, Stride: 0x1}, - unicode.Range32{Lo: 0x11370, Hi: 0x11374, Stride: 0x1}, - unicode.Range32{Lo: 0x11435, Hi: 0x11437, Stride: 0x1}, - unicode.Range32{Lo: 0x11438, Hi: 0x1143f, Stride: 0x1}, - unicode.Range32{Lo: 0x11440, Hi: 0x11441, Stride: 0x1}, - unicode.Range32{Lo: 0x11442, Hi: 0x11444, Stride: 0x1}, - unicode.Range32{Lo: 0x11445, Hi: 0x11445, Stride: 0x1}, - unicode.Range32{Lo: 0x11446, Hi: 0x11446, Stride: 0x1}, - unicode.Range32{Lo: 0x114b0, Hi: 0x114b2, Stride: 0x1}, - unicode.Range32{Lo: 0x114b3, Hi: 0x114b8, Stride: 0x1}, - unicode.Range32{Lo: 0x114b9, Hi: 0x114b9, Stride: 0x1}, - unicode.Range32{Lo: 0x114ba, Hi: 0x114ba, Stride: 0x1}, - unicode.Range32{Lo: 0x114bb, Hi: 0x114be, Stride: 0x1}, - unicode.Range32{Lo: 0x114bf, Hi: 0x114c0, Stride: 0x1}, - unicode.Range32{Lo: 0x114c1, Hi: 0x114c1, Stride: 0x1}, - unicode.Range32{Lo: 0x114c2, Hi: 0x114c3, Stride: 0x1}, - unicode.Range32{Lo: 0x115af, Hi: 0x115b1, Stride: 0x1}, - unicode.Range32{Lo: 0x115b2, Hi: 0x115b5, Stride: 0x1}, - unicode.Range32{Lo: 0x115b8, Hi: 0x115bb, Stride: 0x1}, - unicode.Range32{Lo: 0x115bc, Hi: 0x115bd, Stride: 0x1}, - unicode.Range32{Lo: 0x115be, Hi: 0x115be, Stride: 0x1}, - unicode.Range32{Lo: 0x115bf, Hi: 0x115c0, Stride: 0x1}, - unicode.Range32{Lo: 0x115dc, Hi: 0x115dd, Stride: 0x1}, - unicode.Range32{Lo: 0x11630, Hi: 0x11632, Stride: 0x1}, - unicode.Range32{Lo: 0x11633, Hi: 0x1163a, Stride: 0x1}, - unicode.Range32{Lo: 0x1163b, Hi: 0x1163c, Stride: 0x1}, - unicode.Range32{Lo: 0x1163d, Hi: 0x1163d, Stride: 0x1}, - unicode.Range32{Lo: 0x1163e, Hi: 0x1163e, Stride: 0x1}, - unicode.Range32{Lo: 0x1163f, Hi: 0x11640, Stride: 0x1}, - unicode.Range32{Lo: 0x116ab, Hi: 0x116ab, Stride: 0x1}, - unicode.Range32{Lo: 0x116ac, Hi: 0x116ac, Stride: 0x1}, - unicode.Range32{Lo: 0x116ad, Hi: 0x116ad, Stride: 0x1}, - unicode.Range32{Lo: 0x116ae, Hi: 0x116af, Stride: 0x1}, - unicode.Range32{Lo: 0x116b0, Hi: 0x116b5, Stride: 0x1}, - unicode.Range32{Lo: 0x116b6, Hi: 0x116b6, Stride: 0x1}, - unicode.Range32{Lo: 0x116b7, Hi: 0x116b7, Stride: 0x1}, - unicode.Range32{Lo: 0x1171d, Hi: 0x1171f, Stride: 0x1}, - unicode.Range32{Lo: 0x11720, Hi: 0x11721, Stride: 0x1}, - unicode.Range32{Lo: 0x11722, Hi: 0x11725, Stride: 0x1}, - unicode.Range32{Lo: 0x11726, Hi: 0x11726, Stride: 0x1}, - unicode.Range32{Lo: 0x11727, Hi: 0x1172b, Stride: 0x1}, - unicode.Range32{Lo: 0x11c2f, Hi: 0x11c2f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c30, Hi: 0x11c36, Stride: 0x1}, - unicode.Range32{Lo: 0x11c38, Hi: 0x11c3d, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3e, Hi: 0x11c3e, Stride: 0x1}, - unicode.Range32{Lo: 0x11c3f, Hi: 0x11c3f, Stride: 0x1}, - unicode.Range32{Lo: 0x11c92, Hi: 0x11ca7, Stride: 0x1}, - unicode.Range32{Lo: 0x11ca9, Hi: 0x11ca9, Stride: 0x1}, - unicode.Range32{Lo: 0x11caa, Hi: 0x11cb0, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb1, Hi: 0x11cb1, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb2, Hi: 0x11cb3, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb4, Hi: 0x11cb4, Stride: 0x1}, - unicode.Range32{Lo: 0x11cb5, Hi: 0x11cb6, Stride: 0x1}, - unicode.Range32{Lo: 0x16af0, Hi: 0x16af4, Stride: 0x1}, - unicode.Range32{Lo: 0x16b30, Hi: 0x16b36, Stride: 0x1}, - unicode.Range32{Lo: 0x16f51, Hi: 0x16f7e, Stride: 0x1}, - unicode.Range32{Lo: 0x16f8f, Hi: 0x16f92, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc9d, Hi: 0x1bc9e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d165, Hi: 0x1d166, Stride: 0x1}, - unicode.Range32{Lo: 0x1d167, Hi: 0x1d169, Stride: 0x1}, - unicode.Range32{Lo: 0x1d16d, Hi: 0x1d172, Stride: 0x1}, - unicode.Range32{Lo: 0x1d17b, Hi: 0x1d182, Stride: 0x1}, - unicode.Range32{Lo: 0x1d185, Hi: 0x1d18b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d1aa, Hi: 0x1d1ad, Stride: 0x1}, - unicode.Range32{Lo: 0x1d242, Hi: 0x1d244, Stride: 0x1}, - unicode.Range32{Lo: 0x1da00, Hi: 0x1da36, Stride: 0x1}, - unicode.Range32{Lo: 0x1da3b, Hi: 0x1da6c, Stride: 0x1}, - unicode.Range32{Lo: 0x1da75, Hi: 0x1da75, Stride: 0x1}, - unicode.Range32{Lo: 0x1da84, Hi: 0x1da84, Stride: 0x1}, - unicode.Range32{Lo: 0x1da9b, Hi: 0x1da9f, Stride: 0x1}, - unicode.Range32{Lo: 0x1daa1, Hi: 0x1daaf, Stride: 0x1}, - unicode.Range32{Lo: 0x1e000, Hi: 0x1e006, Stride: 0x1}, - unicode.Range32{Lo: 0x1e008, Hi: 0x1e018, Stride: 0x1}, - unicode.Range32{Lo: 0x1e01b, Hi: 0x1e021, Stride: 0x1}, - unicode.Range32{Lo: 0x1e023, Hi: 0x1e024, Stride: 0x1}, - unicode.Range32{Lo: 0x1e026, Hi: 0x1e02a, Stride: 0x1}, - unicode.Range32{Lo: 0x1e8d0, Hi: 0x1e8d6, Stride: 0x1}, - unicode.Range32{Lo: 0x1e944, Hi: 0x1e94a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0020, Hi: 0xe007f, Stride: 0x1}, - unicode.Range32{Lo: 0xe0100, Hi: 0xe01ef, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _SentenceFormat = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xad, Hi: 0xad, Stride: 0x1}, - unicode.Range16{Lo: 0x600, Hi: 0x605, Stride: 0x1}, - unicode.Range16{Lo: 0x61c, Hi: 0x61c, Stride: 0x1}, - unicode.Range16{Lo: 0x6dd, Hi: 0x6dd, Stride: 0x1}, - unicode.Range16{Lo: 0x70f, Hi: 0x70f, Stride: 0x1}, - unicode.Range16{Lo: 0x8e2, Hi: 0x8e2, Stride: 0x1}, - unicode.Range16{Lo: 0x180e, Hi: 0x180e, Stride: 0x1}, - unicode.Range16{Lo: 0x200b, Hi: 0x200b, Stride: 0x1}, - unicode.Range16{Lo: 0x200e, Hi: 0x200f, Stride: 0x1}, - unicode.Range16{Lo: 0x202a, Hi: 0x202e, Stride: 0x1}, - unicode.Range16{Lo: 0x2060, Hi: 0x2064, Stride: 0x1}, - unicode.Range16{Lo: 0x2066, Hi: 0x206f, Stride: 0x1}, - unicode.Range16{Lo: 0xfeff, Hi: 0xfeff, Stride: 0x1}, - unicode.Range16{Lo: 0xfff9, Hi: 0xfffb, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x110bd, Hi: 0x110bd, Stride: 0x1}, - unicode.Range32{Lo: 0x1bca0, Hi: 0x1bca3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d173, Hi: 0x1d17a, Stride: 0x1}, - unicode.Range32{Lo: 0xe0001, Hi: 0xe0001, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceLF = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0xa, Hi: 0xa, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceLower = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x61, Hi: 0x7a, Stride: 0x1}, - unicode.Range16{Lo: 0xaa, Hi: 0xaa, Stride: 0x1}, - unicode.Range16{Lo: 0xb5, Hi: 0xb5, Stride: 0x1}, - unicode.Range16{Lo: 0xba, Hi: 0xba, Stride: 0x1}, - unicode.Range16{Lo: 0xdf, Hi: 0xf6, Stride: 0x1}, - unicode.Range16{Lo: 0xf8, Hi: 0xff, Stride: 0x1}, - unicode.Range16{Lo: 0x101, Hi: 0x101, Stride: 0x1}, - unicode.Range16{Lo: 0x103, Hi: 0x103, Stride: 0x1}, - unicode.Range16{Lo: 0x105, Hi: 0x105, Stride: 0x1}, - unicode.Range16{Lo: 0x107, Hi: 0x107, Stride: 0x1}, - unicode.Range16{Lo: 0x109, Hi: 0x109, Stride: 0x1}, - unicode.Range16{Lo: 0x10b, Hi: 0x10b, Stride: 0x1}, - unicode.Range16{Lo: 0x10d, Hi: 0x10d, Stride: 0x1}, - unicode.Range16{Lo: 0x10f, Hi: 0x10f, Stride: 0x1}, - unicode.Range16{Lo: 0x111, Hi: 0x111, Stride: 0x1}, - unicode.Range16{Lo: 0x113, Hi: 0x113, Stride: 0x1}, - unicode.Range16{Lo: 0x115, Hi: 0x115, Stride: 0x1}, - unicode.Range16{Lo: 0x117, Hi: 0x117, Stride: 0x1}, - unicode.Range16{Lo: 0x119, Hi: 0x119, Stride: 0x1}, - unicode.Range16{Lo: 0x11b, Hi: 0x11b, Stride: 0x1}, - unicode.Range16{Lo: 0x11d, Hi: 0x11d, Stride: 0x1}, - unicode.Range16{Lo: 0x11f, Hi: 0x11f, Stride: 0x1}, - unicode.Range16{Lo: 0x121, Hi: 0x121, Stride: 0x1}, - unicode.Range16{Lo: 0x123, Hi: 0x123, Stride: 0x1}, - unicode.Range16{Lo: 0x125, Hi: 0x125, Stride: 0x1}, - unicode.Range16{Lo: 0x127, Hi: 0x127, Stride: 0x1}, - unicode.Range16{Lo: 0x129, Hi: 0x129, Stride: 0x1}, - unicode.Range16{Lo: 0x12b, Hi: 0x12b, Stride: 0x1}, - unicode.Range16{Lo: 0x12d, Hi: 0x12d, Stride: 0x1}, - unicode.Range16{Lo: 0x12f, Hi: 0x12f, Stride: 0x1}, - unicode.Range16{Lo: 0x131, Hi: 0x131, Stride: 0x1}, - unicode.Range16{Lo: 0x133, Hi: 0x133, Stride: 0x1}, - unicode.Range16{Lo: 0x135, Hi: 0x135, Stride: 0x1}, - unicode.Range16{Lo: 0x137, Hi: 0x138, Stride: 0x1}, - unicode.Range16{Lo: 0x13a, Hi: 0x13a, Stride: 0x1}, - unicode.Range16{Lo: 0x13c, Hi: 0x13c, Stride: 0x1}, - unicode.Range16{Lo: 0x13e, Hi: 0x13e, Stride: 0x1}, - unicode.Range16{Lo: 0x140, Hi: 0x140, Stride: 0x1}, - unicode.Range16{Lo: 0x142, Hi: 0x142, Stride: 0x1}, - unicode.Range16{Lo: 0x144, Hi: 0x144, Stride: 0x1}, - unicode.Range16{Lo: 0x146, Hi: 0x146, Stride: 0x1}, - unicode.Range16{Lo: 0x148, Hi: 0x149, Stride: 0x1}, - unicode.Range16{Lo: 0x14b, Hi: 0x14b, Stride: 0x1}, - unicode.Range16{Lo: 0x14d, Hi: 0x14d, Stride: 0x1}, - unicode.Range16{Lo: 0x14f, Hi: 0x14f, Stride: 0x1}, - unicode.Range16{Lo: 0x151, Hi: 0x151, Stride: 0x1}, - unicode.Range16{Lo: 0x153, Hi: 0x153, Stride: 0x1}, - unicode.Range16{Lo: 0x155, Hi: 0x155, Stride: 0x1}, - unicode.Range16{Lo: 0x157, Hi: 0x157, Stride: 0x1}, - unicode.Range16{Lo: 0x159, Hi: 0x159, Stride: 0x1}, - unicode.Range16{Lo: 0x15b, Hi: 0x15b, Stride: 0x1}, - unicode.Range16{Lo: 0x15d, Hi: 0x15d, Stride: 0x1}, - unicode.Range16{Lo: 0x15f, Hi: 0x15f, Stride: 0x1}, - unicode.Range16{Lo: 0x161, Hi: 0x161, Stride: 0x1}, - unicode.Range16{Lo: 0x163, Hi: 0x163, Stride: 0x1}, - unicode.Range16{Lo: 0x165, Hi: 0x165, Stride: 0x1}, - unicode.Range16{Lo: 0x167, Hi: 0x167, Stride: 0x1}, - unicode.Range16{Lo: 0x169, Hi: 0x169, Stride: 0x1}, - unicode.Range16{Lo: 0x16b, Hi: 0x16b, Stride: 0x1}, - unicode.Range16{Lo: 0x16d, Hi: 0x16d, Stride: 0x1}, - unicode.Range16{Lo: 0x16f, Hi: 0x16f, Stride: 0x1}, - unicode.Range16{Lo: 0x171, Hi: 0x171, Stride: 0x1}, - unicode.Range16{Lo: 0x173, Hi: 0x173, Stride: 0x1}, - unicode.Range16{Lo: 0x175, Hi: 0x175, Stride: 0x1}, - unicode.Range16{Lo: 0x177, Hi: 0x177, Stride: 0x1}, - unicode.Range16{Lo: 0x17a, Hi: 0x17a, Stride: 0x1}, - unicode.Range16{Lo: 0x17c, Hi: 0x17c, Stride: 0x1}, - unicode.Range16{Lo: 0x17e, Hi: 0x180, Stride: 0x1}, - unicode.Range16{Lo: 0x183, Hi: 0x183, Stride: 0x1}, - unicode.Range16{Lo: 0x185, Hi: 0x185, Stride: 0x1}, - unicode.Range16{Lo: 0x188, Hi: 0x188, Stride: 0x1}, - unicode.Range16{Lo: 0x18c, Hi: 0x18d, Stride: 0x1}, - unicode.Range16{Lo: 0x192, Hi: 0x192, Stride: 0x1}, - unicode.Range16{Lo: 0x195, Hi: 0x195, Stride: 0x1}, - unicode.Range16{Lo: 0x199, Hi: 0x19b, Stride: 0x1}, - unicode.Range16{Lo: 0x19e, Hi: 0x19e, Stride: 0x1}, - unicode.Range16{Lo: 0x1a1, Hi: 0x1a1, Stride: 0x1}, - unicode.Range16{Lo: 0x1a3, Hi: 0x1a3, Stride: 0x1}, - unicode.Range16{Lo: 0x1a5, Hi: 0x1a5, Stride: 0x1}, - unicode.Range16{Lo: 0x1a8, Hi: 0x1a8, Stride: 0x1}, - unicode.Range16{Lo: 0x1aa, Hi: 0x1ab, Stride: 0x1}, - unicode.Range16{Lo: 0x1ad, Hi: 0x1ad, Stride: 0x1}, - unicode.Range16{Lo: 0x1b0, Hi: 0x1b0, Stride: 0x1}, - unicode.Range16{Lo: 0x1b4, Hi: 0x1b4, Stride: 0x1}, - unicode.Range16{Lo: 0x1b6, Hi: 0x1b6, Stride: 0x1}, - unicode.Range16{Lo: 0x1b9, Hi: 0x1ba, Stride: 0x1}, - unicode.Range16{Lo: 0x1bd, Hi: 0x1bf, Stride: 0x1}, - unicode.Range16{Lo: 0x1c6, Hi: 0x1c6, Stride: 0x1}, - unicode.Range16{Lo: 0x1c9, Hi: 0x1c9, Stride: 0x1}, - unicode.Range16{Lo: 0x1cc, Hi: 0x1cc, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce, Hi: 0x1ce, Stride: 0x1}, - unicode.Range16{Lo: 0x1d0, Hi: 0x1d0, Stride: 0x1}, - unicode.Range16{Lo: 0x1d2, Hi: 0x1d2, Stride: 0x1}, - unicode.Range16{Lo: 0x1d4, Hi: 0x1d4, Stride: 0x1}, - unicode.Range16{Lo: 0x1d6, Hi: 0x1d6, Stride: 0x1}, - unicode.Range16{Lo: 0x1d8, Hi: 0x1d8, Stride: 0x1}, - unicode.Range16{Lo: 0x1da, Hi: 0x1da, Stride: 0x1}, - unicode.Range16{Lo: 0x1dc, Hi: 0x1dd, Stride: 0x1}, - unicode.Range16{Lo: 0x1df, Hi: 0x1df, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1, Hi: 0x1e1, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3, Hi: 0x1e3, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5, Hi: 0x1e5, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7, Hi: 0x1e7, Stride: 0x1}, - unicode.Range16{Lo: 0x1e9, Hi: 0x1e9, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb, Hi: 0x1eb, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed, Hi: 0x1ed, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef, Hi: 0x1f0, Stride: 0x1}, - unicode.Range16{Lo: 0x1f3, Hi: 0x1f3, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5, Hi: 0x1f5, Stride: 0x1}, - unicode.Range16{Lo: 0x1f9, Hi: 0x1f9, Stride: 0x1}, - unicode.Range16{Lo: 0x1fb, Hi: 0x1fb, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd, Hi: 0x1fd, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff, Hi: 0x1ff, Stride: 0x1}, - unicode.Range16{Lo: 0x201, Hi: 0x201, Stride: 0x1}, - unicode.Range16{Lo: 0x203, Hi: 0x203, Stride: 0x1}, - unicode.Range16{Lo: 0x205, Hi: 0x205, Stride: 0x1}, - unicode.Range16{Lo: 0x207, Hi: 0x207, Stride: 0x1}, - unicode.Range16{Lo: 0x209, Hi: 0x209, Stride: 0x1}, - unicode.Range16{Lo: 0x20b, Hi: 0x20b, Stride: 0x1}, - unicode.Range16{Lo: 0x20d, Hi: 0x20d, Stride: 0x1}, - unicode.Range16{Lo: 0x20f, Hi: 0x20f, Stride: 0x1}, - unicode.Range16{Lo: 0x211, Hi: 0x211, Stride: 0x1}, - unicode.Range16{Lo: 0x213, Hi: 0x213, Stride: 0x1}, - unicode.Range16{Lo: 0x215, Hi: 0x215, Stride: 0x1}, - unicode.Range16{Lo: 0x217, Hi: 0x217, Stride: 0x1}, - unicode.Range16{Lo: 0x219, Hi: 0x219, Stride: 0x1}, - unicode.Range16{Lo: 0x21b, Hi: 0x21b, Stride: 0x1}, - unicode.Range16{Lo: 0x21d, Hi: 0x21d, Stride: 0x1}, - unicode.Range16{Lo: 0x21f, Hi: 0x21f, Stride: 0x1}, - unicode.Range16{Lo: 0x221, Hi: 0x221, Stride: 0x1}, - unicode.Range16{Lo: 0x223, Hi: 0x223, Stride: 0x1}, - unicode.Range16{Lo: 0x225, Hi: 0x225, Stride: 0x1}, - unicode.Range16{Lo: 0x227, Hi: 0x227, Stride: 0x1}, - unicode.Range16{Lo: 0x229, Hi: 0x229, Stride: 0x1}, - unicode.Range16{Lo: 0x22b, Hi: 0x22b, Stride: 0x1}, - unicode.Range16{Lo: 0x22d, Hi: 0x22d, Stride: 0x1}, - unicode.Range16{Lo: 0x22f, Hi: 0x22f, Stride: 0x1}, - unicode.Range16{Lo: 0x231, Hi: 0x231, Stride: 0x1}, - unicode.Range16{Lo: 0x233, Hi: 0x239, Stride: 0x1}, - unicode.Range16{Lo: 0x23c, Hi: 0x23c, Stride: 0x1}, - unicode.Range16{Lo: 0x23f, Hi: 0x240, Stride: 0x1}, - unicode.Range16{Lo: 0x242, Hi: 0x242, Stride: 0x1}, - unicode.Range16{Lo: 0x247, Hi: 0x247, Stride: 0x1}, - unicode.Range16{Lo: 0x249, Hi: 0x249, Stride: 0x1}, - unicode.Range16{Lo: 0x24b, Hi: 0x24b, Stride: 0x1}, - unicode.Range16{Lo: 0x24d, Hi: 0x24d, Stride: 0x1}, - unicode.Range16{Lo: 0x24f, Hi: 0x293, Stride: 0x1}, - unicode.Range16{Lo: 0x295, Hi: 0x2af, Stride: 0x1}, - unicode.Range16{Lo: 0x2b0, Hi: 0x2b8, Stride: 0x1}, - unicode.Range16{Lo: 0x2c0, Hi: 0x2c1, Stride: 0x1}, - unicode.Range16{Lo: 0x2e0, Hi: 0x2e4, Stride: 0x1}, - unicode.Range16{Lo: 0x371, Hi: 0x371, Stride: 0x1}, - unicode.Range16{Lo: 0x373, Hi: 0x373, Stride: 0x1}, - unicode.Range16{Lo: 0x377, Hi: 0x377, Stride: 0x1}, - unicode.Range16{Lo: 0x37a, Hi: 0x37a, Stride: 0x1}, - unicode.Range16{Lo: 0x37b, Hi: 0x37d, Stride: 0x1}, - unicode.Range16{Lo: 0x390, Hi: 0x390, Stride: 0x1}, - unicode.Range16{Lo: 0x3ac, Hi: 0x3ce, Stride: 0x1}, - unicode.Range16{Lo: 0x3d0, Hi: 0x3d1, Stride: 0x1}, - unicode.Range16{Lo: 0x3d5, Hi: 0x3d7, Stride: 0x1}, - unicode.Range16{Lo: 0x3d9, Hi: 0x3d9, Stride: 0x1}, - unicode.Range16{Lo: 0x3db, Hi: 0x3db, Stride: 0x1}, - unicode.Range16{Lo: 0x3dd, Hi: 0x3dd, Stride: 0x1}, - unicode.Range16{Lo: 0x3df, Hi: 0x3df, Stride: 0x1}, - unicode.Range16{Lo: 0x3e1, Hi: 0x3e1, Stride: 0x1}, - unicode.Range16{Lo: 0x3e3, Hi: 0x3e3, Stride: 0x1}, - unicode.Range16{Lo: 0x3e5, Hi: 0x3e5, Stride: 0x1}, - unicode.Range16{Lo: 0x3e7, Hi: 0x3e7, Stride: 0x1}, - unicode.Range16{Lo: 0x3e9, Hi: 0x3e9, Stride: 0x1}, - unicode.Range16{Lo: 0x3eb, Hi: 0x3eb, Stride: 0x1}, - unicode.Range16{Lo: 0x3ed, Hi: 0x3ed, Stride: 0x1}, - unicode.Range16{Lo: 0x3ef, Hi: 0x3f3, Stride: 0x1}, - unicode.Range16{Lo: 0x3f5, Hi: 0x3f5, Stride: 0x1}, - unicode.Range16{Lo: 0x3f8, Hi: 0x3f8, Stride: 0x1}, - unicode.Range16{Lo: 0x3fb, Hi: 0x3fc, Stride: 0x1}, - unicode.Range16{Lo: 0x430, Hi: 0x45f, Stride: 0x1}, - unicode.Range16{Lo: 0x461, Hi: 0x461, Stride: 0x1}, - unicode.Range16{Lo: 0x463, Hi: 0x463, Stride: 0x1}, - unicode.Range16{Lo: 0x465, Hi: 0x465, Stride: 0x1}, - unicode.Range16{Lo: 0x467, Hi: 0x467, Stride: 0x1}, - unicode.Range16{Lo: 0x469, Hi: 0x469, Stride: 0x1}, - unicode.Range16{Lo: 0x46b, Hi: 0x46b, Stride: 0x1}, - unicode.Range16{Lo: 0x46d, Hi: 0x46d, Stride: 0x1}, - unicode.Range16{Lo: 0x46f, Hi: 0x46f, Stride: 0x1}, - unicode.Range16{Lo: 0x471, Hi: 0x471, Stride: 0x1}, - unicode.Range16{Lo: 0x473, Hi: 0x473, Stride: 0x1}, - unicode.Range16{Lo: 0x475, Hi: 0x475, Stride: 0x1}, - unicode.Range16{Lo: 0x477, Hi: 0x477, Stride: 0x1}, - unicode.Range16{Lo: 0x479, Hi: 0x479, Stride: 0x1}, - unicode.Range16{Lo: 0x47b, Hi: 0x47b, Stride: 0x1}, - unicode.Range16{Lo: 0x47d, Hi: 0x47d, Stride: 0x1}, - unicode.Range16{Lo: 0x47f, Hi: 0x47f, Stride: 0x1}, - unicode.Range16{Lo: 0x481, Hi: 0x481, Stride: 0x1}, - unicode.Range16{Lo: 0x48b, Hi: 0x48b, Stride: 0x1}, - unicode.Range16{Lo: 0x48d, Hi: 0x48d, Stride: 0x1}, - unicode.Range16{Lo: 0x48f, Hi: 0x48f, Stride: 0x1}, - unicode.Range16{Lo: 0x491, Hi: 0x491, Stride: 0x1}, - unicode.Range16{Lo: 0x493, Hi: 0x493, Stride: 0x1}, - unicode.Range16{Lo: 0x495, Hi: 0x495, Stride: 0x1}, - unicode.Range16{Lo: 0x497, Hi: 0x497, Stride: 0x1}, - unicode.Range16{Lo: 0x499, Hi: 0x499, Stride: 0x1}, - unicode.Range16{Lo: 0x49b, Hi: 0x49b, Stride: 0x1}, - unicode.Range16{Lo: 0x49d, Hi: 0x49d, Stride: 0x1}, - unicode.Range16{Lo: 0x49f, Hi: 0x49f, Stride: 0x1}, - unicode.Range16{Lo: 0x4a1, Hi: 0x4a1, Stride: 0x1}, - unicode.Range16{Lo: 0x4a3, Hi: 0x4a3, Stride: 0x1}, - unicode.Range16{Lo: 0x4a5, Hi: 0x4a5, Stride: 0x1}, - unicode.Range16{Lo: 0x4a7, Hi: 0x4a7, Stride: 0x1}, - unicode.Range16{Lo: 0x4a9, Hi: 0x4a9, Stride: 0x1}, - unicode.Range16{Lo: 0x4ab, Hi: 0x4ab, Stride: 0x1}, - unicode.Range16{Lo: 0x4ad, Hi: 0x4ad, Stride: 0x1}, - unicode.Range16{Lo: 0x4af, Hi: 0x4af, Stride: 0x1}, - unicode.Range16{Lo: 0x4b1, Hi: 0x4b1, Stride: 0x1}, - unicode.Range16{Lo: 0x4b3, Hi: 0x4b3, Stride: 0x1}, - unicode.Range16{Lo: 0x4b5, Hi: 0x4b5, Stride: 0x1}, - unicode.Range16{Lo: 0x4b7, Hi: 0x4b7, Stride: 0x1}, - unicode.Range16{Lo: 0x4b9, Hi: 0x4b9, Stride: 0x1}, - unicode.Range16{Lo: 0x4bb, Hi: 0x4bb, Stride: 0x1}, - unicode.Range16{Lo: 0x4bd, Hi: 0x4bd, Stride: 0x1}, - unicode.Range16{Lo: 0x4bf, Hi: 0x4bf, Stride: 0x1}, - unicode.Range16{Lo: 0x4c2, Hi: 0x4c2, Stride: 0x1}, - unicode.Range16{Lo: 0x4c4, Hi: 0x4c4, Stride: 0x1}, - unicode.Range16{Lo: 0x4c6, Hi: 0x4c6, Stride: 0x1}, - unicode.Range16{Lo: 0x4c8, Hi: 0x4c8, Stride: 0x1}, - unicode.Range16{Lo: 0x4ca, Hi: 0x4ca, Stride: 0x1}, - unicode.Range16{Lo: 0x4cc, Hi: 0x4cc, Stride: 0x1}, - unicode.Range16{Lo: 0x4ce, Hi: 0x4cf, Stride: 0x1}, - unicode.Range16{Lo: 0x4d1, Hi: 0x4d1, Stride: 0x1}, - unicode.Range16{Lo: 0x4d3, Hi: 0x4d3, Stride: 0x1}, - unicode.Range16{Lo: 0x4d5, Hi: 0x4d5, Stride: 0x1}, - unicode.Range16{Lo: 0x4d7, Hi: 0x4d7, Stride: 0x1}, - unicode.Range16{Lo: 0x4d9, Hi: 0x4d9, Stride: 0x1}, - unicode.Range16{Lo: 0x4db, Hi: 0x4db, Stride: 0x1}, - unicode.Range16{Lo: 0x4dd, Hi: 0x4dd, Stride: 0x1}, - unicode.Range16{Lo: 0x4df, Hi: 0x4df, Stride: 0x1}, - unicode.Range16{Lo: 0x4e1, Hi: 0x4e1, Stride: 0x1}, - unicode.Range16{Lo: 0x4e3, Hi: 0x4e3, Stride: 0x1}, - unicode.Range16{Lo: 0x4e5, Hi: 0x4e5, Stride: 0x1}, - unicode.Range16{Lo: 0x4e7, Hi: 0x4e7, Stride: 0x1}, - unicode.Range16{Lo: 0x4e9, Hi: 0x4e9, Stride: 0x1}, - unicode.Range16{Lo: 0x4eb, Hi: 0x4eb, Stride: 0x1}, - unicode.Range16{Lo: 0x4ed, Hi: 0x4ed, Stride: 0x1}, - unicode.Range16{Lo: 0x4ef, Hi: 0x4ef, Stride: 0x1}, - unicode.Range16{Lo: 0x4f1, Hi: 0x4f1, Stride: 0x1}, - unicode.Range16{Lo: 0x4f3, Hi: 0x4f3, Stride: 0x1}, - unicode.Range16{Lo: 0x4f5, Hi: 0x4f5, Stride: 0x1}, - unicode.Range16{Lo: 0x4f7, Hi: 0x4f7, Stride: 0x1}, - unicode.Range16{Lo: 0x4f9, Hi: 0x4f9, Stride: 0x1}, - unicode.Range16{Lo: 0x4fb, Hi: 0x4fb, Stride: 0x1}, - unicode.Range16{Lo: 0x4fd, Hi: 0x4fd, Stride: 0x1}, - unicode.Range16{Lo: 0x4ff, Hi: 0x4ff, Stride: 0x1}, - unicode.Range16{Lo: 0x501, Hi: 0x501, Stride: 0x1}, - unicode.Range16{Lo: 0x503, Hi: 0x503, Stride: 0x1}, - unicode.Range16{Lo: 0x505, Hi: 0x505, Stride: 0x1}, - unicode.Range16{Lo: 0x507, Hi: 0x507, Stride: 0x1}, - unicode.Range16{Lo: 0x509, Hi: 0x509, Stride: 0x1}, - unicode.Range16{Lo: 0x50b, Hi: 0x50b, Stride: 0x1}, - unicode.Range16{Lo: 0x50d, Hi: 0x50d, Stride: 0x1}, - unicode.Range16{Lo: 0x50f, Hi: 0x50f, Stride: 0x1}, - unicode.Range16{Lo: 0x511, Hi: 0x511, Stride: 0x1}, - unicode.Range16{Lo: 0x513, Hi: 0x513, Stride: 0x1}, - unicode.Range16{Lo: 0x515, Hi: 0x515, Stride: 0x1}, - unicode.Range16{Lo: 0x517, Hi: 0x517, Stride: 0x1}, - unicode.Range16{Lo: 0x519, Hi: 0x519, Stride: 0x1}, - unicode.Range16{Lo: 0x51b, Hi: 0x51b, Stride: 0x1}, - unicode.Range16{Lo: 0x51d, Hi: 0x51d, Stride: 0x1}, - unicode.Range16{Lo: 0x51f, Hi: 0x51f, Stride: 0x1}, - unicode.Range16{Lo: 0x521, Hi: 0x521, Stride: 0x1}, - unicode.Range16{Lo: 0x523, Hi: 0x523, Stride: 0x1}, - unicode.Range16{Lo: 0x525, Hi: 0x525, Stride: 0x1}, - unicode.Range16{Lo: 0x527, Hi: 0x527, Stride: 0x1}, - unicode.Range16{Lo: 0x529, Hi: 0x529, Stride: 0x1}, - unicode.Range16{Lo: 0x52b, Hi: 0x52b, Stride: 0x1}, - unicode.Range16{Lo: 0x52d, Hi: 0x52d, Stride: 0x1}, - unicode.Range16{Lo: 0x52f, Hi: 0x52f, Stride: 0x1}, - unicode.Range16{Lo: 0x561, Hi: 0x587, Stride: 0x1}, - unicode.Range16{Lo: 0x13f8, Hi: 0x13fd, Stride: 0x1}, - unicode.Range16{Lo: 0x1c80, Hi: 0x1c88, Stride: 0x1}, - unicode.Range16{Lo: 0x1d00, Hi: 0x1d2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1d2c, Hi: 0x1d6a, Stride: 0x1}, - unicode.Range16{Lo: 0x1d6b, Hi: 0x1d77, Stride: 0x1}, - unicode.Range16{Lo: 0x1d78, Hi: 0x1d78, Stride: 0x1}, - unicode.Range16{Lo: 0x1d79, Hi: 0x1d9a, Stride: 0x1}, - unicode.Range16{Lo: 0x1d9b, Hi: 0x1dbf, Stride: 0x1}, - unicode.Range16{Lo: 0x1e01, Hi: 0x1e01, Stride: 0x1}, - unicode.Range16{Lo: 0x1e03, Hi: 0x1e03, Stride: 0x1}, - unicode.Range16{Lo: 0x1e05, Hi: 0x1e05, Stride: 0x1}, - unicode.Range16{Lo: 0x1e07, Hi: 0x1e07, Stride: 0x1}, - unicode.Range16{Lo: 0x1e09, Hi: 0x1e09, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0b, Hi: 0x1e0b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0d, Hi: 0x1e0d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0f, Hi: 0x1e0f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e11, Hi: 0x1e11, Stride: 0x1}, - unicode.Range16{Lo: 0x1e13, Hi: 0x1e13, Stride: 0x1}, - unicode.Range16{Lo: 0x1e15, Hi: 0x1e15, Stride: 0x1}, - unicode.Range16{Lo: 0x1e17, Hi: 0x1e17, Stride: 0x1}, - unicode.Range16{Lo: 0x1e19, Hi: 0x1e19, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1b, Hi: 0x1e1b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1d, Hi: 0x1e1d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1f, Hi: 0x1e1f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e21, Hi: 0x1e21, Stride: 0x1}, - unicode.Range16{Lo: 0x1e23, Hi: 0x1e23, Stride: 0x1}, - unicode.Range16{Lo: 0x1e25, Hi: 0x1e25, Stride: 0x1}, - unicode.Range16{Lo: 0x1e27, Hi: 0x1e27, Stride: 0x1}, - unicode.Range16{Lo: 0x1e29, Hi: 0x1e29, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2b, Hi: 0x1e2b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2d, Hi: 0x1e2d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2f, Hi: 0x1e2f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e31, Hi: 0x1e31, Stride: 0x1}, - unicode.Range16{Lo: 0x1e33, Hi: 0x1e33, Stride: 0x1}, - unicode.Range16{Lo: 0x1e35, Hi: 0x1e35, Stride: 0x1}, - unicode.Range16{Lo: 0x1e37, Hi: 0x1e37, Stride: 0x1}, - unicode.Range16{Lo: 0x1e39, Hi: 0x1e39, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3b, Hi: 0x1e3b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3d, Hi: 0x1e3d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3f, Hi: 0x1e3f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e41, Hi: 0x1e41, Stride: 0x1}, - unicode.Range16{Lo: 0x1e43, Hi: 0x1e43, Stride: 0x1}, - unicode.Range16{Lo: 0x1e45, Hi: 0x1e45, Stride: 0x1}, - unicode.Range16{Lo: 0x1e47, Hi: 0x1e47, Stride: 0x1}, - unicode.Range16{Lo: 0x1e49, Hi: 0x1e49, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4b, Hi: 0x1e4b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4d, Hi: 0x1e4d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4f, Hi: 0x1e4f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e51, Hi: 0x1e51, Stride: 0x1}, - unicode.Range16{Lo: 0x1e53, Hi: 0x1e53, Stride: 0x1}, - unicode.Range16{Lo: 0x1e55, Hi: 0x1e55, Stride: 0x1}, - unicode.Range16{Lo: 0x1e57, Hi: 0x1e57, Stride: 0x1}, - unicode.Range16{Lo: 0x1e59, Hi: 0x1e59, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5b, Hi: 0x1e5b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5d, Hi: 0x1e5d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5f, Hi: 0x1e5f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e61, Hi: 0x1e61, Stride: 0x1}, - unicode.Range16{Lo: 0x1e63, Hi: 0x1e63, Stride: 0x1}, - unicode.Range16{Lo: 0x1e65, Hi: 0x1e65, Stride: 0x1}, - unicode.Range16{Lo: 0x1e67, Hi: 0x1e67, Stride: 0x1}, - unicode.Range16{Lo: 0x1e69, Hi: 0x1e69, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6b, Hi: 0x1e6b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6d, Hi: 0x1e6d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6f, Hi: 0x1e6f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e71, Hi: 0x1e71, Stride: 0x1}, - unicode.Range16{Lo: 0x1e73, Hi: 0x1e73, Stride: 0x1}, - unicode.Range16{Lo: 0x1e75, Hi: 0x1e75, Stride: 0x1}, - unicode.Range16{Lo: 0x1e77, Hi: 0x1e77, Stride: 0x1}, - unicode.Range16{Lo: 0x1e79, Hi: 0x1e79, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7b, Hi: 0x1e7b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7d, Hi: 0x1e7d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7f, Hi: 0x1e7f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e81, Hi: 0x1e81, Stride: 0x1}, - unicode.Range16{Lo: 0x1e83, Hi: 0x1e83, Stride: 0x1}, - unicode.Range16{Lo: 0x1e85, Hi: 0x1e85, Stride: 0x1}, - unicode.Range16{Lo: 0x1e87, Hi: 0x1e87, Stride: 0x1}, - unicode.Range16{Lo: 0x1e89, Hi: 0x1e89, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8b, Hi: 0x1e8b, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8d, Hi: 0x1e8d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8f, Hi: 0x1e8f, Stride: 0x1}, - unicode.Range16{Lo: 0x1e91, Hi: 0x1e91, Stride: 0x1}, - unicode.Range16{Lo: 0x1e93, Hi: 0x1e93, Stride: 0x1}, - unicode.Range16{Lo: 0x1e95, Hi: 0x1e9d, Stride: 0x1}, - unicode.Range16{Lo: 0x1e9f, Hi: 0x1e9f, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea1, Hi: 0x1ea1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea3, Hi: 0x1ea3, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea5, Hi: 0x1ea5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea7, Hi: 0x1ea7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea9, Hi: 0x1ea9, Stride: 0x1}, - unicode.Range16{Lo: 0x1eab, Hi: 0x1eab, Stride: 0x1}, - unicode.Range16{Lo: 0x1ead, Hi: 0x1ead, Stride: 0x1}, - unicode.Range16{Lo: 0x1eaf, Hi: 0x1eaf, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb1, Hi: 0x1eb1, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb3, Hi: 0x1eb3, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb5, Hi: 0x1eb5, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb7, Hi: 0x1eb7, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb9, Hi: 0x1eb9, Stride: 0x1}, - unicode.Range16{Lo: 0x1ebb, Hi: 0x1ebb, Stride: 0x1}, - unicode.Range16{Lo: 0x1ebd, Hi: 0x1ebd, Stride: 0x1}, - unicode.Range16{Lo: 0x1ebf, Hi: 0x1ebf, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec1, Hi: 0x1ec1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec3, Hi: 0x1ec3, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec5, Hi: 0x1ec5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec7, Hi: 0x1ec7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec9, Hi: 0x1ec9, Stride: 0x1}, - unicode.Range16{Lo: 0x1ecb, Hi: 0x1ecb, Stride: 0x1}, - unicode.Range16{Lo: 0x1ecd, Hi: 0x1ecd, Stride: 0x1}, - unicode.Range16{Lo: 0x1ecf, Hi: 0x1ecf, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed1, Hi: 0x1ed1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed3, Hi: 0x1ed3, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed5, Hi: 0x1ed5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed7, Hi: 0x1ed7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed9, Hi: 0x1ed9, Stride: 0x1}, - unicode.Range16{Lo: 0x1edb, Hi: 0x1edb, Stride: 0x1}, - unicode.Range16{Lo: 0x1edd, Hi: 0x1edd, Stride: 0x1}, - unicode.Range16{Lo: 0x1edf, Hi: 0x1edf, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee1, Hi: 0x1ee1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee3, Hi: 0x1ee3, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee5, Hi: 0x1ee5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee7, Hi: 0x1ee7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee9, Hi: 0x1ee9, Stride: 0x1}, - unicode.Range16{Lo: 0x1eeb, Hi: 0x1eeb, Stride: 0x1}, - unicode.Range16{Lo: 0x1eed, Hi: 0x1eed, Stride: 0x1}, - unicode.Range16{Lo: 0x1eef, Hi: 0x1eef, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef1, Hi: 0x1ef1, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef3, Hi: 0x1ef3, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef5, Hi: 0x1ef5, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef7, Hi: 0x1ef7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef9, Hi: 0x1ef9, Stride: 0x1}, - unicode.Range16{Lo: 0x1efb, Hi: 0x1efb, Stride: 0x1}, - unicode.Range16{Lo: 0x1efd, Hi: 0x1efd, Stride: 0x1}, - unicode.Range16{Lo: 0x1eff, Hi: 0x1f07, Stride: 0x1}, - unicode.Range16{Lo: 0x1f10, Hi: 0x1f15, Stride: 0x1}, - unicode.Range16{Lo: 0x1f20, Hi: 0x1f27, Stride: 0x1}, - unicode.Range16{Lo: 0x1f30, Hi: 0x1f37, Stride: 0x1}, - unicode.Range16{Lo: 0x1f40, Hi: 0x1f45, Stride: 0x1}, - unicode.Range16{Lo: 0x1f50, Hi: 0x1f57, Stride: 0x1}, - unicode.Range16{Lo: 0x1f60, Hi: 0x1f67, Stride: 0x1}, - unicode.Range16{Lo: 0x1f70, Hi: 0x1f7d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f80, Hi: 0x1f87, Stride: 0x1}, - unicode.Range16{Lo: 0x1f90, Hi: 0x1f97, Stride: 0x1}, - unicode.Range16{Lo: 0x1fa0, Hi: 0x1fa7, Stride: 0x1}, - unicode.Range16{Lo: 0x1fb0, Hi: 0x1fb4, Stride: 0x1}, - unicode.Range16{Lo: 0x1fb6, Hi: 0x1fb7, Stride: 0x1}, - unicode.Range16{Lo: 0x1fbe, Hi: 0x1fbe, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc2, Hi: 0x1fc4, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc6, Hi: 0x1fc7, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd0, Hi: 0x1fd3, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd6, Hi: 0x1fd7, Stride: 0x1}, - unicode.Range16{Lo: 0x1fe0, Hi: 0x1fe7, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff2, Hi: 0x1ff4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff6, Hi: 0x1ff7, Stride: 0x1}, - unicode.Range16{Lo: 0x2071, Hi: 0x2071, Stride: 0x1}, - unicode.Range16{Lo: 0x207f, Hi: 0x207f, Stride: 0x1}, - unicode.Range16{Lo: 0x2090, Hi: 0x209c, Stride: 0x1}, - unicode.Range16{Lo: 0x210a, Hi: 0x210a, Stride: 0x1}, - unicode.Range16{Lo: 0x210e, Hi: 0x210f, Stride: 0x1}, - unicode.Range16{Lo: 0x2113, Hi: 0x2113, Stride: 0x1}, - unicode.Range16{Lo: 0x212f, Hi: 0x212f, Stride: 0x1}, - unicode.Range16{Lo: 0x2134, Hi: 0x2134, Stride: 0x1}, - unicode.Range16{Lo: 0x2139, Hi: 0x2139, Stride: 0x1}, - unicode.Range16{Lo: 0x213c, Hi: 0x213d, Stride: 0x1}, - unicode.Range16{Lo: 0x2146, Hi: 0x2149, Stride: 0x1}, - unicode.Range16{Lo: 0x214e, Hi: 0x214e, Stride: 0x1}, - unicode.Range16{Lo: 0x2170, Hi: 0x217f, Stride: 0x1}, - unicode.Range16{Lo: 0x2184, Hi: 0x2184, Stride: 0x1}, - unicode.Range16{Lo: 0x24d0, Hi: 0x24e9, Stride: 0x1}, - unicode.Range16{Lo: 0x2c30, Hi: 0x2c5e, Stride: 0x1}, - unicode.Range16{Lo: 0x2c61, Hi: 0x2c61, Stride: 0x1}, - unicode.Range16{Lo: 0x2c65, Hi: 0x2c66, Stride: 0x1}, - unicode.Range16{Lo: 0x2c68, Hi: 0x2c68, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6a, Hi: 0x2c6a, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6c, Hi: 0x2c6c, Stride: 0x1}, - unicode.Range16{Lo: 0x2c71, Hi: 0x2c71, Stride: 0x1}, - unicode.Range16{Lo: 0x2c73, Hi: 0x2c74, Stride: 0x1}, - unicode.Range16{Lo: 0x2c76, Hi: 0x2c7b, Stride: 0x1}, - unicode.Range16{Lo: 0x2c7c, Hi: 0x2c7d, Stride: 0x1}, - unicode.Range16{Lo: 0x2c81, Hi: 0x2c81, Stride: 0x1}, - unicode.Range16{Lo: 0x2c83, Hi: 0x2c83, Stride: 0x1}, - unicode.Range16{Lo: 0x2c85, Hi: 0x2c85, Stride: 0x1}, - unicode.Range16{Lo: 0x2c87, Hi: 0x2c87, Stride: 0x1}, - unicode.Range16{Lo: 0x2c89, Hi: 0x2c89, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8b, Hi: 0x2c8b, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8d, Hi: 0x2c8d, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8f, Hi: 0x2c8f, Stride: 0x1}, - unicode.Range16{Lo: 0x2c91, Hi: 0x2c91, Stride: 0x1}, - unicode.Range16{Lo: 0x2c93, Hi: 0x2c93, Stride: 0x1}, - unicode.Range16{Lo: 0x2c95, Hi: 0x2c95, Stride: 0x1}, - unicode.Range16{Lo: 0x2c97, Hi: 0x2c97, Stride: 0x1}, - unicode.Range16{Lo: 0x2c99, Hi: 0x2c99, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9b, Hi: 0x2c9b, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9d, Hi: 0x2c9d, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9f, Hi: 0x2c9f, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca1, Hi: 0x2ca1, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca3, Hi: 0x2ca3, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca5, Hi: 0x2ca5, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca7, Hi: 0x2ca7, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca9, Hi: 0x2ca9, Stride: 0x1}, - unicode.Range16{Lo: 0x2cab, Hi: 0x2cab, Stride: 0x1}, - unicode.Range16{Lo: 0x2cad, Hi: 0x2cad, Stride: 0x1}, - unicode.Range16{Lo: 0x2caf, Hi: 0x2caf, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb1, Hi: 0x2cb1, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb3, Hi: 0x2cb3, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb5, Hi: 0x2cb5, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb7, Hi: 0x2cb7, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb9, Hi: 0x2cb9, Stride: 0x1}, - unicode.Range16{Lo: 0x2cbb, Hi: 0x2cbb, Stride: 0x1}, - unicode.Range16{Lo: 0x2cbd, Hi: 0x2cbd, Stride: 0x1}, - unicode.Range16{Lo: 0x2cbf, Hi: 0x2cbf, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc1, Hi: 0x2cc1, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc3, Hi: 0x2cc3, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc5, Hi: 0x2cc5, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc7, Hi: 0x2cc7, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc9, Hi: 0x2cc9, Stride: 0x1}, - unicode.Range16{Lo: 0x2ccb, Hi: 0x2ccb, Stride: 0x1}, - unicode.Range16{Lo: 0x2ccd, Hi: 0x2ccd, Stride: 0x1}, - unicode.Range16{Lo: 0x2ccf, Hi: 0x2ccf, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd1, Hi: 0x2cd1, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd3, Hi: 0x2cd3, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd5, Hi: 0x2cd5, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd7, Hi: 0x2cd7, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd9, Hi: 0x2cd9, Stride: 0x1}, - unicode.Range16{Lo: 0x2cdb, Hi: 0x2cdb, Stride: 0x1}, - unicode.Range16{Lo: 0x2cdd, Hi: 0x2cdd, Stride: 0x1}, - unicode.Range16{Lo: 0x2cdf, Hi: 0x2cdf, Stride: 0x1}, - unicode.Range16{Lo: 0x2ce1, Hi: 0x2ce1, Stride: 0x1}, - unicode.Range16{Lo: 0x2ce3, Hi: 0x2ce4, Stride: 0x1}, - unicode.Range16{Lo: 0x2cec, Hi: 0x2cec, Stride: 0x1}, - unicode.Range16{Lo: 0x2cee, Hi: 0x2cee, Stride: 0x1}, - unicode.Range16{Lo: 0x2cf3, Hi: 0x2cf3, Stride: 0x1}, - unicode.Range16{Lo: 0x2d00, Hi: 0x2d25, Stride: 0x1}, - unicode.Range16{Lo: 0x2d27, Hi: 0x2d27, Stride: 0x1}, - unicode.Range16{Lo: 0x2d2d, Hi: 0x2d2d, Stride: 0x1}, - unicode.Range16{Lo: 0xa641, Hi: 0xa641, Stride: 0x1}, - unicode.Range16{Lo: 0xa643, Hi: 0xa643, Stride: 0x1}, - unicode.Range16{Lo: 0xa645, Hi: 0xa645, Stride: 0x1}, - unicode.Range16{Lo: 0xa647, Hi: 0xa647, Stride: 0x1}, - unicode.Range16{Lo: 0xa649, Hi: 0xa649, Stride: 0x1}, - unicode.Range16{Lo: 0xa64b, Hi: 0xa64b, Stride: 0x1}, - unicode.Range16{Lo: 0xa64d, Hi: 0xa64d, Stride: 0x1}, - unicode.Range16{Lo: 0xa64f, Hi: 0xa64f, Stride: 0x1}, - unicode.Range16{Lo: 0xa651, Hi: 0xa651, Stride: 0x1}, - unicode.Range16{Lo: 0xa653, Hi: 0xa653, Stride: 0x1}, - unicode.Range16{Lo: 0xa655, Hi: 0xa655, Stride: 0x1}, - unicode.Range16{Lo: 0xa657, Hi: 0xa657, Stride: 0x1}, - unicode.Range16{Lo: 0xa659, Hi: 0xa659, Stride: 0x1}, - unicode.Range16{Lo: 0xa65b, Hi: 0xa65b, Stride: 0x1}, - unicode.Range16{Lo: 0xa65d, Hi: 0xa65d, Stride: 0x1}, - unicode.Range16{Lo: 0xa65f, Hi: 0xa65f, Stride: 0x1}, - unicode.Range16{Lo: 0xa661, Hi: 0xa661, Stride: 0x1}, - unicode.Range16{Lo: 0xa663, Hi: 0xa663, Stride: 0x1}, - unicode.Range16{Lo: 0xa665, Hi: 0xa665, Stride: 0x1}, - unicode.Range16{Lo: 0xa667, Hi: 0xa667, Stride: 0x1}, - unicode.Range16{Lo: 0xa669, Hi: 0xa669, Stride: 0x1}, - unicode.Range16{Lo: 0xa66b, Hi: 0xa66b, Stride: 0x1}, - unicode.Range16{Lo: 0xa66d, Hi: 0xa66d, Stride: 0x1}, - unicode.Range16{Lo: 0xa681, Hi: 0xa681, Stride: 0x1}, - unicode.Range16{Lo: 0xa683, Hi: 0xa683, Stride: 0x1}, - unicode.Range16{Lo: 0xa685, Hi: 0xa685, Stride: 0x1}, - unicode.Range16{Lo: 0xa687, Hi: 0xa687, Stride: 0x1}, - unicode.Range16{Lo: 0xa689, Hi: 0xa689, Stride: 0x1}, - unicode.Range16{Lo: 0xa68b, Hi: 0xa68b, Stride: 0x1}, - unicode.Range16{Lo: 0xa68d, Hi: 0xa68d, Stride: 0x1}, - unicode.Range16{Lo: 0xa68f, Hi: 0xa68f, Stride: 0x1}, - unicode.Range16{Lo: 0xa691, Hi: 0xa691, Stride: 0x1}, - unicode.Range16{Lo: 0xa693, Hi: 0xa693, Stride: 0x1}, - unicode.Range16{Lo: 0xa695, Hi: 0xa695, Stride: 0x1}, - unicode.Range16{Lo: 0xa697, Hi: 0xa697, Stride: 0x1}, - unicode.Range16{Lo: 0xa699, Hi: 0xa699, Stride: 0x1}, - unicode.Range16{Lo: 0xa69b, Hi: 0xa69b, Stride: 0x1}, - unicode.Range16{Lo: 0xa69c, Hi: 0xa69d, Stride: 0x1}, - unicode.Range16{Lo: 0xa723, Hi: 0xa723, Stride: 0x1}, - unicode.Range16{Lo: 0xa725, Hi: 0xa725, Stride: 0x1}, - unicode.Range16{Lo: 0xa727, Hi: 0xa727, Stride: 0x1}, - unicode.Range16{Lo: 0xa729, Hi: 0xa729, Stride: 0x1}, - unicode.Range16{Lo: 0xa72b, Hi: 0xa72b, Stride: 0x1}, - unicode.Range16{Lo: 0xa72d, Hi: 0xa72d, Stride: 0x1}, - unicode.Range16{Lo: 0xa72f, Hi: 0xa731, Stride: 0x1}, - unicode.Range16{Lo: 0xa733, Hi: 0xa733, Stride: 0x1}, - unicode.Range16{Lo: 0xa735, Hi: 0xa735, Stride: 0x1}, - unicode.Range16{Lo: 0xa737, Hi: 0xa737, Stride: 0x1}, - unicode.Range16{Lo: 0xa739, Hi: 0xa739, Stride: 0x1}, - unicode.Range16{Lo: 0xa73b, Hi: 0xa73b, Stride: 0x1}, - unicode.Range16{Lo: 0xa73d, Hi: 0xa73d, Stride: 0x1}, - unicode.Range16{Lo: 0xa73f, Hi: 0xa73f, Stride: 0x1}, - unicode.Range16{Lo: 0xa741, Hi: 0xa741, Stride: 0x1}, - unicode.Range16{Lo: 0xa743, Hi: 0xa743, Stride: 0x1}, - unicode.Range16{Lo: 0xa745, Hi: 0xa745, Stride: 0x1}, - unicode.Range16{Lo: 0xa747, Hi: 0xa747, Stride: 0x1}, - unicode.Range16{Lo: 0xa749, Hi: 0xa749, Stride: 0x1}, - unicode.Range16{Lo: 0xa74b, Hi: 0xa74b, Stride: 0x1}, - unicode.Range16{Lo: 0xa74d, Hi: 0xa74d, Stride: 0x1}, - unicode.Range16{Lo: 0xa74f, Hi: 0xa74f, Stride: 0x1}, - unicode.Range16{Lo: 0xa751, Hi: 0xa751, Stride: 0x1}, - unicode.Range16{Lo: 0xa753, Hi: 0xa753, Stride: 0x1}, - unicode.Range16{Lo: 0xa755, Hi: 0xa755, Stride: 0x1}, - unicode.Range16{Lo: 0xa757, Hi: 0xa757, Stride: 0x1}, - unicode.Range16{Lo: 0xa759, Hi: 0xa759, Stride: 0x1}, - unicode.Range16{Lo: 0xa75b, Hi: 0xa75b, Stride: 0x1}, - unicode.Range16{Lo: 0xa75d, Hi: 0xa75d, Stride: 0x1}, - unicode.Range16{Lo: 0xa75f, Hi: 0xa75f, Stride: 0x1}, - unicode.Range16{Lo: 0xa761, Hi: 0xa761, Stride: 0x1}, - unicode.Range16{Lo: 0xa763, Hi: 0xa763, Stride: 0x1}, - unicode.Range16{Lo: 0xa765, Hi: 0xa765, Stride: 0x1}, - unicode.Range16{Lo: 0xa767, Hi: 0xa767, Stride: 0x1}, - unicode.Range16{Lo: 0xa769, Hi: 0xa769, Stride: 0x1}, - unicode.Range16{Lo: 0xa76b, Hi: 0xa76b, Stride: 0x1}, - unicode.Range16{Lo: 0xa76d, Hi: 0xa76d, Stride: 0x1}, - unicode.Range16{Lo: 0xa76f, Hi: 0xa76f, Stride: 0x1}, - unicode.Range16{Lo: 0xa770, Hi: 0xa770, Stride: 0x1}, - unicode.Range16{Lo: 0xa771, Hi: 0xa778, Stride: 0x1}, - unicode.Range16{Lo: 0xa77a, Hi: 0xa77a, Stride: 0x1}, - unicode.Range16{Lo: 0xa77c, Hi: 0xa77c, Stride: 0x1}, - unicode.Range16{Lo: 0xa77f, Hi: 0xa77f, Stride: 0x1}, - unicode.Range16{Lo: 0xa781, Hi: 0xa781, Stride: 0x1}, - unicode.Range16{Lo: 0xa783, Hi: 0xa783, Stride: 0x1}, - unicode.Range16{Lo: 0xa785, Hi: 0xa785, Stride: 0x1}, - unicode.Range16{Lo: 0xa787, Hi: 0xa787, Stride: 0x1}, - unicode.Range16{Lo: 0xa78c, Hi: 0xa78c, Stride: 0x1}, - unicode.Range16{Lo: 0xa78e, Hi: 0xa78e, Stride: 0x1}, - unicode.Range16{Lo: 0xa791, Hi: 0xa791, Stride: 0x1}, - unicode.Range16{Lo: 0xa793, Hi: 0xa795, Stride: 0x1}, - unicode.Range16{Lo: 0xa797, Hi: 0xa797, Stride: 0x1}, - unicode.Range16{Lo: 0xa799, Hi: 0xa799, Stride: 0x1}, - unicode.Range16{Lo: 0xa79b, Hi: 0xa79b, Stride: 0x1}, - unicode.Range16{Lo: 0xa79d, Hi: 0xa79d, Stride: 0x1}, - unicode.Range16{Lo: 0xa79f, Hi: 0xa79f, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a1, Hi: 0xa7a1, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a3, Hi: 0xa7a3, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a5, Hi: 0xa7a5, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a7, Hi: 0xa7a7, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a9, Hi: 0xa7a9, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b5, Hi: 0xa7b5, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b7, Hi: 0xa7b7, Stride: 0x1}, - unicode.Range16{Lo: 0xa7f8, Hi: 0xa7f9, Stride: 0x1}, - unicode.Range16{Lo: 0xa7fa, Hi: 0xa7fa, Stride: 0x1}, - unicode.Range16{Lo: 0xab30, Hi: 0xab5a, Stride: 0x1}, - unicode.Range16{Lo: 0xab5c, Hi: 0xab5f, Stride: 0x1}, - unicode.Range16{Lo: 0xab60, Hi: 0xab65, Stride: 0x1}, - unicode.Range16{Lo: 0xab70, Hi: 0xabbf, Stride: 0x1}, - unicode.Range16{Lo: 0xfb00, Hi: 0xfb06, Stride: 0x1}, - unicode.Range16{Lo: 0xfb13, Hi: 0xfb17, Stride: 0x1}, - unicode.Range16{Lo: 0xff41, Hi: 0xff5a, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x10428, Hi: 0x1044f, Stride: 0x1}, - unicode.Range32{Lo: 0x104d8, Hi: 0x104fb, Stride: 0x1}, - unicode.Range32{Lo: 0x10cc0, Hi: 0x10cf2, Stride: 0x1}, - unicode.Range32{Lo: 0x118c0, Hi: 0x118df, Stride: 0x1}, - unicode.Range32{Lo: 0x1d41a, Hi: 0x1d433, Stride: 0x1}, - unicode.Range32{Lo: 0x1d44e, Hi: 0x1d454, Stride: 0x1}, - unicode.Range32{Lo: 0x1d456, Hi: 0x1d467, Stride: 0x1}, - unicode.Range32{Lo: 0x1d482, Hi: 0x1d49b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4b6, Hi: 0x1d4b9, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4bb, Hi: 0x1d4bb, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4bd, Hi: 0x1d4c3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4c5, Hi: 0x1d4cf, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4ea, Hi: 0x1d503, Stride: 0x1}, - unicode.Range32{Lo: 0x1d51e, Hi: 0x1d537, Stride: 0x1}, - unicode.Range32{Lo: 0x1d552, Hi: 0x1d56b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d586, Hi: 0x1d59f, Stride: 0x1}, - unicode.Range32{Lo: 0x1d5ba, Hi: 0x1d5d3, Stride: 0x1}, - unicode.Range32{Lo: 0x1d5ee, Hi: 0x1d607, Stride: 0x1}, - unicode.Range32{Lo: 0x1d622, Hi: 0x1d63b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d656, Hi: 0x1d66f, Stride: 0x1}, - unicode.Range32{Lo: 0x1d68a, Hi: 0x1d6a5, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6c2, Hi: 0x1d6da, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6dc, Hi: 0x1d6e1, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6fc, Hi: 0x1d714, Stride: 0x1}, - unicode.Range32{Lo: 0x1d716, Hi: 0x1d71b, Stride: 0x1}, - unicode.Range32{Lo: 0x1d736, Hi: 0x1d74e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d750, Hi: 0x1d755, Stride: 0x1}, - unicode.Range32{Lo: 0x1d770, Hi: 0x1d788, Stride: 0x1}, - unicode.Range32{Lo: 0x1d78a, Hi: 0x1d78f, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7aa, Hi: 0x1d7c2, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7c4, Hi: 0x1d7c9, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7cb, Hi: 0x1d7cb, Stride: 0x1}, - unicode.Range32{Lo: 0x1e922, Hi: 0x1e943, Stride: 0x1}, - }, - LatinOffset: 6, -} - -var _SentenceNumeric = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x30, Hi: 0x39, Stride: 0x1}, - unicode.Range16{Lo: 0x660, Hi: 0x669, Stride: 0x1}, - unicode.Range16{Lo: 0x66b, Hi: 0x66c, Stride: 0x1}, - unicode.Range16{Lo: 0x6f0, Hi: 0x6f9, Stride: 0x1}, - unicode.Range16{Lo: 0x7c0, Hi: 0x7c9, Stride: 0x1}, - unicode.Range16{Lo: 0x966, Hi: 0x96f, Stride: 0x1}, - unicode.Range16{Lo: 0x9e6, Hi: 0x9ef, Stride: 0x1}, - unicode.Range16{Lo: 0xa66, Hi: 0xa6f, Stride: 0x1}, - unicode.Range16{Lo: 0xae6, Hi: 0xaef, Stride: 0x1}, - unicode.Range16{Lo: 0xb66, Hi: 0xb6f, Stride: 0x1}, - unicode.Range16{Lo: 0xbe6, Hi: 0xbef, Stride: 0x1}, - unicode.Range16{Lo: 0xc66, Hi: 0xc6f, Stride: 0x1}, - unicode.Range16{Lo: 0xce6, Hi: 0xcef, Stride: 0x1}, - unicode.Range16{Lo: 0xd66, Hi: 0xd6f, Stride: 0x1}, - unicode.Range16{Lo: 0xde6, Hi: 0xdef, Stride: 0x1}, - unicode.Range16{Lo: 0xe50, Hi: 0xe59, Stride: 0x1}, - unicode.Range16{Lo: 0xed0, Hi: 0xed9, Stride: 0x1}, - unicode.Range16{Lo: 0xf20, Hi: 0xf29, Stride: 0x1}, - unicode.Range16{Lo: 0x1040, Hi: 0x1049, Stride: 0x1}, - unicode.Range16{Lo: 0x1090, Hi: 0x1099, Stride: 0x1}, - unicode.Range16{Lo: 0x17e0, Hi: 0x17e9, Stride: 0x1}, - unicode.Range16{Lo: 0x1810, Hi: 0x1819, Stride: 0x1}, - unicode.Range16{Lo: 0x1946, Hi: 0x194f, Stride: 0x1}, - unicode.Range16{Lo: 0x19d0, Hi: 0x19d9, Stride: 0x1}, - unicode.Range16{Lo: 0x1a80, Hi: 0x1a89, Stride: 0x1}, - unicode.Range16{Lo: 0x1a90, Hi: 0x1a99, Stride: 0x1}, - unicode.Range16{Lo: 0x1b50, Hi: 0x1b59, Stride: 0x1}, - unicode.Range16{Lo: 0x1bb0, Hi: 0x1bb9, Stride: 0x1}, - unicode.Range16{Lo: 0x1c40, Hi: 0x1c49, Stride: 0x1}, - unicode.Range16{Lo: 0x1c50, Hi: 0x1c59, Stride: 0x1}, - unicode.Range16{Lo: 0xa620, Hi: 0xa629, Stride: 0x1}, - unicode.Range16{Lo: 0xa8d0, Hi: 0xa8d9, Stride: 0x1}, - unicode.Range16{Lo: 0xa900, Hi: 0xa909, Stride: 0x1}, - unicode.Range16{Lo: 0xa9d0, Hi: 0xa9d9, Stride: 0x1}, - unicode.Range16{Lo: 0xa9f0, Hi: 0xa9f9, Stride: 0x1}, - unicode.Range16{Lo: 0xaa50, Hi: 0xaa59, Stride: 0x1}, - unicode.Range16{Lo: 0xabf0, Hi: 0xabf9, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x104a0, Hi: 0x104a9, Stride: 0x1}, - unicode.Range32{Lo: 0x11066, Hi: 0x1106f, Stride: 0x1}, - unicode.Range32{Lo: 0x110f0, Hi: 0x110f9, Stride: 0x1}, - unicode.Range32{Lo: 0x11136, Hi: 0x1113f, Stride: 0x1}, - unicode.Range32{Lo: 0x111d0, Hi: 0x111d9, Stride: 0x1}, - unicode.Range32{Lo: 0x112f0, Hi: 0x112f9, Stride: 0x1}, - unicode.Range32{Lo: 0x11450, Hi: 0x11459, Stride: 0x1}, - unicode.Range32{Lo: 0x114d0, Hi: 0x114d9, Stride: 0x1}, - unicode.Range32{Lo: 0x11650, Hi: 0x11659, Stride: 0x1}, - unicode.Range32{Lo: 0x116c0, Hi: 0x116c9, Stride: 0x1}, - unicode.Range32{Lo: 0x11730, Hi: 0x11739, Stride: 0x1}, - unicode.Range32{Lo: 0x118e0, Hi: 0x118e9, Stride: 0x1}, - unicode.Range32{Lo: 0x11c50, Hi: 0x11c59, Stride: 0x1}, - unicode.Range32{Lo: 0x16a60, Hi: 0x16a69, Stride: 0x1}, - unicode.Range32{Lo: 0x16b50, Hi: 0x16b59, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7ce, Hi: 0x1d7ff, Stride: 0x1}, - unicode.Range32{Lo: 0x1e950, Hi: 0x1e959, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceOLetter = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x1bb, Hi: 0x1bb, Stride: 0x1}, - unicode.Range16{Lo: 0x1c0, Hi: 0x1c3, Stride: 0x1}, - unicode.Range16{Lo: 0x294, Hi: 0x294, Stride: 0x1}, - unicode.Range16{Lo: 0x2b9, Hi: 0x2bf, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6, Hi: 0x2d1, Stride: 0x1}, - unicode.Range16{Lo: 0x2ec, Hi: 0x2ec, Stride: 0x1}, - unicode.Range16{Lo: 0x2ee, Hi: 0x2ee, Stride: 0x1}, - unicode.Range16{Lo: 0x374, Hi: 0x374, Stride: 0x1}, - unicode.Range16{Lo: 0x559, Hi: 0x559, Stride: 0x1}, - unicode.Range16{Lo: 0x5d0, Hi: 0x5ea, Stride: 0x1}, - unicode.Range16{Lo: 0x5f0, Hi: 0x5f2, Stride: 0x1}, - unicode.Range16{Lo: 0x5f3, Hi: 0x5f3, Stride: 0x1}, - unicode.Range16{Lo: 0x620, Hi: 0x63f, Stride: 0x1}, - unicode.Range16{Lo: 0x640, Hi: 0x640, Stride: 0x1}, - unicode.Range16{Lo: 0x641, Hi: 0x64a, Stride: 0x1}, - unicode.Range16{Lo: 0x66e, Hi: 0x66f, Stride: 0x1}, - unicode.Range16{Lo: 0x671, Hi: 0x6d3, Stride: 0x1}, - unicode.Range16{Lo: 0x6d5, Hi: 0x6d5, Stride: 0x1}, - unicode.Range16{Lo: 0x6e5, Hi: 0x6e6, Stride: 0x1}, - unicode.Range16{Lo: 0x6ee, Hi: 0x6ef, Stride: 0x1}, - unicode.Range16{Lo: 0x6fa, Hi: 0x6fc, Stride: 0x1}, - unicode.Range16{Lo: 0x6ff, Hi: 0x6ff, Stride: 0x1}, - unicode.Range16{Lo: 0x710, Hi: 0x710, Stride: 0x1}, - unicode.Range16{Lo: 0x712, Hi: 0x72f, Stride: 0x1}, - unicode.Range16{Lo: 0x74d, Hi: 0x7a5, Stride: 0x1}, - unicode.Range16{Lo: 0x7b1, Hi: 0x7b1, Stride: 0x1}, - unicode.Range16{Lo: 0x7ca, Hi: 0x7ea, Stride: 0x1}, - unicode.Range16{Lo: 0x7f4, Hi: 0x7f5, Stride: 0x1}, - unicode.Range16{Lo: 0x7fa, Hi: 0x7fa, Stride: 0x1}, - unicode.Range16{Lo: 0x800, Hi: 0x815, Stride: 0x1}, - unicode.Range16{Lo: 0x81a, Hi: 0x81a, Stride: 0x1}, - unicode.Range16{Lo: 0x824, Hi: 0x824, Stride: 0x1}, - unicode.Range16{Lo: 0x828, Hi: 0x828, Stride: 0x1}, - unicode.Range16{Lo: 0x840, Hi: 0x858, Stride: 0x1}, - unicode.Range16{Lo: 0x8a0, Hi: 0x8b4, Stride: 0x1}, - unicode.Range16{Lo: 0x8b6, Hi: 0x8bd, Stride: 0x1}, - unicode.Range16{Lo: 0x904, Hi: 0x939, Stride: 0x1}, - unicode.Range16{Lo: 0x93d, Hi: 0x93d, Stride: 0x1}, - unicode.Range16{Lo: 0x950, Hi: 0x950, Stride: 0x1}, - unicode.Range16{Lo: 0x958, Hi: 0x961, Stride: 0x1}, - unicode.Range16{Lo: 0x971, Hi: 0x971, Stride: 0x1}, - unicode.Range16{Lo: 0x972, Hi: 0x980, Stride: 0x1}, - unicode.Range16{Lo: 0x985, Hi: 0x98c, Stride: 0x1}, - unicode.Range16{Lo: 0x98f, Hi: 0x990, Stride: 0x1}, - unicode.Range16{Lo: 0x993, Hi: 0x9a8, Stride: 0x1}, - unicode.Range16{Lo: 0x9aa, Hi: 0x9b0, Stride: 0x1}, - unicode.Range16{Lo: 0x9b2, Hi: 0x9b2, Stride: 0x1}, - unicode.Range16{Lo: 0x9b6, Hi: 0x9b9, Stride: 0x1}, - unicode.Range16{Lo: 0x9bd, Hi: 0x9bd, Stride: 0x1}, - unicode.Range16{Lo: 0x9ce, Hi: 0x9ce, Stride: 0x1}, - unicode.Range16{Lo: 0x9dc, Hi: 0x9dd, Stride: 0x1}, - unicode.Range16{Lo: 0x9df, Hi: 0x9e1, Stride: 0x1}, - unicode.Range16{Lo: 0x9f0, Hi: 0x9f1, Stride: 0x1}, - unicode.Range16{Lo: 0xa05, Hi: 0xa0a, Stride: 0x1}, - unicode.Range16{Lo: 0xa0f, Hi: 0xa10, Stride: 0x1}, - unicode.Range16{Lo: 0xa13, Hi: 0xa28, Stride: 0x1}, - unicode.Range16{Lo: 0xa2a, Hi: 0xa30, Stride: 0x1}, - unicode.Range16{Lo: 0xa32, Hi: 0xa33, Stride: 0x1}, - unicode.Range16{Lo: 0xa35, Hi: 0xa36, Stride: 0x1}, - unicode.Range16{Lo: 0xa38, Hi: 0xa39, Stride: 0x1}, - unicode.Range16{Lo: 0xa59, Hi: 0xa5c, Stride: 0x1}, - unicode.Range16{Lo: 0xa5e, Hi: 0xa5e, Stride: 0x1}, - unicode.Range16{Lo: 0xa72, Hi: 0xa74, Stride: 0x1}, - unicode.Range16{Lo: 0xa85, Hi: 0xa8d, Stride: 0x1}, - unicode.Range16{Lo: 0xa8f, Hi: 0xa91, Stride: 0x1}, - unicode.Range16{Lo: 0xa93, Hi: 0xaa8, Stride: 0x1}, - unicode.Range16{Lo: 0xaaa, Hi: 0xab0, Stride: 0x1}, - unicode.Range16{Lo: 0xab2, Hi: 0xab3, Stride: 0x1}, - unicode.Range16{Lo: 0xab5, Hi: 0xab9, Stride: 0x1}, - unicode.Range16{Lo: 0xabd, Hi: 0xabd, Stride: 0x1}, - unicode.Range16{Lo: 0xad0, Hi: 0xad0, Stride: 0x1}, - unicode.Range16{Lo: 0xae0, Hi: 0xae1, Stride: 0x1}, - unicode.Range16{Lo: 0xaf9, Hi: 0xaf9, Stride: 0x1}, - unicode.Range16{Lo: 0xb05, Hi: 0xb0c, Stride: 0x1}, - unicode.Range16{Lo: 0xb0f, Hi: 0xb10, Stride: 0x1}, - unicode.Range16{Lo: 0xb13, Hi: 0xb28, Stride: 0x1}, - unicode.Range16{Lo: 0xb2a, Hi: 0xb30, Stride: 0x1}, - unicode.Range16{Lo: 0xb32, Hi: 0xb33, Stride: 0x1}, - unicode.Range16{Lo: 0xb35, Hi: 0xb39, Stride: 0x1}, - unicode.Range16{Lo: 0xb3d, Hi: 0xb3d, Stride: 0x1}, - unicode.Range16{Lo: 0xb5c, Hi: 0xb5d, Stride: 0x1}, - unicode.Range16{Lo: 0xb5f, Hi: 0xb61, Stride: 0x1}, - unicode.Range16{Lo: 0xb71, Hi: 0xb71, Stride: 0x1}, - unicode.Range16{Lo: 0xb83, Hi: 0xb83, Stride: 0x1}, - unicode.Range16{Lo: 0xb85, Hi: 0xb8a, Stride: 0x1}, - unicode.Range16{Lo: 0xb8e, Hi: 0xb90, Stride: 0x1}, - unicode.Range16{Lo: 0xb92, Hi: 0xb95, Stride: 0x1}, - unicode.Range16{Lo: 0xb99, Hi: 0xb9a, Stride: 0x1}, - unicode.Range16{Lo: 0xb9c, Hi: 0xb9c, Stride: 0x1}, - unicode.Range16{Lo: 0xb9e, Hi: 0xb9f, Stride: 0x1}, - unicode.Range16{Lo: 0xba3, Hi: 0xba4, Stride: 0x1}, - unicode.Range16{Lo: 0xba8, Hi: 0xbaa, Stride: 0x1}, - unicode.Range16{Lo: 0xbae, Hi: 0xbb9, Stride: 0x1}, - unicode.Range16{Lo: 0xbd0, Hi: 0xbd0, Stride: 0x1}, - unicode.Range16{Lo: 0xc05, Hi: 0xc0c, Stride: 0x1}, - unicode.Range16{Lo: 0xc0e, Hi: 0xc10, Stride: 0x1}, - unicode.Range16{Lo: 0xc12, Hi: 0xc28, Stride: 0x1}, - unicode.Range16{Lo: 0xc2a, Hi: 0xc39, Stride: 0x1}, - unicode.Range16{Lo: 0xc3d, Hi: 0xc3d, Stride: 0x1}, - unicode.Range16{Lo: 0xc58, Hi: 0xc5a, Stride: 0x1}, - unicode.Range16{Lo: 0xc60, Hi: 0xc61, Stride: 0x1}, - unicode.Range16{Lo: 0xc80, Hi: 0xc80, Stride: 0x1}, - unicode.Range16{Lo: 0xc85, Hi: 0xc8c, Stride: 0x1}, - unicode.Range16{Lo: 0xc8e, Hi: 0xc90, Stride: 0x1}, - unicode.Range16{Lo: 0xc92, Hi: 0xca8, Stride: 0x1}, - unicode.Range16{Lo: 0xcaa, Hi: 0xcb3, Stride: 0x1}, - unicode.Range16{Lo: 0xcb5, Hi: 0xcb9, Stride: 0x1}, - unicode.Range16{Lo: 0xcbd, Hi: 0xcbd, Stride: 0x1}, - unicode.Range16{Lo: 0xcde, Hi: 0xcde, Stride: 0x1}, - unicode.Range16{Lo: 0xce0, Hi: 0xce1, Stride: 0x1}, - unicode.Range16{Lo: 0xcf1, Hi: 0xcf2, Stride: 0x1}, - unicode.Range16{Lo: 0xd05, Hi: 0xd0c, Stride: 0x1}, - unicode.Range16{Lo: 0xd0e, Hi: 0xd10, Stride: 0x1}, - unicode.Range16{Lo: 0xd12, Hi: 0xd3a, Stride: 0x1}, - unicode.Range16{Lo: 0xd3d, Hi: 0xd3d, Stride: 0x1}, - unicode.Range16{Lo: 0xd4e, Hi: 0xd4e, Stride: 0x1}, - unicode.Range16{Lo: 0xd54, Hi: 0xd56, Stride: 0x1}, - unicode.Range16{Lo: 0xd5f, Hi: 0xd61, Stride: 0x1}, - unicode.Range16{Lo: 0xd7a, Hi: 0xd7f, Stride: 0x1}, - unicode.Range16{Lo: 0xd85, Hi: 0xd96, Stride: 0x1}, - unicode.Range16{Lo: 0xd9a, Hi: 0xdb1, Stride: 0x1}, - unicode.Range16{Lo: 0xdb3, Hi: 0xdbb, Stride: 0x1}, - unicode.Range16{Lo: 0xdbd, Hi: 0xdbd, Stride: 0x1}, - unicode.Range16{Lo: 0xdc0, Hi: 0xdc6, Stride: 0x1}, - unicode.Range16{Lo: 0xe01, Hi: 0xe30, Stride: 0x1}, - unicode.Range16{Lo: 0xe32, Hi: 0xe33, Stride: 0x1}, - unicode.Range16{Lo: 0xe40, Hi: 0xe45, Stride: 0x1}, - unicode.Range16{Lo: 0xe46, Hi: 0xe46, Stride: 0x1}, - unicode.Range16{Lo: 0xe81, Hi: 0xe82, Stride: 0x1}, - unicode.Range16{Lo: 0xe84, Hi: 0xe84, Stride: 0x1}, - unicode.Range16{Lo: 0xe87, Hi: 0xe88, Stride: 0x1}, - unicode.Range16{Lo: 0xe8a, Hi: 0xe8a, Stride: 0x1}, - unicode.Range16{Lo: 0xe8d, Hi: 0xe8d, Stride: 0x1}, - unicode.Range16{Lo: 0xe94, Hi: 0xe97, Stride: 0x1}, - unicode.Range16{Lo: 0xe99, Hi: 0xe9f, Stride: 0x1}, - unicode.Range16{Lo: 0xea1, Hi: 0xea3, Stride: 0x1}, - unicode.Range16{Lo: 0xea5, Hi: 0xea5, Stride: 0x1}, - unicode.Range16{Lo: 0xea7, Hi: 0xea7, Stride: 0x1}, - unicode.Range16{Lo: 0xeaa, Hi: 0xeab, Stride: 0x1}, - unicode.Range16{Lo: 0xead, Hi: 0xeb0, Stride: 0x1}, - unicode.Range16{Lo: 0xeb2, Hi: 0xeb3, Stride: 0x1}, - unicode.Range16{Lo: 0xebd, Hi: 0xebd, Stride: 0x1}, - unicode.Range16{Lo: 0xec0, Hi: 0xec4, Stride: 0x1}, - unicode.Range16{Lo: 0xec6, Hi: 0xec6, Stride: 0x1}, - unicode.Range16{Lo: 0xedc, Hi: 0xedf, Stride: 0x1}, - unicode.Range16{Lo: 0xf00, Hi: 0xf00, Stride: 0x1}, - unicode.Range16{Lo: 0xf40, Hi: 0xf47, Stride: 0x1}, - unicode.Range16{Lo: 0xf49, Hi: 0xf6c, Stride: 0x1}, - unicode.Range16{Lo: 0xf88, Hi: 0xf8c, Stride: 0x1}, - unicode.Range16{Lo: 0x1000, Hi: 0x102a, Stride: 0x1}, - unicode.Range16{Lo: 0x103f, Hi: 0x103f, Stride: 0x1}, - unicode.Range16{Lo: 0x1050, Hi: 0x1055, Stride: 0x1}, - unicode.Range16{Lo: 0x105a, Hi: 0x105d, Stride: 0x1}, - unicode.Range16{Lo: 0x1061, Hi: 0x1061, Stride: 0x1}, - unicode.Range16{Lo: 0x1065, Hi: 0x1066, Stride: 0x1}, - unicode.Range16{Lo: 0x106e, Hi: 0x1070, Stride: 0x1}, - unicode.Range16{Lo: 0x1075, Hi: 0x1081, Stride: 0x1}, - unicode.Range16{Lo: 0x108e, Hi: 0x108e, Stride: 0x1}, - unicode.Range16{Lo: 0x10d0, Hi: 0x10fa, Stride: 0x1}, - unicode.Range16{Lo: 0x10fc, Hi: 0x10fc, Stride: 0x1}, - unicode.Range16{Lo: 0x10fd, Hi: 0x1248, Stride: 0x1}, - unicode.Range16{Lo: 0x124a, Hi: 0x124d, Stride: 0x1}, - unicode.Range16{Lo: 0x1250, Hi: 0x1256, Stride: 0x1}, - unicode.Range16{Lo: 0x1258, Hi: 0x1258, Stride: 0x1}, - unicode.Range16{Lo: 0x125a, Hi: 0x125d, Stride: 0x1}, - unicode.Range16{Lo: 0x1260, Hi: 0x1288, Stride: 0x1}, - unicode.Range16{Lo: 0x128a, Hi: 0x128d, Stride: 0x1}, - unicode.Range16{Lo: 0x1290, Hi: 0x12b0, Stride: 0x1}, - unicode.Range16{Lo: 0x12b2, Hi: 0x12b5, Stride: 0x1}, - unicode.Range16{Lo: 0x12b8, Hi: 0x12be, Stride: 0x1}, - unicode.Range16{Lo: 0x12c0, Hi: 0x12c0, Stride: 0x1}, - unicode.Range16{Lo: 0x12c2, Hi: 0x12c5, Stride: 0x1}, - unicode.Range16{Lo: 0x12c8, Hi: 0x12d6, Stride: 0x1}, - unicode.Range16{Lo: 0x12d8, Hi: 0x1310, Stride: 0x1}, - unicode.Range16{Lo: 0x1312, Hi: 0x1315, Stride: 0x1}, - unicode.Range16{Lo: 0x1318, Hi: 0x135a, Stride: 0x1}, - unicode.Range16{Lo: 0x1380, Hi: 0x138f, Stride: 0x1}, - unicode.Range16{Lo: 0x1401, Hi: 0x166c, Stride: 0x1}, - unicode.Range16{Lo: 0x166f, Hi: 0x167f, Stride: 0x1}, - unicode.Range16{Lo: 0x1681, Hi: 0x169a, Stride: 0x1}, - unicode.Range16{Lo: 0x16a0, Hi: 0x16ea, Stride: 0x1}, - unicode.Range16{Lo: 0x16ee, Hi: 0x16f0, Stride: 0x1}, - unicode.Range16{Lo: 0x16f1, Hi: 0x16f8, Stride: 0x1}, - unicode.Range16{Lo: 0x1700, Hi: 0x170c, Stride: 0x1}, - unicode.Range16{Lo: 0x170e, Hi: 0x1711, Stride: 0x1}, - unicode.Range16{Lo: 0x1720, Hi: 0x1731, Stride: 0x1}, - unicode.Range16{Lo: 0x1740, Hi: 0x1751, Stride: 0x1}, - unicode.Range16{Lo: 0x1760, Hi: 0x176c, Stride: 0x1}, - unicode.Range16{Lo: 0x176e, Hi: 0x1770, Stride: 0x1}, - unicode.Range16{Lo: 0x1780, Hi: 0x17b3, Stride: 0x1}, - unicode.Range16{Lo: 0x17d7, Hi: 0x17d7, Stride: 0x1}, - unicode.Range16{Lo: 0x17dc, Hi: 0x17dc, Stride: 0x1}, - unicode.Range16{Lo: 0x1820, Hi: 0x1842, Stride: 0x1}, - unicode.Range16{Lo: 0x1843, Hi: 0x1843, Stride: 0x1}, - unicode.Range16{Lo: 0x1844, Hi: 0x1877, Stride: 0x1}, - unicode.Range16{Lo: 0x1880, Hi: 0x1884, Stride: 0x1}, - unicode.Range16{Lo: 0x1887, Hi: 0x18a8, Stride: 0x1}, - unicode.Range16{Lo: 0x18aa, Hi: 0x18aa, Stride: 0x1}, - unicode.Range16{Lo: 0x18b0, Hi: 0x18f5, Stride: 0x1}, - unicode.Range16{Lo: 0x1900, Hi: 0x191e, Stride: 0x1}, - unicode.Range16{Lo: 0x1950, Hi: 0x196d, Stride: 0x1}, - unicode.Range16{Lo: 0x1970, Hi: 0x1974, Stride: 0x1}, - unicode.Range16{Lo: 0x1980, Hi: 0x19ab, Stride: 0x1}, - unicode.Range16{Lo: 0x19b0, Hi: 0x19c9, Stride: 0x1}, - unicode.Range16{Lo: 0x1a00, Hi: 0x1a16, Stride: 0x1}, - unicode.Range16{Lo: 0x1a20, Hi: 0x1a54, Stride: 0x1}, - unicode.Range16{Lo: 0x1aa7, Hi: 0x1aa7, Stride: 0x1}, - unicode.Range16{Lo: 0x1b05, Hi: 0x1b33, Stride: 0x1}, - unicode.Range16{Lo: 0x1b45, Hi: 0x1b4b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b83, Hi: 0x1ba0, Stride: 0x1}, - unicode.Range16{Lo: 0x1bae, Hi: 0x1baf, Stride: 0x1}, - unicode.Range16{Lo: 0x1bba, Hi: 0x1be5, Stride: 0x1}, - unicode.Range16{Lo: 0x1c00, Hi: 0x1c23, Stride: 0x1}, - unicode.Range16{Lo: 0x1c4d, Hi: 0x1c4f, Stride: 0x1}, - unicode.Range16{Lo: 0x1c5a, Hi: 0x1c77, Stride: 0x1}, - unicode.Range16{Lo: 0x1c78, Hi: 0x1c7d, Stride: 0x1}, - unicode.Range16{Lo: 0x1ce9, Hi: 0x1cec, Stride: 0x1}, - unicode.Range16{Lo: 0x1cee, Hi: 0x1cf1, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf5, Hi: 0x1cf6, Stride: 0x1}, - unicode.Range16{Lo: 0x2135, Hi: 0x2138, Stride: 0x1}, - unicode.Range16{Lo: 0x2180, Hi: 0x2182, Stride: 0x1}, - unicode.Range16{Lo: 0x2185, Hi: 0x2188, Stride: 0x1}, - unicode.Range16{Lo: 0x2d30, Hi: 0x2d67, Stride: 0x1}, - unicode.Range16{Lo: 0x2d6f, Hi: 0x2d6f, Stride: 0x1}, - unicode.Range16{Lo: 0x2d80, Hi: 0x2d96, Stride: 0x1}, - unicode.Range16{Lo: 0x2da0, Hi: 0x2da6, Stride: 0x1}, - unicode.Range16{Lo: 0x2da8, Hi: 0x2dae, Stride: 0x1}, - unicode.Range16{Lo: 0x2db0, Hi: 0x2db6, Stride: 0x1}, - unicode.Range16{Lo: 0x2db8, Hi: 0x2dbe, Stride: 0x1}, - unicode.Range16{Lo: 0x2dc0, Hi: 0x2dc6, Stride: 0x1}, - unicode.Range16{Lo: 0x2dc8, Hi: 0x2dce, Stride: 0x1}, - unicode.Range16{Lo: 0x2dd0, Hi: 0x2dd6, Stride: 0x1}, - unicode.Range16{Lo: 0x2dd8, Hi: 0x2dde, Stride: 0x1}, - unicode.Range16{Lo: 0x2e2f, Hi: 0x2e2f, Stride: 0x1}, - unicode.Range16{Lo: 0x3005, Hi: 0x3005, Stride: 0x1}, - unicode.Range16{Lo: 0x3006, Hi: 0x3006, Stride: 0x1}, - unicode.Range16{Lo: 0x3007, Hi: 0x3007, Stride: 0x1}, - unicode.Range16{Lo: 0x3021, Hi: 0x3029, Stride: 0x1}, - unicode.Range16{Lo: 0x3031, Hi: 0x3035, Stride: 0x1}, - unicode.Range16{Lo: 0x3038, Hi: 0x303a, Stride: 0x1}, - unicode.Range16{Lo: 0x303b, Hi: 0x303b, Stride: 0x1}, - unicode.Range16{Lo: 0x303c, Hi: 0x303c, Stride: 0x1}, - unicode.Range16{Lo: 0x3041, Hi: 0x3096, Stride: 0x1}, - unicode.Range16{Lo: 0x309d, Hi: 0x309e, Stride: 0x1}, - unicode.Range16{Lo: 0x309f, Hi: 0x309f, Stride: 0x1}, - unicode.Range16{Lo: 0x30a1, Hi: 0x30fa, Stride: 0x1}, - unicode.Range16{Lo: 0x30fc, Hi: 0x30fe, Stride: 0x1}, - unicode.Range16{Lo: 0x30ff, Hi: 0x30ff, Stride: 0x1}, - unicode.Range16{Lo: 0x3105, Hi: 0x312d, Stride: 0x1}, - unicode.Range16{Lo: 0x3131, Hi: 0x318e, Stride: 0x1}, - unicode.Range16{Lo: 0x31a0, Hi: 0x31ba, Stride: 0x1}, - unicode.Range16{Lo: 0x31f0, Hi: 0x31ff, Stride: 0x1}, - unicode.Range16{Lo: 0x3400, Hi: 0x4db5, Stride: 0x1}, - unicode.Range16{Lo: 0x4e00, Hi: 0x9fd5, Stride: 0x1}, - unicode.Range16{Lo: 0xa000, Hi: 0xa014, Stride: 0x1}, - unicode.Range16{Lo: 0xa015, Hi: 0xa015, Stride: 0x1}, - unicode.Range16{Lo: 0xa016, Hi: 0xa48c, Stride: 0x1}, - unicode.Range16{Lo: 0xa4d0, Hi: 0xa4f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa4f8, Hi: 0xa4fd, Stride: 0x1}, - unicode.Range16{Lo: 0xa500, Hi: 0xa60b, Stride: 0x1}, - unicode.Range16{Lo: 0xa60c, Hi: 0xa60c, Stride: 0x1}, - unicode.Range16{Lo: 0xa610, Hi: 0xa61f, Stride: 0x1}, - unicode.Range16{Lo: 0xa62a, Hi: 0xa62b, Stride: 0x1}, - unicode.Range16{Lo: 0xa66e, Hi: 0xa66e, Stride: 0x1}, - unicode.Range16{Lo: 0xa67f, Hi: 0xa67f, Stride: 0x1}, - unicode.Range16{Lo: 0xa6a0, Hi: 0xa6e5, Stride: 0x1}, - unicode.Range16{Lo: 0xa6e6, Hi: 0xa6ef, Stride: 0x1}, - unicode.Range16{Lo: 0xa717, Hi: 0xa71f, Stride: 0x1}, - unicode.Range16{Lo: 0xa788, Hi: 0xa788, Stride: 0x1}, - unicode.Range16{Lo: 0xa78f, Hi: 0xa78f, Stride: 0x1}, - unicode.Range16{Lo: 0xa7f7, Hi: 0xa7f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa7fb, Hi: 0xa801, Stride: 0x1}, - unicode.Range16{Lo: 0xa803, Hi: 0xa805, Stride: 0x1}, - unicode.Range16{Lo: 0xa807, Hi: 0xa80a, Stride: 0x1}, - unicode.Range16{Lo: 0xa80c, Hi: 0xa822, Stride: 0x1}, - unicode.Range16{Lo: 0xa840, Hi: 0xa873, Stride: 0x1}, - unicode.Range16{Lo: 0xa882, Hi: 0xa8b3, Stride: 0x1}, - unicode.Range16{Lo: 0xa8f2, Hi: 0xa8f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fb, Hi: 0xa8fb, Stride: 0x1}, - unicode.Range16{Lo: 0xa8fd, Hi: 0xa8fd, Stride: 0x1}, - unicode.Range16{Lo: 0xa90a, Hi: 0xa925, Stride: 0x1}, - unicode.Range16{Lo: 0xa930, Hi: 0xa946, Stride: 0x1}, - unicode.Range16{Lo: 0xa960, Hi: 0xa97c, Stride: 0x1}, - unicode.Range16{Lo: 0xa984, Hi: 0xa9b2, Stride: 0x1}, - unicode.Range16{Lo: 0xa9cf, Hi: 0xa9cf, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e0, Hi: 0xa9e4, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e6, Hi: 0xa9e6, Stride: 0x1}, - unicode.Range16{Lo: 0xa9e7, Hi: 0xa9ef, Stride: 0x1}, - unicode.Range16{Lo: 0xa9fa, Hi: 0xa9fe, Stride: 0x1}, - unicode.Range16{Lo: 0xaa00, Hi: 0xaa28, Stride: 0x1}, - unicode.Range16{Lo: 0xaa40, Hi: 0xaa42, Stride: 0x1}, - unicode.Range16{Lo: 0xaa44, Hi: 0xaa4b, Stride: 0x1}, - unicode.Range16{Lo: 0xaa60, Hi: 0xaa6f, Stride: 0x1}, - unicode.Range16{Lo: 0xaa70, Hi: 0xaa70, Stride: 0x1}, - unicode.Range16{Lo: 0xaa71, Hi: 0xaa76, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7a, Hi: 0xaa7a, Stride: 0x1}, - unicode.Range16{Lo: 0xaa7e, Hi: 0xaaaf, Stride: 0x1}, - unicode.Range16{Lo: 0xaab1, Hi: 0xaab1, Stride: 0x1}, - unicode.Range16{Lo: 0xaab5, Hi: 0xaab6, Stride: 0x1}, - unicode.Range16{Lo: 0xaab9, Hi: 0xaabd, Stride: 0x1}, - unicode.Range16{Lo: 0xaac0, Hi: 0xaac0, Stride: 0x1}, - unicode.Range16{Lo: 0xaac2, Hi: 0xaac2, Stride: 0x1}, - unicode.Range16{Lo: 0xaadb, Hi: 0xaadc, Stride: 0x1}, - unicode.Range16{Lo: 0xaadd, Hi: 0xaadd, Stride: 0x1}, - unicode.Range16{Lo: 0xaae0, Hi: 0xaaea, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf2, Hi: 0xaaf2, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf3, Hi: 0xaaf4, Stride: 0x1}, - unicode.Range16{Lo: 0xab01, Hi: 0xab06, Stride: 0x1}, - unicode.Range16{Lo: 0xab09, Hi: 0xab0e, Stride: 0x1}, - unicode.Range16{Lo: 0xab11, Hi: 0xab16, Stride: 0x1}, - unicode.Range16{Lo: 0xab20, Hi: 0xab26, Stride: 0x1}, - unicode.Range16{Lo: 0xab28, Hi: 0xab2e, Stride: 0x1}, - unicode.Range16{Lo: 0xabc0, Hi: 0xabe2, Stride: 0x1}, - unicode.Range16{Lo: 0xac00, Hi: 0xd7a3, Stride: 0x1}, - unicode.Range16{Lo: 0xd7b0, Hi: 0xd7c6, Stride: 0x1}, - unicode.Range16{Lo: 0xd7cb, Hi: 0xd7fb, Stride: 0x1}, - unicode.Range16{Lo: 0xf900, Hi: 0xfa6d, Stride: 0x1}, - unicode.Range16{Lo: 0xfa70, Hi: 0xfad9, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1d, Hi: 0xfb1d, Stride: 0x1}, - unicode.Range16{Lo: 0xfb1f, Hi: 0xfb28, Stride: 0x1}, - unicode.Range16{Lo: 0xfb2a, Hi: 0xfb36, Stride: 0x1}, - unicode.Range16{Lo: 0xfb38, Hi: 0xfb3c, Stride: 0x1}, - unicode.Range16{Lo: 0xfb3e, Hi: 0xfb3e, Stride: 0x1}, - unicode.Range16{Lo: 0xfb40, Hi: 0xfb41, Stride: 0x1}, - unicode.Range16{Lo: 0xfb43, Hi: 0xfb44, Stride: 0x1}, - unicode.Range16{Lo: 0xfb46, Hi: 0xfbb1, Stride: 0x1}, - unicode.Range16{Lo: 0xfbd3, Hi: 0xfd3d, Stride: 0x1}, - unicode.Range16{Lo: 0xfd50, Hi: 0xfd8f, Stride: 0x1}, - unicode.Range16{Lo: 0xfd92, Hi: 0xfdc7, Stride: 0x1}, - unicode.Range16{Lo: 0xfdf0, Hi: 0xfdfb, Stride: 0x1}, - unicode.Range16{Lo: 0xfe70, Hi: 0xfe74, Stride: 0x1}, - unicode.Range16{Lo: 0xfe76, Hi: 0xfefc, Stride: 0x1}, - unicode.Range16{Lo: 0xff66, Hi: 0xff6f, Stride: 0x1}, - unicode.Range16{Lo: 0xff70, Hi: 0xff70, Stride: 0x1}, - unicode.Range16{Lo: 0xff71, Hi: 0xff9d, Stride: 0x1}, - unicode.Range16{Lo: 0xffa0, Hi: 0xffbe, Stride: 0x1}, - unicode.Range16{Lo: 0xffc2, Hi: 0xffc7, Stride: 0x1}, - unicode.Range16{Lo: 0xffca, Hi: 0xffcf, Stride: 0x1}, - unicode.Range16{Lo: 0xffd2, Hi: 0xffd7, Stride: 0x1}, - unicode.Range16{Lo: 0xffda, Hi: 0xffdc, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x10000, Hi: 0x1000b, Stride: 0x1}, - unicode.Range32{Lo: 0x1000d, Hi: 0x10026, Stride: 0x1}, - unicode.Range32{Lo: 0x10028, Hi: 0x1003a, Stride: 0x1}, - unicode.Range32{Lo: 0x1003c, Hi: 0x1003d, Stride: 0x1}, - unicode.Range32{Lo: 0x1003f, Hi: 0x1004d, Stride: 0x1}, - unicode.Range32{Lo: 0x10050, Hi: 0x1005d, Stride: 0x1}, - unicode.Range32{Lo: 0x10080, Hi: 0x100fa, Stride: 0x1}, - unicode.Range32{Lo: 0x10140, Hi: 0x10174, Stride: 0x1}, - unicode.Range32{Lo: 0x10280, Hi: 0x1029c, Stride: 0x1}, - unicode.Range32{Lo: 0x102a0, Hi: 0x102d0, Stride: 0x1}, - unicode.Range32{Lo: 0x10300, Hi: 0x1031f, Stride: 0x1}, - unicode.Range32{Lo: 0x10330, Hi: 0x10340, Stride: 0x1}, - unicode.Range32{Lo: 0x10341, Hi: 0x10341, Stride: 0x1}, - unicode.Range32{Lo: 0x10342, Hi: 0x10349, Stride: 0x1}, - unicode.Range32{Lo: 0x1034a, Hi: 0x1034a, Stride: 0x1}, - unicode.Range32{Lo: 0x10350, Hi: 0x10375, Stride: 0x1}, - unicode.Range32{Lo: 0x10380, Hi: 0x1039d, Stride: 0x1}, - unicode.Range32{Lo: 0x103a0, Hi: 0x103c3, Stride: 0x1}, - unicode.Range32{Lo: 0x103c8, Hi: 0x103cf, Stride: 0x1}, - unicode.Range32{Lo: 0x103d1, Hi: 0x103d5, Stride: 0x1}, - unicode.Range32{Lo: 0x10450, Hi: 0x1049d, Stride: 0x1}, - unicode.Range32{Lo: 0x10500, Hi: 0x10527, Stride: 0x1}, - unicode.Range32{Lo: 0x10530, Hi: 0x10563, Stride: 0x1}, - unicode.Range32{Lo: 0x10600, Hi: 0x10736, Stride: 0x1}, - unicode.Range32{Lo: 0x10740, Hi: 0x10755, Stride: 0x1}, - unicode.Range32{Lo: 0x10760, Hi: 0x10767, Stride: 0x1}, - unicode.Range32{Lo: 0x10800, Hi: 0x10805, Stride: 0x1}, - unicode.Range32{Lo: 0x10808, Hi: 0x10808, Stride: 0x1}, - unicode.Range32{Lo: 0x1080a, Hi: 0x10835, Stride: 0x1}, - unicode.Range32{Lo: 0x10837, Hi: 0x10838, Stride: 0x1}, - unicode.Range32{Lo: 0x1083c, Hi: 0x1083c, Stride: 0x1}, - unicode.Range32{Lo: 0x1083f, Hi: 0x10855, Stride: 0x1}, - unicode.Range32{Lo: 0x10860, Hi: 0x10876, Stride: 0x1}, - unicode.Range32{Lo: 0x10880, Hi: 0x1089e, Stride: 0x1}, - unicode.Range32{Lo: 0x108e0, Hi: 0x108f2, Stride: 0x1}, - unicode.Range32{Lo: 0x108f4, Hi: 0x108f5, Stride: 0x1}, - unicode.Range32{Lo: 0x10900, Hi: 0x10915, Stride: 0x1}, - unicode.Range32{Lo: 0x10920, Hi: 0x10939, Stride: 0x1}, - unicode.Range32{Lo: 0x10980, Hi: 0x109b7, Stride: 0x1}, - unicode.Range32{Lo: 0x109be, Hi: 0x109bf, Stride: 0x1}, - unicode.Range32{Lo: 0x10a00, Hi: 0x10a00, Stride: 0x1}, - unicode.Range32{Lo: 0x10a10, Hi: 0x10a13, Stride: 0x1}, - unicode.Range32{Lo: 0x10a15, Hi: 0x10a17, Stride: 0x1}, - unicode.Range32{Lo: 0x10a19, Hi: 0x10a33, Stride: 0x1}, - unicode.Range32{Lo: 0x10a60, Hi: 0x10a7c, Stride: 0x1}, - unicode.Range32{Lo: 0x10a80, Hi: 0x10a9c, Stride: 0x1}, - unicode.Range32{Lo: 0x10ac0, Hi: 0x10ac7, Stride: 0x1}, - unicode.Range32{Lo: 0x10ac9, Hi: 0x10ae4, Stride: 0x1}, - unicode.Range32{Lo: 0x10b00, Hi: 0x10b35, Stride: 0x1}, - unicode.Range32{Lo: 0x10b40, Hi: 0x10b55, Stride: 0x1}, - unicode.Range32{Lo: 0x10b60, Hi: 0x10b72, Stride: 0x1}, - unicode.Range32{Lo: 0x10b80, Hi: 0x10b91, Stride: 0x1}, - unicode.Range32{Lo: 0x10c00, Hi: 0x10c48, Stride: 0x1}, - unicode.Range32{Lo: 0x11003, Hi: 0x11037, Stride: 0x1}, - unicode.Range32{Lo: 0x11083, Hi: 0x110af, Stride: 0x1}, - unicode.Range32{Lo: 0x110d0, Hi: 0x110e8, Stride: 0x1}, - unicode.Range32{Lo: 0x11103, Hi: 0x11126, Stride: 0x1}, - unicode.Range32{Lo: 0x11150, Hi: 0x11172, Stride: 0x1}, - unicode.Range32{Lo: 0x11176, Hi: 0x11176, Stride: 0x1}, - unicode.Range32{Lo: 0x11183, Hi: 0x111b2, Stride: 0x1}, - unicode.Range32{Lo: 0x111c1, Hi: 0x111c4, Stride: 0x1}, - unicode.Range32{Lo: 0x111da, Hi: 0x111da, Stride: 0x1}, - unicode.Range32{Lo: 0x111dc, Hi: 0x111dc, Stride: 0x1}, - unicode.Range32{Lo: 0x11200, Hi: 0x11211, Stride: 0x1}, - unicode.Range32{Lo: 0x11213, Hi: 0x1122b, Stride: 0x1}, - unicode.Range32{Lo: 0x11280, Hi: 0x11286, Stride: 0x1}, - unicode.Range32{Lo: 0x11288, Hi: 0x11288, Stride: 0x1}, - unicode.Range32{Lo: 0x1128a, Hi: 0x1128d, Stride: 0x1}, - unicode.Range32{Lo: 0x1128f, Hi: 0x1129d, Stride: 0x1}, - unicode.Range32{Lo: 0x1129f, Hi: 0x112a8, Stride: 0x1}, - unicode.Range32{Lo: 0x112b0, Hi: 0x112de, Stride: 0x1}, - unicode.Range32{Lo: 0x11305, Hi: 0x1130c, Stride: 0x1}, - unicode.Range32{Lo: 0x1130f, Hi: 0x11310, Stride: 0x1}, - unicode.Range32{Lo: 0x11313, Hi: 0x11328, Stride: 0x1}, - unicode.Range32{Lo: 0x1132a, Hi: 0x11330, Stride: 0x1}, - unicode.Range32{Lo: 0x11332, Hi: 0x11333, Stride: 0x1}, - unicode.Range32{Lo: 0x11335, Hi: 0x11339, Stride: 0x1}, - unicode.Range32{Lo: 0x1133d, Hi: 0x1133d, Stride: 0x1}, - unicode.Range32{Lo: 0x11350, Hi: 0x11350, Stride: 0x1}, - unicode.Range32{Lo: 0x1135d, Hi: 0x11361, Stride: 0x1}, - unicode.Range32{Lo: 0x11400, Hi: 0x11434, Stride: 0x1}, - unicode.Range32{Lo: 0x11447, Hi: 0x1144a, Stride: 0x1}, - unicode.Range32{Lo: 0x11480, Hi: 0x114af, Stride: 0x1}, - unicode.Range32{Lo: 0x114c4, Hi: 0x114c5, Stride: 0x1}, - unicode.Range32{Lo: 0x114c7, Hi: 0x114c7, Stride: 0x1}, - unicode.Range32{Lo: 0x11580, Hi: 0x115ae, Stride: 0x1}, - unicode.Range32{Lo: 0x115d8, Hi: 0x115db, Stride: 0x1}, - unicode.Range32{Lo: 0x11600, Hi: 0x1162f, Stride: 0x1}, - unicode.Range32{Lo: 0x11644, Hi: 0x11644, Stride: 0x1}, - unicode.Range32{Lo: 0x11680, Hi: 0x116aa, Stride: 0x1}, - unicode.Range32{Lo: 0x11700, Hi: 0x11719, Stride: 0x1}, - unicode.Range32{Lo: 0x118ff, Hi: 0x118ff, Stride: 0x1}, - unicode.Range32{Lo: 0x11ac0, Hi: 0x11af8, Stride: 0x1}, - unicode.Range32{Lo: 0x11c00, Hi: 0x11c08, Stride: 0x1}, - unicode.Range32{Lo: 0x11c0a, Hi: 0x11c2e, Stride: 0x1}, - unicode.Range32{Lo: 0x11c40, Hi: 0x11c40, Stride: 0x1}, - unicode.Range32{Lo: 0x11c72, Hi: 0x11c8f, Stride: 0x1}, - unicode.Range32{Lo: 0x12000, Hi: 0x12399, Stride: 0x1}, - unicode.Range32{Lo: 0x12400, Hi: 0x1246e, Stride: 0x1}, - unicode.Range32{Lo: 0x12480, Hi: 0x12543, Stride: 0x1}, - unicode.Range32{Lo: 0x13000, Hi: 0x1342e, Stride: 0x1}, - unicode.Range32{Lo: 0x14400, Hi: 0x14646, Stride: 0x1}, - unicode.Range32{Lo: 0x16800, Hi: 0x16a38, Stride: 0x1}, - unicode.Range32{Lo: 0x16a40, Hi: 0x16a5e, Stride: 0x1}, - unicode.Range32{Lo: 0x16ad0, Hi: 0x16aed, Stride: 0x1}, - unicode.Range32{Lo: 0x16b00, Hi: 0x16b2f, Stride: 0x1}, - unicode.Range32{Lo: 0x16b40, Hi: 0x16b43, Stride: 0x1}, - unicode.Range32{Lo: 0x16b63, Hi: 0x16b77, Stride: 0x1}, - unicode.Range32{Lo: 0x16b7d, Hi: 0x16b8f, Stride: 0x1}, - unicode.Range32{Lo: 0x16f00, Hi: 0x16f44, Stride: 0x1}, - unicode.Range32{Lo: 0x16f50, Hi: 0x16f50, Stride: 0x1}, - unicode.Range32{Lo: 0x16f93, Hi: 0x16f9f, Stride: 0x1}, - unicode.Range32{Lo: 0x16fe0, Hi: 0x16fe0, Stride: 0x1}, - unicode.Range32{Lo: 0x17000, Hi: 0x187ec, Stride: 0x1}, - unicode.Range32{Lo: 0x18800, Hi: 0x18af2, Stride: 0x1}, - unicode.Range32{Lo: 0x1b000, Hi: 0x1b001, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc00, Hi: 0x1bc6a, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc70, Hi: 0x1bc7c, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc80, Hi: 0x1bc88, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc90, Hi: 0x1bc99, Stride: 0x1}, - unicode.Range32{Lo: 0x1e800, Hi: 0x1e8c4, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee00, Hi: 0x1ee03, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee05, Hi: 0x1ee1f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee21, Hi: 0x1ee22, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee24, Hi: 0x1ee24, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee27, Hi: 0x1ee27, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee29, Hi: 0x1ee32, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee34, Hi: 0x1ee37, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee39, Hi: 0x1ee39, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee3b, Hi: 0x1ee3b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee42, Hi: 0x1ee42, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee47, Hi: 0x1ee47, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee49, Hi: 0x1ee49, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee4b, Hi: 0x1ee4b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee4d, Hi: 0x1ee4f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee51, Hi: 0x1ee52, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee54, Hi: 0x1ee54, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee57, Hi: 0x1ee57, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee59, Hi: 0x1ee59, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5b, Hi: 0x1ee5b, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5d, Hi: 0x1ee5d, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee5f, Hi: 0x1ee5f, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee61, Hi: 0x1ee62, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee64, Hi: 0x1ee64, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee67, Hi: 0x1ee6a, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee6c, Hi: 0x1ee72, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee74, Hi: 0x1ee77, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee79, Hi: 0x1ee7c, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee7e, Hi: 0x1ee7e, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee80, Hi: 0x1ee89, Stride: 0x1}, - unicode.Range32{Lo: 0x1ee8b, Hi: 0x1ee9b, Stride: 0x1}, - unicode.Range32{Lo: 0x1eea1, Hi: 0x1eea3, Stride: 0x1}, - unicode.Range32{Lo: 0x1eea5, Hi: 0x1eea9, Stride: 0x1}, - unicode.Range32{Lo: 0x1eeab, Hi: 0x1eebb, Stride: 0x1}, - unicode.Range32{Lo: 0x20000, Hi: 0x2a6d6, Stride: 0x1}, - unicode.Range32{Lo: 0x2a700, Hi: 0x2b734, Stride: 0x1}, - unicode.Range32{Lo: 0x2b740, Hi: 0x2b81d, Stride: 0x1}, - unicode.Range32{Lo: 0x2b820, Hi: 0x2cea1, Stride: 0x1}, - unicode.Range32{Lo: 0x2f800, Hi: 0x2fa1d, Stride: 0x1}, - }, - LatinOffset: 0, -} - -var _SentenceSContinue = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x2c, Hi: 0x2c, Stride: 0x1}, - unicode.Range16{Lo: 0x2d, Hi: 0x2d, Stride: 0x1}, - unicode.Range16{Lo: 0x3a, Hi: 0x3a, Stride: 0x1}, - unicode.Range16{Lo: 0x55d, Hi: 0x55d, Stride: 0x1}, - unicode.Range16{Lo: 0x60c, Hi: 0x60d, Stride: 0x1}, - unicode.Range16{Lo: 0x7f8, Hi: 0x7f8, Stride: 0x1}, - unicode.Range16{Lo: 0x1802, Hi: 0x1802, Stride: 0x1}, - unicode.Range16{Lo: 0x1808, Hi: 0x1808, Stride: 0x1}, - unicode.Range16{Lo: 0x2013, Hi: 0x2014, Stride: 0x1}, - unicode.Range16{Lo: 0x3001, Hi: 0x3001, Stride: 0x1}, - unicode.Range16{Lo: 0xfe10, Hi: 0xfe11, Stride: 0x1}, - unicode.Range16{Lo: 0xfe13, Hi: 0xfe13, Stride: 0x1}, - unicode.Range16{Lo: 0xfe31, Hi: 0xfe32, Stride: 0x1}, - unicode.Range16{Lo: 0xfe50, Hi: 0xfe51, Stride: 0x1}, - unicode.Range16{Lo: 0xfe55, Hi: 0xfe55, Stride: 0x1}, - unicode.Range16{Lo: 0xfe58, Hi: 0xfe58, Stride: 0x1}, - unicode.Range16{Lo: 0xfe63, Hi: 0xfe63, Stride: 0x1}, - unicode.Range16{Lo: 0xff0c, Hi: 0xff0c, Stride: 0x1}, - unicode.Range16{Lo: 0xff0d, Hi: 0xff0d, Stride: 0x1}, - unicode.Range16{Lo: 0xff1a, Hi: 0xff1a, Stride: 0x1}, - unicode.Range16{Lo: 0xff64, Hi: 0xff64, Stride: 0x1}, - }, - LatinOffset: 3, -} - -var _SentenceSTerm = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x21, Hi: 0x21, Stride: 0x1}, - unicode.Range16{Lo: 0x3f, Hi: 0x3f, Stride: 0x1}, - unicode.Range16{Lo: 0x589, Hi: 0x589, Stride: 0x1}, - unicode.Range16{Lo: 0x61f, Hi: 0x61f, Stride: 0x1}, - unicode.Range16{Lo: 0x6d4, Hi: 0x6d4, Stride: 0x1}, - unicode.Range16{Lo: 0x700, Hi: 0x702, Stride: 0x1}, - unicode.Range16{Lo: 0x7f9, Hi: 0x7f9, Stride: 0x1}, - unicode.Range16{Lo: 0x964, Hi: 0x965, Stride: 0x1}, - unicode.Range16{Lo: 0x104a, Hi: 0x104b, Stride: 0x1}, - unicode.Range16{Lo: 0x1362, Hi: 0x1362, Stride: 0x1}, - unicode.Range16{Lo: 0x1367, Hi: 0x1368, Stride: 0x1}, - unicode.Range16{Lo: 0x166e, Hi: 0x166e, Stride: 0x1}, - unicode.Range16{Lo: 0x1735, Hi: 0x1736, Stride: 0x1}, - unicode.Range16{Lo: 0x1803, Hi: 0x1803, Stride: 0x1}, - unicode.Range16{Lo: 0x1809, Hi: 0x1809, Stride: 0x1}, - unicode.Range16{Lo: 0x1944, Hi: 0x1945, Stride: 0x1}, - unicode.Range16{Lo: 0x1aa8, Hi: 0x1aab, Stride: 0x1}, - unicode.Range16{Lo: 0x1b5a, Hi: 0x1b5b, Stride: 0x1}, - unicode.Range16{Lo: 0x1b5e, Hi: 0x1b5f, Stride: 0x1}, - unicode.Range16{Lo: 0x1c3b, Hi: 0x1c3c, Stride: 0x1}, - unicode.Range16{Lo: 0x1c7e, Hi: 0x1c7f, Stride: 0x1}, - unicode.Range16{Lo: 0x203c, Hi: 0x203d, Stride: 0x1}, - unicode.Range16{Lo: 0x2047, Hi: 0x2049, Stride: 0x1}, - unicode.Range16{Lo: 0x2e2e, Hi: 0x2e2e, Stride: 0x1}, - unicode.Range16{Lo: 0x2e3c, Hi: 0x2e3c, Stride: 0x1}, - unicode.Range16{Lo: 0x3002, Hi: 0x3002, Stride: 0x1}, - unicode.Range16{Lo: 0xa4ff, Hi: 0xa4ff, Stride: 0x1}, - unicode.Range16{Lo: 0xa60e, Hi: 0xa60f, Stride: 0x1}, - unicode.Range16{Lo: 0xa6f3, Hi: 0xa6f3, Stride: 0x1}, - unicode.Range16{Lo: 0xa6f7, Hi: 0xa6f7, Stride: 0x1}, - unicode.Range16{Lo: 0xa876, Hi: 0xa877, Stride: 0x1}, - unicode.Range16{Lo: 0xa8ce, Hi: 0xa8cf, Stride: 0x1}, - unicode.Range16{Lo: 0xa92f, Hi: 0xa92f, Stride: 0x1}, - unicode.Range16{Lo: 0xa9c8, Hi: 0xa9c9, Stride: 0x1}, - unicode.Range16{Lo: 0xaa5d, Hi: 0xaa5f, Stride: 0x1}, - unicode.Range16{Lo: 0xaaf0, Hi: 0xaaf1, Stride: 0x1}, - unicode.Range16{Lo: 0xabeb, Hi: 0xabeb, Stride: 0x1}, - unicode.Range16{Lo: 0xfe56, Hi: 0xfe57, Stride: 0x1}, - unicode.Range16{Lo: 0xff01, Hi: 0xff01, Stride: 0x1}, - unicode.Range16{Lo: 0xff1f, Hi: 0xff1f, Stride: 0x1}, - unicode.Range16{Lo: 0xff61, Hi: 0xff61, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x10a56, Hi: 0x10a57, Stride: 0x1}, - unicode.Range32{Lo: 0x11047, Hi: 0x11048, Stride: 0x1}, - unicode.Range32{Lo: 0x110be, Hi: 0x110c1, Stride: 0x1}, - unicode.Range32{Lo: 0x11141, Hi: 0x11143, Stride: 0x1}, - unicode.Range32{Lo: 0x111c5, Hi: 0x111c6, Stride: 0x1}, - unicode.Range32{Lo: 0x111cd, Hi: 0x111cd, Stride: 0x1}, - unicode.Range32{Lo: 0x111de, Hi: 0x111df, Stride: 0x1}, - unicode.Range32{Lo: 0x11238, Hi: 0x11239, Stride: 0x1}, - unicode.Range32{Lo: 0x1123b, Hi: 0x1123c, Stride: 0x1}, - unicode.Range32{Lo: 0x112a9, Hi: 0x112a9, Stride: 0x1}, - unicode.Range32{Lo: 0x1144b, Hi: 0x1144c, Stride: 0x1}, - unicode.Range32{Lo: 0x115c2, Hi: 0x115c3, Stride: 0x1}, - unicode.Range32{Lo: 0x115c9, Hi: 0x115d7, Stride: 0x1}, - unicode.Range32{Lo: 0x11641, Hi: 0x11642, Stride: 0x1}, - unicode.Range32{Lo: 0x1173c, Hi: 0x1173e, Stride: 0x1}, - unicode.Range32{Lo: 0x11c41, Hi: 0x11c42, Stride: 0x1}, - unicode.Range32{Lo: 0x16a6e, Hi: 0x16a6f, Stride: 0x1}, - unicode.Range32{Lo: 0x16af5, Hi: 0x16af5, Stride: 0x1}, - unicode.Range32{Lo: 0x16b37, Hi: 0x16b38, Stride: 0x1}, - unicode.Range32{Lo: 0x16b44, Hi: 0x16b44, Stride: 0x1}, - unicode.Range32{Lo: 0x1bc9f, Hi: 0x1bc9f, Stride: 0x1}, - unicode.Range32{Lo: 0x1da88, Hi: 0x1da88, Stride: 0x1}, - }, - LatinOffset: 2, -} - -var _SentenceSep = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x85, Hi: 0x85, Stride: 0x1}, - unicode.Range16{Lo: 0x2028, Hi: 0x2028, Stride: 0x1}, - unicode.Range16{Lo: 0x2029, Hi: 0x2029, Stride: 0x1}, - }, - LatinOffset: 1, -} - -var _SentenceSp = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x9, Hi: 0x9, Stride: 0x1}, - unicode.Range16{Lo: 0xb, Hi: 0xc, Stride: 0x1}, - unicode.Range16{Lo: 0x20, Hi: 0x20, Stride: 0x1}, - unicode.Range16{Lo: 0xa0, Hi: 0xa0, Stride: 0x1}, - unicode.Range16{Lo: 0x1680, Hi: 0x1680, Stride: 0x1}, - unicode.Range16{Lo: 0x2000, Hi: 0x200a, Stride: 0x1}, - unicode.Range16{Lo: 0x202f, Hi: 0x202f, Stride: 0x1}, - unicode.Range16{Lo: 0x205f, Hi: 0x205f, Stride: 0x1}, - unicode.Range16{Lo: 0x3000, Hi: 0x3000, Stride: 0x1}, - }, - LatinOffset: 4, -} - -var _SentenceUpper = &unicode.RangeTable{ - R16: []unicode.Range16{ - unicode.Range16{Lo: 0x41, Hi: 0x5a, Stride: 0x1}, - unicode.Range16{Lo: 0xc0, Hi: 0xd6, Stride: 0x1}, - unicode.Range16{Lo: 0xd8, Hi: 0xde, Stride: 0x1}, - unicode.Range16{Lo: 0x100, Hi: 0x100, Stride: 0x1}, - unicode.Range16{Lo: 0x102, Hi: 0x102, Stride: 0x1}, - unicode.Range16{Lo: 0x104, Hi: 0x104, Stride: 0x1}, - unicode.Range16{Lo: 0x106, Hi: 0x106, Stride: 0x1}, - unicode.Range16{Lo: 0x108, Hi: 0x108, Stride: 0x1}, - unicode.Range16{Lo: 0x10a, Hi: 0x10a, Stride: 0x1}, - unicode.Range16{Lo: 0x10c, Hi: 0x10c, Stride: 0x1}, - unicode.Range16{Lo: 0x10e, Hi: 0x10e, Stride: 0x1}, - unicode.Range16{Lo: 0x110, Hi: 0x110, Stride: 0x1}, - unicode.Range16{Lo: 0x112, Hi: 0x112, Stride: 0x1}, - unicode.Range16{Lo: 0x114, Hi: 0x114, Stride: 0x1}, - unicode.Range16{Lo: 0x116, Hi: 0x116, Stride: 0x1}, - unicode.Range16{Lo: 0x118, Hi: 0x118, Stride: 0x1}, - unicode.Range16{Lo: 0x11a, Hi: 0x11a, Stride: 0x1}, - unicode.Range16{Lo: 0x11c, Hi: 0x11c, Stride: 0x1}, - unicode.Range16{Lo: 0x11e, Hi: 0x11e, Stride: 0x1}, - unicode.Range16{Lo: 0x120, Hi: 0x120, Stride: 0x1}, - unicode.Range16{Lo: 0x122, Hi: 0x122, Stride: 0x1}, - unicode.Range16{Lo: 0x124, Hi: 0x124, Stride: 0x1}, - unicode.Range16{Lo: 0x126, Hi: 0x126, Stride: 0x1}, - unicode.Range16{Lo: 0x128, Hi: 0x128, Stride: 0x1}, - unicode.Range16{Lo: 0x12a, Hi: 0x12a, Stride: 0x1}, - unicode.Range16{Lo: 0x12c, Hi: 0x12c, Stride: 0x1}, - unicode.Range16{Lo: 0x12e, Hi: 0x12e, Stride: 0x1}, - unicode.Range16{Lo: 0x130, Hi: 0x130, Stride: 0x1}, - unicode.Range16{Lo: 0x132, Hi: 0x132, Stride: 0x1}, - unicode.Range16{Lo: 0x134, Hi: 0x134, Stride: 0x1}, - unicode.Range16{Lo: 0x136, Hi: 0x136, Stride: 0x1}, - unicode.Range16{Lo: 0x139, Hi: 0x139, Stride: 0x1}, - unicode.Range16{Lo: 0x13b, Hi: 0x13b, Stride: 0x1}, - unicode.Range16{Lo: 0x13d, Hi: 0x13d, Stride: 0x1}, - unicode.Range16{Lo: 0x13f, Hi: 0x13f, Stride: 0x1}, - unicode.Range16{Lo: 0x141, Hi: 0x141, Stride: 0x1}, - unicode.Range16{Lo: 0x143, Hi: 0x143, Stride: 0x1}, - unicode.Range16{Lo: 0x145, Hi: 0x145, Stride: 0x1}, - unicode.Range16{Lo: 0x147, Hi: 0x147, Stride: 0x1}, - unicode.Range16{Lo: 0x14a, Hi: 0x14a, Stride: 0x1}, - unicode.Range16{Lo: 0x14c, Hi: 0x14c, Stride: 0x1}, - unicode.Range16{Lo: 0x14e, Hi: 0x14e, Stride: 0x1}, - unicode.Range16{Lo: 0x150, Hi: 0x150, Stride: 0x1}, - unicode.Range16{Lo: 0x152, Hi: 0x152, Stride: 0x1}, - unicode.Range16{Lo: 0x154, Hi: 0x154, Stride: 0x1}, - unicode.Range16{Lo: 0x156, Hi: 0x156, Stride: 0x1}, - unicode.Range16{Lo: 0x158, Hi: 0x158, Stride: 0x1}, - unicode.Range16{Lo: 0x15a, Hi: 0x15a, Stride: 0x1}, - unicode.Range16{Lo: 0x15c, Hi: 0x15c, Stride: 0x1}, - unicode.Range16{Lo: 0x15e, Hi: 0x15e, Stride: 0x1}, - unicode.Range16{Lo: 0x160, Hi: 0x160, Stride: 0x1}, - unicode.Range16{Lo: 0x162, Hi: 0x162, Stride: 0x1}, - unicode.Range16{Lo: 0x164, Hi: 0x164, Stride: 0x1}, - unicode.Range16{Lo: 0x166, Hi: 0x166, Stride: 0x1}, - unicode.Range16{Lo: 0x168, Hi: 0x168, Stride: 0x1}, - unicode.Range16{Lo: 0x16a, Hi: 0x16a, Stride: 0x1}, - unicode.Range16{Lo: 0x16c, Hi: 0x16c, Stride: 0x1}, - unicode.Range16{Lo: 0x16e, Hi: 0x16e, Stride: 0x1}, - unicode.Range16{Lo: 0x170, Hi: 0x170, Stride: 0x1}, - unicode.Range16{Lo: 0x172, Hi: 0x172, Stride: 0x1}, - unicode.Range16{Lo: 0x174, Hi: 0x174, Stride: 0x1}, - unicode.Range16{Lo: 0x176, Hi: 0x176, Stride: 0x1}, - unicode.Range16{Lo: 0x178, Hi: 0x179, Stride: 0x1}, - unicode.Range16{Lo: 0x17b, Hi: 0x17b, Stride: 0x1}, - unicode.Range16{Lo: 0x17d, Hi: 0x17d, Stride: 0x1}, - unicode.Range16{Lo: 0x181, Hi: 0x182, Stride: 0x1}, - unicode.Range16{Lo: 0x184, Hi: 0x184, Stride: 0x1}, - unicode.Range16{Lo: 0x186, Hi: 0x187, Stride: 0x1}, - unicode.Range16{Lo: 0x189, Hi: 0x18b, Stride: 0x1}, - unicode.Range16{Lo: 0x18e, Hi: 0x191, Stride: 0x1}, - unicode.Range16{Lo: 0x193, Hi: 0x194, Stride: 0x1}, - unicode.Range16{Lo: 0x196, Hi: 0x198, Stride: 0x1}, - unicode.Range16{Lo: 0x19c, Hi: 0x19d, Stride: 0x1}, - unicode.Range16{Lo: 0x19f, Hi: 0x1a0, Stride: 0x1}, - unicode.Range16{Lo: 0x1a2, Hi: 0x1a2, Stride: 0x1}, - unicode.Range16{Lo: 0x1a4, Hi: 0x1a4, Stride: 0x1}, - unicode.Range16{Lo: 0x1a6, Hi: 0x1a7, Stride: 0x1}, - unicode.Range16{Lo: 0x1a9, Hi: 0x1a9, Stride: 0x1}, - unicode.Range16{Lo: 0x1ac, Hi: 0x1ac, Stride: 0x1}, - unicode.Range16{Lo: 0x1ae, Hi: 0x1af, Stride: 0x1}, - unicode.Range16{Lo: 0x1b1, Hi: 0x1b3, Stride: 0x1}, - unicode.Range16{Lo: 0x1b5, Hi: 0x1b5, Stride: 0x1}, - unicode.Range16{Lo: 0x1b7, Hi: 0x1b8, Stride: 0x1}, - unicode.Range16{Lo: 0x1bc, Hi: 0x1bc, Stride: 0x1}, - unicode.Range16{Lo: 0x1c4, Hi: 0x1c5, Stride: 0x1}, - unicode.Range16{Lo: 0x1c7, Hi: 0x1c8, Stride: 0x1}, - unicode.Range16{Lo: 0x1ca, Hi: 0x1cb, Stride: 0x1}, - unicode.Range16{Lo: 0x1cd, Hi: 0x1cd, Stride: 0x1}, - unicode.Range16{Lo: 0x1cf, Hi: 0x1cf, Stride: 0x1}, - unicode.Range16{Lo: 0x1d1, Hi: 0x1d1, Stride: 0x1}, - unicode.Range16{Lo: 0x1d3, Hi: 0x1d3, Stride: 0x1}, - unicode.Range16{Lo: 0x1d5, Hi: 0x1d5, Stride: 0x1}, - unicode.Range16{Lo: 0x1d7, Hi: 0x1d7, Stride: 0x1}, - unicode.Range16{Lo: 0x1d9, Hi: 0x1d9, Stride: 0x1}, - unicode.Range16{Lo: 0x1db, Hi: 0x1db, Stride: 0x1}, - unicode.Range16{Lo: 0x1de, Hi: 0x1de, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0, Hi: 0x1e0, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2, Hi: 0x1e2, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4, Hi: 0x1e4, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6, Hi: 0x1e6, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8, Hi: 0x1e8, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea, Hi: 0x1ea, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec, Hi: 0x1ec, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee, Hi: 0x1ee, Stride: 0x1}, - unicode.Range16{Lo: 0x1f1, Hi: 0x1f2, Stride: 0x1}, - unicode.Range16{Lo: 0x1f4, Hi: 0x1f4, Stride: 0x1}, - unicode.Range16{Lo: 0x1f6, Hi: 0x1f8, Stride: 0x1}, - unicode.Range16{Lo: 0x1fa, Hi: 0x1fa, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc, Hi: 0x1fc, Stride: 0x1}, - unicode.Range16{Lo: 0x1fe, Hi: 0x1fe, Stride: 0x1}, - unicode.Range16{Lo: 0x200, Hi: 0x200, Stride: 0x1}, - unicode.Range16{Lo: 0x202, Hi: 0x202, Stride: 0x1}, - unicode.Range16{Lo: 0x204, Hi: 0x204, Stride: 0x1}, - unicode.Range16{Lo: 0x206, Hi: 0x206, Stride: 0x1}, - unicode.Range16{Lo: 0x208, Hi: 0x208, Stride: 0x1}, - unicode.Range16{Lo: 0x20a, Hi: 0x20a, Stride: 0x1}, - unicode.Range16{Lo: 0x20c, Hi: 0x20c, Stride: 0x1}, - unicode.Range16{Lo: 0x20e, Hi: 0x20e, Stride: 0x1}, - unicode.Range16{Lo: 0x210, Hi: 0x210, Stride: 0x1}, - unicode.Range16{Lo: 0x212, Hi: 0x212, Stride: 0x1}, - unicode.Range16{Lo: 0x214, Hi: 0x214, Stride: 0x1}, - unicode.Range16{Lo: 0x216, Hi: 0x216, Stride: 0x1}, - unicode.Range16{Lo: 0x218, Hi: 0x218, Stride: 0x1}, - unicode.Range16{Lo: 0x21a, Hi: 0x21a, Stride: 0x1}, - unicode.Range16{Lo: 0x21c, Hi: 0x21c, Stride: 0x1}, - unicode.Range16{Lo: 0x21e, Hi: 0x21e, Stride: 0x1}, - unicode.Range16{Lo: 0x220, Hi: 0x220, Stride: 0x1}, - unicode.Range16{Lo: 0x222, Hi: 0x222, Stride: 0x1}, - unicode.Range16{Lo: 0x224, Hi: 0x224, Stride: 0x1}, - unicode.Range16{Lo: 0x226, Hi: 0x226, Stride: 0x1}, - unicode.Range16{Lo: 0x228, Hi: 0x228, Stride: 0x1}, - unicode.Range16{Lo: 0x22a, Hi: 0x22a, Stride: 0x1}, - unicode.Range16{Lo: 0x22c, Hi: 0x22c, Stride: 0x1}, - unicode.Range16{Lo: 0x22e, Hi: 0x22e, Stride: 0x1}, - unicode.Range16{Lo: 0x230, Hi: 0x230, Stride: 0x1}, - unicode.Range16{Lo: 0x232, Hi: 0x232, Stride: 0x1}, - unicode.Range16{Lo: 0x23a, Hi: 0x23b, Stride: 0x1}, - unicode.Range16{Lo: 0x23d, Hi: 0x23e, Stride: 0x1}, - unicode.Range16{Lo: 0x241, Hi: 0x241, Stride: 0x1}, - unicode.Range16{Lo: 0x243, Hi: 0x246, Stride: 0x1}, - unicode.Range16{Lo: 0x248, Hi: 0x248, Stride: 0x1}, - unicode.Range16{Lo: 0x24a, Hi: 0x24a, Stride: 0x1}, - unicode.Range16{Lo: 0x24c, Hi: 0x24c, Stride: 0x1}, - unicode.Range16{Lo: 0x24e, Hi: 0x24e, Stride: 0x1}, - unicode.Range16{Lo: 0x370, Hi: 0x370, Stride: 0x1}, - unicode.Range16{Lo: 0x372, Hi: 0x372, Stride: 0x1}, - unicode.Range16{Lo: 0x376, Hi: 0x376, Stride: 0x1}, - unicode.Range16{Lo: 0x37f, Hi: 0x37f, Stride: 0x1}, - unicode.Range16{Lo: 0x386, Hi: 0x386, Stride: 0x1}, - unicode.Range16{Lo: 0x388, Hi: 0x38a, Stride: 0x1}, - unicode.Range16{Lo: 0x38c, Hi: 0x38c, Stride: 0x1}, - unicode.Range16{Lo: 0x38e, Hi: 0x38f, Stride: 0x1}, - unicode.Range16{Lo: 0x391, Hi: 0x3a1, Stride: 0x1}, - unicode.Range16{Lo: 0x3a3, Hi: 0x3ab, Stride: 0x1}, - unicode.Range16{Lo: 0x3cf, Hi: 0x3cf, Stride: 0x1}, - unicode.Range16{Lo: 0x3d2, Hi: 0x3d4, Stride: 0x1}, - unicode.Range16{Lo: 0x3d8, Hi: 0x3d8, Stride: 0x1}, - unicode.Range16{Lo: 0x3da, Hi: 0x3da, Stride: 0x1}, - unicode.Range16{Lo: 0x3dc, Hi: 0x3dc, Stride: 0x1}, - unicode.Range16{Lo: 0x3de, Hi: 0x3de, Stride: 0x1}, - unicode.Range16{Lo: 0x3e0, Hi: 0x3e0, Stride: 0x1}, - unicode.Range16{Lo: 0x3e2, Hi: 0x3e2, Stride: 0x1}, - unicode.Range16{Lo: 0x3e4, Hi: 0x3e4, Stride: 0x1}, - unicode.Range16{Lo: 0x3e6, Hi: 0x3e6, Stride: 0x1}, - unicode.Range16{Lo: 0x3e8, Hi: 0x3e8, Stride: 0x1}, - unicode.Range16{Lo: 0x3ea, Hi: 0x3ea, Stride: 0x1}, - unicode.Range16{Lo: 0x3ec, Hi: 0x3ec, Stride: 0x1}, - unicode.Range16{Lo: 0x3ee, Hi: 0x3ee, Stride: 0x1}, - unicode.Range16{Lo: 0x3f4, Hi: 0x3f4, Stride: 0x1}, - unicode.Range16{Lo: 0x3f7, Hi: 0x3f7, Stride: 0x1}, - unicode.Range16{Lo: 0x3f9, Hi: 0x3fa, Stride: 0x1}, - unicode.Range16{Lo: 0x3fd, Hi: 0x42f, Stride: 0x1}, - unicode.Range16{Lo: 0x460, Hi: 0x460, Stride: 0x1}, - unicode.Range16{Lo: 0x462, Hi: 0x462, Stride: 0x1}, - unicode.Range16{Lo: 0x464, Hi: 0x464, Stride: 0x1}, - unicode.Range16{Lo: 0x466, Hi: 0x466, Stride: 0x1}, - unicode.Range16{Lo: 0x468, Hi: 0x468, Stride: 0x1}, - unicode.Range16{Lo: 0x46a, Hi: 0x46a, Stride: 0x1}, - unicode.Range16{Lo: 0x46c, Hi: 0x46c, Stride: 0x1}, - unicode.Range16{Lo: 0x46e, Hi: 0x46e, Stride: 0x1}, - unicode.Range16{Lo: 0x470, Hi: 0x470, Stride: 0x1}, - unicode.Range16{Lo: 0x472, Hi: 0x472, Stride: 0x1}, - unicode.Range16{Lo: 0x474, Hi: 0x474, Stride: 0x1}, - unicode.Range16{Lo: 0x476, Hi: 0x476, Stride: 0x1}, - unicode.Range16{Lo: 0x478, Hi: 0x478, Stride: 0x1}, - unicode.Range16{Lo: 0x47a, Hi: 0x47a, Stride: 0x1}, - unicode.Range16{Lo: 0x47c, Hi: 0x47c, Stride: 0x1}, - unicode.Range16{Lo: 0x47e, Hi: 0x47e, Stride: 0x1}, - unicode.Range16{Lo: 0x480, Hi: 0x480, Stride: 0x1}, - unicode.Range16{Lo: 0x48a, Hi: 0x48a, Stride: 0x1}, - unicode.Range16{Lo: 0x48c, Hi: 0x48c, Stride: 0x1}, - unicode.Range16{Lo: 0x48e, Hi: 0x48e, Stride: 0x1}, - unicode.Range16{Lo: 0x490, Hi: 0x490, Stride: 0x1}, - unicode.Range16{Lo: 0x492, Hi: 0x492, Stride: 0x1}, - unicode.Range16{Lo: 0x494, Hi: 0x494, Stride: 0x1}, - unicode.Range16{Lo: 0x496, Hi: 0x496, Stride: 0x1}, - unicode.Range16{Lo: 0x498, Hi: 0x498, Stride: 0x1}, - unicode.Range16{Lo: 0x49a, Hi: 0x49a, Stride: 0x1}, - unicode.Range16{Lo: 0x49c, Hi: 0x49c, Stride: 0x1}, - unicode.Range16{Lo: 0x49e, Hi: 0x49e, Stride: 0x1}, - unicode.Range16{Lo: 0x4a0, Hi: 0x4a0, Stride: 0x1}, - unicode.Range16{Lo: 0x4a2, Hi: 0x4a2, Stride: 0x1}, - unicode.Range16{Lo: 0x4a4, Hi: 0x4a4, Stride: 0x1}, - unicode.Range16{Lo: 0x4a6, Hi: 0x4a6, Stride: 0x1}, - unicode.Range16{Lo: 0x4a8, Hi: 0x4a8, Stride: 0x1}, - unicode.Range16{Lo: 0x4aa, Hi: 0x4aa, Stride: 0x1}, - unicode.Range16{Lo: 0x4ac, Hi: 0x4ac, Stride: 0x1}, - unicode.Range16{Lo: 0x4ae, Hi: 0x4ae, Stride: 0x1}, - unicode.Range16{Lo: 0x4b0, Hi: 0x4b0, Stride: 0x1}, - unicode.Range16{Lo: 0x4b2, Hi: 0x4b2, Stride: 0x1}, - unicode.Range16{Lo: 0x4b4, Hi: 0x4b4, Stride: 0x1}, - unicode.Range16{Lo: 0x4b6, Hi: 0x4b6, Stride: 0x1}, - unicode.Range16{Lo: 0x4b8, Hi: 0x4b8, Stride: 0x1}, - unicode.Range16{Lo: 0x4ba, Hi: 0x4ba, Stride: 0x1}, - unicode.Range16{Lo: 0x4bc, Hi: 0x4bc, Stride: 0x1}, - unicode.Range16{Lo: 0x4be, Hi: 0x4be, Stride: 0x1}, - unicode.Range16{Lo: 0x4c0, Hi: 0x4c1, Stride: 0x1}, - unicode.Range16{Lo: 0x4c3, Hi: 0x4c3, Stride: 0x1}, - unicode.Range16{Lo: 0x4c5, Hi: 0x4c5, Stride: 0x1}, - unicode.Range16{Lo: 0x4c7, Hi: 0x4c7, Stride: 0x1}, - unicode.Range16{Lo: 0x4c9, Hi: 0x4c9, Stride: 0x1}, - unicode.Range16{Lo: 0x4cb, Hi: 0x4cb, Stride: 0x1}, - unicode.Range16{Lo: 0x4cd, Hi: 0x4cd, Stride: 0x1}, - unicode.Range16{Lo: 0x4d0, Hi: 0x4d0, Stride: 0x1}, - unicode.Range16{Lo: 0x4d2, Hi: 0x4d2, Stride: 0x1}, - unicode.Range16{Lo: 0x4d4, Hi: 0x4d4, Stride: 0x1}, - unicode.Range16{Lo: 0x4d6, Hi: 0x4d6, Stride: 0x1}, - unicode.Range16{Lo: 0x4d8, Hi: 0x4d8, Stride: 0x1}, - unicode.Range16{Lo: 0x4da, Hi: 0x4da, Stride: 0x1}, - unicode.Range16{Lo: 0x4dc, Hi: 0x4dc, Stride: 0x1}, - unicode.Range16{Lo: 0x4de, Hi: 0x4de, Stride: 0x1}, - unicode.Range16{Lo: 0x4e0, Hi: 0x4e0, Stride: 0x1}, - unicode.Range16{Lo: 0x4e2, Hi: 0x4e2, Stride: 0x1}, - unicode.Range16{Lo: 0x4e4, Hi: 0x4e4, Stride: 0x1}, - unicode.Range16{Lo: 0x4e6, Hi: 0x4e6, Stride: 0x1}, - unicode.Range16{Lo: 0x4e8, Hi: 0x4e8, Stride: 0x1}, - unicode.Range16{Lo: 0x4ea, Hi: 0x4ea, Stride: 0x1}, - unicode.Range16{Lo: 0x4ec, Hi: 0x4ec, Stride: 0x1}, - unicode.Range16{Lo: 0x4ee, Hi: 0x4ee, Stride: 0x1}, - unicode.Range16{Lo: 0x4f0, Hi: 0x4f0, Stride: 0x1}, - unicode.Range16{Lo: 0x4f2, Hi: 0x4f2, Stride: 0x1}, - unicode.Range16{Lo: 0x4f4, Hi: 0x4f4, Stride: 0x1}, - unicode.Range16{Lo: 0x4f6, Hi: 0x4f6, Stride: 0x1}, - unicode.Range16{Lo: 0x4f8, Hi: 0x4f8, Stride: 0x1}, - unicode.Range16{Lo: 0x4fa, Hi: 0x4fa, Stride: 0x1}, - unicode.Range16{Lo: 0x4fc, Hi: 0x4fc, Stride: 0x1}, - unicode.Range16{Lo: 0x4fe, Hi: 0x4fe, Stride: 0x1}, - unicode.Range16{Lo: 0x500, Hi: 0x500, Stride: 0x1}, - unicode.Range16{Lo: 0x502, Hi: 0x502, Stride: 0x1}, - unicode.Range16{Lo: 0x504, Hi: 0x504, Stride: 0x1}, - unicode.Range16{Lo: 0x506, Hi: 0x506, Stride: 0x1}, - unicode.Range16{Lo: 0x508, Hi: 0x508, Stride: 0x1}, - unicode.Range16{Lo: 0x50a, Hi: 0x50a, Stride: 0x1}, - unicode.Range16{Lo: 0x50c, Hi: 0x50c, Stride: 0x1}, - unicode.Range16{Lo: 0x50e, Hi: 0x50e, Stride: 0x1}, - unicode.Range16{Lo: 0x510, Hi: 0x510, Stride: 0x1}, - unicode.Range16{Lo: 0x512, Hi: 0x512, Stride: 0x1}, - unicode.Range16{Lo: 0x514, Hi: 0x514, Stride: 0x1}, - unicode.Range16{Lo: 0x516, Hi: 0x516, Stride: 0x1}, - unicode.Range16{Lo: 0x518, Hi: 0x518, Stride: 0x1}, - unicode.Range16{Lo: 0x51a, Hi: 0x51a, Stride: 0x1}, - unicode.Range16{Lo: 0x51c, Hi: 0x51c, Stride: 0x1}, - unicode.Range16{Lo: 0x51e, Hi: 0x51e, Stride: 0x1}, - unicode.Range16{Lo: 0x520, Hi: 0x520, Stride: 0x1}, - unicode.Range16{Lo: 0x522, Hi: 0x522, Stride: 0x1}, - unicode.Range16{Lo: 0x524, Hi: 0x524, Stride: 0x1}, - unicode.Range16{Lo: 0x526, Hi: 0x526, Stride: 0x1}, - unicode.Range16{Lo: 0x528, Hi: 0x528, Stride: 0x1}, - unicode.Range16{Lo: 0x52a, Hi: 0x52a, Stride: 0x1}, - unicode.Range16{Lo: 0x52c, Hi: 0x52c, Stride: 0x1}, - unicode.Range16{Lo: 0x52e, Hi: 0x52e, Stride: 0x1}, - unicode.Range16{Lo: 0x531, Hi: 0x556, Stride: 0x1}, - unicode.Range16{Lo: 0x10a0, Hi: 0x10c5, Stride: 0x1}, - unicode.Range16{Lo: 0x10c7, Hi: 0x10c7, Stride: 0x1}, - unicode.Range16{Lo: 0x10cd, Hi: 0x10cd, Stride: 0x1}, - unicode.Range16{Lo: 0x13a0, Hi: 0x13f5, Stride: 0x1}, - unicode.Range16{Lo: 0x1e00, Hi: 0x1e00, Stride: 0x1}, - unicode.Range16{Lo: 0x1e02, Hi: 0x1e02, Stride: 0x1}, - unicode.Range16{Lo: 0x1e04, Hi: 0x1e04, Stride: 0x1}, - unicode.Range16{Lo: 0x1e06, Hi: 0x1e06, Stride: 0x1}, - unicode.Range16{Lo: 0x1e08, Hi: 0x1e08, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0a, Hi: 0x1e0a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0c, Hi: 0x1e0c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e0e, Hi: 0x1e0e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e10, Hi: 0x1e10, Stride: 0x1}, - unicode.Range16{Lo: 0x1e12, Hi: 0x1e12, Stride: 0x1}, - unicode.Range16{Lo: 0x1e14, Hi: 0x1e14, Stride: 0x1}, - unicode.Range16{Lo: 0x1e16, Hi: 0x1e16, Stride: 0x1}, - unicode.Range16{Lo: 0x1e18, Hi: 0x1e18, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1a, Hi: 0x1e1a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1c, Hi: 0x1e1c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e1e, Hi: 0x1e1e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e20, Hi: 0x1e20, Stride: 0x1}, - unicode.Range16{Lo: 0x1e22, Hi: 0x1e22, Stride: 0x1}, - unicode.Range16{Lo: 0x1e24, Hi: 0x1e24, Stride: 0x1}, - unicode.Range16{Lo: 0x1e26, Hi: 0x1e26, Stride: 0x1}, - unicode.Range16{Lo: 0x1e28, Hi: 0x1e28, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2a, Hi: 0x1e2a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2c, Hi: 0x1e2c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e2e, Hi: 0x1e2e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e30, Hi: 0x1e30, Stride: 0x1}, - unicode.Range16{Lo: 0x1e32, Hi: 0x1e32, Stride: 0x1}, - unicode.Range16{Lo: 0x1e34, Hi: 0x1e34, Stride: 0x1}, - unicode.Range16{Lo: 0x1e36, Hi: 0x1e36, Stride: 0x1}, - unicode.Range16{Lo: 0x1e38, Hi: 0x1e38, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3a, Hi: 0x1e3a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3c, Hi: 0x1e3c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e3e, Hi: 0x1e3e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e40, Hi: 0x1e40, Stride: 0x1}, - unicode.Range16{Lo: 0x1e42, Hi: 0x1e42, Stride: 0x1}, - unicode.Range16{Lo: 0x1e44, Hi: 0x1e44, Stride: 0x1}, - unicode.Range16{Lo: 0x1e46, Hi: 0x1e46, Stride: 0x1}, - unicode.Range16{Lo: 0x1e48, Hi: 0x1e48, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4a, Hi: 0x1e4a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4c, Hi: 0x1e4c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e4e, Hi: 0x1e4e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e50, Hi: 0x1e50, Stride: 0x1}, - unicode.Range16{Lo: 0x1e52, Hi: 0x1e52, Stride: 0x1}, - unicode.Range16{Lo: 0x1e54, Hi: 0x1e54, Stride: 0x1}, - unicode.Range16{Lo: 0x1e56, Hi: 0x1e56, Stride: 0x1}, - unicode.Range16{Lo: 0x1e58, Hi: 0x1e58, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5a, Hi: 0x1e5a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5c, Hi: 0x1e5c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e5e, Hi: 0x1e5e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e60, Hi: 0x1e60, Stride: 0x1}, - unicode.Range16{Lo: 0x1e62, Hi: 0x1e62, Stride: 0x1}, - unicode.Range16{Lo: 0x1e64, Hi: 0x1e64, Stride: 0x1}, - unicode.Range16{Lo: 0x1e66, Hi: 0x1e66, Stride: 0x1}, - unicode.Range16{Lo: 0x1e68, Hi: 0x1e68, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6a, Hi: 0x1e6a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6c, Hi: 0x1e6c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e6e, Hi: 0x1e6e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e70, Hi: 0x1e70, Stride: 0x1}, - unicode.Range16{Lo: 0x1e72, Hi: 0x1e72, Stride: 0x1}, - unicode.Range16{Lo: 0x1e74, Hi: 0x1e74, Stride: 0x1}, - unicode.Range16{Lo: 0x1e76, Hi: 0x1e76, Stride: 0x1}, - unicode.Range16{Lo: 0x1e78, Hi: 0x1e78, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7a, Hi: 0x1e7a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7c, Hi: 0x1e7c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e7e, Hi: 0x1e7e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e80, Hi: 0x1e80, Stride: 0x1}, - unicode.Range16{Lo: 0x1e82, Hi: 0x1e82, Stride: 0x1}, - unicode.Range16{Lo: 0x1e84, Hi: 0x1e84, Stride: 0x1}, - unicode.Range16{Lo: 0x1e86, Hi: 0x1e86, Stride: 0x1}, - unicode.Range16{Lo: 0x1e88, Hi: 0x1e88, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8a, Hi: 0x1e8a, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8c, Hi: 0x1e8c, Stride: 0x1}, - unicode.Range16{Lo: 0x1e8e, Hi: 0x1e8e, Stride: 0x1}, - unicode.Range16{Lo: 0x1e90, Hi: 0x1e90, Stride: 0x1}, - unicode.Range16{Lo: 0x1e92, Hi: 0x1e92, Stride: 0x1}, - unicode.Range16{Lo: 0x1e94, Hi: 0x1e94, Stride: 0x1}, - unicode.Range16{Lo: 0x1e9e, Hi: 0x1e9e, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea0, Hi: 0x1ea0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea2, Hi: 0x1ea2, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea4, Hi: 0x1ea4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea6, Hi: 0x1ea6, Stride: 0x1}, - unicode.Range16{Lo: 0x1ea8, Hi: 0x1ea8, Stride: 0x1}, - unicode.Range16{Lo: 0x1eaa, Hi: 0x1eaa, Stride: 0x1}, - unicode.Range16{Lo: 0x1eac, Hi: 0x1eac, Stride: 0x1}, - unicode.Range16{Lo: 0x1eae, Hi: 0x1eae, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb0, Hi: 0x1eb0, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb2, Hi: 0x1eb2, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb4, Hi: 0x1eb4, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb6, Hi: 0x1eb6, Stride: 0x1}, - unicode.Range16{Lo: 0x1eb8, Hi: 0x1eb8, Stride: 0x1}, - unicode.Range16{Lo: 0x1eba, Hi: 0x1eba, Stride: 0x1}, - unicode.Range16{Lo: 0x1ebc, Hi: 0x1ebc, Stride: 0x1}, - unicode.Range16{Lo: 0x1ebe, Hi: 0x1ebe, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec0, Hi: 0x1ec0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec2, Hi: 0x1ec2, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec4, Hi: 0x1ec4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec6, Hi: 0x1ec6, Stride: 0x1}, - unicode.Range16{Lo: 0x1ec8, Hi: 0x1ec8, Stride: 0x1}, - unicode.Range16{Lo: 0x1eca, Hi: 0x1eca, Stride: 0x1}, - unicode.Range16{Lo: 0x1ecc, Hi: 0x1ecc, Stride: 0x1}, - unicode.Range16{Lo: 0x1ece, Hi: 0x1ece, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed0, Hi: 0x1ed0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed2, Hi: 0x1ed2, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed4, Hi: 0x1ed4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed6, Hi: 0x1ed6, Stride: 0x1}, - unicode.Range16{Lo: 0x1ed8, Hi: 0x1ed8, Stride: 0x1}, - unicode.Range16{Lo: 0x1eda, Hi: 0x1eda, Stride: 0x1}, - unicode.Range16{Lo: 0x1edc, Hi: 0x1edc, Stride: 0x1}, - unicode.Range16{Lo: 0x1ede, Hi: 0x1ede, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee0, Hi: 0x1ee0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee2, Hi: 0x1ee2, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee4, Hi: 0x1ee4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee6, Hi: 0x1ee6, Stride: 0x1}, - unicode.Range16{Lo: 0x1ee8, Hi: 0x1ee8, Stride: 0x1}, - unicode.Range16{Lo: 0x1eea, Hi: 0x1eea, Stride: 0x1}, - unicode.Range16{Lo: 0x1eec, Hi: 0x1eec, Stride: 0x1}, - unicode.Range16{Lo: 0x1eee, Hi: 0x1eee, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef0, Hi: 0x1ef0, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef2, Hi: 0x1ef2, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef4, Hi: 0x1ef4, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef6, Hi: 0x1ef6, Stride: 0x1}, - unicode.Range16{Lo: 0x1ef8, Hi: 0x1ef8, Stride: 0x1}, - unicode.Range16{Lo: 0x1efa, Hi: 0x1efa, Stride: 0x1}, - unicode.Range16{Lo: 0x1efc, Hi: 0x1efc, Stride: 0x1}, - unicode.Range16{Lo: 0x1efe, Hi: 0x1efe, Stride: 0x1}, - unicode.Range16{Lo: 0x1f08, Hi: 0x1f0f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f18, Hi: 0x1f1d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f28, Hi: 0x1f2f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f38, Hi: 0x1f3f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f48, Hi: 0x1f4d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f59, Hi: 0x1f59, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5b, Hi: 0x1f5b, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5d, Hi: 0x1f5d, Stride: 0x1}, - unicode.Range16{Lo: 0x1f5f, Hi: 0x1f5f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f68, Hi: 0x1f6f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f88, Hi: 0x1f8f, Stride: 0x1}, - unicode.Range16{Lo: 0x1f98, Hi: 0x1f9f, Stride: 0x1}, - unicode.Range16{Lo: 0x1fa8, Hi: 0x1faf, Stride: 0x1}, - unicode.Range16{Lo: 0x1fb8, Hi: 0x1fbc, Stride: 0x1}, - unicode.Range16{Lo: 0x1fc8, Hi: 0x1fcc, Stride: 0x1}, - unicode.Range16{Lo: 0x1fd8, Hi: 0x1fdb, Stride: 0x1}, - unicode.Range16{Lo: 0x1fe8, Hi: 0x1fec, Stride: 0x1}, - unicode.Range16{Lo: 0x1ff8, Hi: 0x1ffc, Stride: 0x1}, - unicode.Range16{Lo: 0x2102, Hi: 0x2102, Stride: 0x1}, - unicode.Range16{Lo: 0x2107, Hi: 0x2107, Stride: 0x1}, - unicode.Range16{Lo: 0x210b, Hi: 0x210d, Stride: 0x1}, - unicode.Range16{Lo: 0x2110, Hi: 0x2112, Stride: 0x1}, - unicode.Range16{Lo: 0x2115, Hi: 0x2115, Stride: 0x1}, - unicode.Range16{Lo: 0x2119, Hi: 0x211d, Stride: 0x1}, - unicode.Range16{Lo: 0x2124, Hi: 0x2124, Stride: 0x1}, - unicode.Range16{Lo: 0x2126, Hi: 0x2126, Stride: 0x1}, - unicode.Range16{Lo: 0x2128, Hi: 0x2128, Stride: 0x1}, - unicode.Range16{Lo: 0x212a, Hi: 0x212d, Stride: 0x1}, - unicode.Range16{Lo: 0x2130, Hi: 0x2133, Stride: 0x1}, - unicode.Range16{Lo: 0x213e, Hi: 0x213f, Stride: 0x1}, - unicode.Range16{Lo: 0x2145, Hi: 0x2145, Stride: 0x1}, - unicode.Range16{Lo: 0x2160, Hi: 0x216f, Stride: 0x1}, - unicode.Range16{Lo: 0x2183, Hi: 0x2183, Stride: 0x1}, - unicode.Range16{Lo: 0x24b6, Hi: 0x24cf, Stride: 0x1}, - unicode.Range16{Lo: 0x2c00, Hi: 0x2c2e, Stride: 0x1}, - unicode.Range16{Lo: 0x2c60, Hi: 0x2c60, Stride: 0x1}, - unicode.Range16{Lo: 0x2c62, Hi: 0x2c64, Stride: 0x1}, - unicode.Range16{Lo: 0x2c67, Hi: 0x2c67, Stride: 0x1}, - unicode.Range16{Lo: 0x2c69, Hi: 0x2c69, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6b, Hi: 0x2c6b, Stride: 0x1}, - unicode.Range16{Lo: 0x2c6d, Hi: 0x2c70, Stride: 0x1}, - unicode.Range16{Lo: 0x2c72, Hi: 0x2c72, Stride: 0x1}, - unicode.Range16{Lo: 0x2c75, Hi: 0x2c75, Stride: 0x1}, - unicode.Range16{Lo: 0x2c7e, Hi: 0x2c80, Stride: 0x1}, - unicode.Range16{Lo: 0x2c82, Hi: 0x2c82, Stride: 0x1}, - unicode.Range16{Lo: 0x2c84, Hi: 0x2c84, Stride: 0x1}, - unicode.Range16{Lo: 0x2c86, Hi: 0x2c86, Stride: 0x1}, - unicode.Range16{Lo: 0x2c88, Hi: 0x2c88, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8a, Hi: 0x2c8a, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8c, Hi: 0x2c8c, Stride: 0x1}, - unicode.Range16{Lo: 0x2c8e, Hi: 0x2c8e, Stride: 0x1}, - unicode.Range16{Lo: 0x2c90, Hi: 0x2c90, Stride: 0x1}, - unicode.Range16{Lo: 0x2c92, Hi: 0x2c92, Stride: 0x1}, - unicode.Range16{Lo: 0x2c94, Hi: 0x2c94, Stride: 0x1}, - unicode.Range16{Lo: 0x2c96, Hi: 0x2c96, Stride: 0x1}, - unicode.Range16{Lo: 0x2c98, Hi: 0x2c98, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9a, Hi: 0x2c9a, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9c, Hi: 0x2c9c, Stride: 0x1}, - unicode.Range16{Lo: 0x2c9e, Hi: 0x2c9e, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca0, Hi: 0x2ca0, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca2, Hi: 0x2ca2, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca4, Hi: 0x2ca4, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca6, Hi: 0x2ca6, Stride: 0x1}, - unicode.Range16{Lo: 0x2ca8, Hi: 0x2ca8, Stride: 0x1}, - unicode.Range16{Lo: 0x2caa, Hi: 0x2caa, Stride: 0x1}, - unicode.Range16{Lo: 0x2cac, Hi: 0x2cac, Stride: 0x1}, - unicode.Range16{Lo: 0x2cae, Hi: 0x2cae, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb0, Hi: 0x2cb0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb2, Hi: 0x2cb2, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb4, Hi: 0x2cb4, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb6, Hi: 0x2cb6, Stride: 0x1}, - unicode.Range16{Lo: 0x2cb8, Hi: 0x2cb8, Stride: 0x1}, - unicode.Range16{Lo: 0x2cba, Hi: 0x2cba, Stride: 0x1}, - unicode.Range16{Lo: 0x2cbc, Hi: 0x2cbc, Stride: 0x1}, - unicode.Range16{Lo: 0x2cbe, Hi: 0x2cbe, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc0, Hi: 0x2cc0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc2, Hi: 0x2cc2, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc4, Hi: 0x2cc4, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc6, Hi: 0x2cc6, Stride: 0x1}, - unicode.Range16{Lo: 0x2cc8, Hi: 0x2cc8, Stride: 0x1}, - unicode.Range16{Lo: 0x2cca, Hi: 0x2cca, Stride: 0x1}, - unicode.Range16{Lo: 0x2ccc, Hi: 0x2ccc, Stride: 0x1}, - unicode.Range16{Lo: 0x2cce, Hi: 0x2cce, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd0, Hi: 0x2cd0, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd2, Hi: 0x2cd2, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd4, Hi: 0x2cd4, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd6, Hi: 0x2cd6, Stride: 0x1}, - unicode.Range16{Lo: 0x2cd8, Hi: 0x2cd8, Stride: 0x1}, - unicode.Range16{Lo: 0x2cda, Hi: 0x2cda, Stride: 0x1}, - unicode.Range16{Lo: 0x2cdc, Hi: 0x2cdc, Stride: 0x1}, - unicode.Range16{Lo: 0x2cde, Hi: 0x2cde, Stride: 0x1}, - unicode.Range16{Lo: 0x2ce0, Hi: 0x2ce0, Stride: 0x1}, - unicode.Range16{Lo: 0x2ce2, Hi: 0x2ce2, Stride: 0x1}, - unicode.Range16{Lo: 0x2ceb, Hi: 0x2ceb, Stride: 0x1}, - unicode.Range16{Lo: 0x2ced, Hi: 0x2ced, Stride: 0x1}, - unicode.Range16{Lo: 0x2cf2, Hi: 0x2cf2, Stride: 0x1}, - unicode.Range16{Lo: 0xa640, Hi: 0xa640, Stride: 0x1}, - unicode.Range16{Lo: 0xa642, Hi: 0xa642, Stride: 0x1}, - unicode.Range16{Lo: 0xa644, Hi: 0xa644, Stride: 0x1}, - unicode.Range16{Lo: 0xa646, Hi: 0xa646, Stride: 0x1}, - unicode.Range16{Lo: 0xa648, Hi: 0xa648, Stride: 0x1}, - unicode.Range16{Lo: 0xa64a, Hi: 0xa64a, Stride: 0x1}, - unicode.Range16{Lo: 0xa64c, Hi: 0xa64c, Stride: 0x1}, - unicode.Range16{Lo: 0xa64e, Hi: 0xa64e, Stride: 0x1}, - unicode.Range16{Lo: 0xa650, Hi: 0xa650, Stride: 0x1}, - unicode.Range16{Lo: 0xa652, Hi: 0xa652, Stride: 0x1}, - unicode.Range16{Lo: 0xa654, Hi: 0xa654, Stride: 0x1}, - unicode.Range16{Lo: 0xa656, Hi: 0xa656, Stride: 0x1}, - unicode.Range16{Lo: 0xa658, Hi: 0xa658, Stride: 0x1}, - unicode.Range16{Lo: 0xa65a, Hi: 0xa65a, Stride: 0x1}, - unicode.Range16{Lo: 0xa65c, Hi: 0xa65c, Stride: 0x1}, - unicode.Range16{Lo: 0xa65e, Hi: 0xa65e, Stride: 0x1}, - unicode.Range16{Lo: 0xa660, Hi: 0xa660, Stride: 0x1}, - unicode.Range16{Lo: 0xa662, Hi: 0xa662, Stride: 0x1}, - unicode.Range16{Lo: 0xa664, Hi: 0xa664, Stride: 0x1}, - unicode.Range16{Lo: 0xa666, Hi: 0xa666, Stride: 0x1}, - unicode.Range16{Lo: 0xa668, Hi: 0xa668, Stride: 0x1}, - unicode.Range16{Lo: 0xa66a, Hi: 0xa66a, Stride: 0x1}, - unicode.Range16{Lo: 0xa66c, Hi: 0xa66c, Stride: 0x1}, - unicode.Range16{Lo: 0xa680, Hi: 0xa680, Stride: 0x1}, - unicode.Range16{Lo: 0xa682, Hi: 0xa682, Stride: 0x1}, - unicode.Range16{Lo: 0xa684, Hi: 0xa684, Stride: 0x1}, - unicode.Range16{Lo: 0xa686, Hi: 0xa686, Stride: 0x1}, - unicode.Range16{Lo: 0xa688, Hi: 0xa688, Stride: 0x1}, - unicode.Range16{Lo: 0xa68a, Hi: 0xa68a, Stride: 0x1}, - unicode.Range16{Lo: 0xa68c, Hi: 0xa68c, Stride: 0x1}, - unicode.Range16{Lo: 0xa68e, Hi: 0xa68e, Stride: 0x1}, - unicode.Range16{Lo: 0xa690, Hi: 0xa690, Stride: 0x1}, - unicode.Range16{Lo: 0xa692, Hi: 0xa692, Stride: 0x1}, - unicode.Range16{Lo: 0xa694, Hi: 0xa694, Stride: 0x1}, - unicode.Range16{Lo: 0xa696, Hi: 0xa696, Stride: 0x1}, - unicode.Range16{Lo: 0xa698, Hi: 0xa698, Stride: 0x1}, - unicode.Range16{Lo: 0xa69a, Hi: 0xa69a, Stride: 0x1}, - unicode.Range16{Lo: 0xa722, Hi: 0xa722, Stride: 0x1}, - unicode.Range16{Lo: 0xa724, Hi: 0xa724, Stride: 0x1}, - unicode.Range16{Lo: 0xa726, Hi: 0xa726, Stride: 0x1}, - unicode.Range16{Lo: 0xa728, Hi: 0xa728, Stride: 0x1}, - unicode.Range16{Lo: 0xa72a, Hi: 0xa72a, Stride: 0x1}, - unicode.Range16{Lo: 0xa72c, Hi: 0xa72c, Stride: 0x1}, - unicode.Range16{Lo: 0xa72e, Hi: 0xa72e, Stride: 0x1}, - unicode.Range16{Lo: 0xa732, Hi: 0xa732, Stride: 0x1}, - unicode.Range16{Lo: 0xa734, Hi: 0xa734, Stride: 0x1}, - unicode.Range16{Lo: 0xa736, Hi: 0xa736, Stride: 0x1}, - unicode.Range16{Lo: 0xa738, Hi: 0xa738, Stride: 0x1}, - unicode.Range16{Lo: 0xa73a, Hi: 0xa73a, Stride: 0x1}, - unicode.Range16{Lo: 0xa73c, Hi: 0xa73c, Stride: 0x1}, - unicode.Range16{Lo: 0xa73e, Hi: 0xa73e, Stride: 0x1}, - unicode.Range16{Lo: 0xa740, Hi: 0xa740, Stride: 0x1}, - unicode.Range16{Lo: 0xa742, Hi: 0xa742, Stride: 0x1}, - unicode.Range16{Lo: 0xa744, Hi: 0xa744, Stride: 0x1}, - unicode.Range16{Lo: 0xa746, Hi: 0xa746, Stride: 0x1}, - unicode.Range16{Lo: 0xa748, Hi: 0xa748, Stride: 0x1}, - unicode.Range16{Lo: 0xa74a, Hi: 0xa74a, Stride: 0x1}, - unicode.Range16{Lo: 0xa74c, Hi: 0xa74c, Stride: 0x1}, - unicode.Range16{Lo: 0xa74e, Hi: 0xa74e, Stride: 0x1}, - unicode.Range16{Lo: 0xa750, Hi: 0xa750, Stride: 0x1}, - unicode.Range16{Lo: 0xa752, Hi: 0xa752, Stride: 0x1}, - unicode.Range16{Lo: 0xa754, Hi: 0xa754, Stride: 0x1}, - unicode.Range16{Lo: 0xa756, Hi: 0xa756, Stride: 0x1}, - unicode.Range16{Lo: 0xa758, Hi: 0xa758, Stride: 0x1}, - unicode.Range16{Lo: 0xa75a, Hi: 0xa75a, Stride: 0x1}, - unicode.Range16{Lo: 0xa75c, Hi: 0xa75c, Stride: 0x1}, - unicode.Range16{Lo: 0xa75e, Hi: 0xa75e, Stride: 0x1}, - unicode.Range16{Lo: 0xa760, Hi: 0xa760, Stride: 0x1}, - unicode.Range16{Lo: 0xa762, Hi: 0xa762, Stride: 0x1}, - unicode.Range16{Lo: 0xa764, Hi: 0xa764, Stride: 0x1}, - unicode.Range16{Lo: 0xa766, Hi: 0xa766, Stride: 0x1}, - unicode.Range16{Lo: 0xa768, Hi: 0xa768, Stride: 0x1}, - unicode.Range16{Lo: 0xa76a, Hi: 0xa76a, Stride: 0x1}, - unicode.Range16{Lo: 0xa76c, Hi: 0xa76c, Stride: 0x1}, - unicode.Range16{Lo: 0xa76e, Hi: 0xa76e, Stride: 0x1}, - unicode.Range16{Lo: 0xa779, Hi: 0xa779, Stride: 0x1}, - unicode.Range16{Lo: 0xa77b, Hi: 0xa77b, Stride: 0x1}, - unicode.Range16{Lo: 0xa77d, Hi: 0xa77e, Stride: 0x1}, - unicode.Range16{Lo: 0xa780, Hi: 0xa780, Stride: 0x1}, - unicode.Range16{Lo: 0xa782, Hi: 0xa782, Stride: 0x1}, - unicode.Range16{Lo: 0xa784, Hi: 0xa784, Stride: 0x1}, - unicode.Range16{Lo: 0xa786, Hi: 0xa786, Stride: 0x1}, - unicode.Range16{Lo: 0xa78b, Hi: 0xa78b, Stride: 0x1}, - unicode.Range16{Lo: 0xa78d, Hi: 0xa78d, Stride: 0x1}, - unicode.Range16{Lo: 0xa790, Hi: 0xa790, Stride: 0x1}, - unicode.Range16{Lo: 0xa792, Hi: 0xa792, Stride: 0x1}, - unicode.Range16{Lo: 0xa796, Hi: 0xa796, Stride: 0x1}, - unicode.Range16{Lo: 0xa798, Hi: 0xa798, Stride: 0x1}, - unicode.Range16{Lo: 0xa79a, Hi: 0xa79a, Stride: 0x1}, - unicode.Range16{Lo: 0xa79c, Hi: 0xa79c, Stride: 0x1}, - unicode.Range16{Lo: 0xa79e, Hi: 0xa79e, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a0, Hi: 0xa7a0, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a2, Hi: 0xa7a2, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a4, Hi: 0xa7a4, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a6, Hi: 0xa7a6, Stride: 0x1}, - unicode.Range16{Lo: 0xa7a8, Hi: 0xa7a8, Stride: 0x1}, - unicode.Range16{Lo: 0xa7aa, Hi: 0xa7ae, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b0, Hi: 0xa7b4, Stride: 0x1}, - unicode.Range16{Lo: 0xa7b6, Hi: 0xa7b6, Stride: 0x1}, - unicode.Range16{Lo: 0xff21, Hi: 0xff3a, Stride: 0x1}, - }, - R32: []unicode.Range32{ - unicode.Range32{Lo: 0x10400, Hi: 0x10427, Stride: 0x1}, - unicode.Range32{Lo: 0x104b0, Hi: 0x104d3, Stride: 0x1}, - unicode.Range32{Lo: 0x10c80, Hi: 0x10cb2, Stride: 0x1}, - unicode.Range32{Lo: 0x118a0, Hi: 0x118bf, Stride: 0x1}, - unicode.Range32{Lo: 0x1d400, Hi: 0x1d419, Stride: 0x1}, - unicode.Range32{Lo: 0x1d434, Hi: 0x1d44d, Stride: 0x1}, - unicode.Range32{Lo: 0x1d468, Hi: 0x1d481, Stride: 0x1}, - unicode.Range32{Lo: 0x1d49c, Hi: 0x1d49c, Stride: 0x1}, - unicode.Range32{Lo: 0x1d49e, Hi: 0x1d49f, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a2, Hi: 0x1d4a2, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a5, Hi: 0x1d4a6, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4a9, Hi: 0x1d4ac, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4ae, Hi: 0x1d4b5, Stride: 0x1}, - unicode.Range32{Lo: 0x1d4d0, Hi: 0x1d4e9, Stride: 0x1}, - unicode.Range32{Lo: 0x1d504, Hi: 0x1d505, Stride: 0x1}, - unicode.Range32{Lo: 0x1d507, Hi: 0x1d50a, Stride: 0x1}, - unicode.Range32{Lo: 0x1d50d, Hi: 0x1d514, Stride: 0x1}, - unicode.Range32{Lo: 0x1d516, Hi: 0x1d51c, Stride: 0x1}, - unicode.Range32{Lo: 0x1d538, Hi: 0x1d539, Stride: 0x1}, - unicode.Range32{Lo: 0x1d53b, Hi: 0x1d53e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d540, Hi: 0x1d544, Stride: 0x1}, - unicode.Range32{Lo: 0x1d546, Hi: 0x1d546, Stride: 0x1}, - unicode.Range32{Lo: 0x1d54a, Hi: 0x1d550, Stride: 0x1}, - unicode.Range32{Lo: 0x1d56c, Hi: 0x1d585, Stride: 0x1}, - unicode.Range32{Lo: 0x1d5a0, Hi: 0x1d5b9, Stride: 0x1}, - unicode.Range32{Lo: 0x1d5d4, Hi: 0x1d5ed, Stride: 0x1}, - unicode.Range32{Lo: 0x1d608, Hi: 0x1d621, Stride: 0x1}, - unicode.Range32{Lo: 0x1d63c, Hi: 0x1d655, Stride: 0x1}, - unicode.Range32{Lo: 0x1d670, Hi: 0x1d689, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6a8, Hi: 0x1d6c0, Stride: 0x1}, - unicode.Range32{Lo: 0x1d6e2, Hi: 0x1d6fa, Stride: 0x1}, - unicode.Range32{Lo: 0x1d71c, Hi: 0x1d734, Stride: 0x1}, - unicode.Range32{Lo: 0x1d756, Hi: 0x1d76e, Stride: 0x1}, - unicode.Range32{Lo: 0x1d790, Hi: 0x1d7a8, Stride: 0x1}, - unicode.Range32{Lo: 0x1d7ca, Hi: 0x1d7ca, Stride: 0x1}, - unicode.Range32{Lo: 0x1e900, Hi: 0x1e921, Stride: 0x1}, - unicode.Range32{Lo: 0x1f130, Hi: 0x1f149, Stride: 0x1}, - unicode.Range32{Lo: 0x1f150, Hi: 0x1f169, Stride: 0x1}, - unicode.Range32{Lo: 0x1f170, Hi: 0x1f189, Stride: 0x1}, - }, - LatinOffset: 3, -} - -type _SentenceRuneRange unicode.RangeTable - -func _SentenceRuneType(r rune) *_SentenceRuneRange { - switch { - case unicode.Is(_SentenceATerm, r): - return (*_SentenceRuneRange)(_SentenceATerm) - case unicode.Is(_SentenceCR, r): - return (*_SentenceRuneRange)(_SentenceCR) - case unicode.Is(_SentenceClose, r): - return (*_SentenceRuneRange)(_SentenceClose) - case unicode.Is(_SentenceExtend, r): - return (*_SentenceRuneRange)(_SentenceExtend) - case unicode.Is(_SentenceFormat, r): - return (*_SentenceRuneRange)(_SentenceFormat) - case unicode.Is(_SentenceLF, r): - return (*_SentenceRuneRange)(_SentenceLF) - case unicode.Is(_SentenceLower, r): - return (*_SentenceRuneRange)(_SentenceLower) - case unicode.Is(_SentenceNumeric, r): - return (*_SentenceRuneRange)(_SentenceNumeric) - case unicode.Is(_SentenceOLetter, r): - return (*_SentenceRuneRange)(_SentenceOLetter) - case unicode.Is(_SentenceSContinue, r): - return (*_SentenceRuneRange)(_SentenceSContinue) - case unicode.Is(_SentenceSTerm, r): - return (*_SentenceRuneRange)(_SentenceSTerm) - case unicode.Is(_SentenceSep, r): - return (*_SentenceRuneRange)(_SentenceSep) - case unicode.Is(_SentenceSp, r): - return (*_SentenceRuneRange)(_SentenceSp) - case unicode.Is(_SentenceUpper, r): - return (*_SentenceRuneRange)(_SentenceUpper) - default: - return nil - } -} -func (rng *_SentenceRuneRange) String() string { - switch (*unicode.RangeTable)(rng) { - case _SentenceATerm: - return "ATerm" - case _SentenceCR: - return "CR" - case _SentenceClose: - return "Close" - case _SentenceExtend: - return "Extend" - case _SentenceFormat: - return "Format" - case _SentenceLF: - return "LF" - case _SentenceLower: - return "Lower" - case _SentenceNumeric: - return "Numeric" - case _SentenceOLetter: - return "OLetter" - case _SentenceSContinue: - return "SContinue" - case _SentenceSTerm: - return "STerm" - case _SentenceSep: - return "Sep" - case _SentenceSp: - return "Sp" - case _SentenceUpper: - return "Upper" - default: - return "Other" - } -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/tables_test.go b/vendor/github.com/apparentlymart/go-textseg/textseg/tables_test.go deleted file mode 100644 index 3640cd4..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/tables_test.go +++ /dev/null @@ -1,13545 +0,0 @@ -// Generated by running -// maketesttables --url=http://www.unicode.org/Public/9.0.0/ucd/auxiliary/ -// DO NOT EDIT - -package textseg - -var unicodeGraphemeTests = []struct { - input []byte - output [][]byte -}{ - { - input: []byte{0x20, 0x20}, - output: [][]byte{[]byte{0x20}, []byte{0x20}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0x20, 0xd}, - output: [][]byte{[]byte{0x20}, []byte{0xd}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x20, 0xa}, - output: [][]byte{[]byte{0x20}, []byte{0xa}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x20, 0x1}, - output: [][]byte{[]byte{0x20}, []byte{0x1}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x20, 0xcc, 0x80}, - output: [][]byte{[]byte{0x20, 0xcc, 0x80}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x20, 0xd8, 0x80}, - output: [][]byte{[]byte{0x20}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0x20, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0x20, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0x20, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0x20}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0x20, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0x20}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0x20, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0x20}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0x20, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0x20}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0x20, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0x20}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0x20, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x20}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x20, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x20}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x20, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x20}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x20, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x20, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x20, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x20}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x20, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x20}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x20, 0xcd, 0xb8}, - output: [][]byte{[]byte{0x20}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0x20, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0x20}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0x20, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0x20, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xd, 0x20}, - output: [][]byte{[]byte{0xd}, []byte{0x20}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xd, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xd}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xd, 0xa}, - output: [][]byte{[]byte{0xd, 0xa}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xd, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0x1}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xd, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xd8, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xd, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xd}, []byte{0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xd, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xd, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xd, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xd}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xd, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xd, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xd}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xd}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xd, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xd}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xa, 0x20}, - output: [][]byte{[]byte{0xa}, []byte{0x20}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xa, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xd}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xa, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xa}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xa, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0x1}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xa, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0xd8, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xa, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xa}, []byte{0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xa, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xa, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xa, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xa}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xa, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xa, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xa}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xa, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xa, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xa, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xa, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xa}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xa, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xa}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0x1, 0x20}, - output: [][]byte{[]byte{0x1}, []byte{0x20}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0x1, 0xd}, - output: [][]byte{[]byte{0x1}, []byte{0xd}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x1, 0xa}, - output: [][]byte{[]byte{0x1}, []byte{0xa}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x1, 0x1}, - output: [][]byte{[]byte{0x1}, []byte{0x1}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x1, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x1, 0xd8, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0x1, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0x1}, []byte{0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0x1, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0x1, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0x1}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0x1, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0x1}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0x1, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0x1, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0x1}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x1, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x1}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x1, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x1}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x1, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x1}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x1, 0xcd, 0xb8}, - output: [][]byte{[]byte{0x1}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0x1, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0x1}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0x1}, []byte{0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xcc, 0x80, 0x20}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x20}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xcc, 0x80, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xd8, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xcc, 0x80, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xcc, 0x80, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xcc, 0x80, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xcc, 0x80, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xd8, 0x80, 0x20}, - output: [][]byte{[]byte{0xd8, 0x80, 0x20}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xd8, 0x80, 0xd}, - output: [][]byte{[]byte{0xd8, 0x80}, []byte{0xd}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xd8, 0x80, 0xa}, - output: [][]byte{[]byte{0xd8, 0x80}, []byte{0xa}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xd8, 0x80, 0x1}, - output: [][]byte{[]byte{0xd8, 0x80}, []byte{0x1}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xd8, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xd8, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xd8, 0x80, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xd8, 0x80, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xd8, 0x80, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xd8, 0x80, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xd8, 0x80, 0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xd8, 0x80, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd8, 0x80, 0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd8, 0x80, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd8, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd8, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd8, 0x80, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd8, 0x80, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd8, 0x80, 0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd8, 0x80, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd8, 0x80, 0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd8, 0x80, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcd, 0xb8}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xd8, 0x80, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xd8, 0x80}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xd8, 0x80, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xd8, 0x80, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0x20}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0x20}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xd}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xd}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xa}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xa}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0x1}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0x1}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe0, 0xa4, 0x83, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe0, 0xa4, 0x83, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0x20}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xd}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xa}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0x1}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0x20}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xd}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xa}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0x1}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x85, 0xa0, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x85, 0xa0, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0x20}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xd}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xa}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0x1}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe1, 0x86, 0xa8, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe1, 0x86, 0xa8, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0x20}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0x20}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xd}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xa}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xa}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0x1}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0x1}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xd8, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0x20}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0x20}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xd}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xa}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xa}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0x1}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0x1}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xd8, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x20}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xa}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x20}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xa}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x20}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xa}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xcd, 0xb8, 0x20}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0x20}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xcd, 0xb8, 0xd}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xd}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xcd, 0xb8, 0xa}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xa}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xcd, 0xb8, 0x1}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0x1}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xd8, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xcd, 0xb8, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xcd, 0xb8, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xcd, 0xb8, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcd, 0xb8, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcd, 0xb8, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcd, 0xb8, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xcd, 0xb8, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xcd, 0xb8}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xcd, 0xb8, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xcd, 0xb8, 0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0x20}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0x20}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0x20}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0x20}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xd}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xd}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xa}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xa}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0x1}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0x1}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xd8, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xd8, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xd8, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe0, 0xa4, 0x83}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88, 0xe0, 0xa4, 0x83}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe1, 0x85, 0xa0}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x85, 0xa0}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe1, 0x86, 0xa8}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xe1, 0x86, 0xa8}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xea, 0xb0, 0x80}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x80}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xea, 0xb0, 0x81}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xea, 0xb0, 0x81}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xcd, 0xb8}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xcd, 0xb8}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xef, 0xbf, 0xbd, 0xcc, 0x88, 0xef, 0xbf, 0xbd}, - output: [][]byte{[]byte{0xef, 0xbf, 0xbd}, []byte{0xcc, 0x88}, []byte{0xef, 0xbf, 0xbd}}, - }, - { - input: []byte{0xd, 0xa, 0x61, 0xa, 0xcc, 0x88}, - output: [][]byte{[]byte{0xd, 0xa}, []byte{0x61}, []byte{0xa}, []byte{0xcc, 0x88}}, - }, - { - input: []byte{0x61, 0xcc, 0x88}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88}}, - }, - { - input: []byte{0x20, 0xe2, 0x80, 0x8d, 0xd9, 0x86}, - output: [][]byte{[]byte{0x20, 0xe2, 0x80, 0x8d}, []byte{0xd9, 0x86}}, - }, - { - input: []byte{0xd9, 0x86, 0xe2, 0x80, 0x8d, 0x20}, - output: [][]byte{[]byte{0xd9, 0x86, 0xe2, 0x80, 0x8d}, []byte{0x20}}, - }, - { - input: []byte{0xe1, 0x84, 0x80, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xe1, 0x84, 0x80, 0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x80, 0xe1, 0x86, 0xa8, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x80, 0xe1, 0x86, 0xa8}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xea, 0xb0, 0x81, 0xe1, 0x86, 0xa8, 0xe1, 0x84, 0x80}, - output: [][]byte{[]byte{0xea, 0xb0, 0x81, 0xe1, 0x86, 0xa8}, []byte{0xe1, 0x84, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0xf0, 0x9f, 0x87, 0xa9, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8, 0xf0, 0x9f, 0x87, 0xa9}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x62}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xe0, 0xa4, 0x83, 0x62}, - output: [][]byte{[]byte{0x61, 0xe0, 0xa4, 0x83}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xd8, 0x80, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xd8, 0x80, 0x62}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, -} -var unicodeWordTests = []struct { - input []byte - output [][]byte -}{ - { - input: []byte{0x1, 0x1}, - output: [][]byte{[]byte{0x1}, []byte{0x1}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x1, 0xd}, - output: [][]byte{[]byte{0x1}, []byte{0xd}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x1, 0xa}, - output: [][]byte{[]byte{0x1}, []byte{0xa}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x1, 0xb}, - output: [][]byte{[]byte{0x1}, []byte{0xb}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x1, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x1}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x1, 0x41}, - output: [][]byte{[]byte{0x1}, []byte{0x41}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x1, 0x3a}, - output: [][]byte{[]byte{0x1}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0x2c}, - output: [][]byte{[]byte{0x1}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0x2e}, - output: [][]byte{[]byte{0x1}, []byte{0x2e}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x1, 0x30}, - output: [][]byte{[]byte{0x1}, []byte{0x30}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x1, 0x5f}, - output: [][]byte{[]byte{0x1}, []byte{0x5f}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x1, 0xd7, 0x90}, - output: [][]byte{[]byte{0x1}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x1, 0x22}, - output: [][]byte{[]byte{0x1}, []byte{0x22}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x1, 0x27}, - output: [][]byte{[]byte{0x1}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x1}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x1, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x1}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x1, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x1}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x1, 0xc2, 0xad}, - output: [][]byte{[]byte{0x1, 0xc2, 0xad}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x1, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1, 0xcc, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x1, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x1, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x1, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x1, 0x61, 0x3a}, - output: [][]byte{[]byte{0x1}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0x61, 0x27}, - output: [][]byte{[]byte{0x1}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x1, 0x61, 0x2c}, - output: [][]byte{[]byte{0x1}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0x31, 0x3a}, - output: [][]byte{[]byte{0x1}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x1, 0x31, 0x27}, - output: [][]byte{[]byte{0x1}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x1, 0x31, 0x2c}, - output: [][]byte{[]byte{0x1}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x1, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0x1}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xd, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xd}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xd, 0xa}, - output: [][]byte{[]byte{0xd, 0xa}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xd, 0xb}, - output: [][]byte{[]byte{0xd}, []byte{0xb}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xd, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xd}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xd, 0x41}, - output: [][]byte{[]byte{0xd}, []byte{0x41}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xd, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0x2e}, - output: [][]byte{[]byte{0xd}, []byte{0x2e}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xd, 0x30}, - output: [][]byte{[]byte{0xd}, []byte{0x30}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xd, 0x5f}, - output: [][]byte{[]byte{0xd}, []byte{0x5f}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd, 0xd7, 0x90}, - output: [][]byte{[]byte{0xd}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xd, 0x22}, - output: [][]byte{[]byte{0xd}, []byte{0x22}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xd, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xd, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0x61, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0x61, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0x61, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0x31, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xd, 0x31, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xd, 0x31, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0x1}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xa, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xd}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xa, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xa}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xa, 0xb}, - output: [][]byte{[]byte{0xa}, []byte{0xb}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xa, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xa}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xa, 0x41}, - output: [][]byte{[]byte{0xa}, []byte{0x41}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xa, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0x2e}, - output: [][]byte{[]byte{0xa}, []byte{0x2e}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xa, 0x30}, - output: [][]byte{[]byte{0xa}, []byte{0x30}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xa, 0x5f}, - output: [][]byte{[]byte{0xa}, []byte{0x5f}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xa, 0xd7, 0x90}, - output: [][]byte{[]byte{0xa}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xa, 0x22}, - output: [][]byte{[]byte{0xa}, []byte{0x22}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xa, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xa, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xa, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xa, 0xc2, 0xad}, - output: [][]byte{[]byte{0xa}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xa, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xa}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xa, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0x61, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0x61, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0x61, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0x31, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xa, 0x31, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xa, 0x31, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0x1}, - output: [][]byte{[]byte{0xb}, []byte{0x1}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xb, 0xd}, - output: [][]byte{[]byte{0xb}, []byte{0xd}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xb, 0xa}, - output: [][]byte{[]byte{0xb}, []byte{0xa}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xb, 0xb}, - output: [][]byte{[]byte{0xb}, []byte{0xb}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xb, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xb}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xb, 0x41}, - output: [][]byte{[]byte{0xb}, []byte{0x41}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xb, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0x2e}, - output: [][]byte{[]byte{0xb}, []byte{0x2e}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xb, 0x30}, - output: [][]byte{[]byte{0xb}, []byte{0x30}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xb, 0x5f}, - output: [][]byte{[]byte{0xb}, []byte{0x5f}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xb, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xb}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xb, 0xd7, 0x90}, - output: [][]byte{[]byte{0xb}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xb, 0x22}, - output: [][]byte{[]byte{0xb}, []byte{0x22}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xb, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xb}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xb, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xb}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xb, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xb}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xb, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xb}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xb, 0xc2, 0xad}, - output: [][]byte{[]byte{0xb}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xb, 0xcc, 0x80}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xb, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xb}, []byte{0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xb, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0x61, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0x61, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0x61, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0x31, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xb, 0x31, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xb, 0x31, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xb, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xb, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xb}, []byte{0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x1}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x1}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xd}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xd}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xa}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xa}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xb}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xb}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x41}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x41}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x2e}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x2e}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x30}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x30}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x5f}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0x5f}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x22}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x22}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xc2, 0xad}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x80}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x61, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x31, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0x1}, - output: [][]byte{[]byte{0x41}, []byte{0x1}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x41, 0xd}, - output: [][]byte{[]byte{0x41}, []byte{0xd}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x41, 0xa}, - output: [][]byte{[]byte{0x41}, []byte{0xa}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x41, 0xb}, - output: [][]byte{[]byte{0x41}, []byte{0xb}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x41, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x41}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x41, 0x41}, - output: [][]byte{[]byte{0x41, 0x41}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x41, 0x3a}, - output: [][]byte{[]byte{0x41}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0x2c}, - output: [][]byte{[]byte{0x41}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0x2e}, - output: [][]byte{[]byte{0x41}, []byte{0x2e}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x41, 0x30}, - output: [][]byte{[]byte{0x41, 0x30}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x41, 0x5f}, - output: [][]byte{[]byte{0x41, 0x5f}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0x41, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x41}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x41, 0xd7, 0x90}, - output: [][]byte{[]byte{0x41, 0xd7, 0x90}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x41, 0x22}, - output: [][]byte{[]byte{0x41}, []byte{0x22}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x41, 0x27}, - output: [][]byte{[]byte{0x41}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x41}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x41, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x41}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x41, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x41}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x41, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x41}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x41, 0xc2, 0xad}, - output: [][]byte{[]byte{0x41, 0xc2, 0xad}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x41, 0xcc, 0x80}, - output: [][]byte{[]byte{0x41, 0xcc, 0x80}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x41, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x41, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x41, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0x61, 0x3a}, - output: [][]byte{[]byte{0x41, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0x61, 0x27}, - output: [][]byte{[]byte{0x41, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0x61, 0x2c}, - output: [][]byte{[]byte{0x41, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0x31, 0x3a}, - output: [][]byte{[]byte{0x41, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x41, 0x31, 0x27}, - output: [][]byte{[]byte{0x41, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x41, 0x31, 0x2c}, - output: [][]byte{[]byte{0x41, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x41, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0x1}, - output: [][]byte{[]byte{0x3a}, []byte{0x1}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x3a, 0xd}, - output: [][]byte{[]byte{0x3a}, []byte{0xd}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x3a, 0xa}, - output: [][]byte{[]byte{0x3a}, []byte{0xa}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x3a, 0xb}, - output: [][]byte{[]byte{0x3a}, []byte{0xb}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x3a, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x3a}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x3a, 0x41}, - output: [][]byte{[]byte{0x3a}, []byte{0x41}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x3a, 0x3a}, - output: [][]byte{[]byte{0x3a}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0x2c}, - output: [][]byte{[]byte{0x3a}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0x2e}, - output: [][]byte{[]byte{0x3a}, []byte{0x2e}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x3a, 0x30}, - output: [][]byte{[]byte{0x3a}, []byte{0x30}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x3a, 0x5f}, - output: [][]byte{[]byte{0x3a}, []byte{0x5f}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x3a, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x3a}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x3a, 0xd7, 0x90}, - output: [][]byte{[]byte{0x3a}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x3a, 0x22}, - output: [][]byte{[]byte{0x3a}, []byte{0x22}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x3a, 0x27}, - output: [][]byte{[]byte{0x3a}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x3a}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x3a, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x3a}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x3a, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x3a}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x3a, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x3a}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x3a, 0xc2, 0xad}, - output: [][]byte{[]byte{0x3a, 0xc2, 0xad}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x3a, 0xcc, 0x80}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x80}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x3a, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x3a, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x3a, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0x61, 0x3a}, - output: [][]byte{[]byte{0x3a}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0x61, 0x27}, - output: [][]byte{[]byte{0x3a}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0x61, 0x2c}, - output: [][]byte{[]byte{0x3a}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0x31, 0x3a}, - output: [][]byte{[]byte{0x3a}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x3a, 0x31, 0x27}, - output: [][]byte{[]byte{0x3a}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x3a, 0x31, 0x2c}, - output: [][]byte{[]byte{0x3a}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x3a, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x3a, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0x1}, - output: [][]byte{[]byte{0x2c}, []byte{0x1}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x2c, 0xd}, - output: [][]byte{[]byte{0x2c}, []byte{0xd}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x2c, 0xa}, - output: [][]byte{[]byte{0x2c}, []byte{0xa}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x2c, 0xb}, - output: [][]byte{[]byte{0x2c}, []byte{0xb}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x2c, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x2c}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x2c, 0x41}, - output: [][]byte{[]byte{0x2c}, []byte{0x41}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x2c, 0x3a}, - output: [][]byte{[]byte{0x2c}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0x2c}, - output: [][]byte{[]byte{0x2c}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0x2e}, - output: [][]byte{[]byte{0x2c}, []byte{0x2e}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x2c, 0x30}, - output: [][]byte{[]byte{0x2c}, []byte{0x30}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x2c, 0x5f}, - output: [][]byte{[]byte{0x2c}, []byte{0x5f}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x2c, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x2c}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x2c, 0xd7, 0x90}, - output: [][]byte{[]byte{0x2c}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x2c, 0x22}, - output: [][]byte{[]byte{0x2c}, []byte{0x22}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x2c, 0x27}, - output: [][]byte{[]byte{0x2c}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x2c}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x2c, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x2c}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x2c, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x2c}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x2c, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x2c}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x2c, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2c, 0xc2, 0xad}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x2c, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x80}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x2c, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x2c, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x2c, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0x61, 0x3a}, - output: [][]byte{[]byte{0x2c}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0x61, 0x27}, - output: [][]byte{[]byte{0x2c}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0x61, 0x2c}, - output: [][]byte{[]byte{0x2c}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0x31, 0x3a}, - output: [][]byte{[]byte{0x2c}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x2c, 0x31, 0x27}, - output: [][]byte{[]byte{0x2c}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x2c, 0x31, 0x2c}, - output: [][]byte{[]byte{0x2c}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x2c, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0x1}, - output: [][]byte{[]byte{0x2e}, []byte{0x1}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x2e, 0xd}, - output: [][]byte{[]byte{0x2e}, []byte{0xd}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x2e, 0xa}, - output: [][]byte{[]byte{0x2e}, []byte{0xa}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x2e, 0xb}, - output: [][]byte{[]byte{0x2e}, []byte{0xb}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x2e, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x2e}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x2e, 0x41}, - output: [][]byte{[]byte{0x2e}, []byte{0x41}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x2e, 0x3a}, - output: [][]byte{[]byte{0x2e}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0x2c}, - output: [][]byte{[]byte{0x2e}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0x2e}, - output: [][]byte{[]byte{0x2e}, []byte{0x2e}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x2e, 0x30}, - output: [][]byte{[]byte{0x2e}, []byte{0x30}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x2e, 0x5f}, - output: [][]byte{[]byte{0x2e}, []byte{0x5f}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x2e, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x2e}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x2e, 0xd7, 0x90}, - output: [][]byte{[]byte{0x2e}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x2e, 0x22}, - output: [][]byte{[]byte{0x2e}, []byte{0x22}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x2e, 0x27}, - output: [][]byte{[]byte{0x2e}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x2e}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x2e, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x2e}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x2e, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x2e}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x2e, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x2e}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x2e, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2e, 0xc2, 0xad}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x2e, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x80}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x2e, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x2e, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x2e, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0x61, 0x3a}, - output: [][]byte{[]byte{0x2e}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0x61, 0x27}, - output: [][]byte{[]byte{0x2e}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0x61, 0x2c}, - output: [][]byte{[]byte{0x2e}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0x31, 0x3a}, - output: [][]byte{[]byte{0x2e}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x2e, 0x31, 0x27}, - output: [][]byte{[]byte{0x2e}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x2e, 0x31, 0x2c}, - output: [][]byte{[]byte{0x2e}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x2e, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0x1}, - output: [][]byte{[]byte{0x30}, []byte{0x1}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x30, 0xd}, - output: [][]byte{[]byte{0x30}, []byte{0xd}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x30, 0xa}, - output: [][]byte{[]byte{0x30}, []byte{0xa}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x30, 0xb}, - output: [][]byte{[]byte{0x30}, []byte{0xb}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x30, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x30}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x30, 0x41}, - output: [][]byte{[]byte{0x30, 0x41}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x30, 0x3a}, - output: [][]byte{[]byte{0x30}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0x2c}, - output: [][]byte{[]byte{0x30}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0x2e}, - output: [][]byte{[]byte{0x30}, []byte{0x2e}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x30, 0x30}, - output: [][]byte{[]byte{0x30, 0x30}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x30, 0x5f}, - output: [][]byte{[]byte{0x30, 0x5f}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0x30, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x30}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x30, 0xd7, 0x90}, - output: [][]byte{[]byte{0x30, 0xd7, 0x90}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x30, 0x22}, - output: [][]byte{[]byte{0x30}, []byte{0x22}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x30, 0x27}, - output: [][]byte{[]byte{0x30}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x30}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x30, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x30}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x30, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x30}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x30, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x30}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x30, 0xc2, 0xad}, - output: [][]byte{[]byte{0x30, 0xc2, 0xad}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x30, 0xcc, 0x80}, - output: [][]byte{[]byte{0x30, 0xcc, 0x80}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x30, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x30, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x30, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0x61, 0x3a}, - output: [][]byte{[]byte{0x30, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0x61, 0x27}, - output: [][]byte{[]byte{0x30, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0x61, 0x2c}, - output: [][]byte{[]byte{0x30, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0x31, 0x3a}, - output: [][]byte{[]byte{0x30, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x30, 0x31, 0x27}, - output: [][]byte{[]byte{0x30, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x30, 0x31, 0x2c}, - output: [][]byte{[]byte{0x30, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x30, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0x1}, - output: [][]byte{[]byte{0x5f}, []byte{0x1}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x5f, 0xd}, - output: [][]byte{[]byte{0x5f}, []byte{0xd}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x5f, 0xa}, - output: [][]byte{[]byte{0x5f}, []byte{0xa}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x5f, 0xb}, - output: [][]byte{[]byte{0x5f}, []byte{0xb}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x5f, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x5f, 0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x5f, 0x41}, - output: [][]byte{[]byte{0x5f, 0x41}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x5f, 0x3a}, - output: [][]byte{[]byte{0x5f}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0x2c}, - output: [][]byte{[]byte{0x5f}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0x2e}, - output: [][]byte{[]byte{0x5f}, []byte{0x2e}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x5f, 0x30}, - output: [][]byte{[]byte{0x5f, 0x30}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x5f, 0x5f}, - output: [][]byte{[]byte{0x5f, 0x5f}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0x5f, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x5f}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x5f, 0xd7, 0x90}, - output: [][]byte{[]byte{0x5f, 0xd7, 0x90}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x5f, 0x22}, - output: [][]byte{[]byte{0x5f}, []byte{0x22}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x5f, 0x27}, - output: [][]byte{[]byte{0x5f}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x5f}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x5f, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x5f}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x5f, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x5f}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x5f, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x5f}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x5f, 0xc2, 0xad}, - output: [][]byte{[]byte{0x5f, 0xc2, 0xad}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x5f, 0xcc, 0x80}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x80}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x5f, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x5f, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x5f, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0x61, 0x3a}, - output: [][]byte{[]byte{0x5f, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0x61, 0x27}, - output: [][]byte{[]byte{0x5f, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0x61, 0x2c}, - output: [][]byte{[]byte{0x5f, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0x31, 0x3a}, - output: [][]byte{[]byte{0x5f, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x5f, 0x31, 0x27}, - output: [][]byte{[]byte{0x5f, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x5f, 0x31, 0x2c}, - output: [][]byte{[]byte{0x5f, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x5f, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x5f, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x5f, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0x1}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0x1}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xd7, 0x90, 0xd}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xd}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xd7, 0x90, 0xa}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xa}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xd7, 0x90, 0xb}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xb}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xd7, 0x90, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xd7, 0x90, 0x41}, - output: [][]byte{[]byte{0xd7, 0x90, 0x41}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xd7, 0x90, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0x2e}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0x2e}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xd7, 0x90, 0x30}, - output: [][]byte{[]byte{0xd7, 0x90, 0x30}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xd7, 0x90, 0x5f}, - output: [][]byte{[]byte{0xd7, 0x90, 0x5f}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0xd7, 0x90, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xd7, 0x90, 0xd7, 0x90}, - output: [][]byte{[]byte{0xd7, 0x90, 0xd7, 0x90}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0xd7, 0x90, 0x22}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0x22}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xd7, 0x90, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xd7, 0x90, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xd7, 0x90, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xd7, 0x90, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd7, 0x90}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xd7, 0x90, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd7, 0x90, 0xc2, 0xad}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x80}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd7, 0x90, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd7, 0x90, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xd7, 0x90, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0x61, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0x61, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0x61, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0x31, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xd7, 0x90, 0x31, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0x31, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xd7, 0x90, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd7, 0x90, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xd7, 0x90, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0x1}, - output: [][]byte{[]byte{0x22}, []byte{0x1}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x22, 0xd}, - output: [][]byte{[]byte{0x22}, []byte{0xd}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x22, 0xa}, - output: [][]byte{[]byte{0x22}, []byte{0xa}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x22, 0xb}, - output: [][]byte{[]byte{0x22}, []byte{0xb}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x22, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x22}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x22, 0x41}, - output: [][]byte{[]byte{0x22}, []byte{0x41}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x22, 0x3a}, - output: [][]byte{[]byte{0x22}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0x2c}, - output: [][]byte{[]byte{0x22}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0x2e}, - output: [][]byte{[]byte{0x22}, []byte{0x2e}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x22, 0x30}, - output: [][]byte{[]byte{0x22}, []byte{0x30}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x22, 0x5f}, - output: [][]byte{[]byte{0x22}, []byte{0x5f}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x22, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x22}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x22, 0xd7, 0x90}, - output: [][]byte{[]byte{0x22}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x22, 0x22}, - output: [][]byte{[]byte{0x22}, []byte{0x22}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x22, 0x27}, - output: [][]byte{[]byte{0x22}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x22}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x22, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x22}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x22, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x22}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x22, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x22}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x22, 0xc2, 0xad}, - output: [][]byte{[]byte{0x22, 0xc2, 0xad}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x22, 0xcc, 0x80}, - output: [][]byte{[]byte{0x22, 0xcc, 0x80}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x22, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x22, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x22, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0x61, 0x3a}, - output: [][]byte{[]byte{0x22}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0x61, 0x27}, - output: [][]byte{[]byte{0x22}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0x61, 0x2c}, - output: [][]byte{[]byte{0x22}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0x31, 0x3a}, - output: [][]byte{[]byte{0x22}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x22, 0x31, 0x27}, - output: [][]byte{[]byte{0x22}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x22, 0x31, 0x2c}, - output: [][]byte{[]byte{0x22}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x22, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0x1}, - output: [][]byte{[]byte{0x27}, []byte{0x1}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x27, 0xd}, - output: [][]byte{[]byte{0x27}, []byte{0xd}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x27, 0xa}, - output: [][]byte{[]byte{0x27}, []byte{0xa}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x27, 0xb}, - output: [][]byte{[]byte{0x27}, []byte{0xb}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x27, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x27}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x27, 0x41}, - output: [][]byte{[]byte{0x27}, []byte{0x41}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x27, 0x3a}, - output: [][]byte{[]byte{0x27}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0x2c}, - output: [][]byte{[]byte{0x27}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0x2e}, - output: [][]byte{[]byte{0x27}, []byte{0x2e}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x27, 0x30}, - output: [][]byte{[]byte{0x27}, []byte{0x30}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x27, 0x5f}, - output: [][]byte{[]byte{0x27}, []byte{0x5f}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x27, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x27}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x27, 0xd7, 0x90}, - output: [][]byte{[]byte{0x27}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x27, 0x22}, - output: [][]byte{[]byte{0x27}, []byte{0x22}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x27, 0x27}, - output: [][]byte{[]byte{0x27}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x27}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x27, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x27}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x27, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x27}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x27, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x27}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x27, 0xc2, 0xad}, - output: [][]byte{[]byte{0x27, 0xc2, 0xad}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x27, 0xcc, 0x80}, - output: [][]byte{[]byte{0x27, 0xcc, 0x80}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x27, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x27, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x27, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0x61, 0x3a}, - output: [][]byte{[]byte{0x27}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0x61, 0x27}, - output: [][]byte{[]byte{0x27}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0x61, 0x2c}, - output: [][]byte{[]byte{0x27}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0x31, 0x3a}, - output: [][]byte{[]byte{0x27}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x27, 0x31, 0x27}, - output: [][]byte{[]byte{0x27}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x27, 0x31, 0x2c}, - output: [][]byte{[]byte{0x27}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x27, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x27, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xa}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x41}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x30}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x22}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x8f, 0xbb, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xa}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x41}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x30}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x22}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x9d, 0xa4, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0x1}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x1}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xc2, 0xad, 0xd}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xd}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xc2, 0xad, 0xa}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xa}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xc2, 0xad, 0xb}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xb}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xc2, 0xad, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xc2, 0xad, 0x41}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x41}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xc2, 0xad, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0x2e}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x2e}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xc2, 0xad, 0x30}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x30}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xc2, 0xad, 0x5f}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x5f}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xc2, 0xad, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xc2, 0xad, 0xd7, 0x90}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xc2, 0xad, 0x22}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x22}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xc2, 0xad, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xc2, 0xad, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xc2, 0xad, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xc2, 0xad, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xc2, 0xad, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0xad, 0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0xad, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xc2, 0xad, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xc2, 0xad, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0x61, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0x61, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0x61, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0x31, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xc2, 0xad, 0x31, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xc2, 0xad, 0x31, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0xb}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xb}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xcc, 0x80, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xcc, 0x80, 0x41}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x41}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xcc, 0x80, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0x2e}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x2e}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xcc, 0x80, 0x30}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x30}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xcc, 0x80, 0x5f}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x5f}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xd7, 0x90}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xcc, 0x80, 0x22}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x22}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xcc, 0x80, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xcc, 0x80, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xcc, 0x80, 0xc2, 0xad}, - output: [][]byte{[]byte{0xcc, 0x80, 0xc2, 0xad}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xcc, 0x80, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0x61, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0x61, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0x61, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0x31, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xcc, 0x80, 0x31, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xcc, 0x80, 0x31, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xa}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x41}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x30}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x22}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x1}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xd}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xa}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xb}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x41}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x41}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x2e}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x30}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x30}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x5f}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x5f}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x5f}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x22}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x31, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x3a, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x3a, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x3a, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x3a, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x3a, 0x41}, - output: [][]byte{[]byte{0x61, 0x3a, 0x41}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x61, 0x3a, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x3a, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x3a, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x3a, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x3a, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x3a, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x3a, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x3a, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x3a, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x3a, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x3a, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x3a, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x3a, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x3a, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x3a, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x3a, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x3a, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x3a, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x3a, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x3a, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x3a, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x3a, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x3a, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x3a, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x27, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x27, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x27, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x27, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x27, 0x41}, - output: [][]byte{[]byte{0x61, 0x27, 0x41}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x61, 0x27, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x27, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x27, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x27, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x27, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x27, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x27, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x27, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x27, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x27, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x27, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x27, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x27, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x27, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x27}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x41}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x41}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x61, 0x2c, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x61, 0x2c, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x61, 0x2c, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x61, 0x2c, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x61, 0x2c, 0x41}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x41}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x61, 0x2c, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x61, 0x2c, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x61, 0x2c, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x61, 0x2c, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x61, 0x2c, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x61, 0x2c, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x61, 0x2c, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x61, 0x2c, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x61, 0x2c, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x61, 0x2c, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0x2c, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x2c, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x61, 0x2c, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0x61, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x61, 0x2c, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x61, 0x2c, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x61, 0x2c, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x61, 0x2c, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x61}, []byte{0x2c, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x3a, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x3a, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x3a, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x3a, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x3a, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x3a, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x3a, 0x30}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x30}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x31, 0x3a, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x3a, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x3a, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x3a, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x3a, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x3a, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x3a, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x3a, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x3a, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x3a, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x3a, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x3a, 0x31, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x3a, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x3a, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x3a, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x3a, 0xcc, 0x88}, []byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x27, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x27, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x27, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x27, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x27, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x27, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x27, 0x30}, - output: [][]byte{[]byte{0x31, 0x27, 0x30}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x31, 0x27, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x31, 0x27, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x27, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x27, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x27, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x27, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x27, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x27, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x27, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x27, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x27, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x27, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x27}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x27, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x27, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x27, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x27, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x27, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x27, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x27, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x27, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x27, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x27, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x27, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x27, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x27, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x2c, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x2c, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x2c, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x2c, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x2c, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x2c, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x2c, 0x30}, - output: [][]byte{[]byte{0x31, 0x2c, 0x30}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x31, 0x2c, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x31, 0x2c, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x2c, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x2c, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x2c, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x2c, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x2c, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x2c, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x2c, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x2c, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x2c, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x2c, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2c, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x2c, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x2c, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2c, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x2c, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x2c, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2c, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x2c, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x2c, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2c, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x2c, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2c, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x2c, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xd}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xa}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xb}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xb}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x2e}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x30}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x30}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x5f}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x5f}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x87, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x87, 0xa6}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xd7, 0x90}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xd7, 0x90}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x22}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x80, 0x8d}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x61, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x3a}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x61}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x61}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x27, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x61}, []byte{0x27, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x61, 0x2c}, - output: [][]byte{[]byte{0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x61}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x3a}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x3a}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x27}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x27}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2c}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x2c}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31, 0x2e, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0x31, 0x2e, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x31}, []byte{0x2e, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xd, 0xa, 0x61, 0xa, 0xcc, 0x88}, - output: [][]byte{[]byte{0xd, 0xa}, []byte{0x61}, []byte{0xa}, []byte{0xcc, 0x88}}, - }, - { - input: []byte{0x61, 0xcc, 0x88}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88}}, - }, - { - input: []byte{0x20, 0xe2, 0x80, 0x8d, 0xd9, 0x86}, - output: [][]byte{[]byte{0x20, 0xe2, 0x80, 0x8d}, []byte{0xd9, 0x86}}, - }, - { - input: []byte{0xd9, 0x86, 0xe2, 0x80, 0x8d, 0x20}, - output: [][]byte{[]byte{0xd9, 0x86, 0xe2, 0x80, 0x8d}, []byte{0x20}}, - }, - { - input: []byte{0x41, 0x41, 0x41}, - output: [][]byte{[]byte{0x41, 0x41, 0x41}}, - }, - { - input: []byte{0x41, 0x3a, 0x41}, - output: [][]byte{[]byte{0x41, 0x3a, 0x41}}, - }, - { - input: []byte{0x41, 0x3a, 0x3a, 0x41}, - output: [][]byte{[]byte{0x41}, []byte{0x3a}, []byte{0x3a}, []byte{0x41}}, - }, - { - input: []byte{0xd7, 0x90, 0x27}, - output: [][]byte{[]byte{0xd7, 0x90, 0x27}}, - }, - { - input: []byte{0xd7, 0x90, 0x22, 0xd7, 0x90}, - output: [][]byte{[]byte{0xd7, 0x90, 0x22, 0xd7, 0x90}}, - }, - { - input: []byte{0x41, 0x30, 0x30, 0x41}, - output: [][]byte{[]byte{0x41, 0x30, 0x30, 0x41}}, - }, - { - input: []byte{0x30, 0x2c, 0x30}, - output: [][]byte{[]byte{0x30, 0x2c, 0x30}}, - }, - { - input: []byte{0x30, 0x2c, 0x2c, 0x30}, - output: [][]byte{[]byte{0x30}, []byte{0x2c}, []byte{0x2c}, []byte{0x30}}, - }, - { - input: []byte{0xe3, 0x80, 0xb1, 0xe3, 0x80, 0xb1}, - output: [][]byte{[]byte{0xe3, 0x80, 0xb1, 0xe3, 0x80, 0xb1}}, - }, - { - input: []byte{0x41, 0x5f, 0x30, 0x5f, 0xe3, 0x80, 0xb1, 0x5f}, - output: [][]byte{[]byte{0x41, 0x5f, 0x30, 0x5f, 0xe3, 0x80, 0xb1, 0x5f}}, - }, - { - input: []byte{0x41, 0x5f, 0x5f, 0x41}, - output: [][]byte{[]byte{0x41, 0x5f, 0x5f, 0x41}}, - }, - { - input: []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xe2, 0x80, 0x8d}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8}, []byte{0x62}}, - }, - { - input: []byte{0x61, 0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7, 0xf0, 0x9f, 0x87, 0xa8, 0xf0, 0x9f, 0x87, 0xa9, 0x62}, - output: [][]byte{[]byte{0x61}, []byte{0xf0, 0x9f, 0x87, 0xa6, 0xf0, 0x9f, 0x87, 0xa7}, []byte{0xf0, 0x9f, 0x87, 0xa8, 0xf0, 0x9f, 0x87, 0xa9}, []byte{0x62}}, - }, - { - input: []byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb, 0xe2, 0x98, 0x9d}, - output: [][]byte{[]byte{0xe2, 0x98, 0x9d, 0xf0, 0x9f, 0x8f, 0xbb}, []byte{0xe2, 0x98, 0x9d}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x8f, 0xbb}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xe2, 0x9d, 0xa4}}, - }, - { - input: []byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xe2, 0x80, 0x8d, 0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0xf0, 0x9f, 0x91, 0xa6, 0xf0, 0x9f, 0x91, 0xa6}, - output: [][]byte{[]byte{0xf0, 0x9f, 0x91, 0xa6}, []byte{0xf0, 0x9f, 0x91, 0xa6}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x62}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xe2, 0x80, 0x8d, 0xcc, 0x88, 0x62}}, - }, - { - input: []byte{0x31, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x31, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x31, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x31, 0x5f, 0x61, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x31, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x3a, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x3a}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2e, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2e}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x3a, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x3a, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x3a}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x2e, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x2e, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2e}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x2c, 0x31}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x31}}, - }, - { - input: []byte{0x61, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x31, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x31}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, - { - input: []byte{0x61, 0x5f, 0x61, 0x2c, 0x2c, 0x61}, - output: [][]byte{[]byte{0x61, 0x5f, 0x61}, []byte{0x2c}, []byte{0x2c}, []byte{0x61}}, - }, -} -var unicodeSentenceTests = []struct { - input []byte - output [][]byte -}{ - { - input: []byte{0x1, 0x1}, - output: [][]byte{[]byte{0x1, 0x1}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x1, 0xd}, - output: [][]byte{[]byte{0x1, 0xd}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x1, 0xa}, - output: [][]byte{[]byte{0x1, 0xa}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x1, 0xc2, 0x85}, - output: [][]byte{[]byte{0x1, 0xc2, 0x85}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x1, 0x9}, - output: [][]byte{[]byte{0x1, 0x9}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x1, 0x61}, - output: [][]byte{[]byte{0x1, 0x61}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x1, 0x41}, - output: [][]byte{[]byte{0x1, 0x41}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x1, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x1, 0xc6, 0xbb}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x1, 0x30}, - output: [][]byte{[]byte{0x1, 0x30}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x1, 0x2e}, - output: [][]byte{[]byte{0x1, 0x2e}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x1, 0x21}, - output: [][]byte{[]byte{0x1, 0x21}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x1, 0x22}, - output: [][]byte{[]byte{0x1, 0x22}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x1, 0x2c}, - output: [][]byte{[]byte{0x1, 0x2c}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x1, 0xc2, 0xad}, - output: [][]byte{[]byte{0x1, 0xc2, 0xad}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x1, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1, 0xcc, 0x80}}, - }, - { - input: []byte{0x1, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x1, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0x1}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xd, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xd}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xd, 0xa}, - output: [][]byte{[]byte{0xd, 0xa}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xd, 0xc2, 0x85}, - output: [][]byte{[]byte{0xd}, []byte{0xc2, 0x85}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xd, 0x9}, - output: [][]byte{[]byte{0xd}, []byte{0x9}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xd, 0x61}, - output: [][]byte{[]byte{0xd}, []byte{0x61}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xd, 0x41}, - output: [][]byte{[]byte{0xd}, []byte{0x41}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xd, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xd, 0x30}, - output: [][]byte{[]byte{0xd}, []byte{0x30}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xd, 0x2e}, - output: [][]byte{[]byte{0xd}, []byte{0x2e}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xd, 0x21}, - output: [][]byte{[]byte{0xd}, []byte{0x21}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xd, 0x22}, - output: [][]byte{[]byte{0xd}, []byte{0x22}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xd, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0x2c}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xd, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xd, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xd}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0x1}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xa, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xd}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xa, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xa}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xa, 0xc2, 0x85}, - output: [][]byte{[]byte{0xa}, []byte{0xc2, 0x85}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xa, 0x9}, - output: [][]byte{[]byte{0xa}, []byte{0x9}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xa, 0x61}, - output: [][]byte{[]byte{0xa}, []byte{0x61}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xa, 0x41}, - output: [][]byte{[]byte{0xa}, []byte{0x41}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xa, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xa, 0x30}, - output: [][]byte{[]byte{0xa}, []byte{0x30}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xa, 0x2e}, - output: [][]byte{[]byte{0xa}, []byte{0x2e}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xa, 0x21}, - output: [][]byte{[]byte{0xa}, []byte{0x21}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xa, 0x22}, - output: [][]byte{[]byte{0xa}, []byte{0x22}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xa, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0x2c}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xa, 0xc2, 0xad}, - output: [][]byte{[]byte{0xa}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xa, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xa, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xa}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0x85, 0x1}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x1}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xc2, 0x85, 0xd}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xd}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xc2, 0x85, 0xa}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xa}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xc2, 0x85, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xc2, 0x85}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xc2, 0x85, 0x9}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x9}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xc2, 0x85, 0x61}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x61}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xc2, 0x85, 0x41}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x41}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xc2, 0x85, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xc2, 0x85, 0x30}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x30}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xc2, 0x85, 0x2e}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x2e}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xc2, 0x85, 0x21}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x21}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xc2, 0x85, 0x22}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x22}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xc2, 0x85, 0x2c}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0x2c}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xc2, 0x85, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0x85, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0x85}, []byte{0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x9, 0x1}, - output: [][]byte{[]byte{0x9, 0x1}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x9, 0xd}, - output: [][]byte{[]byte{0x9, 0xd}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x9, 0xa}, - output: [][]byte{[]byte{0x9, 0xa}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x9, 0xc2, 0x85}, - output: [][]byte{[]byte{0x9, 0xc2, 0x85}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x9, 0x9}, - output: [][]byte{[]byte{0x9, 0x9}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x9, 0x61}, - output: [][]byte{[]byte{0x9, 0x61}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x9, 0x41}, - output: [][]byte{[]byte{0x9, 0x41}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x9, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x9, 0xc6, 0xbb}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x9, 0x30}, - output: [][]byte{[]byte{0x9, 0x30}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x9, 0x2e}, - output: [][]byte{[]byte{0x9, 0x2e}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x9, 0x21}, - output: [][]byte{[]byte{0x9, 0x21}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x9, 0x22}, - output: [][]byte{[]byte{0x9, 0x22}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x9, 0x2c}, - output: [][]byte{[]byte{0x9, 0x2c}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x9, 0xc2, 0xad}, - output: [][]byte{[]byte{0x9, 0xc2, 0xad}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x9, 0xcc, 0x80}, - output: [][]byte{[]byte{0x9, 0xcc, 0x80}}, - }, - { - input: []byte{0x9, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x9, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0x1}, - output: [][]byte{[]byte{0x61, 0x1}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x61, 0xd}, - output: [][]byte{[]byte{0x61, 0xd}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x61, 0xa}, - output: [][]byte{[]byte{0x61, 0xa}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x61, 0xc2, 0x85}, - output: [][]byte{[]byte{0x61, 0xc2, 0x85}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x61, 0x9}, - output: [][]byte{[]byte{0x61, 0x9}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x61, 0x61}, - output: [][]byte{[]byte{0x61, 0x61}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x61, 0x41}, - output: [][]byte{[]byte{0x61, 0x41}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x61, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x61, 0xc6, 0xbb}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x61, 0x30}, - output: [][]byte{[]byte{0x61, 0x30}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x61, 0x2e}, - output: [][]byte{[]byte{0x61, 0x2e}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x61, 0x21}, - output: [][]byte{[]byte{0x61, 0x21}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x61, 0x22}, - output: [][]byte{[]byte{0x61, 0x22}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x61, 0x2c}, - output: [][]byte{[]byte{0x61, 0x2c}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x61, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x61, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61, 0xcc, 0x80}}, - }, - { - input: []byte{0x61, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x41, 0x1}, - output: [][]byte{[]byte{0x41, 0x1}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x41, 0xd}, - output: [][]byte{[]byte{0x41, 0xd}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x41, 0xa}, - output: [][]byte{[]byte{0x41, 0xa}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x41, 0xc2, 0x85}, - output: [][]byte{[]byte{0x41, 0xc2, 0x85}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x41, 0x9}, - output: [][]byte{[]byte{0x41, 0x9}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x41, 0x61}, - output: [][]byte{[]byte{0x41, 0x61}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x41, 0x41}, - output: [][]byte{[]byte{0x41, 0x41}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x41, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x41, 0xc6, 0xbb}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x41, 0x30}, - output: [][]byte{[]byte{0x41, 0x30}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x41, 0x2e}, - output: [][]byte{[]byte{0x41, 0x2e}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x41, 0x21}, - output: [][]byte{[]byte{0x41, 0x21}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x41, 0x22}, - output: [][]byte{[]byte{0x41, 0x22}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x41, 0x2c}, - output: [][]byte{[]byte{0x41, 0x2c}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x41, 0xc2, 0xad}, - output: [][]byte{[]byte{0x41, 0xc2, 0xad}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x41, 0xcc, 0x80}, - output: [][]byte{[]byte{0x41, 0xcc, 0x80}}, - }, - { - input: []byte{0x41, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x41, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xc6, 0xbb, 0x1}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x1}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xc6, 0xbb, 0xd}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xd}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xc6, 0xbb, 0xa}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xa}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xc6, 0xbb, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xc2, 0x85}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xc6, 0xbb, 0x9}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x9}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xc6, 0xbb, 0x61}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x61}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xc6, 0xbb, 0x41}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x41}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xc6, 0xbb, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xc6, 0xbb}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xc6, 0xbb, 0x30}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x30}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xc6, 0xbb, 0x2e}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x2e}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xc6, 0xbb, 0x21}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x21}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xc6, 0xbb, 0x22}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x22}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xc6, 0xbb, 0x2c}, - output: [][]byte{[]byte{0xc6, 0xbb, 0x2c}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xc6, 0xbb, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xc2, 0xad}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x80}}, - }, - { - input: []byte{0xc6, 0xbb, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc6, 0xbb, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x30, 0x1}, - output: [][]byte{[]byte{0x30, 0x1}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x30, 0xd}, - output: [][]byte{[]byte{0x30, 0xd}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x30, 0xa}, - output: [][]byte{[]byte{0x30, 0xa}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x30, 0xc2, 0x85}, - output: [][]byte{[]byte{0x30, 0xc2, 0x85}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x30, 0x9}, - output: [][]byte{[]byte{0x30, 0x9}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x30, 0x61}, - output: [][]byte{[]byte{0x30, 0x61}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x30, 0x41}, - output: [][]byte{[]byte{0x30, 0x41}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x30, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x30, 0xc6, 0xbb}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x30, 0x30}, - output: [][]byte{[]byte{0x30, 0x30}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x30, 0x2e}, - output: [][]byte{[]byte{0x30, 0x2e}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x30, 0x21}, - output: [][]byte{[]byte{0x30, 0x21}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x30, 0x22}, - output: [][]byte{[]byte{0x30, 0x22}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x30, 0x2c}, - output: [][]byte{[]byte{0x30, 0x2c}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x30, 0xc2, 0xad}, - output: [][]byte{[]byte{0x30, 0xc2, 0xad}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x30, 0xcc, 0x80}, - output: [][]byte{[]byte{0x30, 0xcc, 0x80}}, - }, - { - input: []byte{0x30, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x30, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x2e, 0x1}, - output: [][]byte{[]byte{0x2e}, []byte{0x1}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x2e, 0xd}, - output: [][]byte{[]byte{0x2e, 0xd}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x2e, 0xa}, - output: [][]byte{[]byte{0x2e, 0xa}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x2e, 0xc2, 0x85}, - output: [][]byte{[]byte{0x2e, 0xc2, 0x85}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x2e, 0x9}, - output: [][]byte{[]byte{0x2e, 0x9}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x2e, 0x61}, - output: [][]byte{[]byte{0x2e, 0x61}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x2e, 0x41}, - output: [][]byte{[]byte{0x2e}, []byte{0x41}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x2e, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x2e}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0x2e, 0x30}, - output: [][]byte{[]byte{0x2e, 0x30}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x2e, 0x2e}, - output: [][]byte{[]byte{0x2e, 0x2e}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x2e, 0x21}, - output: [][]byte{[]byte{0x2e, 0x21}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x2e, 0x22}, - output: [][]byte{[]byte{0x2e, 0x22}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x2e, 0x2c}, - output: [][]byte{[]byte{0x2e, 0x2c}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x2e, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2e, 0xc2, 0xad}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x2e, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x80}}, - }, - { - input: []byte{0x2e, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2e, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x21, 0x1}, - output: [][]byte{[]byte{0x21}, []byte{0x1}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88}, []byte{0x1}}, - }, - { - input: []byte{0x21, 0xd}, - output: [][]byte{[]byte{0x21, 0xd}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x21, 0xa}, - output: [][]byte{[]byte{0x21, 0xa}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x21, 0xc2, 0x85}, - output: [][]byte{[]byte{0x21, 0xc2, 0x85}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x21, 0x9}, - output: [][]byte{[]byte{0x21, 0x9}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x21, 0x61}, - output: [][]byte{[]byte{0x21}, []byte{0x61}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88}, []byte{0x61}}, - }, - { - input: []byte{0x21, 0x41}, - output: [][]byte{[]byte{0x21}, []byte{0x41}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88}, []byte{0x41}}, - }, - { - input: []byte{0x21, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x21}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88}, []byte{0xc6, 0xbb}}, - }, - { - input: []byte{0x21, 0x30}, - output: [][]byte{[]byte{0x21}, []byte{0x30}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88}, []byte{0x30}}, - }, - { - input: []byte{0x21, 0x2e}, - output: [][]byte{[]byte{0x21, 0x2e}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x21, 0x21}, - output: [][]byte{[]byte{0x21, 0x21}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x21, 0x22}, - output: [][]byte{[]byte{0x21, 0x22}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x21, 0x2c}, - output: [][]byte{[]byte{0x21, 0x2c}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x21, 0xc2, 0xad}, - output: [][]byte{[]byte{0x21, 0xc2, 0xad}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x21, 0xcc, 0x80}, - output: [][]byte{[]byte{0x21, 0xcc, 0x80}}, - }, - { - input: []byte{0x21, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x21, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x22, 0x1}, - output: [][]byte{[]byte{0x22, 0x1}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x22, 0xd}, - output: [][]byte{[]byte{0x22, 0xd}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x22, 0xa}, - output: [][]byte{[]byte{0x22, 0xa}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x22, 0xc2, 0x85}, - output: [][]byte{[]byte{0x22, 0xc2, 0x85}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x22, 0x9}, - output: [][]byte{[]byte{0x22, 0x9}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x22, 0x61}, - output: [][]byte{[]byte{0x22, 0x61}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x22, 0x41}, - output: [][]byte{[]byte{0x22, 0x41}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x22, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x22, 0xc6, 0xbb}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x22, 0x30}, - output: [][]byte{[]byte{0x22, 0x30}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x22, 0x2e}, - output: [][]byte{[]byte{0x22, 0x2e}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x22, 0x21}, - output: [][]byte{[]byte{0x22, 0x21}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x22, 0x22}, - output: [][]byte{[]byte{0x22, 0x22}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x22, 0x2c}, - output: [][]byte{[]byte{0x22, 0x2c}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x22, 0xc2, 0xad}, - output: [][]byte{[]byte{0x22, 0xc2, 0xad}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x22, 0xcc, 0x80}, - output: [][]byte{[]byte{0x22, 0xcc, 0x80}}, - }, - { - input: []byte{0x22, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x22, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0x2c, 0x1}, - output: [][]byte{[]byte{0x2c, 0x1}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0x2c, 0xd}, - output: [][]byte{[]byte{0x2c, 0xd}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0x2c, 0xa}, - output: [][]byte{[]byte{0x2c, 0xa}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0x2c, 0xc2, 0x85}, - output: [][]byte{[]byte{0x2c, 0xc2, 0x85}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0x2c, 0x9}, - output: [][]byte{[]byte{0x2c, 0x9}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0x2c, 0x61}, - output: [][]byte{[]byte{0x2c, 0x61}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0x2c, 0x41}, - output: [][]byte{[]byte{0x2c, 0x41}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0x2c, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x2c, 0xc6, 0xbb}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0x2c, 0x30}, - output: [][]byte{[]byte{0x2c, 0x30}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0x2c, 0x2e}, - output: [][]byte{[]byte{0x2c, 0x2e}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0x2c, 0x21}, - output: [][]byte{[]byte{0x2c, 0x21}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0x2c, 0x22}, - output: [][]byte{[]byte{0x2c, 0x22}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0x2c, 0x2c}, - output: [][]byte{[]byte{0x2c, 0x2c}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0x2c, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2c, 0xc2, 0xad}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0x2c, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x80}}, - }, - { - input: []byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0x2c, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0xad, 0x1}, - output: [][]byte{[]byte{0xc2, 0xad, 0x1}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xc2, 0xad, 0xd}, - output: [][]byte{[]byte{0xc2, 0xad, 0xd}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xc2, 0xad, 0xa}, - output: [][]byte{[]byte{0xc2, 0xad, 0xa}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xc2, 0xad, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc2, 0xad, 0xc2, 0x85}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xc2, 0xad, 0x9}, - output: [][]byte{[]byte{0xc2, 0xad, 0x9}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xc2, 0xad, 0x61}, - output: [][]byte{[]byte{0xc2, 0xad, 0x61}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xc2, 0xad, 0x41}, - output: [][]byte{[]byte{0xc2, 0xad, 0x41}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xc2, 0xad, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc2, 0xad, 0xc6, 0xbb}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xc2, 0xad, 0x30}, - output: [][]byte{[]byte{0xc2, 0xad, 0x30}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xc2, 0xad, 0x2e}, - output: [][]byte{[]byte{0xc2, 0xad, 0x2e}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xc2, 0xad, 0x21}, - output: [][]byte{[]byte{0xc2, 0xad, 0x21}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xc2, 0xad, 0x22}, - output: [][]byte{[]byte{0xc2, 0xad, 0x22}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xc2, 0xad, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad, 0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xc2, 0xad, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0xad, 0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x80}}, - }, - { - input: []byte{0xc2, 0xad, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xc2, 0xad, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80, 0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x1}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x1}}, - }, - { - input: []byte{0xcc, 0x80, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80, 0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xd}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xd}}, - }, - { - input: []byte{0xcc, 0x80, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80, 0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xa}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xa}}, - }, - { - input: []byte{0xcc, 0x80, 0xc2, 0x85}, - output: [][]byte{[]byte{0xcc, 0x80, 0xc2, 0x85}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0x85}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0x85}}, - }, - { - input: []byte{0xcc, 0x80, 0x9}, - output: [][]byte{[]byte{0xcc, 0x80, 0x9}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x9}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x9}}, - }, - { - input: []byte{0xcc, 0x80, 0x61}, - output: [][]byte{[]byte{0xcc, 0x80, 0x61}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x61}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x61}}, - }, - { - input: []byte{0xcc, 0x80, 0x41}, - output: [][]byte{[]byte{0xcc, 0x80, 0x41}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x41}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x41}}, - }, - { - input: []byte{0xcc, 0x80, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80, 0xc6, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xc6, 0xbb}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xc6, 0xbb}}, - }, - { - input: []byte{0xcc, 0x80, 0x30}, - output: [][]byte{[]byte{0xcc, 0x80, 0x30}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x30}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x30}}, - }, - { - input: []byte{0xcc, 0x80, 0x2e}, - output: [][]byte{[]byte{0xcc, 0x80, 0x2e}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x2e}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x2e}}, - }, - { - input: []byte{0xcc, 0x80, 0x21}, - output: [][]byte{[]byte{0xcc, 0x80, 0x21}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x21}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x21}}, - }, - { - input: []byte{0xcc, 0x80, 0x22}, - output: [][]byte{[]byte{0xcc, 0x80, 0x22}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x22}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x22}}, - }, - { - input: []byte{0xcc, 0x80, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80, 0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0x2c}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0x2c}}, - }, - { - input: []byte{0xcc, 0x80, 0xc2, 0xad}, - output: [][]byte{[]byte{0xcc, 0x80, 0xc2, 0xad}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0xad}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xc2, 0xad}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x80}}, - }, - { - input: []byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}, - output: [][]byte{[]byte{0xcc, 0x80, 0xcc, 0x88, 0xcc, 0x80}}, - }, - { - input: []byte{0xd, 0xa, 0x61, 0xa, 0xcc, 0x88}, - output: [][]byte{[]byte{0xd, 0xa}, []byte{0x61, 0xa}, []byte{0xcc, 0x88}}, - }, - { - input: []byte{0x61, 0xcc, 0x88}, - output: [][]byte{[]byte{0x61, 0xcc, 0x88}}, - }, - { - input: []byte{0x20, 0xe2, 0x80, 0x8d, 0xd9, 0x86}, - output: [][]byte{[]byte{0x20, 0xe2, 0x80, 0x8d, 0xd9, 0x86}}, - }, - { - input: []byte{0xd9, 0x86, 0xe2, 0x80, 0x8d, 0x20}, - output: [][]byte{[]byte{0xd9, 0x86, 0xe2, 0x80, 0x8d, 0x20}}, - }, - { - input: []byte{0x28, 0x22, 0x47, 0x6f, 0x2e, 0x22, 0x29, 0x20, 0x28, 0x48, 0x65, 0x20, 0x64, 0x69, 0x64, 0x2e, 0x29}, - output: [][]byte{[]byte{0x28, 0x22, 0x47, 0x6f, 0x2e, 0x22, 0x29, 0x20}, []byte{0x28, 0x48, 0x65, 0x20, 0x64, 0x69, 0x64, 0x2e, 0x29}}, - }, - { - input: []byte{0x28, 0xe2, 0x80, 0x9c, 0x47, 0x6f, 0x3f, 0xe2, 0x80, 0x9d, 0x29, 0x20, 0x28, 0x48, 0x65, 0x20, 0x64, 0x69, 0x64, 0x2e, 0x29}, - output: [][]byte{[]byte{0x28, 0xe2, 0x80, 0x9c, 0x47, 0x6f, 0x3f, 0xe2, 0x80, 0x9d, 0x29, 0x20}, []byte{0x28, 0x48, 0x65, 0x20, 0x64, 0x69, 0x64, 0x2e, 0x29}}, - }, - { - input: []byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x2e, 0x20, 0x69, 0x73}, - output: [][]byte{[]byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x2e, 0x20, 0x69, 0x73}}, - }, - { - input: []byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x3f, 0x20, 0x48, 0x65}, - output: [][]byte{[]byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x3f, 0x20}, []byte{0x48, 0x65}}, - }, - { - input: []byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x2e}, - output: [][]byte{[]byte{0x55, 0x2e, 0x53, 0x2e, 0x41, 0xcc, 0x80, 0x2e}}, - }, - { - input: []byte{0x33, 0x2e, 0x34}, - output: [][]byte{[]byte{0x33, 0x2e, 0x34}}, - }, - { - input: []byte{0x63, 0x2e, 0x64}, - output: [][]byte{[]byte{0x63, 0x2e, 0x64}}, - }, - { - input: []byte{0x43, 0x2e, 0x64}, - output: [][]byte{[]byte{0x43, 0x2e, 0x64}}, - }, - { - input: []byte{0x63, 0x2e, 0x44}, - output: [][]byte{[]byte{0x63, 0x2e, 0x44}}, - }, - { - input: []byte{0x43, 0x2e, 0x44}, - output: [][]byte{[]byte{0x43, 0x2e, 0x44}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0x74, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0x74, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0x54, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0}, []byte{0x54, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xe2, 0x80, 0x98, 0x28, 0x74, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xe2, 0x80, 0x98, 0x28, 0x74, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xe2, 0x80, 0x98, 0x28, 0x54, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0}, []byte{0xe2, 0x80, 0x98, 0x28, 0x54, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xcc, 0x88, 0x74, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xcc, 0x88, 0x74, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xcc, 0x88, 0x54, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xc2, 0xa0, 0xcc, 0x88}, []byte{0x54, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xcc, 0x88, 0x54, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xe2, 0x80, 0x99, 0xcc, 0x88}, []byte{0x54, 0x68, 0x65}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xa, 0xcc, 0x88, 0x54, 0x68, 0x65}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0x29, 0xa}, []byte{0xcc, 0x88, 0x54, 0x68, 0x65}}, - }, - { - input: []byte{0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x2e, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65}, - output: [][]byte{[]byte{0x74, 0x68, 0x65, 0x20, 0x72, 0x65, 0x73, 0x70, 0x2e, 0x20, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x20, 0x61, 0x72, 0x65}}, - }, - { - input: []byte{0xe5, 0xad, 0x97, 0x2e, 0xe5, 0xad, 0x97}, - output: [][]byte{[]byte{0xe5, 0xad, 0x97, 0x2e}, []byte{0xe5, 0xad, 0x97}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0xe5, 0xae, 0x83}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e}, []byte{0xe5, 0xae, 0x83}}, - }, - { - input: []byte{0x65, 0x74, 0x63, 0x2e, 0xe3, 0x80, 0x82}, - output: [][]byte{[]byte{0x65, 0x74, 0x63, 0x2e, 0xe3, 0x80, 0x82}}, - }, - { - input: []byte{0xe5, 0xad, 0x97, 0xe3, 0x80, 0x82, 0xe5, 0xae, 0x83}, - output: [][]byte{[]byte{0xe5, 0xad, 0x97, 0xe3, 0x80, 0x82}, []byte{0xe5, 0xae, 0x83}}, - }, - { - input: []byte{0x21, 0x20, 0x20}, - output: [][]byte{[]byte{0x21, 0x20, 0x20}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x22, 0xe2, 0x81, 0xa0, 0x47, 0xe2, 0x81, 0xa0, 0x6f, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x22, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x22, 0xe2, 0x81, 0xa0, 0x47, 0xe2, 0x81, 0xa0, 0x6f, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x22, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0}, []byte{0x28, 0xe2, 0x81, 0xa0, 0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x9c, 0xe2, 0x81, 0xa0, 0x47, 0xe2, 0x81, 0xa0, 0x6f, 0xe2, 0x81, 0xa0, 0x3f, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x9d, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x9c, 0xe2, 0x81, 0xa0, 0x47, 0xe2, 0x81, 0xa0, 0x6f, 0xe2, 0x81, 0xa0, 0x3f, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x9d, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0}, []byte{0x28, 0xe2, 0x81, 0xa0, 0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x2e, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x2e, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x69, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x3f, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x3f, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0}, []byte{0x48, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x55, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x53, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x41, 0xe2, 0x81, 0xa0, 0xcc, 0x80, 0x2e, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x33, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x34, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x33, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x34, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x43, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x43, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x44, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x44, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x43, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x44, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x43, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x44, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0}, []byte{0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x98, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x98, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x98, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0}, []byte{0xe2, 0x80, 0x98, 0xe2, 0x81, 0xa0, 0x28, 0xe2, 0x81, 0xa0, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xc2, 0xa0, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xe2, 0x80, 0x99, 0xe2, 0x81, 0xa0, 0xcc, 0x88}, []byte{0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xa, 0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x81, 0xa0, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x29, 0xe2, 0x81, 0xa0, 0xa}, []byte{0xe2, 0x81, 0xa0, 0xcc, 0x88, 0xe2, 0x81, 0xa0, 0x54, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0x70, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x6c, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x68, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0x70, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x6c, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0, 0x64, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x73, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x61, 0xe2, 0x81, 0xa0, 0x72, 0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0}, []byte{0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0xe5, 0xae, 0x83, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0}, []byte{0xe5, 0xae, 0x83, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0x82, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x65, 0xe2, 0x81, 0xa0, 0x74, 0xe2, 0x81, 0xa0, 0x63, 0xe2, 0x81, 0xa0, 0x2e, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0x82, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0x82, 0xe2, 0x81, 0xa0, 0xe5, 0xae, 0x83, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0xe5, 0xad, 0x97, 0xe2, 0x81, 0xa0, 0xe3, 0x80, 0x82, 0xe2, 0x81, 0xa0}, []byte{0xe5, 0xae, 0x83, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, - { - input: []byte{0xe2, 0x81, 0xa0, 0x21, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}, - output: [][]byte{[]byte{0xe2, 0x81, 0xa0, 0x21, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0x20, 0xe2, 0x81, 0xa0, 0xe2, 0x81, 0xa0}}, - }, -} diff --git a/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb b/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb deleted file mode 100644 index 422e4e5..0000000 --- a/vendor/github.com/apparentlymart/go-textseg/textseg/unicode2ragel.rb +++ /dev/null @@ -1,335 +0,0 @@ -#!/usr/bin/env ruby -# -# This scripted has been updated to accept more command-line arguments: -# -# -u, --url URL to process -# -m, --machine Machine name -# -p, --properties Properties to add to the machine -# -o, --output Write output to file -# -# Updated by: Marty Schoch -# -# This script uses the unicode spec to generate a Ragel state machine -# that recognizes unicode alphanumeric characters. It generates 5 -# character classes: uupper, ulower, ualpha, udigit, and ualnum. -# Currently supported encodings are UTF-8 [default] and UCS-4. -# -# Usage: unicode2ragel.rb [options] -# -e, --encoding [ucs4 | utf8] Data encoding -# -h, --help Show this message -# -# This script was originally written as part of the Ferret search -# engine library. -# -# Author: Rakan El-Khalil - -require 'optparse' -require 'open-uri' - -ENCODINGS = [ :utf8, :ucs4 ] -ALPHTYPES = { :utf8 => "byte", :ucs4 => "rune" } -DEFAULT_CHART_URL = "http://www.unicode.org/Public/5.1.0/ucd/DerivedCoreProperties.txt" -DEFAULT_MACHINE_NAME= "WChar" - -### -# Display vars & default option - -TOTAL_WIDTH = 80 -RANGE_WIDTH = 23 -@encoding = :utf8 -@chart_url = DEFAULT_CHART_URL -machine_name = DEFAULT_MACHINE_NAME -properties = [] -@output = $stdout - -### -# Option parsing - -cli_opts = OptionParser.new do |opts| - opts.on("-e", "--encoding [ucs4 | utf8]", "Data encoding") do |o| - @encoding = o.downcase.to_sym - end - opts.on("-h", "--help", "Show this message") do - puts opts - exit - end - opts.on("-u", "--url URL", "URL to process") do |o| - @chart_url = o - end - opts.on("-m", "--machine MACHINE_NAME", "Machine name") do |o| - machine_name = o - end - opts.on("-p", "--properties x,y,z", Array, "Properties to add to machine") do |o| - properties = o - end - opts.on("-o", "--output FILE", "output file") do |o| - @output = File.new(o, "w+") - end -end - -cli_opts.parse(ARGV) -unless ENCODINGS.member? @encoding - puts "Invalid encoding: #{@encoding}" - puts cli_opts - exit -end - -## -# Downloads the document at url and yields every alpha line's hex -# range and description. - -def each_alpha( url, property ) - open( url ) do |file| - file.each_line do |line| - next if line =~ /^#/; - next if line !~ /; #{property} #/; - - range, description = line.split(/;/) - range.strip! - description.gsub!(/.*#/, '').strip! - - if range =~ /\.\./ - start, stop = range.split '..' - else start = stop = range - end - - yield start.hex .. stop.hex, description - end - end -end - -### -# Formats to hex at minimum width - -def to_hex( n ) - r = "%0X" % n - r = "0#{r}" unless (r.length % 2).zero? - r -end - -### -# UCS4 is just a straight hex conversion of the unicode codepoint. - -def to_ucs4( range ) - rangestr = "0x" + to_hex(range.begin) - rangestr << "..0x" + to_hex(range.end) if range.begin != range.end - [ rangestr ] -end - -## -# 0x00 - 0x7f -> 0zzzzzzz[7] -# 0x80 - 0x7ff -> 110yyyyy[5] 10zzzzzz[6] -# 0x800 - 0xffff -> 1110xxxx[4] 10yyyyyy[6] 10zzzzzz[6] -# 0x010000 - 0x10ffff -> 11110www[3] 10xxxxxx[6] 10yyyyyy[6] 10zzzzzz[6] - -UTF8_BOUNDARIES = [0x7f, 0x7ff, 0xffff, 0x10ffff] - -def to_utf8_enc( n ) - r = 0 - if n <= 0x7f - r = n - elsif n <= 0x7ff - y = 0xc0 | (n >> 6) - z = 0x80 | (n & 0x3f) - r = y << 8 | z - elsif n <= 0xffff - x = 0xe0 | (n >> 12) - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = x << 16 | y << 8 | z - elsif n <= 0x10ffff - w = 0xf0 | (n >> 18) - x = 0x80 | (n >> 12) & 0x3f - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = w << 24 | x << 16 | y << 8 | z - end - - to_hex(r) -end - -def from_utf8_enc( n ) - n = n.hex - r = 0 - if n <= 0x7f - r = n - elsif n <= 0xdfff - y = (n >> 8) & 0x1f - z = n & 0x3f - r = y << 6 | z - elsif n <= 0xefffff - x = (n >> 16) & 0x0f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = x << 10 | y << 6 | z - elsif n <= 0xf7ffffff - w = (n >> 24) & 0x07 - x = (n >> 16) & 0x3f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = w << 18 | x << 12 | y << 6 | z - end - r -end - -### -# Given a range, splits it up into ranges that can be continuously -# encoded into utf8. Eg: 0x00 .. 0xff => [0x00..0x7f, 0x80..0xff] -# This is not strictly needed since the current [5.1] unicode standard -# doesn't have ranges that straddle utf8 boundaries. This is included -# for completeness as there is no telling if that will ever change. - -def utf8_ranges( range ) - ranges = [] - UTF8_BOUNDARIES.each do |max| - if range.begin <= max - if range.end <= max - ranges << range - return ranges - end - - ranges << (range.begin .. max) - range = (max + 1) .. range.end - end - end - ranges -end - -def build_range( start, stop ) - size = start.size/2 - left = size - 1 - return [""] if size < 1 - - a = start[0..1] - b = stop[0..1] - - ### - # Shared prefix - - if a == b - return build_range(start[2..-1], stop[2..-1]).map do |elt| - "0x#{a} " + elt - end - end - - ### - # Unshared prefix, end of run - - return ["0x#{a}..0x#{b} "] if left.zero? - - ### - # Unshared prefix, not end of run - # Range can be 0x123456..0x56789A - # Which is equivalent to: - # 0x123456 .. 0x12FFFF - # 0x130000 .. 0x55FFFF - # 0x560000 .. 0x56789A - - ret = [] - ret << build_range(start, a + "FF" * left) - - ### - # Only generate middle range if need be. - - if a.hex+1 != b.hex - max = to_hex(b.hex - 1) - max = "FF" if b == "FF" - ret << "0x#{to_hex(a.hex+1)}..0x#{max} " + "0x00..0xFF " * left - end - - ### - # Don't generate last range if it is covered by first range - - ret << build_range(b + "00" * left, stop) unless b == "FF" - ret.flatten! -end - -def to_utf8( range ) - utf8_ranges( range ).map do |r| - begin_enc = to_utf8_enc(r.begin) - end_enc = to_utf8_enc(r.end) - build_range begin_enc, end_enc - end.flatten! -end - -## -# Perform a 3-way comparison of the number of codepoints advertised by -# the unicode spec for the given range, the originally parsed range, -# and the resulting utf8 encoded range. - -def count_codepoints( code ) - code.split(' ').inject(1) do |acc, elt| - if elt =~ /0x(.+)\.\.0x(.+)/ - if @encoding == :utf8 - acc * (from_utf8_enc($2) - from_utf8_enc($1) + 1) - else - acc * ($2.hex - $1.hex + 1) - end - else - acc - end - end -end - -def is_valid?( range, desc, codes ) - spec_count = 1 - spec_count = $1.to_i if desc =~ /\[(\d+)\]/ - range_count = range.end - range.begin + 1 - - sum = codes.inject(0) { |acc, elt| acc + count_codepoints(elt) } - sum == spec_count and sum == range_count -end - -## -# Generate the state maching to stdout - -def generate_machine( name, property ) - pipe = " " - @output.puts " #{name} = " - each_alpha( @chart_url, property ) do |range, desc| - - codes = (@encoding == :ucs4) ? to_ucs4(range) : to_utf8(range) - - #raise "Invalid encoding of range #{range}: #{codes.inspect}" unless - # is_valid? range, desc, codes - - range_width = codes.map { |a| a.size }.max - range_width = RANGE_WIDTH if range_width < RANGE_WIDTH - - desc_width = TOTAL_WIDTH - RANGE_WIDTH - 11 - desc_width -= (range_width - RANGE_WIDTH) if range_width > RANGE_WIDTH - - if desc.size > desc_width - desc = desc[0..desc_width - 4] + "..." - end - - codes.each_with_index do |r, idx| - desc = "" unless idx.zero? - code = "%-#{range_width}s" % r - @output.puts " #{pipe} #{code} ##{desc}" - pipe = "|" - end - end - @output.puts " ;" - @output.puts "" -end - -@output.puts <= e.label - }) - if idx < num && n.edges[idx].label == e.label { - n.edges[idx].node = e.node - return - } - panic("replacing missing edge") -} - -func (n *node) getEdge(label byte) *node { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - return n.edges[idx].node - } - return nil -} - -func (n *node) delEdge(label byte) { - num := len(n.edges) - idx := sort.Search(num, func(i int) bool { - return n.edges[i].label >= label - }) - if idx < num && n.edges[idx].label == label { - copy(n.edges[idx:], n.edges[idx+1:]) - n.edges[len(n.edges)-1] = edge{} - n.edges = n.edges[:len(n.edges)-1] - } -} - -type edges []edge - -func (e edges) Len() int { - return len(e) -} - -func (e edges) Less(i, j int) bool { - return e[i].label < e[j].label -} - -func (e edges) Swap(i, j int) { - e[i], e[j] = e[j], e[i] -} - -func (e edges) Sort() { - sort.Sort(e) -} - -// Tree implements a radix tree. This can be treated as a -// Dictionary abstract data type. The main advantage over -// a standard hash map is prefix-based lookups and -// ordered iteration, -type Tree struct { - root *node - size int -} - -// New returns an empty Tree -func New() *Tree { - return NewFromMap(nil) -} - -// NewFromMap returns a new tree containing the keys -// from an existing map -func NewFromMap(m map[string]interface{}) *Tree { - t := &Tree{root: &node{}} - for k, v := range m { - t.Insert(k, v) - } - return t -} - -// Len is used to return the number of elements in the tree -func (t *Tree) Len() int { - return t.size -} - -// longestPrefix finds the length of the shared prefix -// of two strings -func longestPrefix(k1, k2 string) int { - max := len(k1) - if l := len(k2); l < max { - max = l - } - var i int - for i = 0; i < max; i++ { - if k1[i] != k2[i] { - break - } - } - return i -} - -// Insert is used to add a newentry or update -// an existing entry. Returns if updated. -func (t *Tree) Insert(s string, v interface{}) (interface{}, bool) { - var parent *node - n := t.root - search := s - for { - // Handle key exhaution - if len(search) == 0 { - if n.isLeaf() { - old := n.leaf.val - n.leaf.val = v - return old, true - } - - n.leaf = &leafNode{ - key: s, - val: v, - } - t.size++ - return nil, false - } - - // Look for the edge - parent = n - n = n.getEdge(search[0]) - - // No edge, create one - if n == nil { - e := edge{ - label: search[0], - node: &node{ - leaf: &leafNode{ - key: s, - val: v, - }, - prefix: search, - }, - } - parent.addEdge(e) - t.size++ - return nil, false - } - - // Determine longest prefix of the search key on match - commonPrefix := longestPrefix(search, n.prefix) - if commonPrefix == len(n.prefix) { - search = search[commonPrefix:] - continue - } - - // Split the node - t.size++ - child := &node{ - prefix: search[:commonPrefix], - } - parent.replaceEdge(edge{ - label: search[0], - node: child, - }) - - // Restore the existing node - child.addEdge(edge{ - label: n.prefix[commonPrefix], - node: n, - }) - n.prefix = n.prefix[commonPrefix:] - - // Create a new leaf node - leaf := &leafNode{ - key: s, - val: v, - } - - // If the new key is a subset, add to to this node - search = search[commonPrefix:] - if len(search) == 0 { - child.leaf = leaf - return nil, false - } - - // Create a new edge for the node - child.addEdge(edge{ - label: search[0], - node: &node{ - leaf: leaf, - prefix: search, - }, - }) - return nil, false - } -} - -// Delete is used to delete a key, returning the previous -// value and if it was deleted -func (t *Tree) Delete(s string) (interface{}, bool) { - var parent *node - var label byte - n := t.root - search := s - for { - // Check for key exhaution - if len(search) == 0 { - if !n.isLeaf() { - break - } - goto DELETE - } - - // Look for an edge - parent = n - label = search[0] - n = n.getEdge(label) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - return nil, false - -DELETE: - // Delete the leaf - leaf := n.leaf - n.leaf = nil - t.size-- - - // Check if we should delete this node from the parent - if parent != nil && len(n.edges) == 0 { - parent.delEdge(label) - } - - // Check if we should merge this node - if n != t.root && len(n.edges) == 1 { - n.mergeChild() - } - - // Check if we should merge the parent's other child - if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() { - parent.mergeChild() - } - - return leaf.val, true -} - -// DeletePrefix is used to delete the subtree under a prefix -// Returns how many nodes were deleted -// Use this to delete large subtrees efficiently -func (t *Tree) DeletePrefix(s string) int { - return t.deletePrefix(nil, t.root, s) -} - -// delete does a recursive deletion -func (t *Tree) deletePrefix(parent, n *node, prefix string) int { - // Check for key exhaustion - if len(prefix) == 0 { - // Remove the leaf node - subTreeSize := 0 - //recursively walk from all edges of the node to be deleted - recursiveWalk(n, func(s string, v interface{}) bool { - subTreeSize++ - return false - }) - if n.isLeaf() { - n.leaf = nil - } - n.edges = nil // deletes the entire subtree - - // Check if we should merge the parent's other child - if parent != nil && parent != t.root && len(parent.edges) == 1 && !parent.isLeaf() { - parent.mergeChild() - } - t.size -= subTreeSize - return subTreeSize - } - - // Look for an edge - label := prefix[0] - child := n.getEdge(label) - if child == nil || (!strings.HasPrefix(child.prefix, prefix) && !strings.HasPrefix(prefix, child.prefix)) { - return 0 - } - - // Consume the search prefix - if len(child.prefix) > len(prefix) { - prefix = prefix[len(prefix):] - } else { - prefix = prefix[len(child.prefix):] - } - return t.deletePrefix(n, child, prefix) -} - -func (n *node) mergeChild() { - e := n.edges[0] - child := e.node - n.prefix = n.prefix + child.prefix - n.leaf = child.leaf - n.edges = child.edges -} - -// Get is used to lookup a specific key, returning -// the value and if it was found -func (t *Tree) Get(s string) (interface{}, bool) { - n := t.root - search := s - for { - // Check for key exhaution - if len(search) == 0 { - if n.isLeaf() { - return n.leaf.val, true - } - break - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - return nil, false -} - -// LongestPrefix is like Get, but instead of an -// exact match, it will return the longest prefix match. -func (t *Tree) LongestPrefix(s string) (string, interface{}, bool) { - var last *leafNode - n := t.root - search := s - for { - // Look for a leaf node - if n.isLeaf() { - last = n.leaf - } - - // Check for key exhaution - if len(search) == 0 { - break - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } - if last != nil { - return last.key, last.val, true - } - return "", nil, false -} - -// Minimum is used to return the minimum value in the tree -func (t *Tree) Minimum() (string, interface{}, bool) { - n := t.root - for { - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - if len(n.edges) > 0 { - n = n.edges[0].node - } else { - break - } - } - return "", nil, false -} - -// Maximum is used to return the maximum value in the tree -func (t *Tree) Maximum() (string, interface{}, bool) { - n := t.root - for { - if num := len(n.edges); num > 0 { - n = n.edges[num-1].node - continue - } - if n.isLeaf() { - return n.leaf.key, n.leaf.val, true - } - break - } - return "", nil, false -} - -// Walk is used to walk the tree -func (t *Tree) Walk(fn WalkFn) { - recursiveWalk(t.root, fn) -} - -// WalkPrefix is used to walk the tree under a prefix -func (t *Tree) WalkPrefix(prefix string, fn WalkFn) { - n := t.root - search := prefix - for { - // Check for key exhaution - if len(search) == 0 { - recursiveWalk(n, fn) - return - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - break - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - - } else if strings.HasPrefix(n.prefix, search) { - // Child may be under our search prefix - recursiveWalk(n, fn) - return - } else { - break - } - } - -} - -// WalkPath is used to walk the tree, but only visiting nodes -// from the root down to a given leaf. Where WalkPrefix walks -// all the entries *under* the given prefix, this walks the -// entries *above* the given prefix. -func (t *Tree) WalkPath(path string, fn WalkFn) { - n := t.root - search := path - for { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return - } - - // Check for key exhaution - if len(search) == 0 { - return - } - - // Look for an edge - n = n.getEdge(search[0]) - if n == nil { - return - } - - // Consume the search prefix - if strings.HasPrefix(search, n.prefix) { - search = search[len(n.prefix):] - } else { - break - } - } -} - -// recursiveWalk is used to do a pre-order walk of a node -// recursively. Returns true if the walk should be aborted -func recursiveWalk(n *node, fn WalkFn) bool { - // Visit the leaf values if any - if n.leaf != nil && fn(n.leaf.key, n.leaf.val) { - return true - } - - // Recurse on the children - for _, e := range n.edges { - if recursiveWalk(e.node, fn) { - return true - } - } - return false -} - -// ToMap is used to walk the tree and convert it into a map -func (t *Tree) ToMap() map[string]interface{} { - out := make(map[string]interface{}, t.size) - t.Walk(func(k string, v interface{}) bool { - out[k] = v - return false - }) - return out -} diff --git a/vendor/github.com/armon/go-radix/radix_test.go b/vendor/github.com/armon/go-radix/radix_test.go deleted file mode 100644 index a7a4eab..0000000 --- a/vendor/github.com/armon/go-radix/radix_test.go +++ /dev/null @@ -1,359 +0,0 @@ -package radix - -import ( - crand "crypto/rand" - "fmt" - "reflect" - "sort" - "testing" -) - -func TestRadix(t *testing.T) { - var min, max string - inp := make(map[string]interface{}) - for i := 0; i < 1000; i++ { - gen := generateUUID() - inp[gen] = i - if gen < min || i == 0 { - min = gen - } - if gen > max || i == 0 { - max = gen - } - } - - r := NewFromMap(inp) - if r.Len() != len(inp) { - t.Fatalf("bad length: %v %v", r.Len(), len(inp)) - } - - r.Walk(func(k string, v interface{}) bool { - println(k) - return false - }) - - for k, v := range inp { - out, ok := r.Get(k) - if !ok { - t.Fatalf("missing key: %v", k) - } - if out != v { - t.Fatalf("value mis-match: %v %v", out, v) - } - } - - // Check min and max - outMin, _, _ := r.Minimum() - if outMin != min { - t.Fatalf("bad minimum: %v %v", outMin, min) - } - outMax, _, _ := r.Maximum() - if outMax != max { - t.Fatalf("bad maximum: %v %v", outMax, max) - } - - for k, v := range inp { - out, ok := r.Delete(k) - if !ok { - t.Fatalf("missing key: %v", k) - } - if out != v { - t.Fatalf("value mis-match: %v %v", out, v) - } - } - if r.Len() != 0 { - t.Fatalf("bad length: %v", r.Len()) - } -} - -func TestRoot(t *testing.T) { - r := New() - _, ok := r.Delete("") - if ok { - t.Fatalf("bad") - } - _, ok = r.Insert("", true) - if ok { - t.Fatalf("bad") - } - val, ok := r.Get("") - if !ok || val != true { - t.Fatalf("bad: %v", val) - } - val, ok = r.Delete("") - if !ok || val != true { - t.Fatalf("bad: %v", val) - } -} - -func TestDelete(t *testing.T) { - - r := New() - - s := []string{"", "A", "AB"} - - for _, ss := range s { - r.Insert(ss, true) - } - - for _, ss := range s { - _, ok := r.Delete(ss) - if !ok { - t.Fatalf("bad %q", ss) - } - } -} - -func TestDeletePrefix(t *testing.T) { - type exp struct { - inp[] string - prefix string - out[] string - numDeleted int - } - - cases := []exp{ - {[]string{"", "A", "AB", "ABC", "R", "S"}, "A", []string{"", "R", "S"}, 3}, - {[]string{"", "A", "AB", "ABC", "R", "S"}, "ABC", []string{"", "A", "AB", "R", "S"}, 1}, - {[]string{"", "A", "AB", "ABC", "R", "S"}, "", []string{}, 6}, - {[]string{"", "A", "AB", "ABC", "R", "S"}, "S", []string{"", "A", "AB", "ABC", "R"}, 1}, - {[]string{"", "A", "AB", "ABC", "R", "S"}, "SS", []string{"", "A", "AB", "ABC", "R", "S"}, 0}, - } - - for _, test := range cases { - r := New() - for _, ss := range test.inp { - r.Insert(ss, true) - } - - deleted := r.DeletePrefix(test.prefix) - if deleted != test.numDeleted { - t.Fatalf("Bad delete, expected %v to be deleted but got %v", test.numDeleted, deleted) - } - - out := []string{} - fn := func(s string, v interface{}) bool { - out = append(out, s) - return false - } - r.Walk(fn) - - if !reflect.DeepEqual(out, test.out) { - t.Fatalf("mis-match: %v %v", out, test.out) - } - } -} - -func TestLongestPrefix(t *testing.T) { - r := New() - - keys := []string{ - "", - "foo", - "foobar", - "foobarbaz", - "foobarbazzip", - "foozip", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out string - } - cases := []exp{ - {"a", ""}, - {"abc", ""}, - {"fo", ""}, - {"foo", "foo"}, - {"foob", "foo"}, - {"foobar", "foobar"}, - {"foobarba", "foobar"}, - {"foobarbaz", "foobarbaz"}, - {"foobarbazzi", "foobarbaz"}, - {"foobarbazzip", "foobarbazzip"}, - {"foozi", "foo"}, - {"foozip", "foozip"}, - {"foozipzap", "foozip"}, - } - for _, test := range cases { - m, _, ok := r.LongestPrefix(test.inp) - if !ok { - t.Fatalf("no match: %v", test) - } - if m != test.out { - t.Fatalf("mis-match: %v %v", m, test) - } - } -} - -func TestWalkPrefix(t *testing.T) { - r := New() - - keys := []string{ - "foobar", - "foo/bar/baz", - "foo/baz/bar", - "foo/zip/zap", - "zipzap", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out []string - } - cases := []exp{ - { - "f", - []string{"foobar", "foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foo", - []string{"foobar", "foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foob", - []string{"foobar"}, - }, - { - "foo/", - []string{"foo/bar/baz", "foo/baz/bar", "foo/zip/zap"}, - }, - { - "foo/b", - []string{"foo/bar/baz", "foo/baz/bar"}, - }, - { - "foo/ba", - []string{"foo/bar/baz", "foo/baz/bar"}, - }, - { - "foo/bar", - []string{"foo/bar/baz"}, - }, - { - "foo/bar/baz", - []string{"foo/bar/baz"}, - }, - { - "foo/bar/bazoo", - []string{}, - }, - { - "z", - []string{"zipzap"}, - }, - } - - for _, test := range cases { - out := []string{} - fn := func(s string, v interface{}) bool { - out = append(out, s) - return false - } - r.WalkPrefix(test.inp, fn) - sort.Strings(out) - sort.Strings(test.out) - if !reflect.DeepEqual(out, test.out) { - t.Fatalf("mis-match: %v %v", out, test.out) - } - } -} - -func TestWalkPath(t *testing.T) { - r := New() - - keys := []string{ - "foo", - "foo/bar", - "foo/bar/baz", - "foo/baz/bar", - "foo/zip/zap", - "zipzap", - } - for _, k := range keys { - r.Insert(k, nil) - } - if r.Len() != len(keys) { - t.Fatalf("bad len: %v %v", r.Len(), len(keys)) - } - - type exp struct { - inp string - out []string - } - cases := []exp{ - { - "f", - []string{}, - }, - { - "foo", - []string{"foo"}, - }, - { - "foo/", - []string{"foo"}, - }, - { - "foo/ba", - []string{"foo"}, - }, - { - "foo/bar", - []string{"foo", "foo/bar"}, - }, - { - "foo/bar/baz", - []string{"foo", "foo/bar", "foo/bar/baz"}, - }, - { - "foo/bar/bazoo", - []string{"foo", "foo/bar", "foo/bar/baz"}, - }, - { - "z", - []string{}, - }, - } - - for _, test := range cases { - out := []string{} - fn := func(s string, v interface{}) bool { - out = append(out, s) - return false - } - r.WalkPath(test.inp, fn) - sort.Strings(out) - sort.Strings(test.out) - if !reflect.DeepEqual(out, test.out) { - t.Fatalf("mis-match: %v %v", out, test.out) - } - } -} - -// generateUUID is used to generate a random UUID -func generateUUID() string { - buf := make([]byte, 16) - if _, err := crand.Read(buf); err != nil { - panic(fmt.Errorf("failed to read random bytes: %v", err)) - } - - return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", - buf[0:4], - buf[4:6], - buf[6:8], - buf[8:10], - buf[10:16]) -} 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 fb11cec..0000000 --- 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 395878d..0000000 --- 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 4b86136..0000000 --- a/vendor/github.com/aws/aws-sdk-go/.travis.yml +++ /dev/null @@ -1,29 +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 - -branches: - only: - - master 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 986c5e5..0000000 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ /dev/null @@ -1,2652 +0,0 @@ -Release v1.12.66 (2018-01-19) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/glue`: Updates service API and documentation - * New AWS Glue DataCatalog APIs to manage table versions and a new feature to skip archiving of the old table version when updating table. -* `service/transcribe`: Adds new service - -Release v1.12.65 (2018-01-18) -=== - -### Service Client Updates -* `service/sagemaker`: Updates service API and documentation - * CreateTrainingJob and CreateEndpointConfig now supports KMS Key for volume encryption. - -Release v1.12.64 (2018-01-17) -=== - -### Service Client Updates -* `service/autoscaling-plans`: Updates service documentation -* `service/ec2`: Updates service documentation - * Documentation updates for EC2 - -Release v1.12.63 (2018-01-17) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service API and documentation -* `service/autoscaling-plans`: Adds new service -* `service/rds`: Updates service API and documentation - * With this release you can now integrate RDS DB instances with CloudWatch Logs. We have added parameters to the operations for creating and modifying DB instances (for example CreateDBInstance) to allow you to take advantage of this capability through the CLI and API. Once you enable this feature, a stream of log events will publish to CloudWatch Logs for each log type you enable. - -Release v1.12.62 (2018-01-15) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lambda`: Updates service API and documentation - * Support for creating Lambda Functions using 'dotnetcore2.0' and 'go1.x'. - -Release v1.12.61 (2018-01-12) -=== - -### Service Client Updates -* `service/glue`: Updates service API and documentation - * Support is added to generate ETL scripts in Scala which can now be run by AWS Glue ETL jobs. In addition, the trigger API now supports firing when any conditions are met (in addition to all conditions). Also, jobs can be triggered based on a "failed" or "stopped" job run (in addition to a "succeeded" job run). - -Release v1.12.60 (2018-01-11) -=== - -### Service Client Updates -* `service/elasticloadbalancing`: Updates service API and documentation -* `service/elasticloadbalancingv2`: Updates service API and documentation -* `service/rds`: Updates service API and documentation - * Read Replicas for Amazon RDS for MySQL, MariaDB, and PostgreSQL now support Multi-AZ deployments.Amazon RDS Read Replicas enable you to create one or more read-only copies of your database instance within the same AWS Region or in a different AWS Region. Updates made to the source database are asynchronously copied to the Read Replicas. In addition to providing scalability for read-heavy workloads, you can choose to promote a Read Replica to become standalone a DB instance when needed.Amazon RDS Multi-AZ Deployments provide enhanced availability for database instances within a single AWS Region. With Multi-AZ, your data is synchronously replicated to a standby in a different Availability Zone (AZ). In case of an infrastructure failure, Amazon RDS performs an automatic failover to the standby, minimizing disruption to your applications.You can now combine Read Replicas with Multi-AZ as part of a disaster recovery strategy for your production databases. A well-designed and tested plan is critical for maintaining business continuity after a disaster. Since Read Replicas can also be created in different regions than the source database, your Read Replica can be promoted to become the new production database in case of a regional disruption.You can also combine Read Replicas with Multi-AZ for your database engine upgrade process. You can create a Read Replica of your production database instance and upgrade it to a new database engine version. When the upgrade is complete, you can stop applications, promote the Read Replica to a standalone database instance and switch over your applications. Since the database instance is already a Multi-AZ deployment, no additional steps are needed.For more information, see the Amazon RDS User Guide. -* `service/ssm`: Updates service documentation - * Updates documentation for the HierarchyLevelLimitExceededException error. - -Release v1.12.59 (2018-01-09) -=== - -### Service Client Updates -* `service/kms`: Updates service documentation - * Documentation updates for AWS KMS - -Release v1.12.58 (2018-01-09) -=== - -### Service Client Updates -* `service/ds`: Updates service API and documentation - * On October 24 we introduced AWS Directory Service for Microsoft Active Directory (Standard Edition), also known as AWS Microsoft AD (Standard Edition), which is a managed Microsoft Active Directory (AD) that is optimized for small and midsize businesses (SMBs). With this SDK release, you can now create an AWS Microsoft AD directory using API. This enables you to run typical SMB workloads using a cost-effective, highly available, and managed Microsoft AD in the AWS Cloud. - -Release v1.12.57 (2018-01-08) -=== - -### Service Client Updates -* `service/codedeploy`: Updates service API and documentation - * The AWS CodeDeploy API was updated to support DeleteGitHubAccountToken, a new method that deletes a GitHub account connection. -* `service/discovery`: Updates service API and documentation - * Documentation updates for AWS Application Discovery Service. -* `service/route53`: Updates service API and documentation - * This release adds an exception to the CreateTrafficPolicyVersion API operation. - -Release v1.12.56 (2018-01-05) -=== - -### Service Client Updates -* `service/inspector`: Updates service API, documentation, and examples - * Added 2 new attributes to the DescribeAssessmentTemplate response, indicating the total number of assessment runs and last assessment run ARN (if present.) -* `service/snowball`: Updates service documentation - * Documentation updates for snowball -* `service/ssm`: Updates service documentation - * Documentation updates for ssm - -Release v1.12.55 (2018-01-02) -=== - -### Service Client Updates -* `service/rds`: Updates service documentation - * Documentation updates for rds - -Release v1.12.54 (2017-12-29) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/workspaces`: Updates service API and documentation - * Modify WorkSpaces have been updated with flexible storage and switching of hardware bundles feature. The following configurations have been added to ModifyWorkSpacesProperties: storage and compute. This update provides the capability to configure the storage of a WorkSpace. It also adds the capability of switching hardware bundle of a WorkSpace by specifying an eligible compute (Value, Standard, Performance, Power). - -Release v1.12.53 (2017-12-22) -=== - -### Service Client Updates -* `service/ec2`: Updates service API - * This release fixes an issue with tags not showing in DescribeAddresses responses. -* `service/ecs`: Updates service API and documentation - * Amazon ECS users can now set a health check initialization wait period of their ECS services, the services that are associated with an Elastic Load Balancer (ELB) will wait for a period of time before the ELB become healthy. You can now configure this in Create and Update Service. -* `service/inspector`: Updates service API and documentation - * PreviewAgents API now returns additional fields within the AgentPreview data type. The API now shows the agent health and availability status for all instances included in the assessment target. This allows users to check the health status of Inspector Agents before running an assessment. In addition, it shows the instance ID, hostname, and IP address of the targeted instances. -* `service/sagemaker`: Updates service API and documentation - * SageMaker Models no longer support SupplementalContainers. API's that have been affected are CreateModel and DescribeModel. - -Release v1.12.52 (2017-12-21) -=== - -### Service Client Updates -* `service/codebuild`: Updates service API and documentation - * Adding support allowing AWS CodeBuild customers to select specific curated image versions. -* `service/ec2`: Updates service API and documentation - * Elastic IP tagging enables you to add key and value metadata to your Elastic IPs so that you can search, filter, and organize them according to your organization's needs. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/kinesisanalytics`: Updates service API and documentation - * Kinesis Analytics now supports AWS Lambda functions as output. - -Release v1.12.51 (2017-12-21) -=== - -### Service Client Updates -* `service/config`: Updates service API -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/iot`: Updates service API and documentation - * This release adds support for code signed Over-the-air update functionality for Amazon FreeRTOS. Users can now create and schedule Over-the-air updates to their Amazon FreeRTOS devices using these new APIs. - -Release v1.12.50 (2017-12-19) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * API Gateway now adds support for calling API with compressed payloads using one of the supported content codings, tagging an API stage for cost allocation, and returning API keys from a custom authorizer for use with a usage plan. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/mediastore-data`: Updates service documentation -* `service/route53`: Updates service API and documentation - * Route 53 added support for a new China (Ningxia) region, cn-northwest-1. You can now specify cn-northwest-1 as the region for latency-based or geoproximity routing. Route 53 also added support for a new EU (Paris) region, eu-west-3. You can now associate VPCs in eu-west-3 with private hosted zones and create alias records that route traffic to resources in eu-west-3. - -Release v1.12.49 (2017-12-19) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/monitoring`: Updates service documentation - * Documentation updates for monitoring - -Release v1.12.48 (2017-12-15) -=== - -### Service Client Updates -* `service/appstream`: Updates service API and documentation - * This API update is to enable customers to add tags to their Amazon AppStream 2.0 resources - -Release v1.12.47 (2017-12-14) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * Adds support for Cognito Authorizer scopes at the API method level. -* `service/email`: Updates service documentation - * Added information about the maximum number of transactions per second for the SendCustomVerificationEmail operation. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.46 (2017-12-12) -=== - -### Service Client Updates -* `service/workmail`: Adds new service - * Today, Amazon WorkMail released an administrative SDK and enabled AWS CloudTrail integration. With the administrative SDK, you can natively integrate WorkMail with your existing services. The SDK enables programmatic user, resource, and group management through API calls. This means your existing IT tools and workflows can now automate WorkMail management, and third party applications can streamline WorkMail migrations and account actions. - -Release v1.12.45 (2017-12-11) -=== - -### Service Client Updates -* `service/cognito-idp`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lex-models`: Updates service API and documentation -* `service/sagemaker`: Updates service API - * CreateModel API Update: The request parameter 'ExecutionRoleArn' has changed from optional to required. - -Release v1.12.44 (2017-12-08) -=== - -### Service Client Updates -* `service/appstream`: Updates service API and documentation - * This API update is to support the feature that allows customers to automatically consume the latest Amazon AppStream 2.0 agent as and when published by AWS. -* `service/ecs`: Updates service documentation - * Documentation updates for Windows containers. -* `service/monitoring`: Updates service API and documentation - * With this launch, you can now create a CloudWatch alarm that alerts you when M out of N datapoints of a metric are breaching your predefined threshold, such as three out of five times in any given five minutes interval or two out of six times in a thirty minutes interval. When M out of N datapoints are not breaching your threshold in an interval, the alarm will be in OK state. Please note that the M datapoints out of N datapoints in an interval can be of any order and does not need to be consecutive. Consequently, you can now get alerted even when the spikes in your metrics are intermittent over an interval. - -Release v1.12.43 (2017-12-07) -=== - -### Service Client Updates -* `service/email`: Updates service API, documentation, and paginators - * Customers can customize the emails that Amazon SES sends when verifying new identities. This feature is helpful for developers whose applications send email through Amazon SES on behalf of their customers. -* `service/es`: Updates service API and documentation - * Added support for encryption of data at rest on Amazon Elasticsearch Service using AWS KMS - -### SDK Bugs -* `models/apis` Fixes removes colliding sagemaker models folders ([#1686](https://github.com/aws/aws-sdk-go/pull/1686)) - * Fixes Release v1.12.42's SageMaker vs sagemaker model folders. -Release v1.12.42 (2017-12-06) -=== - -### Service Client Updates -* `service/clouddirectory`: Updates service API and documentation - * Amazon Cloud Directory makes it easier for you to apply schema changes across your directories with in-place schema upgrades. Your directories now remain available while backward-compatible schema changes are being applied, such as the addition of new fields. You also can view the history of your schema changes in Cloud Directory by using both major and minor version identifiers, which can help you track and audit schema versions across directories. -* `service/elasticbeanstalk`: Updates service documentation - * Documentation updates for AWS Elastic Beanstalk. -* `service/sagemaker`: Adds new service - * Initial waiters for common SageMaker workflows. - -Release v1.12.41 (2017-12-05) -=== - -### Service Client Updates -* `service/iot`: Updates service API and documentation - * Add error action API for RulesEngine. -* `service/servicecatalog`: Updates service API and documentation - * ServiceCatalog has two distinct personas for its use, an "admin" persona (who creates sets of products with different versions and prescribes who has access to them) and an "end-user" persona (who can launch cloud resources based on the configuration data their admins have given them access to). This API update will allow admin users to deactivate/activate product versions, end-user will only be able to access and launch active product versions. -* `service/servicediscovery`: Adds new service - * Amazon Route 53 Auto Naming lets you configure public or private namespaces that your microservice applications run in. When instances of the service become available, you can call the Auto Naming API to register the instance, and Amazon Route 53 automatically creates up to five DNS records and an optional health check. Clients that submit DNS queries for the service receive an answer that contains up to eight healthy records. - -Release v1.12.40 (2017-12-04) -=== - -### Service Client Updates -* `service/budgets`: Updates service API and documentation - * Add additional costTypes to support finer control for different charges included in a cost budget. -* `service/ecs`: Updates service documentation - * Documentation updates for ecs - -Release v1.12.39 (2017-12-01) -=== - -### Service Client Updates -* `service/SageMaker`: Updates service waiters - -Release v1.12.38 (2017-11-30) -=== - -### Service Client Updates -* `service/AWSMoneypenny`: Adds new service -* `service/Cloud9`: Adds new service -* `service/Serverless Registry`: Adds new service -* `service/apigateway`: Updates service API, documentation, and paginators - * Added support Private Integration and VPC Link features in API Gateway. This allows to create an API with the API Gateway private integration, thus providing clients access to HTTP/HTTPS resources in an Amazon VPC from outside of the VPC through a VpcLink resource. -* `service/ec2`: Updates service API and documentation - * Adds the following updates: 1. Spread Placement ensures that instances are placed on distinct hardware in order to reduce correlated failures. 2. Inter-region VPC Peering allows customers to peer VPCs across different AWS regions without requiring additional gateways, VPN connections or physical hardware -* `service/lambda`: Updates service API and documentation - * AWS Lambda now supports the ability to set the concurrency limits for individual functions, and increasing memory to 3008 MB. - -Release v1.12.37 (2017-11-30) -=== - -### Service Client Updates -* `service/Ardi`: Adds new service -* `service/autoscaling`: Updates service API and documentation - * You can now use Auto Scaling with EC2 Launch Templates via the CreateAutoScalingGroup and UpdateAutoScalingGroup APIs. -* `service/ec2`: Updates service API and documentation - * Adds the following updates: 1. T2 Unlimited enables high CPU performance for any period of time whenever required 2. You are now able to create and launch EC2 m5 and h1 instances -* `service/lightsail`: Updates service API and documentation - * This release adds support for load balancer and TLS/SSL certificate management. This set of APIs allows customers to create, manage, and scale secure load balanced applications on Lightsail infrastructure. To provide support for customers who manage their DNS on Lightsail, we've added the ability create an Alias A type record which can point to a load balancer DNS name via the CreateDomainEntry API http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_CreateDomainEntry.html. -* `service/ssm`: Updates service API and documentation - * This release updates AWS Systems Manager APIs to enable executing automations at controlled rate, target resources in a resource groups and execute entire automation at once or single step at a time. It is now also possible to use YAML, in addition to JSON, when creating Systems Manager documents. -* `service/waf`: Updates service API and documentation - * This release adds support for rule group and managed rule group. Rule group is a container of rules that customers can create, put rules in it and associate the rule group to a WebACL. All rules in a rule group will function identically as they would if each rule was individually associated to the WebACL. Managed rule group is a pre-configured rule group composed by our security partners and made available via the AWS Marketplace. Customers can subscribe to these managed rule groups, associate the managed rule group to their WebACL and start using them immediately to protect their resources. -* `service/waf-regional`: Updates service API and documentation - -Release v1.12.36 (2017-11-29) -=== - -### Service Client Updates -* `service/DeepInsight`: Adds new service -* `service/IronmanRuntime`: Adds new service -* `service/Orchestra - Laser`: Adds new service -* `service/SageMaker`: Adds new service -* `service/Shine`: Adds new service -* `service/archived.kinesisvideo`: Adds new service -* `service/data.kinesisvideo`: Adds new service -* `service/dynamodb`: Updates service API and documentation - * Amazon DynamoDB now supports the following features: Global Table and On-Demand Backup. Global Table is a fully-managed, multi-region, multi-master database. DynamoDB customers can now write anywhere and read anywhere with single-digit millisecond latency by performing database operations closest to where end users reside. Global Table also enables customers to disaster-proof their applications, keeping them running and data accessible even in the face of natural disasters or region disruptions. Customers can set up Global Table with just a few clicks in the AWS Management Console-no application rewrites required. On-Demand Backup capability is to protect data from loss due to application errors, and meet customers' archival needs for compliance and regulatory reasons. Customers can backup and restore their DynamoDB table data anytime, with a single-click in the AWS management console or a single API call. Backup and restore actions execute with zero impact on table performance or availability. For more information, see the Amazon DynamoDB Developer Guide. -* `service/ecs`: Updates service API and documentation - * Amazon Elastic Container Service (Amazon ECS) released a new launch type for running containers on a serverless infrastructure. The Fargate launch type allows you to run your containerized applications without the need to provision and manage the backend infrastructure. Just register your task definition and Fargate launches the container for you. -* `service/glacier`: Updates service API and documentation - * This release includes support for Glacier Select, a new feature that allows you to filter and analyze your Glacier archives and store the results in a user-specified S3 location. -* `service/greengrass`: Updates service API and documentation - * Greengrass OTA feature allows updating Greengrass Core and Greengrass OTA Agent. Local Resource Access feature allows Greengrass Lambdas to access local resources such as peripheral devices and volumes. -* `service/iot`: Updates service API and documentation - * This release adds support for a number of new IoT features, including AWS IoT Device Management (Jobs, Fleet Index and Thing Registration), Thing Groups, Policies on Thing Groups, Registry & Job Events, JSON Logs, Fine-Grained Logging Controls, Custom Authorization and AWS Service Authentication Using X.509 Certificates. -* `service/kinesisvideo`: Adds new service - * Announcing Amazon Kinesis Video Streams, a fully managed video ingestion and storage service. Kinesis Video Streams makes it easy to securely stream video from connected devices to AWS for machine learning, analytics, and processing. You can also stream other time-encoded data like RADAR and LIDAR signals using Kinesis Video Streams. -* `service/rekognition`: Updates service API, documentation, and paginators - * This release introduces Amazon Rekognition support for video analysis. -* `service/s3`: Updates service API and documentation - * This release includes support for Glacier Select, a new feature that allows you to filter and analyze your Glacier storage class objects and store the results in a user-specified S3 location. - -Release v1.12.35 (2017-11-29) -=== - -### Service Client Updates -* `service/AmazonMQ`: Adds new service -* `service/GuardDuty`: Adds new service -* `service/apigateway`: Updates service API and documentation - * Changes related to CanaryReleaseDeployment feature. Enables API developer to create a deployment as canary deployment and test API changes with percentage of customers before promoting changes to all customers. -* `service/batch`: Updates service API and documentation - * Add support for Array Jobs which allow users to easily submit many copies of a job with a single API call. This change also enhances the job dependency model to support N_TO_N and sequential dependency chains. The ListJobs and DescribeJobs APIs now have the ability to list or describe the status of entire Array Jobs or individual elements within the array. -* `service/cognito-idp`: Updates service API and documentation -* `service/deepdish`: Adds new service - * AWS AppSync is an enterprise-level, fully managed GraphQL service with real-time data synchronization and offline programming features. -* `service/ec2`: Updates service API and documentation - * Adds the following updates: 1. You are now able to host a service powered by AWS PrivateLink to provide private connectivity to other VPCs. You are now also able to create endpoints to other services powered by PrivateLink including AWS services, Marketplace Seller services or custom services created by yourself or other AWS VPC customers. 2. You are now able to save launch parameters in a single template that can be used with Auto Scaling, Spot Fleet, Spot, and On Demand instances. 3. You are now able to launch Spot instances via the RunInstances API, using a single additional parameter. RunInstances will response synchronously with an instance ID should capacity be available for your Spot request. 4. A simplified Spot pricing model which delivers low, predictable prices that adjust gradually, based on long-term trends in supply and demand. 5. Amazon EC2 Spot can now hibernate Amazon EBS-backed instances in the event of an interruption, so your workloads pick up from where they left off. Spot can fulfill your request by resuming instances from a hibernated state when capacity is available. -* `service/lambda`: Updates service API and documentation - * Lambda aliases can now shift traffic between two function versions, based on preassigned weights. - -Release v1.12.34 (2017-11-27) -=== - -### Service Client Updates -* `service/data.mediastore`: Adds new service -* `service/mediaconvert`: Adds new service - * AWS Elemental MediaConvert is a file-based video conversion service that transforms media into formats required for traditional broadcast and for internet streaming to multi-screen devices. -* `service/medialive`: Adds new service - * AWS Elemental MediaLive is a video service that lets you easily create live outputs for broadcast and streaming delivery. -* `service/mediapackage`: Adds new service - * AWS Elemental MediaPackage is a just-in-time video packaging and origination service that lets you format highly secure and reliable live outputs for a variety of devices. -* `service/mediastore`: Adds new service - * AWS Elemental MediaStore is an AWS storage service optimized for media. It gives you the performance, consistency, and low latency required to deliver live and on-demand video content. AWS Elemental MediaStore acts as the origin store in your video workflow. - -Release v1.12.33 (2017-11-22) -=== - -### Service Client Updates -* `service/acm`: Updates service API and documentation - * AWS Certificate Manager now supports the ability to import domainless certs and additional Key Types as well as an additional validation method for DNS. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.32 (2017-11-22) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * Add support for Access logs and customizable integration timeouts -* `service/cloudformation`: Updates service API and documentation - * 1) Instance-level parameter overrides (CloudFormation-StackSet feature): This feature will allow the customers to override the template parameters on specific stackInstances. Customers will also have ability to update their existing instances with/without parameter-overrides using a new API "UpdateStackInstances" 2) Add support for SSM parameters in CloudFormation - This feature will allow the customers to use Systems Manager parameters in CloudFormation templates. They will be able to see values for these parameters in Describe APIs. -* `service/codebuild`: Updates service API and documentation - * Adding support for accessing Amazon VPC resources from AWS CodeBuild, dependency caching and build badges. -* `service/elasticmapreduce`: Updates service API and documentation - * Enable Kerberos on Amazon EMR. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rekognition`: Updates service API and documentation - * This release includes updates to Amazon Rekognition for the following APIs. The new DetectText API allows you to recognize and extract textual content from images. Face Model Versioning has been added to operations that deal with face detection. -* `service/shield`: Updates service API, documentation, and paginators - * The AWS Shield SDK has been updated in order to support Elastic IP address protections, the addition of AttackProperties objects in DescribeAttack responses, and a new GetSubscriptionState operation. -* `service/storagegateway`: Updates service API and documentation - * AWS Storage Gateway now enables you to get notification when all your files written to your NFS file share have been uploaded to Amazon S3. Storage Gateway also enables guessing of the MIME type for uploaded objects based on file extensions. -* `service/xray`: Updates service API, documentation, and paginators - * Added automatic pagination support for AWS X-Ray APIs in the SDKs that support this feature. - -Release v1.12.31 (2017-11-20) -=== - -### Service Client Updates -* `service/apigateway`: Updates service documentation - * Documentation updates for Apigateway -* `service/codecommit`: Updates service API, documentation, and paginators - * AWS CodeCommit now supports pull requests. You can use pull requests to collaboratively review code changes for minor changes or fixes, major feature additions, or new versions of your released software. -* `service/firehose`: Updates service API and documentation - * This release includes a new Kinesis Firehose feature that supports Splunk as Kinesis Firehose delivery destination. You can now use Kinesis Firehose to ingest real-time data to Splunk in a serverless, reliable, and salable manner. This release also includes a new feature that allows you to configure Lambda buffer size in Kinesis Firehose data transformation feature. You can now customize the data buffer size before invoking Lambda function in Kinesis Firehose for data transformation. This feature allows you to flexibly trade-off processing and delivery latency with cost and efficiency based on your specific use cases and requirements. -* `service/iis`: Adds new service - * The AWS Cost Explorer API gives customers programmatic access to AWS cost and usage information, allowing them to perform adhoc queries and build interactive cost management applications that leverage this dataset. -* `service/kinesis`: Updates service API and documentation - * Customers can now obtain the important characteristics of their stream with DescribeStreamSummary. The response will not include the shard list for the stream but will have the number of open shards, and all the other fields included in the DescribeStream response. -* `service/workdocs`: Updates service API and documentation - * DescribeGroups API and miscellaneous enhancements - -### SDK Bugs -* `aws/client`: Retry delays for throttled exception were not limited to 5 mintues [#1654](https://github.com/aws/aws-sdk-go/pull/1654) - * Fixes [#1653](https://github.com/aws/aws-sdk-go/issues/1653) -Release v1.12.30 (2017-11-17) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service API and documentation -* `service/dms`: Updates service API, documentation, and paginators - * Support for migration task assessment. Support for data validation after the migration. -* `service/elasticloadbalancingv2`: Updates service API and documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * Amazon RDS now supports importing MySQL databases by using backup files from Amazon S3. -* `service/s3`: Updates service API - * Added ORC to the supported S3 Inventory formats. - -### SDK Bugs -* `private/protocol/restjson`: Define JSONValue marshaling for body and querystring ([#1640](https://github.com/aws/aws-sdk-go/pull/1640)) - * Adds support for APIs which use JSONValue for body and querystring targets. - * Fixes [#1636](https://github.com/aws/aws-sdk-go/issues/1636) -Release v1.12.29 (2017-11-16) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service API and documentation -* `service/ec2`: Updates service API - * You are now able to create and launch EC2 x1e smaller instance sizes -* `service/glue`: Updates service API and documentation - * API update for AWS Glue. New crawler configuration attribute enables customers to specify crawler behavior. New XML classifier enables classification of XML data. -* `service/opsworkscm`: Updates service API, documentation, and waiters - * Documentation updates for OpsWorks-cm: a new feature, OpsWorks for Puppet Enterprise, that allows users to create and manage OpsWorks-hosted Puppet Enterprise servers. -* `service/organizations`: Updates service API, documentation, and paginators - * This release adds APIs that you can use to enable and disable integration with AWS services designed to work with AWS Organizations. This integration allows the AWS service to perform operations on your behalf on all of the accounts in your organization. Although you can use these APIs yourself, we recommend that you instead use the commands provided in the other AWS service to enable integration with AWS Organizations. -* `service/route53`: Updates service API and documentation - * You can use Route 53's GetAccountLimit/GetHostedZoneLimit/GetReusableDelegationSetLimit APIs to view your current limits (including custom set limits) on Route 53 resources such as hosted zones and health checks. These APIs also return the number of each resource you're currently using to enable comparison against your current limits. - -Release v1.12.28 (2017-11-15) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * 1. Extended GetDocumentationParts operation to support retrieving documentation parts resources without contents. 2. Added hosted zone ID in the custom domain response. -* `service/email`: Updates service API, documentation, and examples - * SES launches Configuration Set Reputation Metrics and Email Pausing Today, two features that build upon the capabilities of the reputation dashboard. The first is the ability to export reputation metrics for individual configuration sets. The second is the ability to temporarily pause email sending, either at the configuration set level, or across your entire Amazon SES account. -* `service/polly`: Updates service API - * Amazon Polly adds Korean language support with new female voice - "Seoyeon" and new Indian English female voice - "Aditi" -* `service/states`: Updates service API and documentation - * You can now use the UpdateStateMachine API to update your state machine definition and role ARN. Existing executions will continue to use the previous definition and role ARN. You can use the DescribeStateMachineForExecution API to determine which state machine definition and role ARN is associated with an execution - -Release v1.12.27 (2017-11-14) -=== - -### Service Client Updates -* `service/ecs`: Updates service API and documentation - * Added new mode for Task Networking in ECS, called awsvpc mode. Mode configuration parameters to be passed in via awsvpcConfiguration. Updated APIs now use/show this new mode - RegisterTaskDefinition, CreateService, UpdateService, RunTask, StartTask. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/lightsail`: Updates service API and documentation - * Lightsail now supports attached block storage, which allows you to scale your applications and protect application data with additional SSD-backed storage disks. This feature allows Lightsail customers to attach secure storage disks to their Lightsail instances and manage their attached disks, including creating and deleting disks, attaching and detaching disks from instances, and backing up disks via snapshot. -* `service/route53`: Updates service API and documentation - * When a Route 53 health check or hosted zone is created by a linked AWS service, the object now includes information about the service that created it. Hosted zones or health checks that are created by a linked service can't be updated or deleted using Route 53. -* `service/ssm`: Updates service API and documentation - * EC2 Systems Manager GetInventory API adds support for aggregation. - -### SDK Enhancements -* `aws/request`: Remove default port from HTTP host header ([#1618](https://github.com/aws/aws-sdk-go/pull/1618)) - * Updates the SDK to automatically remove default ports based on the URL's scheme when setting the HTTP Host header's value. - * Fixes [#1537](https://github.com/aws/aws-sdk-go/issues/1537) - -Release v1.12.26 (2017-11-09) -=== - -### Service Client Updates -* `service/ec2`: Updates service API and documentation - * Introduces the following features: 1. Create a default subnet in an Availability Zone if no default subnet exists. 2. Spot Fleet integrates with Elastic Load Balancing to enable you to attach one or more load balancers to a Spot Fleet request. When you attach the load balancer, it automatically registers the instance in the Spot Fleet to the load balancers which distributes incoming traffic across the instances. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.25 (2017-11-08) -=== - -### Service Client Updates -* `service/application-autoscaling`: Updates service API and documentation -* `service/batch`: Updates service documentation - * Documentation updates for AWS Batch. -* `service/ec2`: Updates service API and documentation - * AWS PrivateLink for Amazon Services - Customers can now privately access Amazon services from their Amazon Virtual Private Cloud (VPC), without using public IPs, and without requiring the traffic to traverse across the Internet. -* `service/elasticache`: Updates service API and documentation - * This release adds online resharding for ElastiCache for Redis offering, providing the ability to add and remove shards from a running cluster. Developers can now dynamically scale-out or scale-in their Redis cluster workloads to adapt to changes in demand. ElastiCache will resize the cluster by adding or removing shards and redistribute hash slots uniformly across the new shard configuration, all while the cluster continues to stay online and serves requests. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.24 (2017-11-07) -=== - -### Service Client Updates -* `service/elasticloadbalancingv2`: Updates service documentation -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/rds`: Updates service API and documentation - * DescribeOrderableDBInstanceOptions now returns the minimum and maximum allowed values for storage size, total provisioned IOPS, and provisioned IOPS per GiB for a DB instance. -* `service/s3`: Updates service API, documentation, and examples - * This releases adds support for 4 features: 1. Default encryption for S3 Bucket, 2. Encryption status in inventory and Encryption support for inventory. 3. Cross region replication of KMS-encrypted objects, and 4. ownership overwrite for CRR. - -Release v1.12.23 (2017-11-07) -=== - -### Service Client Updates -* `service/api.pricing`: Adds new service -* `service/ec2`: Updates service API - * You are now able to create and launch EC2 C5 instances, the next generation of EC2's compute-optimized instances, in us-east-1, us-west-2 and eu-west-1. C5 instances offer up to 72 vCPUs, 144 GiB of DDR4 instance memory, 25 Gbps in Network bandwidth and improved EBS and Networking bandwidth on smaller instance sizes to deliver improved performance for compute-intensive workloads. -* `aws/endpoints`: Updated Regions and Endpoints metadata. -* `service/kms`: Updates service API, documentation, and examples - * Documentation updates for AWS KMS. -* `service/organizations`: Updates service documentation - * This release updates permission statements for several API operations, and corrects some other minor errors. -* `service/states`: Updates service API, documentation, and paginators - * Documentation update. - -Release v1.12.22 (2017-11-03) -=== - -### Service Client Updates -* `service/ecs`: Updates service API and documentation - * Amazon ECS users can now add devices to their containers and enable init process in containers through the use of docker's 'devices' and 'init' features. These fields can be specified under linuxParameters in ContainerDefinition in the Task Definition Template. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.21 (2017-11-02) -=== - -### Service Client Updates -* `service/apigateway`: Updates service API and documentation - * This release supports creating and managing Regional and Edge-Optimized API endpoints. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -### SDK Bugs -* `aws/request`: Fix bug in request presign creating invalide URL ([#1624](https://github.com/aws/aws-sdk-go/pull/1624)) - * Fixes a bug the Request Presign and PresignRequest methods that would allow a invalid expire duration as input. A expire time of 0 would be interpreted by the SDK to generate a normal request signature, not a presigned URL. This caused the returned URL unusable. - * Fixes [#1617](https://github.com/aws/aws-sdk-go/issues/1617) -Release v1.12.20 (2017-11-01) -=== - -### Service Client Updates -* `service/acm`: Updates service documentation - * Documentation updates for ACM -* `service/cloudhsmv2`: Updates service documentation - * Minor documentation update for AWS CloudHSM (cloudhsmv2). -* `service/directconnect`: Updates service API and documentation - * AWS DirectConnect now provides support for Global Access for Virtual Private Cloud (VPC) via a new feature called Direct Connect Gateway. A Direct Connect Gateway will allow you to group multiple Direct Connect Private Virtual Interfaces (DX-VIF) and Private Virtual Gateways (VGW) from different AWS regions (but belonging to the same AWS Account) and pass traffic from any DX-VIF to any VPC in the grouping. -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -### SDK Enhancements -* `aws/client`: Adding status code 429 to throttlable status codes in default retryer (#1621) - -Release v1.12.19 (2017-10-26) -=== - -### Service Client Updates -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.18 (2017-10-26) -=== - -### Service Client Updates -* `service/cloudfront`: Updates service API and documentation - * You can now specify additional options for MinimumProtocolVersion, which controls the SSL/TLS protocol that CloudFront uses to communicate with viewers. The minimum protocol version that you choose also determines the ciphers that CloudFront uses to encrypt the content that it returns to viewers. -* `service/ec2`: Updates service API - * You are now able to create and launch EC2 P3 instance, next generation GPU instances, optimized for machine learning and high performance computing applications. With up to eight NVIDIA Tesla V100 GPUs, P3 instances provide up to one petaflop of mixed-precision, 125 teraflops of single-precision, and 62 teraflops of double-precision floating point performance, as well as a 300 GB/s second-generation NVLink interconnect that enables high-speed, low-latency GPU-to-GPU communication. P3 instances also feature up to 64 vCPUs based on custom Intel Xeon E5 (Broadwell) processors, 488 GB of DRAM, and 25 Gbps of dedicated aggregate network bandwidth using the Elastic Network Adapter (ENA). -* `aws/endpoints`: Updated Regions and Endpoints metadata. - -Release v1.12.17 (2017-10-24) -=== - -### Service Client Updates -* `service/config`: Updates service API -* `service/elasticache`: Updates service API, documentation, and examples - * Amazon ElastiCache for Redis today announced support for data encryption both for data in-transit and data at-rest. The new encryption in-transit functionality enables ElastiCache for Redis customers to encrypt data for all communication between clients and Redis engine, and all intra-cluster Redis communication. The encryption at-rest functionality allows customers to encrypt their S3 based backups. Customers can begin using the new functionality by simply enabling this functionality via AWS console, and a small configuration change in their Redis clients. The ElastiCache for Redis service automatically manages life cycle of the certificates required for encryption, including the issuance, renewal and expiration of certificates. Additionally, as part of this launch, customers will gain the ability to start using the Redis AUTH command that provides an added level of authentication. -* `service/glue`: Adds new service - * AWS Glue: Adding a new API, BatchStopJobRun, to stop one or more job runs for a specified Job. -* `service/pinpoint`: Updates service API and documentation - * Added support for APNs VoIP messages. Added support for collapsible IDs, message priority, and TTL for APNs and FCM/GCM. - -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 8a1927a..0000000 --- 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 6f422a9..0000000 --- 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 854c94f..0000000 --- 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 664fc59..0000000 --- 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 d645695..0000000 --- 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 83ccc1e..0000000 --- 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 5f14d11..0000000 --- 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 c327744..0000000 --- a/vendor/github.com/aws/aws-sdk-go/README.md +++ /dev/null @@ -1,451 +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. - -We [announced](https://aws.amazon.com/blogs/developer/aws-sdk-for-go-2-0-developer-preview/) the Developer Preview for the [v2 AWS SDK for Go](). The v2 SDK is available at https://github.com/aws/aws-sdk-go-v2, and `go get github.com/aws/aws-sdk-go-v2` via `go get`. Check out the v2 SDK's [changes and updates](https://github.com/aws/aws-sdk-go-v2/blob/master/CHANGELOG.md), and let us know what you think. We want your feedback. - -## 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.Int64Value(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 56fdfc2..0000000 --- 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 0202a00..0000000 --- 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 1a3d106..0000000 --- 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 007b37b..0000000 --- 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 59fa4a5..0000000 --- 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 18d3c5b..0000000 --- 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 11c52c3..0000000 --- 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 58a05d6..0000000 --- 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 710eb43..0000000 --- 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 b6432f1..0000000 --- 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 788fe6e..0000000 --- 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 30d3b99..0000000 --- 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 63d2df6..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer.go +++ /dev/null @@ -1,138 +0,0 @@ -package client - -import ( - "math/rand" - "strconv" - "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 { - if delay, ok := getRetryDelay(r); ok { - return delay - } - - minTime = 500 - } - - retryCount := r.RetryCount - if throttle && retryCount > 8 { - retryCount = 8 - } else if retryCount > 13 { - retryCount = 13 - } - - 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 { - switch r.HTTPResponse.StatusCode { - case 429: - case 502: - case 503: - case 504: - default: - return r.IsErrorThrottle() - } - - return true -} - -// This will look in the Retry-After header, RFC 7231, for how long -// it will wait before attempting another request -func getRetryDelay(r *request.Request) (time.Duration, bool) { - if !canUseRetryAfterHeader(r) { - return 0, false - } - - delayStr := r.HTTPResponse.Header.Get("Retry-After") - if len(delayStr) == 0 { - return 0, false - } - - delay, err := strconv.Atoi(delayStr) - if err != nil { - return 0, false - } - - return time.Duration(delay) * time.Second, true -} - -// Will look at the status code to see if the retry header pertains to -// the status code. -func canUseRetryAfterHeader(r *request.Request) bool { - switch r.HTTPResponse.StatusCode { - case 429: - case 503: - default: - return false - } - - return true -} - -// 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/default_retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go deleted file mode 100644 index fddba4e..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/default_retryer_test.go +++ /dev/null @@ -1,189 +0,0 @@ -package client - -import ( - "net/http" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws/request" -) - -func TestRetryThrottleStatusCodes(t *testing.T) { - cases := []struct { - expectThrottle bool - expectRetry bool - r request.Request - }{ - { - false, - false, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 200}, - }, - }, - { - true, - true, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 429}, - }, - }, - { - true, - true, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 502}, - }, - }, - { - true, - true, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 503}, - }, - }, - { - true, - true, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 504}, - }, - }, - { - false, - true, - request.Request{ - HTTPResponse: &http.Response{StatusCode: 500}, - }, - }, - } - - d := DefaultRetryer{NumMaxRetries: 10} - for i, c := range cases { - throttle := d.shouldThrottle(&c.r) - retry := d.ShouldRetry(&c.r) - - if e, a := c.expectThrottle, throttle; e != a { - t.Errorf("%d: expected %v, but received %v", i, e, a) - } - - if e, a := c.expectRetry, retry; e != a { - t.Errorf("%d: expected %v, but received %v", i, e, a) - } - } -} - -func TestCanUseRetryAfter(t *testing.T) { - cases := []struct { - r request.Request - e bool - }{ - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 200}, - }, - false, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 500}, - }, - false, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 429}, - }, - true, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 503}, - }, - true, - }, - } - - for i, c := range cases { - a := canUseRetryAfterHeader(&c.r) - if c.e != a { - t.Errorf("%d: expected %v, but received %v", i, c.e, a) - } - } -} - -func TestGetRetryDelay(t *testing.T) { - cases := []struct { - r request.Request - e time.Duration - equal bool - ok bool - }{ - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 429, Header: http.Header{"Retry-After": []string{"3600"}}}, - }, - 3600 * time.Second, - true, - true, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{"120"}}}, - }, - 120 * time.Second, - true, - true, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{"120"}}}, - }, - 1 * time.Second, - false, - true, - }, - { - request.Request{ - HTTPResponse: &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{""}}}, - }, - 0 * time.Second, - true, - false, - }, - } - - for i, c := range cases { - a, ok := getRetryDelay(&c.r) - if c.ok != ok { - t.Errorf("%d: expected %v, but received %v", i, c.ok, ok) - } - - if (c.e != a) == c.equal { - t.Errorf("%d: expected %v, but received %v", i, c.e, a) - } - } -} - -func TestRetryDelay(t *testing.T) { - r := request.Request{} - for i := 0; i < 100; i++ { - rTemp := r - rTemp.HTTPResponse = &http.Response{StatusCode: 500, Header: http.Header{"Retry-After": []string{""}}} - rTemp.RetryCount = i - a, _ := getRetryDelay(&rTemp) - if a > 5*time.Minute { - t.Errorf("retry delay should never be greater than five minutes, received %d", a) - } - } - - for i := 0; i < 100; i++ { - rTemp := r - rTemp.RetryCount = i - rTemp.HTTPResponse = &http.Response{StatusCode: 503, Header: http.Header{"Retry-After": []string{""}}} - a, _ := getRetryDelay(&rTemp) - if a > 5*time.Minute { - t.Errorf("retry delay should never be greater than five minutes, received %d", a) - } - } -} 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 1f39c91..0000000 --- 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 b8d600c..0000000 --- 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 4778056..0000000 --- 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 4fd0d07..0000000 --- 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 endpoint 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 fe97a31..0000000 --- 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 79f4268..0000000 --- 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 8fdda53..0000000 --- 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 064f75c..0000000 --- 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 d80a1bb..0000000 --- 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 ff5d58e..0000000 --- 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 1a9461e..0000000 --- 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 495e3ef..0000000 --- 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 b47afc2..0000000 --- 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 1d715c9..0000000 --- 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 7d50b15..0000000 --- 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 e1d8a08..0000000 --- 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 f298d65..0000000 --- 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 3b393a2..0000000 --- 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 42416fc..0000000 --- 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 7b79ba9..0000000 --- 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 c397495..0000000 --- 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 cccd4bf..0000000 --- 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 a4cec5c..0000000 --- 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 ad057a3..0000000 --- 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 c14231a..0000000 --- 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 53f6ce2..0000000 --- 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 7fc91d9..0000000 --- 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 51e21e0..0000000 --- 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 1eb45f2..0000000 --- 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 4f5dab3..0000000 --- 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 ea01236..0000000 --- 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 4108e43..0000000 --- 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 4c0212a..0000000 --- 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 2cb0818..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ /dev/null @@ -1,193 +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" - "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) -} - -var lookupHostFn = net.LookupHost - -func isLoopbackHost(host string) (bool, error) { - ip := net.ParseIP(host) - if ip != nil { - return ip.IsLoopback(), nil - } - - // Host is not an ip, perform lookup - addrs, err := lookupHostFn(host) - if err != nil { - return false, err - } - for _, addr := range addrs { - if !net.ParseIP(addr).IsLoopback() { - return false, nil - } - } - - return true, nil -} - -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 { - host := aws.URLHostname(parsed) - if len(host) == 0 { - errMsg = "unable to parse host from local HTTP cred provider URL" - } else if isLoopback, loopbackErr := isLoopbackHost(host); loopbackErr != nil { - errMsg = fmt.Sprintf("failed to resolve host %q, %v", host, loopbackErr) - } else if !isLoopback { - errMsg = fmt.Sprintf("invalid endpoint host, %q, only loopback hosts are allowed.", 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 cb06468..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults_test.go +++ /dev/null @@ -1,116 +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) { - origFn := lookupHostFn - defer func() { lookupHostFn = origFn }() - - lookupHostFn = func(host string) ([]string, error) { - m := map[string]struct { - Addrs []string - Err error - }{ - "localhost": {Addrs: []string{"::1", "127.0.0.1"}}, - "actuallylocal": {Addrs: []string{"127.0.0.2"}}, - "notlocal": {Addrs: []string{"::1", "127.0.0.1", "192.168.1.10"}}, - "www.example.com": {Addrs: []string{"10.10.10.10"}}, - } - - h, ok := m[host] - if !ok { - t.Fatalf("unknown host in test, %v", host) - return nil, fmt.Errorf("unknown host") - } - - return h.Addrs, h.Err - } - - cases := []struct { - Host string - Fail bool - }{ - {"localhost", false}, - {"actuallylocal", false}, - {"127.0.0.1", false}, - {"127.1.1.1", false}, - {"[::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 ca0ee1d..0000000 --- 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 4fcb616..0000000 --- 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 984407a..0000000 --- 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 7dde1fb..0000000 --- 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 5b4379d..0000000 --- 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 c2bc215..0000000 --- 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 74f72de..0000000 --- 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 3193907..0000000 --- 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 5470a8c..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ /dev/null @@ -1,2617 +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). - EuWest3RegionID = "eu-west-3" // EU (Paris). - 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). - CnNorthwest1RegionID = "cn-northwest-1" // China (Ningxia). -) - -// AWS GovCloud (US) partition's regions. -const ( - UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US). -) - -// Service identifiers -const ( - AcmServiceID = "acm" // Acm. - ApiPricingServiceID = "api.pricing" // ApiPricing. - 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. - DaxServiceID = "dax" // Dax. - 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)", - }, - "eu-west-3": region{ - Description: "EU (Paris)", - }, - "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{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "api.pricing": service{ - Defaults: endpoint{ - CredentialScope: credentialScope{ - Service: "pricing", - }, - }, - Endpoints: endpoints{ - "ap-south-1": endpoint{}, - "us-east-1": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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-northeast-1": 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{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": 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{}, - "eu-west-3": 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-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{}, - }, - }, - "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{}, - "eu-west-3": 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-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{}, - }, - }, - "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{}, - "eu-west-3": 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{}, - }, - }, - "dax": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "ap-south-1": endpoint{}, - "eu-west-1": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-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{}, - "eu-west-3": 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{}, - "eu-west-3": 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-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{}, - }, - }, - "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{}, - "eu-west-3": 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{}, - "eu-west-3": 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-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{}, - "eu-west-3": endpoint{}, - "sa-east-1": 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-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{}, - "eu-west-3": endpoint{}, - "sa-east-1": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "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-1": 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{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "glue": service{ - - Endpoints: endpoints{ - "ap-northeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "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-central-1": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{ - "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{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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-east-2": 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{ - "eu-west-1": endpoint{}, - "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{}, - "eu-west-3": 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-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{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": 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{}, - "ca-central-1": endpoint{}, - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "eu-west-3": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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{}, - "eu-west-3": 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)", - }, - "cn-northwest-1": region{ - Description: "China (Ningxia)", - }, - }, - Services: services{ - "apigateway": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "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{}, - "cn-northwest-1": endpoint{}, - }, - }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "cloudformation": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "cloudtrail": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "codedeploy": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "cognito-identity": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "config": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "directconnect": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "dynamodb": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ec2": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-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{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticbeanstalk": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticloadbalancing": service{ - Defaults: endpoint{ - Protocols: []string{"https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "elasticmapreduce": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "es": service{ - - Endpoints: endpoints{ - "cn-northwest-1": endpoint{}, - }, - }, - "events": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "glacier": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-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{}, - "cn-northwest-1": endpoint{}, - }, - }, - "lambda": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "logs": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "monitoring": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "rds": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "redshift": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "s3": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - SignatureVersions: []string{"s3v4"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "snowball": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - }, - }, - "sns": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "sqs": service{ - Defaults: endpoint{ - SSLCommonName: "{region}.queue.{dnsSuffix}", - Protocols: []string{"http", "https"}, - }, - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "ssm": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-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{}, - "cn-northwest-1": endpoint{}, - }, - }, - "sts": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, - "swf": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-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{}, - }, - }, - "dms": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, - "dynamodb": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "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{}, - }, - }, - "elasticbeanstalk": 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{}, - "us-gov-west-1-fips": endpoint{ - Hostname: "dynamodb.us-gov-west-1.amazonaws.com", - CredentialScope: credentialScope{ - Region: "us-gov-west-1", - }, - }, - }, - }, - "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 84316b9..0000000 --- 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 9c3eedb..0000000 --- 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 9c0e09d..0000000 --- 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 007fed2..0000000 --- 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 13d968a..0000000 --- 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 05e92df..0000000 --- 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 1385cb4..0000000 --- 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 5766361..0000000 --- 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 91a6f27..0000000 --- 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 3babb5a..0000000 --- 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 271da43..0000000 --- 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 daf9eca..0000000 --- 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 aba8eb4..0000000 --- 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 bb5f6bd..0000000 --- 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 802ac88..0000000 --- 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 b2da558..0000000 --- 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 79f7960..0000000 --- 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 4a4f855..0000000 --- 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 2ce9ef4..0000000 --- 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 02f07f4..0000000 --- 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 01856e3..0000000 --- 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 5c7db49..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ /dev/null @@ -1,679 +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" - - // ErrCodeInvalidPresignExpire is returned when the expire time provided to - // presign is invalid - ErrCodeInvalidPresignExpire = "InvalidPresignExpireError" - - // 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 - 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 - - // A value greater than 0 instructs the request to be signed as Presigned URL - // You should not set this field directly. Instead use Request's - // Presign or PresignRequest methods. - ExpireTime time.Duration - - 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) - } - - SanitizeHostForHeader(httpReq) - - 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. -// -// It is invalid to create a presigned URL with a expire duration 0 or less. An -// error is returned if expire duration is 0 or less. -func (r *Request) Presign(expire time.Duration) (string, error) { - r = r.copy() - - // Presign requires all headers be hoisted. There is no way to retrieve - // the signed headers not hoisted without this. Making the presigned URL - // useless. - r.NotHoist = false - - u, _, err := getPresignedURL(r, expire) - return u, err -} - -// PresignRequest behaves just like presign, with the addition of returning a -// set of headers that were signed. -// -// It is invalid to create a presigned URL with a expire duration 0 or less. An -// error is returned if expire duration is 0 or less. -// -// 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(expire time.Duration) (string, http.Header, error) { - r = r.copy() - return getPresignedURL(r, expire) -} - -func getPresignedURL(r *Request, expire time.Duration) (string, http.Header, error) { - if expire <= 0 { - return "", nil, awserr.New( - ErrCodeInvalidPresignExpire, - "presigned URL requires an expire duration greater than 0", - nil, - ) - } - - r.ExpireTime = expire - - if r.Operation.BeforePresignFn != nil { - if err := r.Operation.BeforePresignFn(r); err != nil { - return "", nil, err - } - } - - if err := r.Sign(); err != nil { - return "", nil, err - } - - 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") - -} - -// SanitizeHostForHeader removes default port from host and updates request.Host -func SanitizeHostForHeader(r *http.Request) { - host := getHost(r) - port := portOnly(host) - if port != "" && isDefaultPort(r.URL.Scheme, port) { - r.Host = stripPort(host) - } -} - -// Returns host from request -func getHost(r *http.Request) string { - if r.Host != "" { - return r.Host - } - - return r.URL.Host -} - -// Hostname returns u.Host, without any port number. -// -// If Host is an IPv6 literal with a port number, Hostname returns the -// IPv6 literal without the square brackets. IPv6 literals may include -// a zone identifier. -// -// Copied from the Go 1.8 standard library (net/url) -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] -} - -// Port returns the port part of u.Host, without the leading colon. -// If u.Host doesn't contain a port, Port returns an empty string. -// -// Copied from the Go 1.8 standard library (net/url) -func portOnly(hostport string) string { - colon := strings.IndexByte(hostport, ':') - if colon == -1 { - return "" - } - if i := strings.Index(hostport, "]:"); i != -1 { - return hostport[i+len("]:"):] - } - if strings.Contains(hostport, "]") { - return "" - } - return hostport[colon+len(":"):] -} - -// Returns true if the specified URI is using the standard port -// (i.e. port 80 for HTTP URIs or 443 for HTTPS URIs) -func isDefaultPort(scheme, port string) bool { - if port == "" { - return true - } - - lowerCaseScheme := strings.ToLower(scheme) - if (lowerCaseScheme == "http" && port == "80") || (lowerCaseScheme == "https" && port == "443") { - return true - } - - return false -} 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 91b4e7b..0000000 --- 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 d0314ab..0000000 --- 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 869b97a..0000000 --- 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 ca6150c..0000000 --- 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 c32fc69..0000000 --- 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 8f3b0f0..0000000 --- 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 a7365cd..0000000 --- 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 307fa07..0000000 --- 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 2af2867..0000000 --- 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 966f934..0000000 --- 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 59de673..0000000 --- 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 73a95ba..0000000 --- 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 4a91724..0000000 --- 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 151cbf3..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ /dev/null @@ -1,1004 +0,0 @@ -package request_test - -import ( - "bytes" - "encoding/json" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/http/httptest" - "net/url" - "reflect" - "runtime" - "strconv" - "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/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" - "github.com/aws/aws-sdk-go/aws/defaults" -) - -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: 400, Body: body(`{"__type":"ProvisionedThroughputExceededException","message":"Rate exceeded."}`)}, - {StatusCode: 429, Body: body(`{"__type":"FooException","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 := 3, 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") - } -} - -func TestRequest_Presign(t *testing.T) { - presign := func(r *request.Request, expire time.Duration) (string, http.Header, error) { - u, err := r.Presign(expire) - return u, nil, err - } - presignRequest := func(r *request.Request, expire time.Duration) (string, http.Header, error) { - return r.PresignRequest(expire) - } - mustParseURL := func(v string) *url.URL { - u, err := url.Parse(v) - if err != nil { - panic(err) - } - return u - } - - cases := []struct { - Expire time.Duration - PresignFn func(*request.Request, time.Duration) (string, http.Header, error) - SignerFn func(*request.Request) - URL string - Header http.Header - Err string - }{ - { - PresignFn: presign, - Err: request.ErrCodeInvalidPresignExpire, - }, - { - PresignFn: presignRequest, - Err: request.ErrCodeInvalidPresignExpire, - }, - { - Expire: -1, - PresignFn: presign, - Err: request.ErrCodeInvalidPresignExpire, - }, - { - // Presign clear NotHoist - Expire: 1 * time.Minute, - PresignFn: func(r *request.Request, dur time.Duration) (string, http.Header, error) { - r.NotHoist = true - return presign(r, dur) - }, - SignerFn: func(r *request.Request) { - r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL") - fmt.Println("url", r.HTTPRequest.URL.String()) - if r.NotHoist { - r.Error = fmt.Errorf("expect NotHoist to be cleared") - } - }, - URL: "https://endpoint/presignedURL", - }, - { - // PresignRequest does not clear NotHoist - Expire: 1 * time.Minute, - PresignFn: func(r *request.Request, dur time.Duration) (string, http.Header, error) { - r.NotHoist = true - return presignRequest(r, dur) - }, - SignerFn: func(r *request.Request) { - r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL") - if !r.NotHoist { - r.Error = fmt.Errorf("expect NotHoist not to be cleared") - } - }, - URL: "https://endpoint/presignedURL", - }, - { - // PresignRequest returns signed headers - Expire: 1 * time.Minute, - PresignFn: presignRequest, - SignerFn: func(r *request.Request) { - r.HTTPRequest.URL = mustParseURL("https://endpoint/presignedURL") - r.HTTPRequest.Header.Set("UnsigndHeader", "abc") - r.SignedHeaderVals = http.Header{ - "X-Amzn-Header": []string{"abc", "123"}, - "X-Amzn-Header2": []string{"efg", "456"}, - } - }, - URL: "https://endpoint/presignedURL", - Header: http.Header{ - "X-Amzn-Header": []string{"abc", "123"}, - "X-Amzn-Header2": []string{"efg", "456"}, - }, - }, - } - - svc := awstesting.NewClient() - svc.Handlers.Clear() - for i, c := range cases { - req := svc.NewRequest(&request.Operation{ - Name: "name", HTTPMethod: "GET", HTTPPath: "/path", - }, &struct{}{}, &struct{}{}) - req.Handlers.Sign.PushBack(c.SignerFn) - - u, h, err := c.PresignFn(req, c.Expire) - if len(c.Err) != 0 { - if e, a := c.Err, err.Error(); !strings.Contains(a, e) { - t.Errorf("%d, expect %v to be in %v", i, e, a) - } - continue - } else if err != nil { - t.Errorf("%d, expect no error, got %v", i, err) - continue - } - if e, a := c.URL, u; e != a { - t.Errorf("%d, expect %v URL, got %v", i, e, a) - } - if e, a := c.Header, h; !reflect.DeepEqual(e, a) { - t.Errorf("%d, expect %v header got %v", i, e, a) - } - } -} - -func TestNew_EndpointWithDefaultPort(t *testing.T) { - endpoint := "https://estest.us-east-1.es.amazonaws.com:443" - expectedRequestHost := "estest.us-east-1.es.amazonaws.com" - - r := request.New( - aws.Config{}, - metadata.ClientInfo{Endpoint: endpoint}, - defaults.Handlers(), - client.DefaultRetryer{}, - &request.Operation{}, - nil, - nil, - ) - - if h := r.HTTPRequest.Host; h != expectedRequestHost { - t.Errorf("expect %v host, got %q", expectedRequestHost, h) - } -} - -func TestSanitizeHostForHeader(t *testing.T) { - cases := []struct { - url string - expectedRequestHost string - }{ - {"https://estest.us-east-1.es.amazonaws.com:443", "estest.us-east-1.es.amazonaws.com"}, - {"https://estest.us-east-1.es.amazonaws.com", "estest.us-east-1.es.amazonaws.com"}, - {"https://localhost:9200", "localhost:9200"}, - {"http://localhost:80", "localhost"}, - {"http://localhost:8080", "localhost:8080"}, - } - - for _, c := range cases { - r, _ := http.NewRequest("GET", c.url, nil) - request.SanitizeHostForHeader(r) - - if h := r.Host; h != c.expectedRequestHost { - t.Errorf("expect %v host, got %q", c.expectedRequestHost, h) - } - } -} 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 f35fef2..0000000 --- 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 a878748..0000000 --- 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 09a44eb..0000000 --- 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 33e1b2d..0000000 --- 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 c814158..0000000 --- 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 4012462..0000000 --- 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 4601f88..0000000 --- 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 db0f92d..0000000 --- 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 a89c0af..0000000 --- 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 ea7b886..0000000 --- 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 f1adcf4..0000000 --- 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 10e3662..0000000 --- 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 9f75d5a..0000000 --- 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 9612b31..0000000 --- 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 09c8e5b..0000000 --- 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 3a07b8d..0000000 --- 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 2e591c2..0000000 --- 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 93d664b..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/functional_test.go +++ /dev/null @@ -1,254 +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) - } -} - -func TestStandaloneSign_WithPort(t *testing.T) { - - cases := []struct { - description string - url string - expectedSig string - }{ - { - "default HTTPS port", - "https://estest.us-east-1.es.amazonaws.com:443/_search", - "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=e573fc9aa3a156b720976419319be98fb2824a3abc2ddd895ecb1d1611c6a82d", - }, - { - "default HTTP port", - "http://example.com:80/_search", - "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=54ebe60c4ae03a40948b849e13c333523235f38002e2807059c64a9a8c7cb951", - }, - { - "non-standard HTTP port", - "http://example.com:9200/_search", - "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=cd9d926a460f8d3b58b57beadbd87666dc667e014c0afaa4cea37b2867f51b4f", - }, - { - "non-standard HTTPS port", - "https://example.com:9200/_search", - "AWS4-HMAC-SHA256 Credential=AKID/19700101/us-east-1/es/aws4_request, SignedHeaders=host;x-amz-date;x-amz-security-token, Signature=cd9d926a460f8d3b58b57beadbd87666dc667e014c0afaa4cea37b2867f51b4f", - }, - } - - for _, c := range cases { - signer := v4.NewSigner(unit.Session.Config.Credentials) - req, _ := http.NewRequest("GET", c.url, nil) - _, 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 := c.expectedSig, actual; e != a { - t.Errorf("%s, expect %v, got %v", c.description, e, a) - } - } -} - -func TestStandalonePresign_WithPort(t *testing.T) { - - cases := []struct { - description string - url string - expectedSig string - }{ - { - "default HTTPS port", - "https://estest.us-east-1.es.amazonaws.com:443/_search", - "0abcf61a351063441296febf4b485734d780634fba8cf1e7d9769315c35255d6", - }, - { - "default HTTP port", - "http://example.com:80/_search", - "fce9976dd6c849c21adfa6d3f3e9eefc651d0e4a2ccd740d43efddcccfdc8179", - }, - { - "non-standard HTTP port", - "http://example.com:9200/_search", - "f33c25a81c735e42bef35ed5e9f720c43940562e3e616ff0777bf6dde75249b0", - }, - { - "non-standard HTTPS port", - "https://example.com:9200/_search", - "f33c25a81c735e42bef35ed5e9f720c43940562e3e616ff0777bf6dde75249b0", - }, - } - - for _, c := range cases { - signer := v4.NewSigner(unit.Session.Config.Credentials) - req, _ := http.NewRequest("GET", c.url, nil) - _, err := signer.Presign(req, nil, "es", "us-east-1", 5 * time.Minute, time.Unix(0, 0)) - if err != nil { - t.Fatalf("expect no error, got %v", err) - } - - actual := req.URL.Query().Get("X-Amz-Signature") - if e, a := c.expectedSig, actual; e != a { - t.Errorf("%s, expect %v, got %v", c.description, 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 244c86d..0000000 --- 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 f4be951..0000000 --- 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 6aa2ed2..0000000 --- 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 bd082e9..0000000 --- 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 ccc88b4..0000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/signer/v4/v4.go +++ /dev/null @@ -1,767 +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, false, 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, true, signTime) -} - -func (v4 Signer) signWithBody(r *http.Request, body io.ReadSeeker, service, region string, exp time.Duration, isPresign bool, 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: isPresign, - 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.sanitizeHostForHeader() - 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) sanitizeHostForHeader() { - request.SanitizeHostForHeader(ctx.Request) -} - -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, req.ExpireTime > 0, 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 45d0eb8..0000000 --- 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 0e2d864..0000000 --- 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 e399ef5..0000000 --- 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 6192b24..0000000 --- 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 0210d27..0000000 --- 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 7bd32f3..0000000 --- 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.66" 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 427208e..0000000 --- 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 32b806a..0000000 --- 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(endpoints.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 ebcbc2b..0000000 --- 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 a2fd455..0000000 --- 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 afe96b1..0000000 --- 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 5bdb4c5..0000000 --- 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 53831df..0000000 --- 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 b6ea235..0000000 --- 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/jsonvalue.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go deleted file mode 100644 index 776d110..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue.go +++ /dev/null @@ -1,76 +0,0 @@ -package protocol - -import ( - "encoding/base64" - "encoding/json" - "fmt" - "strconv" - - "github.com/aws/aws-sdk-go/aws" -) - -// EscapeMode is the mode that should be use for escaping a value -type EscapeMode uint - -// The modes for escaping a value before it is marshaled, and unmarshaled. -const ( - NoEscape EscapeMode = iota - Base64Escape - QuotedEscape -) - -// EncodeJSONValue marshals the value into a JSON string, and optionally base64 -// encodes the string before returning it. -// -// Will panic if the escape mode is unknown. -func EncodeJSONValue(v aws.JSONValue, escape EscapeMode) (string, error) { - b, err := json.Marshal(v) - if err != nil { - return "", err - } - - switch escape { - case NoEscape: - return string(b), nil - case Base64Escape: - return base64.StdEncoding.EncodeToString(b), nil - case QuotedEscape: - return strconv.Quote(string(b)), nil - } - - panic(fmt.Sprintf("EncodeJSONValue called with unknown EscapeMode, %v", escape)) -} - -// DecodeJSONValue will attempt to decode the string input as a JSONValue. -// Optionally decoding base64 the value first before JSON unmarshaling. -// -// Will panic if the escape mode is unknown. -func DecodeJSONValue(v string, escape EscapeMode) (aws.JSONValue, error) { - var b []byte - var err error - - switch escape { - case NoEscape: - b = []byte(v) - case Base64Escape: - b, err = base64.StdEncoding.DecodeString(v) - case QuotedEscape: - var u string - u, err = strconv.Unquote(v) - b = []byte(u) - default: - panic(fmt.Sprintf("DecodeJSONValue called with unknown EscapeMode, %v", escape)) - } - - if err != nil { - return nil, err - } - - m := aws.JSONValue{} - err = json.Unmarshal(b, &m) - if err != nil { - return nil, err - } - - return m, nil -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go deleted file mode 100644 index 66a3c8c..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonvalue_test.go +++ /dev/null @@ -1,93 +0,0 @@ -package protocol - -import ( - "fmt" - "reflect" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" -) - -var testJSONValueCases = []struct { - Value aws.JSONValue - Mode EscapeMode - String string -}{ - { - Value: aws.JSONValue{ - "abc": 123., - }, - Mode: NoEscape, - String: `{"abc":123}`, - }, - { - Value: aws.JSONValue{ - "abc": 123., - }, - Mode: Base64Escape, - String: `eyJhYmMiOjEyM30=`, - }, - { - Value: aws.JSONValue{ - "abc": 123., - }, - Mode: QuotedEscape, - String: `"{\"abc\":123}"`, - }, -} - -func TestEncodeJSONValue(t *testing.T) { - for i, c := range testJSONValueCases { - str, err := EncodeJSONValue(c.Value, c.Mode) - if err != nil { - t.Fatalf("%d, expect no error, got %v", i, err) - } - if e, a := c.String, str; e != a { - t.Errorf("%d, expect %v encoded value, got %v", i, e, a) - } - } -} - -func TestDecodeJSONValue(t *testing.T) { - for i, c := range testJSONValueCases { - val, err := DecodeJSONValue(c.String, c.Mode) - if err != nil { - t.Fatalf("%d, expect no error, got %v", i, err) - } - if e, a := c.Value, val; !reflect.DeepEqual(e, a) { - t.Errorf("%d, expect %v encoded value, got %v", i, e, a) - } - } -} - -func TestEncodeJSONValue_PanicUnkownMode(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Errorf("expect panic, got none") - } else { - reason := fmt.Sprintf("%v", r) - if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) { - t.Errorf("expect %q to be in %v", e, a) - } - } - }() - - val := aws.JSONValue{} - - EncodeJSONValue(val, 123456) -} -func TestDecodeJSONValue_PanicUnkownMode(t *testing.T) { - defer func() { - if r := recover(); r == nil { - t.Errorf("expect panic, got none") - } else { - reason := fmt.Sprintf("%v", r) - if e, a := "unknown EscapeMode", reason; !strings.Contains(a, e) { - t.Errorf("expect %q to be in %v", e, a) - } - } - }() - - DecodeJSONValue(`{"abc":123}`, 123456) -} 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 eb2e155..0000000 --- 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 18169f0..0000000 --- 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 abcc271..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/build_test.go +++ /dev/null @@ -1,4056 +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"` -} - -// 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(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 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 *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation3Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.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 *InputService15TestShapeInputService15TestCaseOperation3Input) (*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 *InputService15TestShapeInputService15TestCaseOperation3Input, 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 *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation3Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.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 *InputService15TestShapeInputService15TestCaseOperation3Input) (*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 *InputService15TestShapeInputService15TestCaseOperation3Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation2Output, error) { - req, out := c.InputService15TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService15TestCaseOperation3 = "OperationName" - -// InputService15TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService15TestCaseOperation3 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 InputService15TestCaseOperation3 for more information on using the InputService15TestCaseOperation3 -// 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 InputService15TestCaseOperation3Request method. -// req, resp := client.InputService15TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService15ProtocolTest) InputService15TestCaseOperation3Request(input *InputService15TestShapeInputService15TestCaseOperation3Input) (req *request.Request, output *InputService15TestShapeInputService15TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService15TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation3Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(query.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService15TestCaseOperation3 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 InputService15TestCaseOperation3 for usage and error information. -func (c *InputService15ProtocolTest) InputService15TestCaseOperation3(input *InputService15TestShapeInputService15TestCaseOperation3Input) (*InputService15TestShapeInputService15TestCaseOperation3Output, error) { - req, out := c.InputService15TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService15TestCaseOperation3WithContext is the same as InputService15TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService15TestCaseOperation3 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) InputService15TestCaseOperation3WithContext(ctx aws.Context, input *InputService15TestShapeInputService15TestCaseOperation3Input, opts ...request.Option) (*InputService15TestShapeInputService15TestCaseOperation3Output, error) { - req, out := c.InputService15TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService15TestShapeInputService15TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService15TestShapeInputService15TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService15TestShapeInputService15TestCaseOperation3Input struct { - _ struct{} `type:"structure"` - - FooEnum *string `type:"string" enum:"InputService15TestShapeEnumType"` - - ListEnums []*string `type:"list"` -} - -// SetFooEnum sets the FooEnum field's value. -func (s *InputService15TestShapeInputService15TestCaseOperation3Input) SetFooEnum(v string) *InputService15TestShapeInputService15TestCaseOperation3Input { - s.FooEnum = &v - return s -} - -// SetListEnums sets the ListEnums field's value. -func (s *InputService15TestShapeInputService15TestCaseOperation3Input) SetListEnums(v []*string) *InputService15TestShapeInputService15TestCaseOperation3Input { - s.ListEnums = v - return s -} - -type InputService15TestShapeInputService15TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -const ( - // EnumTypeFoo is a InputService15TestShapeEnumType enum value - EnumTypeFoo = "foo" - - // EnumTypeBar is a InputService15TestShapeEnumType enum value - EnumTypeBar = "bar" -) - -// -// 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 - -} - -func TestInputService15ProtocolTestEnumCase1(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation3Input{ - FooEnum: aws.String("foo"), - ListEnums: []*string{ - aws.String("foo"), - aws.String(""), - aws.String("bar"), - }, - } - req, _ := svc.InputService15TestCaseOperation1Request(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&FooEnum=foo&ListEnums.member.1=foo&ListEnums.member.2=&ListEnums.member.3=bar&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestEnumCase2(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation3Input{ - FooEnum: aws.String("foo"), - } - req, _ := svc.InputService15TestCaseOperation2Request(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&FooEnum=foo&Version=2014-01-01`, util.Trim(string(body))) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService15ProtocolTestEnumCase3(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation3Input{} - req, _ := svc.InputService15TestCaseOperation3Request(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&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 5ce9cba..0000000 --- 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 e0f4d5a..0000000 --- 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 f214296..0000000 --- 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 e6c5c97..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/query/unmarshal_test.go +++ /dev/null @@ -1,2991 +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 -} - -// OutputService16ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// OutputService16ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type OutputService16ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the OutputService16ProtocolTest 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 OutputService16ProtocolTest client from just a session. -// svc := outputservice16protocoltest.New(mySession) -// -// // Create a OutputService16ProtocolTest client with additional configuration -// svc := outputservice16protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewOutputService16ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *OutputService16ProtocolTest { - c := p.ClientConfig("outputservice16protocoltest", cfgs...) - return newOutputService16ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newOutputService16ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *OutputService16ProtocolTest { - svc := &OutputService16ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "outputservice16protocoltest", - 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 OutputService16ProtocolTest operation and runs any -// custom request initialization. -func (c *OutputService16ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opOutputService16TestCaseOperation1 = "OperationName" - -// OutputService16TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the OutputService16TestCaseOperation1 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 OutputService16TestCaseOperation1 for more information on using the OutputService16TestCaseOperation1 -// 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 OutputService16TestCaseOperation1Request method. -// req, resp := client.OutputService16TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1Request(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (req *request.Request, output *OutputService16TestShapeOutputService16TestCaseOperation1Output) { - op := &request.Operation{ - Name: opOutputService16TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService16TestShapeOutputService16TestCaseOperation1Input{} - } - - output = &OutputService16TestShapeOutputService16TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService16TestCaseOperation1 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 OutputService16TestCaseOperation1 for usage and error information. -func (c *OutputService16ProtocolTest) OutputService16TestCaseOperation1(input *OutputService16TestShapeOutputService16TestCaseOperation1Input) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) { - req, out := c.OutputService16TestCaseOperation1Request(input) - return out, req.Send() -} - -// OutputService16TestCaseOperation1WithContext is the same as OutputService16TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService16TestCaseOperation1 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 *OutputService16ProtocolTest) OutputService16TestCaseOperation1WithContext(ctx aws.Context, input *OutputService16TestShapeOutputService16TestCaseOperation1Input, opts ...request.Option) (*OutputService16TestShapeOutputService16TestCaseOperation1Output, error) { - req, out := c.OutputService16TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService16TestShapeOutputService16TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService16TestShapeOutputService16TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - FooEnum *string `type:"string" enum:"OutputService16TestShapeEC2EnumType"` - - ListEnums []*string `type:"list"` -} - -// SetFooEnum sets the FooEnum field's value. -func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetFooEnum(v string) *OutputService16TestShapeOutputService16TestCaseOperation1Output { - s.FooEnum = &v - return s -} - -// SetListEnums sets the ListEnums field's value. -func (s *OutputService16TestShapeOutputService16TestCaseOperation1Output) SetListEnums(v []*string) *OutputService16TestShapeOutputService16TestCaseOperation1Output { - s.ListEnums = v - return s -} - -const ( - // EC2EnumTypeFoo is a OutputService16TestShapeEC2EnumType enum value - EC2EnumTypeFoo = "foo" - - // EC2EnumTypeBar is a OutputService16TestShapeEC2EnumType enum value - EC2EnumTypeBar = "bar" -) - -// -// 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) - } - -} - -func TestOutputService16ProtocolTestEnumOutputCase1(t *testing.T) { - svc := NewOutputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("foofoobar")) - req, out := svc.OutputService16TestCaseOperation1Request(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 := "foo", *out.FooEnum; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "foo", *out.ListEnums[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "bar", *out.ListEnums[1]; 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 c405288..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/build.go +++ /dev/null @@ -1,291 +0,0 @@ -// Package rest provides RESTful serialization of AWS requests and responses. -package rest - -import ( - "bytes" - "encoding/base64" - "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" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// 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) (str string, err error) { - v = reflect.Indirect(v) - if !v.IsValid() { - return "", errValueNotSet - } - - 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: - if len(value) == 0 { - return "", errValueNotSet - } - escaping := protocol.NoEscape - if tag.Get("location") == "header" { - escaping = protocol.Base64Escape - } - str, err = protocol.EncodeJSONValue(value, escaping) - if err != nil { - return "", fmt.Errorf("unable to encode JSONValue, %v", err) - } - 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 9f18081..0000000 --- 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 4366de2..0000000 --- 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 46457b2..0000000 --- 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 823f045..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/rest/unmarshal.go +++ /dev/null @@ -1,221 +0,0 @@ -package rest - -import ( - "bytes" - "encoding/base64" - "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" - "github.com/aws/aws-sdk-go/private/protocol" -) - -// 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: - escaping := protocol.NoEscape - if tag.Get("location") == "header" { - escaping = protocol.Base64Escape - } - m, err := protocol.DecodeJSONValue(header, escaping) - 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/restxml/build_bench_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go deleted file mode 100644 index 13106ee..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_bench_test.go +++ /dev/null @@ -1,366 +0,0 @@ -// +build bench - -package restxml_test - -import ( - "net/http" - "net/http/httptest" - "os" - "testing" - - "bytes" - "encoding/xml" - - "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/restxml" - "github.com/aws/aws-sdk-go/service/cloudfront" - "github.com/aws/aws-sdk-go/service/s3" -) - -var ( - cloudfrontSvc *cloudfront.CloudFront - s3Svc *s3.S3 -) - -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), - })) - cloudfrontSvc = cloudfront.New(sess) - s3Svc = s3.New(sess) - - c := m.Run() - server.Close() - os.Exit(c) -} - -func BenchmarkRESTXMLBuild_Complex_CFCreateDistro(b *testing.B) { - params := cloudfrontCreateDistributionInput() - - benchRESTXMLBuild(b, func() *request.Request { - req, _ := cloudfrontSvc.CreateDistributionRequest(params) - return req - }) -} - -func BenchmarkRESTXMLBuild_Simple_CFDeleteDistro(b *testing.B) { - params := cloudfrontDeleteDistributionInput() - - benchRESTXMLBuild(b, func() *request.Request { - req, _ := cloudfrontSvc.DeleteDistributionRequest(params) - return req - }) -} - -func BenchmarkRESTXMLBuild_REST_S3HeadObject(b *testing.B) { - params := s3HeadObjectInput() - - benchRESTXMLBuild(b, func() *request.Request { - req, _ := s3Svc.HeadObjectRequest(params) - return req - }) -} - -func BenchmarkRESTXMLBuild_XML_S3PutObjectAcl(b *testing.B) { - params := s3PutObjectAclInput() - - benchRESTXMLBuild(b, func() *request.Request { - req, _ := s3Svc.PutObjectAclRequest(params) - return req - }) -} - -func BenchmarkRESTXMLRequest_Complex_CFCreateDistro(b *testing.B) { - benchRESTXMLRequest(b, func() *request.Request { - req, _ := cloudfrontSvc.CreateDistributionRequest(cloudfrontCreateDistributionInput()) - return req - }) -} - -func BenchmarkRESTXMLRequest_Simple_CFDeleteDistro(b *testing.B) { - benchRESTXMLRequest(b, func() *request.Request { - req, _ := cloudfrontSvc.DeleteDistributionRequest(cloudfrontDeleteDistributionInput()) - return req - }) -} - -func BenchmarkRESTXMLRequest_REST_S3HeadObject(b *testing.B) { - benchRESTXMLRequest(b, func() *request.Request { - req, _ := s3Svc.HeadObjectRequest(s3HeadObjectInput()) - return req - }) -} - -func BenchmarkRESTXMLRequest_XML_S3PutObjectAcl(b *testing.B) { - benchRESTXMLRequest(b, func() *request.Request { - req, _ := s3Svc.PutObjectAclRequest(s3PutObjectAclInput()) - return req - }) -} - -func BenchmarkEncodingXML_Simple(b *testing.B) { - params := cloudfrontDeleteDistributionInput() - - for i := 0; i < b.N; i++ { - buf := &bytes.Buffer{} - encoder := xml.NewEncoder(buf) - if err := encoder.Encode(params); err != nil { - b.Fatal("Unexpected error", err) - } - } -} - -func benchRESTXMLBuild(b *testing.B, reqFn func() *request.Request) { - b.ResetTimer() - - for i := 0; i < b.N; i++ { - req := reqFn() - restxml.Build(req) - if req.Error != nil { - b.Fatal("Unexpected error", req.Error) - } - } -} - -func benchRESTXMLRequest(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 cloudfrontCreateDistributionInput() *cloudfront.CreateDistributionInput { - return &cloudfront.CreateDistributionInput{ - DistributionConfig: &cloudfront.DistributionConfig{ // Required - CallerReference: aws.String("string"), // Required - Comment: aws.String("string"), // Required - DefaultCacheBehavior: &cloudfront.DefaultCacheBehavior{ // Required - ForwardedValues: &cloudfront.ForwardedValues{ // Required - Cookies: &cloudfront.CookiePreference{ // Required - Forward: aws.String("ItemSelection"), // Required - WhitelistedNames: &cloudfront.CookieNames{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - QueryString: aws.Bool(true), // Required - Headers: &cloudfront.Headers{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - MinTTL: aws.Int64(1), // Required - TargetOriginId: aws.String("string"), // Required - TrustedSigners: &cloudfront.TrustedSigners{ // Required - Enabled: aws.Bool(true), // Required - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required - AllowedMethods: &cloudfront.AllowedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - CachedMethods: &cloudfront.CachedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - }, - }, - DefaultTTL: aws.Int64(1), - MaxTTL: aws.Int64(1), - SmoothStreaming: aws.Bool(true), - }, - Enabled: aws.Bool(true), // Required - Origins: &cloudfront.Origins{ // Required - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.Origin{ - { // Required - DomainName: aws.String("string"), // Required - Id: aws.String("string"), // Required - CustomOriginConfig: &cloudfront.CustomOriginConfig{ - HTTPPort: aws.Int64(1), // Required - HTTPSPort: aws.Int64(1), // Required - OriginProtocolPolicy: aws.String("OriginProtocolPolicy"), // Required - }, - OriginPath: aws.String("string"), - S3OriginConfig: &cloudfront.S3OriginConfig{ - OriginAccessIdentity: aws.String("string"), // Required - }, - }, - // More values... - }, - }, - Aliases: &cloudfront.Aliases{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - CacheBehaviors: &cloudfront.CacheBehaviors{ - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.CacheBehavior{ - { // Required - ForwardedValues: &cloudfront.ForwardedValues{ // Required - Cookies: &cloudfront.CookiePreference{ // Required - Forward: aws.String("ItemSelection"), // Required - WhitelistedNames: &cloudfront.CookieNames{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - QueryString: aws.Bool(true), // Required - Headers: &cloudfront.Headers{ - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - MinTTL: aws.Int64(1), // Required - PathPattern: aws.String("string"), // Required - TargetOriginId: aws.String("string"), // Required - TrustedSigners: &cloudfront.TrustedSigners{ // Required - Enabled: aws.Bool(true), // Required - Quantity: aws.Int64(1), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - ViewerProtocolPolicy: aws.String("ViewerProtocolPolicy"), // Required - AllowedMethods: &cloudfront.AllowedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - CachedMethods: &cloudfront.CachedMethods{ - Items: []*string{ // Required - aws.String("Method"), // Required - // More values... - }, - Quantity: aws.Int64(1), // Required - }, - }, - DefaultTTL: aws.Int64(1), - MaxTTL: aws.Int64(1), - SmoothStreaming: aws.Bool(true), - }, - // More values... - }, - }, - CustomErrorResponses: &cloudfront.CustomErrorResponses{ - Quantity: aws.Int64(1), // Required - Items: []*cloudfront.CustomErrorResponse{ - { // Required - ErrorCode: aws.Int64(1), // Required - ErrorCachingMinTTL: aws.Int64(1), - ResponseCode: aws.String("string"), - ResponsePagePath: aws.String("string"), - }, - // More values... - }, - }, - DefaultRootObject: aws.String("string"), - Logging: &cloudfront.LoggingConfig{ - Bucket: aws.String("string"), // Required - Enabled: aws.Bool(true), // Required - IncludeCookies: aws.Bool(true), // Required - Prefix: aws.String("string"), // Required - }, - PriceClass: aws.String("PriceClass"), - Restrictions: &cloudfront.Restrictions{ - GeoRestriction: &cloudfront.GeoRestriction{ // Required - Quantity: aws.Int64(1), // Required - RestrictionType: aws.String("GeoRestrictionType"), // Required - Items: []*string{ - aws.String("string"), // Required - // More values... - }, - }, - }, - ViewerCertificate: &cloudfront.ViewerCertificate{ - CloudFrontDefaultCertificate: aws.Bool(true), - IAMCertificateId: aws.String("string"), - MinimumProtocolVersion: aws.String("MinimumProtocolVersion"), - SSLSupportMethod: aws.String("SSLSupportMethod"), - }, - }, - } -} - -func cloudfrontDeleteDistributionInput() *cloudfront.DeleteDistributionInput { - return &cloudfront.DeleteDistributionInput{ - Id: aws.String("string"), // Required - IfMatch: aws.String("string"), - } -} - -func s3HeadObjectInput() *s3.HeadObjectInput { - return &s3.HeadObjectInput{ - Bucket: aws.String("somebucketname"), - Key: aws.String("keyname"), - VersionId: aws.String("someVersion"), - IfMatch: aws.String("IfMatch"), - } -} - -func s3PutObjectAclInput() *s3.PutObjectAclInput { - return &s3.PutObjectAclInput{ - Bucket: aws.String("somebucketname"), - Key: aws.String("keyname"), - AccessControlPolicy: &s3.AccessControlPolicy{ - Grants: []*s3.Grant{ - { - Grantee: &s3.Grantee{ - DisplayName: aws.String("someName"), - EmailAddress: aws.String("someAddr"), - ID: aws.String("someID"), - Type: aws.String(s3.TypeCanonicalUser), - URI: aws.String("someURI"), - }, - Permission: aws.String(s3.PermissionWrite), - }, - }, - Owner: &s3.Owner{ - DisplayName: aws.String("howdy"), - ID: aws.String("someID"), - }, - }, - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go deleted file mode 100644 index 3f1efef..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/build_test.go +++ /dev/null @@ -1,6344 +0,0 @@ -package restxml_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/restxml" - "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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService1TestShapeInputService1TestCaseOperation2Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation2Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService1TestShapeInputService1TestCaseOperation2Input) (*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 *InputService1TestShapeInputService1TestCaseOperation2Input, 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 *InputService1TestShapeInputService1TestCaseOperation2Input) (req *request.Request, output *InputService1TestShapeInputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService1TestCaseOperation2, - HTTPMethod: "PUT", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation2Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService1TestShapeInputService1TestCaseOperation2Input) (*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 *InputService1TestShapeInputService1TestCaseOperation2Input, 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, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService1TestShapeInputService1TestCaseOperation3Input{} - } - - output = &InputService1TestShapeInputService1TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 InputService1TestShapeInputService1TestCaseOperation2Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - Name *string `type:"string"` -} - -// SetDescription sets the Description field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation2Input) SetDescription(v string) *InputService1TestShapeInputService1TestCaseOperation2Input { - s.Description = &v - return s -} - -// SetName sets the Name field's value. -func (s *InputService1TestShapeInputService1TestCaseOperation2Input) SetName(v string) *InputService1TestShapeInputService1TestCaseOperation2Input { - s.Name = &v - return s -} - -type InputService1TestShapeInputService1TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService1TestShapeInputService1TestCaseOperation3Input struct { - _ struct{} `type:"structure"` -} - -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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService2TestShapeInputService2TestCaseOperation1Input{} - } - - output = &InputService2TestShapeInputService2TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - First *bool `type:"boolean"` - - Fourth *int64 `type:"integer"` - - Second *bool `type:"boolean"` - - Third *float64 `type:"float"` -} - -// SetFirst sets the First field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetFirst(v bool) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.First = &v - return s -} - -// SetFourth sets the Fourth field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetFourth(v int64) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.Fourth = &v - return s -} - -// SetSecond sets the Second field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetSecond(v bool) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.Second = &v - return s -} - -// SetThird sets the Third field's value. -func (s *InputService2TestShapeInputService2TestCaseOperation1Input) SetThird(v float64) *InputService2TestShapeInputService2TestCaseOperation1Input { - s.Third = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService3TestShapeInputService3TestCaseOperation2Input{} - } - - output = &InputService3TestShapeInputService3TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - SubStructure *InputService3TestShapeSubStructure `type:"structure"` -} - -// SetDescription sets the Description field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetDescription(v string) *InputService3TestShapeInputService3TestCaseOperation2Input { - s.Description = &v - return s -} - -// SetSubStructure sets the SubStructure field's value. -func (s *InputService3TestShapeInputService3TestCaseOperation2Input) SetSubStructure(v *InputService3TestShapeSubStructure) *InputService3TestShapeInputService3TestCaseOperation2Input { - s.SubStructure = v - return s -} - -type InputService3TestShapeInputService3TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService3TestShapeSubStructure struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Foo *string `type:"string"` -} - -// SetBar sets the Bar field's value. -func (s *InputService3TestShapeSubStructure) SetBar(v string) *InputService3TestShapeSubStructure { - s.Bar = &v - return s -} - -// SetFoo sets the Foo field's value. -func (s *InputService3TestShapeSubStructure) SetFoo(v string) *InputService3TestShapeSubStructure { - s.Foo = &v - return s -} - -// 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService4TestShapeInputService4TestCaseOperation1Input{} - } - - output = &InputService4TestShapeInputService4TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Description *string `type:"string"` - - SubStructure *InputService4TestShapeSubStructure `type:"structure"` -} - -// SetDescription sets the Description field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetDescription(v string) *InputService4TestShapeInputService4TestCaseOperation1Input { - s.Description = &v - return s -} - -// SetSubStructure sets the SubStructure field's value. -func (s *InputService4TestShapeInputService4TestCaseOperation1Input) SetSubStructure(v *InputService4TestShapeSubStructure) *InputService4TestShapeInputService4TestCaseOperation1Input { - s.SubStructure = v - return s -} - -type InputService4TestShapeInputService4TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService4TestShapeSubStructure struct { - _ struct{} `type:"structure"` - - Bar *string `type:"string"` - - Foo *string `type:"string"` -} - -// SetBar sets the Bar field's value. -func (s *InputService4TestShapeSubStructure) SetBar(v string) *InputService4TestShapeSubStructure { - s.Bar = &v - return s -} - -// SetFoo sets the Foo field's value. -func (s *InputService4TestShapeSubStructure) SetFoo(v string) *InputService4TestShapeSubStructure { - s.Foo = &v - return s -} - -// 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService5TestShapeInputService5TestCaseOperation1Input{} - } - - output = &InputService5TestShapeInputService5TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `type:"list"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService5TestShapeInputService5TestCaseOperation1Input) SetListParam(v []*string) *InputService5TestShapeInputService5TestCaseOperation1Input { - s.ListParam = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService6TestShapeInputService6TestCaseOperation1Input{} - } - - output = &InputService6TestShapeInputService6TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `locationName:"AlternateName" locationNameList:"NotMember" type:"list"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService6TestShapeInputService6TestCaseOperation1Input) SetListParam(v []*string) *InputService6TestShapeInputService6TestCaseOperation1Input { - s.ListParam = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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, - HTTPMethod: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService7TestShapeInputService7TestCaseOperation1Input{} - } - - output = &InputService7TestShapeInputService7TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `type:"list" flattened:"true"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService7TestShapeInputService7TestCaseOperation1Input) SetListParam(v []*string) *InputService7TestShapeInputService7TestCaseOperation1Input { - s.ListParam = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "POST", - HTTPPath: "/2014-01-01/hostedzone", - } - - if input == nil { - input = &InputService8TestShapeInputService8TestCaseOperation1Input{} - } - - output = &InputService8TestShapeInputService8TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*string `locationName:"item" type:"list" flattened:"true"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService8TestShapeInputService8TestCaseOperation1Input) SetListParam(v []*string) *InputService8TestShapeInputService8TestCaseOperation1Input { - s.ListParam = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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/hostedzone", - } - - if input == nil { - input = &InputService9TestShapeInputService9TestCaseOperation1Input{} - } - - output = &InputService9TestShapeInputService9TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - ListParam []*InputService9TestShapeSingleFieldStruct `locationName:"item" type:"list" flattened:"true"` -} - -// SetListParam sets the ListParam field's value. -func (s *InputService9TestShapeInputService9TestCaseOperation1Input) SetListParam(v []*InputService9TestShapeSingleFieldStruct) *InputService9TestShapeInputService9TestCaseOperation1Input { - s.ListParam = v - return s -} - -type InputService9TestShapeInputService9TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService9TestShapeSingleFieldStruct struct { - _ struct{} `type:"structure"` - - Element *string `locationName:"value" type:"string"` -} - -// SetElement sets the Element field's value. -func (s *InputService9TestShapeSingleFieldStruct) SetElement(v string) *InputService9TestShapeSingleFieldStruct { - s.Element = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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/hostedzone", - } - - if input == nil { - input = &InputService10TestShapeInputService10TestCaseOperation1Input{} - } - - output = &InputService10TestShapeInputService10TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - StructureParam *InputService10TestShapeStructureShape `type:"structure"` -} - -// SetStructureParam sets the StructureParam field's value. -func (s *InputService10TestShapeInputService10TestCaseOperation1Input) SetStructureParam(v *InputService10TestShapeStructureShape) *InputService10TestShapeInputService10TestCaseOperation1Input { - s.StructureParam = v - return s -} - -type InputService10TestShapeInputService10TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService10TestShapeStructureShape struct { - _ struct{} `type:"structure"` - - // B is automatically base64 encoded/decoded by the SDK. - B []byte `locationName:"b" type:"blob"` - - T *time.Time `locationName:"t" type:"timestamp" timestampFormat:"iso8601"` -} - -// SetB sets the B field's value. -func (s *InputService10TestShapeStructureShape) SetB(v []byte) *InputService10TestShapeStructureShape { - s.B = v - return s -} - -// SetT sets the T field's value. -func (s *InputService10TestShapeStructureShape) SetT(v time.Time) *InputService10TestShapeStructureShape { - s.T = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "/", - } - - if input == nil { - input = &InputService11TestShapeInputService11TestCaseOperation1Input{} - } - - output = &InputService11TestShapeInputService11TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - Foo map[string]*string `location:"headers" locationName:"x-foo-" type:"map"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService11TestShapeInputService11TestCaseOperation1Input) SetFoo(v map[string]*string) *InputService11TestShapeInputService11TestCaseOperation1Input { - s.Foo = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService12TestShapeInputService12TestCaseOperation1Input{} - } - - output = &InputService12TestShapeInputService12TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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"` - - Items []*string `location:"querystring" locationName:"item" type:"list"` -} - -// SetItems sets the Items field's value. -func (s *InputService12TestShapeInputService12TestCaseOperation1Input) SetItems(v []*string) *InputService12TestShapeInputService12TestCaseOperation1Input { - s.Items = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService13TestShapeInputService13TestCaseOperation1Input) (req *request.Request, output *InputService13TestShapeInputService13TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService13TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService13TestShapeInputService13TestCaseOperation1Input{} - } - - output = &InputService13TestShapeInputService13TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService13TestShapeInputService13TestCaseOperation1Input) (*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 *InputService13TestShapeInputService13TestCaseOperation1Input, opts ...request.Option) (*InputService13TestShapeInputService13TestCaseOperation1Output, error) { - req, out := c.InputService13TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService13TestShapeInputService13TestCaseOperation1Input 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 *InputService13TestShapeInputService13TestCaseOperation1Input) SetPipelineId(v string) *InputService13TestShapeInputService13TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -// SetQueryDoc sets the QueryDoc field's value. -func (s *InputService13TestShapeInputService13TestCaseOperation1Input) SetQueryDoc(v map[string]*string) *InputService13TestShapeInputService13TestCaseOperation1Input { - s.QueryDoc = v - return s -} - -type InputService13TestShapeInputService13TestCaseOperation1Output 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService14TestShapeInputService14TestCaseOperation1Input) (req *request.Request, output *InputService14TestShapeInputService14TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService14TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/2014-01-01/jobsByPipeline/{PipelineId}", - } - - if input == nil { - input = &InputService14TestShapeInputService14TestCaseOperation1Input{} - } - - output = &InputService14TestShapeInputService14TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService14TestShapeInputService14TestCaseOperation1Input) (*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 *InputService14TestShapeInputService14TestCaseOperation1Input, opts ...request.Option) (*InputService14TestShapeInputService14TestCaseOperation1Output, error) { - req, out := c.InputService14TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService14TestShapeInputService14TestCaseOperation1Input 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 *InputService14TestShapeInputService14TestCaseOperation1Input) SetPipelineId(v string) *InputService14TestShapeInputService14TestCaseOperation1Input { - s.PipelineId = &v - return s -} - -// SetQueryDoc sets the QueryDoc field's value. -func (s *InputService14TestShapeInputService14TestCaseOperation1Input) SetQueryDoc(v map[string][]*string) *InputService14TestShapeInputService14TestCaseOperation1Input { - s.QueryDoc = v - return s -} - -type InputService14TestShapeInputService14TestCaseOperation1Output 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation2Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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: "GET", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService15TestShapeInputService15TestCaseOperation2Input{} - } - - output = &InputService15TestShapeInputService15TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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"` - - BoolQuery *bool `location:"querystring" locationName:"bool-query" type:"boolean"` -} - -// SetBoolQuery sets the BoolQuery field's value. -func (s *InputService15TestShapeInputService15TestCaseOperation2Input) SetBoolQuery(v bool) *InputService15TestShapeInputService15TestCaseOperation2Input { - s.BoolQuery = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService16TestShapeInputService16TestCaseOperation1Input) (req *request.Request, output *InputService16TestShapeInputService16TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService16TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService16TestShapeInputService16TestCaseOperation1Input{} - } - - output = &InputService16TestShapeInputService16TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService16TestShapeInputService16TestCaseOperation1Input) (*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 *InputService16TestShapeInputService16TestCaseOperation1Input, opts ...request.Option) (*InputService16TestShapeInputService16TestCaseOperation1Output, error) { - req, out := c.InputService16TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService16TestShapeInputService16TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *string `locationName:"foo" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService16TestShapeInputService16TestCaseOperation1Input) SetFoo(v string) *InputService16TestShapeInputService16TestCaseOperation1Input { - s.Foo = &v - return s -} - -type InputService16TestShapeInputService16TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "/", - } - - if input == nil { - input = &InputService17TestShapeInputService17TestCaseOperation2Input{} - } - - output = &InputService17TestShapeInputService17TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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: "/", - } - - if input == nil { - input = &InputService17TestShapeInputService17TestCaseOperation2Input{} - } - - output = &InputService17TestShapeInputService17TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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" payload:"Foo"` - - Foo []byte `locationName:"foo" type:"blob"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService17TestShapeInputService17TestCaseOperation2Input) SetFoo(v []byte) *InputService17TestShapeInputService17TestCaseOperation2Input { - s.Foo = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation4Input{} - } - - output = &InputService18TestShapeInputService18TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService18TestShapeInputService18TestCaseOperation4Input) (*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 *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation1Output, error) { - req, out := c.InputService18TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService18TestCaseOperation2 = "OperationName" - -// InputService18TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService18TestCaseOperation2 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 InputService18TestCaseOperation2 for more information on using the InputService18TestCaseOperation2 -// 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 InputService18TestCaseOperation2Request method. -// req, resp := client.InputService18TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService18ProtocolTest) InputService18TestCaseOperation2Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation4Input{} - } - - output = &InputService18TestShapeInputService18TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService18TestCaseOperation2 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 InputService18TestCaseOperation2 for usage and error information. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation2(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation2Output, error) { - req, out := c.InputService18TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService18TestCaseOperation2WithContext is the same as InputService18TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService18TestCaseOperation2 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) InputService18TestCaseOperation2WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation2Output, error) { - req, out := c.InputService18TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService18TestCaseOperation3 = "OperationName" - -// InputService18TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService18TestCaseOperation3 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 InputService18TestCaseOperation3 for more information on using the InputService18TestCaseOperation3 -// 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 InputService18TestCaseOperation3Request method. -// req, resp := client.InputService18TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService18ProtocolTest) InputService18TestCaseOperation3Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation4Input{} - } - - output = &InputService18TestShapeInputService18TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService18TestCaseOperation3 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 InputService18TestCaseOperation3 for usage and error information. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation3(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation3Output, error) { - req, out := c.InputService18TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService18TestCaseOperation3WithContext is the same as InputService18TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService18TestCaseOperation3 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) InputService18TestCaseOperation3WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation3Output, error) { - req, out := c.InputService18TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService18TestCaseOperation4 = "OperationName" - -// InputService18TestCaseOperation4Request generates a "aws/request.Request" representing the -// client's request for the InputService18TestCaseOperation4 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 InputService18TestCaseOperation4 for more information on using the InputService18TestCaseOperation4 -// 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 InputService18TestCaseOperation4Request method. -// req, resp := client.InputService18TestCaseOperation4Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService18ProtocolTest) InputService18TestCaseOperation4Request(input *InputService18TestShapeInputService18TestCaseOperation4Input) (req *request.Request, output *InputService18TestShapeInputService18TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService18TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/", - } - - if input == nil { - input = &InputService18TestShapeInputService18TestCaseOperation4Input{} - } - - output = &InputService18TestShapeInputService18TestCaseOperation4Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService18TestCaseOperation4 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 InputService18TestCaseOperation4 for usage and error information. -func (c *InputService18ProtocolTest) InputService18TestCaseOperation4(input *InputService18TestShapeInputService18TestCaseOperation4Input) (*InputService18TestShapeInputService18TestCaseOperation4Output, error) { - req, out := c.InputService18TestCaseOperation4Request(input) - return out, req.Send() -} - -// InputService18TestCaseOperation4WithContext is the same as InputService18TestCaseOperation4 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService18TestCaseOperation4 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) InputService18TestCaseOperation4WithContext(ctx aws.Context, input *InputService18TestShapeInputService18TestCaseOperation4Input, opts ...request.Option) (*InputService18TestShapeInputService18TestCaseOperation4Output, error) { - req, out := c.InputService18TestCaseOperation4Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService18TestShapeFooShape struct { - _ struct{} `locationName:"foo" type:"structure"` - - Baz *string `locationName:"baz" type:"string"` -} - -// SetBaz sets the Baz field's value. -func (s *InputService18TestShapeFooShape) SetBaz(v string) *InputService18TestShapeFooShape { - s.Baz = &v - return s -} - -type InputService18TestShapeInputService18TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService18TestShapeInputService18TestCaseOperation4Input struct { - _ struct{} `type:"structure" payload:"Foo"` - - Foo *InputService18TestShapeFooShape `locationName:"foo" type:"structure"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService18TestShapeInputService18TestCaseOperation4Input) SetFoo(v *InputService18TestShapeFooShape) *InputService18TestShapeInputService18TestCaseOperation4Input { - s.Foo = v - return s -} - -type InputService18TestShapeInputService18TestCaseOperation4Output 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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(restxml.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 InputService19TestShapeGrant struct { - _ struct{} `locationName:"Grant" type:"structure"` - - Grantee *InputService19TestShapeGrantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` -} - -// SetGrantee sets the Grantee field's value. -func (s *InputService19TestShapeGrant) SetGrantee(v *InputService19TestShapeGrantee) *InputService19TestShapeGrant { - s.Grantee = v - return s -} - -type InputService19TestShapeGrantee struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - EmailAddress *string `type:"string"` - - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true"` -} - -// SetEmailAddress sets the EmailAddress field's value. -func (s *InputService19TestShapeGrantee) SetEmailAddress(v string) *InputService19TestShapeGrantee { - s.EmailAddress = &v - return s -} - -// SetType sets the Type field's value. -func (s *InputService19TestShapeGrantee) SetType(v string) *InputService19TestShapeGrantee { - s.Type = &v - return s -} - -type InputService19TestShapeInputService19TestCaseOperation1Input struct { - _ struct{} `type:"structure" payload:"Grant"` - - Grant *InputService19TestShapeGrant `locationName:"Grant" type:"structure"` -} - -// SetGrant sets the Grant field's value. -func (s *InputService19TestShapeInputService19TestCaseOperation1Input) SetGrant(v *InputService19TestShapeGrant) *InputService19TestShapeInputService19TestCaseOperation1Input { - s.Grant = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *InputService20TestShapeInputService20TestCaseOperation1Input) (req *request.Request, output *InputService20TestShapeInputService20TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService20TestCaseOperation1, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &InputService20TestShapeInputService20TestCaseOperation1Input{} - } - - output = &InputService20TestShapeInputService20TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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 *InputService20TestShapeInputService20TestCaseOperation1Input) (*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 *InputService20TestShapeInputService20TestCaseOperation1Input, opts ...request.Option) (*InputService20TestShapeInputService20TestCaseOperation1Output, error) { - req, out := c.InputService20TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService20TestShapeInputService20TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - Bucket *string `location:"uri" type:"string"` - - Key *string `location:"uri" type:"string"` -} - -// SetBucket sets the Bucket field's value. -func (s *InputService20TestShapeInputService20TestCaseOperation1Input) SetBucket(v string) *InputService20TestShapeInputService20TestCaseOperation1Input { - s.Bucket = &v - return s -} - -// SetKey sets the Key field's value. -func (s *InputService20TestShapeInputService20TestCaseOperation1Input) SetKey(v string) *InputService20TestShapeInputService20TestCaseOperation1Input { - s.Key = &v - return s -} - -type InputService20TestShapeInputService20TestCaseOperation1Output 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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: "/path", - } - - if input == nil { - input = &InputService21TestShapeInputService21TestCaseOperation2Input{} - } - - output = &InputService21TestShapeInputService21TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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: "/path?abc=mno", - } - - if input == nil { - input = &InputService21TestShapeInputService21TestCaseOperation2Input{} - } - - output = &InputService21TestShapeInputService21TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.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"` - - Foo *string `location:"querystring" locationName:"param-name" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *InputService21TestShapeInputService21TestCaseOperation2Input) SetFoo(v string) *InputService21TestShapeInputService21TestCaseOperation2Input { - s.Foo = &v - return s -} - -type InputService21TestShapeInputService21TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService22ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService22ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService22ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService22ProtocolTest 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 InputService22ProtocolTest client from just a session. -// svc := inputservice22protocoltest.New(mySession) -// -// // Create a InputService22ProtocolTest client with additional configuration -// svc := inputservice22protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService22ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService22ProtocolTest { - c := p.ClientConfig("inputservice22protocoltest", cfgs...) - return newInputService22ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService22ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService22ProtocolTest { - svc := &InputService22ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice22protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService22ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService22ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService22TestCaseOperation1 = "OperationName" - -// InputService22TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation1 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 InputService22TestCaseOperation1 for more information on using the InputService22TestCaseOperation1 -// 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 InputService22TestCaseOperation1Request method. -// req, resp := client.InputService22TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation1Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation1 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 InputService22TestCaseOperation1 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation1(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation1Output, error) { - req, out := c.InputService22TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation1WithContext is the same as InputService22TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation1 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 *InputService22ProtocolTest) InputService22TestCaseOperation1WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation1Output, error) { - req, out := c.InputService22TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService22TestCaseOperation2 = "OperationName" - -// InputService22TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation2 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 InputService22TestCaseOperation2 for more information on using the InputService22TestCaseOperation2 -// 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 InputService22TestCaseOperation2Request method. -// req, resp := client.InputService22TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation2Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation2 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 InputService22TestCaseOperation2 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation2(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation2Output, error) { - req, out := c.InputService22TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation2WithContext is the same as InputService22TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation2 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 *InputService22ProtocolTest) InputService22TestCaseOperation2WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation2Output, error) { - req, out := c.InputService22TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService22TestCaseOperation3 = "OperationName" - -// InputService22TestCaseOperation3Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation3 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 InputService22TestCaseOperation3 for more information on using the InputService22TestCaseOperation3 -// 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 InputService22TestCaseOperation3Request method. -// req, resp := client.InputService22TestCaseOperation3Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation3Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation3Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation3, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation3Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation3 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 InputService22TestCaseOperation3 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation3(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation3Output, error) { - req, out := c.InputService22TestCaseOperation3Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation3WithContext is the same as InputService22TestCaseOperation3 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation3 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 *InputService22ProtocolTest) InputService22TestCaseOperation3WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation3Output, error) { - req, out := c.InputService22TestCaseOperation3Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService22TestCaseOperation4 = "OperationName" - -// InputService22TestCaseOperation4Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation4 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 InputService22TestCaseOperation4 for more information on using the InputService22TestCaseOperation4 -// 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 InputService22TestCaseOperation4Request method. -// req, resp := client.InputService22TestCaseOperation4Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation4Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation4Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation4, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation4Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation4 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 InputService22TestCaseOperation4 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation4(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation4Output, error) { - req, out := c.InputService22TestCaseOperation4Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation4WithContext is the same as InputService22TestCaseOperation4 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation4 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 *InputService22ProtocolTest) InputService22TestCaseOperation4WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation4Output, error) { - req, out := c.InputService22TestCaseOperation4Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService22TestCaseOperation5 = "OperationName" - -// InputService22TestCaseOperation5Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation5 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 InputService22TestCaseOperation5 for more information on using the InputService22TestCaseOperation5 -// 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 InputService22TestCaseOperation5Request method. -// req, resp := client.InputService22TestCaseOperation5Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation5Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation5Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation5, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation5Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation5 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 InputService22TestCaseOperation5 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation5(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation5Output, error) { - req, out := c.InputService22TestCaseOperation5Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation5WithContext is the same as InputService22TestCaseOperation5 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation5 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 *InputService22ProtocolTest) InputService22TestCaseOperation5WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation5Output, error) { - req, out := c.InputService22TestCaseOperation5Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService22TestCaseOperation6 = "OperationName" - -// InputService22TestCaseOperation6Request generates a "aws/request.Request" representing the -// client's request for the InputService22TestCaseOperation6 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 InputService22TestCaseOperation6 for more information on using the InputService22TestCaseOperation6 -// 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 InputService22TestCaseOperation6Request method. -// req, resp := client.InputService22TestCaseOperation6Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService22ProtocolTest) InputService22TestCaseOperation6Request(input *InputService22TestShapeInputService22TestCaseOperation6Input) (req *request.Request, output *InputService22TestShapeInputService22TestCaseOperation6Output) { - op := &request.Operation{ - Name: opInputService22TestCaseOperation6, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService22TestShapeInputService22TestCaseOperation6Input{} - } - - output = &InputService22TestShapeInputService22TestCaseOperation6Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService22TestCaseOperation6 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 InputService22TestCaseOperation6 for usage and error information. -func (c *InputService22ProtocolTest) InputService22TestCaseOperation6(input *InputService22TestShapeInputService22TestCaseOperation6Input) (*InputService22TestShapeInputService22TestCaseOperation6Output, error) { - req, out := c.InputService22TestCaseOperation6Request(input) - return out, req.Send() -} - -// InputService22TestCaseOperation6WithContext is the same as InputService22TestCaseOperation6 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService22TestCaseOperation6 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 *InputService22ProtocolTest) InputService22TestCaseOperation6WithContext(ctx aws.Context, input *InputService22TestShapeInputService22TestCaseOperation6Input, opts ...request.Option) (*InputService22TestShapeInputService22TestCaseOperation6Output, error) { - req, out := c.InputService22TestCaseOperation6Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService22TestShapeInputService22TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeInputService22TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeInputService22TestCaseOperation3Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeInputService22TestCaseOperation4Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeInputService22TestCaseOperation5Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeInputService22TestCaseOperation6Input struct { - _ struct{} `locationName:"OperationRequest" type:"structure" xmlURI:"https://foo/"` - - RecursiveStruct *InputService22TestShapeRecursiveStructType `type:"structure"` -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService22TestShapeInputService22TestCaseOperation6Input) SetRecursiveStruct(v *InputService22TestShapeRecursiveStructType) *InputService22TestShapeInputService22TestCaseOperation6Input { - s.RecursiveStruct = v - return s -} - -type InputService22TestShapeInputService22TestCaseOperation6Output struct { - _ struct{} `type:"structure"` -} - -type InputService22TestShapeRecursiveStructType struct { - _ struct{} `type:"structure"` - - NoRecurse *string `type:"string"` - - RecursiveList []*InputService22TestShapeRecursiveStructType `type:"list"` - - RecursiveMap map[string]*InputService22TestShapeRecursiveStructType `type:"map"` - - RecursiveStruct *InputService22TestShapeRecursiveStructType `type:"structure"` -} - -// SetNoRecurse sets the NoRecurse field's value. -func (s *InputService22TestShapeRecursiveStructType) SetNoRecurse(v string) *InputService22TestShapeRecursiveStructType { - s.NoRecurse = &v - return s -} - -// SetRecursiveList sets the RecursiveList field's value. -func (s *InputService22TestShapeRecursiveStructType) SetRecursiveList(v []*InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType { - s.RecursiveList = v - return s -} - -// SetRecursiveMap sets the RecursiveMap field's value. -func (s *InputService22TestShapeRecursiveStructType) SetRecursiveMap(v map[string]*InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType { - s.RecursiveMap = v - return s -} - -// SetRecursiveStruct sets the RecursiveStruct field's value. -func (s *InputService22TestShapeRecursiveStructType) SetRecursiveStruct(v *InputService22TestShapeRecursiveStructType) *InputService22TestShapeRecursiveStructType { - s.RecursiveStruct = v - return s -} - -// InputService23ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService23ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService23ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService23ProtocolTest 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 InputService23ProtocolTest client from just a session. -// svc := inputservice23protocoltest.New(mySession) -// -// // Create a InputService23ProtocolTest client with additional configuration -// svc := inputservice23protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService23ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService23ProtocolTest { - c := p.ClientConfig("inputservice23protocoltest", cfgs...) - return newInputService23ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService23ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService23ProtocolTest { - svc := &InputService23ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice23protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService23ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService23ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService23TestCaseOperation1 = "OperationName" - -// InputService23TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService23TestCaseOperation1 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 InputService23TestCaseOperation1 for more information on using the InputService23TestCaseOperation1 -// 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 InputService23TestCaseOperation1Request method. -// req, resp := client.InputService23TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService23ProtocolTest) InputService23TestCaseOperation1Request(input *InputService23TestShapeInputService23TestCaseOperation1Input) (req *request.Request, output *InputService23TestShapeInputService23TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService23TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService23TestShapeInputService23TestCaseOperation1Input{} - } - - output = &InputService23TestShapeInputService23TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService23TestCaseOperation1 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 InputService23TestCaseOperation1 for usage and error information. -func (c *InputService23ProtocolTest) InputService23TestCaseOperation1(input *InputService23TestShapeInputService23TestCaseOperation1Input) (*InputService23TestShapeInputService23TestCaseOperation1Output, error) { - req, out := c.InputService23TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService23TestCaseOperation1WithContext is the same as InputService23TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService23TestCaseOperation1 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 *InputService23ProtocolTest) InputService23TestCaseOperation1WithContext(ctx aws.Context, input *InputService23TestShapeInputService23TestCaseOperation1Input, opts ...request.Option) (*InputService23TestShapeInputService23TestCaseOperation1Output, error) { - req, out := c.InputService23TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService23TestShapeInputService23TestCaseOperation1Input struct { - _ struct{} `type:"structure"` - - TimeArgInHeader *time.Time `location:"header" locationName:"x-amz-timearg" type:"timestamp" timestampFormat:"rfc822"` -} - -// SetTimeArgInHeader sets the TimeArgInHeader field's value. -func (s *InputService23TestShapeInputService23TestCaseOperation1Input) SetTimeArgInHeader(v time.Time) *InputService23TestShapeInputService23TestCaseOperation1Input { - s.TimeArgInHeader = &v - return s -} - -type InputService23TestShapeInputService23TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -// InputService24ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService24ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService24ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService24ProtocolTest 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 InputService24ProtocolTest client from just a session. -// svc := inputservice24protocoltest.New(mySession) -// -// // Create a InputService24ProtocolTest client with additional configuration -// svc := inputservice24protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService24ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService24ProtocolTest { - c := p.ClientConfig("inputservice24protocoltest", cfgs...) - return newInputService24ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService24ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService24ProtocolTest { - svc := &InputService24ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice24protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService24ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService24ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService24TestCaseOperation1 = "OperationName" - -// InputService24TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService24TestCaseOperation1 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 InputService24TestCaseOperation1 for more information on using the InputService24TestCaseOperation1 -// 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 InputService24TestCaseOperation1Request method. -// req, resp := client.InputService24TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService24ProtocolTest) InputService24TestCaseOperation1Request(input *InputService24TestShapeInputService24TestCaseOperation2Input) (req *request.Request, output *InputService24TestShapeInputService24TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService24TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService24TestShapeInputService24TestCaseOperation2Input{} - } - - output = &InputService24TestShapeInputService24TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService24TestCaseOperation1 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 InputService24TestCaseOperation1 for usage and error information. -func (c *InputService24ProtocolTest) InputService24TestCaseOperation1(input *InputService24TestShapeInputService24TestCaseOperation2Input) (*InputService24TestShapeInputService24TestCaseOperation1Output, error) { - req, out := c.InputService24TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService24TestCaseOperation1WithContext is the same as InputService24TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService24TestCaseOperation1 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 *InputService24ProtocolTest) InputService24TestCaseOperation1WithContext(ctx aws.Context, input *InputService24TestShapeInputService24TestCaseOperation2Input, opts ...request.Option) (*InputService24TestShapeInputService24TestCaseOperation1Output, error) { - req, out := c.InputService24TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService24TestCaseOperation2 = "OperationName" - -// InputService24TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService24TestCaseOperation2 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 InputService24TestCaseOperation2 for more information on using the InputService24TestCaseOperation2 -// 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 InputService24TestCaseOperation2Request method. -// req, resp := client.InputService24TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService24ProtocolTest) InputService24TestCaseOperation2Request(input *InputService24TestShapeInputService24TestCaseOperation2Input) (req *request.Request, output *InputService24TestShapeInputService24TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService24TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService24TestShapeInputService24TestCaseOperation2Input{} - } - - output = &InputService24TestShapeInputService24TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService24TestCaseOperation2 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 InputService24TestCaseOperation2 for usage and error information. -func (c *InputService24ProtocolTest) InputService24TestCaseOperation2(input *InputService24TestShapeInputService24TestCaseOperation2Input) (*InputService24TestShapeInputService24TestCaseOperation2Output, error) { - req, out := c.InputService24TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService24TestCaseOperation2WithContext is the same as InputService24TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService24TestCaseOperation2 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 *InputService24ProtocolTest) InputService24TestCaseOperation2WithContext(ctx aws.Context, input *InputService24TestShapeInputService24TestCaseOperation2Input, opts ...request.Option) (*InputService24TestShapeInputService24TestCaseOperation2Output, error) { - req, out := c.InputService24TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService24TestShapeInputService24TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService24TestShapeInputService24TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - Token *string `type:"string" idempotencyToken:"true"` -} - -// SetToken sets the Token field's value. -func (s *InputService24TestShapeInputService24TestCaseOperation2Input) SetToken(v string) *InputService24TestShapeInputService24TestCaseOperation2Input { - s.Token = &v - return s -} - -type InputService24TestShapeInputService24TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -// InputService25ProtocolTest provides the API operation methods for making requests to -// . See this package's package overview docs -// for details on the service. -// -// InputService25ProtocolTest methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type InputService25ProtocolTest struct { - *client.Client -} - -// New creates a new instance of the InputService25ProtocolTest 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 InputService25ProtocolTest client from just a session. -// svc := inputservice25protocoltest.New(mySession) -// -// // Create a InputService25ProtocolTest client with additional configuration -// svc := inputservice25protocoltest.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func NewInputService25ProtocolTest(p client.ConfigProvider, cfgs ...*aws.Config) *InputService25ProtocolTest { - c := p.ClientConfig("inputservice25protocoltest", cfgs...) - return newInputService25ProtocolTestClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) -} - -// newClient creates, initializes and returns a new service client instance. -func newInputService25ProtocolTestClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *InputService25ProtocolTest { - svc := &InputService25ProtocolTest{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: "inputservice25protocoltest", - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2014-01-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - return svc -} - -// newRequest creates a new request for a InputService25ProtocolTest operation and runs any -// custom request initialization. -func (c *InputService25ProtocolTest) newRequest(op *request.Operation, params, data interface{}) *request.Request { - req := c.NewRequest(op, params, data) - - return req -} - -const opInputService25TestCaseOperation1 = "OperationName" - -// InputService25TestCaseOperation1Request generates a "aws/request.Request" representing the -// client's request for the InputService25TestCaseOperation1 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 InputService25TestCaseOperation1 for more information on using the InputService25TestCaseOperation1 -// 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 InputService25TestCaseOperation1Request method. -// req, resp := client.InputService25TestCaseOperation1Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService25ProtocolTest) InputService25TestCaseOperation1Request(input *InputService25TestShapeInputService25TestCaseOperation2Input) (req *request.Request, output *InputService25TestShapeInputService25TestCaseOperation1Output) { - op := &request.Operation{ - Name: opInputService25TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/Enum/{URIEnum}", - } - - if input == nil { - input = &InputService25TestShapeInputService25TestCaseOperation2Input{} - } - - output = &InputService25TestShapeInputService25TestCaseOperation1Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService25TestCaseOperation1 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 InputService25TestCaseOperation1 for usage and error information. -func (c *InputService25ProtocolTest) InputService25TestCaseOperation1(input *InputService25TestShapeInputService25TestCaseOperation2Input) (*InputService25TestShapeInputService25TestCaseOperation1Output, error) { - req, out := c.InputService25TestCaseOperation1Request(input) - return out, req.Send() -} - -// InputService25TestCaseOperation1WithContext is the same as InputService25TestCaseOperation1 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService25TestCaseOperation1 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 *InputService25ProtocolTest) InputService25TestCaseOperation1WithContext(ctx aws.Context, input *InputService25TestShapeInputService25TestCaseOperation2Input, opts ...request.Option) (*InputService25TestShapeInputService25TestCaseOperation1Output, error) { - req, out := c.InputService25TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opInputService25TestCaseOperation2 = "OperationName" - -// InputService25TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the InputService25TestCaseOperation2 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 InputService25TestCaseOperation2 for more information on using the InputService25TestCaseOperation2 -// 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 InputService25TestCaseOperation2Request method. -// req, resp := client.InputService25TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *InputService25ProtocolTest) InputService25TestCaseOperation2Request(input *InputService25TestShapeInputService25TestCaseOperation2Input) (req *request.Request, output *InputService25TestShapeInputService25TestCaseOperation2Output) { - op := &request.Operation{ - Name: opInputService25TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &InputService25TestShapeInputService25TestCaseOperation2Input{} - } - - output = &InputService25TestShapeInputService25TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// InputService25TestCaseOperation2 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 InputService25TestCaseOperation2 for usage and error information. -func (c *InputService25ProtocolTest) InputService25TestCaseOperation2(input *InputService25TestShapeInputService25TestCaseOperation2Input) (*InputService25TestShapeInputService25TestCaseOperation2Output, error) { - req, out := c.InputService25TestCaseOperation2Request(input) - return out, req.Send() -} - -// InputService25TestCaseOperation2WithContext is the same as InputService25TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See InputService25TestCaseOperation2 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 *InputService25ProtocolTest) InputService25TestCaseOperation2WithContext(ctx aws.Context, input *InputService25TestShapeInputService25TestCaseOperation2Input, opts ...request.Option) (*InputService25TestShapeInputService25TestCaseOperation2Output, error) { - req, out := c.InputService25TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type InputService25TestShapeInputService25TestCaseOperation1Output struct { - _ struct{} `type:"structure"` -} - -type InputService25TestShapeInputService25TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - FooEnum *string `type:"string" enum:"InputService25TestShapeEnumType"` - - HeaderEnum *string `location:"header" locationName:"x-amz-enum" type:"string" enum:"InputService25TestShapeEnumType"` - - ListEnums []*string `type:"list"` - - URIFooEnum *string `location:"uri" locationName:"URIEnum" type:"string" enum:"InputService25TestShapeEnumType"` - - URIListEnums []*string `location:"querystring" locationName:"ListEnums" type:"list"` -} - -// SetFooEnum sets the FooEnum field's value. -func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetFooEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input { - s.FooEnum = &v - return s -} - -// SetHeaderEnum sets the HeaderEnum field's value. -func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetHeaderEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input { - s.HeaderEnum = &v - return s -} - -// SetListEnums sets the ListEnums field's value. -func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetListEnums(v []*string) *InputService25TestShapeInputService25TestCaseOperation2Input { - s.ListEnums = v - return s -} - -// SetURIFooEnum sets the URIFooEnum field's value. -func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetURIFooEnum(v string) *InputService25TestShapeInputService25TestCaseOperation2Input { - s.URIFooEnum = &v - return s -} - -// SetURIListEnums sets the URIListEnums field's value. -func (s *InputService25TestShapeInputService25TestCaseOperation2Input) SetURIListEnums(v []*string) *InputService25TestShapeInputService25TestCaseOperation2Input { - s.URIListEnums = v - return s -} - -type InputService25TestShapeInputService25TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -const ( - // EnumTypeFoo is a InputService25TestShapeEnumType enum value - EnumTypeFoo = "foo" - - // EnumTypeBar is a InputService25TestShapeEnumType enum value - EnumTypeBar = "bar" - - // EnumType0 is a InputService25TestShapeEnumType enum value - EnumType0 = "0" - - // EnumType1 is a InputService25TestShapeEnumType enum value - EnumType1 = "1" -) - -// -// Tests begin here -// - -func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation2Input{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `barfoo`, util.Trim(string(body)), InputService1TestShapeInputService1TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation2Input{ - Description: aws.String("bar"), - Name: aws.String("foo"), - } - req, _ := svc.InputService1TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `barfoo`, util.Trim(string(body)), InputService1TestShapeInputService1TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService1ProtocolTestBasicXMLSerializationCase3(t *testing.T) { - svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService1TestShapeInputService1TestCaseOperation3Input{} - req, _ := svc.InputService1TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.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/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) { - svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService2TestShapeInputService2TestCaseOperation1Input{ - First: aws.Bool(true), - Fourth: aws.Int64(3), - Second: aws.Bool(false), - Third: aws.Float64(1.2), - } - req, _ := svc.InputService2TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `true3false1.2`, util.Trim(string(body)), InputService2TestShapeInputService2TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - Description: aws.String("baz"), - SubStructure: &InputService3TestShapeSubStructure{ - Bar: aws.String("b"), - Foo: aws.String("a"), - }, - } - req, _ := svc.InputService3TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `bazba`, util.Trim(string(body)), InputService3TestShapeInputService3TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService3ProtocolTestNestedStructuresCase2(t *testing.T) { - svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService3TestShapeInputService3TestCaseOperation2Input{ - Description: aws.String("baz"), - SubStructure: &InputService3TestShapeSubStructure{ - Foo: aws.String("a"), - }, - } - req, _ := svc.InputService3TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `baza`, util.Trim(string(body)), InputService3TestShapeInputService3TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) { - svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService4TestShapeInputService4TestCaseOperation1Input{ - Description: aws.String("baz"), - SubStructure: &InputService4TestShapeSubStructure{}, - } - req, _ := svc.InputService4TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `baz`, util.Trim(string(body)), InputService4TestShapeInputService4TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { - svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService5TestShapeInputService5TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService5TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService5TestShapeInputService5TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *testing.T) { - svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService6TestShapeInputService6TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService6TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService6TestShapeInputService6TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) { - svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService7TestShapeInputService7TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService7TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService7TestShapeInputService7TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing.T) { - svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService8TestShapeInputService8TestCaseOperation1Input{ - ListParam: []*string{ - aws.String("one"), - aws.String("two"), - aws.String("three"), - }, - } - req, _ := svc.InputService8TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService8TestShapeInputService8TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) { - svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService9TestShapeInputService9TestCaseOperation1Input{ - ListParam: []*InputService9TestShapeSingleFieldStruct{ - { - Element: aws.String("one"), - }, - { - Element: aws.String("two"), - }, - { - Element: aws.String("three"), - }, - }, - } - req, _ := svc.InputService9TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `onetwothree`, util.Trim(string(body)), InputService9TestShapeInputService9TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) { - svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService10TestShapeInputService10TestCaseOperation1Input{ - StructureParam: &InputService10TestShapeStructureShape{ - B: []byte("foo"), - T: aws.Time(time.Unix(1422172800, 0)), - }, - } - req, _ := svc.InputService10TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `Zm9v2015-01-25T08:00:00Z`, util.Trim(string(body)), InputService10TestShapeInputService10TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/2014-01-01/hostedzone", r.URL.String()) - - // assert headers - -} - -func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) { - svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService11TestShapeInputService11TestCaseOperation1Input{ - Foo: map[string]*string{ - "a": aws.String("b"), - "c": aws.String("d"), - }, - } - req, _ := svc.InputService11TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := "b", r.Header.Get("x-foo-a"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - if e, a := "d", r.Header.Get("x-foo-c"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService12ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { - svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService12TestShapeInputService12TestCaseOperation1Input{ - Items: []*string{ - aws.String("value1"), - aws.String("value2"), - }, - } - req, _ := svc.InputService12TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService13ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService13TestShapeInputService13TestCaseOperation1Input{ - PipelineId: aws.String("foo"), - QueryDoc: map[string]*string{ - "bar": aws.String("baz"), - "fizz": aws.String("buzz"), - }, - } - req, _ := svc.InputService13TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService14ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService14TestShapeInputService14TestCaseOperation1Input{ - PipelineId: aws.String("id"), - QueryDoc: map[string][]*string{ - "fizz": { - aws.String("buzz"), - aws.String("pop"), - }, - "foo": { - aws.String("bar"), - aws.String("baz"), - }, - }, - } - req, _ := svc.InputService14TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService15ProtocolTestBooleanInQuerystringCase1(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation2Input{ - BoolQuery: aws.Bool(true), - } - req, _ := svc.InputService15TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService15ProtocolTestBooleanInQuerystringCase2(t *testing.T) { - svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService15TestShapeInputService15TestCaseOperation2Input{ - BoolQuery: aws.Bool(false), - } - req, _ := svc.InputService15TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService16ProtocolTestStringPayloadCase1(t *testing.T) { - svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService16TestShapeInputService16TestCaseOperation1Input{ - Foo: aws.String("bar"), - } - req, _ := svc.InputService16TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(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 TestInputService17ProtocolTestBlobPayloadCase1(t *testing.T) { - svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService17TestShapeInputService17TestCaseOperation2Input{ - Foo: []byte("bar"), - } - req, _ := svc.InputService17TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(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 TestInputService17ProtocolTestBlobPayloadCase2(t *testing.T) { - svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService17TestShapeInputService17TestCaseOperation2Input{} - req, _ := svc.InputService17TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService18ProtocolTestStructurePayloadCase1(t *testing.T) { - svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService18TestShapeInputService18TestCaseOperation4Input{ - Foo: &InputService18TestShapeFooShape{ - Baz: aws.String("bar"), - }, - } - req, _ := svc.InputService18TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `bar`, util.Trim(string(body)), InputService18TestShapeInputService18TestCaseOperation4Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestStructurePayloadCase2(t *testing.T) { - svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService18TestShapeInputService18TestCaseOperation4Input{} - req, _ := svc.InputService18TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService18ProtocolTestStructurePayloadCase3(t *testing.T) { - svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService18TestShapeInputService18TestCaseOperation4Input{ - Foo: &InputService18TestShapeFooShape{}, - } - req, _ := svc.InputService18TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, ``, util.Trim(string(body)), InputService18TestShapeInputService18TestCaseOperation4Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService18ProtocolTestStructurePayloadCase4(t *testing.T) { - svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService18TestShapeInputService18TestCaseOperation4Input{} - req, _ := svc.InputService18TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService19ProtocolTestXMLAttributeCase1(t *testing.T) { - svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService19TestShapeInputService19TestCaseOperation1Input{ - Grant: &InputService19TestShapeGrant{ - Grantee: &InputService19TestShapeGrantee{ - EmailAddress: aws.String("foo@example.com"), - Type: aws.String("CanonicalUser"), - }, - }, - } - req, _ := svc.InputService19TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo@example.com`, util.Trim(string(body)), InputService19TestShapeInputService19TestCaseOperation1Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/", r.URL.String()) - - // assert headers - -} - -func TestInputService20ProtocolTestGreedyKeysCase1(t *testing.T) { - svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService20TestShapeInputService20TestCaseOperation1Input{ - Bucket: aws.String("my/bucket"), - Key: aws.String("testing /123"), - } - req, _ := svc.InputService20TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.Build(req) - if req.Error != nil { - t.Errorf("expect no error, got %v", req.Error) - } - - // assert URL - awstesting.AssertURL(t, "https://test/my%2Fbucket/testing%20/123", r.URL.String()) - - // assert headers - -} - -func TestInputService21ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService21TestShapeInputService21TestCaseOperation2Input{} - req, _ := svc.InputService21TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService21ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService21TestShapeInputService21TestCaseOperation2Input{ - Foo: aws.String(""), - } - req, _ := svc.InputService21TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService22ProtocolTestRecursiveShapesCase1(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - } - req, _ := svc.InputService22TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService22ProtocolTestRecursiveShapesCase2(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - } - req, _ := svc.InputService22TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService22ProtocolTestRecursiveShapesCase3(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - NoRecurse: aws.String("foo"), - }, - }, - }, - }, - } - req, _ := svc.InputService22TestCaseOperation3Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foo`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService22ProtocolTestRecursiveShapesCase4(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveList: []*InputService22TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - NoRecurse: aws.String("bar"), - }, - }, - }, - } - req, _ := svc.InputService22TestCaseOperation4Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foobar`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService22ProtocolTestRecursiveShapesCase5(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveList: []*InputService22TestShapeRecursiveStructType{ - { - NoRecurse: aws.String("foo"), - }, - { - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - NoRecurse: aws.String("bar"), - }, - }, - }, - }, - } - req, _ := svc.InputService22TestCaseOperation5Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foobar`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService22ProtocolTestRecursiveShapesCase6(t *testing.T) { - svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService22TestShapeInputService22TestCaseOperation6Input{ - RecursiveStruct: &InputService22TestShapeRecursiveStructType{ - RecursiveMap: map[string]*InputService22TestShapeRecursiveStructType{ - "bar": { - NoRecurse: aws.String("bar"), - }, - "foo": { - NoRecurse: aws.String("foo"), - }, - }, - }, - } - req, _ := svc.InputService22TestCaseOperation6Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foofoobarbar`, util.Trim(string(body)), InputService22TestShapeInputService22TestCaseOperation6Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService23ProtocolTestTimestampInHeaderCase1(t *testing.T) { - svc := NewInputService23ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService23TestShapeInputService23TestCaseOperation1Input{ - TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), - } - req, _ := svc.InputService23TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 TestInputService24ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - svc := NewInputService24ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService24TestShapeInputService24TestCaseOperation2Input{ - Token: aws.String("abc123"), - } - req, _ := svc.InputService24TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `abc123`, util.Trim(string(body)), InputService24TestShapeInputService24TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService24ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - svc := NewInputService24ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService24TestShapeInputService24TestCaseOperation2Input{} - req, _ := svc.InputService24TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `00000000-0000-4000-8000-000000000000`, util.Trim(string(body)), InputService24TestShapeInputService24TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/path", r.URL.String()) - - // assert headers - -} - -func TestInputService25ProtocolTestEnumCase1(t *testing.T) { - svc := NewInputService25ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService25TestShapeInputService25TestCaseOperation2Input{ - FooEnum: aws.String("foo"), - HeaderEnum: aws.String("baz"), - ListEnums: []*string{ - aws.String("foo"), - aws.String(""), - aws.String("bar"), - }, - URIFooEnum: aws.String("bar"), - URIListEnums: []*string{ - aws.String("0"), - aws.String(""), - aws.String("1"), - }, - } - req, _ := svc.InputService25TestCaseOperation1Request(input) - r := req.HTTPRequest - - // build request - restxml.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 := util.SortXML(r.Body) - awstesting.AssertXML(t, `foofoobar`, util.Trim(string(body)), InputService25TestShapeInputService25TestCaseOperation2Input{}) - - // assert URL - awstesting.AssertURL(t, "https://test/Enum/bar?ListEnums=0&ListEnums=&ListEnums=1", r.URL.String()) - - // assert headers - if e, a := "baz", r.Header.Get("x-amz-enum"); e != a { - t.Errorf("expect %v to be %v", e, a) - } - -} - -func TestInputService25ProtocolTestEnumCase2(t *testing.T) { - svc := NewInputService25ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - input := &InputService25TestShapeInputService25TestCaseOperation2Input{} - req, _ := svc.InputService25TestCaseOperation2Request(input) - r := req.HTTPRequest - - // build request - restxml.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 - -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go deleted file mode 100644 index 7bdf4c8..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/restxml.go +++ /dev/null @@ -1,69 +0,0 @@ -// Package restxml provides RESTful XML serialization of AWS -// requests and responses. -package restxml - -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/input/rest-xml.json build_test.go -//go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/rest-xml.json unmarshal_test.go - -import ( - "bytes" - "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/query" - "github.com/aws/aws-sdk-go/private/protocol/rest" - "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" -) - -// BuildHandler is a named request handler for building restxml protocol requests -var BuildHandler = request.NamedHandler{Name: "awssdk.restxml.Build", Fn: Build} - -// UnmarshalHandler is a named request handler for unmarshaling restxml protocol requests -var UnmarshalHandler = request.NamedHandler{Name: "awssdk.restxml.Unmarshal", Fn: Unmarshal} - -// UnmarshalMetaHandler is a named request handler for unmarshaling restxml protocol request metadata -var UnmarshalMetaHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalMeta", Fn: UnmarshalMeta} - -// UnmarshalErrorHandler is a named request handler for unmarshaling restxml protocol request errors -var UnmarshalErrorHandler = request.NamedHandler{Name: "awssdk.restxml.UnmarshalError", Fn: UnmarshalError} - -// Build builds a request payload for the REST XML protocol. -func Build(r *request.Request) { - rest.Build(r) - - if t := rest.PayloadType(r.Params); t == "structure" || t == "" { - var buf bytes.Buffer - err := xmlutil.BuildXML(r.Params, xml.NewEncoder(&buf)) - if err != nil { - r.Error = awserr.New("SerializationError", "failed to encode rest XML request", err) - return - } - r.SetBufferBody(buf.Bytes()) - } -} - -// Unmarshal unmarshals a payload response for the REST XML protocol. -func Unmarshal(r *request.Request) { - if t := rest.PayloadType(r.Data); t == "structure" || t == "" { - defer r.HTTPResponse.Body.Close() - decoder := xml.NewDecoder(r.HTTPResponse.Body) - err := xmlutil.UnmarshalXML(r.Data, decoder, "") - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode REST XML response", err) - return - } - } else { - rest.Unmarshal(r) - } -} - -// UnmarshalMeta unmarshals response headers for the REST XML protocol. -func UnmarshalMeta(r *request.Request) { - rest.UnmarshalMeta(r) -} - -// UnmarshalError unmarshals a response error for the REST XML protocol. -func UnmarshalError(r *request.Request) { - query.UnmarshalError(r) -} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go deleted file mode 100644 index fb6d8b8..0000000 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/restxml/unmarshal_test.go +++ /dev/null @@ -1,3008 +0,0 @@ -package restxml_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/restxml" - "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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *OutputService1TestShapeOutputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation1, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation1Input{} - } - - output = &OutputService1TestShapeOutputService1TestCaseOperation2Output{} - 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) (*OutputService1TestShapeOutputService1TestCaseOperation2Output, 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) (*OutputService1TestShapeOutputService1TestCaseOperation2Output, error) { - req, out := c.OutputService1TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opOutputService1TestCaseOperation2 = "OperationName" - -// OutputService1TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the OutputService1TestCaseOperation2 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 OutputService1TestCaseOperation2 for more information on using the OutputService1TestCaseOperation2 -// 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 OutputService1TestCaseOperation2Request method. -// req, resp := client.OutputService1TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2Request(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (req *request.Request, output *OutputService1TestShapeOutputService1TestCaseOperation2Output) { - op := &request.Operation{ - Name: opOutputService1TestCaseOperation2, - HTTPPath: "/", - } - - if input == nil { - input = &OutputService1TestShapeOutputService1TestCaseOperation2Input{} - } - - output = &OutputService1TestShapeOutputService1TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - return -} - -// OutputService1TestCaseOperation2 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 OutputService1TestCaseOperation2 for usage and error information. -func (c *OutputService1ProtocolTest) OutputService1TestCaseOperation2(input *OutputService1TestShapeOutputService1TestCaseOperation2Input) (*OutputService1TestShapeOutputService1TestCaseOperation2Output, error) { - req, out := c.OutputService1TestCaseOperation2Request(input) - return out, req.Send() -} - -// OutputService1TestCaseOperation2WithContext is the same as OutputService1TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService1TestCaseOperation2 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) OutputService1TestCaseOperation2WithContext(ctx aws.Context, input *OutputService1TestShapeOutputService1TestCaseOperation2Input, opts ...request.Option) (*OutputService1TestShapeOutputService1TestCaseOperation2Output, error) { - req, out := c.OutputService1TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService1TestShapeOutputService1TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation2Input struct { - _ struct{} `type:"structure"` -} - -type OutputService1TestShapeOutputService1TestCaseOperation2Output 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 `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 *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetChar(v string) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Char = &v - return s -} - -// SetDouble sets the Double field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetDouble(v float64) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Double = &v - return s -} - -// SetFalseBool sets the FalseBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetFalseBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.FalseBool = &v - return s -} - -// SetFloat sets the Float field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetFloat(v float64) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Float = &v - return s -} - -// SetImaHeader sets the ImaHeader field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetImaHeader(v string) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.ImaHeader = &v - return s -} - -// SetImaHeaderLocation sets the ImaHeaderLocation field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetImaHeaderLocation(v string) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.ImaHeaderLocation = &v - return s -} - -// SetLong sets the Long field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetLong(v int64) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Long = &v - return s -} - -// SetNum sets the Num field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetNum(v int64) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Num = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetStr(v string) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Str = &v - return s -} - -// SetTimestamp sets the Timestamp field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetTimestamp(v time.Time) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - s.Timestamp = &v - return s -} - -// SetTrueBool sets the TrueBool field's value. -func (s *OutputService1TestShapeOutputService1TestCaseOperation2Output) SetTrueBool(v bool) *OutputService1TestShapeOutputService1TestCaseOperation2Output { - 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - // Blob is automatically base64 encoded/decoded by the SDK. - Blob []byte `type:"blob"` -} - -// SetBlob sets the Blob field's value. -func (s *OutputService2TestShapeOutputService2TestCaseOperation1Output) SetBlob(v []byte) *OutputService2TestShapeOutputService2TestCaseOperation1Output { - s.Blob = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - ListMember []*string `type:"list"` -} - -// SetListMember sets the ListMember field's value. -func (s *OutputService3TestShapeOutputService3TestCaseOperation1Output) SetListMember(v []*string) *OutputService3TestShapeOutputService3TestCaseOperation1Output { - s.ListMember = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 `locationNameList:"item" 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 `type:"list" flattened:"true"` -} - -// 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - Map map[string]*OutputService6TestShapeSingleStructure `type:"map"` -} - -// SetMap sets the Map field's value. -func (s *OutputService6TestShapeOutputService6TestCaseOperation1Output) SetMap(v map[string]*OutputService6TestShapeSingleStructure) *OutputService6TestShapeOutputService6TestCaseOperation1Output { - s.Map = v - return s -} - -type OutputService6TestShapeSingleStructure struct { - _ struct{} `type:"structure"` - - Foo *string `locationName:"foo" type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService6TestShapeSingleStructure) SetFoo(v string) *OutputService6TestShapeSingleStructure { - s.Foo = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - Map map[string]*string `type:"map" flattened:"true"` -} - -// SetMap sets the Map field's value. -func (s *OutputService7TestShapeOutputService7TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService7TestShapeOutputService7TestCaseOperation1Output { - s.Map = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - Map map[string]*string `locationNameKey:"foo" locationNameValue:"bar" type:"map"` -} - -// SetMap sets the Map field's value. -func (s *OutputService8TestShapeOutputService8TestCaseOperation1Output) SetMap(v map[string]*string) *OutputService8TestShapeOutputService8TestCaseOperation1Output { - s.Map = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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" payload:"Data"` - - Data *OutputService9TestShapeSingleStructure `type:"structure"` - - Header *string `location:"header" locationName:"X-Foo" type:"string"` -} - -// SetData sets the Data field's value. -func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetData(v *OutputService9TestShapeSingleStructure) *OutputService9TestShapeOutputService9TestCaseOperation1Output { - s.Data = v - return s -} - -// SetHeader sets the Header field's value. -func (s *OutputService9TestShapeOutputService9TestCaseOperation1Output) SetHeader(v string) *OutputService9TestShapeOutputService9TestCaseOperation1Output { - s.Header = &v - return s -} - -type OutputService9TestShapeSingleStructure struct { - _ struct{} `type:"structure"` - - Foo *string `type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService9TestShapeSingleStructure) SetFoo(v string) *OutputService9TestShapeSingleStructure { - 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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" payload:"Stream"` - - Stream []byte `type:"blob"` -} - -// SetStream sets the Stream field's value. -func (s *OutputService10TestShapeOutputService10TestCaseOperation1Output) SetStream(v []byte) *OutputService10TestShapeOutputService10TestCaseOperation1Output { - s.Stream = 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - Char *string `location:"header" locationName:"x-char" type:"character"` - - Double *float64 `location:"header" locationName:"x-double" type:"double"` - - FalseBool *bool `location:"header" locationName:"x-false-bool" type:"boolean"` - - Float *float64 `location:"header" locationName:"x-float" type:"float"` - - Integer *int64 `location:"header" locationName:"x-int" type:"integer"` - - Long *int64 `location:"header" locationName:"x-long" type:"long"` - - Str *string `location:"header" locationName:"x-str" type:"string"` - - Timestamp *time.Time `location:"header" locationName:"x-timestamp" type:"timestamp" timestampFormat:"iso8601"` - - TrueBool *bool `location:"header" locationName:"x-true-bool" type:"boolean"` -} - -// SetChar sets the Char field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetChar(v string) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Char = &v - return s -} - -// SetDouble sets the Double field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetDouble(v float64) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Double = &v - return s -} - -// SetFalseBool sets the FalseBool field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetFalseBool(v bool) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.FalseBool = &v - return s -} - -// SetFloat sets the Float field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetFloat(v float64) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Float = &v - return s -} - -// SetInteger sets the Integer field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetInteger(v int64) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Integer = &v - return s -} - -// SetLong sets the Long field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetLong(v int64) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Long = &v - return s -} - -// SetStr sets the Str field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetStr(v string) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Str = &v - return s -} - -// SetTimestamp sets the Timestamp field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetTimestamp(v time.Time) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.Timestamp = &v - return s -} - -// SetTrueBool sets the TrueBool field's value. -func (s *OutputService11TestShapeOutputService11TestCaseOperation1Output) SetTrueBool(v bool) *OutputService11TestShapeOutputService11TestCaseOperation1Output { - s.TrueBool = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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"` - - Foo *string `type:"string"` -} - -// SetFoo sets the Foo field's value. -func (s *OutputService12TestShapeOutputService12TestCaseOperation1Output) SetFoo(v string) *OutputService12TestShapeOutputService12TestCaseOperation1Output { - s.Foo = &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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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 *OutputService13TestShapeOutputService13TestCaseOperation2Input) { - op := &request.Operation{ - Name: opOutputService13TestCaseOperation1, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &OutputService13TestShapeOutputService13TestCaseOperation1Input{} - } - - output = &OutputService13TestShapeOutputService13TestCaseOperation2Input{} - 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) (*OutputService13TestShapeOutputService13TestCaseOperation2Input, 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) (*OutputService13TestShapeOutputService13TestCaseOperation2Input, error) { - req, out := c.OutputService13TestCaseOperation1Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opOutputService13TestCaseOperation2 = "OperationName" - -// OutputService13TestCaseOperation2Request generates a "aws/request.Request" representing the -// client's request for the OutputService13TestCaseOperation2 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 OutputService13TestCaseOperation2 for more information on using the OutputService13TestCaseOperation2 -// 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 OutputService13TestCaseOperation2Request method. -// req, resp := client.OutputService13TestCaseOperation2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation2Request(input *OutputService13TestShapeOutputService13TestCaseOperation2Input) (req *request.Request, output *OutputService13TestShapeOutputService13TestCaseOperation2Output) { - op := &request.Operation{ - Name: opOutputService13TestCaseOperation2, - HTTPMethod: "POST", - HTTPPath: "/path", - } - - if input == nil { - input = &OutputService13TestShapeOutputService13TestCaseOperation2Input{} - } - - output = &OutputService13TestShapeOutputService13TestCaseOperation2Output{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// OutputService13TestCaseOperation2 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 OutputService13TestCaseOperation2 for usage and error information. -func (c *OutputService13ProtocolTest) OutputService13TestCaseOperation2(input *OutputService13TestShapeOutputService13TestCaseOperation2Input) (*OutputService13TestShapeOutputService13TestCaseOperation2Output, error) { - req, out := c.OutputService13TestCaseOperation2Request(input) - return out, req.Send() -} - -// OutputService13TestCaseOperation2WithContext is the same as OutputService13TestCaseOperation2 with the addition of -// the ability to pass a context and additional request options. -// -// See OutputService13TestCaseOperation2 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) OutputService13TestCaseOperation2WithContext(ctx aws.Context, input *OutputService13TestShapeOutputService13TestCaseOperation2Input, opts ...request.Option) (*OutputService13TestShapeOutputService13TestCaseOperation2Output, error) { - req, out := c.OutputService13TestCaseOperation2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -type OutputService13TestShapeOutputService13TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService13TestShapeOutputService13TestCaseOperation2Input struct { - _ struct{} `type:"structure"` - - FooEnum *string `type:"string" enum:"OutputService13TestShapeRESTJSONEnumType"` - - HeaderEnum *string `location:"header" locationName:"x-amz-enum" type:"string" enum:"OutputService13TestShapeRESTJSONEnumType"` - - ListEnums []*string `type:"list"` -} - -// SetFooEnum sets the FooEnum field's value. -func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetFooEnum(v string) *OutputService13TestShapeOutputService13TestCaseOperation2Input { - s.FooEnum = &v - return s -} - -// SetHeaderEnum sets the HeaderEnum field's value. -func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetHeaderEnum(v string) *OutputService13TestShapeOutputService13TestCaseOperation2Input { - s.HeaderEnum = &v - return s -} - -// SetListEnums sets the ListEnums field's value. -func (s *OutputService13TestShapeOutputService13TestCaseOperation2Input) SetListEnums(v []*string) *OutputService13TestShapeOutputService13TestCaseOperation2Input { - s.ListEnums = v - return s -} - -type OutputService13TestShapeOutputService13TestCaseOperation2Output struct { - _ struct{} `type:"structure"` -} - -const ( - // RESTJSONEnumTypeFoo is a OutputService13TestShapeRESTJSONEnumType enum value - RESTJSONEnumTypeFoo = "foo" - - // RESTJSONEnumTypeBar is a OutputService13TestShapeRESTJSONEnumType enum value - RESTJSONEnumTypeBar = "bar" - - // RESTJSONEnumType0 is a OutputService13TestShapeRESTJSONEnumType enum value - RESTJSONEnumType0 = "0" - - // RESTJSONEnumType1 is a OutputService13TestShapeRESTJSONEnumType enum value - RESTJSONEnumType1 = "1" -) - -// 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(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.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, - HTTPMethod: "GET", - HTTPPath: "/path", - } - - 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 OutputService14TestShapeItemDetailShape struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - ID *string `type:"string"` - - // Type is a required field - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"OutputService14TestShapeItemType"` -} - -// SetID sets the ID field's value. -func (s *OutputService14TestShapeItemDetailShape) SetID(v string) *OutputService14TestShapeItemDetailShape { - s.ID = &v - return s -} - -// SetType sets the Type field's value. -func (s *OutputService14TestShapeItemDetailShape) SetType(v string) *OutputService14TestShapeItemDetailShape { - s.Type = &v - return s -} - -type OutputService14TestShapeItemShape struct { - _ struct{} `type:"structure"` - - ItemDetail *OutputService14TestShapeItemDetailShape `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` -} - -// SetItemDetail sets the ItemDetail field's value. -func (s *OutputService14TestShapeItemShape) SetItemDetail(v *OutputService14TestShapeItemDetailShape) *OutputService14TestShapeItemShape { - s.ItemDetail = v - return s -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Input struct { - _ struct{} `type:"structure"` -} - -type OutputService14TestShapeOutputService14TestCaseOperation1Output struct { - _ struct{} `type:"structure"` - - ListItems []*OutputService14TestShapeItemShape `locationName:"ItemsList" locationNameList:"Item" type:"list"` -} - -// SetListItems sets the ListItems field's value. -func (s *OutputService14TestShapeOutputService14TestCaseOperation1Output) SetListItems(v []*OutputService14TestShapeItemShape) *OutputService14TestShapeOutputService14TestCaseOperation1Output { - s.ListItems = v - return s -} - -const ( - // ItemTypeType1 is a OutputService14TestShapeItemType enum value - ItemTypeType1 = "Type1" - - // ItemTypeType2 is a OutputService14TestShapeItemType enum value - ItemTypeType2 = "Type2" - - // ItemTypeType3 is a OutputService14TestShapeItemType enum value - ItemTypeType3 = "Type3" -) - -// -// 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:00Z")) - 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 - restxml.UnmarshalMeta(req) - restxml.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 := "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 TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) { - svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("123falsetrue1.21.3200a2015-01-25T08:00:00Z")) - req, out := svc.OutputService1TestCaseOperation2Request(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 - restxml.UnmarshalMeta(req) - restxml.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 := "", *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 TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("dmFsdWU=")) - req, out := svc.OutputService2TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService3ProtocolTestListsCase1(t *testing.T) { - svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService3TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService4TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc123")) - req, out := svc.OutputService5TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService6TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService7TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("quxbarbazbam")) - req, out := svc.OutputService8TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) { - svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService9TestCaseOperation1Request(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 - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { - svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("abc")) - req, out := svc.OutputService10TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) { - svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("")) - req, out := svc.OutputService11TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("x-char", "a") - req.HTTPResponse.Header.Set("x-double", "1.5") - req.HTTPResponse.Header.Set("x-false-bool", "false") - req.HTTPResponse.Header.Set("x-float", "1.5") - req.HTTPResponse.Header.Set("x-int", "1") - req.HTTPResponse.Header.Set("x-long", "100") - req.HTTPResponse.Header.Set("x-str", "string") - req.HTTPResponse.Header.Set("x-timestamp", "Sun, 25 Jan 2015 08:00:00 GMT") - req.HTTPResponse.Header.Set("x-true-bool", "true") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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.5, *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.5, *out.Float; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(1), *out.Integer; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := int64(100), *out.Long; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "string", *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 TestOutputService12ProtocolTestEmptyStringCase1(t *testing.T) { - svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("requestid")) - req, out := svc.OutputService12TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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) - } - -} - -func TestOutputService13ProtocolTestEnumCase1(t *testing.T) { - svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("foo01")) - req, out := svc.OutputService13TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - req.HTTPResponse.Header.Set("x-amz-enum", "baz") - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 := "foo", *out.FooEnum; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "baz", *out.HeaderEnum; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "0", *out.ListEnums[0]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "1", *out.ListEnums[1]; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} - -func TestOutputService13ProtocolTestEnumCase2(t *testing.T) { - svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("")) - req, out := svc.OutputService13TestCaseOperation2Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 TestOutputService14ProtocolTestXMLAttributesCase1(t *testing.T) { - svc := NewOutputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) - - buf := bytes.NewReader([]byte("id1id2id3")) - req, out := svc.OutputService14TestCaseOperation1Request(nil) - req.HTTPResponse = &http.Response{StatusCode: 200, Body: ioutil.NopCloser(buf), Header: http.Header{}} - - // set headers - - // unmarshal response - restxml.UnmarshalMeta(req) - restxml.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 := "id1", *out.ListItems[0].ItemDetail.ID; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "Type1", *out.ListItems[0].ItemDetail.Type; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "id2", *out.ListItems[1].ItemDetail.ID; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "Type2", *out.ListItems[1].ItemDetail.Type; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "id3", *out.ListItems[2].ItemDetail.ID; e != a { - t.Errorf("expect %v, got %v", e, a) - } - if e, a := "Type3", *out.ListItems[2].ItemDetail.Type; e != a { - t.Errorf("expect %v, got %v", e, a) - } - -} 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 da1a681..0000000 --- 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 2733e99..0000000 --- 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 7091b45..0000000 --- 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 8758462..0000000 --- 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 1185d23..0000000 --- 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 3e970b6..0000000 --- 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/service/generate.go b/vendor/github.com/aws/aws-sdk-go/service/generate.go deleted file mode 100644 index 3ffc9fc..0000000 --- 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/s3/api.go b/vendor/github.com/aws/aws-sdk-go/service/s3/api.go deleted file mode 100644 index 0d852f5..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/api.go +++ /dev/null @@ -1,21374 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -import ( - "fmt" - "io" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol" - "github.com/aws/aws-sdk-go/private/protocol/restxml" -) - -const opAbortMultipartUpload = "AbortMultipartUpload" - -// AbortMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the AbortMultipartUpload 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 AbortMultipartUpload for more information on using the AbortMultipartUpload -// 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 AbortMultipartUploadRequest method. -// req, resp := client.AbortMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload -func (c *S3) AbortMultipartUploadRequest(input *AbortMultipartUploadInput) (req *request.Request, output *AbortMultipartUploadOutput) { - op := &request.Operation{ - Name: opAbortMultipartUpload, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &AbortMultipartUploadInput{} - } - - output = &AbortMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// AbortMultipartUpload API operation for Amazon Simple Storage Service. -// -// Aborts a multipart upload. -// -// To verify that all parts have been removed, so you don't get charged for -// the part storage, you should call the List Parts operation and ensure the -// parts list is empty. -// -// 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 Simple Storage Service's -// API operation AbortMultipartUpload for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchUpload "NoSuchUpload" -// The specified multipart upload does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUpload -func (c *S3) AbortMultipartUpload(input *AbortMultipartUploadInput) (*AbortMultipartUploadOutput, error) { - req, out := c.AbortMultipartUploadRequest(input) - return out, req.Send() -} - -// AbortMultipartUploadWithContext is the same as AbortMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See AbortMultipartUpload 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 *S3) AbortMultipartUploadWithContext(ctx aws.Context, input *AbortMultipartUploadInput, opts ...request.Option) (*AbortMultipartUploadOutput, error) { - req, out := c.AbortMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCompleteMultipartUpload = "CompleteMultipartUpload" - -// CompleteMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the CompleteMultipartUpload 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 CompleteMultipartUpload for more information on using the CompleteMultipartUpload -// 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 CompleteMultipartUploadRequest method. -// req, resp := client.CompleteMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload -func (c *S3) CompleteMultipartUploadRequest(input *CompleteMultipartUploadInput) (req *request.Request, output *CompleteMultipartUploadOutput) { - op := &request.Operation{ - Name: opCompleteMultipartUpload, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &CompleteMultipartUploadInput{} - } - - output = &CompleteMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// CompleteMultipartUpload API operation for Amazon Simple Storage Service. -// -// Completes a multipart upload by assembling previously uploaded parts. -// -// 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 Simple Storage Service's -// API operation CompleteMultipartUpload for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUpload -func (c *S3) CompleteMultipartUpload(input *CompleteMultipartUploadInput) (*CompleteMultipartUploadOutput, error) { - req, out := c.CompleteMultipartUploadRequest(input) - return out, req.Send() -} - -// CompleteMultipartUploadWithContext is the same as CompleteMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See CompleteMultipartUpload 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 *S3) CompleteMultipartUploadWithContext(ctx aws.Context, input *CompleteMultipartUploadInput, opts ...request.Option) (*CompleteMultipartUploadOutput, error) { - req, out := c.CompleteMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCopyObject = "CopyObject" - -// CopyObjectRequest generates a "aws/request.Request" representing the -// client's request for the CopyObject 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 CopyObject for more information on using the CopyObject -// 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 CopyObjectRequest method. -// req, resp := client.CopyObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject -func (c *S3) CopyObjectRequest(input *CopyObjectInput) (req *request.Request, output *CopyObjectOutput) { - op := &request.Operation{ - Name: opCopyObject, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &CopyObjectInput{} - } - - output = &CopyObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// CopyObject API operation for Amazon Simple Storage Service. -// -// Creates a copy of an object that is already stored 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 Amazon Simple Storage Service's -// API operation CopyObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeObjectNotInActiveTierError "ObjectNotInActiveTierError" -// The source object of the COPY operation is not in the active tier and is -// only stored in Amazon Glacier. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObject -func (c *S3) CopyObject(input *CopyObjectInput) (*CopyObjectOutput, error) { - req, out := c.CopyObjectRequest(input) - return out, req.Send() -} - -// CopyObjectWithContext is the same as CopyObject with the addition of -// the ability to pass a context and additional request options. -// -// See CopyObject 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 *S3) CopyObjectWithContext(ctx aws.Context, input *CopyObjectInput, opts ...request.Option) (*CopyObjectOutput, error) { - req, out := c.CopyObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateBucket = "CreateBucket" - -// CreateBucketRequest generates a "aws/request.Request" representing the -// client's request for the CreateBucket 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 CreateBucket for more information on using the CreateBucket -// 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 CreateBucketRequest method. -// req, resp := client.CreateBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket -func (c *S3) CreateBucketRequest(input *CreateBucketInput) (req *request.Request, output *CreateBucketOutput) { - op := &request.Operation{ - Name: opCreateBucket, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &CreateBucketInput{} - } - - output = &CreateBucketOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateBucket API operation for Amazon Simple Storage Service. -// -// Creates a new bucket. -// -// 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 Simple Storage Service's -// API operation CreateBucket for usage and error information. -// -// Returned Error Codes: -// * ErrCodeBucketAlreadyExists "BucketAlreadyExists" -// The requested bucket name is not available. The bucket namespace is shared -// by all users of the system. Please select a different name and try again. -// -// * ErrCodeBucketAlreadyOwnedByYou "BucketAlreadyOwnedByYou" -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucket -func (c *S3) CreateBucket(input *CreateBucketInput) (*CreateBucketOutput, error) { - req, out := c.CreateBucketRequest(input) - return out, req.Send() -} - -// CreateBucketWithContext is the same as CreateBucket with the addition of -// the ability to pass a context and additional request options. -// -// See CreateBucket 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 *S3) CreateBucketWithContext(ctx aws.Context, input *CreateBucketInput, opts ...request.Option) (*CreateBucketOutput, error) { - req, out := c.CreateBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opCreateMultipartUpload = "CreateMultipartUpload" - -// CreateMultipartUploadRequest generates a "aws/request.Request" representing the -// client's request for the CreateMultipartUpload 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 CreateMultipartUpload for more information on using the CreateMultipartUpload -// 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 CreateMultipartUploadRequest method. -// req, resp := client.CreateMultipartUploadRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload -func (c *S3) CreateMultipartUploadRequest(input *CreateMultipartUploadInput) (req *request.Request, output *CreateMultipartUploadOutput) { - op := &request.Operation{ - Name: opCreateMultipartUpload, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?uploads", - } - - if input == nil { - input = &CreateMultipartUploadInput{} - } - - output = &CreateMultipartUploadOutput{} - req = c.newRequest(op, input, output) - return -} - -// CreateMultipartUpload API operation for Amazon Simple Storage Service. -// -// Initiates a multipart upload and returns an upload ID. -// -// Note: After you initiate multipart upload and upload one or more parts, you -// must either complete or abort multipart upload in order to stop getting charged -// for storage of the uploaded parts. Only after you either complete or abort -// multipart upload, Amazon S3 frees up the parts storage and stops charging -// you for the parts storage. -// -// 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 Simple Storage Service's -// API operation CreateMultipartUpload for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUpload -func (c *S3) CreateMultipartUpload(input *CreateMultipartUploadInput) (*CreateMultipartUploadOutput, error) { - req, out := c.CreateMultipartUploadRequest(input) - return out, req.Send() -} - -// CreateMultipartUploadWithContext is the same as CreateMultipartUpload with the addition of -// the ability to pass a context and additional request options. -// -// See CreateMultipartUpload 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 *S3) CreateMultipartUploadWithContext(ctx aws.Context, input *CreateMultipartUploadInput, opts ...request.Option) (*CreateMultipartUploadOutput, error) { - req, out := c.CreateMultipartUploadRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucket = "DeleteBucket" - -// DeleteBucketRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucket 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 DeleteBucket for more information on using the DeleteBucket -// 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 DeleteBucketRequest method. -// req, resp := client.DeleteBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket -func (c *S3) DeleteBucketRequest(input *DeleteBucketInput) (req *request.Request, output *DeleteBucketOutput) { - op := &request.Operation{ - Name: opDeleteBucket, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &DeleteBucketInput{} - } - - output = &DeleteBucketOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucket API operation for Amazon Simple Storage Service. -// -// Deletes the bucket. All objects (including all object versions and Delete -// Markers) in the bucket must be deleted before the bucket itself can be deleted. -// -// 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 Simple Storage Service's -// API operation DeleteBucket for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucket -func (c *S3) DeleteBucket(input *DeleteBucketInput) (*DeleteBucketOutput, error) { - req, out := c.DeleteBucketRequest(input) - return out, req.Send() -} - -// DeleteBucketWithContext is the same as DeleteBucket with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucket 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 *S3) DeleteBucketWithContext(ctx aws.Context, input *DeleteBucketInput, opts ...request.Option) (*DeleteBucketOutput, error) { - req, out := c.DeleteBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketAnalyticsConfiguration = "DeleteBucketAnalyticsConfiguration" - -// DeleteBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketAnalyticsConfiguration 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 DeleteBucketAnalyticsConfiguration for more information on using the DeleteBucketAnalyticsConfiguration -// 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 DeleteBucketAnalyticsConfigurationRequest method. -// req, resp := client.DeleteBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration -func (c *S3) DeleteBucketAnalyticsConfigurationRequest(input *DeleteBucketAnalyticsConfigurationInput) (req *request.Request, output *DeleteBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketAnalyticsConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &DeleteBucketAnalyticsConfigurationInput{} - } - - output = &DeleteBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes an analytics configuration for the bucket (specified by the analytics -// configuration ID). -// -// 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 Simple Storage Service's -// API operation DeleteBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfiguration -func (c *S3) DeleteBucketAnalyticsConfiguration(input *DeleteBucketAnalyticsConfigurationInput) (*DeleteBucketAnalyticsConfigurationOutput, error) { - req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketAnalyticsConfigurationWithContext is the same as DeleteBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketAnalyticsConfiguration 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 *S3) DeleteBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *DeleteBucketAnalyticsConfigurationInput, opts ...request.Option) (*DeleteBucketAnalyticsConfigurationOutput, error) { - req, out := c.DeleteBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketCors = "DeleteBucketCors" - -// DeleteBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketCors 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 DeleteBucketCors for more information on using the DeleteBucketCors -// 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 DeleteBucketCorsRequest method. -// req, resp := client.DeleteBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors -func (c *S3) DeleteBucketCorsRequest(input *DeleteBucketCorsInput) (req *request.Request, output *DeleteBucketCorsOutput) { - op := &request.Operation{ - Name: opDeleteBucketCors, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &DeleteBucketCorsInput{} - } - - output = &DeleteBucketCorsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketCors API operation for Amazon Simple Storage Service. -// -// Deletes the cors configuration information set for the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCors -func (c *S3) DeleteBucketCors(input *DeleteBucketCorsInput) (*DeleteBucketCorsOutput, error) { - req, out := c.DeleteBucketCorsRequest(input) - return out, req.Send() -} - -// DeleteBucketCorsWithContext is the same as DeleteBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketCors 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 *S3) DeleteBucketCorsWithContext(ctx aws.Context, input *DeleteBucketCorsInput, opts ...request.Option) (*DeleteBucketCorsOutput, error) { - req, out := c.DeleteBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketEncryption = "DeleteBucketEncryption" - -// DeleteBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketEncryption 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 DeleteBucketEncryption for more information on using the DeleteBucketEncryption -// 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 DeleteBucketEncryptionRequest method. -// req, resp := client.DeleteBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryption -func (c *S3) DeleteBucketEncryptionRequest(input *DeleteBucketEncryptionInput) (req *request.Request, output *DeleteBucketEncryptionOutput) { - op := &request.Operation{ - Name: opDeleteBucketEncryption, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &DeleteBucketEncryptionInput{} - } - - output = &DeleteBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketEncryption API operation for Amazon Simple Storage Service. -// -// Deletes the server-side encryption configuration from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryption -func (c *S3) DeleteBucketEncryption(input *DeleteBucketEncryptionInput) (*DeleteBucketEncryptionOutput, error) { - req, out := c.DeleteBucketEncryptionRequest(input) - return out, req.Send() -} - -// DeleteBucketEncryptionWithContext is the same as DeleteBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketEncryption 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 *S3) DeleteBucketEncryptionWithContext(ctx aws.Context, input *DeleteBucketEncryptionInput, opts ...request.Option) (*DeleteBucketEncryptionOutput, error) { - req, out := c.DeleteBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketInventoryConfiguration = "DeleteBucketInventoryConfiguration" - -// DeleteBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketInventoryConfiguration 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 DeleteBucketInventoryConfiguration for more information on using the DeleteBucketInventoryConfiguration -// 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 DeleteBucketInventoryConfigurationRequest method. -// req, resp := client.DeleteBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration -func (c *S3) DeleteBucketInventoryConfigurationRequest(input *DeleteBucketInventoryConfigurationInput) (req *request.Request, output *DeleteBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketInventoryConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &DeleteBucketInventoryConfigurationInput{} - } - - output = &DeleteBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes an inventory configuration (identified by the inventory ID) from -// the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfiguration -func (c *S3) DeleteBucketInventoryConfiguration(input *DeleteBucketInventoryConfigurationInput) (*DeleteBucketInventoryConfigurationOutput, error) { - req, out := c.DeleteBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketInventoryConfigurationWithContext is the same as DeleteBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketInventoryConfiguration 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 *S3) DeleteBucketInventoryConfigurationWithContext(ctx aws.Context, input *DeleteBucketInventoryConfigurationInput, opts ...request.Option) (*DeleteBucketInventoryConfigurationOutput, error) { - req, out := c.DeleteBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketLifecycle = "DeleteBucketLifecycle" - -// DeleteBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketLifecycle 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 DeleteBucketLifecycle for more information on using the DeleteBucketLifecycle -// 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 DeleteBucketLifecycleRequest method. -// req, resp := client.DeleteBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle -func (c *S3) DeleteBucketLifecycleRequest(input *DeleteBucketLifecycleInput) (req *request.Request, output *DeleteBucketLifecycleOutput) { - op := &request.Operation{ - Name: opDeleteBucketLifecycle, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &DeleteBucketLifecycleInput{} - } - - output = &DeleteBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketLifecycle API operation for Amazon Simple Storage Service. -// -// Deletes the lifecycle configuration from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycle -func (c *S3) DeleteBucketLifecycle(input *DeleteBucketLifecycleInput) (*DeleteBucketLifecycleOutput, error) { - req, out := c.DeleteBucketLifecycleRequest(input) - return out, req.Send() -} - -// DeleteBucketLifecycleWithContext is the same as DeleteBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketLifecycle 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 *S3) DeleteBucketLifecycleWithContext(ctx aws.Context, input *DeleteBucketLifecycleInput, opts ...request.Option) (*DeleteBucketLifecycleOutput, error) { - req, out := c.DeleteBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketMetricsConfiguration = "DeleteBucketMetricsConfiguration" - -// DeleteBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketMetricsConfiguration 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 DeleteBucketMetricsConfiguration for more information on using the DeleteBucketMetricsConfiguration -// 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 DeleteBucketMetricsConfigurationRequest method. -// req, resp := client.DeleteBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration -func (c *S3) DeleteBucketMetricsConfigurationRequest(input *DeleteBucketMetricsConfigurationInput) (req *request.Request, output *DeleteBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opDeleteBucketMetricsConfiguration, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &DeleteBucketMetricsConfigurationInput{} - } - - output = &DeleteBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Deletes a metrics configuration (specified by the metrics configuration ID) -// from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfiguration -func (c *S3) DeleteBucketMetricsConfiguration(input *DeleteBucketMetricsConfigurationInput) (*DeleteBucketMetricsConfigurationOutput, error) { - req, out := c.DeleteBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// DeleteBucketMetricsConfigurationWithContext is the same as DeleteBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketMetricsConfiguration 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 *S3) DeleteBucketMetricsConfigurationWithContext(ctx aws.Context, input *DeleteBucketMetricsConfigurationInput, opts ...request.Option) (*DeleteBucketMetricsConfigurationOutput, error) { - req, out := c.DeleteBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketPolicy = "DeleteBucketPolicy" - -// DeleteBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketPolicy 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 DeleteBucketPolicy for more information on using the DeleteBucketPolicy -// 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 DeleteBucketPolicyRequest method. -// req, resp := client.DeleteBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy -func (c *S3) DeleteBucketPolicyRequest(input *DeleteBucketPolicyInput) (req *request.Request, output *DeleteBucketPolicyOutput) { - op := &request.Operation{ - Name: opDeleteBucketPolicy, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &DeleteBucketPolicyInput{} - } - - output = &DeleteBucketPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketPolicy API operation for Amazon Simple Storage Service. -// -// Deletes the policy from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicy -func (c *S3) DeleteBucketPolicy(input *DeleteBucketPolicyInput) (*DeleteBucketPolicyOutput, error) { - req, out := c.DeleteBucketPolicyRequest(input) - return out, req.Send() -} - -// DeleteBucketPolicyWithContext is the same as DeleteBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketPolicy 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 *S3) DeleteBucketPolicyWithContext(ctx aws.Context, input *DeleteBucketPolicyInput, opts ...request.Option) (*DeleteBucketPolicyOutput, error) { - req, out := c.DeleteBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketReplication = "DeleteBucketReplication" - -// DeleteBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketReplication 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 DeleteBucketReplication for more information on using the DeleteBucketReplication -// 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 DeleteBucketReplicationRequest method. -// req, resp := client.DeleteBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication -func (c *S3) DeleteBucketReplicationRequest(input *DeleteBucketReplicationInput) (req *request.Request, output *DeleteBucketReplicationOutput) { - op := &request.Operation{ - Name: opDeleteBucketReplication, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &DeleteBucketReplicationInput{} - } - - output = &DeleteBucketReplicationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketReplication API operation for Amazon Simple Storage Service. -// -// Deletes the replication configuration from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplication -func (c *S3) DeleteBucketReplication(input *DeleteBucketReplicationInput) (*DeleteBucketReplicationOutput, error) { - req, out := c.DeleteBucketReplicationRequest(input) - return out, req.Send() -} - -// DeleteBucketReplicationWithContext is the same as DeleteBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketReplication 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 *S3) DeleteBucketReplicationWithContext(ctx aws.Context, input *DeleteBucketReplicationInput, opts ...request.Option) (*DeleteBucketReplicationOutput, error) { - req, out := c.DeleteBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketTagging = "DeleteBucketTagging" - -// DeleteBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketTagging 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 DeleteBucketTagging for more information on using the DeleteBucketTagging -// 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 DeleteBucketTaggingRequest method. -// req, resp := client.DeleteBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging -func (c *S3) DeleteBucketTaggingRequest(input *DeleteBucketTaggingInput) (req *request.Request, output *DeleteBucketTaggingOutput) { - op := &request.Operation{ - Name: opDeleteBucketTagging, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &DeleteBucketTaggingInput{} - } - - output = &DeleteBucketTaggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketTagging API operation for Amazon Simple Storage Service. -// -// Deletes the tags from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTagging -func (c *S3) DeleteBucketTagging(input *DeleteBucketTaggingInput) (*DeleteBucketTaggingOutput, error) { - req, out := c.DeleteBucketTaggingRequest(input) - return out, req.Send() -} - -// DeleteBucketTaggingWithContext is the same as DeleteBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketTagging 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 *S3) DeleteBucketTaggingWithContext(ctx aws.Context, input *DeleteBucketTaggingInput, opts ...request.Option) (*DeleteBucketTaggingOutput, error) { - req, out := c.DeleteBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteBucketWebsite = "DeleteBucketWebsite" - -// DeleteBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the DeleteBucketWebsite 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 DeleteBucketWebsite for more information on using the DeleteBucketWebsite -// 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 DeleteBucketWebsiteRequest method. -// req, resp := client.DeleteBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite -func (c *S3) DeleteBucketWebsiteRequest(input *DeleteBucketWebsiteInput) (req *request.Request, output *DeleteBucketWebsiteOutput) { - op := &request.Operation{ - Name: opDeleteBucketWebsite, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &DeleteBucketWebsiteInput{} - } - - output = &DeleteBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// DeleteBucketWebsite API operation for Amazon Simple Storage Service. -// -// This operation removes the website configuration from the bucket. -// -// 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 Simple Storage Service's -// API operation DeleteBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsite -func (c *S3) DeleteBucketWebsite(input *DeleteBucketWebsiteInput) (*DeleteBucketWebsiteOutput, error) { - req, out := c.DeleteBucketWebsiteRequest(input) - return out, req.Send() -} - -// DeleteBucketWebsiteWithContext is the same as DeleteBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteBucketWebsite 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 *S3) DeleteBucketWebsiteWithContext(ctx aws.Context, input *DeleteBucketWebsiteInput, opts ...request.Option) (*DeleteBucketWebsiteOutput, error) { - req, out := c.DeleteBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObject = "DeleteObject" - -// DeleteObjectRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObject 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 DeleteObject for more information on using the DeleteObject -// 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 DeleteObjectRequest method. -// req, resp := client.DeleteObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject -func (c *S3) DeleteObjectRequest(input *DeleteObjectInput) (req *request.Request, output *DeleteObjectOutput) { - op := &request.Operation{ - Name: opDeleteObject, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &DeleteObjectInput{} - } - - output = &DeleteObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeleteObject API operation for Amazon Simple Storage Service. -// -// Removes the null version (if there is one) of an object and inserts a delete -// marker, which becomes the latest version of the object. If there isn't a -// null version, Amazon S3 does not remove any objects. -// -// 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 Simple Storage Service's -// API operation DeleteObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObject -func (c *S3) DeleteObject(input *DeleteObjectInput) (*DeleteObjectOutput, error) { - req, out := c.DeleteObjectRequest(input) - return out, req.Send() -} - -// DeleteObjectWithContext is the same as DeleteObject with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObject 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 *S3) DeleteObjectWithContext(ctx aws.Context, input *DeleteObjectInput, opts ...request.Option) (*DeleteObjectOutput, error) { - req, out := c.DeleteObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObjectTagging = "DeleteObjectTagging" - -// DeleteObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObjectTagging 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 DeleteObjectTagging for more information on using the DeleteObjectTagging -// 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 DeleteObjectTaggingRequest method. -// req, resp := client.DeleteObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging -func (c *S3) DeleteObjectTaggingRequest(input *DeleteObjectTaggingInput) (req *request.Request, output *DeleteObjectTaggingOutput) { - op := &request.Operation{ - Name: opDeleteObjectTagging, - HTTPMethod: "DELETE", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &DeleteObjectTaggingInput{} - } - - output = &DeleteObjectTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeleteObjectTagging API operation for Amazon Simple Storage Service. -// -// Removes the tag-set from an existing object. -// -// 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 Simple Storage Service's -// API operation DeleteObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTagging -func (c *S3) DeleteObjectTagging(input *DeleteObjectTaggingInput) (*DeleteObjectTaggingOutput, error) { - req, out := c.DeleteObjectTaggingRequest(input) - return out, req.Send() -} - -// DeleteObjectTaggingWithContext is the same as DeleteObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObjectTagging 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 *S3) DeleteObjectTaggingWithContext(ctx aws.Context, input *DeleteObjectTaggingInput, opts ...request.Option) (*DeleteObjectTaggingOutput, error) { - req, out := c.DeleteObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opDeleteObjects = "DeleteObjects" - -// DeleteObjectsRequest generates a "aws/request.Request" representing the -// client's request for the DeleteObjects 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 DeleteObjects for more information on using the DeleteObjects -// 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 DeleteObjectsRequest method. -// req, resp := client.DeleteObjectsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects -func (c *S3) DeleteObjectsRequest(input *DeleteObjectsInput) (req *request.Request, output *DeleteObjectsOutput) { - op := &request.Operation{ - Name: opDeleteObjects, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}?delete", - } - - if input == nil { - input = &DeleteObjectsInput{} - } - - output = &DeleteObjectsOutput{} - req = c.newRequest(op, input, output) - return -} - -// DeleteObjects API operation for Amazon Simple Storage Service. -// -// This operation enables you to delete multiple objects from a bucket using -// a single HTTP request. You may specify up to 1000 keys. -// -// 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 Simple Storage Service's -// API operation DeleteObjects for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjects -func (c *S3) DeleteObjects(input *DeleteObjectsInput) (*DeleteObjectsOutput, error) { - req, out := c.DeleteObjectsRequest(input) - return out, req.Send() -} - -// DeleteObjectsWithContext is the same as DeleteObjects with the addition of -// the ability to pass a context and additional request options. -// -// See DeleteObjects 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 *S3) DeleteObjectsWithContext(ctx aws.Context, input *DeleteObjectsInput, opts ...request.Option) (*DeleteObjectsOutput, error) { - req, out := c.DeleteObjectsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAccelerateConfiguration = "GetBucketAccelerateConfiguration" - -// GetBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAccelerateConfiguration 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 GetBucketAccelerateConfiguration for more information on using the GetBucketAccelerateConfiguration -// 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 GetBucketAccelerateConfigurationRequest method. -// req, resp := client.GetBucketAccelerateConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration -func (c *S3) GetBucketAccelerateConfigurationRequest(input *GetBucketAccelerateConfigurationInput) (req *request.Request, output *GetBucketAccelerateConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketAccelerateConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?accelerate", - } - - if input == nil { - input = &GetBucketAccelerateConfigurationInput{} - } - - output = &GetBucketAccelerateConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAccelerateConfiguration API operation for Amazon Simple Storage Service. -// -// Returns the accelerate configuration of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketAccelerateConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfiguration -func (c *S3) GetBucketAccelerateConfiguration(input *GetBucketAccelerateConfigurationInput) (*GetBucketAccelerateConfigurationOutput, error) { - req, out := c.GetBucketAccelerateConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketAccelerateConfigurationWithContext is the same as GetBucketAccelerateConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAccelerateConfiguration 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 *S3) GetBucketAccelerateConfigurationWithContext(ctx aws.Context, input *GetBucketAccelerateConfigurationInput, opts ...request.Option) (*GetBucketAccelerateConfigurationOutput, error) { - req, out := c.GetBucketAccelerateConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAcl = "GetBucketAcl" - -// GetBucketAclRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAcl 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 GetBucketAcl for more information on using the GetBucketAcl -// 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 GetBucketAclRequest method. -// req, resp := client.GetBucketAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl -func (c *S3) GetBucketAclRequest(input *GetBucketAclInput) (req *request.Request, output *GetBucketAclOutput) { - op := &request.Operation{ - Name: opGetBucketAcl, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?acl", - } - - if input == nil { - input = &GetBucketAclInput{} - } - - output = &GetBucketAclOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAcl API operation for Amazon Simple Storage Service. -// -// Gets the access control policy for the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketAcl for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAcl -func (c *S3) GetBucketAcl(input *GetBucketAclInput) (*GetBucketAclOutput, error) { - req, out := c.GetBucketAclRequest(input) - return out, req.Send() -} - -// GetBucketAclWithContext is the same as GetBucketAcl with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAcl 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 *S3) GetBucketAclWithContext(ctx aws.Context, input *GetBucketAclInput, opts ...request.Option) (*GetBucketAclOutput, error) { - req, out := c.GetBucketAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketAnalyticsConfiguration = "GetBucketAnalyticsConfiguration" - -// GetBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketAnalyticsConfiguration 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 GetBucketAnalyticsConfiguration for more information on using the GetBucketAnalyticsConfiguration -// 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 GetBucketAnalyticsConfigurationRequest method. -// req, resp := client.GetBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration -func (c *S3) GetBucketAnalyticsConfigurationRequest(input *GetBucketAnalyticsConfigurationInput) (req *request.Request, output *GetBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketAnalyticsConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &GetBucketAnalyticsConfigurationInput{} - } - - output = &GetBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// Gets an analytics configuration for the bucket (specified by the analytics -// configuration ID). -// -// 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 Simple Storage Service's -// API operation GetBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfiguration -func (c *S3) GetBucketAnalyticsConfiguration(input *GetBucketAnalyticsConfigurationInput) (*GetBucketAnalyticsConfigurationOutput, error) { - req, out := c.GetBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketAnalyticsConfigurationWithContext is the same as GetBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketAnalyticsConfiguration 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 *S3) GetBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *GetBucketAnalyticsConfigurationInput, opts ...request.Option) (*GetBucketAnalyticsConfigurationOutput, error) { - req, out := c.GetBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketCors = "GetBucketCors" - -// GetBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketCors 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 GetBucketCors for more information on using the GetBucketCors -// 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 GetBucketCorsRequest method. -// req, resp := client.GetBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors -func (c *S3) GetBucketCorsRequest(input *GetBucketCorsInput) (req *request.Request, output *GetBucketCorsOutput) { - op := &request.Operation{ - Name: opGetBucketCors, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &GetBucketCorsInput{} - } - - output = &GetBucketCorsOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketCors API operation for Amazon Simple Storage Service. -// -// Returns the cors configuration for the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCors -func (c *S3) GetBucketCors(input *GetBucketCorsInput) (*GetBucketCorsOutput, error) { - req, out := c.GetBucketCorsRequest(input) - return out, req.Send() -} - -// GetBucketCorsWithContext is the same as GetBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketCors 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 *S3) GetBucketCorsWithContext(ctx aws.Context, input *GetBucketCorsInput, opts ...request.Option) (*GetBucketCorsOutput, error) { - req, out := c.GetBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketEncryption = "GetBucketEncryption" - -// GetBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketEncryption 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 GetBucketEncryption for more information on using the GetBucketEncryption -// 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 GetBucketEncryptionRequest method. -// req, resp := client.GetBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryption -func (c *S3) GetBucketEncryptionRequest(input *GetBucketEncryptionInput) (req *request.Request, output *GetBucketEncryptionOutput) { - op := &request.Operation{ - Name: opGetBucketEncryption, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &GetBucketEncryptionInput{} - } - - output = &GetBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketEncryption API operation for Amazon Simple Storage Service. -// -// Returns the server-side encryption configuration of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryption -func (c *S3) GetBucketEncryption(input *GetBucketEncryptionInput) (*GetBucketEncryptionOutput, error) { - req, out := c.GetBucketEncryptionRequest(input) - return out, req.Send() -} - -// GetBucketEncryptionWithContext is the same as GetBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketEncryption 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 *S3) GetBucketEncryptionWithContext(ctx aws.Context, input *GetBucketEncryptionInput, opts ...request.Option) (*GetBucketEncryptionOutput, error) { - req, out := c.GetBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketInventoryConfiguration = "GetBucketInventoryConfiguration" - -// GetBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketInventoryConfiguration 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 GetBucketInventoryConfiguration for more information on using the GetBucketInventoryConfiguration -// 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 GetBucketInventoryConfigurationRequest method. -// req, resp := client.GetBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration -func (c *S3) GetBucketInventoryConfigurationRequest(input *GetBucketInventoryConfigurationInput) (req *request.Request, output *GetBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketInventoryConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &GetBucketInventoryConfigurationInput{} - } - - output = &GetBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// Returns an inventory configuration (identified by the inventory ID) from -// the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfiguration -func (c *S3) GetBucketInventoryConfiguration(input *GetBucketInventoryConfigurationInput) (*GetBucketInventoryConfigurationOutput, error) { - req, out := c.GetBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketInventoryConfigurationWithContext is the same as GetBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketInventoryConfiguration 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 *S3) GetBucketInventoryConfigurationWithContext(ctx aws.Context, input *GetBucketInventoryConfigurationInput, opts ...request.Option) (*GetBucketInventoryConfigurationOutput, error) { - req, out := c.GetBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLifecycle = "GetBucketLifecycle" - -// GetBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLifecycle 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 GetBucketLifecycle for more information on using the GetBucketLifecycle -// 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 GetBucketLifecycleRequest method. -// req, resp := client.GetBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle -func (c *S3) GetBucketLifecycleRequest(input *GetBucketLifecycleInput) (req *request.Request, output *GetBucketLifecycleOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, GetBucketLifecycle, has been deprecated") - } - op := &request.Operation{ - Name: opGetBucketLifecycle, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &GetBucketLifecycleInput{} - } - - output = &GetBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLifecycle API operation for Amazon Simple Storage Service. -// -// Deprecated, see the GetBucketLifecycleConfiguration operation. -// -// 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 Simple Storage Service's -// API operation GetBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycle -func (c *S3) GetBucketLifecycle(input *GetBucketLifecycleInput) (*GetBucketLifecycleOutput, error) { - req, out := c.GetBucketLifecycleRequest(input) - return out, req.Send() -} - -// GetBucketLifecycleWithContext is the same as GetBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLifecycle 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 *S3) GetBucketLifecycleWithContext(ctx aws.Context, input *GetBucketLifecycleInput, opts ...request.Option) (*GetBucketLifecycleOutput, error) { - req, out := c.GetBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLifecycleConfiguration = "GetBucketLifecycleConfiguration" - -// GetBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLifecycleConfiguration 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 GetBucketLifecycleConfiguration for more information on using the GetBucketLifecycleConfiguration -// 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 GetBucketLifecycleConfigurationRequest method. -// req, resp := client.GetBucketLifecycleConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration -func (c *S3) GetBucketLifecycleConfigurationRequest(input *GetBucketLifecycleConfigurationInput) (req *request.Request, output *GetBucketLifecycleConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketLifecycleConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &GetBucketLifecycleConfigurationInput{} - } - - output = &GetBucketLifecycleConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLifecycleConfiguration API operation for Amazon Simple Storage Service. -// -// Returns the lifecycle configuration information set on the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketLifecycleConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfiguration -func (c *S3) GetBucketLifecycleConfiguration(input *GetBucketLifecycleConfigurationInput) (*GetBucketLifecycleConfigurationOutput, error) { - req, out := c.GetBucketLifecycleConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketLifecycleConfigurationWithContext is the same as GetBucketLifecycleConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLifecycleConfiguration 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 *S3) GetBucketLifecycleConfigurationWithContext(ctx aws.Context, input *GetBucketLifecycleConfigurationInput, opts ...request.Option) (*GetBucketLifecycleConfigurationOutput, error) { - req, out := c.GetBucketLifecycleConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLocation = "GetBucketLocation" - -// GetBucketLocationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLocation 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 GetBucketLocation for more information on using the GetBucketLocation -// 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 GetBucketLocationRequest method. -// req, resp := client.GetBucketLocationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation -func (c *S3) GetBucketLocationRequest(input *GetBucketLocationInput) (req *request.Request, output *GetBucketLocationOutput) { - op := &request.Operation{ - Name: opGetBucketLocation, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?location", - } - - if input == nil { - input = &GetBucketLocationInput{} - } - - output = &GetBucketLocationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLocation API operation for Amazon Simple Storage Service. -// -// Returns the region the bucket resides in. -// -// 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 Simple Storage Service's -// API operation GetBucketLocation for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocation -func (c *S3) GetBucketLocation(input *GetBucketLocationInput) (*GetBucketLocationOutput, error) { - req, out := c.GetBucketLocationRequest(input) - return out, req.Send() -} - -// GetBucketLocationWithContext is the same as GetBucketLocation with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLocation 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 *S3) GetBucketLocationWithContext(ctx aws.Context, input *GetBucketLocationInput, opts ...request.Option) (*GetBucketLocationOutput, error) { - req, out := c.GetBucketLocationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketLogging = "GetBucketLogging" - -// GetBucketLoggingRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketLogging 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 GetBucketLogging for more information on using the GetBucketLogging -// 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 GetBucketLoggingRequest method. -// req, resp := client.GetBucketLoggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging -func (c *S3) GetBucketLoggingRequest(input *GetBucketLoggingInput) (req *request.Request, output *GetBucketLoggingOutput) { - op := &request.Operation{ - Name: opGetBucketLogging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?logging", - } - - if input == nil { - input = &GetBucketLoggingInput{} - } - - output = &GetBucketLoggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketLogging API operation for Amazon Simple Storage Service. -// -// Returns the logging status of a bucket and the permissions users have to -// view and modify that status. To use GET, you must be the bucket owner. -// -// 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 Simple Storage Service's -// API operation GetBucketLogging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLogging -func (c *S3) GetBucketLogging(input *GetBucketLoggingInput) (*GetBucketLoggingOutput, error) { - req, out := c.GetBucketLoggingRequest(input) - return out, req.Send() -} - -// GetBucketLoggingWithContext is the same as GetBucketLogging with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketLogging 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 *S3) GetBucketLoggingWithContext(ctx aws.Context, input *GetBucketLoggingInput, opts ...request.Option) (*GetBucketLoggingOutput, error) { - req, out := c.GetBucketLoggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketMetricsConfiguration = "GetBucketMetricsConfiguration" - -// GetBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketMetricsConfiguration 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 GetBucketMetricsConfiguration for more information on using the GetBucketMetricsConfiguration -// 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 GetBucketMetricsConfigurationRequest method. -// req, resp := client.GetBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration -func (c *S3) GetBucketMetricsConfigurationRequest(input *GetBucketMetricsConfigurationInput) (req *request.Request, output *GetBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opGetBucketMetricsConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &GetBucketMetricsConfigurationInput{} - } - - output = &GetBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Gets a metrics configuration (specified by the metrics configuration ID) -// from the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfiguration -func (c *S3) GetBucketMetricsConfiguration(input *GetBucketMetricsConfigurationInput) (*GetBucketMetricsConfigurationOutput, error) { - req, out := c.GetBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketMetricsConfigurationWithContext is the same as GetBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketMetricsConfiguration 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 *S3) GetBucketMetricsConfigurationWithContext(ctx aws.Context, input *GetBucketMetricsConfigurationInput, opts ...request.Option) (*GetBucketMetricsConfigurationOutput, error) { - req, out := c.GetBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketNotification = "GetBucketNotification" - -// GetBucketNotificationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketNotification 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 GetBucketNotification for more information on using the GetBucketNotification -// 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 GetBucketNotificationRequest method. -// req, resp := client.GetBucketNotificationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification -func (c *S3) GetBucketNotificationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfigurationDeprecated) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, GetBucketNotification, has been deprecated") - } - op := &request.Operation{ - Name: opGetBucketNotification, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &GetBucketNotificationConfigurationRequest{} - } - - output = &NotificationConfigurationDeprecated{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketNotification API operation for Amazon Simple Storage Service. -// -// Deprecated, see the GetBucketNotificationConfiguration operation. -// -// 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 Simple Storage Service's -// API operation GetBucketNotification for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotification -func (c *S3) GetBucketNotification(input *GetBucketNotificationConfigurationRequest) (*NotificationConfigurationDeprecated, error) { - req, out := c.GetBucketNotificationRequest(input) - return out, req.Send() -} - -// GetBucketNotificationWithContext is the same as GetBucketNotification with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketNotification 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 *S3) GetBucketNotificationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfigurationDeprecated, error) { - req, out := c.GetBucketNotificationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketNotificationConfiguration = "GetBucketNotificationConfiguration" - -// GetBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketNotificationConfiguration 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 GetBucketNotificationConfiguration for more information on using the GetBucketNotificationConfiguration -// 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 GetBucketNotificationConfigurationRequest method. -// req, resp := client.GetBucketNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration -func (c *S3) GetBucketNotificationConfigurationRequest(input *GetBucketNotificationConfigurationRequest) (req *request.Request, output *NotificationConfiguration) { - op := &request.Operation{ - Name: opGetBucketNotificationConfiguration, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &GetBucketNotificationConfigurationRequest{} - } - - output = &NotificationConfiguration{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketNotificationConfiguration API operation for Amazon Simple Storage Service. -// -// Returns the notification configuration of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketNotificationConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfiguration -func (c *S3) GetBucketNotificationConfiguration(input *GetBucketNotificationConfigurationRequest) (*NotificationConfiguration, error) { - req, out := c.GetBucketNotificationConfigurationRequest(input) - return out, req.Send() -} - -// GetBucketNotificationConfigurationWithContext is the same as GetBucketNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketNotificationConfiguration 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 *S3) GetBucketNotificationConfigurationWithContext(ctx aws.Context, input *GetBucketNotificationConfigurationRequest, opts ...request.Option) (*NotificationConfiguration, error) { - req, out := c.GetBucketNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketPolicy = "GetBucketPolicy" - -// GetBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketPolicy 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 GetBucketPolicy for more information on using the GetBucketPolicy -// 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 GetBucketPolicyRequest method. -// req, resp := client.GetBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy -func (c *S3) GetBucketPolicyRequest(input *GetBucketPolicyInput) (req *request.Request, output *GetBucketPolicyOutput) { - op := &request.Operation{ - Name: opGetBucketPolicy, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &GetBucketPolicyInput{} - } - - output = &GetBucketPolicyOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketPolicy API operation for Amazon Simple Storage Service. -// -// Returns the policy of a specified bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicy -func (c *S3) GetBucketPolicy(input *GetBucketPolicyInput) (*GetBucketPolicyOutput, error) { - req, out := c.GetBucketPolicyRequest(input) - return out, req.Send() -} - -// GetBucketPolicyWithContext is the same as GetBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketPolicy 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 *S3) GetBucketPolicyWithContext(ctx aws.Context, input *GetBucketPolicyInput, opts ...request.Option) (*GetBucketPolicyOutput, error) { - req, out := c.GetBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketReplication = "GetBucketReplication" - -// GetBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketReplication 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 GetBucketReplication for more information on using the GetBucketReplication -// 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 GetBucketReplicationRequest method. -// req, resp := client.GetBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication -func (c *S3) GetBucketReplicationRequest(input *GetBucketReplicationInput) (req *request.Request, output *GetBucketReplicationOutput) { - op := &request.Operation{ - Name: opGetBucketReplication, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &GetBucketReplicationInput{} - } - - output = &GetBucketReplicationOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketReplication API operation for Amazon Simple Storage Service. -// -// Returns the replication configuration of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplication -func (c *S3) GetBucketReplication(input *GetBucketReplicationInput) (*GetBucketReplicationOutput, error) { - req, out := c.GetBucketReplicationRequest(input) - return out, req.Send() -} - -// GetBucketReplicationWithContext is the same as GetBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketReplication 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 *S3) GetBucketReplicationWithContext(ctx aws.Context, input *GetBucketReplicationInput, opts ...request.Option) (*GetBucketReplicationOutput, error) { - req, out := c.GetBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketRequestPayment = "GetBucketRequestPayment" - -// GetBucketRequestPaymentRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketRequestPayment 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 GetBucketRequestPayment for more information on using the GetBucketRequestPayment -// 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 GetBucketRequestPaymentRequest method. -// req, resp := client.GetBucketRequestPaymentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment -func (c *S3) GetBucketRequestPaymentRequest(input *GetBucketRequestPaymentInput) (req *request.Request, output *GetBucketRequestPaymentOutput) { - op := &request.Operation{ - Name: opGetBucketRequestPayment, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?requestPayment", - } - - if input == nil { - input = &GetBucketRequestPaymentInput{} - } - - output = &GetBucketRequestPaymentOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketRequestPayment API operation for Amazon Simple Storage Service. -// -// Returns the request payment configuration of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketRequestPayment for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPayment -func (c *S3) GetBucketRequestPayment(input *GetBucketRequestPaymentInput) (*GetBucketRequestPaymentOutput, error) { - req, out := c.GetBucketRequestPaymentRequest(input) - return out, req.Send() -} - -// GetBucketRequestPaymentWithContext is the same as GetBucketRequestPayment with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketRequestPayment 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 *S3) GetBucketRequestPaymentWithContext(ctx aws.Context, input *GetBucketRequestPaymentInput, opts ...request.Option) (*GetBucketRequestPaymentOutput, error) { - req, out := c.GetBucketRequestPaymentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketTagging = "GetBucketTagging" - -// GetBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketTagging 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 GetBucketTagging for more information on using the GetBucketTagging -// 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 GetBucketTaggingRequest method. -// req, resp := client.GetBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging -func (c *S3) GetBucketTaggingRequest(input *GetBucketTaggingInput) (req *request.Request, output *GetBucketTaggingOutput) { - op := &request.Operation{ - Name: opGetBucketTagging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &GetBucketTaggingInput{} - } - - output = &GetBucketTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketTagging API operation for Amazon Simple Storage Service. -// -// Returns the tag set associated with the bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTagging -func (c *S3) GetBucketTagging(input *GetBucketTaggingInput) (*GetBucketTaggingOutput, error) { - req, out := c.GetBucketTaggingRequest(input) - return out, req.Send() -} - -// GetBucketTaggingWithContext is the same as GetBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketTagging 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 *S3) GetBucketTaggingWithContext(ctx aws.Context, input *GetBucketTaggingInput, opts ...request.Option) (*GetBucketTaggingOutput, error) { - req, out := c.GetBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketVersioning = "GetBucketVersioning" - -// GetBucketVersioningRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketVersioning 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 GetBucketVersioning for more information on using the GetBucketVersioning -// 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 GetBucketVersioningRequest method. -// req, resp := client.GetBucketVersioningRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning -func (c *S3) GetBucketVersioningRequest(input *GetBucketVersioningInput) (req *request.Request, output *GetBucketVersioningOutput) { - op := &request.Operation{ - Name: opGetBucketVersioning, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versioning", - } - - if input == nil { - input = &GetBucketVersioningInput{} - } - - output = &GetBucketVersioningOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketVersioning API operation for Amazon Simple Storage Service. -// -// Returns the versioning state of a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketVersioning for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioning -func (c *S3) GetBucketVersioning(input *GetBucketVersioningInput) (*GetBucketVersioningOutput, error) { - req, out := c.GetBucketVersioningRequest(input) - return out, req.Send() -} - -// GetBucketVersioningWithContext is the same as GetBucketVersioning with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketVersioning 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 *S3) GetBucketVersioningWithContext(ctx aws.Context, input *GetBucketVersioningInput, opts ...request.Option) (*GetBucketVersioningOutput, error) { - req, out := c.GetBucketVersioningRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetBucketWebsite = "GetBucketWebsite" - -// GetBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the GetBucketWebsite 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 GetBucketWebsite for more information on using the GetBucketWebsite -// 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 GetBucketWebsiteRequest method. -// req, resp := client.GetBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite -func (c *S3) GetBucketWebsiteRequest(input *GetBucketWebsiteInput) (req *request.Request, output *GetBucketWebsiteOutput) { - op := &request.Operation{ - Name: opGetBucketWebsite, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &GetBucketWebsiteInput{} - } - - output = &GetBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetBucketWebsite API operation for Amazon Simple Storage Service. -// -// Returns the website configuration for a bucket. -// -// 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 Simple Storage Service's -// API operation GetBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsite -func (c *S3) GetBucketWebsite(input *GetBucketWebsiteInput) (*GetBucketWebsiteOutput, error) { - req, out := c.GetBucketWebsiteRequest(input) - return out, req.Send() -} - -// GetBucketWebsiteWithContext is the same as GetBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See GetBucketWebsite 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 *S3) GetBucketWebsiteWithContext(ctx aws.Context, input *GetBucketWebsiteInput, opts ...request.Option) (*GetBucketWebsiteOutput, error) { - req, out := c.GetBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObject = "GetObject" - -// GetObjectRequest generates a "aws/request.Request" representing the -// client's request for the GetObject 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 GetObject for more information on using the GetObject -// 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 GetObjectRequest method. -// req, resp := client.GetObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject -func (c *S3) GetObjectRequest(input *GetObjectInput) (req *request.Request, output *GetObjectOutput) { - op := &request.Operation{ - Name: opGetObject, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &GetObjectInput{} - } - - output = &GetObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObject API operation for Amazon Simple Storage Service. -// -// Retrieves objects from 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 Amazon Simple Storage Service's -// API operation GetObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObject -func (c *S3) GetObject(input *GetObjectInput) (*GetObjectOutput, error) { - req, out := c.GetObjectRequest(input) - return out, req.Send() -} - -// GetObjectWithContext is the same as GetObject with the addition of -// the ability to pass a context and additional request options. -// -// See GetObject 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 *S3) GetObjectWithContext(ctx aws.Context, input *GetObjectInput, opts ...request.Option) (*GetObjectOutput, error) { - req, out := c.GetObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectAcl = "GetObjectAcl" - -// GetObjectAclRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectAcl 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 GetObjectAcl for more information on using the GetObjectAcl -// 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 GetObjectAclRequest method. -// req, resp := client.GetObjectAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl -func (c *S3) GetObjectAclRequest(input *GetObjectAclInput) (req *request.Request, output *GetObjectAclOutput) { - op := &request.Operation{ - Name: opGetObjectAcl, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - - if input == nil { - input = &GetObjectAclInput{} - } - - output = &GetObjectAclOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectAcl API operation for Amazon Simple Storage Service. -// -// Returns the access control list (ACL) of an object. -// -// 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 Simple Storage Service's -// API operation GetObjectAcl for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAcl -func (c *S3) GetObjectAcl(input *GetObjectAclInput) (*GetObjectAclOutput, error) { - req, out := c.GetObjectAclRequest(input) - return out, req.Send() -} - -// GetObjectAclWithContext is the same as GetObjectAcl with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectAcl 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 *S3) GetObjectAclWithContext(ctx aws.Context, input *GetObjectAclInput, opts ...request.Option) (*GetObjectAclOutput, error) { - req, out := c.GetObjectAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectTagging = "GetObjectTagging" - -// GetObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectTagging 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 GetObjectTagging for more information on using the GetObjectTagging -// 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 GetObjectTaggingRequest method. -// req, resp := client.GetObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging -func (c *S3) GetObjectTaggingRequest(input *GetObjectTaggingInput) (req *request.Request, output *GetObjectTaggingOutput) { - op := &request.Operation{ - Name: opGetObjectTagging, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &GetObjectTaggingInput{} - } - - output = &GetObjectTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectTagging API operation for Amazon Simple Storage Service. -// -// Returns the tag-set of an object. -// -// 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 Simple Storage Service's -// API operation GetObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTagging -func (c *S3) GetObjectTagging(input *GetObjectTaggingInput) (*GetObjectTaggingOutput, error) { - req, out := c.GetObjectTaggingRequest(input) - return out, req.Send() -} - -// GetObjectTaggingWithContext is the same as GetObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectTagging 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 *S3) GetObjectTaggingWithContext(ctx aws.Context, input *GetObjectTaggingInput, opts ...request.Option) (*GetObjectTaggingOutput, error) { - req, out := c.GetObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opGetObjectTorrent = "GetObjectTorrent" - -// GetObjectTorrentRequest generates a "aws/request.Request" representing the -// client's request for the GetObjectTorrent 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 GetObjectTorrent for more information on using the GetObjectTorrent -// 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 GetObjectTorrentRequest method. -// req, resp := client.GetObjectTorrentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent -func (c *S3) GetObjectTorrentRequest(input *GetObjectTorrentInput) (req *request.Request, output *GetObjectTorrentOutput) { - op := &request.Operation{ - Name: opGetObjectTorrent, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}?torrent", - } - - if input == nil { - input = &GetObjectTorrentInput{} - } - - output = &GetObjectTorrentOutput{} - req = c.newRequest(op, input, output) - return -} - -// GetObjectTorrent API operation for Amazon Simple Storage Service. -// -// Return torrent files from a bucket. -// -// 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 Simple Storage Service's -// API operation GetObjectTorrent for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrent -func (c *S3) GetObjectTorrent(input *GetObjectTorrentInput) (*GetObjectTorrentOutput, error) { - req, out := c.GetObjectTorrentRequest(input) - return out, req.Send() -} - -// GetObjectTorrentWithContext is the same as GetObjectTorrent with the addition of -// the ability to pass a context and additional request options. -// -// See GetObjectTorrent 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 *S3) GetObjectTorrentWithContext(ctx aws.Context, input *GetObjectTorrentInput, opts ...request.Option) (*GetObjectTorrentOutput, error) { - req, out := c.GetObjectTorrentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opHeadBucket = "HeadBucket" - -// HeadBucketRequest generates a "aws/request.Request" representing the -// client's request for the HeadBucket 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 HeadBucket for more information on using the HeadBucket -// 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 HeadBucketRequest method. -// req, resp := client.HeadBucketRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket -func (c *S3) HeadBucketRequest(input *HeadBucketInput) (req *request.Request, output *HeadBucketOutput) { - op := &request.Operation{ - Name: opHeadBucket, - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}", - } - - if input == nil { - input = &HeadBucketInput{} - } - - output = &HeadBucketOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// HeadBucket API operation for Amazon Simple Storage Service. -// -// This operation is useful to determine if a bucket exists and you have permission -// to access it. -// -// 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 Simple Storage Service's -// API operation HeadBucket for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucket -func (c *S3) HeadBucket(input *HeadBucketInput) (*HeadBucketOutput, error) { - req, out := c.HeadBucketRequest(input) - return out, req.Send() -} - -// HeadBucketWithContext is the same as HeadBucket with the addition of -// the ability to pass a context and additional request options. -// -// See HeadBucket 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 *S3) HeadBucketWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.Option) (*HeadBucketOutput, error) { - req, out := c.HeadBucketRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opHeadObject = "HeadObject" - -// HeadObjectRequest generates a "aws/request.Request" representing the -// client's request for the HeadObject 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 HeadObject for more information on using the HeadObject -// 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 HeadObjectRequest method. -// req, resp := client.HeadObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject -func (c *S3) HeadObjectRequest(input *HeadObjectInput) (req *request.Request, output *HeadObjectOutput) { - op := &request.Operation{ - Name: opHeadObject, - HTTPMethod: "HEAD", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &HeadObjectInput{} - } - - output = &HeadObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// HeadObject API operation for Amazon Simple Storage Service. -// -// The HEAD operation retrieves metadata from an object without returning the -// object itself. This operation is useful if you're only interested in an object's -// metadata. To use HEAD, you must have READ access to the object. -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/ErrorResponses.html#RESTErrorResponses -// for more information on returned errors. -// -// 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 Simple Storage Service's -// API operation HeadObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObject -func (c *S3) HeadObject(input *HeadObjectInput) (*HeadObjectOutput, error) { - req, out := c.HeadObjectRequest(input) - return out, req.Send() -} - -// HeadObjectWithContext is the same as HeadObject with the addition of -// the ability to pass a context and additional request options. -// -// See HeadObject 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 *S3) HeadObjectWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.Option) (*HeadObjectOutput, error) { - req, out := c.HeadObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketAnalyticsConfigurations = "ListBucketAnalyticsConfigurations" - -// ListBucketAnalyticsConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketAnalyticsConfigurations 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 ListBucketAnalyticsConfigurations for more information on using the ListBucketAnalyticsConfigurations -// 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 ListBucketAnalyticsConfigurationsRequest method. -// req, resp := client.ListBucketAnalyticsConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations -func (c *S3) ListBucketAnalyticsConfigurationsRequest(input *ListBucketAnalyticsConfigurationsInput) (req *request.Request, output *ListBucketAnalyticsConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketAnalyticsConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &ListBucketAnalyticsConfigurationsInput{} - } - - output = &ListBucketAnalyticsConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketAnalyticsConfigurations API operation for Amazon Simple Storage Service. -// -// Lists the analytics configurations for the bucket. -// -// 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 Simple Storage Service's -// API operation ListBucketAnalyticsConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurations -func (c *S3) ListBucketAnalyticsConfigurations(input *ListBucketAnalyticsConfigurationsInput) (*ListBucketAnalyticsConfigurationsOutput, error) { - req, out := c.ListBucketAnalyticsConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketAnalyticsConfigurationsWithContext is the same as ListBucketAnalyticsConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketAnalyticsConfigurations 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 *S3) ListBucketAnalyticsConfigurationsWithContext(ctx aws.Context, input *ListBucketAnalyticsConfigurationsInput, opts ...request.Option) (*ListBucketAnalyticsConfigurationsOutput, error) { - req, out := c.ListBucketAnalyticsConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketInventoryConfigurations = "ListBucketInventoryConfigurations" - -// ListBucketInventoryConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketInventoryConfigurations 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 ListBucketInventoryConfigurations for more information on using the ListBucketInventoryConfigurations -// 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 ListBucketInventoryConfigurationsRequest method. -// req, resp := client.ListBucketInventoryConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations -func (c *S3) ListBucketInventoryConfigurationsRequest(input *ListBucketInventoryConfigurationsInput) (req *request.Request, output *ListBucketInventoryConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketInventoryConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &ListBucketInventoryConfigurationsInput{} - } - - output = &ListBucketInventoryConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketInventoryConfigurations API operation for Amazon Simple Storage Service. -// -// Returns a list of inventory configurations for the bucket. -// -// 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 Simple Storage Service's -// API operation ListBucketInventoryConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurations -func (c *S3) ListBucketInventoryConfigurations(input *ListBucketInventoryConfigurationsInput) (*ListBucketInventoryConfigurationsOutput, error) { - req, out := c.ListBucketInventoryConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketInventoryConfigurationsWithContext is the same as ListBucketInventoryConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketInventoryConfigurations 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 *S3) ListBucketInventoryConfigurationsWithContext(ctx aws.Context, input *ListBucketInventoryConfigurationsInput, opts ...request.Option) (*ListBucketInventoryConfigurationsOutput, error) { - req, out := c.ListBucketInventoryConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBucketMetricsConfigurations = "ListBucketMetricsConfigurations" - -// ListBucketMetricsConfigurationsRequest generates a "aws/request.Request" representing the -// client's request for the ListBucketMetricsConfigurations 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 ListBucketMetricsConfigurations for more information on using the ListBucketMetricsConfigurations -// 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 ListBucketMetricsConfigurationsRequest method. -// req, resp := client.ListBucketMetricsConfigurationsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations -func (c *S3) ListBucketMetricsConfigurationsRequest(input *ListBucketMetricsConfigurationsInput) (req *request.Request, output *ListBucketMetricsConfigurationsOutput) { - op := &request.Operation{ - Name: opListBucketMetricsConfigurations, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &ListBucketMetricsConfigurationsInput{} - } - - output = &ListBucketMetricsConfigurationsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBucketMetricsConfigurations API operation for Amazon Simple Storage Service. -// -// Lists the metrics configurations for the bucket. -// -// 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 Simple Storage Service's -// API operation ListBucketMetricsConfigurations for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurations -func (c *S3) ListBucketMetricsConfigurations(input *ListBucketMetricsConfigurationsInput) (*ListBucketMetricsConfigurationsOutput, error) { - req, out := c.ListBucketMetricsConfigurationsRequest(input) - return out, req.Send() -} - -// ListBucketMetricsConfigurationsWithContext is the same as ListBucketMetricsConfigurations with the addition of -// the ability to pass a context and additional request options. -// -// See ListBucketMetricsConfigurations 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 *S3) ListBucketMetricsConfigurationsWithContext(ctx aws.Context, input *ListBucketMetricsConfigurationsInput, opts ...request.Option) (*ListBucketMetricsConfigurationsOutput, error) { - req, out := c.ListBucketMetricsConfigurationsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListBuckets = "ListBuckets" - -// ListBucketsRequest generates a "aws/request.Request" representing the -// client's request for the ListBuckets 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 ListBuckets for more information on using the ListBuckets -// 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 ListBucketsRequest method. -// req, resp := client.ListBucketsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets -func (c *S3) ListBucketsRequest(input *ListBucketsInput) (req *request.Request, output *ListBucketsOutput) { - op := &request.Operation{ - Name: opListBuckets, - HTTPMethod: "GET", - HTTPPath: "/", - } - - if input == nil { - input = &ListBucketsInput{} - } - - output = &ListBucketsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListBuckets API operation for Amazon Simple Storage Service. -// -// Returns a list of all buckets owned by the authenticated sender of 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 Simple Storage Service's -// API operation ListBuckets for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBuckets -func (c *S3) ListBuckets(input *ListBucketsInput) (*ListBucketsOutput, error) { - req, out := c.ListBucketsRequest(input) - return out, req.Send() -} - -// ListBucketsWithContext is the same as ListBuckets with the addition of -// the ability to pass a context and additional request options. -// -// See ListBuckets 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 *S3) ListBucketsWithContext(ctx aws.Context, input *ListBucketsInput, opts ...request.Option) (*ListBucketsOutput, error) { - req, out := c.ListBucketsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opListMultipartUploads = "ListMultipartUploads" - -// ListMultipartUploadsRequest generates a "aws/request.Request" representing the -// client's request for the ListMultipartUploads 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 ListMultipartUploads for more information on using the ListMultipartUploads -// 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 ListMultipartUploadsRequest method. -// req, resp := client.ListMultipartUploadsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads -func (c *S3) ListMultipartUploadsRequest(input *ListMultipartUploadsInput) (req *request.Request, output *ListMultipartUploadsOutput) { - op := &request.Operation{ - Name: opListMultipartUploads, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?uploads", - Paginator: &request.Paginator{ - InputTokens: []string{"KeyMarker", "UploadIdMarker"}, - OutputTokens: []string{"NextKeyMarker", "NextUploadIdMarker"}, - LimitToken: "MaxUploads", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListMultipartUploadsInput{} - } - - output = &ListMultipartUploadsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListMultipartUploads API operation for Amazon Simple Storage Service. -// -// This operation lists in-progress multipart uploads. -// -// 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 Simple Storage Service's -// API operation ListMultipartUploads for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploads -func (c *S3) ListMultipartUploads(input *ListMultipartUploadsInput) (*ListMultipartUploadsOutput, error) { - req, out := c.ListMultipartUploadsRequest(input) - return out, req.Send() -} - -// ListMultipartUploadsWithContext is the same as ListMultipartUploads with the addition of -// the ability to pass a context and additional request options. -// -// See ListMultipartUploads 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 *S3) ListMultipartUploadsWithContext(ctx aws.Context, input *ListMultipartUploadsInput, opts ...request.Option) (*ListMultipartUploadsOutput, error) { - req, out := c.ListMultipartUploadsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListMultipartUploadsPages iterates over the pages of a ListMultipartUploads operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListMultipartUploads 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 ListMultipartUploads operation. -// pageNum := 0 -// err := client.ListMultipartUploadsPages(params, -// func(page *ListMultipartUploadsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListMultipartUploadsPages(input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool) error { - return c.ListMultipartUploadsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListMultipartUploadsPagesWithContext same as ListMultipartUploadsPages 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 *S3) ListMultipartUploadsPagesWithContext(ctx aws.Context, input *ListMultipartUploadsInput, fn func(*ListMultipartUploadsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListMultipartUploadsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListMultipartUploadsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListMultipartUploadsOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListObjectVersions = "ListObjectVersions" - -// ListObjectVersionsRequest generates a "aws/request.Request" representing the -// client's request for the ListObjectVersions 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 ListObjectVersions for more information on using the ListObjectVersions -// 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 ListObjectVersionsRequest method. -// req, resp := client.ListObjectVersionsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions -func (c *S3) ListObjectVersionsRequest(input *ListObjectVersionsInput) (req *request.Request, output *ListObjectVersionsOutput) { - op := &request.Operation{ - Name: opListObjectVersions, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?versions", - Paginator: &request.Paginator{ - InputTokens: []string{"KeyMarker", "VersionIdMarker"}, - OutputTokens: []string{"NextKeyMarker", "NextVersionIdMarker"}, - LimitToken: "MaxKeys", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListObjectVersionsInput{} - } - - output = &ListObjectVersionsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListObjectVersions API operation for Amazon Simple Storage Service. -// -// Returns metadata about all of the versions of objects in a bucket. -// -// 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 Simple Storage Service's -// API operation ListObjectVersions for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersions -func (c *S3) ListObjectVersions(input *ListObjectVersionsInput) (*ListObjectVersionsOutput, error) { - req, out := c.ListObjectVersionsRequest(input) - return out, req.Send() -} - -// ListObjectVersionsWithContext is the same as ListObjectVersions with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjectVersions 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 *S3) ListObjectVersionsWithContext(ctx aws.Context, input *ListObjectVersionsInput, opts ...request.Option) (*ListObjectVersionsOutput, error) { - req, out := c.ListObjectVersionsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectVersionsPages iterates over the pages of a ListObjectVersions operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjectVersions 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 ListObjectVersions operation. -// pageNum := 0 -// err := client.ListObjectVersionsPages(params, -// func(page *ListObjectVersionsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectVersionsPages(input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool) error { - return c.ListObjectVersionsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectVersionsPagesWithContext same as ListObjectVersionsPages 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 *S3) ListObjectVersionsPagesWithContext(ctx aws.Context, input *ListObjectVersionsInput, fn func(*ListObjectVersionsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectVersionsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectVersionsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListObjectVersionsOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListObjects = "ListObjects" - -// ListObjectsRequest generates a "aws/request.Request" representing the -// client's request for the ListObjects 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 ListObjects for more information on using the ListObjects -// 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 ListObjectsRequest method. -// req, resp := client.ListObjectsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects -func (c *S3) ListObjectsRequest(input *ListObjectsInput) (req *request.Request, output *ListObjectsOutput) { - op := &request.Operation{ - Name: opListObjects, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}", - Paginator: &request.Paginator{ - InputTokens: []string{"Marker"}, - OutputTokens: []string{"NextMarker || Contents[-1].Key"}, - LimitToken: "MaxKeys", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListObjectsInput{} - } - - output = &ListObjectsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListObjects API operation for Amazon Simple Storage Service. -// -// Returns some or all (up to 1000) of the objects in a bucket. You can use -// the request parameters as selection criteria to return a subset of the objects -// in a bucket. -// -// 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 Simple Storage Service's -// API operation ListObjects for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjects -func (c *S3) ListObjects(input *ListObjectsInput) (*ListObjectsOutput, error) { - req, out := c.ListObjectsRequest(input) - return out, req.Send() -} - -// ListObjectsWithContext is the same as ListObjects with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjects 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 *S3) ListObjectsWithContext(ctx aws.Context, input *ListObjectsInput, opts ...request.Option) (*ListObjectsOutput, error) { - req, out := c.ListObjectsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectsPages iterates over the pages of a ListObjects operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjects 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 ListObjects operation. -// pageNum := 0 -// err := client.ListObjectsPages(params, -// func(page *ListObjectsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectsPages(input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool) error { - return c.ListObjectsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectsPagesWithContext same as ListObjectsPages 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 *S3) ListObjectsPagesWithContext(ctx aws.Context, input *ListObjectsInput, fn func(*ListObjectsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListObjectsOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opListObjectsV2 = "ListObjectsV2" - -// ListObjectsV2Request generates a "aws/request.Request" representing the -// client's request for the ListObjectsV2 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 ListObjectsV2 for more information on using the ListObjectsV2 -// 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 ListObjectsV2Request method. -// req, resp := client.ListObjectsV2Request(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 -func (c *S3) ListObjectsV2Request(input *ListObjectsV2Input) (req *request.Request, output *ListObjectsV2Output) { - op := &request.Operation{ - Name: opListObjectsV2, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}?list-type=2", - Paginator: &request.Paginator{ - InputTokens: []string{"ContinuationToken"}, - OutputTokens: []string{"NextContinuationToken"}, - LimitToken: "MaxKeys", - TruncationToken: "", - }, - } - - if input == nil { - input = &ListObjectsV2Input{} - } - - output = &ListObjectsV2Output{} - req = c.newRequest(op, input, output) - return -} - -// ListObjectsV2 API operation for Amazon Simple Storage Service. -// -// Returns some or all (up to 1000) of the objects in a bucket. You can use -// the request parameters as selection criteria to return a subset of the objects -// in a bucket. Note: ListObjectsV2 is the revised List Objects API and we recommend -// you use this revised API for new application development. -// -// 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 Simple Storage Service's -// API operation ListObjectsV2 for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchBucket "NoSuchBucket" -// The specified bucket does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2 -func (c *S3) ListObjectsV2(input *ListObjectsV2Input) (*ListObjectsV2Output, error) { - req, out := c.ListObjectsV2Request(input) - return out, req.Send() -} - -// ListObjectsV2WithContext is the same as ListObjectsV2 with the addition of -// the ability to pass a context and additional request options. -// -// See ListObjectsV2 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 *S3) ListObjectsV2WithContext(ctx aws.Context, input *ListObjectsV2Input, opts ...request.Option) (*ListObjectsV2Output, error) { - req, out := c.ListObjectsV2Request(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListObjectsV2Pages iterates over the pages of a ListObjectsV2 operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListObjectsV2 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 ListObjectsV2 operation. -// pageNum := 0 -// err := client.ListObjectsV2Pages(params, -// func(page *ListObjectsV2Output, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListObjectsV2Pages(input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool) error { - return c.ListObjectsV2PagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListObjectsV2PagesWithContext same as ListObjectsV2Pages 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 *S3) ListObjectsV2PagesWithContext(ctx aws.Context, input *ListObjectsV2Input, fn func(*ListObjectsV2Output, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListObjectsV2Input - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListObjectsV2Request(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListObjectsV2Output), !p.HasNextPage()) - } - return p.Err() -} - -const opListParts = "ListParts" - -// ListPartsRequest generates a "aws/request.Request" representing the -// client's request for the ListParts 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 ListParts for more information on using the ListParts -// 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 ListPartsRequest method. -// req, resp := client.ListPartsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts -func (c *S3) ListPartsRequest(input *ListPartsInput) (req *request.Request, output *ListPartsOutput) { - op := &request.Operation{ - Name: opListParts, - HTTPMethod: "GET", - HTTPPath: "/{Bucket}/{Key+}", - Paginator: &request.Paginator{ - InputTokens: []string{"PartNumberMarker"}, - OutputTokens: []string{"NextPartNumberMarker"}, - LimitToken: "MaxParts", - TruncationToken: "IsTruncated", - }, - } - - if input == nil { - input = &ListPartsInput{} - } - - output = &ListPartsOutput{} - req = c.newRequest(op, input, output) - return -} - -// ListParts API operation for Amazon Simple Storage Service. -// -// Lists the parts that have been uploaded for a specific multipart upload. -// -// 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 Simple Storage Service's -// API operation ListParts for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListParts -func (c *S3) ListParts(input *ListPartsInput) (*ListPartsOutput, error) { - req, out := c.ListPartsRequest(input) - return out, req.Send() -} - -// ListPartsWithContext is the same as ListParts with the addition of -// the ability to pass a context and additional request options. -// -// See ListParts 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 *S3) ListPartsWithContext(ctx aws.Context, input *ListPartsInput, opts ...request.Option) (*ListPartsOutput, error) { - req, out := c.ListPartsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// ListPartsPages iterates over the pages of a ListParts operation, -// calling the "fn" function with the response data for each page. To stop -// iterating, return false from the fn function. -// -// See ListParts 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 ListParts operation. -// pageNum := 0 -// err := client.ListPartsPages(params, -// func(page *ListPartsOutput, lastPage bool) bool { -// pageNum++ -// fmt.Println(page) -// return pageNum <= 3 -// }) -// -func (c *S3) ListPartsPages(input *ListPartsInput, fn func(*ListPartsOutput, bool) bool) error { - return c.ListPartsPagesWithContext(aws.BackgroundContext(), input, fn) -} - -// ListPartsPagesWithContext same as ListPartsPages 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 *S3) ListPartsPagesWithContext(ctx aws.Context, input *ListPartsInput, fn func(*ListPartsOutput, bool) bool, opts ...request.Option) error { - p := request.Pagination{ - NewRequest: func() (*request.Request, error) { - var inCpy *ListPartsInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.ListPartsRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - - cont := true - for p.Next() && cont { - cont = fn(p.Page().(*ListPartsOutput), !p.HasNextPage()) - } - return p.Err() -} - -const opPutBucketAccelerateConfiguration = "PutBucketAccelerateConfiguration" - -// PutBucketAccelerateConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAccelerateConfiguration 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 PutBucketAccelerateConfiguration for more information on using the PutBucketAccelerateConfiguration -// 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 PutBucketAccelerateConfigurationRequest method. -// req, resp := client.PutBucketAccelerateConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration -func (c *S3) PutBucketAccelerateConfigurationRequest(input *PutBucketAccelerateConfigurationInput) (req *request.Request, output *PutBucketAccelerateConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketAccelerateConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?accelerate", - } - - if input == nil { - input = &PutBucketAccelerateConfigurationInput{} - } - - output = &PutBucketAccelerateConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketAccelerateConfiguration API operation for Amazon Simple Storage Service. -// -// Sets the accelerate configuration of an existing bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketAccelerateConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfiguration -func (c *S3) PutBucketAccelerateConfiguration(input *PutBucketAccelerateConfigurationInput) (*PutBucketAccelerateConfigurationOutput, error) { - req, out := c.PutBucketAccelerateConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketAccelerateConfigurationWithContext is the same as PutBucketAccelerateConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAccelerateConfiguration 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 *S3) PutBucketAccelerateConfigurationWithContext(ctx aws.Context, input *PutBucketAccelerateConfigurationInput, opts ...request.Option) (*PutBucketAccelerateConfigurationOutput, error) { - req, out := c.PutBucketAccelerateConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketAcl = "PutBucketAcl" - -// PutBucketAclRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAcl 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 PutBucketAcl for more information on using the PutBucketAcl -// 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 PutBucketAclRequest method. -// req, resp := client.PutBucketAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl -func (c *S3) PutBucketAclRequest(input *PutBucketAclInput) (req *request.Request, output *PutBucketAclOutput) { - op := &request.Operation{ - Name: opPutBucketAcl, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?acl", - } - - if input == nil { - input = &PutBucketAclInput{} - } - - output = &PutBucketAclOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketAcl API operation for Amazon Simple Storage Service. -// -// Sets the permissions on a bucket using access control lists (ACL). -// -// 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 Simple Storage Service's -// API operation PutBucketAcl for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAcl -func (c *S3) PutBucketAcl(input *PutBucketAclInput) (*PutBucketAclOutput, error) { - req, out := c.PutBucketAclRequest(input) - return out, req.Send() -} - -// PutBucketAclWithContext is the same as PutBucketAcl with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAcl 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 *S3) PutBucketAclWithContext(ctx aws.Context, input *PutBucketAclInput, opts ...request.Option) (*PutBucketAclOutput, error) { - req, out := c.PutBucketAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketAnalyticsConfiguration = "PutBucketAnalyticsConfiguration" - -// PutBucketAnalyticsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketAnalyticsConfiguration 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 PutBucketAnalyticsConfiguration for more information on using the PutBucketAnalyticsConfiguration -// 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 PutBucketAnalyticsConfigurationRequest method. -// req, resp := client.PutBucketAnalyticsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration -func (c *S3) PutBucketAnalyticsConfigurationRequest(input *PutBucketAnalyticsConfigurationInput) (req *request.Request, output *PutBucketAnalyticsConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketAnalyticsConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?analytics", - } - - if input == nil { - input = &PutBucketAnalyticsConfigurationInput{} - } - - output = &PutBucketAnalyticsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketAnalyticsConfiguration API operation for Amazon Simple Storage Service. -// -// Sets an analytics configuration for the bucket (specified by the analytics -// configuration ID). -// -// 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 Simple Storage Service's -// API operation PutBucketAnalyticsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfiguration -func (c *S3) PutBucketAnalyticsConfiguration(input *PutBucketAnalyticsConfigurationInput) (*PutBucketAnalyticsConfigurationOutput, error) { - req, out := c.PutBucketAnalyticsConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketAnalyticsConfigurationWithContext is the same as PutBucketAnalyticsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketAnalyticsConfiguration 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 *S3) PutBucketAnalyticsConfigurationWithContext(ctx aws.Context, input *PutBucketAnalyticsConfigurationInput, opts ...request.Option) (*PutBucketAnalyticsConfigurationOutput, error) { - req, out := c.PutBucketAnalyticsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketCors = "PutBucketCors" - -// PutBucketCorsRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketCors 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 PutBucketCors for more information on using the PutBucketCors -// 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 PutBucketCorsRequest method. -// req, resp := client.PutBucketCorsRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors -func (c *S3) PutBucketCorsRequest(input *PutBucketCorsInput) (req *request.Request, output *PutBucketCorsOutput) { - op := &request.Operation{ - Name: opPutBucketCors, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?cors", - } - - if input == nil { - input = &PutBucketCorsInput{} - } - - output = &PutBucketCorsOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketCors API operation for Amazon Simple Storage Service. -// -// Sets the cors configuration for a bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketCors for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCors -func (c *S3) PutBucketCors(input *PutBucketCorsInput) (*PutBucketCorsOutput, error) { - req, out := c.PutBucketCorsRequest(input) - return out, req.Send() -} - -// PutBucketCorsWithContext is the same as PutBucketCors with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketCors 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 *S3) PutBucketCorsWithContext(ctx aws.Context, input *PutBucketCorsInput, opts ...request.Option) (*PutBucketCorsOutput, error) { - req, out := c.PutBucketCorsRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketEncryption = "PutBucketEncryption" - -// PutBucketEncryptionRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketEncryption 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 PutBucketEncryption for more information on using the PutBucketEncryption -// 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 PutBucketEncryptionRequest method. -// req, resp := client.PutBucketEncryptionRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryption -func (c *S3) PutBucketEncryptionRequest(input *PutBucketEncryptionInput) (req *request.Request, output *PutBucketEncryptionOutput) { - op := &request.Operation{ - Name: opPutBucketEncryption, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?encryption", - } - - if input == nil { - input = &PutBucketEncryptionInput{} - } - - output = &PutBucketEncryptionOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketEncryption API operation for Amazon Simple Storage Service. -// -// Creates a new server-side encryption configuration (or replaces an existing -// one, if present). -// -// 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 Simple Storage Service's -// API operation PutBucketEncryption for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryption -func (c *S3) PutBucketEncryption(input *PutBucketEncryptionInput) (*PutBucketEncryptionOutput, error) { - req, out := c.PutBucketEncryptionRequest(input) - return out, req.Send() -} - -// PutBucketEncryptionWithContext is the same as PutBucketEncryption with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketEncryption 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 *S3) PutBucketEncryptionWithContext(ctx aws.Context, input *PutBucketEncryptionInput, opts ...request.Option) (*PutBucketEncryptionOutput, error) { - req, out := c.PutBucketEncryptionRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketInventoryConfiguration = "PutBucketInventoryConfiguration" - -// PutBucketInventoryConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketInventoryConfiguration 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 PutBucketInventoryConfiguration for more information on using the PutBucketInventoryConfiguration -// 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 PutBucketInventoryConfigurationRequest method. -// req, resp := client.PutBucketInventoryConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration -func (c *S3) PutBucketInventoryConfigurationRequest(input *PutBucketInventoryConfigurationInput) (req *request.Request, output *PutBucketInventoryConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketInventoryConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?inventory", - } - - if input == nil { - input = &PutBucketInventoryConfigurationInput{} - } - - output = &PutBucketInventoryConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketInventoryConfiguration API operation for Amazon Simple Storage Service. -// -// Adds an inventory configuration (identified by the inventory ID) from the -// bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketInventoryConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfiguration -func (c *S3) PutBucketInventoryConfiguration(input *PutBucketInventoryConfigurationInput) (*PutBucketInventoryConfigurationOutput, error) { - req, out := c.PutBucketInventoryConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketInventoryConfigurationWithContext is the same as PutBucketInventoryConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketInventoryConfiguration 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 *S3) PutBucketInventoryConfigurationWithContext(ctx aws.Context, input *PutBucketInventoryConfigurationInput, opts ...request.Option) (*PutBucketInventoryConfigurationOutput, error) { - req, out := c.PutBucketInventoryConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLifecycle = "PutBucketLifecycle" - -// PutBucketLifecycleRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLifecycle 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 PutBucketLifecycle for more information on using the PutBucketLifecycle -// 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 PutBucketLifecycleRequest method. -// req, resp := client.PutBucketLifecycleRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle -func (c *S3) PutBucketLifecycleRequest(input *PutBucketLifecycleInput) (req *request.Request, output *PutBucketLifecycleOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, PutBucketLifecycle, has been deprecated") - } - op := &request.Operation{ - Name: opPutBucketLifecycle, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &PutBucketLifecycleInput{} - } - - output = &PutBucketLifecycleOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketLifecycle API operation for Amazon Simple Storage Service. -// -// Deprecated, see the PutBucketLifecycleConfiguration operation. -// -// 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 Simple Storage Service's -// API operation PutBucketLifecycle for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycle -func (c *S3) PutBucketLifecycle(input *PutBucketLifecycleInput) (*PutBucketLifecycleOutput, error) { - req, out := c.PutBucketLifecycleRequest(input) - return out, req.Send() -} - -// PutBucketLifecycleWithContext is the same as PutBucketLifecycle with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLifecycle 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 *S3) PutBucketLifecycleWithContext(ctx aws.Context, input *PutBucketLifecycleInput, opts ...request.Option) (*PutBucketLifecycleOutput, error) { - req, out := c.PutBucketLifecycleRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLifecycleConfiguration = "PutBucketLifecycleConfiguration" - -// PutBucketLifecycleConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLifecycleConfiguration 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 PutBucketLifecycleConfiguration for more information on using the PutBucketLifecycleConfiguration -// 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 PutBucketLifecycleConfigurationRequest method. -// req, resp := client.PutBucketLifecycleConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration -func (c *S3) PutBucketLifecycleConfigurationRequest(input *PutBucketLifecycleConfigurationInput) (req *request.Request, output *PutBucketLifecycleConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketLifecycleConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?lifecycle", - } - - if input == nil { - input = &PutBucketLifecycleConfigurationInput{} - } - - output = &PutBucketLifecycleConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketLifecycleConfiguration API operation for Amazon Simple Storage Service. -// -// Sets lifecycle configuration for your bucket. If a lifecycle configuration -// exists, it replaces it. -// -// 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 Simple Storage Service's -// API operation PutBucketLifecycleConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfiguration -func (c *S3) PutBucketLifecycleConfiguration(input *PutBucketLifecycleConfigurationInput) (*PutBucketLifecycleConfigurationOutput, error) { - req, out := c.PutBucketLifecycleConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketLifecycleConfigurationWithContext is the same as PutBucketLifecycleConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLifecycleConfiguration 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 *S3) PutBucketLifecycleConfigurationWithContext(ctx aws.Context, input *PutBucketLifecycleConfigurationInput, opts ...request.Option) (*PutBucketLifecycleConfigurationOutput, error) { - req, out := c.PutBucketLifecycleConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketLogging = "PutBucketLogging" - -// PutBucketLoggingRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketLogging 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 PutBucketLogging for more information on using the PutBucketLogging -// 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 PutBucketLoggingRequest method. -// req, resp := client.PutBucketLoggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging -func (c *S3) PutBucketLoggingRequest(input *PutBucketLoggingInput) (req *request.Request, output *PutBucketLoggingOutput) { - op := &request.Operation{ - Name: opPutBucketLogging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?logging", - } - - if input == nil { - input = &PutBucketLoggingInput{} - } - - output = &PutBucketLoggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketLogging API operation for Amazon Simple Storage Service. -// -// Set the logging parameters for a bucket and to specify permissions for who -// can view and modify the logging parameters. To set the logging status of -// a bucket, you must be the bucket owner. -// -// 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 Simple Storage Service's -// API operation PutBucketLogging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLogging -func (c *S3) PutBucketLogging(input *PutBucketLoggingInput) (*PutBucketLoggingOutput, error) { - req, out := c.PutBucketLoggingRequest(input) - return out, req.Send() -} - -// PutBucketLoggingWithContext is the same as PutBucketLogging with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketLogging 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 *S3) PutBucketLoggingWithContext(ctx aws.Context, input *PutBucketLoggingInput, opts ...request.Option) (*PutBucketLoggingOutput, error) { - req, out := c.PutBucketLoggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketMetricsConfiguration = "PutBucketMetricsConfiguration" - -// PutBucketMetricsConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketMetricsConfiguration 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 PutBucketMetricsConfiguration for more information on using the PutBucketMetricsConfiguration -// 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 PutBucketMetricsConfigurationRequest method. -// req, resp := client.PutBucketMetricsConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration -func (c *S3) PutBucketMetricsConfigurationRequest(input *PutBucketMetricsConfigurationInput) (req *request.Request, output *PutBucketMetricsConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketMetricsConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?metrics", - } - - if input == nil { - input = &PutBucketMetricsConfigurationInput{} - } - - output = &PutBucketMetricsConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketMetricsConfiguration API operation for Amazon Simple Storage Service. -// -// Sets a metrics configuration (specified by the metrics configuration ID) -// for the bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketMetricsConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfiguration -func (c *S3) PutBucketMetricsConfiguration(input *PutBucketMetricsConfigurationInput) (*PutBucketMetricsConfigurationOutput, error) { - req, out := c.PutBucketMetricsConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketMetricsConfigurationWithContext is the same as PutBucketMetricsConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketMetricsConfiguration 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 *S3) PutBucketMetricsConfigurationWithContext(ctx aws.Context, input *PutBucketMetricsConfigurationInput, opts ...request.Option) (*PutBucketMetricsConfigurationOutput, error) { - req, out := c.PutBucketMetricsConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketNotification = "PutBucketNotification" - -// PutBucketNotificationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketNotification 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 PutBucketNotification for more information on using the PutBucketNotification -// 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 PutBucketNotificationRequest method. -// req, resp := client.PutBucketNotificationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification -func (c *S3) PutBucketNotificationRequest(input *PutBucketNotificationInput) (req *request.Request, output *PutBucketNotificationOutput) { - if c.Client.Config.Logger != nil { - c.Client.Config.Logger.Log("This operation, PutBucketNotification, has been deprecated") - } - op := &request.Operation{ - Name: opPutBucketNotification, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &PutBucketNotificationInput{} - } - - output = &PutBucketNotificationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketNotification API operation for Amazon Simple Storage Service. -// -// Deprecated, see the PutBucketNotificationConfiguraiton operation. -// -// 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 Simple Storage Service's -// API operation PutBucketNotification for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotification -func (c *S3) PutBucketNotification(input *PutBucketNotificationInput) (*PutBucketNotificationOutput, error) { - req, out := c.PutBucketNotificationRequest(input) - return out, req.Send() -} - -// PutBucketNotificationWithContext is the same as PutBucketNotification with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketNotification 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 *S3) PutBucketNotificationWithContext(ctx aws.Context, input *PutBucketNotificationInput, opts ...request.Option) (*PutBucketNotificationOutput, error) { - req, out := c.PutBucketNotificationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketNotificationConfiguration = "PutBucketNotificationConfiguration" - -// PutBucketNotificationConfigurationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketNotificationConfiguration 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 PutBucketNotificationConfiguration for more information on using the PutBucketNotificationConfiguration -// 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 PutBucketNotificationConfigurationRequest method. -// req, resp := client.PutBucketNotificationConfigurationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration -func (c *S3) PutBucketNotificationConfigurationRequest(input *PutBucketNotificationConfigurationInput) (req *request.Request, output *PutBucketNotificationConfigurationOutput) { - op := &request.Operation{ - Name: opPutBucketNotificationConfiguration, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?notification", - } - - if input == nil { - input = &PutBucketNotificationConfigurationInput{} - } - - output = &PutBucketNotificationConfigurationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketNotificationConfiguration API operation for Amazon Simple Storage Service. -// -// Enables notifications of specified events for a bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketNotificationConfiguration for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfiguration -func (c *S3) PutBucketNotificationConfiguration(input *PutBucketNotificationConfigurationInput) (*PutBucketNotificationConfigurationOutput, error) { - req, out := c.PutBucketNotificationConfigurationRequest(input) - return out, req.Send() -} - -// PutBucketNotificationConfigurationWithContext is the same as PutBucketNotificationConfiguration with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketNotificationConfiguration 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 *S3) PutBucketNotificationConfigurationWithContext(ctx aws.Context, input *PutBucketNotificationConfigurationInput, opts ...request.Option) (*PutBucketNotificationConfigurationOutput, error) { - req, out := c.PutBucketNotificationConfigurationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketPolicy = "PutBucketPolicy" - -// PutBucketPolicyRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketPolicy 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 PutBucketPolicy for more information on using the PutBucketPolicy -// 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 PutBucketPolicyRequest method. -// req, resp := client.PutBucketPolicyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy -func (c *S3) PutBucketPolicyRequest(input *PutBucketPolicyInput) (req *request.Request, output *PutBucketPolicyOutput) { - op := &request.Operation{ - Name: opPutBucketPolicy, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?policy", - } - - if input == nil { - input = &PutBucketPolicyInput{} - } - - output = &PutBucketPolicyOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketPolicy API operation for Amazon Simple Storage Service. -// -// Replaces a policy on a bucket. If the bucket already has a policy, the one -// in this request completely replaces it. -// -// 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 Simple Storage Service's -// API operation PutBucketPolicy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicy -func (c *S3) PutBucketPolicy(input *PutBucketPolicyInput) (*PutBucketPolicyOutput, error) { - req, out := c.PutBucketPolicyRequest(input) - return out, req.Send() -} - -// PutBucketPolicyWithContext is the same as PutBucketPolicy with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketPolicy 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 *S3) PutBucketPolicyWithContext(ctx aws.Context, input *PutBucketPolicyInput, opts ...request.Option) (*PutBucketPolicyOutput, error) { - req, out := c.PutBucketPolicyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketReplication = "PutBucketReplication" - -// PutBucketReplicationRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketReplication 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 PutBucketReplication for more information on using the PutBucketReplication -// 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 PutBucketReplicationRequest method. -// req, resp := client.PutBucketReplicationRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication -func (c *S3) PutBucketReplicationRequest(input *PutBucketReplicationInput) (req *request.Request, output *PutBucketReplicationOutput) { - op := &request.Operation{ - Name: opPutBucketReplication, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?replication", - } - - if input == nil { - input = &PutBucketReplicationInput{} - } - - output = &PutBucketReplicationOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketReplication API operation for Amazon Simple Storage Service. -// -// Creates a new replication configuration (or replaces an existing one, if -// present). -// -// 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 Simple Storage Service's -// API operation PutBucketReplication for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplication -func (c *S3) PutBucketReplication(input *PutBucketReplicationInput) (*PutBucketReplicationOutput, error) { - req, out := c.PutBucketReplicationRequest(input) - return out, req.Send() -} - -// PutBucketReplicationWithContext is the same as PutBucketReplication with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketReplication 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 *S3) PutBucketReplicationWithContext(ctx aws.Context, input *PutBucketReplicationInput, opts ...request.Option) (*PutBucketReplicationOutput, error) { - req, out := c.PutBucketReplicationRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketRequestPayment = "PutBucketRequestPayment" - -// PutBucketRequestPaymentRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketRequestPayment 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 PutBucketRequestPayment for more information on using the PutBucketRequestPayment -// 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 PutBucketRequestPaymentRequest method. -// req, resp := client.PutBucketRequestPaymentRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment -func (c *S3) PutBucketRequestPaymentRequest(input *PutBucketRequestPaymentInput) (req *request.Request, output *PutBucketRequestPaymentOutput) { - op := &request.Operation{ - Name: opPutBucketRequestPayment, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?requestPayment", - } - - if input == nil { - input = &PutBucketRequestPaymentInput{} - } - - output = &PutBucketRequestPaymentOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketRequestPayment API operation for Amazon Simple Storage Service. -// -// Sets the request payment configuration for a bucket. By default, the bucket -// owner pays for downloads from the bucket. This configuration parameter enables -// the bucket owner (only) to specify that the person requesting the download -// will be charged for the download. Documentation on requester pays buckets -// can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/RequesterPaysBuckets.html -// -// 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 Simple Storage Service's -// API operation PutBucketRequestPayment for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPayment -func (c *S3) PutBucketRequestPayment(input *PutBucketRequestPaymentInput) (*PutBucketRequestPaymentOutput, error) { - req, out := c.PutBucketRequestPaymentRequest(input) - return out, req.Send() -} - -// PutBucketRequestPaymentWithContext is the same as PutBucketRequestPayment with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketRequestPayment 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 *S3) PutBucketRequestPaymentWithContext(ctx aws.Context, input *PutBucketRequestPaymentInput, opts ...request.Option) (*PutBucketRequestPaymentOutput, error) { - req, out := c.PutBucketRequestPaymentRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketTagging = "PutBucketTagging" - -// PutBucketTaggingRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketTagging 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 PutBucketTagging for more information on using the PutBucketTagging -// 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 PutBucketTaggingRequest method. -// req, resp := client.PutBucketTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging -func (c *S3) PutBucketTaggingRequest(input *PutBucketTaggingInput) (req *request.Request, output *PutBucketTaggingOutput) { - op := &request.Operation{ - Name: opPutBucketTagging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?tagging", - } - - if input == nil { - input = &PutBucketTaggingInput{} - } - - output = &PutBucketTaggingOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketTagging API operation for Amazon Simple Storage Service. -// -// Sets the tags for a bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTagging -func (c *S3) PutBucketTagging(input *PutBucketTaggingInput) (*PutBucketTaggingOutput, error) { - req, out := c.PutBucketTaggingRequest(input) - return out, req.Send() -} - -// PutBucketTaggingWithContext is the same as PutBucketTagging with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketTagging 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 *S3) PutBucketTaggingWithContext(ctx aws.Context, input *PutBucketTaggingInput, opts ...request.Option) (*PutBucketTaggingOutput, error) { - req, out := c.PutBucketTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketVersioning = "PutBucketVersioning" - -// PutBucketVersioningRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketVersioning 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 PutBucketVersioning for more information on using the PutBucketVersioning -// 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 PutBucketVersioningRequest method. -// req, resp := client.PutBucketVersioningRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning -func (c *S3) PutBucketVersioningRequest(input *PutBucketVersioningInput) (req *request.Request, output *PutBucketVersioningOutput) { - op := &request.Operation{ - Name: opPutBucketVersioning, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?versioning", - } - - if input == nil { - input = &PutBucketVersioningInput{} - } - - output = &PutBucketVersioningOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketVersioning API operation for Amazon Simple Storage Service. -// -// Sets the versioning state of an existing bucket. To set the versioning state, -// you must be the bucket owner. -// -// 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 Simple Storage Service's -// API operation PutBucketVersioning for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioning -func (c *S3) PutBucketVersioning(input *PutBucketVersioningInput) (*PutBucketVersioningOutput, error) { - req, out := c.PutBucketVersioningRequest(input) - return out, req.Send() -} - -// PutBucketVersioningWithContext is the same as PutBucketVersioning with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketVersioning 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 *S3) PutBucketVersioningWithContext(ctx aws.Context, input *PutBucketVersioningInput, opts ...request.Option) (*PutBucketVersioningOutput, error) { - req, out := c.PutBucketVersioningRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutBucketWebsite = "PutBucketWebsite" - -// PutBucketWebsiteRequest generates a "aws/request.Request" representing the -// client's request for the PutBucketWebsite 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 PutBucketWebsite for more information on using the PutBucketWebsite -// 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 PutBucketWebsiteRequest method. -// req, resp := client.PutBucketWebsiteRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite -func (c *S3) PutBucketWebsiteRequest(input *PutBucketWebsiteInput) (req *request.Request, output *PutBucketWebsiteOutput) { - op := &request.Operation{ - Name: opPutBucketWebsite, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}?website", - } - - if input == nil { - input = &PutBucketWebsiteInput{} - } - - output = &PutBucketWebsiteOutput{} - req = c.newRequest(op, input, output) - req.Handlers.Unmarshal.Remove(restxml.UnmarshalHandler) - req.Handlers.Unmarshal.PushBackNamed(protocol.UnmarshalDiscardBodyHandler) - return -} - -// PutBucketWebsite API operation for Amazon Simple Storage Service. -// -// Set the website configuration for a bucket. -// -// 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 Simple Storage Service's -// API operation PutBucketWebsite for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsite -func (c *S3) PutBucketWebsite(input *PutBucketWebsiteInput) (*PutBucketWebsiteOutput, error) { - req, out := c.PutBucketWebsiteRequest(input) - return out, req.Send() -} - -// PutBucketWebsiteWithContext is the same as PutBucketWebsite with the addition of -// the ability to pass a context and additional request options. -// -// See PutBucketWebsite 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 *S3) PutBucketWebsiteWithContext(ctx aws.Context, input *PutBucketWebsiteInput, opts ...request.Option) (*PutBucketWebsiteOutput, error) { - req, out := c.PutBucketWebsiteRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObject = "PutObject" - -// PutObjectRequest generates a "aws/request.Request" representing the -// client's request for the PutObject 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 PutObject for more information on using the PutObject -// 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 PutObjectRequest method. -// req, resp := client.PutObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject -func (c *S3) PutObjectRequest(input *PutObjectInput) (req *request.Request, output *PutObjectOutput) { - op := &request.Operation{ - Name: opPutObject, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &PutObjectInput{} - } - - output = &PutObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// PutObject API operation for Amazon Simple Storage Service. -// -// Adds an object to a bucket. -// -// 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 Simple Storage Service's -// API operation PutObject for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObject -func (c *S3) PutObject(input *PutObjectInput) (*PutObjectOutput, error) { - req, out := c.PutObjectRequest(input) - return out, req.Send() -} - -// PutObjectWithContext is the same as PutObject with the addition of -// the ability to pass a context and additional request options. -// -// See PutObject 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 *S3) PutObjectWithContext(ctx aws.Context, input *PutObjectInput, opts ...request.Option) (*PutObjectOutput, error) { - req, out := c.PutObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectAcl = "PutObjectAcl" - -// PutObjectAclRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectAcl 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 PutObjectAcl for more information on using the PutObjectAcl -// 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 PutObjectAclRequest method. -// req, resp := client.PutObjectAclRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl -func (c *S3) PutObjectAclRequest(input *PutObjectAclInput) (req *request.Request, output *PutObjectAclOutput) { - op := &request.Operation{ - Name: opPutObjectAcl, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?acl", - } - - if input == nil { - input = &PutObjectAclInput{} - } - - output = &PutObjectAclOutput{} - req = c.newRequest(op, input, output) - return -} - -// PutObjectAcl API operation for Amazon Simple Storage Service. -// -// uses the acl subresource to set the access control list (ACL) permissions -// for an object that already exists in a bucket -// -// 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 Simple Storage Service's -// API operation PutObjectAcl for usage and error information. -// -// Returned Error Codes: -// * ErrCodeNoSuchKey "NoSuchKey" -// The specified key does not exist. -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAcl -func (c *S3) PutObjectAcl(input *PutObjectAclInput) (*PutObjectAclOutput, error) { - req, out := c.PutObjectAclRequest(input) - return out, req.Send() -} - -// PutObjectAclWithContext is the same as PutObjectAcl with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectAcl 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 *S3) PutObjectAclWithContext(ctx aws.Context, input *PutObjectAclInput, opts ...request.Option) (*PutObjectAclOutput, error) { - req, out := c.PutObjectAclRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opPutObjectTagging = "PutObjectTagging" - -// PutObjectTaggingRequest generates a "aws/request.Request" representing the -// client's request for the PutObjectTagging 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 PutObjectTagging for more information on using the PutObjectTagging -// 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 PutObjectTaggingRequest method. -// req, resp := client.PutObjectTaggingRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging -func (c *S3) PutObjectTaggingRequest(input *PutObjectTaggingInput) (req *request.Request, output *PutObjectTaggingOutput) { - op := &request.Operation{ - Name: opPutObjectTagging, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}?tagging", - } - - if input == nil { - input = &PutObjectTaggingInput{} - } - - output = &PutObjectTaggingOutput{} - req = c.newRequest(op, input, output) - return -} - -// PutObjectTagging API operation for Amazon Simple Storage Service. -// -// Sets the supplied tag-set to an object that already exists in a bucket -// -// 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 Simple Storage Service's -// API operation PutObjectTagging for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTagging -func (c *S3) PutObjectTagging(input *PutObjectTaggingInput) (*PutObjectTaggingOutput, error) { - req, out := c.PutObjectTaggingRequest(input) - return out, req.Send() -} - -// PutObjectTaggingWithContext is the same as PutObjectTagging with the addition of -// the ability to pass a context and additional request options. -// -// See PutObjectTagging 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 *S3) PutObjectTaggingWithContext(ctx aws.Context, input *PutObjectTaggingInput, opts ...request.Option) (*PutObjectTaggingOutput, error) { - req, out := c.PutObjectTaggingRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opRestoreObject = "RestoreObject" - -// RestoreObjectRequest generates a "aws/request.Request" representing the -// client's request for the RestoreObject 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 RestoreObject for more information on using the RestoreObject -// 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 RestoreObjectRequest method. -// req, resp := client.RestoreObjectRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject -func (c *S3) RestoreObjectRequest(input *RestoreObjectInput) (req *request.Request, output *RestoreObjectOutput) { - op := &request.Operation{ - Name: opRestoreObject, - HTTPMethod: "POST", - HTTPPath: "/{Bucket}/{Key+}?restore", - } - - if input == nil { - input = &RestoreObjectInput{} - } - - output = &RestoreObjectOutput{} - req = c.newRequest(op, input, output) - return -} - -// RestoreObject API operation for Amazon Simple Storage Service. -// -// Restores an archived copy of an object back into 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 Amazon Simple Storage Service's -// API operation RestoreObject for usage and error information. -// -// Returned Error Codes: -// * ErrCodeObjectAlreadyInActiveTierError "ObjectAlreadyInActiveTierError" -// This operation is not allowed against this storage tier -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObject -func (c *S3) RestoreObject(input *RestoreObjectInput) (*RestoreObjectOutput, error) { - req, out := c.RestoreObjectRequest(input) - return out, req.Send() -} - -// RestoreObjectWithContext is the same as RestoreObject with the addition of -// the ability to pass a context and additional request options. -// -// See RestoreObject 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 *S3) RestoreObjectWithContext(ctx aws.Context, input *RestoreObjectInput, opts ...request.Option) (*RestoreObjectOutput, error) { - req, out := c.RestoreObjectRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUploadPart = "UploadPart" - -// UploadPartRequest generates a "aws/request.Request" representing the -// client's request for the UploadPart 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 UploadPart for more information on using the UploadPart -// 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 UploadPartRequest method. -// req, resp := client.UploadPartRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart -func (c *S3) UploadPartRequest(input *UploadPartInput) (req *request.Request, output *UploadPartOutput) { - op := &request.Operation{ - Name: opUploadPart, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &UploadPartInput{} - } - - output = &UploadPartOutput{} - req = c.newRequest(op, input, output) - return -} - -// UploadPart API operation for Amazon Simple Storage Service. -// -// Uploads a part in a multipart upload. -// -// Note: After you initiate multipart upload and upload one or more parts, you -// must either complete or abort multipart upload in order to stop getting charged -// for storage of the uploaded parts. Only after you either complete or abort -// multipart upload, Amazon S3 frees up the parts storage and stops charging -// you for the parts storage. -// -// 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 Simple Storage Service's -// API operation UploadPart for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPart -func (c *S3) UploadPart(input *UploadPartInput) (*UploadPartOutput, error) { - req, out := c.UploadPartRequest(input) - return out, req.Send() -} - -// UploadPartWithContext is the same as UploadPart with the addition of -// the ability to pass a context and additional request options. -// -// See UploadPart 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 *S3) UploadPartWithContext(ctx aws.Context, input *UploadPartInput, opts ...request.Option) (*UploadPartOutput, error) { - req, out := c.UploadPartRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -const opUploadPartCopy = "UploadPartCopy" - -// UploadPartCopyRequest generates a "aws/request.Request" representing the -// client's request for the UploadPartCopy 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 UploadPartCopy for more information on using the UploadPartCopy -// 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 UploadPartCopyRequest method. -// req, resp := client.UploadPartCopyRequest(params) -// -// err := req.Send() -// if err == nil { // resp is now filled -// fmt.Println(resp) -// } -// -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy -func (c *S3) UploadPartCopyRequest(input *UploadPartCopyInput) (req *request.Request, output *UploadPartCopyOutput) { - op := &request.Operation{ - Name: opUploadPartCopy, - HTTPMethod: "PUT", - HTTPPath: "/{Bucket}/{Key+}", - } - - if input == nil { - input = &UploadPartCopyInput{} - } - - output = &UploadPartCopyOutput{} - req = c.newRequest(op, input, output) - return -} - -// UploadPartCopy API operation for Amazon Simple Storage Service. -// -// Uploads a part by copying data from an existing object as data source. -// -// 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 Simple Storage Service's -// API operation UploadPartCopy for usage and error information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopy -func (c *S3) UploadPartCopy(input *UploadPartCopyInput) (*UploadPartCopyOutput, error) { - req, out := c.UploadPartCopyRequest(input) - return out, req.Send() -} - -// UploadPartCopyWithContext is the same as UploadPartCopy with the addition of -// the ability to pass a context and additional request options. -// -// See UploadPartCopy 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 *S3) UploadPartCopyWithContext(ctx aws.Context, input *UploadPartCopyInput, opts ...request.Option) (*UploadPartCopyOutput, error) { - req, out := c.UploadPartCopyRequest(input) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return out, req.Send() -} - -// Specifies the days since the initiation of an Incomplete Multipart Upload -// that Lifecycle will wait before permanently removing all parts of the upload. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortIncompleteMultipartUpload -type AbortIncompleteMultipartUpload struct { - _ struct{} `type:"structure"` - - // Indicates the number of days that must pass since initiation for Lifecycle - // to abort an Incomplete Multipart Upload. - DaysAfterInitiation *int64 `type:"integer"` -} - -// String returns the string representation -func (s AbortIncompleteMultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortIncompleteMultipartUpload) GoString() string { - return s.String() -} - -// SetDaysAfterInitiation sets the DaysAfterInitiation field's value. -func (s *AbortIncompleteMultipartUpload) SetDaysAfterInitiation(v int64) *AbortIncompleteMultipartUpload { - s.DaysAfterInitiation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUploadRequest -type AbortMultipartUploadInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s AbortMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AbortMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AbortMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *AbortMultipartUploadInput) SetBucket(v string) *AbortMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *AbortMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *AbortMultipartUploadInput) SetKey(v string) *AbortMultipartUploadInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *AbortMultipartUploadInput) SetRequestPayer(v string) *AbortMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *AbortMultipartUploadInput) SetUploadId(v string) *AbortMultipartUploadInput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AbortMultipartUploadOutput -type AbortMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s AbortMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AbortMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *AbortMultipartUploadOutput) SetRequestCharged(v string) *AbortMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccelerateConfiguration -type AccelerateConfiguration struct { - _ struct{} `type:"structure"` - - // The accelerate configuration of the bucket. - Status *string `type:"string" enum:"BucketAccelerateStatus"` -} - -// String returns the string representation -func (s AccelerateConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccelerateConfiguration) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *AccelerateConfiguration) SetStatus(v string) *AccelerateConfiguration { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccessControlPolicy -type AccessControlPolicy struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s AccessControlPolicy) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccessControlPolicy) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AccessControlPolicy) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AccessControlPolicy"} - if s.Grants != nil { - for i, v := range s.Grants { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Grants", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrants sets the Grants field's value. -func (s *AccessControlPolicy) SetGrants(v []*Grant) *AccessControlPolicy { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *AccessControlPolicy) SetOwner(v *Owner) *AccessControlPolicy { - s.Owner = v - return s -} - -// Container for information regarding the access control for replicas. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AccessControlTranslation -type AccessControlTranslation struct { - _ struct{} `type:"structure"` - - // The override value for the owner of the replica object. - // - // Owner is a required field - Owner *string `type:"string" required:"true" enum:"OwnerOverride"` -} - -// String returns the string representation -func (s AccessControlTranslation) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AccessControlTranslation) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AccessControlTranslation) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AccessControlTranslation"} - if s.Owner == nil { - invalidParams.Add(request.NewErrParamRequired("Owner")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetOwner sets the Owner field's value. -func (s *AccessControlTranslation) SetOwner(v string) *AccessControlTranslation { - s.Owner = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsAndOperator -type AnalyticsAndOperator struct { - _ struct{} `type:"structure"` - - // The prefix to use when evaluating an AND predicate. - Prefix *string `type:"string"` - - // The list of tags to use when evaluating an AND predicate. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s AnalyticsAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsAndOperator) SetPrefix(v string) *AnalyticsAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *AnalyticsAndOperator) SetTags(v []*Tag) *AnalyticsAndOperator { - s.Tags = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsConfiguration -type AnalyticsConfiguration struct { - _ struct{} `type:"structure"` - - // The filter used to describe a set of objects for analyses. A filter must - // have exactly one prefix, one tag, or one conjunction (AnalyticsAndOperator). - // If no filter is provided, all objects will be considered in any analysis. - Filter *AnalyticsFilter `type:"structure"` - - // The identifier used to represent an analytics configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` - - // If present, it indicates that data related to access patterns will be collected - // and made available to analyze the tradeoffs between different storage classes. - // - // StorageClassAnalysis is a required field - StorageClassAnalysis *StorageClassAnalysis `type:"structure" required:"true"` -} - -// String returns the string representation -func (s AnalyticsConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsConfiguration"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.StorageClassAnalysis == nil { - invalidParams.Add(request.NewErrParamRequired("StorageClassAnalysis")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - if s.StorageClassAnalysis != nil { - if err := s.StorageClassAnalysis.Validate(); err != nil { - invalidParams.AddNested("StorageClassAnalysis", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFilter sets the Filter field's value. -func (s *AnalyticsConfiguration) SetFilter(v *AnalyticsFilter) *AnalyticsConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *AnalyticsConfiguration) SetId(v string) *AnalyticsConfiguration { - s.Id = &v - return s -} - -// SetStorageClassAnalysis sets the StorageClassAnalysis field's value. -func (s *AnalyticsConfiguration) SetStorageClassAnalysis(v *StorageClassAnalysis) *AnalyticsConfiguration { - s.StorageClassAnalysis = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsExportDestination -type AnalyticsExportDestination struct { - _ struct{} `type:"structure"` - - // A destination signifying output to an S3 bucket. - // - // S3BucketDestination is a required field - S3BucketDestination *AnalyticsS3BucketDestination `type:"structure" required:"true"` -} - -// String returns the string representation -func (s AnalyticsExportDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsExportDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsExportDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsExportDestination"} - if s.S3BucketDestination == nil { - invalidParams.Add(request.NewErrParamRequired("S3BucketDestination")) - } - if s.S3BucketDestination != nil { - if err := s.S3BucketDestination.Validate(); err != nil { - invalidParams.AddNested("S3BucketDestination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3BucketDestination sets the S3BucketDestination field's value. -func (s *AnalyticsExportDestination) SetS3BucketDestination(v *AnalyticsS3BucketDestination) *AnalyticsExportDestination { - s.S3BucketDestination = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsFilter -type AnalyticsFilter struct { - _ struct{} `type:"structure"` - - // A conjunction (logical AND) of predicates, which is used in evaluating an - // analytics filter. The operator must have at least two predicates. - And *AnalyticsAndOperator `type:"structure"` - - // The prefix to use when evaluating an analytics filter. - Prefix *string `type:"string"` - - // The tag to use when evaluating an analytics filter. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s AnalyticsFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *AnalyticsFilter) SetAnd(v *AnalyticsAndOperator) *AnalyticsFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsFilter) SetPrefix(v string) *AnalyticsFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *AnalyticsFilter) SetTag(v *Tag) *AnalyticsFilter { - s.Tag = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/AnalyticsS3BucketDestination -type AnalyticsS3BucketDestination struct { - _ struct{} `type:"structure"` - - // The Amazon resource name (ARN) of the bucket to which data is exported. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // The account ID that owns the destination bucket. If no account ID is provided, - // the owner will not be validated prior to exporting data. - BucketAccountId *string `type:"string"` - - // The file format used when exporting data to Amazon S3. - // - // Format is a required field - Format *string `type:"string" required:"true" enum:"AnalyticsS3ExportFileFormat"` - - // The prefix to use when exporting data. The exported data begins with this - // prefix. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s AnalyticsS3BucketDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s AnalyticsS3BucketDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *AnalyticsS3BucketDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "AnalyticsS3BucketDestination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Format == nil { - invalidParams.Add(request.NewErrParamRequired("Format")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *AnalyticsS3BucketDestination) SetBucket(v string) *AnalyticsS3BucketDestination { - s.Bucket = &v - return s -} - -func (s *AnalyticsS3BucketDestination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBucketAccountId sets the BucketAccountId field's value. -func (s *AnalyticsS3BucketDestination) SetBucketAccountId(v string) *AnalyticsS3BucketDestination { - s.BucketAccountId = &v - return s -} - -// SetFormat sets the Format field's value. -func (s *AnalyticsS3BucketDestination) SetFormat(v string) *AnalyticsS3BucketDestination { - s.Format = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *AnalyticsS3BucketDestination) SetPrefix(v string) *AnalyticsS3BucketDestination { - s.Prefix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Bucket -type Bucket struct { - _ struct{} `type:"structure"` - - // Date the bucket was created. - CreationDate *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // The name of the bucket. - Name *string `type:"string"` -} - -// String returns the string representation -func (s Bucket) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Bucket) GoString() string { - return s.String() -} - -// SetCreationDate sets the CreationDate field's value. -func (s *Bucket) SetCreationDate(v time.Time) *Bucket { - s.CreationDate = &v - return s -} - -// SetName sets the Name field's value. -func (s *Bucket) SetName(v string) *Bucket { - s.Name = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketLifecycleConfiguration -type BucketLifecycleConfiguration struct { - _ struct{} `type:"structure"` - - // Rules is a required field - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s BucketLifecycleConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s BucketLifecycleConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BucketLifecycleConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BucketLifecycleConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *BucketLifecycleConfiguration) SetRules(v []*LifecycleRule) *BucketLifecycleConfiguration { - s.Rules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/BucketLoggingStatus -type BucketLoggingStatus struct { - _ struct{} `type:"structure"` - - LoggingEnabled *LoggingEnabled `type:"structure"` -} - -// String returns the string representation -func (s BucketLoggingStatus) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s BucketLoggingStatus) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *BucketLoggingStatus) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "BucketLoggingStatus"} - if s.LoggingEnabled != nil { - if err := s.LoggingEnabled.Validate(); err != nil { - invalidParams.AddNested("LoggingEnabled", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLoggingEnabled sets the LoggingEnabled field's value. -func (s *BucketLoggingStatus) SetLoggingEnabled(v *LoggingEnabled) *BucketLoggingStatus { - s.LoggingEnabled = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CORSConfiguration -type CORSConfiguration struct { - _ struct{} `type:"structure"` - - // CORSRules is a required field - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s CORSConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CORSConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CORSConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CORSConfiguration"} - if s.CORSRules == nil { - invalidParams.Add(request.NewErrParamRequired("CORSRules")) - } - if s.CORSRules != nil { - for i, v := range s.CORSRules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "CORSRules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCORSRules sets the CORSRules field's value. -func (s *CORSConfiguration) SetCORSRules(v []*CORSRule) *CORSConfiguration { - s.CORSRules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CORSRule -type CORSRule struct { - _ struct{} `type:"structure"` - - // Specifies which headers are allowed in a pre-flight OPTIONS request. - AllowedHeaders []*string `locationName:"AllowedHeader" type:"list" flattened:"true"` - - // Identifies HTTP methods that the domain/origin specified in the rule is allowed - // to execute. - // - // AllowedMethods is a required field - AllowedMethods []*string `locationName:"AllowedMethod" type:"list" flattened:"true" required:"true"` - - // One or more origins you want customers to be able to access the bucket from. - // - // AllowedOrigins is a required field - AllowedOrigins []*string `locationName:"AllowedOrigin" type:"list" flattened:"true" required:"true"` - - // One or more headers in the response that you want customers to be able to - // access from their applications (for example, from a JavaScript XMLHttpRequest - // object). - ExposeHeaders []*string `locationName:"ExposeHeader" type:"list" flattened:"true"` - - // The time in seconds that your browser is to cache the preflight response - // for the specified resource. - MaxAgeSeconds *int64 `type:"integer"` -} - -// String returns the string representation -func (s CORSRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CORSRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CORSRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CORSRule"} - if s.AllowedMethods == nil { - invalidParams.Add(request.NewErrParamRequired("AllowedMethods")) - } - if s.AllowedOrigins == nil { - invalidParams.Add(request.NewErrParamRequired("AllowedOrigins")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAllowedHeaders sets the AllowedHeaders field's value. -func (s *CORSRule) SetAllowedHeaders(v []*string) *CORSRule { - s.AllowedHeaders = v - return s -} - -// SetAllowedMethods sets the AllowedMethods field's value. -func (s *CORSRule) SetAllowedMethods(v []*string) *CORSRule { - s.AllowedMethods = v - return s -} - -// SetAllowedOrigins sets the AllowedOrigins field's value. -func (s *CORSRule) SetAllowedOrigins(v []*string) *CORSRule { - s.AllowedOrigins = v - return s -} - -// SetExposeHeaders sets the ExposeHeaders field's value. -func (s *CORSRule) SetExposeHeaders(v []*string) *CORSRule { - s.ExposeHeaders = v - return s -} - -// SetMaxAgeSeconds sets the MaxAgeSeconds field's value. -func (s *CORSRule) SetMaxAgeSeconds(v int64) *CORSRule { - s.MaxAgeSeconds = &v - return s -} - -// Describes how a CSV-formatted input object is formatted. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CSVInput -type CSVInput struct { - _ struct{} `type:"structure"` - - // Single character used to indicate a row should be ignored when present at - // the start of a row. - Comments *string `type:"string"` - - // Value used to separate individual fields in a record. - FieldDelimiter *string `type:"string"` - - // Describes the first line of input. Valid values: None, Ignore, Use. - FileHeaderInfo *string `type:"string" enum:"FileHeaderInfo"` - - // Value used for escaping where the field delimiter is part of the value. - QuoteCharacter *string `type:"string"` - - // Single character used for escaping the quote character inside an already - // escaped value. - QuoteEscapeCharacter *string `type:"string"` - - // Value used to separate individual records. - RecordDelimiter *string `type:"string"` -} - -// String returns the string representation -func (s CSVInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CSVInput) GoString() string { - return s.String() -} - -// SetComments sets the Comments field's value. -func (s *CSVInput) SetComments(v string) *CSVInput { - s.Comments = &v - return s -} - -// SetFieldDelimiter sets the FieldDelimiter field's value. -func (s *CSVInput) SetFieldDelimiter(v string) *CSVInput { - s.FieldDelimiter = &v - return s -} - -// SetFileHeaderInfo sets the FileHeaderInfo field's value. -func (s *CSVInput) SetFileHeaderInfo(v string) *CSVInput { - s.FileHeaderInfo = &v - return s -} - -// SetQuoteCharacter sets the QuoteCharacter field's value. -func (s *CSVInput) SetQuoteCharacter(v string) *CSVInput { - s.QuoteCharacter = &v - return s -} - -// SetQuoteEscapeCharacter sets the QuoteEscapeCharacter field's value. -func (s *CSVInput) SetQuoteEscapeCharacter(v string) *CSVInput { - s.QuoteEscapeCharacter = &v - return s -} - -// SetRecordDelimiter sets the RecordDelimiter field's value. -func (s *CSVInput) SetRecordDelimiter(v string) *CSVInput { - s.RecordDelimiter = &v - return s -} - -// Describes how CSV-formatted results are formatted. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CSVOutput -type CSVOutput struct { - _ struct{} `type:"structure"` - - // Value used to separate individual fields in a record. - FieldDelimiter *string `type:"string"` - - // Value used for escaping where the field delimiter is part of the value. - QuoteCharacter *string `type:"string"` - - // Single character used for escaping the quote character inside an already - // escaped value. - QuoteEscapeCharacter *string `type:"string"` - - // Indicates whether or not all output fields should be quoted. - QuoteFields *string `type:"string" enum:"QuoteFields"` - - // Value used to separate individual records. - RecordDelimiter *string `type:"string"` -} - -// String returns the string representation -func (s CSVOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CSVOutput) GoString() string { - return s.String() -} - -// SetFieldDelimiter sets the FieldDelimiter field's value. -func (s *CSVOutput) SetFieldDelimiter(v string) *CSVOutput { - s.FieldDelimiter = &v - return s -} - -// SetQuoteCharacter sets the QuoteCharacter field's value. -func (s *CSVOutput) SetQuoteCharacter(v string) *CSVOutput { - s.QuoteCharacter = &v - return s -} - -// SetQuoteEscapeCharacter sets the QuoteEscapeCharacter field's value. -func (s *CSVOutput) SetQuoteEscapeCharacter(v string) *CSVOutput { - s.QuoteEscapeCharacter = &v - return s -} - -// SetQuoteFields sets the QuoteFields field's value. -func (s *CSVOutput) SetQuoteFields(v string) *CSVOutput { - s.QuoteFields = &v - return s -} - -// SetRecordDelimiter sets the RecordDelimiter field's value. -func (s *CSVOutput) SetRecordDelimiter(v string) *CSVOutput { - s.RecordDelimiter = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CloudFunctionConfiguration -type CloudFunctionConfiguration struct { - _ struct{} `type:"structure"` - - CloudFunction *string `type:"string"` - - // Bucket event for which to send notifications. - Event *string `deprecated:"true" type:"string" enum:"Event"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - InvocationRole *string `type:"string"` -} - -// String returns the string representation -func (s CloudFunctionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CloudFunctionConfiguration) GoString() string { - return s.String() -} - -// SetCloudFunction sets the CloudFunction field's value. -func (s *CloudFunctionConfiguration) SetCloudFunction(v string) *CloudFunctionConfiguration { - s.CloudFunction = &v - return s -} - -// SetEvent sets the Event field's value. -func (s *CloudFunctionConfiguration) SetEvent(v string) *CloudFunctionConfiguration { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *CloudFunctionConfiguration) SetEvents(v []*string) *CloudFunctionConfiguration { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *CloudFunctionConfiguration) SetId(v string) *CloudFunctionConfiguration { - s.Id = &v - return s -} - -// SetInvocationRole sets the InvocationRole field's value. -func (s *CloudFunctionConfiguration) SetInvocationRole(v string) *CloudFunctionConfiguration { - s.InvocationRole = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CommonPrefix -type CommonPrefix struct { - _ struct{} `type:"structure"` - - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s CommonPrefix) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CommonPrefix) GoString() string { - return s.String() -} - -// SetPrefix sets the Prefix field's value. -func (s *CommonPrefix) SetPrefix(v string) *CommonPrefix { - s.Prefix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUploadRequest -type CompleteMultipartUploadInput struct { - _ struct{} `type:"structure" payload:"MultipartUpload"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - MultipartUpload *CompletedMultipartUpload `locationName:"CompleteMultipartUpload" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s CompleteMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompleteMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CompleteMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CompleteMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *CompleteMultipartUploadInput) SetBucket(v string) *CompleteMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *CompleteMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *CompleteMultipartUploadInput) SetKey(v string) *CompleteMultipartUploadInput { - s.Key = &v - return s -} - -// SetMultipartUpload sets the MultipartUpload field's value. -func (s *CompleteMultipartUploadInput) SetMultipartUpload(v *CompletedMultipartUpload) *CompleteMultipartUploadInput { - s.MultipartUpload = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CompleteMultipartUploadInput) SetRequestPayer(v string) *CompleteMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *CompleteMultipartUploadInput) SetUploadId(v string) *CompleteMultipartUploadInput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompleteMultipartUploadOutput -type CompleteMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - Bucket *string `type:"string"` - - // Entity tag of the object. - ETag *string `type:"string"` - - // If the object expiration is configured, this will contain the expiration - // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - Key *string `min:"1" type:"string"` - - Location *string `type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s CompleteMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompleteMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetBucket sets the Bucket field's value. -func (s *CompleteMultipartUploadOutput) SetBucket(v string) *CompleteMultipartUploadOutput { - s.Bucket = &v - return s -} - -func (s *CompleteMultipartUploadOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetETag sets the ETag field's value. -func (s *CompleteMultipartUploadOutput) SetETag(v string) *CompleteMultipartUploadOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *CompleteMultipartUploadOutput) SetExpiration(v string) *CompleteMultipartUploadOutput { - s.Expiration = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CompleteMultipartUploadOutput) SetKey(v string) *CompleteMultipartUploadOutput { - s.Key = &v - return s -} - -// SetLocation sets the Location field's value. -func (s *CompleteMultipartUploadOutput) SetLocation(v string) *CompleteMultipartUploadOutput { - s.Location = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CompleteMultipartUploadOutput) SetRequestCharged(v string) *CompleteMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CompleteMultipartUploadOutput) SetSSEKMSKeyId(v string) *CompleteMultipartUploadOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CompleteMultipartUploadOutput) SetServerSideEncryption(v string) *CompleteMultipartUploadOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *CompleteMultipartUploadOutput) SetVersionId(v string) *CompleteMultipartUploadOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompletedMultipartUpload -type CompletedMultipartUpload struct { - _ struct{} `type:"structure"` - - Parts []*CompletedPart `locationName:"Part" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s CompletedMultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompletedMultipartUpload) GoString() string { - return s.String() -} - -// SetParts sets the Parts field's value. -func (s *CompletedMultipartUpload) SetParts(v []*CompletedPart) *CompletedMultipartUpload { - s.Parts = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CompletedPart -type CompletedPart struct { - _ struct{} `type:"structure"` - - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Part number that identifies the part. This is a positive integer between - // 1 and 10,000. - PartNumber *int64 `type:"integer"` -} - -// String returns the string representation -func (s CompletedPart) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CompletedPart) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CompletedPart) SetETag(v string) *CompletedPart { - s.ETag = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *CompletedPart) SetPartNumber(v int64) *CompletedPart { - s.PartNumber = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Condition -type Condition struct { - _ struct{} `type:"structure"` - - // The HTTP error code when the redirect is applied. In the event of an error, - // if the error code equals this value, then the specified redirect is applied. - // Required when parent element Condition is specified and sibling KeyPrefixEquals - // is not specified. If both are specified, then both must be true for the redirect - // to be applied. - HttpErrorCodeReturnedEquals *string `type:"string"` - - // The object key name prefix when the redirect is applied. For example, to - // redirect requests for ExamplePage.html, the key prefix will be ExamplePage.html. - // To redirect request for all pages with the prefix docs/, the key prefix will - // be /docs, which identifies all objects in the docs/ folder. Required when - // the parent element Condition is specified and sibling HttpErrorCodeReturnedEquals - // is not specified. If both conditions are specified, both must be true for - // the redirect to be applied. - KeyPrefixEquals *string `type:"string"` -} - -// String returns the string representation -func (s Condition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Condition) GoString() string { - return s.String() -} - -// SetHttpErrorCodeReturnedEquals sets the HttpErrorCodeReturnedEquals field's value. -func (s *Condition) SetHttpErrorCodeReturnedEquals(v string) *Condition { - s.HttpErrorCodeReturnedEquals = &v - return s -} - -// SetKeyPrefixEquals sets the KeyPrefixEquals field's value. -func (s *Condition) SetKeyPrefixEquals(v string) *Condition { - s.KeyPrefixEquals = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectRequest -type CopyObjectInput struct { - _ struct{} `type:"structure"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - // - // CopySource is a required field - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Specifies the algorithm to use when decrypting the source object (e.g., AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Specifies whether the metadata is copied from the source object or replaced - // with metadata provided in the request. - MetadataDirective *string `location:"header" locationName:"x-amz-metadata-directive" type:"string" enum:"MetadataDirective"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object destination object this value must be used in - // conjunction with the TaggingDirective. The tag-set must be encoded as URL - // Query parameters - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // Specifies whether the object tag-set are copied from the source object or - // replaced with tag-set provided in the request. - TaggingDirective *string `location:"header" locationName:"x-amz-tagging-directive" type:"string" enum:"TaggingDirective"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s CopyObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CopyObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CopyObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.CopySource == nil { - invalidParams.Add(request.NewErrParamRequired("CopySource")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CopyObjectInput) SetACL(v string) *CopyObjectInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CopyObjectInput) SetBucket(v string) *CopyObjectInput { - s.Bucket = &v - return s -} - -func (s *CopyObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *CopyObjectInput) SetCacheControl(v string) *CopyObjectInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *CopyObjectInput) SetContentDisposition(v string) *CopyObjectInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *CopyObjectInput) SetContentEncoding(v string) *CopyObjectInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *CopyObjectInput) SetContentLanguage(v string) *CopyObjectInput { - s.ContentLanguage = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *CopyObjectInput) SetContentType(v string) *CopyObjectInput { - s.ContentType = &v - return s -} - -// SetCopySource sets the CopySource field's value. -func (s *CopyObjectInput) SetCopySource(v string) *CopyObjectInput { - s.CopySource = &v - return s -} - -// SetCopySourceIfMatch sets the CopySourceIfMatch field's value. -func (s *CopyObjectInput) SetCopySourceIfMatch(v string) *CopyObjectInput { - s.CopySourceIfMatch = &v - return s -} - -// SetCopySourceIfModifiedSince sets the CopySourceIfModifiedSince field's value. -func (s *CopyObjectInput) SetCopySourceIfModifiedSince(v time.Time) *CopyObjectInput { - s.CopySourceIfModifiedSince = &v - return s -} - -// SetCopySourceIfNoneMatch sets the CopySourceIfNoneMatch field's value. -func (s *CopyObjectInput) SetCopySourceIfNoneMatch(v string) *CopyObjectInput { - s.CopySourceIfNoneMatch = &v - return s -} - -// SetCopySourceIfUnmodifiedSince sets the CopySourceIfUnmodifiedSince field's value. -func (s *CopyObjectInput) SetCopySourceIfUnmodifiedSince(v time.Time) *CopyObjectInput { - s.CopySourceIfUnmodifiedSince = &v - return s -} - -// SetCopySourceSSECustomerAlgorithm sets the CopySourceSSECustomerAlgorithm field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerAlgorithm(v string) *CopyObjectInput { - s.CopySourceSSECustomerAlgorithm = &v - return s -} - -// SetCopySourceSSECustomerKey sets the CopySourceSSECustomerKey field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerKey(v string) *CopyObjectInput { - s.CopySourceSSECustomerKey = &v - return s -} - -func (s *CopyObjectInput) getCopySourceSSECustomerKey() (v string) { - if s.CopySourceSSECustomerKey == nil { - return v - } - return *s.CopySourceSSECustomerKey -} - -// SetCopySourceSSECustomerKeyMD5 sets the CopySourceSSECustomerKeyMD5 field's value. -func (s *CopyObjectInput) SetCopySourceSSECustomerKeyMD5(v string) *CopyObjectInput { - s.CopySourceSSECustomerKeyMD5 = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *CopyObjectInput) SetExpires(v time.Time) *CopyObjectInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CopyObjectInput) SetGrantFullControl(v string) *CopyObjectInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CopyObjectInput) SetGrantRead(v string) *CopyObjectInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CopyObjectInput) SetGrantReadACP(v string) *CopyObjectInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CopyObjectInput) SetGrantWriteACP(v string) *CopyObjectInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CopyObjectInput) SetKey(v string) *CopyObjectInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *CopyObjectInput) SetMetadata(v map[string]*string) *CopyObjectInput { - s.Metadata = v - return s -} - -// SetMetadataDirective sets the MetadataDirective field's value. -func (s *CopyObjectInput) SetMetadataDirective(v string) *CopyObjectInput { - s.MetadataDirective = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CopyObjectInput) SetRequestPayer(v string) *CopyObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CopyObjectInput) SetSSECustomerAlgorithm(v string) *CopyObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *CopyObjectInput) SetSSECustomerKey(v string) *CopyObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *CopyObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CopyObjectInput) SetSSECustomerKeyMD5(v string) *CopyObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CopyObjectInput) SetSSEKMSKeyId(v string) *CopyObjectInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CopyObjectInput) SetServerSideEncryption(v string) *CopyObjectInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *CopyObjectInput) SetStorageClass(v string) *CopyObjectInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *CopyObjectInput) SetTagging(v string) *CopyObjectInput { - s.Tagging = &v - return s -} - -// SetTaggingDirective sets the TaggingDirective field's value. -func (s *CopyObjectInput) SetTaggingDirective(v string) *CopyObjectInput { - s.TaggingDirective = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *CopyObjectInput) SetWebsiteRedirectLocation(v string) *CopyObjectInput { - s.WebsiteRedirectLocation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectOutput -type CopyObjectOutput struct { - _ struct{} `type:"structure" payload:"CopyObjectResult"` - - CopyObjectResult *CopyObjectResult `type:"structure"` - - CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If the object expiration is configured, the response includes this header. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version ID of the newly created copy. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s CopyObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectOutput) GoString() string { - return s.String() -} - -// SetCopyObjectResult sets the CopyObjectResult field's value. -func (s *CopyObjectOutput) SetCopyObjectResult(v *CopyObjectResult) *CopyObjectOutput { - s.CopyObjectResult = v - return s -} - -// SetCopySourceVersionId sets the CopySourceVersionId field's value. -func (s *CopyObjectOutput) SetCopySourceVersionId(v string) *CopyObjectOutput { - s.CopySourceVersionId = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *CopyObjectOutput) SetExpiration(v string) *CopyObjectOutput { - s.Expiration = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CopyObjectOutput) SetRequestCharged(v string) *CopyObjectOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CopyObjectOutput) SetSSECustomerAlgorithm(v string) *CopyObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CopyObjectOutput) SetSSECustomerKeyMD5(v string) *CopyObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CopyObjectOutput) SetSSEKMSKeyId(v string) *CopyObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CopyObjectOutput) SetServerSideEncryption(v string) *CopyObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *CopyObjectOutput) SetVersionId(v string) *CopyObjectOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyObjectResult -type CopyObjectResult struct { - _ struct{} `type:"structure"` - - ETag *string `type:"string"` - - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -// String returns the string representation -func (s CopyObjectResult) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyObjectResult) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CopyObjectResult) SetETag(v string) *CopyObjectResult { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *CopyObjectResult) SetLastModified(v time.Time) *CopyObjectResult { - s.LastModified = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CopyPartResult -type CopyPartResult struct { - _ struct{} `type:"structure"` - - // Entity tag of the object. - ETag *string `type:"string"` - - // Date and time at which the object was uploaded. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` -} - -// String returns the string representation -func (s CopyPartResult) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CopyPartResult) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *CopyPartResult) SetETag(v string) *CopyPartResult { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *CopyPartResult) SetLastModified(v time.Time) *CopyPartResult { - s.LastModified = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketConfiguration -type CreateBucketConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies the region where the bucket will be created. If you don't specify - // a region, the bucket will be created in US Standard. - LocationConstraint *string `type:"string" enum:"BucketLocationConstraint"` -} - -// String returns the string representation -func (s CreateBucketConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketConfiguration) GoString() string { - return s.String() -} - -// SetLocationConstraint sets the LocationConstraint field's value. -func (s *CreateBucketConfiguration) SetLocationConstraint(v string) *CreateBucketConfiguration { - s.LocationConstraint = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketRequest -type CreateBucketInput struct { - _ struct{} `type:"structure" payload:"CreateBucketConfiguration"` - - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - CreateBucketConfiguration *CreateBucketConfiguration `locationName:"CreateBucketConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` -} - -// String returns the string representation -func (s CreateBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CreateBucketInput) SetACL(v string) *CreateBucketInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateBucketInput) SetBucket(v string) *CreateBucketInput { - s.Bucket = &v - return s -} - -func (s *CreateBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCreateBucketConfiguration sets the CreateBucketConfiguration field's value. -func (s *CreateBucketInput) SetCreateBucketConfiguration(v *CreateBucketConfiguration) *CreateBucketInput { - s.CreateBucketConfiguration = v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CreateBucketInput) SetGrantFullControl(v string) *CreateBucketInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CreateBucketInput) SetGrantRead(v string) *CreateBucketInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CreateBucketInput) SetGrantReadACP(v string) *CreateBucketInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *CreateBucketInput) SetGrantWrite(v string) *CreateBucketInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CreateBucketInput) SetGrantWriteACP(v string) *CreateBucketInput { - s.GrantWriteACP = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateBucketOutput -type CreateBucketOutput struct { - _ struct{} `type:"structure"` - - Location *string `location:"header" locationName:"Location" type:"string"` -} - -// String returns the string representation -func (s CreateBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateBucketOutput) GoString() string { - return s.String() -} - -// SetLocation sets the Location field's value. -func (s *CreateBucketOutput) SetLocation(v string) *CreateBucketOutput { - s.Location = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUploadRequest -type CreateMultipartUploadInput struct { - _ struct{} `type:"structure"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object. The tag-set must be encoded as URL Query parameters - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s CreateMultipartUploadInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateMultipartUploadInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *CreateMultipartUploadInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "CreateMultipartUploadInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *CreateMultipartUploadInput) SetACL(v string) *CreateMultipartUploadInput { - s.ACL = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateMultipartUploadInput) SetBucket(v string) *CreateMultipartUploadInput { - s.Bucket = &v - return s -} - -func (s *CreateMultipartUploadInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *CreateMultipartUploadInput) SetCacheControl(v string) *CreateMultipartUploadInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *CreateMultipartUploadInput) SetContentDisposition(v string) *CreateMultipartUploadInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *CreateMultipartUploadInput) SetContentEncoding(v string) *CreateMultipartUploadInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *CreateMultipartUploadInput) SetContentLanguage(v string) *CreateMultipartUploadInput { - s.ContentLanguage = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *CreateMultipartUploadInput) SetContentType(v string) *CreateMultipartUploadInput { - s.ContentType = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *CreateMultipartUploadInput) SetExpires(v time.Time) *CreateMultipartUploadInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *CreateMultipartUploadInput) SetGrantFullControl(v string) *CreateMultipartUploadInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *CreateMultipartUploadInput) SetGrantRead(v string) *CreateMultipartUploadInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *CreateMultipartUploadInput) SetGrantReadACP(v string) *CreateMultipartUploadInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *CreateMultipartUploadInput) SetGrantWriteACP(v string) *CreateMultipartUploadInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *CreateMultipartUploadInput) SetKey(v string) *CreateMultipartUploadInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *CreateMultipartUploadInput) SetMetadata(v map[string]*string) *CreateMultipartUploadInput { - s.Metadata = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *CreateMultipartUploadInput) SetRequestPayer(v string) *CreateMultipartUploadInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerAlgorithm(v string) *CreateMultipartUploadInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerKey(v string) *CreateMultipartUploadInput { - s.SSECustomerKey = &v - return s -} - -func (s *CreateMultipartUploadInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CreateMultipartUploadInput) SetSSECustomerKeyMD5(v string) *CreateMultipartUploadInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CreateMultipartUploadInput) SetSSEKMSKeyId(v string) *CreateMultipartUploadInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CreateMultipartUploadInput) SetServerSideEncryption(v string) *CreateMultipartUploadInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *CreateMultipartUploadInput) SetStorageClass(v string) *CreateMultipartUploadInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *CreateMultipartUploadInput) SetTagging(v string) *CreateMultipartUploadInput { - s.Tagging = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *CreateMultipartUploadInput) SetWebsiteRedirectLocation(v string) *CreateMultipartUploadInput { - s.WebsiteRedirectLocation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/CreateMultipartUploadOutput -type CreateMultipartUploadOutput struct { - _ struct{} `type:"structure"` - - // Date when multipart upload will become eligible for abort operation by lifecycle. - AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` - - // Id of the lifecycle rule that makes a multipart upload eligible for abort - // operation. - AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` - - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `locationName:"Bucket" type:"string"` - - // Object key for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // ID for the initiated multipart upload. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s CreateMultipartUploadOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s CreateMultipartUploadOutput) GoString() string { - return s.String() -} - -// SetAbortDate sets the AbortDate field's value. -func (s *CreateMultipartUploadOutput) SetAbortDate(v time.Time) *CreateMultipartUploadOutput { - s.AbortDate = &v - return s -} - -// SetAbortRuleId sets the AbortRuleId field's value. -func (s *CreateMultipartUploadOutput) SetAbortRuleId(v string) *CreateMultipartUploadOutput { - s.AbortRuleId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *CreateMultipartUploadOutput) SetBucket(v string) *CreateMultipartUploadOutput { - s.Bucket = &v - return s -} - -func (s *CreateMultipartUploadOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *CreateMultipartUploadOutput) SetKey(v string) *CreateMultipartUploadOutput { - s.Key = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *CreateMultipartUploadOutput) SetRequestCharged(v string) *CreateMultipartUploadOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *CreateMultipartUploadOutput) SetSSECustomerAlgorithm(v string) *CreateMultipartUploadOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *CreateMultipartUploadOutput) SetSSECustomerKeyMD5(v string) *CreateMultipartUploadOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *CreateMultipartUploadOutput) SetSSEKMSKeyId(v string) *CreateMultipartUploadOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *CreateMultipartUploadOutput) SetServerSideEncryption(v string) *CreateMultipartUploadOutput { - s.ServerSideEncryption = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *CreateMultipartUploadOutput) SetUploadId(v string) *CreateMultipartUploadOutput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Delete -type Delete struct { - _ struct{} `type:"structure"` - - // Objects is a required field - Objects []*ObjectIdentifier `locationName:"Object" type:"list" flattened:"true" required:"true"` - - // Element to enable quiet mode for the request. When you add this element, - // you must set its value to true. - Quiet *bool `type:"boolean"` -} - -// String returns the string representation -func (s Delete) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Delete) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Delete) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Delete"} - if s.Objects == nil { - invalidParams.Add(request.NewErrParamRequired("Objects")) - } - if s.Objects != nil { - for i, v := range s.Objects { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Objects", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetObjects sets the Objects field's value. -func (s *Delete) SetObjects(v []*ObjectIdentifier) *Delete { - s.Objects = v - return s -} - -// SetQuiet sets the Quiet field's value. -func (s *Delete) SetQuiet(v bool) *Delete { - s.Quiet = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfigurationRequest -type DeleteBucketAnalyticsConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket from which an analytics configuration is deleted. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The identifier used to represent an analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketAnalyticsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketAnalyticsConfigurationInput) SetBucket(v string) *DeleteBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketAnalyticsConfigurationInput) SetId(v string) *DeleteBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketAnalyticsConfigurationOutput -type DeleteBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCorsRequest -type DeleteBucketCorsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketCorsInput) SetBucket(v string) *DeleteBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketCorsOutput -type DeleteBucketCorsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketCorsOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryptionRequest -type DeleteBucketEncryptionInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the server-side encryption configuration - // to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketEncryptionInput) SetBucket(v string) *DeleteBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketEncryptionOutput -type DeleteBucketEncryptionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketEncryptionOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketRequest -type DeleteBucketInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketInput) SetBucket(v string) *DeleteBucketInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfigurationRequest -type DeleteBucketInventoryConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the inventory configuration to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketInventoryConfigurationInput) SetBucket(v string) *DeleteBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketInventoryConfigurationInput) SetId(v string) *DeleteBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketInventoryConfigurationOutput -type DeleteBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycleRequest -type DeleteBucketLifecycleInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketLifecycleInput) SetBucket(v string) *DeleteBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketLifecycleOutput -type DeleteBucketLifecycleOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketLifecycleOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfigurationRequest -type DeleteBucketMetricsConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the metrics configuration to delete. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketMetricsConfigurationInput) SetBucket(v string) *DeleteBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *DeleteBucketMetricsConfigurationInput) SetId(v string) *DeleteBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketMetricsConfigurationOutput -type DeleteBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketOutput -type DeleteBucketOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicyRequest -type DeleteBucketPolicyInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketPolicyInput) SetBucket(v string) *DeleteBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketPolicyOutput -type DeleteBucketPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketPolicyOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplicationRequest -type DeleteBucketReplicationInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketReplicationInput) SetBucket(v string) *DeleteBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketReplicationOutput -type DeleteBucketReplicationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketReplicationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTaggingRequest -type DeleteBucketTaggingInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketTaggingInput) SetBucket(v string) *DeleteBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketTaggingOutput -type DeleteBucketTaggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketTaggingOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsiteRequest -type DeleteBucketWebsiteInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s DeleteBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteBucketWebsiteInput) SetBucket(v string) *DeleteBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *DeleteBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteBucketWebsiteOutput -type DeleteBucketWebsiteOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s DeleteBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteBucketWebsiteOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteMarkerEntry -type DeleteMarkerEntry struct { - _ struct{} `type:"structure"` - - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `min:"1" type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - // Version ID of an object. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s DeleteMarkerEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteMarkerEntry) GoString() string { - return s.String() -} - -// SetIsLatest sets the IsLatest field's value. -func (s *DeleteMarkerEntry) SetIsLatest(v bool) *DeleteMarkerEntry { - s.IsLatest = &v - return s -} - -// SetKey sets the Key field's value. -func (s *DeleteMarkerEntry) SetKey(v string) *DeleteMarkerEntry { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *DeleteMarkerEntry) SetLastModified(v time.Time) *DeleteMarkerEntry { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *DeleteMarkerEntry) SetOwner(v *Owner) *DeleteMarkerEntry { - s.Owner = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteMarkerEntry) SetVersionId(v string) *DeleteMarkerEntry { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectRequest -type DeleteObjectInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectInput) SetBucket(v string) *DeleteObjectInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *DeleteObjectInput) SetKey(v string) *DeleteObjectInput { - s.Key = &v - return s -} - -// SetMFA sets the MFA field's value. -func (s *DeleteObjectInput) SetMFA(v string) *DeleteObjectInput { - s.MFA = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *DeleteObjectInput) SetRequestPayer(v string) *DeleteObjectInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectInput) SetVersionId(v string) *DeleteObjectInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectOutput -type DeleteObjectOutput struct { - _ struct{} `type:"structure"` - - // Specifies whether the versioned object that was permanently deleted was (true) - // or was not (false) a delete marker. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Returns the version ID of the delete marker created as a result of the DELETE - // operation. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectOutput) GoString() string { - return s.String() -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *DeleteObjectOutput) SetDeleteMarker(v bool) *DeleteObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *DeleteObjectOutput) SetRequestCharged(v string) *DeleteObjectOutput { - s.RequestCharged = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectOutput) SetVersionId(v string) *DeleteObjectOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTaggingRequest -type DeleteObjectTaggingInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // The versionId of the object that the tag-set will be removed from. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectTaggingInput) SetBucket(v string) *DeleteObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *DeleteObjectTaggingInput) SetKey(v string) *DeleteObjectTaggingInput { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectTaggingInput) SetVersionId(v string) *DeleteObjectTaggingInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectTaggingOutput -type DeleteObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - // The versionId of the object the tag-set was removed from. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s DeleteObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetVersionId sets the VersionId field's value. -func (s *DeleteObjectTaggingOutput) SetVersionId(v string) *DeleteObjectTaggingOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectsRequest -type DeleteObjectsInput struct { - _ struct{} `type:"structure" payload:"Delete"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Delete is a required field - Delete *Delete `locationName:"Delete" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s DeleteObjectsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *DeleteObjectsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "DeleteObjectsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Delete == nil { - invalidParams.Add(request.NewErrParamRequired("Delete")) - } - if s.Delete != nil { - if err := s.Delete.Validate(); err != nil { - invalidParams.AddNested("Delete", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *DeleteObjectsInput) SetBucket(v string) *DeleteObjectsInput { - s.Bucket = &v - return s -} - -func (s *DeleteObjectsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelete sets the Delete field's value. -func (s *DeleteObjectsInput) SetDelete(v *Delete) *DeleteObjectsInput { - s.Delete = v - return s -} - -// SetMFA sets the MFA field's value. -func (s *DeleteObjectsInput) SetMFA(v string) *DeleteObjectsInput { - s.MFA = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *DeleteObjectsInput) SetRequestPayer(v string) *DeleteObjectsInput { - s.RequestPayer = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeleteObjectsOutput -type DeleteObjectsOutput struct { - _ struct{} `type:"structure"` - - Deleted []*DeletedObject `type:"list" flattened:"true"` - - Errors []*Error `locationName:"Error" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s DeleteObjectsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeleteObjectsOutput) GoString() string { - return s.String() -} - -// SetDeleted sets the Deleted field's value. -func (s *DeleteObjectsOutput) SetDeleted(v []*DeletedObject) *DeleteObjectsOutput { - s.Deleted = v - return s -} - -// SetErrors sets the Errors field's value. -func (s *DeleteObjectsOutput) SetErrors(v []*Error) *DeleteObjectsOutput { - s.Errors = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *DeleteObjectsOutput) SetRequestCharged(v string) *DeleteObjectsOutput { - s.RequestCharged = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/DeletedObject -type DeletedObject struct { - _ struct{} `type:"structure"` - - DeleteMarker *bool `type:"boolean"` - - DeleteMarkerVersionId *string `type:"string"` - - Key *string `min:"1" type:"string"` - - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s DeletedObject) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s DeletedObject) GoString() string { - return s.String() -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *DeletedObject) SetDeleteMarker(v bool) *DeletedObject { - s.DeleteMarker = &v - return s -} - -// SetDeleteMarkerVersionId sets the DeleteMarkerVersionId field's value. -func (s *DeletedObject) SetDeleteMarkerVersionId(v string) *DeletedObject { - s.DeleteMarkerVersionId = &v - return s -} - -// SetKey sets the Key field's value. -func (s *DeletedObject) SetKey(v string) *DeletedObject { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *DeletedObject) SetVersionId(v string) *DeletedObject { - s.VersionId = &v - return s -} - -// Container for replication destination information. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Destination -type Destination struct { - _ struct{} `type:"structure"` - - // Container for information regarding the access control for replicas. - AccessControlTranslation *AccessControlTranslation `type:"structure"` - - // Account ID of the destination bucket. Currently this is only being verified - // if Access Control Translation is enabled - Account *string `type:"string"` - - // Amazon resource name (ARN) of the bucket where you want Amazon S3 to store - // replicas of the object identified by the rule. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // Container for information regarding encryption based configuration for replicas. - EncryptionConfiguration *EncryptionConfiguration `type:"structure"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"StorageClass"` -} - -// String returns the string representation -func (s Destination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Destination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Destination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Destination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.AccessControlTranslation != nil { - if err := s.AccessControlTranslation.Validate(); err != nil { - invalidParams.AddNested("AccessControlTranslation", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessControlTranslation sets the AccessControlTranslation field's value. -func (s *Destination) SetAccessControlTranslation(v *AccessControlTranslation) *Destination { - s.AccessControlTranslation = v - return s -} - -// SetAccount sets the Account field's value. -func (s *Destination) SetAccount(v string) *Destination { - s.Account = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *Destination) SetBucket(v string) *Destination { - s.Bucket = &v - return s -} - -func (s *Destination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetEncryptionConfiguration sets the EncryptionConfiguration field's value. -func (s *Destination) SetEncryptionConfiguration(v *EncryptionConfiguration) *Destination { - s.EncryptionConfiguration = v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Destination) SetStorageClass(v string) *Destination { - s.StorageClass = &v - return s -} - -// Describes the server-side encryption that will be applied to the restore -// results. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Encryption -type Encryption struct { - _ struct{} `type:"structure"` - - // The server-side encryption algorithm used when storing job results in Amazon - // S3 (e.g., AES256, aws:kms). - // - // EncryptionType is a required field - EncryptionType *string `type:"string" required:"true" enum:"ServerSideEncryption"` - - // If the encryption type is aws:kms, this optional value can be used to specify - // the encryption context for the restore results. - KMSContext *string `type:"string"` - - // If the encryption type is aws:kms, this optional value specifies the AWS - // KMS key ID to use for encryption of job results. - KMSKeyId *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() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Encryption) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Encryption"} - if s.EncryptionType == nil { - invalidParams.Add(request.NewErrParamRequired("EncryptionType")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEncryptionType sets the EncryptionType field's value. -func (s *Encryption) SetEncryptionType(v string) *Encryption { - s.EncryptionType = &v - return s -} - -// SetKMSContext sets the KMSContext field's value. -func (s *Encryption) SetKMSContext(v string) *Encryption { - s.KMSContext = &v - return s -} - -// SetKMSKeyId sets the KMSKeyId field's value. -func (s *Encryption) SetKMSKeyId(v string) *Encryption { - s.KMSKeyId = &v - return s -} - -// Container for information regarding encryption based configuration for replicas. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/EncryptionConfiguration -type EncryptionConfiguration struct { - _ struct{} `type:"structure"` - - // The id of the KMS key used to encrypt the replica object. - ReplicaKmsKeyID *string `type:"string"` -} - -// String returns the string representation -func (s EncryptionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s EncryptionConfiguration) GoString() string { - return s.String() -} - -// SetReplicaKmsKeyID sets the ReplicaKmsKeyID field's value. -func (s *EncryptionConfiguration) SetReplicaKmsKeyID(v string) *EncryptionConfiguration { - s.ReplicaKmsKeyID = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Error -type Error struct { - _ struct{} `type:"structure"` - - Code *string `type:"string"` - - Key *string `min:"1" type:"string"` - - Message *string `type:"string"` - - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s Error) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Error) GoString() string { - return s.String() -} - -// SetCode sets the Code field's value. -func (s *Error) SetCode(v string) *Error { - s.Code = &v - return s -} - -// SetKey sets the Key field's value. -func (s *Error) SetKey(v string) *Error { - s.Key = &v - return s -} - -// SetMessage sets the Message field's value. -func (s *Error) SetMessage(v string) *Error { - s.Message = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *Error) SetVersionId(v string) *Error { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ErrorDocument -type ErrorDocument struct { - _ struct{} `type:"structure"` - - // The object key name to use when a 4XX class error occurs. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` -} - -// String returns the string representation -func (s ErrorDocument) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ErrorDocument) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ErrorDocument) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ErrorDocument"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *ErrorDocument) SetKey(v string) *ErrorDocument { - s.Key = &v - return s -} - -// Container for key value pair that defines the criteria for the filter rule. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/FilterRule -type FilterRule struct { - _ struct{} `type:"structure"` - - // Object key name prefix or suffix identifying one or more objects to which - // the filtering rule applies. Maximum prefix length can be up to 1,024 characters. - // Overlapping prefixes and suffixes are not supported. For more information, - // go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - Name *string `type:"string" enum:"FilterRuleName"` - - Value *string `type:"string"` -} - -// String returns the string representation -func (s FilterRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s FilterRule) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *FilterRule) SetName(v string) *FilterRule { - s.Name = &v - return s -} - -// SetValue sets the Value field's value. -func (s *FilterRule) SetValue(v string) *FilterRule { - s.Value = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfigurationRequest -type GetBucketAccelerateConfigurationInput struct { - _ struct{} `type:"structure"` - - // Name of the bucket for which the accelerate configuration is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAccelerateConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAccelerateConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAccelerateConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAccelerateConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAccelerateConfigurationInput) SetBucket(v string) *GetBucketAccelerateConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAccelerateConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAccelerateConfigurationOutput -type GetBucketAccelerateConfigurationOutput struct { - _ struct{} `type:"structure"` - - // The accelerate configuration of the bucket. - Status *string `type:"string" enum:"BucketAccelerateStatus"` -} - -// String returns the string representation -func (s GetBucketAccelerateConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAccelerateConfigurationOutput) GoString() string { - return s.String() -} - -// SetStatus sets the Status field's value. -func (s *GetBucketAccelerateConfigurationOutput) SetStatus(v string) *GetBucketAccelerateConfigurationOutput { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAclRequest -type GetBucketAclInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAclInput) SetBucket(v string) *GetBucketAclInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAclOutput -type GetBucketAclOutput struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s GetBucketAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAclOutput) GoString() string { - return s.String() -} - -// SetGrants sets the Grants field's value. -func (s *GetBucketAclOutput) SetGrants(v []*Grant) *GetBucketAclOutput { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *GetBucketAclOutput) SetOwner(v *Owner) *GetBucketAclOutput { - s.Owner = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfigurationRequest -type GetBucketAnalyticsConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket from which an analytics configuration is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The identifier used to represent an analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketAnalyticsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketAnalyticsConfigurationInput) SetBucket(v string) *GetBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketAnalyticsConfigurationInput) SetId(v string) *GetBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketAnalyticsConfigurationOutput -type GetBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` - - // The configuration and any analyses for the analytics filter. - AnalyticsConfiguration *AnalyticsConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -// SetAnalyticsConfiguration sets the AnalyticsConfiguration field's value. -func (s *GetBucketAnalyticsConfigurationOutput) SetAnalyticsConfiguration(v *AnalyticsConfiguration) *GetBucketAnalyticsConfigurationOutput { - s.AnalyticsConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCorsRequest -type GetBucketCorsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketCorsInput) SetBucket(v string) *GetBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *GetBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketCorsOutput -type GetBucketCorsOutput struct { - _ struct{} `type:"structure"` - - CORSRules []*CORSRule `locationName:"CORSRule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketCorsOutput) GoString() string { - return s.String() -} - -// SetCORSRules sets the CORSRules field's value. -func (s *GetBucketCorsOutput) SetCORSRules(v []*CORSRule) *GetBucketCorsOutput { - s.CORSRules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryptionRequest -type GetBucketEncryptionInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket from which the server-side encryption configuration - // is retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketEncryptionInput) SetBucket(v string) *GetBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *GetBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketEncryptionOutput -type GetBucketEncryptionOutput struct { - _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - - // Container for server-side encryption configuration rules. Currently S3 supports - // one rule only. - ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketEncryptionOutput) GoString() string { - return s.String() -} - -// SetServerSideEncryptionConfiguration sets the ServerSideEncryptionConfiguration field's value. -func (s *GetBucketEncryptionOutput) SetServerSideEncryptionConfiguration(v *ServerSideEncryptionConfiguration) *GetBucketEncryptionOutput { - s.ServerSideEncryptionConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfigurationRequest -type GetBucketInventoryConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the inventory configuration to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketInventoryConfigurationInput) SetBucket(v string) *GetBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketInventoryConfigurationInput) SetId(v string) *GetBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketInventoryConfigurationOutput -type GetBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure" payload:"InventoryConfiguration"` - - // Specifies the inventory configuration. - InventoryConfiguration *InventoryConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -// SetInventoryConfiguration sets the InventoryConfiguration field's value. -func (s *GetBucketInventoryConfigurationOutput) SetInventoryConfiguration(v *InventoryConfiguration) *GetBucketInventoryConfigurationOutput { - s.InventoryConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfigurationRequest -type GetBucketLifecycleConfigurationInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLifecycleConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLifecycleConfigurationInput) SetBucket(v string) *GetBucketLifecycleConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLifecycleConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleConfigurationOutput -type GetBucketLifecycleConfigurationOutput struct { - _ struct{} `type:"structure"` - - Rules []*LifecycleRule `locationName:"Rule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleConfigurationOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *GetBucketLifecycleConfigurationOutput) SetRules(v []*LifecycleRule) *GetBucketLifecycleConfigurationOutput { - s.Rules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleRequest -type GetBucketLifecycleInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLifecycleInput) SetBucket(v string) *GetBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLifecycleOutput -type GetBucketLifecycleOutput struct { - _ struct{} `type:"structure"` - - Rules []*Rule `locationName:"Rule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s GetBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLifecycleOutput) GoString() string { - return s.String() -} - -// SetRules sets the Rules field's value. -func (s *GetBucketLifecycleOutput) SetRules(v []*Rule) *GetBucketLifecycleOutput { - s.Rules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocationRequest -type GetBucketLocationInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLocationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLocationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLocationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLocationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLocationInput) SetBucket(v string) *GetBucketLocationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLocationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLocationOutput -type GetBucketLocationOutput struct { - _ struct{} `type:"structure"` - - LocationConstraint *string `type:"string" enum:"BucketLocationConstraint"` -} - -// String returns the string representation -func (s GetBucketLocationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLocationOutput) GoString() string { - return s.String() -} - -// SetLocationConstraint sets the LocationConstraint field's value. -func (s *GetBucketLocationOutput) SetLocationConstraint(v string) *GetBucketLocationOutput { - s.LocationConstraint = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLoggingRequest -type GetBucketLoggingInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketLoggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLoggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketLoggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketLoggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketLoggingInput) SetBucket(v string) *GetBucketLoggingInput { - s.Bucket = &v - return s -} - -func (s *GetBucketLoggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketLoggingOutput -type GetBucketLoggingOutput struct { - _ struct{} `type:"structure"` - - LoggingEnabled *LoggingEnabled `type:"structure"` -} - -// String returns the string representation -func (s GetBucketLoggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketLoggingOutput) GoString() string { - return s.String() -} - -// SetLoggingEnabled sets the LoggingEnabled field's value. -func (s *GetBucketLoggingOutput) SetLoggingEnabled(v *LoggingEnabled) *GetBucketLoggingOutput { - s.LoggingEnabled = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfigurationRequest -type GetBucketMetricsConfigurationInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the metrics configuration to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketMetricsConfigurationInput) SetBucket(v string) *GetBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *GetBucketMetricsConfigurationInput) SetId(v string) *GetBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketMetricsConfigurationOutput -type GetBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure" payload:"MetricsConfiguration"` - - // Specifies the metrics configuration. - MetricsConfiguration *MetricsConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -// SetMetricsConfiguration sets the MetricsConfiguration field's value. -func (s *GetBucketMetricsConfigurationOutput) SetMetricsConfiguration(v *MetricsConfiguration) *GetBucketMetricsConfigurationOutput { - s.MetricsConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketNotificationConfigurationRequest -type GetBucketNotificationConfigurationRequest struct { - _ struct{} `type:"structure"` - - // Name of the bucket to get the notification configuration for. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketNotificationConfigurationRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketNotificationConfigurationRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketNotificationConfigurationRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketNotificationConfigurationRequest"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketNotificationConfigurationRequest) SetBucket(v string) *GetBucketNotificationConfigurationRequest { - s.Bucket = &v - return s -} - -func (s *GetBucketNotificationConfigurationRequest) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyRequest -type GetBucketPolicyInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketPolicyInput) SetBucket(v string) *GetBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *GetBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketPolicyOutput -type GetBucketPolicyOutput struct { - _ struct{} `type:"structure" payload:"Policy"` - - // The bucket policy as a JSON document. - Policy *string `type:"string"` -} - -// String returns the string representation -func (s GetBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketPolicyOutput) GoString() string { - return s.String() -} - -// SetPolicy sets the Policy field's value. -func (s *GetBucketPolicyOutput) SetPolicy(v string) *GetBucketPolicyOutput { - s.Policy = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplicationRequest -type GetBucketReplicationInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketReplicationInput) SetBucket(v string) *GetBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *GetBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketReplicationOutput -type GetBucketReplicationOutput struct { - _ struct{} `type:"structure" payload:"ReplicationConfiguration"` - - // Container for replication rules. You can add as many as 1,000 rules. Total - // replication configuration size can be up to 2 MB. - ReplicationConfiguration *ReplicationConfiguration `type:"structure"` -} - -// String returns the string representation -func (s GetBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketReplicationOutput) GoString() string { - return s.String() -} - -// SetReplicationConfiguration sets the ReplicationConfiguration field's value. -func (s *GetBucketReplicationOutput) SetReplicationConfiguration(v *ReplicationConfiguration) *GetBucketReplicationOutput { - s.ReplicationConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPaymentRequest -type GetBucketRequestPaymentInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketRequestPaymentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketRequestPaymentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketRequestPaymentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketRequestPaymentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketRequestPaymentInput) SetBucket(v string) *GetBucketRequestPaymentInput { - s.Bucket = &v - return s -} - -func (s *GetBucketRequestPaymentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketRequestPaymentOutput -type GetBucketRequestPaymentOutput struct { - _ struct{} `type:"structure"` - - // Specifies who pays for the download and request fees. - Payer *string `type:"string" enum:"Payer"` -} - -// String returns the string representation -func (s GetBucketRequestPaymentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketRequestPaymentOutput) GoString() string { - return s.String() -} - -// SetPayer sets the Payer field's value. -func (s *GetBucketRequestPaymentOutput) SetPayer(v string) *GetBucketRequestPaymentOutput { - s.Payer = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTaggingRequest -type GetBucketTaggingInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketTaggingInput) SetBucket(v string) *GetBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *GetBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketTaggingOutput -type GetBucketTaggingOutput struct { - _ struct{} `type:"structure"` - - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` -} - -// String returns the string representation -func (s GetBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketTaggingOutput) GoString() string { - return s.String() -} - -// SetTagSet sets the TagSet field's value. -func (s *GetBucketTaggingOutput) SetTagSet(v []*Tag) *GetBucketTaggingOutput { - s.TagSet = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioningRequest -type GetBucketVersioningInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketVersioningInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketVersioningInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketVersioningInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketVersioningInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketVersioningInput) SetBucket(v string) *GetBucketVersioningInput { - s.Bucket = &v - return s -} - -func (s *GetBucketVersioningInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketVersioningOutput -type GetBucketVersioningOutput struct { - _ struct{} `type:"structure"` - - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string" enum:"MFADeleteStatus"` - - // The versioning state of the bucket. - Status *string `type:"string" enum:"BucketVersioningStatus"` -} - -// String returns the string representation -func (s GetBucketVersioningOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketVersioningOutput) GoString() string { - return s.String() -} - -// SetMFADelete sets the MFADelete field's value. -func (s *GetBucketVersioningOutput) SetMFADelete(v string) *GetBucketVersioningOutput { - s.MFADelete = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *GetBucketVersioningOutput) SetStatus(v string) *GetBucketVersioningOutput { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsiteRequest -type GetBucketWebsiteInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s GetBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetBucketWebsiteInput) SetBucket(v string) *GetBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *GetBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetBucketWebsiteOutput -type GetBucketWebsiteOutput struct { - _ struct{} `type:"structure"` - - ErrorDocument *ErrorDocument `type:"structure"` - - IndexDocument *IndexDocument `type:"structure"` - - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` -} - -// String returns the string representation -func (s GetBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetBucketWebsiteOutput) GoString() string { - return s.String() -} - -// SetErrorDocument sets the ErrorDocument field's value. -func (s *GetBucketWebsiteOutput) SetErrorDocument(v *ErrorDocument) *GetBucketWebsiteOutput { - s.ErrorDocument = v - return s -} - -// SetIndexDocument sets the IndexDocument field's value. -func (s *GetBucketWebsiteOutput) SetIndexDocument(v *IndexDocument) *GetBucketWebsiteOutput { - s.IndexDocument = v - return s -} - -// SetRedirectAllRequestsTo sets the RedirectAllRequestsTo field's value. -func (s *GetBucketWebsiteOutput) SetRedirectAllRequestsTo(v *RedirectAllRequestsTo) *GetBucketWebsiteOutput { - s.RedirectAllRequestsTo = v - return s -} - -// SetRoutingRules sets the RoutingRules field's value. -func (s *GetBucketWebsiteOutput) SetRoutingRules(v []*RoutingRule) *GetBucketWebsiteOutput { - s.RoutingRules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAclRequest -type GetObjectAclInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectAclInput) SetBucket(v string) *GetObjectAclInput { - s.Bucket = &v - return s -} - -func (s *GetObjectAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectAclInput) SetKey(v string) *GetObjectAclInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectAclInput) SetRequestPayer(v string) *GetObjectAclInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectAclInput) SetVersionId(v string) *GetObjectAclInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectAclOutput -type GetObjectAclOutput struct { - _ struct{} `type:"structure"` - - // A list of grants. - Grants []*Grant `locationName:"AccessControlList" locationNameList:"Grant" type:"list"` - - Owner *Owner `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s GetObjectAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectAclOutput) GoString() string { - return s.String() -} - -// SetGrants sets the Grants field's value. -func (s *GetObjectAclOutput) SetGrants(v []*Grant) *GetObjectAclOutput { - s.Grants = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *GetObjectAclOutput) SetOwner(v *Owner) *GetObjectAclOutput { - s.Owner = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectAclOutput) SetRequestCharged(v string) *GetObjectAclOutput { - s.RequestCharged = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectRequest -type GetObjectInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of the object being read. This is a positive integer between - // 1 and 10,000. Effectively performs a 'ranged' GET request for the part specified. - // Useful for downloading just a part of an object. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Sets the Cache-Control header of the response. - ResponseCacheControl *string `location:"querystring" locationName:"response-cache-control" type:"string"` - - // Sets the Content-Disposition header of the response - ResponseContentDisposition *string `location:"querystring" locationName:"response-content-disposition" type:"string"` - - // Sets the Content-Encoding header of the response. - ResponseContentEncoding *string `location:"querystring" locationName:"response-content-encoding" type:"string"` - - // Sets the Content-Language header of the response. - ResponseContentLanguage *string `location:"querystring" locationName:"response-content-language" type:"string"` - - // Sets the Content-Type header of the response. - ResponseContentType *string `location:"querystring" locationName:"response-content-type" type:"string"` - - // Sets the Expires header of the response. - ResponseExpires *time.Time `location:"querystring" locationName:"response-expires" type:"timestamp" timestampFormat:"iso8601"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectInput) SetBucket(v string) *GetObjectInput { - s.Bucket = &v - return s -} - -func (s *GetObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetIfMatch sets the IfMatch field's value. -func (s *GetObjectInput) SetIfMatch(v string) *GetObjectInput { - s.IfMatch = &v - return s -} - -// SetIfModifiedSince sets the IfModifiedSince field's value. -func (s *GetObjectInput) SetIfModifiedSince(v time.Time) *GetObjectInput { - s.IfModifiedSince = &v - return s -} - -// SetIfNoneMatch sets the IfNoneMatch field's value. -func (s *GetObjectInput) SetIfNoneMatch(v string) *GetObjectInput { - s.IfNoneMatch = &v - return s -} - -// SetIfUnmodifiedSince sets the IfUnmodifiedSince field's value. -func (s *GetObjectInput) SetIfUnmodifiedSince(v time.Time) *GetObjectInput { - s.IfUnmodifiedSince = &v - return s -} - -// SetKey sets the Key field's value. -func (s *GetObjectInput) SetKey(v string) *GetObjectInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *GetObjectInput) SetPartNumber(v int64) *GetObjectInput { - s.PartNumber = &v - return s -} - -// SetRange sets the Range field's value. -func (s *GetObjectInput) SetRange(v string) *GetObjectInput { - s.Range = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectInput) SetRequestPayer(v string) *GetObjectInput { - s.RequestPayer = &v - return s -} - -// SetResponseCacheControl sets the ResponseCacheControl field's value. -func (s *GetObjectInput) SetResponseCacheControl(v string) *GetObjectInput { - s.ResponseCacheControl = &v - return s -} - -// SetResponseContentDisposition sets the ResponseContentDisposition field's value. -func (s *GetObjectInput) SetResponseContentDisposition(v string) *GetObjectInput { - s.ResponseContentDisposition = &v - return s -} - -// SetResponseContentEncoding sets the ResponseContentEncoding field's value. -func (s *GetObjectInput) SetResponseContentEncoding(v string) *GetObjectInput { - s.ResponseContentEncoding = &v - return s -} - -// SetResponseContentLanguage sets the ResponseContentLanguage field's value. -func (s *GetObjectInput) SetResponseContentLanguage(v string) *GetObjectInput { - s.ResponseContentLanguage = &v - return s -} - -// SetResponseContentType sets the ResponseContentType field's value. -func (s *GetObjectInput) SetResponseContentType(v string) *GetObjectInput { - s.ResponseContentType = &v - return s -} - -// SetResponseExpires sets the ResponseExpires field's value. -func (s *GetObjectInput) SetResponseExpires(v time.Time) *GetObjectInput { - s.ResponseExpires = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *GetObjectInput) SetSSECustomerAlgorithm(v string) *GetObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *GetObjectInput) SetSSECustomerKey(v string) *GetObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *GetObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *GetObjectInput) SetSSECustomerKeyMD5(v string) *GetObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectInput) SetVersionId(v string) *GetObjectInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectOutput -type GetObjectOutput struct { - _ struct{} `type:"structure" payload:"Body"` - - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Object data. - Body io.ReadCloser `type:"blob"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The portion of the object returned in the response. - ContentRange *string `location:"header" locationName:"Content-Range" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *string `location:"header" locationName:"Expires" type:"string"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - // The count of parts this object has. - PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` - - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"ReplicationStatus"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Provides information about object restoration operation and expiration time - // of the restored object copy. - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The number of tags, if any, on the object. - TagCount *int64 `location:"header" locationName:"x-amz-tagging-count" type:"integer"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s GetObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectOutput) GoString() string { - return s.String() -} - -// SetAcceptRanges sets the AcceptRanges field's value. -func (s *GetObjectOutput) SetAcceptRanges(v string) *GetObjectOutput { - s.AcceptRanges = &v - return s -} - -// SetBody sets the Body field's value. -func (s *GetObjectOutput) SetBody(v io.ReadCloser) *GetObjectOutput { - s.Body = v - return s -} - -// SetCacheControl sets the CacheControl field's value. -func (s *GetObjectOutput) SetCacheControl(v string) *GetObjectOutput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *GetObjectOutput) SetContentDisposition(v string) *GetObjectOutput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *GetObjectOutput) SetContentEncoding(v string) *GetObjectOutput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *GetObjectOutput) SetContentLanguage(v string) *GetObjectOutput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *GetObjectOutput) SetContentLength(v int64) *GetObjectOutput { - s.ContentLength = &v - return s -} - -// SetContentRange sets the ContentRange field's value. -func (s *GetObjectOutput) SetContentRange(v string) *GetObjectOutput { - s.ContentRange = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *GetObjectOutput) SetContentType(v string) *GetObjectOutput { - s.ContentType = &v - return s -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *GetObjectOutput) SetDeleteMarker(v bool) *GetObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetETag sets the ETag field's value. -func (s *GetObjectOutput) SetETag(v string) *GetObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *GetObjectOutput) SetExpiration(v string) *GetObjectOutput { - s.Expiration = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *GetObjectOutput) SetExpires(v string) *GetObjectOutput { - s.Expires = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *GetObjectOutput) SetLastModified(v time.Time) *GetObjectOutput { - s.LastModified = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *GetObjectOutput) SetMetadata(v map[string]*string) *GetObjectOutput { - s.Metadata = v - return s -} - -// SetMissingMeta sets the MissingMeta field's value. -func (s *GetObjectOutput) SetMissingMeta(v int64) *GetObjectOutput { - s.MissingMeta = &v - return s -} - -// SetPartsCount sets the PartsCount field's value. -func (s *GetObjectOutput) SetPartsCount(v int64) *GetObjectOutput { - s.PartsCount = &v - return s -} - -// SetReplicationStatus sets the ReplicationStatus field's value. -func (s *GetObjectOutput) SetReplicationStatus(v string) *GetObjectOutput { - s.ReplicationStatus = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectOutput) SetRequestCharged(v string) *GetObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestore sets the Restore field's value. -func (s *GetObjectOutput) SetRestore(v string) *GetObjectOutput { - s.Restore = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *GetObjectOutput) SetSSECustomerAlgorithm(v string) *GetObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *GetObjectOutput) SetSSECustomerKeyMD5(v string) *GetObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *GetObjectOutput) SetSSEKMSKeyId(v string) *GetObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *GetObjectOutput) SetServerSideEncryption(v string) *GetObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *GetObjectOutput) SetStorageClass(v string) *GetObjectOutput { - s.StorageClass = &v - return s -} - -// SetTagCount sets the TagCount field's value. -func (s *GetObjectOutput) SetTagCount(v int64) *GetObjectOutput { - s.TagCount = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectOutput) SetVersionId(v string) *GetObjectOutput { - s.VersionId = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *GetObjectOutput) SetWebsiteRedirectLocation(v string) *GetObjectOutput { - s.WebsiteRedirectLocation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTaggingRequest -type GetObjectTaggingInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s GetObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectTaggingInput) SetBucket(v string) *GetObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *GetObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectTaggingInput) SetKey(v string) *GetObjectTaggingInput { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectTaggingInput) SetVersionId(v string) *GetObjectTaggingInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTaggingOutput -type GetObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` - - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s GetObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetTagSet sets the TagSet field's value. -func (s *GetObjectTaggingOutput) SetTagSet(v []*Tag) *GetObjectTaggingOutput { - s.TagSet = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *GetObjectTaggingOutput) SetVersionId(v string) *GetObjectTaggingOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrentRequest -type GetObjectTorrentInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s GetObjectTorrentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTorrentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GetObjectTorrentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GetObjectTorrentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *GetObjectTorrentInput) SetBucket(v string) *GetObjectTorrentInput { - s.Bucket = &v - return s -} - -func (s *GetObjectTorrentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *GetObjectTorrentInput) SetKey(v string) *GetObjectTorrentInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *GetObjectTorrentInput) SetRequestPayer(v string) *GetObjectTorrentInput { - s.RequestPayer = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GetObjectTorrentOutput -type GetObjectTorrentOutput struct { - _ struct{} `type:"structure" payload:"Body"` - - Body io.ReadCloser `type:"blob"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s GetObjectTorrentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GetObjectTorrentOutput) GoString() string { - return s.String() -} - -// SetBody sets the Body field's value. -func (s *GetObjectTorrentOutput) SetBody(v io.ReadCloser) *GetObjectTorrentOutput { - s.Body = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *GetObjectTorrentOutput) SetRequestCharged(v string) *GetObjectTorrentOutput { - s.RequestCharged = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/GlacierJobParameters -type GlacierJobParameters struct { - _ struct{} `type:"structure"` - - // Glacier retrieval tier at which the restore will be processed. - // - // Tier is a required field - Tier *string `type:"string" required:"true" enum:"Tier"` -} - -// String returns the string representation -func (s GlacierJobParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s GlacierJobParameters) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *GlacierJobParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "GlacierJobParameters"} - if s.Tier == nil { - invalidParams.Add(request.NewErrParamRequired("Tier")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTier sets the Tier field's value. -func (s *GlacierJobParameters) SetTier(v string) *GlacierJobParameters { - s.Tier = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Grant -type Grant struct { - _ struct{} `type:"structure"` - - Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Specifies the permission given to the grantee. - Permission *string `type:"string" enum:"Permission"` -} - -// String returns the string representation -func (s Grant) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Grant) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Grant) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Grant"} - if s.Grantee != nil { - if err := s.Grantee.Validate(); err != nil { - invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantee sets the Grantee field's value. -func (s *Grant) SetGrantee(v *Grantee) *Grant { - s.Grantee = v - return s -} - -// SetPermission sets the Permission field's value. -func (s *Grant) SetPermission(v string) *Grant { - s.Permission = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Grantee -type Grantee struct { - _ struct{} `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Screen name of the grantee. - DisplayName *string `type:"string"` - - // Email address of the grantee. - EmailAddress *string `type:"string"` - - // The canonical user ID of the grantee. - ID *string `type:"string"` - - // Type of grantee - // - // Type is a required field - Type *string `locationName:"xsi:type" type:"string" xmlAttribute:"true" required:"true" enum:"Type"` - - // URI of the grantee group. - URI *string `type:"string"` -} - -// String returns the string representation -func (s Grantee) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Grantee) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Grantee) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Grantee"} - if s.Type == nil { - invalidParams.Add(request.NewErrParamRequired("Type")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Grantee) SetDisplayName(v string) *Grantee { - s.DisplayName = &v - return s -} - -// SetEmailAddress sets the EmailAddress field's value. -func (s *Grantee) SetEmailAddress(v string) *Grantee { - s.EmailAddress = &v - return s -} - -// SetID sets the ID field's value. -func (s *Grantee) SetID(v string) *Grantee { - s.ID = &v - return s -} - -// SetType sets the Type field's value. -func (s *Grantee) SetType(v string) *Grantee { - s.Type = &v - return s -} - -// SetURI sets the URI field's value. -func (s *Grantee) SetURI(v string) *Grantee { - s.URI = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucketRequest -type HeadBucketInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s HeadBucketInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadBucketInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *HeadBucketInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "HeadBucketInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *HeadBucketInput) SetBucket(v string) *HeadBucketInput { - s.Bucket = &v - return s -} - -func (s *HeadBucketInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadBucketOutput -type HeadBucketOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s HeadBucketOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadBucketOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObjectRequest -type HeadObjectInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Return the object only if its entity tag (ETag) is the same as the one specified, - // otherwise return a 412 (precondition failed). - IfMatch *string `location:"header" locationName:"If-Match" type:"string"` - - // Return the object only if it has been modified since the specified time, - // otherwise return a 304 (not modified). - IfModifiedSince *time.Time `location:"header" locationName:"If-Modified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Return the object only if its entity tag (ETag) is different from the one - // specified, otherwise return a 304 (not modified). - IfNoneMatch *string `location:"header" locationName:"If-None-Match" type:"string"` - - // Return the object only if it has not been modified since the specified time, - // otherwise return a 412 (precondition failed). - IfUnmodifiedSince *time.Time `location:"header" locationName:"If-Unmodified-Since" type:"timestamp" timestampFormat:"rfc822"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of the object being read. This is a positive integer between - // 1 and 10,000. Effectively performs a 'ranged' HEAD request for the part specified. - // Useful querying about the size of the part and the number of parts in this - // object. - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer"` - - // Downloads the specified range bytes of an object. For more information about - // the HTTP Range header, go to http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.35. - Range *string `location:"header" locationName:"Range" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s HeadObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *HeadObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "HeadObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *HeadObjectInput) SetBucket(v string) *HeadObjectInput { - s.Bucket = &v - return s -} - -func (s *HeadObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetIfMatch sets the IfMatch field's value. -func (s *HeadObjectInput) SetIfMatch(v string) *HeadObjectInput { - s.IfMatch = &v - return s -} - -// SetIfModifiedSince sets the IfModifiedSince field's value. -func (s *HeadObjectInput) SetIfModifiedSince(v time.Time) *HeadObjectInput { - s.IfModifiedSince = &v - return s -} - -// SetIfNoneMatch sets the IfNoneMatch field's value. -func (s *HeadObjectInput) SetIfNoneMatch(v string) *HeadObjectInput { - s.IfNoneMatch = &v - return s -} - -// SetIfUnmodifiedSince sets the IfUnmodifiedSince field's value. -func (s *HeadObjectInput) SetIfUnmodifiedSince(v time.Time) *HeadObjectInput { - s.IfUnmodifiedSince = &v - return s -} - -// SetKey sets the Key field's value. -func (s *HeadObjectInput) SetKey(v string) *HeadObjectInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *HeadObjectInput) SetPartNumber(v int64) *HeadObjectInput { - s.PartNumber = &v - return s -} - -// SetRange sets the Range field's value. -func (s *HeadObjectInput) SetRange(v string) *HeadObjectInput { - s.Range = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *HeadObjectInput) SetRequestPayer(v string) *HeadObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *HeadObjectInput) SetSSECustomerAlgorithm(v string) *HeadObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *HeadObjectInput) SetSSECustomerKey(v string) *HeadObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *HeadObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *HeadObjectInput) SetSSECustomerKeyMD5(v string) *HeadObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *HeadObjectInput) SetVersionId(v string) *HeadObjectInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/HeadObjectOutput -type HeadObjectOutput struct { - _ struct{} `type:"structure"` - - AcceptRanges *string `location:"header" locationName:"accept-ranges" type:"string"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // Specifies whether the object retrieved was (true) or was not (false) a Delete - // Marker. If false, this response header does not appear in the response. - DeleteMarker *bool `location:"header" locationName:"x-amz-delete-marker" type:"boolean"` - - // An ETag is an opaque identifier assigned by a web server to a specific version - // of a resource found at a URL - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured (see PUT Bucket lifecycle), the response - // includes this header. It includes the expiry-date and rule-id key value pairs - // providing object expiration information. The value of the rule-id is URL - // encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *string `location:"header" locationName:"Expires" type:"string"` - - // Last modified date of the object - LastModified *time.Time `location:"header" locationName:"Last-Modified" type:"timestamp" timestampFormat:"rfc822"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // This is set to the number of metadata entries not returned in x-amz-meta - // headers. This can happen if you create metadata using an API like SOAP that - // supports more flexible metadata than the REST API. For example, using SOAP, - // you can create metadata whose values are not legal HTTP headers. - MissingMeta *int64 `location:"header" locationName:"x-amz-missing-meta" type:"integer"` - - // The count of parts this object has. - PartsCount *int64 `location:"header" locationName:"x-amz-mp-parts-count" type:"integer"` - - ReplicationStatus *string `location:"header" locationName:"x-amz-replication-status" type:"string" enum:"ReplicationStatus"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Provides information about object restoration operation and expiration time - // of the restored object copy. - Restore *string `location:"header" locationName:"x-amz-restore" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s HeadObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s HeadObjectOutput) GoString() string { - return s.String() -} - -// SetAcceptRanges sets the AcceptRanges field's value. -func (s *HeadObjectOutput) SetAcceptRanges(v string) *HeadObjectOutput { - s.AcceptRanges = &v - return s -} - -// SetCacheControl sets the CacheControl field's value. -func (s *HeadObjectOutput) SetCacheControl(v string) *HeadObjectOutput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *HeadObjectOutput) SetContentDisposition(v string) *HeadObjectOutput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *HeadObjectOutput) SetContentEncoding(v string) *HeadObjectOutput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *HeadObjectOutput) SetContentLanguage(v string) *HeadObjectOutput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *HeadObjectOutput) SetContentLength(v int64) *HeadObjectOutput { - s.ContentLength = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *HeadObjectOutput) SetContentType(v string) *HeadObjectOutput { - s.ContentType = &v - return s -} - -// SetDeleteMarker sets the DeleteMarker field's value. -func (s *HeadObjectOutput) SetDeleteMarker(v bool) *HeadObjectOutput { - s.DeleteMarker = &v - return s -} - -// SetETag sets the ETag field's value. -func (s *HeadObjectOutput) SetETag(v string) *HeadObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *HeadObjectOutput) SetExpiration(v string) *HeadObjectOutput { - s.Expiration = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *HeadObjectOutput) SetExpires(v string) *HeadObjectOutput { - s.Expires = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *HeadObjectOutput) SetLastModified(v time.Time) *HeadObjectOutput { - s.LastModified = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *HeadObjectOutput) SetMetadata(v map[string]*string) *HeadObjectOutput { - s.Metadata = v - return s -} - -// SetMissingMeta sets the MissingMeta field's value. -func (s *HeadObjectOutput) SetMissingMeta(v int64) *HeadObjectOutput { - s.MissingMeta = &v - return s -} - -// SetPartsCount sets the PartsCount field's value. -func (s *HeadObjectOutput) SetPartsCount(v int64) *HeadObjectOutput { - s.PartsCount = &v - return s -} - -// SetReplicationStatus sets the ReplicationStatus field's value. -func (s *HeadObjectOutput) SetReplicationStatus(v string) *HeadObjectOutput { - s.ReplicationStatus = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *HeadObjectOutput) SetRequestCharged(v string) *HeadObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestore sets the Restore field's value. -func (s *HeadObjectOutput) SetRestore(v string) *HeadObjectOutput { - s.Restore = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *HeadObjectOutput) SetSSECustomerAlgorithm(v string) *HeadObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *HeadObjectOutput) SetSSECustomerKeyMD5(v string) *HeadObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *HeadObjectOutput) SetSSEKMSKeyId(v string) *HeadObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *HeadObjectOutput) SetServerSideEncryption(v string) *HeadObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *HeadObjectOutput) SetStorageClass(v string) *HeadObjectOutput { - s.StorageClass = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *HeadObjectOutput) SetVersionId(v string) *HeadObjectOutput { - s.VersionId = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *HeadObjectOutput) SetWebsiteRedirectLocation(v string) *HeadObjectOutput { - s.WebsiteRedirectLocation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/IndexDocument -type IndexDocument struct { - _ struct{} `type:"structure"` - - // A suffix that is appended to a request that is for a directory on the website - // endpoint (e.g. if the suffix is index.html and you make a request to samplebucket/images/ - // the data that is returned will be for the object with the key name images/index.html) - // The suffix must not be empty and must not include a slash character. - // - // Suffix is a required field - Suffix *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s IndexDocument) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s IndexDocument) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *IndexDocument) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "IndexDocument"} - if s.Suffix == nil { - invalidParams.Add(request.NewErrParamRequired("Suffix")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSuffix sets the Suffix field's value. -func (s *IndexDocument) SetSuffix(v string) *IndexDocument { - s.Suffix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Initiator -type Initiator struct { - _ struct{} `type:"structure"` - - // Name of the Principal. - DisplayName *string `type:"string"` - - // If the principal is an AWS account, it provides the Canonical User ID. If - // the principal is an IAM User, it provides a user ARN value. - ID *string `type:"string"` -} - -// String returns the string representation -func (s Initiator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Initiator) GoString() string { - return s.String() -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Initiator) SetDisplayName(v string) *Initiator { - s.DisplayName = &v - return s -} - -// SetID sets the ID field's value. -func (s *Initiator) SetID(v string) *Initiator { - s.ID = &v - return s -} - -// Describes the serialization format of the object. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InputSerialization -type InputSerialization struct { - _ struct{} `type:"structure"` - - // Describes the serialization of a CSV-encoded object. - CSV *CSVInput `type:"structure"` -} - -// String returns the string representation -func (s InputSerialization) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InputSerialization) GoString() string { - return s.String() -} - -// SetCSV sets the CSV field's value. -func (s *InputSerialization) SetCSV(v *CSVInput) *InputSerialization { - s.CSV = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryConfiguration -type InventoryConfiguration struct { - _ struct{} `type:"structure"` - - // Contains information about where to publish the inventory results. - // - // Destination is a required field - Destination *InventoryDestination `type:"structure" required:"true"` - - // Specifies an inventory filter. The inventory only includes objects that meet - // the filter's criteria. - Filter *InventoryFilter `type:"structure"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` - - // Specifies which object version(s) to included in the inventory results. - // - // IncludedObjectVersions is a required field - IncludedObjectVersions *string `type:"string" required:"true" enum:"InventoryIncludedObjectVersions"` - - // Specifies whether the inventory is enabled or disabled. - // - // IsEnabled is a required field - IsEnabled *bool `type:"boolean" required:"true"` - - // Contains the optional fields that are included in the inventory results. - OptionalFields []*string `locationNameList:"Field" type:"list"` - - // Specifies the schedule for generating inventory results. - // - // Schedule is a required field - Schedule *InventorySchedule `type:"structure" required:"true"` -} - -// String returns the string representation -func (s InventoryConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryConfiguration"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.IncludedObjectVersions == nil { - invalidParams.Add(request.NewErrParamRequired("IncludedObjectVersions")) - } - if s.IsEnabled == nil { - invalidParams.Add(request.NewErrParamRequired("IsEnabled")) - } - if s.Schedule == nil { - invalidParams.Add(request.NewErrParamRequired("Schedule")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - if s.Schedule != nil { - if err := s.Schedule.Validate(); err != nil { - invalidParams.AddNested("Schedule", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDestination sets the Destination field's value. -func (s *InventoryConfiguration) SetDestination(v *InventoryDestination) *InventoryConfiguration { - s.Destination = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *InventoryConfiguration) SetFilter(v *InventoryFilter) *InventoryConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *InventoryConfiguration) SetId(v string) *InventoryConfiguration { - s.Id = &v - return s -} - -// SetIncludedObjectVersions sets the IncludedObjectVersions field's value. -func (s *InventoryConfiguration) SetIncludedObjectVersions(v string) *InventoryConfiguration { - s.IncludedObjectVersions = &v - return s -} - -// SetIsEnabled sets the IsEnabled field's value. -func (s *InventoryConfiguration) SetIsEnabled(v bool) *InventoryConfiguration { - s.IsEnabled = &v - return s -} - -// SetOptionalFields sets the OptionalFields field's value. -func (s *InventoryConfiguration) SetOptionalFields(v []*string) *InventoryConfiguration { - s.OptionalFields = v - return s -} - -// SetSchedule sets the Schedule field's value. -func (s *InventoryConfiguration) SetSchedule(v *InventorySchedule) *InventoryConfiguration { - s.Schedule = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryDestination -type InventoryDestination struct { - _ struct{} `type:"structure"` - - // Contains the bucket name, file format, bucket owner (optional), and prefix - // (optional) where inventory results are published. - // - // S3BucketDestination is a required field - S3BucketDestination *InventoryS3BucketDestination `type:"structure" required:"true"` -} - -// String returns the string representation -func (s InventoryDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryDestination"} - if s.S3BucketDestination == nil { - invalidParams.Add(request.NewErrParamRequired("S3BucketDestination")) - } - if s.S3BucketDestination != nil { - if err := s.S3BucketDestination.Validate(); err != nil { - invalidParams.AddNested("S3BucketDestination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3BucketDestination sets the S3BucketDestination field's value. -func (s *InventoryDestination) SetS3BucketDestination(v *InventoryS3BucketDestination) *InventoryDestination { - s.S3BucketDestination = v - return s -} - -// Contains the type of server-side encryption used to encrypt the inventory -// results. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryEncryption -type InventoryEncryption struct { - _ struct{} `type:"structure"` - - // Specifies the use of SSE-KMS to encrypt delievered Inventory reports. - SSEKMS *SSEKMS `locationName:"SSE-KMS" type:"structure"` - - // Specifies the use of SSE-S3 to encrypt delievered Inventory reports. - SSES3 *SSES3 `locationName:"SSE-S3" type:"structure"` -} - -// String returns the string representation -func (s InventoryEncryption) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryEncryption) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryEncryption) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryEncryption"} - if s.SSEKMS != nil { - if err := s.SSEKMS.Validate(); err != nil { - invalidParams.AddNested("SSEKMS", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSSEKMS sets the SSEKMS field's value. -func (s *InventoryEncryption) SetSSEKMS(v *SSEKMS) *InventoryEncryption { - s.SSEKMS = v - return s -} - -// SetSSES3 sets the SSES3 field's value. -func (s *InventoryEncryption) SetSSES3(v *SSES3) *InventoryEncryption { - s.SSES3 = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryFilter -type InventoryFilter struct { - _ struct{} `type:"structure"` - - // The prefix that an object must have to be included in the inventory results. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s InventoryFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryFilter"} - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *InventoryFilter) SetPrefix(v string) *InventoryFilter { - s.Prefix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventoryS3BucketDestination -type InventoryS3BucketDestination struct { - _ struct{} `type:"structure"` - - // The ID of the account that owns the destination bucket. - AccountId *string `type:"string"` - - // The Amazon resource name (ARN) of the bucket where inventory results will - // be published. - // - // Bucket is a required field - Bucket *string `type:"string" required:"true"` - - // Contains the type of server-side encryption used to encrypt the inventory - // results. - Encryption *InventoryEncryption `type:"structure"` - - // Specifies the output format of the inventory results. - // - // Format is a required field - Format *string `type:"string" required:"true" enum:"InventoryFormat"` - - // The prefix that is prepended to all inventory results. - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s InventoryS3BucketDestination) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventoryS3BucketDestination) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventoryS3BucketDestination) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventoryS3BucketDestination"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Format == nil { - invalidParams.Add(request.NewErrParamRequired("Format")) - } - if s.Encryption != nil { - if err := s.Encryption.Validate(); err != nil { - invalidParams.AddNested("Encryption", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccountId sets the AccountId field's value. -func (s *InventoryS3BucketDestination) SetAccountId(v string) *InventoryS3BucketDestination { - s.AccountId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *InventoryS3BucketDestination) SetBucket(v string) *InventoryS3BucketDestination { - s.Bucket = &v - return s -} - -func (s *InventoryS3BucketDestination) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetEncryption sets the Encryption field's value. -func (s *InventoryS3BucketDestination) SetEncryption(v *InventoryEncryption) *InventoryS3BucketDestination { - s.Encryption = v - return s -} - -// SetFormat sets the Format field's value. -func (s *InventoryS3BucketDestination) SetFormat(v string) *InventoryS3BucketDestination { - s.Format = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *InventoryS3BucketDestination) SetPrefix(v string) *InventoryS3BucketDestination { - s.Prefix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/InventorySchedule -type InventorySchedule struct { - _ struct{} `type:"structure"` - - // Specifies how frequently inventory results are produced. - // - // Frequency is a required field - Frequency *string `type:"string" required:"true" enum:"InventoryFrequency"` -} - -// String returns the string representation -func (s InventorySchedule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s InventorySchedule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *InventorySchedule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "InventorySchedule"} - if s.Frequency == nil { - invalidParams.Add(request.NewErrParamRequired("Frequency")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFrequency sets the Frequency field's value. -func (s *InventorySchedule) SetFrequency(v string) *InventorySchedule { - s.Frequency = &v - return s -} - -// Container for object key name prefix and suffix filtering rules. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/S3KeyFilter -type KeyFilter struct { - _ struct{} `type:"structure"` - - // A list of containers for key value pair that defines the criteria for the - // filter rule. - FilterRules []*FilterRule `locationName:"FilterRule" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s KeyFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s KeyFilter) GoString() string { - return s.String() -} - -// SetFilterRules sets the FilterRules field's value. -func (s *KeyFilter) SetFilterRules(v []*FilterRule) *KeyFilter { - s.FilterRules = v - return s -} - -// Container for specifying the AWS Lambda notification configuration. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LambdaFunctionConfiguration -type LambdaFunctionConfiguration struct { - _ struct{} `type:"structure"` - - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Container for object key name filtering rules. For information about key - // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - Filter *NotificationConfigurationFilter `type:"structure"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // Lambda cloud function ARN that Amazon S3 can invoke when it detects events - // of the specified type. - // - // LambdaFunctionArn is a required field - LambdaFunctionArn *string `locationName:"CloudFunction" type:"string" required:"true"` -} - -// String returns the string representation -func (s LambdaFunctionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LambdaFunctionConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LambdaFunctionConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LambdaFunctionConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.LambdaFunctionArn == nil { - invalidParams.Add(request.NewErrParamRequired("LambdaFunctionArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *LambdaFunctionConfiguration) SetEvents(v []*string) *LambdaFunctionConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *LambdaFunctionConfiguration) SetFilter(v *NotificationConfigurationFilter) *LambdaFunctionConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *LambdaFunctionConfiguration) SetId(v string) *LambdaFunctionConfiguration { - s.Id = &v - return s -} - -// SetLambdaFunctionArn sets the LambdaFunctionArn field's value. -func (s *LambdaFunctionConfiguration) SetLambdaFunctionArn(v string) *LambdaFunctionConfiguration { - s.LambdaFunctionArn = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleConfiguration -type LifecycleConfiguration struct { - _ struct{} `type:"structure"` - - // Rules is a required field - Rules []*Rule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s LifecycleConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *LifecycleConfiguration) SetRules(v []*Rule) *LifecycleConfiguration { - s.Rules = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleExpiration -type LifecycleExpiration struct { - _ struct{} `type:"structure"` - - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. - Days *int64 `type:"integer"` - - // Indicates whether Amazon S3 will remove a delete marker with no noncurrent - // versions. If set to true, the delete marker will be expired; if set to false - // the policy takes no action. This cannot be specified with Days or Date in - // a Lifecycle Expiration Policy. - ExpiredObjectDeleteMarker *bool `type:"boolean"` -} - -// String returns the string representation -func (s LifecycleExpiration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleExpiration) GoString() string { - return s.String() -} - -// SetDate sets the Date field's value. -func (s *LifecycleExpiration) SetDate(v time.Time) *LifecycleExpiration { - s.Date = &v - return s -} - -// SetDays sets the Days field's value. -func (s *LifecycleExpiration) SetDays(v int64) *LifecycleExpiration { - s.Days = &v - return s -} - -// SetExpiredObjectDeleteMarker sets the ExpiredObjectDeleteMarker field's value. -func (s *LifecycleExpiration) SetExpiredObjectDeleteMarker(v bool) *LifecycleExpiration { - s.ExpiredObjectDeleteMarker = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRule -type LifecycleRule struct { - _ struct{} `type:"structure"` - - // Specifies the days since the initiation of an Incomplete Multipart Upload - // that Lifecycle will wait before permanently removing all parts of the upload. - AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` - - Expiration *LifecycleExpiration `type:"structure"` - - // The Filter is used to identify objects that a Lifecycle Rule applies to. - // A Filter must have exactly one of Prefix, Tag, or And specified. - Filter *LifecycleRuleFilter `type:"structure"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Specifies when noncurrent object versions expire. Upon expiration, Amazon - // S3 permanently deletes the noncurrent object versions. You set this lifecycle - // configuration action on a bucket that has versioning enabled (or suspended) - // to request that Amazon S3 delete noncurrent object versions at a specific - // period in the object's lifetime. - NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` - - NoncurrentVersionTransitions []*NoncurrentVersionTransition `locationName:"NoncurrentVersionTransition" type:"list" flattened:"true"` - - // Prefix identifying one or more objects to which the rule applies. This is - // deprecated; use Filter instead. - Prefix *string `deprecated:"true" type:"string"` - - // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule - // is not currently being applied. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ExpirationStatus"` - - Transitions []*Transition `locationName:"Transition" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s LifecycleRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRule"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAbortIncompleteMultipartUpload sets the AbortIncompleteMultipartUpload field's value. -func (s *LifecycleRule) SetAbortIncompleteMultipartUpload(v *AbortIncompleteMultipartUpload) *LifecycleRule { - s.AbortIncompleteMultipartUpload = v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *LifecycleRule) SetExpiration(v *LifecycleExpiration) *LifecycleRule { - s.Expiration = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *LifecycleRule) SetFilter(v *LifecycleRuleFilter) *LifecycleRule { - s.Filter = v - return s -} - -// SetID sets the ID field's value. -func (s *LifecycleRule) SetID(v string) *LifecycleRule { - s.ID = &v - return s -} - -// SetNoncurrentVersionExpiration sets the NoncurrentVersionExpiration field's value. -func (s *LifecycleRule) SetNoncurrentVersionExpiration(v *NoncurrentVersionExpiration) *LifecycleRule { - s.NoncurrentVersionExpiration = v - return s -} - -// SetNoncurrentVersionTransitions sets the NoncurrentVersionTransitions field's value. -func (s *LifecycleRule) SetNoncurrentVersionTransitions(v []*NoncurrentVersionTransition) *LifecycleRule { - s.NoncurrentVersionTransitions = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRule) SetPrefix(v string) *LifecycleRule { - s.Prefix = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *LifecycleRule) SetStatus(v string) *LifecycleRule { - s.Status = &v - return s -} - -// SetTransitions sets the Transitions field's value. -func (s *LifecycleRule) SetTransitions(v []*Transition) *LifecycleRule { - s.Transitions = v - return s -} - -// This is used in a Lifecycle Rule Filter to apply a logical AND to two or -// more predicates. The Lifecycle Rule will apply to any object matching all -// of the predicates configured inside the And operator. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRuleAndOperator -type LifecycleRuleAndOperator struct { - _ struct{} `type:"structure"` - - Prefix *string `type:"string"` - - // All of these tags must exist in the object's tag set in order for the rule - // to apply. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s LifecycleRuleAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRuleAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRuleAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRuleAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRuleAndOperator) SetPrefix(v string) *LifecycleRuleAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *LifecycleRuleAndOperator) SetTags(v []*Tag) *LifecycleRuleAndOperator { - s.Tags = v - return s -} - -// The Filter is used to identify objects that a Lifecycle Rule applies to. -// A Filter must have exactly one of Prefix, Tag, or And specified. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LifecycleRuleFilter -type LifecycleRuleFilter struct { - _ struct{} `type:"structure"` - - // This is used in a Lifecycle Rule Filter to apply a logical AND to two or - // more predicates. The Lifecycle Rule will apply to any object matching all - // of the predicates configured inside the And operator. - And *LifecycleRuleAndOperator `type:"structure"` - - // Prefix identifying one or more objects to which the rule applies. - Prefix *string `type:"string"` - - // This tag must exist in the object's tag set in order for the rule to apply. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s LifecycleRuleFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LifecycleRuleFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LifecycleRuleFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LifecycleRuleFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *LifecycleRuleFilter) SetAnd(v *LifecycleRuleAndOperator) *LifecycleRuleFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *LifecycleRuleFilter) SetPrefix(v string) *LifecycleRuleFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *LifecycleRuleFilter) SetTag(v *Tag) *LifecycleRuleFilter { - s.Tag = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurationsRequest -type ListBucketAnalyticsConfigurationsInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket from which analytics configurations are retrieved. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ContinuationToken that represents a placeholder from where this request - // should begin. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketAnalyticsConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketAnalyticsConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketAnalyticsConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketAnalyticsConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketAnalyticsConfigurationsInput) SetBucket(v string) *ListBucketAnalyticsConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketAnalyticsConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsInput) SetContinuationToken(v string) *ListBucketAnalyticsConfigurationsInput { - s.ContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketAnalyticsConfigurationsOutput -type ListBucketAnalyticsConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // The list of analytics configurations for a bucket. - AnalyticsConfigurationList []*AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"list" flattened:"true"` - - // The ContinuationToken that represents where this request began. - ContinuationToken *string `type:"string"` - - // Indicates whether the returned list of analytics configurations is complete. - // A value of true indicates that the list is not complete and the NextContinuationToken - // will be provided for a subsequent request. - IsTruncated *bool `type:"boolean"` - - // NextContinuationToken is sent when isTruncated is true, which indicates that - // there are more analytics configurations to list. The next request must include - // this NextContinuationToken. The token is obfuscated and is not a usable value. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketAnalyticsConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketAnalyticsConfigurationsOutput) GoString() string { - return s.String() -} - -// SetAnalyticsConfigurationList sets the AnalyticsConfigurationList field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetAnalyticsConfigurationList(v []*AnalyticsConfiguration) *ListBucketAnalyticsConfigurationsOutput { - s.AnalyticsConfigurationList = v - return s -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetContinuationToken(v string) *ListBucketAnalyticsConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetIsTruncated(v bool) *ListBucketAnalyticsConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketAnalyticsConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketAnalyticsConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurationsRequest -type ListBucketInventoryConfigurationsInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the inventory configurations to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The marker used to continue an inventory configuration listing that has been - // truncated. Use the NextContinuationToken from a previously truncated list - // response to continue the listing. The continuation token is an opaque value - // that Amazon S3 understands. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketInventoryConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketInventoryConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketInventoryConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketInventoryConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketInventoryConfigurationsInput) SetBucket(v string) *ListBucketInventoryConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketInventoryConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsInput) SetContinuationToken(v string) *ListBucketInventoryConfigurationsInput { - s.ContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketInventoryConfigurationsOutput -type ListBucketInventoryConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // If sent in the request, the marker that is used as a starting point for this - // inventory configuration list response. - ContinuationToken *string `type:"string"` - - // The list of inventory configurations for a bucket. - InventoryConfigurationList []*InventoryConfiguration `locationName:"InventoryConfiguration" type:"list" flattened:"true"` - - // Indicates whether the returned list of inventory configurations is truncated - // in this response. A value of true indicates that the list is truncated. - IsTruncated *bool `type:"boolean"` - - // The marker used to continue this inventory configuration listing. Use the - // NextContinuationToken from this response to continue the listing in a subsequent - // request. The continuation token is an opaque value that Amazon S3 understands. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketInventoryConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketInventoryConfigurationsOutput) GoString() string { - return s.String() -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetContinuationToken(v string) *ListBucketInventoryConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetInventoryConfigurationList sets the InventoryConfigurationList field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetInventoryConfigurationList(v []*InventoryConfiguration) *ListBucketInventoryConfigurationsOutput { - s.InventoryConfigurationList = v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetIsTruncated(v bool) *ListBucketInventoryConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketInventoryConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketInventoryConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurationsRequest -type ListBucketMetricsConfigurationsInput struct { - _ struct{} `type:"structure"` - - // The name of the bucket containing the metrics configurations to retrieve. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The marker that is used to continue a metrics configuration listing that - // has been truncated. Use the NextContinuationToken from a previously truncated - // list response to continue the listing. The continuation token is an opaque - // value that Amazon S3 understands. - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` -} - -// String returns the string representation -func (s ListBucketMetricsConfigurationsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketMetricsConfigurationsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListBucketMetricsConfigurationsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListBucketMetricsConfigurationsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListBucketMetricsConfigurationsInput) SetBucket(v string) *ListBucketMetricsConfigurationsInput { - s.Bucket = &v - return s -} - -func (s *ListBucketMetricsConfigurationsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsInput) SetContinuationToken(v string) *ListBucketMetricsConfigurationsInput { - s.ContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketMetricsConfigurationsOutput -type ListBucketMetricsConfigurationsOutput struct { - _ struct{} `type:"structure"` - - // The marker that is used as a starting point for this metrics configuration - // list response. This value is present if it was sent in the request. - ContinuationToken *string `type:"string"` - - // Indicates whether the returned list of metrics configurations is complete. - // A value of true indicates that the list is not complete and the NextContinuationToken - // will be provided for a subsequent request. - IsTruncated *bool `type:"boolean"` - - // The list of metrics configurations for a bucket. - MetricsConfigurationList []*MetricsConfiguration `locationName:"MetricsConfiguration" type:"list" flattened:"true"` - - // The marker used to continue a metrics configuration listing that has been - // truncated. Use the NextContinuationToken from a previously truncated list - // response to continue the listing. The continuation token is an opaque value - // that Amazon S3 understands. - NextContinuationToken *string `type:"string"` -} - -// String returns the string representation -func (s ListBucketMetricsConfigurationsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketMetricsConfigurationsOutput) GoString() string { - return s.String() -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetContinuationToken(v string) *ListBucketMetricsConfigurationsOutput { - s.ContinuationToken = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetIsTruncated(v bool) *ListBucketMetricsConfigurationsOutput { - s.IsTruncated = &v - return s -} - -// SetMetricsConfigurationList sets the MetricsConfigurationList field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetMetricsConfigurationList(v []*MetricsConfiguration) *ListBucketMetricsConfigurationsOutput { - s.MetricsConfigurationList = v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListBucketMetricsConfigurationsOutput) SetNextContinuationToken(v string) *ListBucketMetricsConfigurationsOutput { - s.NextContinuationToken = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketsInput -type ListBucketsInput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s ListBucketsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketsInput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListBucketsOutput -type ListBucketsOutput struct { - _ struct{} `type:"structure"` - - Buckets []*Bucket `locationNameList:"Bucket" type:"list"` - - Owner *Owner `type:"structure"` -} - -// String returns the string representation -func (s ListBucketsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListBucketsOutput) GoString() string { - return s.String() -} - -// SetBuckets sets the Buckets field's value. -func (s *ListBucketsOutput) SetBuckets(v []*Bucket) *ListBucketsOutput { - s.Buckets = v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ListBucketsOutput) SetOwner(v *Owner) *ListBucketsOutput { - s.Owner = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploadsRequest -type ListMultipartUploadsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Together with upload-id-marker, this parameter specifies the multipart upload - // after which listing should begin. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of multipart uploads, from 1 to 1,000, to return - // in the response body. 1,000 is the maximum number of uploads that can be - // returned in a response. - MaxUploads *int64 `location:"querystring" locationName:"max-uploads" type:"integer"` - - // Lists in-progress uploads only for those keys that begin with the specified - // prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Together with key-marker, specifies the multipart upload after which listing - // should begin. If key-marker is not specified, the upload-id-marker parameter - // is ignored. - UploadIdMarker *string `location:"querystring" locationName:"upload-id-marker" type:"string"` -} - -// String returns the string representation -func (s ListMultipartUploadsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListMultipartUploadsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListMultipartUploadsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListMultipartUploadsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListMultipartUploadsInput) SetBucket(v string) *ListMultipartUploadsInput { - s.Bucket = &v - return s -} - -func (s *ListMultipartUploadsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListMultipartUploadsInput) SetDelimiter(v string) *ListMultipartUploadsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListMultipartUploadsInput) SetEncodingType(v string) *ListMultipartUploadsInput { - s.EncodingType = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListMultipartUploadsInput) SetKeyMarker(v string) *ListMultipartUploadsInput { - s.KeyMarker = &v - return s -} - -// SetMaxUploads sets the MaxUploads field's value. -func (s *ListMultipartUploadsInput) SetMaxUploads(v int64) *ListMultipartUploadsInput { - s.MaxUploads = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListMultipartUploadsInput) SetPrefix(v string) *ListMultipartUploadsInput { - s.Prefix = &v - return s -} - -// SetUploadIdMarker sets the UploadIdMarker field's value. -func (s *ListMultipartUploadsInput) SetUploadIdMarker(v string) *ListMultipartUploadsInput { - s.UploadIdMarker = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListMultipartUploadsOutput -type ListMultipartUploadsOutput struct { - _ struct{} `type:"structure"` - - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string" enum:"EncodingType"` - - // Indicates whether the returned list of multipart uploads is truncated. A - // value of true indicates that the list was truncated. The list can be truncated - // if the number of multipart uploads exceeds the limit allowed or specified - // by max uploads. - IsTruncated *bool `type:"boolean"` - - // The key at or after which the listing began. - KeyMarker *string `type:"string"` - - // Maximum number of multipart uploads that could have been included in the - // response. - MaxUploads *int64 `type:"integer"` - - // When a list is truncated, this element specifies the value that should be - // used for the key-marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // When a list is truncated, this element specifies the value that should be - // used for the upload-id-marker request parameter in a subsequent request. - NextUploadIdMarker *string `type:"string"` - - // When a prefix is provided in the request, this field contains the specified - // prefix. The result contains only keys starting with the specified prefix. - Prefix *string `type:"string"` - - // Upload ID after which listing began. - UploadIdMarker *string `type:"string"` - - Uploads []*MultipartUpload `locationName:"Upload" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s ListMultipartUploadsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListMultipartUploadsOutput) GoString() string { - return s.String() -} - -// SetBucket sets the Bucket field's value. -func (s *ListMultipartUploadsOutput) SetBucket(v string) *ListMultipartUploadsOutput { - s.Bucket = &v - return s -} - -func (s *ListMultipartUploadsOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListMultipartUploadsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListMultipartUploadsOutput { - s.CommonPrefixes = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListMultipartUploadsOutput) SetDelimiter(v string) *ListMultipartUploadsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListMultipartUploadsOutput) SetEncodingType(v string) *ListMultipartUploadsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListMultipartUploadsOutput) SetIsTruncated(v bool) *ListMultipartUploadsOutput { - s.IsTruncated = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListMultipartUploadsOutput) SetKeyMarker(v string) *ListMultipartUploadsOutput { - s.KeyMarker = &v - return s -} - -// SetMaxUploads sets the MaxUploads field's value. -func (s *ListMultipartUploadsOutput) SetMaxUploads(v int64) *ListMultipartUploadsOutput { - s.MaxUploads = &v - return s -} - -// SetNextKeyMarker sets the NextKeyMarker field's value. -func (s *ListMultipartUploadsOutput) SetNextKeyMarker(v string) *ListMultipartUploadsOutput { - s.NextKeyMarker = &v - return s -} - -// SetNextUploadIdMarker sets the NextUploadIdMarker field's value. -func (s *ListMultipartUploadsOutput) SetNextUploadIdMarker(v string) *ListMultipartUploadsOutput { - s.NextUploadIdMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListMultipartUploadsOutput) SetPrefix(v string) *ListMultipartUploadsOutput { - s.Prefix = &v - return s -} - -// SetUploadIdMarker sets the UploadIdMarker field's value. -func (s *ListMultipartUploadsOutput) SetUploadIdMarker(v string) *ListMultipartUploadsOutput { - s.UploadIdMarker = &v - return s -} - -// SetUploads sets the Uploads field's value. -func (s *ListMultipartUploadsOutput) SetUploads(v []*MultipartUpload) *ListMultipartUploadsOutput { - s.Uploads = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersionsRequest -type ListObjectVersionsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Specifies the key to start with when listing objects in a bucket. - KeyMarker *string `location:"querystring" locationName:"key-marker" type:"string"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Specifies the object version you want to start listing from. - VersionIdMarker *string `location:"querystring" locationName:"version-id-marker" type:"string"` -} - -// String returns the string representation -func (s ListObjectVersionsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectVersionsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectVersionsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectVersionsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectVersionsInput) SetBucket(v string) *ListObjectVersionsInput { - s.Bucket = &v - return s -} - -func (s *ListObjectVersionsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectVersionsInput) SetDelimiter(v string) *ListObjectVersionsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectVersionsInput) SetEncodingType(v string) *ListObjectVersionsInput { - s.EncodingType = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListObjectVersionsInput) SetKeyMarker(v string) *ListObjectVersionsInput { - s.KeyMarker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectVersionsInput) SetMaxKeys(v int64) *ListObjectVersionsInput { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectVersionsInput) SetPrefix(v string) *ListObjectVersionsInput { - s.Prefix = &v - return s -} - -// SetVersionIdMarker sets the VersionIdMarker field's value. -func (s *ListObjectVersionsInput) SetVersionIdMarker(v string) *ListObjectVersionsInput { - s.VersionIdMarker = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectVersionsOutput -type ListObjectVersionsOutput struct { - _ struct{} `type:"structure"` - - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - DeleteMarkers []*DeleteMarkerEntry `locationName:"DeleteMarker" type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string" enum:"EncodingType"` - - // A flag that indicates whether or not Amazon S3 returned all of the results - // that satisfied the search criteria. If your results were truncated, you can - // make a follow-up paginated request using the NextKeyMarker and NextVersionIdMarker - // response parameters as a starting place in another request to return the - // rest of the results. - IsTruncated *bool `type:"boolean"` - - // Marks the last Key returned in a truncated response. - KeyMarker *string `type:"string"` - - MaxKeys *int64 `type:"integer"` - - Name *string `type:"string"` - - // Use this value for the key marker request parameter in a subsequent request. - NextKeyMarker *string `type:"string"` - - // Use this value for the next version id marker parameter in a subsequent request. - NextVersionIdMarker *string `type:"string"` - - Prefix *string `type:"string"` - - VersionIdMarker *string `type:"string"` - - Versions []*ObjectVersion `locationName:"Version" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s ListObjectVersionsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectVersionsOutput) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectVersionsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListObjectVersionsOutput { - s.CommonPrefixes = v - return s -} - -// SetDeleteMarkers sets the DeleteMarkers field's value. -func (s *ListObjectVersionsOutput) SetDeleteMarkers(v []*DeleteMarkerEntry) *ListObjectVersionsOutput { - s.DeleteMarkers = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectVersionsOutput) SetDelimiter(v string) *ListObjectVersionsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectVersionsOutput) SetEncodingType(v string) *ListObjectVersionsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectVersionsOutput) SetIsTruncated(v bool) *ListObjectVersionsOutput { - s.IsTruncated = &v - return s -} - -// SetKeyMarker sets the KeyMarker field's value. -func (s *ListObjectVersionsOutput) SetKeyMarker(v string) *ListObjectVersionsOutput { - s.KeyMarker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectVersionsOutput) SetMaxKeys(v int64) *ListObjectVersionsOutput { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectVersionsOutput) SetName(v string) *ListObjectVersionsOutput { - s.Name = &v - return s -} - -// SetNextKeyMarker sets the NextKeyMarker field's value. -func (s *ListObjectVersionsOutput) SetNextKeyMarker(v string) *ListObjectVersionsOutput { - s.NextKeyMarker = &v - return s -} - -// SetNextVersionIdMarker sets the NextVersionIdMarker field's value. -func (s *ListObjectVersionsOutput) SetNextVersionIdMarker(v string) *ListObjectVersionsOutput { - s.NextVersionIdMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectVersionsOutput) SetPrefix(v string) *ListObjectVersionsOutput { - s.Prefix = &v - return s -} - -// SetVersionIdMarker sets the VersionIdMarker field's value. -func (s *ListObjectVersionsOutput) SetVersionIdMarker(v string) *ListObjectVersionsOutput { - s.VersionIdMarker = &v - return s -} - -// SetVersions sets the Versions field's value. -func (s *ListObjectVersionsOutput) SetVersions(v []*ObjectVersion) *ListObjectVersionsOutput { - s.Versions = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsRequest -type ListObjectsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Requests Amazon S3 to encode the object keys in the response and specifies - // the encoding method to use. An object key may contain any Unicode character; - // however, XML 1.0 parser cannot parse some characters, such as characters - // with an ASCII value from 0 to 10. For characters that are not supported in - // XML 1.0, you can add this parameter to request that Amazon S3 encode the - // keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // Specifies the key to start with when listing objects in a bucket. - Marker *string `location:"querystring" locationName:"marker" type:"string"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // list objects request. Bucket owners need not specify this parameter in their - // requests. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` -} - -// String returns the string representation -func (s ListObjectsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectsInput) SetBucket(v string) *ListObjectsInput { - s.Bucket = &v - return s -} - -func (s *ListObjectsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsInput) SetDelimiter(v string) *ListObjectsInput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsInput) SetEncodingType(v string) *ListObjectsInput { - s.EncodingType = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListObjectsInput) SetMarker(v string) *ListObjectsInput { - s.Marker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsInput) SetMaxKeys(v int64) *ListObjectsInput { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsInput) SetPrefix(v string) *ListObjectsInput { - s.Prefix = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListObjectsInput) SetRequestPayer(v string) *ListObjectsInput { - s.RequestPayer = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsOutput -type ListObjectsOutput struct { - _ struct{} `type:"structure"` - - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - Contents []*Object `type:"list" flattened:"true"` - - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string" enum:"EncodingType"` - - // A flag that indicates whether or not Amazon S3 returned all of the results - // that satisfied the search criteria. - IsTruncated *bool `type:"boolean"` - - Marker *string `type:"string"` - - MaxKeys *int64 `type:"integer"` - - Name *string `type:"string"` - - // When response is truncated (the IsTruncated element value in the response - // is true), you can use the key name in this field as marker in the subsequent - // request to get next set of objects. Amazon S3 lists objects in alphabetical - // order Note: This element is returned only if you have delimiter request parameter - // specified. If response does not include the NextMaker and it is truncated, - // you can use the value of the last Key in the response as the marker in the - // subsequent request to get the next set of object keys. - NextMarker *string `type:"string"` - - Prefix *string `type:"string"` -} - -// String returns the string representation -func (s ListObjectsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsOutput) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectsOutput) SetCommonPrefixes(v []*CommonPrefix) *ListObjectsOutput { - s.CommonPrefixes = v - return s -} - -// SetContents sets the Contents field's value. -func (s *ListObjectsOutput) SetContents(v []*Object) *ListObjectsOutput { - s.Contents = v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsOutput) SetDelimiter(v string) *ListObjectsOutput { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsOutput) SetEncodingType(v string) *ListObjectsOutput { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectsOutput) SetIsTruncated(v bool) *ListObjectsOutput { - s.IsTruncated = &v - return s -} - -// SetMarker sets the Marker field's value. -func (s *ListObjectsOutput) SetMarker(v string) *ListObjectsOutput { - s.Marker = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsOutput) SetMaxKeys(v int64) *ListObjectsOutput { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectsOutput) SetName(v string) *ListObjectsOutput { - s.Name = &v - return s -} - -// SetNextMarker sets the NextMarker field's value. -func (s *ListObjectsOutput) SetNextMarker(v string) *ListObjectsOutput { - s.NextMarker = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsOutput) SetPrefix(v string) *ListObjectsOutput { - s.Prefix = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2Request -type ListObjectsV2Input struct { - _ struct{} `type:"structure"` - - // Name of the bucket to list. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // ContinuationToken indicates Amazon S3 that the list is being continued on - // this bucket with a token. ContinuationToken is obfuscated and is not a real - // key - ContinuationToken *string `location:"querystring" locationName:"continuation-token" type:"string"` - - // A delimiter is a character you use to group keys. - Delimiter *string `location:"querystring" locationName:"delimiter" type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `location:"querystring" locationName:"encoding-type" type:"string" enum:"EncodingType"` - - // The owner field is not present in listV2 by default, if you want to return - // owner field with each key in the result then set the fetch owner field to - // true - FetchOwner *bool `location:"querystring" locationName:"fetch-owner" type:"boolean"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `location:"querystring" locationName:"max-keys" type:"integer"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `location:"querystring" locationName:"prefix" type:"string"` - - // Confirms that the requester knows that she or he will be charged for the - // list objects request in V2 style. Bucket owners need not specify this parameter - // in their requests. - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts - // listing after this specified key. StartAfter can be any key in the bucket - StartAfter *string `location:"querystring" locationName:"start-after" type:"string"` -} - -// String returns the string representation -func (s ListObjectsV2Input) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsV2Input) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListObjectsV2Input) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListObjectsV2Input"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListObjectsV2Input) SetBucket(v string) *ListObjectsV2Input { - s.Bucket = &v - return s -} - -func (s *ListObjectsV2Input) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListObjectsV2Input) SetContinuationToken(v string) *ListObjectsV2Input { - s.ContinuationToken = &v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsV2Input) SetDelimiter(v string) *ListObjectsV2Input { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsV2Input) SetEncodingType(v string) *ListObjectsV2Input { - s.EncodingType = &v - return s -} - -// SetFetchOwner sets the FetchOwner field's value. -func (s *ListObjectsV2Input) SetFetchOwner(v bool) *ListObjectsV2Input { - s.FetchOwner = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsV2Input) SetMaxKeys(v int64) *ListObjectsV2Input { - s.MaxKeys = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsV2Input) SetPrefix(v string) *ListObjectsV2Input { - s.Prefix = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListObjectsV2Input) SetRequestPayer(v string) *ListObjectsV2Input { - s.RequestPayer = &v - return s -} - -// SetStartAfter sets the StartAfter field's value. -func (s *ListObjectsV2Input) SetStartAfter(v string) *ListObjectsV2Input { - s.StartAfter = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListObjectsV2Output -type ListObjectsV2Output struct { - _ struct{} `type:"structure"` - - // CommonPrefixes contains all (if there are any) keys between Prefix and the - // next occurrence of the string specified by delimiter - CommonPrefixes []*CommonPrefix `type:"list" flattened:"true"` - - // Metadata about each object returned. - Contents []*Object `type:"list" flattened:"true"` - - // ContinuationToken indicates Amazon S3 that the list is being continued on - // this bucket with a token. ContinuationToken is obfuscated and is not a real - // key - ContinuationToken *string `type:"string"` - - // A delimiter is a character you use to group keys. - Delimiter *string `type:"string"` - - // Encoding type used by Amazon S3 to encode object keys in the response. - EncodingType *string `type:"string" enum:"EncodingType"` - - // A flag that indicates whether or not Amazon S3 returned all of the results - // that satisfied the search criteria. - IsTruncated *bool `type:"boolean"` - - // KeyCount is the number of keys returned with this request. KeyCount will - // always be less than equals to MaxKeys field. Say you ask for 50 keys, your - // result will include less than equals 50 keys - KeyCount *int64 `type:"integer"` - - // Sets the maximum number of keys returned in the response. The response might - // contain fewer keys but will never contain more. - MaxKeys *int64 `type:"integer"` - - // Name of the bucket to list. - Name *string `type:"string"` - - // NextContinuationToken is sent when isTruncated is true which means there - // are more keys in the bucket that can be listed. The next list requests to - // Amazon S3 can be continued with this NextContinuationToken. NextContinuationToken - // is obfuscated and is not a real key - NextContinuationToken *string `type:"string"` - - // Limits the response to keys that begin with the specified prefix. - Prefix *string `type:"string"` - - // StartAfter is where you want Amazon S3 to start listing from. Amazon S3 starts - // listing after this specified key. StartAfter can be any key in the bucket - StartAfter *string `type:"string"` -} - -// String returns the string representation -func (s ListObjectsV2Output) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListObjectsV2Output) GoString() string { - return s.String() -} - -// SetCommonPrefixes sets the CommonPrefixes field's value. -func (s *ListObjectsV2Output) SetCommonPrefixes(v []*CommonPrefix) *ListObjectsV2Output { - s.CommonPrefixes = v - return s -} - -// SetContents sets the Contents field's value. -func (s *ListObjectsV2Output) SetContents(v []*Object) *ListObjectsV2Output { - s.Contents = v - return s -} - -// SetContinuationToken sets the ContinuationToken field's value. -func (s *ListObjectsV2Output) SetContinuationToken(v string) *ListObjectsV2Output { - s.ContinuationToken = &v - return s -} - -// SetDelimiter sets the Delimiter field's value. -func (s *ListObjectsV2Output) SetDelimiter(v string) *ListObjectsV2Output { - s.Delimiter = &v - return s -} - -// SetEncodingType sets the EncodingType field's value. -func (s *ListObjectsV2Output) SetEncodingType(v string) *ListObjectsV2Output { - s.EncodingType = &v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListObjectsV2Output) SetIsTruncated(v bool) *ListObjectsV2Output { - s.IsTruncated = &v - return s -} - -// SetKeyCount sets the KeyCount field's value. -func (s *ListObjectsV2Output) SetKeyCount(v int64) *ListObjectsV2Output { - s.KeyCount = &v - return s -} - -// SetMaxKeys sets the MaxKeys field's value. -func (s *ListObjectsV2Output) SetMaxKeys(v int64) *ListObjectsV2Output { - s.MaxKeys = &v - return s -} - -// SetName sets the Name field's value. -func (s *ListObjectsV2Output) SetName(v string) *ListObjectsV2Output { - s.Name = &v - return s -} - -// SetNextContinuationToken sets the NextContinuationToken field's value. -func (s *ListObjectsV2Output) SetNextContinuationToken(v string) *ListObjectsV2Output { - s.NextContinuationToken = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ListObjectsV2Output) SetPrefix(v string) *ListObjectsV2Output { - s.Prefix = &v - return s -} - -// SetStartAfter sets the StartAfter field's value. -func (s *ListObjectsV2Output) SetStartAfter(v string) *ListObjectsV2Output { - s.StartAfter = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListPartsRequest -type ListPartsInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Sets the maximum number of parts to return. - MaxParts *int64 `location:"querystring" locationName:"max-parts" type:"integer"` - - // Specifies the part after which listing should begin. Only parts with higher - // part numbers will be listed. - PartNumberMarker *int64 `location:"querystring" locationName:"part-number-marker" type:"integer"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Upload ID identifying the multipart upload whose parts are being listed. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s ListPartsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPartsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ListPartsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ListPartsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *ListPartsInput) SetBucket(v string) *ListPartsInput { - s.Bucket = &v - return s -} - -func (s *ListPartsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *ListPartsInput) SetKey(v string) *ListPartsInput { - s.Key = &v - return s -} - -// SetMaxParts sets the MaxParts field's value. -func (s *ListPartsInput) SetMaxParts(v int64) *ListPartsInput { - s.MaxParts = &v - return s -} - -// SetPartNumberMarker sets the PartNumberMarker field's value. -func (s *ListPartsInput) SetPartNumberMarker(v int64) *ListPartsInput { - s.PartNumberMarker = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *ListPartsInput) SetRequestPayer(v string) *ListPartsInput { - s.RequestPayer = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *ListPartsInput) SetUploadId(v string) *ListPartsInput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ListPartsOutput -type ListPartsOutput struct { - _ struct{} `type:"structure"` - - // Date when multipart upload will become eligible for abort operation by lifecycle. - AbortDate *time.Time `location:"header" locationName:"x-amz-abort-date" type:"timestamp" timestampFormat:"rfc822"` - - // Id of the lifecycle rule that makes a multipart upload eligible for abort - // operation. - AbortRuleId *string `location:"header" locationName:"x-amz-abort-rule-id" type:"string"` - - // Name of the bucket to which the multipart upload was initiated. - Bucket *string `type:"string"` - - // Identifies who initiated the multipart upload. - Initiator *Initiator `type:"structure"` - - // Indicates whether the returned list of parts is truncated. - IsTruncated *bool `type:"boolean"` - - // Object key for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - // Maximum number of parts that were allowed in the response. - MaxParts *int64 `type:"integer"` - - // When a list is truncated, this element specifies the last part in the list, - // as well as the value to use for the part-number-marker request parameter - // in a subsequent request. - NextPartNumberMarker *int64 `type:"integer"` - - Owner *Owner `type:"structure"` - - // Part number after which listing begins. - PartNumberMarker *int64 `type:"integer"` - - Parts []*Part `locationName:"Part" type:"list" flattened:"true"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"StorageClass"` - - // Upload ID identifying the multipart upload whose parts are being listed. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s ListPartsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ListPartsOutput) GoString() string { - return s.String() -} - -// SetAbortDate sets the AbortDate field's value. -func (s *ListPartsOutput) SetAbortDate(v time.Time) *ListPartsOutput { - s.AbortDate = &v - return s -} - -// SetAbortRuleId sets the AbortRuleId field's value. -func (s *ListPartsOutput) SetAbortRuleId(v string) *ListPartsOutput { - s.AbortRuleId = &v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *ListPartsOutput) SetBucket(v string) *ListPartsOutput { - s.Bucket = &v - return s -} - -func (s *ListPartsOutput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetInitiator sets the Initiator field's value. -func (s *ListPartsOutput) SetInitiator(v *Initiator) *ListPartsOutput { - s.Initiator = v - return s -} - -// SetIsTruncated sets the IsTruncated field's value. -func (s *ListPartsOutput) SetIsTruncated(v bool) *ListPartsOutput { - s.IsTruncated = &v - return s -} - -// SetKey sets the Key field's value. -func (s *ListPartsOutput) SetKey(v string) *ListPartsOutput { - s.Key = &v - return s -} - -// SetMaxParts sets the MaxParts field's value. -func (s *ListPartsOutput) SetMaxParts(v int64) *ListPartsOutput { - s.MaxParts = &v - return s -} - -// SetNextPartNumberMarker sets the NextPartNumberMarker field's value. -func (s *ListPartsOutput) SetNextPartNumberMarker(v int64) *ListPartsOutput { - s.NextPartNumberMarker = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ListPartsOutput) SetOwner(v *Owner) *ListPartsOutput { - s.Owner = v - return s -} - -// SetPartNumberMarker sets the PartNumberMarker field's value. -func (s *ListPartsOutput) SetPartNumberMarker(v int64) *ListPartsOutput { - s.PartNumberMarker = &v - return s -} - -// SetParts sets the Parts field's value. -func (s *ListPartsOutput) SetParts(v []*Part) *ListPartsOutput { - s.Parts = v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *ListPartsOutput) SetRequestCharged(v string) *ListPartsOutput { - s.RequestCharged = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *ListPartsOutput) SetStorageClass(v string) *ListPartsOutput { - s.StorageClass = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *ListPartsOutput) SetUploadId(v string) *ListPartsOutput { - s.UploadId = &v - return s -} - -// Describes an S3 location that will receive the results of the restore request. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/S3Location -type Location struct { - _ struct{} `type:"structure"` - - // A list of grants that control access to the staged results. - AccessControlList []*Grant `locationNameList:"Grant" type:"list"` - - // The name of the bucket where the restore results will be placed. - // - // BucketName is a required field - BucketName *string `type:"string" required:"true"` - - // The canned ACL to apply to the restore results. - CannedACL *string `type:"string" enum:"ObjectCannedACL"` - - // Describes the server-side encryption that will be applied to the restore - // results. - Encryption *Encryption `type:"structure"` - - // The prefix that is prepended to the restore results for this request. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` - - // The class of storage used to store the restore results. - StorageClass *string `type:"string" enum:"StorageClass"` - - // The tag-set that is applied to the restore results. - Tagging *Tagging `type:"structure"` - - // A list of metadata to store with the restore results in S3. - UserMetadata []*MetadataEntry `locationNameList:"MetadataEntry" type:"list"` -} - -// String returns the string representation -func (s Location) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Location) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Location) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Location"} - if s.BucketName == nil { - invalidParams.Add(request.NewErrParamRequired("BucketName")) - } - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - if s.AccessControlList != nil { - for i, v := range s.AccessControlList { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "AccessControlList", i), err.(request.ErrInvalidParams)) - } - } - } - if s.Encryption != nil { - if err := s.Encryption.Validate(); err != nil { - invalidParams.AddNested("Encryption", err.(request.ErrInvalidParams)) - } - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccessControlList sets the AccessControlList field's value. -func (s *Location) SetAccessControlList(v []*Grant) *Location { - s.AccessControlList = v - return s -} - -// SetBucketName sets the BucketName field's value. -func (s *Location) SetBucketName(v string) *Location { - s.BucketName = &v - return s -} - -// SetCannedACL sets the CannedACL field's value. -func (s *Location) SetCannedACL(v string) *Location { - s.CannedACL = &v - return s -} - -// SetEncryption sets the Encryption field's value. -func (s *Location) SetEncryption(v *Encryption) *Location { - s.Encryption = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *Location) SetPrefix(v string) *Location { - s.Prefix = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Location) SetStorageClass(v string) *Location { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *Location) SetTagging(v *Tagging) *Location { - s.Tagging = v - return s -} - -// SetUserMetadata sets the UserMetadata field's value. -func (s *Location) SetUserMetadata(v []*MetadataEntry) *Location { - s.UserMetadata = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/LoggingEnabled -type LoggingEnabled struct { - _ struct{} `type:"structure"` - - // Specifies the bucket where you want Amazon S3 to store server access logs. - // You can have your logs delivered to any bucket that you own, including the - // same bucket that is being logged. You can also configure multiple buckets - // to deliver their logs to the same target bucket. In this case you should - // choose a different TargetPrefix for each source bucket so that the delivered - // log files can be distinguished by key. - TargetBucket *string `type:"string"` - - TargetGrants []*TargetGrant `locationNameList:"Grant" type:"list"` - - // This element lets you specify a prefix for the keys that the log files will - // be stored under. - TargetPrefix *string `type:"string"` -} - -// String returns the string representation -func (s LoggingEnabled) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s LoggingEnabled) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *LoggingEnabled) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "LoggingEnabled"} - if s.TargetGrants != nil { - for i, v := range s.TargetGrants { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TargetGrants", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTargetBucket sets the TargetBucket field's value. -func (s *LoggingEnabled) SetTargetBucket(v string) *LoggingEnabled { - s.TargetBucket = &v - return s -} - -// SetTargetGrants sets the TargetGrants field's value. -func (s *LoggingEnabled) SetTargetGrants(v []*TargetGrant) *LoggingEnabled { - s.TargetGrants = v - return s -} - -// SetTargetPrefix sets the TargetPrefix field's value. -func (s *LoggingEnabled) SetTargetPrefix(v string) *LoggingEnabled { - s.TargetPrefix = &v - return s -} - -// A metadata key-value pair to store with an object. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetadataEntry -type MetadataEntry struct { - _ struct{} `type:"structure"` - - Name *string `type:"string"` - - Value *string `type:"string"` -} - -// String returns the string representation -func (s MetadataEntry) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetadataEntry) GoString() string { - return s.String() -} - -// SetName sets the Name field's value. -func (s *MetadataEntry) SetName(v string) *MetadataEntry { - s.Name = &v - return s -} - -// SetValue sets the Value field's value. -func (s *MetadataEntry) SetValue(v string) *MetadataEntry { - s.Value = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsAndOperator -type MetricsAndOperator struct { - _ struct{} `type:"structure"` - - // The prefix used when evaluating an AND predicate. - Prefix *string `type:"string"` - - // The list of tags used when evaluating an AND predicate. - Tags []*Tag `locationName:"Tag" locationNameList:"Tag" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s MetricsAndOperator) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsAndOperator) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsAndOperator) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsAndOperator"} - if s.Tags != nil { - for i, v := range s.Tags { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Tags", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPrefix sets the Prefix field's value. -func (s *MetricsAndOperator) SetPrefix(v string) *MetricsAndOperator { - s.Prefix = &v - return s -} - -// SetTags sets the Tags field's value. -func (s *MetricsAndOperator) SetTags(v []*Tag) *MetricsAndOperator { - s.Tags = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsConfiguration -type MetricsConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies a metrics configuration filter. The metrics configuration will - // only include objects that meet the filter's criteria. A filter must be a - // prefix, a tag, or a conjunction (MetricsAndOperator). - Filter *MetricsFilter `type:"structure"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s MetricsConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsConfiguration"} - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.Filter != nil { - if err := s.Filter.Validate(); err != nil { - invalidParams.AddNested("Filter", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetFilter sets the Filter field's value. -func (s *MetricsConfiguration) SetFilter(v *MetricsFilter) *MetricsConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *MetricsConfiguration) SetId(v string) *MetricsConfiguration { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MetricsFilter -type MetricsFilter struct { - _ struct{} `type:"structure"` - - // A conjunction (logical AND) of predicates, which is used in evaluating a - // metrics filter. The operator must have at least two predicates, and an object - // must match all of the predicates in order for the filter to apply. - And *MetricsAndOperator `type:"structure"` - - // The prefix used when evaluating a metrics filter. - Prefix *string `type:"string"` - - // The tag used when evaluating a metrics filter. - Tag *Tag `type:"structure"` -} - -// String returns the string representation -func (s MetricsFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MetricsFilter) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *MetricsFilter) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "MetricsFilter"} - if s.And != nil { - if err := s.And.Validate(); err != nil { - invalidParams.AddNested("And", err.(request.ErrInvalidParams)) - } - } - if s.Tag != nil { - if err := s.Tag.Validate(); err != nil { - invalidParams.AddNested("Tag", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnd sets the And field's value. -func (s *MetricsFilter) SetAnd(v *MetricsAndOperator) *MetricsFilter { - s.And = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *MetricsFilter) SetPrefix(v string) *MetricsFilter { - s.Prefix = &v - return s -} - -// SetTag sets the Tag field's value. -func (s *MetricsFilter) SetTag(v *Tag) *MetricsFilter { - s.Tag = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/MultipartUpload -type MultipartUpload struct { - _ struct{} `type:"structure"` - - // Date and time at which the multipart upload was initiated. - Initiated *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Identifies who initiated the multipart upload. - Initiator *Initiator `type:"structure"` - - // Key of the object for which the multipart upload was initiated. - Key *string `min:"1" type:"string"` - - Owner *Owner `type:"structure"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"StorageClass"` - - // Upload ID that identifies the multipart upload. - UploadId *string `type:"string"` -} - -// String returns the string representation -func (s MultipartUpload) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s MultipartUpload) GoString() string { - return s.String() -} - -// SetInitiated sets the Initiated field's value. -func (s *MultipartUpload) SetInitiated(v time.Time) *MultipartUpload { - s.Initiated = &v - return s -} - -// SetInitiator sets the Initiator field's value. -func (s *MultipartUpload) SetInitiator(v *Initiator) *MultipartUpload { - s.Initiator = v - return s -} - -// SetKey sets the Key field's value. -func (s *MultipartUpload) SetKey(v string) *MultipartUpload { - s.Key = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *MultipartUpload) SetOwner(v *Owner) *MultipartUpload { - s.Owner = v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *MultipartUpload) SetStorageClass(v string) *MultipartUpload { - s.StorageClass = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *MultipartUpload) SetUploadId(v string) *MultipartUpload { - s.UploadId = &v - return s -} - -// Specifies when noncurrent object versions expire. Upon expiration, Amazon -// S3 permanently deletes the noncurrent object versions. You set this lifecycle -// configuration action on a bucket that has versioning enabled (or suspended) -// to request that Amazon S3 delete noncurrent object versions at a specific -// period in the object's lifetime. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoncurrentVersionExpiration -type NoncurrentVersionExpiration struct { - _ struct{} `type:"structure"` - - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) - NoncurrentDays *int64 `type:"integer"` -} - -// String returns the string representation -func (s NoncurrentVersionExpiration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NoncurrentVersionExpiration) GoString() string { - return s.String() -} - -// SetNoncurrentDays sets the NoncurrentDays field's value. -func (s *NoncurrentVersionExpiration) SetNoncurrentDays(v int64) *NoncurrentVersionExpiration { - s.NoncurrentDays = &v - return s -} - -// Container for the transition rule that describes when noncurrent objects -// transition to the STANDARD_IA or GLACIER storage class. If your bucket is -// versioning-enabled (or versioning is suspended), you can set this action -// to request that Amazon S3 transition noncurrent object versions to the STANDARD_IA -// or GLACIER storage class at a specific period in the object's lifetime. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NoncurrentVersionTransition -type NoncurrentVersionTransition struct { - _ struct{} `type:"structure"` - - // Specifies the number of days an object is noncurrent before Amazon S3 can - // perform the associated action. For information about the noncurrent days - // calculations, see How Amazon S3 Calculates When an Object Became Noncurrent - // (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-access-control.html) - NoncurrentDays *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"TransitionStorageClass"` -} - -// String returns the string representation -func (s NoncurrentVersionTransition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NoncurrentVersionTransition) GoString() string { - return s.String() -} - -// SetNoncurrentDays sets the NoncurrentDays field's value. -func (s *NoncurrentVersionTransition) SetNoncurrentDays(v int64) *NoncurrentVersionTransition { - s.NoncurrentDays = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *NoncurrentVersionTransition) SetStorageClass(v string) *NoncurrentVersionTransition { - s.StorageClass = &v - return s -} - -// Container for specifying the notification configuration of the bucket. If -// this element is empty, notifications are turned off on the bucket. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfiguration -type NotificationConfiguration struct { - _ struct{} `type:"structure"` - - LambdaFunctionConfigurations []*LambdaFunctionConfiguration `locationName:"CloudFunctionConfiguration" type:"list" flattened:"true"` - - QueueConfigurations []*QueueConfiguration `locationName:"QueueConfiguration" type:"list" flattened:"true"` - - TopicConfigurations []*TopicConfiguration `locationName:"TopicConfiguration" type:"list" flattened:"true"` -} - -// String returns the string representation -func (s NotificationConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *NotificationConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "NotificationConfiguration"} - if s.LambdaFunctionConfigurations != nil { - for i, v := range s.LambdaFunctionConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "LambdaFunctionConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - if s.QueueConfigurations != nil { - for i, v := range s.QueueConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "QueueConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - if s.TopicConfigurations != nil { - for i, v := range s.TopicConfigurations { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TopicConfigurations", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetLambdaFunctionConfigurations sets the LambdaFunctionConfigurations field's value. -func (s *NotificationConfiguration) SetLambdaFunctionConfigurations(v []*LambdaFunctionConfiguration) *NotificationConfiguration { - s.LambdaFunctionConfigurations = v - return s -} - -// SetQueueConfigurations sets the QueueConfigurations field's value. -func (s *NotificationConfiguration) SetQueueConfigurations(v []*QueueConfiguration) *NotificationConfiguration { - s.QueueConfigurations = v - return s -} - -// SetTopicConfigurations sets the TopicConfigurations field's value. -func (s *NotificationConfiguration) SetTopicConfigurations(v []*TopicConfiguration) *NotificationConfiguration { - s.TopicConfigurations = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfigurationDeprecated -type NotificationConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - CloudFunctionConfiguration *CloudFunctionConfiguration `type:"structure"` - - QueueConfiguration *QueueConfigurationDeprecated `type:"structure"` - - TopicConfiguration *TopicConfigurationDeprecated `type:"structure"` -} - -// String returns the string representation -func (s NotificationConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetCloudFunctionConfiguration sets the CloudFunctionConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetCloudFunctionConfiguration(v *CloudFunctionConfiguration) *NotificationConfigurationDeprecated { - s.CloudFunctionConfiguration = v - return s -} - -// SetQueueConfiguration sets the QueueConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetQueueConfiguration(v *QueueConfigurationDeprecated) *NotificationConfigurationDeprecated { - s.QueueConfiguration = v - return s -} - -// SetTopicConfiguration sets the TopicConfiguration field's value. -func (s *NotificationConfigurationDeprecated) SetTopicConfiguration(v *TopicConfigurationDeprecated) *NotificationConfigurationDeprecated { - s.TopicConfiguration = v - return s -} - -// Container for object key name filtering rules. For information about key -// name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/NotificationConfigurationFilter -type NotificationConfigurationFilter struct { - _ struct{} `type:"structure"` - - // Container for object key name prefix and suffix filtering rules. - Key *KeyFilter `locationName:"S3Key" type:"structure"` -} - -// String returns the string representation -func (s NotificationConfigurationFilter) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s NotificationConfigurationFilter) GoString() string { - return s.String() -} - -// SetKey sets the Key field's value. -func (s *NotificationConfigurationFilter) SetKey(v *KeyFilter) *NotificationConfigurationFilter { - s.Key = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Object -type Object struct { - _ struct{} `type:"structure"` - - ETag *string `type:"string"` - - Key *string `min:"1" type:"string"` - - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"ObjectStorageClass"` -} - -// String returns the string representation -func (s Object) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Object) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *Object) SetETag(v string) *Object { - s.ETag = &v - return s -} - -// SetKey sets the Key field's value. -func (s *Object) SetKey(v string) *Object { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *Object) SetLastModified(v time.Time) *Object { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *Object) SetOwner(v *Owner) *Object { - s.Owner = v - return s -} - -// SetSize sets the Size field's value. -func (s *Object) SetSize(v int64) *Object { - s.Size = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Object) SetStorageClass(v string) *Object { - s.StorageClass = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectIdentifier -type ObjectIdentifier struct { - _ struct{} `type:"structure"` - - // Key name of the object to delete. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // VersionId for the specific version of the object to delete. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s ObjectIdentifier) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectIdentifier) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ObjectIdentifier) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ObjectIdentifier"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *ObjectIdentifier) SetKey(v string) *ObjectIdentifier { - s.Key = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *ObjectIdentifier) SetVersionId(v string) *ObjectIdentifier { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ObjectVersion -type ObjectVersion struct { - _ struct{} `type:"structure"` - - ETag *string `type:"string"` - - // Specifies whether the object is (true) or is not (false) the latest version - // of an object. - IsLatest *bool `type:"boolean"` - - // The object key. - Key *string `min:"1" type:"string"` - - // Date and time the object was last modified. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - Owner *Owner `type:"structure"` - - // Size in bytes of the object. - Size *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"ObjectVersionStorageClass"` - - // Version ID of an object. - VersionId *string `type:"string"` -} - -// String returns the string representation -func (s ObjectVersion) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ObjectVersion) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *ObjectVersion) SetETag(v string) *ObjectVersion { - s.ETag = &v - return s -} - -// SetIsLatest sets the IsLatest field's value. -func (s *ObjectVersion) SetIsLatest(v bool) *ObjectVersion { - s.IsLatest = &v - return s -} - -// SetKey sets the Key field's value. -func (s *ObjectVersion) SetKey(v string) *ObjectVersion { - s.Key = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *ObjectVersion) SetLastModified(v time.Time) *ObjectVersion { - s.LastModified = &v - return s -} - -// SetOwner sets the Owner field's value. -func (s *ObjectVersion) SetOwner(v *Owner) *ObjectVersion { - s.Owner = v - return s -} - -// SetSize sets the Size field's value. -func (s *ObjectVersion) SetSize(v int64) *ObjectVersion { - s.Size = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *ObjectVersion) SetStorageClass(v string) *ObjectVersion { - s.StorageClass = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *ObjectVersion) SetVersionId(v string) *ObjectVersion { - s.VersionId = &v - return s -} - -// Describes the location where the restore job's output is stored. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/OutputLocation -type OutputLocation struct { - _ struct{} `type:"structure"` - - // Describes an S3 location that will receive the results of the restore request. - S3 *Location `type:"structure"` -} - -// String returns the string representation -func (s OutputLocation) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s OutputLocation) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *OutputLocation) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "OutputLocation"} - if s.S3 != nil { - if err := s.S3.Validate(); err != nil { - invalidParams.AddNested("S3", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetS3 sets the S3 field's value. -func (s *OutputLocation) SetS3(v *Location) *OutputLocation { - s.S3 = v - return s -} - -// Describes how results of the Select job are serialized. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/OutputSerialization -type OutputSerialization struct { - _ struct{} `type:"structure"` - - // Describes the serialization of CSV-encoded Select results. - CSV *CSVOutput `type:"structure"` -} - -// String returns the string representation -func (s OutputSerialization) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s OutputSerialization) GoString() string { - return s.String() -} - -// SetCSV sets the CSV field's value. -func (s *OutputSerialization) SetCSV(v *CSVOutput) *OutputSerialization { - s.CSV = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Owner -type Owner struct { - _ struct{} `type:"structure"` - - DisplayName *string `type:"string"` - - ID *string `type:"string"` -} - -// String returns the string representation -func (s Owner) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Owner) GoString() string { - return s.String() -} - -// SetDisplayName sets the DisplayName field's value. -func (s *Owner) SetDisplayName(v string) *Owner { - s.DisplayName = &v - return s -} - -// SetID sets the ID field's value. -func (s *Owner) SetID(v string) *Owner { - s.ID = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Part -type Part struct { - _ struct{} `type:"structure"` - - // Entity tag returned when the part was uploaded. - ETag *string `type:"string"` - - // Date and time at which the part was uploaded. - LastModified *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Part number identifying the part. This is a positive integer between 1 and - // 10,000. - PartNumber *int64 `type:"integer"` - - // Size of the uploaded part data. - Size *int64 `type:"integer"` -} - -// String returns the string representation -func (s Part) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Part) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *Part) SetETag(v string) *Part { - s.ETag = &v - return s -} - -// SetLastModified sets the LastModified field's value. -func (s *Part) SetLastModified(v time.Time) *Part { - s.LastModified = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *Part) SetPartNumber(v int64) *Part { - s.PartNumber = &v - return s -} - -// SetSize sets the Size field's value. -func (s *Part) SetSize(v int64) *Part { - s.Size = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfigurationRequest -type PutBucketAccelerateConfigurationInput struct { - _ struct{} `type:"structure" payload:"AccelerateConfiguration"` - - // Specifies the Accelerate Configuration you want to set for the bucket. - // - // AccelerateConfiguration is a required field - AccelerateConfiguration *AccelerateConfiguration `locationName:"AccelerateConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Name of the bucket for which the accelerate configuration is set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketAccelerateConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAccelerateConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAccelerateConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAccelerateConfigurationInput"} - if s.AccelerateConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("AccelerateConfiguration")) - } - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAccelerateConfiguration sets the AccelerateConfiguration field's value. -func (s *PutBucketAccelerateConfigurationInput) SetAccelerateConfiguration(v *AccelerateConfiguration) *PutBucketAccelerateConfigurationInput { - s.AccelerateConfiguration = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAccelerateConfigurationInput) SetBucket(v string) *PutBucketAccelerateConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAccelerateConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAccelerateConfigurationOutput -type PutBucketAccelerateConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAccelerateConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAccelerateConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAclRequest -type PutBucketAclInput struct { - _ struct{} `type:"structure" payload:"AccessControlPolicy"` - - // The canned ACL to apply to the bucket. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"BucketCannedACL"` - - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` -} - -// String returns the string representation -func (s PutBucketAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.AccessControlPolicy != nil { - if err := s.AccessControlPolicy.Validate(); err != nil { - invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutBucketAclInput) SetACL(v string) *PutBucketAclInput { - s.ACL = &v - return s -} - -// SetAccessControlPolicy sets the AccessControlPolicy field's value. -func (s *PutBucketAclInput) SetAccessControlPolicy(v *AccessControlPolicy) *PutBucketAclInput { - s.AccessControlPolicy = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAclInput) SetBucket(v string) *PutBucketAclInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutBucketAclInput) SetGrantFullControl(v string) *PutBucketAclInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutBucketAclInput) SetGrantRead(v string) *PutBucketAclInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutBucketAclInput) SetGrantReadACP(v string) *PutBucketAclInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *PutBucketAclInput) SetGrantWrite(v string) *PutBucketAclInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutBucketAclInput) SetGrantWriteACP(v string) *PutBucketAclInput { - s.GrantWriteACP = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAclOutput -type PutBucketAclOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAclOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfigurationRequest -type PutBucketAnalyticsConfigurationInput struct { - _ struct{} `type:"structure" payload:"AnalyticsConfiguration"` - - // The configuration and any analyses for the analytics filter. - // - // AnalyticsConfiguration is a required field - AnalyticsConfiguration *AnalyticsConfiguration `locationName:"AnalyticsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // The name of the bucket to which an analytics configuration is stored. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The identifier used to represent an analytics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketAnalyticsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAnalyticsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketAnalyticsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketAnalyticsConfigurationInput"} - if s.AnalyticsConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("AnalyticsConfiguration")) - } - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.AnalyticsConfiguration != nil { - if err := s.AnalyticsConfiguration.Validate(); err != nil { - invalidParams.AddNested("AnalyticsConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAnalyticsConfiguration sets the AnalyticsConfiguration field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetAnalyticsConfiguration(v *AnalyticsConfiguration) *PutBucketAnalyticsConfigurationInput { - s.AnalyticsConfiguration = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetBucket(v string) *PutBucketAnalyticsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketAnalyticsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketAnalyticsConfigurationInput) SetId(v string) *PutBucketAnalyticsConfigurationInput { - s.Id = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketAnalyticsConfigurationOutput -type PutBucketAnalyticsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketAnalyticsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketAnalyticsConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCorsRequest -type PutBucketCorsInput struct { - _ struct{} `type:"structure" payload:"CORSConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // CORSConfiguration is a required field - CORSConfiguration *CORSConfiguration `locationName:"CORSConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketCorsInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketCorsInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketCorsInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketCorsInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.CORSConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("CORSConfiguration")) - } - if s.CORSConfiguration != nil { - if err := s.CORSConfiguration.Validate(); err != nil { - invalidParams.AddNested("CORSConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketCorsInput) SetBucket(v string) *PutBucketCorsInput { - s.Bucket = &v - return s -} - -func (s *PutBucketCorsInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCORSConfiguration sets the CORSConfiguration field's value. -func (s *PutBucketCorsInput) SetCORSConfiguration(v *CORSConfiguration) *PutBucketCorsInput { - s.CORSConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketCorsOutput -type PutBucketCorsOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketCorsOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketCorsOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryptionRequest -type PutBucketEncryptionInput struct { - _ struct{} `type:"structure" payload:"ServerSideEncryptionConfiguration"` - - // The name of the bucket for which the server-side encryption configuration - // is set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for server-side encryption configuration rules. Currently S3 supports - // one rule only. - // - // ServerSideEncryptionConfiguration is a required field - ServerSideEncryptionConfiguration *ServerSideEncryptionConfiguration `locationName:"ServerSideEncryptionConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketEncryptionInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketEncryptionInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketEncryptionInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketEncryptionInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.ServerSideEncryptionConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("ServerSideEncryptionConfiguration")) - } - if s.ServerSideEncryptionConfiguration != nil { - if err := s.ServerSideEncryptionConfiguration.Validate(); err != nil { - invalidParams.AddNested("ServerSideEncryptionConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketEncryptionInput) SetBucket(v string) *PutBucketEncryptionInput { - s.Bucket = &v - return s -} - -func (s *PutBucketEncryptionInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetServerSideEncryptionConfiguration sets the ServerSideEncryptionConfiguration field's value. -func (s *PutBucketEncryptionInput) SetServerSideEncryptionConfiguration(v *ServerSideEncryptionConfiguration) *PutBucketEncryptionInput { - s.ServerSideEncryptionConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketEncryptionOutput -type PutBucketEncryptionOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketEncryptionOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketEncryptionOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfigurationRequest -type PutBucketInventoryConfigurationInput struct { - _ struct{} `type:"structure" payload:"InventoryConfiguration"` - - // The name of the bucket where the inventory configuration will be stored. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the inventory configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` - - // Specifies the inventory configuration. - // - // InventoryConfiguration is a required field - InventoryConfiguration *InventoryConfiguration `locationName:"InventoryConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketInventoryConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketInventoryConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketInventoryConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketInventoryConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.InventoryConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("InventoryConfiguration")) - } - if s.InventoryConfiguration != nil { - if err := s.InventoryConfiguration.Validate(); err != nil { - invalidParams.AddNested("InventoryConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketInventoryConfigurationInput) SetBucket(v string) *PutBucketInventoryConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketInventoryConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketInventoryConfigurationInput) SetId(v string) *PutBucketInventoryConfigurationInput { - s.Id = &v - return s -} - -// SetInventoryConfiguration sets the InventoryConfiguration field's value. -func (s *PutBucketInventoryConfigurationInput) SetInventoryConfiguration(v *InventoryConfiguration) *PutBucketInventoryConfigurationInput { - s.InventoryConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketInventoryConfigurationOutput -type PutBucketInventoryConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketInventoryConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketInventoryConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfigurationRequest -type PutBucketLifecycleConfigurationInput struct { - _ struct{} `type:"structure" payload:"LifecycleConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - LifecycleConfiguration *BucketLifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLifecycleConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLifecycleConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.LifecycleConfiguration != nil { - if err := s.LifecycleConfiguration.Validate(); err != nil { - invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLifecycleConfigurationInput) SetBucket(v string) *PutBucketLifecycleConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLifecycleConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetLifecycleConfiguration sets the LifecycleConfiguration field's value. -func (s *PutBucketLifecycleConfigurationInput) SetLifecycleConfiguration(v *BucketLifecycleConfiguration) *PutBucketLifecycleConfigurationInput { - s.LifecycleConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleConfigurationOutput -type PutBucketLifecycleConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLifecycleConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleRequest -type PutBucketLifecycleInput struct { - _ struct{} `type:"structure" payload:"LifecycleConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - LifecycleConfiguration *LifecycleConfiguration `locationName:"LifecycleConfiguration" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLifecycleInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLifecycleInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLifecycleInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.LifecycleConfiguration != nil { - if err := s.LifecycleConfiguration.Validate(); err != nil { - invalidParams.AddNested("LifecycleConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLifecycleInput) SetBucket(v string) *PutBucketLifecycleInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLifecycleInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetLifecycleConfiguration sets the LifecycleConfiguration field's value. -func (s *PutBucketLifecycleInput) SetLifecycleConfiguration(v *LifecycleConfiguration) *PutBucketLifecycleInput { - s.LifecycleConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLifecycleOutput -type PutBucketLifecycleOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLifecycleOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLifecycleOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLoggingRequest -type PutBucketLoggingInput struct { - _ struct{} `type:"structure" payload:"BucketLoggingStatus"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // BucketLoggingStatus is a required field - BucketLoggingStatus *BucketLoggingStatus `locationName:"BucketLoggingStatus" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketLoggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLoggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketLoggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketLoggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.BucketLoggingStatus == nil { - invalidParams.Add(request.NewErrParamRequired("BucketLoggingStatus")) - } - if s.BucketLoggingStatus != nil { - if err := s.BucketLoggingStatus.Validate(); err != nil { - invalidParams.AddNested("BucketLoggingStatus", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketLoggingInput) SetBucket(v string) *PutBucketLoggingInput { - s.Bucket = &v - return s -} - -func (s *PutBucketLoggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetBucketLoggingStatus sets the BucketLoggingStatus field's value. -func (s *PutBucketLoggingInput) SetBucketLoggingStatus(v *BucketLoggingStatus) *PutBucketLoggingInput { - s.BucketLoggingStatus = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketLoggingOutput -type PutBucketLoggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketLoggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketLoggingOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfigurationRequest -type PutBucketMetricsConfigurationInput struct { - _ struct{} `type:"structure" payload:"MetricsConfiguration"` - - // The name of the bucket for which the metrics configuration is set. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The ID used to identify the metrics configuration. - // - // Id is a required field - Id *string `location:"querystring" locationName:"id" type:"string" required:"true"` - - // Specifies the metrics configuration. - // - // MetricsConfiguration is a required field - MetricsConfiguration *MetricsConfiguration `locationName:"MetricsConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketMetricsConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketMetricsConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketMetricsConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketMetricsConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Id == nil { - invalidParams.Add(request.NewErrParamRequired("Id")) - } - if s.MetricsConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("MetricsConfiguration")) - } - if s.MetricsConfiguration != nil { - if err := s.MetricsConfiguration.Validate(); err != nil { - invalidParams.AddNested("MetricsConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketMetricsConfigurationInput) SetBucket(v string) *PutBucketMetricsConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketMetricsConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetId sets the Id field's value. -func (s *PutBucketMetricsConfigurationInput) SetId(v string) *PutBucketMetricsConfigurationInput { - s.Id = &v - return s -} - -// SetMetricsConfiguration sets the MetricsConfiguration field's value. -func (s *PutBucketMetricsConfigurationInput) SetMetricsConfiguration(v *MetricsConfiguration) *PutBucketMetricsConfigurationInput { - s.MetricsConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketMetricsConfigurationOutput -type PutBucketMetricsConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketMetricsConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketMetricsConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfigurationRequest -type PutBucketNotificationConfigurationInput struct { - _ struct{} `type:"structure" payload:"NotificationConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for specifying the notification configuration of the bucket. If - // this element is empty, notifications are turned off on the bucket. - // - // NotificationConfiguration is a required field - NotificationConfiguration *NotificationConfiguration `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketNotificationConfigurationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationConfigurationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketNotificationConfigurationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationConfigurationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.NotificationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) - } - if s.NotificationConfiguration != nil { - if err := s.NotificationConfiguration.Validate(); err != nil { - invalidParams.AddNested("NotificationConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketNotificationConfigurationInput) SetBucket(v string) *PutBucketNotificationConfigurationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketNotificationConfigurationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetNotificationConfiguration sets the NotificationConfiguration field's value. -func (s *PutBucketNotificationConfigurationInput) SetNotificationConfiguration(v *NotificationConfiguration) *PutBucketNotificationConfigurationInput { - s.NotificationConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationConfigurationOutput -type PutBucketNotificationConfigurationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketNotificationConfigurationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationConfigurationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationRequest -type PutBucketNotificationInput struct { - _ struct{} `type:"structure" payload:"NotificationConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // NotificationConfiguration is a required field - NotificationConfiguration *NotificationConfigurationDeprecated `locationName:"NotificationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketNotificationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketNotificationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketNotificationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.NotificationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("NotificationConfiguration")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketNotificationInput) SetBucket(v string) *PutBucketNotificationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketNotificationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetNotificationConfiguration sets the NotificationConfiguration field's value. -func (s *PutBucketNotificationInput) SetNotificationConfiguration(v *NotificationConfigurationDeprecated) *PutBucketNotificationInput { - s.NotificationConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketNotificationOutput -type PutBucketNotificationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketNotificationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketNotificationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicyRequest -type PutBucketPolicyInput struct { - _ struct{} `type:"structure" payload:"Policy"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Set this parameter to true to confirm that you want to remove your permissions - // to change this bucket policy in the future. - ConfirmRemoveSelfBucketAccess *bool `location:"header" locationName:"x-amz-confirm-remove-self-bucket-access" type:"boolean"` - - // The bucket policy as a JSON document. - // - // Policy is a required field - Policy *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s PutBucketPolicyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketPolicyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketPolicyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketPolicyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Policy == nil { - invalidParams.Add(request.NewErrParamRequired("Policy")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketPolicyInput) SetBucket(v string) *PutBucketPolicyInput { - s.Bucket = &v - return s -} - -func (s *PutBucketPolicyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetConfirmRemoveSelfBucketAccess sets the ConfirmRemoveSelfBucketAccess field's value. -func (s *PutBucketPolicyInput) SetConfirmRemoveSelfBucketAccess(v bool) *PutBucketPolicyInput { - s.ConfirmRemoveSelfBucketAccess = &v - return s -} - -// SetPolicy sets the Policy field's value. -func (s *PutBucketPolicyInput) SetPolicy(v string) *PutBucketPolicyInput { - s.Policy = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketPolicyOutput -type PutBucketPolicyOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketPolicyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketPolicyOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplicationRequest -type PutBucketReplicationInput struct { - _ struct{} `type:"structure" payload:"ReplicationConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Container for replication rules. You can add as many as 1,000 rules. Total - // replication configuration size can be up to 2 MB. - // - // ReplicationConfiguration is a required field - ReplicationConfiguration *ReplicationConfiguration `locationName:"ReplicationConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketReplicationInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketReplicationInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketReplicationInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketReplicationInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.ReplicationConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("ReplicationConfiguration")) - } - if s.ReplicationConfiguration != nil { - if err := s.ReplicationConfiguration.Validate(); err != nil { - invalidParams.AddNested("ReplicationConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketReplicationInput) SetBucket(v string) *PutBucketReplicationInput { - s.Bucket = &v - return s -} - -func (s *PutBucketReplicationInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetReplicationConfiguration sets the ReplicationConfiguration field's value. -func (s *PutBucketReplicationInput) SetReplicationConfiguration(v *ReplicationConfiguration) *PutBucketReplicationInput { - s.ReplicationConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketReplicationOutput -type PutBucketReplicationOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketReplicationOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketReplicationOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPaymentRequest -type PutBucketRequestPaymentInput struct { - _ struct{} `type:"structure" payload:"RequestPaymentConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // RequestPaymentConfiguration is a required field - RequestPaymentConfiguration *RequestPaymentConfiguration `locationName:"RequestPaymentConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketRequestPaymentInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketRequestPaymentInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketRequestPaymentInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketRequestPaymentInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.RequestPaymentConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("RequestPaymentConfiguration")) - } - if s.RequestPaymentConfiguration != nil { - if err := s.RequestPaymentConfiguration.Validate(); err != nil { - invalidParams.AddNested("RequestPaymentConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketRequestPaymentInput) SetBucket(v string) *PutBucketRequestPaymentInput { - s.Bucket = &v - return s -} - -func (s *PutBucketRequestPaymentInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetRequestPaymentConfiguration sets the RequestPaymentConfiguration field's value. -func (s *PutBucketRequestPaymentInput) SetRequestPaymentConfiguration(v *RequestPaymentConfiguration) *PutBucketRequestPaymentInput { - s.RequestPaymentConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketRequestPaymentOutput -type PutBucketRequestPaymentOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketRequestPaymentOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketRequestPaymentOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTaggingRequest -type PutBucketTaggingInput struct { - _ struct{} `type:"structure" payload:"Tagging"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Tagging is a required field - Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Tagging == nil { - invalidParams.Add(request.NewErrParamRequired("Tagging")) - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketTaggingInput) SetBucket(v string) *PutBucketTaggingInput { - s.Bucket = &v - return s -} - -func (s *PutBucketTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetTagging sets the Tagging field's value. -func (s *PutBucketTaggingInput) SetTagging(v *Tagging) *PutBucketTaggingInput { - s.Tagging = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketTaggingOutput -type PutBucketTaggingOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketTaggingOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioningRequest -type PutBucketVersioningInput struct { - _ struct{} `type:"structure" payload:"VersioningConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The concatenation of the authentication device's serial number, a space, - // and the value that is displayed on your authentication device. - MFA *string `location:"header" locationName:"x-amz-mfa" type:"string"` - - // VersioningConfiguration is a required field - VersioningConfiguration *VersioningConfiguration `locationName:"VersioningConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketVersioningInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketVersioningInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketVersioningInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketVersioningInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.VersioningConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("VersioningConfiguration")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketVersioningInput) SetBucket(v string) *PutBucketVersioningInput { - s.Bucket = &v - return s -} - -func (s *PutBucketVersioningInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetMFA sets the MFA field's value. -func (s *PutBucketVersioningInput) SetMFA(v string) *PutBucketVersioningInput { - s.MFA = &v - return s -} - -// SetVersioningConfiguration sets the VersioningConfiguration field's value. -func (s *PutBucketVersioningInput) SetVersioningConfiguration(v *VersioningConfiguration) *PutBucketVersioningInput { - s.VersioningConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketVersioningOutput -type PutBucketVersioningOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketVersioningOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketVersioningOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsiteRequest -type PutBucketWebsiteInput struct { - _ struct{} `type:"structure" payload:"WebsiteConfiguration"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // WebsiteConfiguration is a required field - WebsiteConfiguration *WebsiteConfiguration `locationName:"WebsiteConfiguration" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` -} - -// String returns the string representation -func (s PutBucketWebsiteInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketWebsiteInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutBucketWebsiteInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutBucketWebsiteInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.WebsiteConfiguration == nil { - invalidParams.Add(request.NewErrParamRequired("WebsiteConfiguration")) - } - if s.WebsiteConfiguration != nil { - if err := s.WebsiteConfiguration.Validate(); err != nil { - invalidParams.AddNested("WebsiteConfiguration", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutBucketWebsiteInput) SetBucket(v string) *PutBucketWebsiteInput { - s.Bucket = &v - return s -} - -func (s *PutBucketWebsiteInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetWebsiteConfiguration sets the WebsiteConfiguration field's value. -func (s *PutBucketWebsiteInput) SetWebsiteConfiguration(v *WebsiteConfiguration) *PutBucketWebsiteInput { - s.WebsiteConfiguration = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutBucketWebsiteOutput -type PutBucketWebsiteOutput struct { - _ struct{} `type:"structure"` -} - -// String returns the string representation -func (s PutBucketWebsiteOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutBucketWebsiteOutput) GoString() string { - return s.String() -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAclRequest -type PutObjectAclInput struct { - _ struct{} `type:"structure" payload:"AccessControlPolicy"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - AccessControlPolicy *AccessControlPolicy `locationName:"AccessControlPolicy" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Allows grantee the read, write, read ACP, and write ACP permissions on the - // bucket. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to list the objects in the bucket. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the bucket ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to create, overwrite, and delete any object in the bucket. - GrantWrite *string `location:"header" locationName:"x-amz-grant-write" type:"string"` - - // Allows grantee to write the ACL for the applicable bucket. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // VersionId used to reference a specific version of the object. - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectAclInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectAclInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectAclInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectAclInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.AccessControlPolicy != nil { - if err := s.AccessControlPolicy.Validate(); err != nil { - invalidParams.AddNested("AccessControlPolicy", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutObjectAclInput) SetACL(v string) *PutObjectAclInput { - s.ACL = &v - return s -} - -// SetAccessControlPolicy sets the AccessControlPolicy field's value. -func (s *PutObjectAclInput) SetAccessControlPolicy(v *AccessControlPolicy) *PutObjectAclInput { - s.AccessControlPolicy = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectAclInput) SetBucket(v string) *PutObjectAclInput { - s.Bucket = &v - return s -} - -func (s *PutObjectAclInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutObjectAclInput) SetGrantFullControl(v string) *PutObjectAclInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutObjectAclInput) SetGrantRead(v string) *PutObjectAclInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutObjectAclInput) SetGrantReadACP(v string) *PutObjectAclInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWrite sets the GrantWrite field's value. -func (s *PutObjectAclInput) SetGrantWrite(v string) *PutObjectAclInput { - s.GrantWrite = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutObjectAclInput) SetGrantWriteACP(v string) *PutObjectAclInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PutObjectAclInput) SetKey(v string) *PutObjectAclInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectAclInput) SetRequestPayer(v string) *PutObjectAclInput { - s.RequestPayer = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectAclInput) SetVersionId(v string) *PutObjectAclInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectAclOutput -type PutObjectAclOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` -} - -// String returns the string representation -func (s PutObjectAclOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectAclOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectAclOutput) SetRequestCharged(v string) *PutObjectAclOutput { - s.RequestCharged = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectRequest -type PutObjectInput struct { - _ struct{} `type:"structure" payload:"Body"` - - // The canned ACL to apply to the object. - ACL *string `location:"header" locationName:"x-amz-acl" type:"string" enum:"ObjectCannedACL"` - - // Object data. - Body io.ReadSeeker `type:"blob"` - - // Name of the bucket to which the PUT operation was initiated. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Specifies caching behavior along the request/reply chain. - CacheControl *string `location:"header" locationName:"Cache-Control" type:"string"` - - // Specifies presentational information for the object. - ContentDisposition *string `location:"header" locationName:"Content-Disposition" type:"string"` - - // Specifies what content encodings have been applied to the object and thus - // what decoding mechanisms must be applied to obtain the media-type referenced - // by the Content-Type header field. - ContentEncoding *string `location:"header" locationName:"Content-Encoding" type:"string"` - - // The language the content is in. - ContentLanguage *string `location:"header" locationName:"Content-Language" type:"string"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The base64-encoded 128-bit MD5 digest of the part data. - ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` - - // A standard MIME type describing the format of the object data. - ContentType *string `location:"header" locationName:"Content-Type" type:"string"` - - // The date and time at which the object is no longer cacheable. - Expires *time.Time `location:"header" locationName:"Expires" type:"timestamp" timestampFormat:"rfc822"` - - // Gives the grantee READ, READ_ACP, and WRITE_ACP permissions on the object. - GrantFullControl *string `location:"header" locationName:"x-amz-grant-full-control" type:"string"` - - // Allows grantee to read the object data and its metadata. - GrantRead *string `location:"header" locationName:"x-amz-grant-read" type:"string"` - - // Allows grantee to read the object ACL. - GrantReadACP *string `location:"header" locationName:"x-amz-grant-read-acp" type:"string"` - - // Allows grantee to write the ACL for the applicable object. - GrantWriteACP *string `location:"header" locationName:"x-amz-grant-write-acp" type:"string"` - - // Object key for which the PUT operation was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // A map of metadata to store with the object in S3. - Metadata map[string]*string `location:"headers" locationName:"x-amz-meta-" type:"map"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Specifies the AWS KMS key ID to use for object encryption. All GET and PUT - // requests for an object protected by AWS KMS will fail if not made via SSL - // or using SigV4. Documentation on configuring any of the officially supported - // AWS SDKs and CLI can be found at http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingAWSSDK.html#specify-signature-version - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // The type of storage to use for the object. Defaults to 'STANDARD'. - StorageClass *string `location:"header" locationName:"x-amz-storage-class" type:"string" enum:"StorageClass"` - - // The tag-set for the object. The tag-set must be encoded as URL Query parameters - Tagging *string `location:"header" locationName:"x-amz-tagging" type:"string"` - - // If the bucket is configured as a website, redirects requests for this object - // to another object in the same bucket or to an external URL. Amazon S3 stores - // the value of this header in the object metadata. - WebsiteRedirectLocation *string `location:"header" locationName:"x-amz-website-redirect-location" type:"string"` -} - -// String returns the string representation -func (s PutObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetACL sets the ACL field's value. -func (s *PutObjectInput) SetACL(v string) *PutObjectInput { - s.ACL = &v - return s -} - -// SetBody sets the Body field's value. -func (s *PutObjectInput) SetBody(v io.ReadSeeker) *PutObjectInput { - s.Body = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectInput) SetBucket(v string) *PutObjectInput { - s.Bucket = &v - return s -} - -func (s *PutObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCacheControl sets the CacheControl field's value. -func (s *PutObjectInput) SetCacheControl(v string) *PutObjectInput { - s.CacheControl = &v - return s -} - -// SetContentDisposition sets the ContentDisposition field's value. -func (s *PutObjectInput) SetContentDisposition(v string) *PutObjectInput { - s.ContentDisposition = &v - return s -} - -// SetContentEncoding sets the ContentEncoding field's value. -func (s *PutObjectInput) SetContentEncoding(v string) *PutObjectInput { - s.ContentEncoding = &v - return s -} - -// SetContentLanguage sets the ContentLanguage field's value. -func (s *PutObjectInput) SetContentLanguage(v string) *PutObjectInput { - s.ContentLanguage = &v - return s -} - -// SetContentLength sets the ContentLength field's value. -func (s *PutObjectInput) SetContentLength(v int64) *PutObjectInput { - s.ContentLength = &v - return s -} - -// SetContentMD5 sets the ContentMD5 field's value. -func (s *PutObjectInput) SetContentMD5(v string) *PutObjectInput { - s.ContentMD5 = &v - return s -} - -// SetContentType sets the ContentType field's value. -func (s *PutObjectInput) SetContentType(v string) *PutObjectInput { - s.ContentType = &v - return s -} - -// SetExpires sets the Expires field's value. -func (s *PutObjectInput) SetExpires(v time.Time) *PutObjectInput { - s.Expires = &v - return s -} - -// SetGrantFullControl sets the GrantFullControl field's value. -func (s *PutObjectInput) SetGrantFullControl(v string) *PutObjectInput { - s.GrantFullControl = &v - return s -} - -// SetGrantRead sets the GrantRead field's value. -func (s *PutObjectInput) SetGrantRead(v string) *PutObjectInput { - s.GrantRead = &v - return s -} - -// SetGrantReadACP sets the GrantReadACP field's value. -func (s *PutObjectInput) SetGrantReadACP(v string) *PutObjectInput { - s.GrantReadACP = &v - return s -} - -// SetGrantWriteACP sets the GrantWriteACP field's value. -func (s *PutObjectInput) SetGrantWriteACP(v string) *PutObjectInput { - s.GrantWriteACP = &v - return s -} - -// SetKey sets the Key field's value. -func (s *PutObjectInput) SetKey(v string) *PutObjectInput { - s.Key = &v - return s -} - -// SetMetadata sets the Metadata field's value. -func (s *PutObjectInput) SetMetadata(v map[string]*string) *PutObjectInput { - s.Metadata = v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *PutObjectInput) SetRequestPayer(v string) *PutObjectInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *PutObjectInput) SetSSECustomerAlgorithm(v string) *PutObjectInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *PutObjectInput) SetSSECustomerKey(v string) *PutObjectInput { - s.SSECustomerKey = &v - return s -} - -func (s *PutObjectInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *PutObjectInput) SetSSECustomerKeyMD5(v string) *PutObjectInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *PutObjectInput) SetSSEKMSKeyId(v string) *PutObjectInput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *PutObjectInput) SetServerSideEncryption(v string) *PutObjectInput { - s.ServerSideEncryption = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *PutObjectInput) SetStorageClass(v string) *PutObjectInput { - s.StorageClass = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *PutObjectInput) SetTagging(v string) *PutObjectInput { - s.Tagging = &v - return s -} - -// SetWebsiteRedirectLocation sets the WebsiteRedirectLocation field's value. -func (s *PutObjectInput) SetWebsiteRedirectLocation(v string) *PutObjectInput { - s.WebsiteRedirectLocation = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectOutput -type PutObjectOutput struct { - _ struct{} `type:"structure"` - - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If the object expiration is configured, this will contain the expiration - // date (expiry-date) and rule ID (rule-id). The value of rule-id is URL encoded. - Expiration *string `location:"header" locationName:"x-amz-expiration" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` - - // Version of the object. - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s PutObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectOutput) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *PutObjectOutput) SetETag(v string) *PutObjectOutput { - s.ETag = &v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *PutObjectOutput) SetExpiration(v string) *PutObjectOutput { - s.Expiration = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *PutObjectOutput) SetRequestCharged(v string) *PutObjectOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *PutObjectOutput) SetSSECustomerAlgorithm(v string) *PutObjectOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *PutObjectOutput) SetSSECustomerKeyMD5(v string) *PutObjectOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *PutObjectOutput) SetSSEKMSKeyId(v string) *PutObjectOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *PutObjectOutput) SetServerSideEncryption(v string) *PutObjectOutput { - s.ServerSideEncryption = &v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectOutput) SetVersionId(v string) *PutObjectOutput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTaggingRequest -type PutObjectTaggingInput struct { - _ struct{} `type:"structure" payload:"Tagging"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Tagging is a required field - Tagging *Tagging `locationName:"Tagging" type:"structure" required:"true" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s PutObjectTaggingInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectTaggingInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *PutObjectTaggingInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "PutObjectTaggingInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Tagging == nil { - invalidParams.Add(request.NewErrParamRequired("Tagging")) - } - if s.Tagging != nil { - if err := s.Tagging.Validate(); err != nil { - invalidParams.AddNested("Tagging", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *PutObjectTaggingInput) SetBucket(v string) *PutObjectTaggingInput { - s.Bucket = &v - return s -} - -func (s *PutObjectTaggingInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *PutObjectTaggingInput) SetKey(v string) *PutObjectTaggingInput { - s.Key = &v - return s -} - -// SetTagging sets the Tagging field's value. -func (s *PutObjectTaggingInput) SetTagging(v *Tagging) *PutObjectTaggingInput { - s.Tagging = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectTaggingInput) SetVersionId(v string) *PutObjectTaggingInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/PutObjectTaggingOutput -type PutObjectTaggingOutput struct { - _ struct{} `type:"structure"` - - VersionId *string `location:"header" locationName:"x-amz-version-id" type:"string"` -} - -// String returns the string representation -func (s PutObjectTaggingOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s PutObjectTaggingOutput) GoString() string { - return s.String() -} - -// SetVersionId sets the VersionId field's value. -func (s *PutObjectTaggingOutput) SetVersionId(v string) *PutObjectTaggingOutput { - s.VersionId = &v - return s -} - -// Container for specifying an configuration when you want Amazon S3 to publish -// events to an Amazon Simple Queue Service (Amazon SQS) queue. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/QueueConfiguration -type QueueConfiguration struct { - _ struct{} `type:"structure"` - - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Container for object key name filtering rules. For information about key - // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - Filter *NotificationConfigurationFilter `type:"structure"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // Amazon SQS queue ARN to which Amazon S3 will publish a message when it detects - // events of specified type. - // - // QueueArn is a required field - QueueArn *string `locationName:"Queue" type:"string" required:"true"` -} - -// String returns the string representation -func (s QueueConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s QueueConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *QueueConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "QueueConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.QueueArn == nil { - invalidParams.Add(request.NewErrParamRequired("QueueArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *QueueConfiguration) SetEvents(v []*string) *QueueConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *QueueConfiguration) SetFilter(v *NotificationConfigurationFilter) *QueueConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *QueueConfiguration) SetId(v string) *QueueConfiguration { - s.Id = &v - return s -} - -// SetQueueArn sets the QueueArn field's value. -func (s *QueueConfiguration) SetQueueArn(v string) *QueueConfiguration { - s.QueueArn = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/QueueConfigurationDeprecated -type QueueConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - // Bucket event for which to send notifications. - Event *string `deprecated:"true" type:"string" enum:"Event"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - Queue *string `type:"string"` -} - -// String returns the string representation -func (s QueueConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s QueueConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetEvent sets the Event field's value. -func (s *QueueConfigurationDeprecated) SetEvent(v string) *QueueConfigurationDeprecated { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *QueueConfigurationDeprecated) SetEvents(v []*string) *QueueConfigurationDeprecated { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *QueueConfigurationDeprecated) SetId(v string) *QueueConfigurationDeprecated { - s.Id = &v - return s -} - -// SetQueue sets the Queue field's value. -func (s *QueueConfigurationDeprecated) SetQueue(v string) *QueueConfigurationDeprecated { - s.Queue = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Redirect -type Redirect struct { - _ struct{} `type:"structure"` - - // The host name to use in the redirect request. - HostName *string `type:"string"` - - // The HTTP redirect code to use on the response. Not required if one of the - // siblings is present. - HttpRedirectCode *string `type:"string"` - - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. - Protocol *string `type:"string" enum:"Protocol"` - - // The object key prefix to use in the redirect request. For example, to redirect - // requests for all pages with prefix docs/ (objects in the docs/ folder) to - // documents/, you can set a condition block with KeyPrefixEquals set to docs/ - // and in the Redirect set ReplaceKeyPrefixWith to /documents. Not required - // if one of the siblings is present. Can be present only if ReplaceKeyWith - // is not provided. - ReplaceKeyPrefixWith *string `type:"string"` - - // The specific object key to use in the redirect request. For example, redirect - // request to error.html. Not required if one of the sibling is present. Can - // be present only if ReplaceKeyPrefixWith is not provided. - ReplaceKeyWith *string `type:"string"` -} - -// String returns the string representation -func (s Redirect) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Redirect) GoString() string { - return s.String() -} - -// SetHostName sets the HostName field's value. -func (s *Redirect) SetHostName(v string) *Redirect { - s.HostName = &v - return s -} - -// SetHttpRedirectCode sets the HttpRedirectCode field's value. -func (s *Redirect) SetHttpRedirectCode(v string) *Redirect { - s.HttpRedirectCode = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *Redirect) SetProtocol(v string) *Redirect { - s.Protocol = &v - return s -} - -// SetReplaceKeyPrefixWith sets the ReplaceKeyPrefixWith field's value. -func (s *Redirect) SetReplaceKeyPrefixWith(v string) *Redirect { - s.ReplaceKeyPrefixWith = &v - return s -} - -// SetReplaceKeyWith sets the ReplaceKeyWith field's value. -func (s *Redirect) SetReplaceKeyWith(v string) *Redirect { - s.ReplaceKeyWith = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RedirectAllRequestsTo -type RedirectAllRequestsTo struct { - _ struct{} `type:"structure"` - - // Name of the host where requests will be redirected. - // - // HostName is a required field - HostName *string `type:"string" required:"true"` - - // Protocol to use (http, https) when redirecting requests. The default is the - // protocol that is used in the original request. - Protocol *string `type:"string" enum:"Protocol"` -} - -// String returns the string representation -func (s RedirectAllRequestsTo) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RedirectAllRequestsTo) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RedirectAllRequestsTo) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RedirectAllRequestsTo"} - if s.HostName == nil { - invalidParams.Add(request.NewErrParamRequired("HostName")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetHostName sets the HostName field's value. -func (s *RedirectAllRequestsTo) SetHostName(v string) *RedirectAllRequestsTo { - s.HostName = &v - return s -} - -// SetProtocol sets the Protocol field's value. -func (s *RedirectAllRequestsTo) SetProtocol(v string) *RedirectAllRequestsTo { - s.Protocol = &v - return s -} - -// Container for replication rules. You can add as many as 1,000 rules. Total -// replication configuration size can be up to 2 MB. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationConfiguration -type ReplicationConfiguration struct { - _ struct{} `type:"structure"` - - // Amazon Resource Name (ARN) of an IAM role for Amazon S3 to assume when replicating - // the objects. - // - // Role is a required field - Role *string `type:"string" required:"true"` - - // Container for information about a particular replication rule. Replication - // configuration must have at least one rule and can contain up to 1,000 rules. - // - // Rules is a required field - Rules []*ReplicationRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s ReplicationConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationConfiguration"} - if s.Role == nil { - invalidParams.Add(request.NewErrParamRequired("Role")) - } - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRole sets the Role field's value. -func (s *ReplicationConfiguration) SetRole(v string) *ReplicationConfiguration { - s.Role = &v - return s -} - -// SetRules sets the Rules field's value. -func (s *ReplicationConfiguration) SetRules(v []*ReplicationRule) *ReplicationConfiguration { - s.Rules = v - return s -} - -// Container for information about a particular replication rule. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ReplicationRule -type ReplicationRule struct { - _ struct{} `type:"structure"` - - // Container for replication destination information. - // - // Destination is a required field - Destination *Destination `type:"structure" required:"true"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Object keyname prefix identifying one or more objects to which the rule applies. - // Maximum prefix length can be up to 1,024 characters. Overlapping prefixes - // are not supported. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` - - // Container for filters that define which source objects should be replicated. - SourceSelectionCriteria *SourceSelectionCriteria `type:"structure"` - - // The rule is ignored if status is not Enabled. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ReplicationRuleStatus"` -} - -// String returns the string representation -func (s ReplicationRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ReplicationRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ReplicationRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ReplicationRule"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - if s.SourceSelectionCriteria != nil { - if err := s.SourceSelectionCriteria.Validate(); err != nil { - invalidParams.AddNested("SourceSelectionCriteria", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDestination sets the Destination field's value. -func (s *ReplicationRule) SetDestination(v *Destination) *ReplicationRule { - s.Destination = v - return s -} - -// SetID sets the ID field's value. -func (s *ReplicationRule) SetID(v string) *ReplicationRule { - s.ID = &v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *ReplicationRule) SetPrefix(v string) *ReplicationRule { - s.Prefix = &v - return s -} - -// SetSourceSelectionCriteria sets the SourceSelectionCriteria field's value. -func (s *ReplicationRule) SetSourceSelectionCriteria(v *SourceSelectionCriteria) *ReplicationRule { - s.SourceSelectionCriteria = v - return s -} - -// SetStatus sets the Status field's value. -func (s *ReplicationRule) SetStatus(v string) *ReplicationRule { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RequestPaymentConfiguration -type RequestPaymentConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies who pays for the download and request fees. - // - // Payer is a required field - Payer *string `type:"string" required:"true" enum:"Payer"` -} - -// String returns the string representation -func (s RequestPaymentConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RequestPaymentConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RequestPaymentConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RequestPaymentConfiguration"} - if s.Payer == nil { - invalidParams.Add(request.NewErrParamRequired("Payer")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetPayer sets the Payer field's value. -func (s *RequestPaymentConfiguration) SetPayer(v string) *RequestPaymentConfiguration { - s.Payer = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObjectRequest -type RestoreObjectInput struct { - _ struct{} `type:"structure" payload:"RestoreRequest"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Container for restore job parameters. - RestoreRequest *RestoreRequest `locationName:"RestoreRequest" type:"structure" xmlURI:"http://s3.amazonaws.com/doc/2006-03-01/"` - - VersionId *string `location:"querystring" locationName:"versionId" type:"string"` -} - -// String returns the string representation -func (s RestoreObjectInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreObjectInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RestoreObjectInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RestoreObjectInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.RestoreRequest != nil { - if err := s.RestoreRequest.Validate(); err != nil { - invalidParams.AddNested("RestoreRequest", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *RestoreObjectInput) SetBucket(v string) *RestoreObjectInput { - s.Bucket = &v - return s -} - -func (s *RestoreObjectInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetKey sets the Key field's value. -func (s *RestoreObjectInput) SetKey(v string) *RestoreObjectInput { - s.Key = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *RestoreObjectInput) SetRequestPayer(v string) *RestoreObjectInput { - s.RequestPayer = &v - return s -} - -// SetRestoreRequest sets the RestoreRequest field's value. -func (s *RestoreObjectInput) SetRestoreRequest(v *RestoreRequest) *RestoreObjectInput { - s.RestoreRequest = v - return s -} - -// SetVersionId sets the VersionId field's value. -func (s *RestoreObjectInput) SetVersionId(v string) *RestoreObjectInput { - s.VersionId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreObjectOutput -type RestoreObjectOutput struct { - _ struct{} `type:"structure"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // Indicates the path in the provided S3 output location where Select results - // will be restored to. - RestoreOutputPath *string `location:"header" locationName:"x-amz-restore-output-path" type:"string"` -} - -// String returns the string representation -func (s RestoreObjectOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreObjectOutput) GoString() string { - return s.String() -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *RestoreObjectOutput) SetRequestCharged(v string) *RestoreObjectOutput { - s.RequestCharged = &v - return s -} - -// SetRestoreOutputPath sets the RestoreOutputPath field's value. -func (s *RestoreObjectOutput) SetRestoreOutputPath(v string) *RestoreObjectOutput { - s.RestoreOutputPath = &v - return s -} - -// Container for restore job parameters. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RestoreRequest -type RestoreRequest struct { - _ struct{} `type:"structure"` - - // Lifetime of the active copy in days. Do not use with restores that specify - // OutputLocation. - Days *int64 `type:"integer"` - - // The optional description for the job. - Description *string `type:"string"` - - // Glacier related parameters pertaining to this job. Do not use with restores - // that specify OutputLocation. - GlacierJobParameters *GlacierJobParameters `type:"structure"` - - // Describes the location where the restore job's output is stored. - OutputLocation *OutputLocation `type:"structure"` - - // Describes the parameters for Select job types. - SelectParameters *SelectParameters `type:"structure"` - - // Glacier retrieval tier at which the restore will be processed. - Tier *string `type:"string" enum:"Tier"` - - // Type of restore request. - Type *string `type:"string" enum:"RestoreRequestType"` -} - -// String returns the string representation -func (s RestoreRequest) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RestoreRequest) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RestoreRequest) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RestoreRequest"} - if s.GlacierJobParameters != nil { - if err := s.GlacierJobParameters.Validate(); err != nil { - invalidParams.AddNested("GlacierJobParameters", err.(request.ErrInvalidParams)) - } - } - if s.OutputLocation != nil { - if err := s.OutputLocation.Validate(); err != nil { - invalidParams.AddNested("OutputLocation", err.(request.ErrInvalidParams)) - } - } - if s.SelectParameters != nil { - if err := s.SelectParameters.Validate(); err != nil { - invalidParams.AddNested("SelectParameters", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDays sets the Days field's value. -func (s *RestoreRequest) SetDays(v int64) *RestoreRequest { - s.Days = &v - return s -} - -// SetDescription sets the Description field's value. -func (s *RestoreRequest) SetDescription(v string) *RestoreRequest { - s.Description = &v - return s -} - -// SetGlacierJobParameters sets the GlacierJobParameters field's value. -func (s *RestoreRequest) SetGlacierJobParameters(v *GlacierJobParameters) *RestoreRequest { - s.GlacierJobParameters = v - return s -} - -// SetOutputLocation sets the OutputLocation field's value. -func (s *RestoreRequest) SetOutputLocation(v *OutputLocation) *RestoreRequest { - s.OutputLocation = v - return s -} - -// SetSelectParameters sets the SelectParameters field's value. -func (s *RestoreRequest) SetSelectParameters(v *SelectParameters) *RestoreRequest { - s.SelectParameters = v - return s -} - -// SetTier sets the Tier field's value. -func (s *RestoreRequest) SetTier(v string) *RestoreRequest { - s.Tier = &v - return s -} - -// SetType sets the Type field's value. -func (s *RestoreRequest) SetType(v string) *RestoreRequest { - s.Type = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/RoutingRule -type RoutingRule struct { - _ struct{} `type:"structure"` - - // A container for describing a condition that must be met for the specified - // redirect to apply. For example, 1. If request is for pages in the /docs folder, - // redirect to the /documents folder. 2. If request results in HTTP error 4xx, - // redirect request to another host where you might process the error. - Condition *Condition `type:"structure"` - - // Container for redirect information. You can redirect requests to another - // host, to another page, or with another protocol. In the event of an error, - // you can can specify a different error code to return. - // - // Redirect is a required field - Redirect *Redirect `type:"structure" required:"true"` -} - -// String returns the string representation -func (s RoutingRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s RoutingRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *RoutingRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "RoutingRule"} - if s.Redirect == nil { - invalidParams.Add(request.NewErrParamRequired("Redirect")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetCondition sets the Condition field's value. -func (s *RoutingRule) SetCondition(v *Condition) *RoutingRule { - s.Condition = v - return s -} - -// SetRedirect sets the Redirect field's value. -func (s *RoutingRule) SetRedirect(v *Redirect) *RoutingRule { - s.Redirect = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Rule -type Rule struct { - _ struct{} `type:"structure"` - - // Specifies the days since the initiation of an Incomplete Multipart Upload - // that Lifecycle will wait before permanently removing all parts of the upload. - AbortIncompleteMultipartUpload *AbortIncompleteMultipartUpload `type:"structure"` - - Expiration *LifecycleExpiration `type:"structure"` - - // Unique identifier for the rule. The value cannot be longer than 255 characters. - ID *string `type:"string"` - - // Specifies when noncurrent object versions expire. Upon expiration, Amazon - // S3 permanently deletes the noncurrent object versions. You set this lifecycle - // configuration action on a bucket that has versioning enabled (or suspended) - // to request that Amazon S3 delete noncurrent object versions at a specific - // period in the object's lifetime. - NoncurrentVersionExpiration *NoncurrentVersionExpiration `type:"structure"` - - // Container for the transition rule that describes when noncurrent objects - // transition to the STANDARD_IA or GLACIER storage class. If your bucket is - // versioning-enabled (or versioning is suspended), you can set this action - // to request that Amazon S3 transition noncurrent object versions to the STANDARD_IA - // or GLACIER storage class at a specific period in the object's lifetime. - NoncurrentVersionTransition *NoncurrentVersionTransition `type:"structure"` - - // Prefix identifying one or more objects to which the rule applies. - // - // Prefix is a required field - Prefix *string `type:"string" required:"true"` - - // If 'Enabled', the rule is currently being applied. If 'Disabled', the rule - // is not currently being applied. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"ExpirationStatus"` - - Transition *Transition `type:"structure"` -} - -// String returns the string representation -func (s Rule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Rule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Rule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Rule"} - if s.Prefix == nil { - invalidParams.Add(request.NewErrParamRequired("Prefix")) - } - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetAbortIncompleteMultipartUpload sets the AbortIncompleteMultipartUpload field's value. -func (s *Rule) SetAbortIncompleteMultipartUpload(v *AbortIncompleteMultipartUpload) *Rule { - s.AbortIncompleteMultipartUpload = v - return s -} - -// SetExpiration sets the Expiration field's value. -func (s *Rule) SetExpiration(v *LifecycleExpiration) *Rule { - s.Expiration = v - return s -} - -// SetID sets the ID field's value. -func (s *Rule) SetID(v string) *Rule { - s.ID = &v - return s -} - -// SetNoncurrentVersionExpiration sets the NoncurrentVersionExpiration field's value. -func (s *Rule) SetNoncurrentVersionExpiration(v *NoncurrentVersionExpiration) *Rule { - s.NoncurrentVersionExpiration = v - return s -} - -// SetNoncurrentVersionTransition sets the NoncurrentVersionTransition field's value. -func (s *Rule) SetNoncurrentVersionTransition(v *NoncurrentVersionTransition) *Rule { - s.NoncurrentVersionTransition = v - return s -} - -// SetPrefix sets the Prefix field's value. -func (s *Rule) SetPrefix(v string) *Rule { - s.Prefix = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *Rule) SetStatus(v string) *Rule { - s.Status = &v - return s -} - -// SetTransition sets the Transition field's value. -func (s *Rule) SetTransition(v *Transition) *Rule { - s.Transition = v - return s -} - -// Specifies the use of SSE-KMS to encrypt delievered Inventory reports. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SSEKMS -type SSEKMS struct { - _ struct{} `locationName:"SSE-KMS" type:"structure"` - - // Specifies the ID of the AWS Key Management Service (KMS) master encryption - // key to use for encrypting Inventory reports. - // - // KeyId is a required field - KeyId *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s SSEKMS) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SSEKMS) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SSEKMS) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SSEKMS"} - if s.KeyId == nil { - invalidParams.Add(request.NewErrParamRequired("KeyId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKeyId sets the KeyId field's value. -func (s *SSEKMS) SetKeyId(v string) *SSEKMS { - s.KeyId = &v - return s -} - -// Specifies the use of SSE-S3 to encrypt delievered Inventory reports. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SSES3 -type SSES3 struct { - _ struct{} `locationName:"SSE-S3" type:"structure"` -} - -// String returns the string representation -func (s SSES3) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SSES3) GoString() string { - return s.String() -} - -// Describes the parameters for Select job types. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SelectParameters -type SelectParameters struct { - _ struct{} `type:"structure"` - - // The expression that is used to query the object. - // - // Expression is a required field - Expression *string `type:"string" required:"true"` - - // The type of the provided expression (e.g., SQL). - // - // ExpressionType is a required field - ExpressionType *string `type:"string" required:"true" enum:"ExpressionType"` - - // Describes the serialization format of the object. - // - // InputSerialization is a required field - InputSerialization *InputSerialization `type:"structure" required:"true"` - - // Describes how the results of the Select job are serialized. - // - // OutputSerialization is a required field - OutputSerialization *OutputSerialization `type:"structure" required:"true"` -} - -// String returns the string representation -func (s SelectParameters) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SelectParameters) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SelectParameters) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SelectParameters"} - if s.Expression == nil { - invalidParams.Add(request.NewErrParamRequired("Expression")) - } - if s.ExpressionType == nil { - invalidParams.Add(request.NewErrParamRequired("ExpressionType")) - } - if s.InputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("InputSerialization")) - } - if s.OutputSerialization == nil { - invalidParams.Add(request.NewErrParamRequired("OutputSerialization")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetExpression sets the Expression field's value. -func (s *SelectParameters) SetExpression(v string) *SelectParameters { - s.Expression = &v - return s -} - -// SetExpressionType sets the ExpressionType field's value. -func (s *SelectParameters) SetExpressionType(v string) *SelectParameters { - s.ExpressionType = &v - return s -} - -// SetInputSerialization sets the InputSerialization field's value. -func (s *SelectParameters) SetInputSerialization(v *InputSerialization) *SelectParameters { - s.InputSerialization = v - return s -} - -// SetOutputSerialization sets the OutputSerialization field's value. -func (s *SelectParameters) SetOutputSerialization(v *OutputSerialization) *SelectParameters { - s.OutputSerialization = v - return s -} - -// Describes the default server-side encryption to apply to new objects in the -// bucket. If Put Object request does not specify any server-side encryption, -// this default encryption will be applied. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionByDefault -type ServerSideEncryptionByDefault struct { - _ struct{} `type:"structure"` - - // KMS master key ID to use for the default encryption. This parameter is allowed - // if SSEAlgorithm is aws:kms. - KMSMasterKeyID *string `type:"string"` - - // Server-side encryption algorithm to use for the default encryption. - // - // SSEAlgorithm is a required field - SSEAlgorithm *string `type:"string" required:"true" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s ServerSideEncryptionByDefault) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionByDefault) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionByDefault) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionByDefault"} - if s.SSEAlgorithm == nil { - invalidParams.Add(request.NewErrParamRequired("SSEAlgorithm")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKMSMasterKeyID sets the KMSMasterKeyID field's value. -func (s *ServerSideEncryptionByDefault) SetKMSMasterKeyID(v string) *ServerSideEncryptionByDefault { - s.KMSMasterKeyID = &v - return s -} - -// SetSSEAlgorithm sets the SSEAlgorithm field's value. -func (s *ServerSideEncryptionByDefault) SetSSEAlgorithm(v string) *ServerSideEncryptionByDefault { - s.SSEAlgorithm = &v - return s -} - -// Container for server-side encryption configuration rules. Currently S3 supports -// one rule only. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionConfiguration -type ServerSideEncryptionConfiguration struct { - _ struct{} `type:"structure"` - - // Container for information about a particular server-side encryption configuration - // rule. - // - // Rules is a required field - Rules []*ServerSideEncryptionRule `locationName:"Rule" type:"list" flattened:"true" required:"true"` -} - -// String returns the string representation -func (s ServerSideEncryptionConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionConfiguration"} - if s.Rules == nil { - invalidParams.Add(request.NewErrParamRequired("Rules")) - } - if s.Rules != nil { - for i, v := range s.Rules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Rules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetRules sets the Rules field's value. -func (s *ServerSideEncryptionConfiguration) SetRules(v []*ServerSideEncryptionRule) *ServerSideEncryptionConfiguration { - s.Rules = v - return s -} - -// Container for information about a particular server-side encryption configuration -// rule. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/ServerSideEncryptionRule -type ServerSideEncryptionRule struct { - _ struct{} `type:"structure"` - - // Describes the default server-side encryption to apply to new objects in the - // bucket. If Put Object request does not specify any server-side encryption, - // this default encryption will be applied. - ApplyServerSideEncryptionByDefault *ServerSideEncryptionByDefault `type:"structure"` -} - -// String returns the string representation -func (s ServerSideEncryptionRule) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s ServerSideEncryptionRule) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *ServerSideEncryptionRule) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "ServerSideEncryptionRule"} - if s.ApplyServerSideEncryptionByDefault != nil { - if err := s.ApplyServerSideEncryptionByDefault.Validate(); err != nil { - invalidParams.AddNested("ApplyServerSideEncryptionByDefault", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetApplyServerSideEncryptionByDefault sets the ApplyServerSideEncryptionByDefault field's value. -func (s *ServerSideEncryptionRule) SetApplyServerSideEncryptionByDefault(v *ServerSideEncryptionByDefault) *ServerSideEncryptionRule { - s.ApplyServerSideEncryptionByDefault = v - return s -} - -// Container for filters that define which source objects should be replicated. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SourceSelectionCriteria -type SourceSelectionCriteria struct { - _ struct{} `type:"structure"` - - // Container for filter information of selection of KMS Encrypted S3 objects. - SseKmsEncryptedObjects *SseKmsEncryptedObjects `type:"structure"` -} - -// String returns the string representation -func (s SourceSelectionCriteria) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SourceSelectionCriteria) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SourceSelectionCriteria) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SourceSelectionCriteria"} - if s.SseKmsEncryptedObjects != nil { - if err := s.SseKmsEncryptedObjects.Validate(); err != nil { - invalidParams.AddNested("SseKmsEncryptedObjects", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetSseKmsEncryptedObjects sets the SseKmsEncryptedObjects field's value. -func (s *SourceSelectionCriteria) SetSseKmsEncryptedObjects(v *SseKmsEncryptedObjects) *SourceSelectionCriteria { - s.SseKmsEncryptedObjects = v - return s -} - -// Container for filter information of selection of KMS Encrypted S3 objects. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/SseKmsEncryptedObjects -type SseKmsEncryptedObjects struct { - _ struct{} `type:"structure"` - - // The replication for KMS encrypted S3 objects is disabled if status is not - // Enabled. - // - // Status is a required field - Status *string `type:"string" required:"true" enum:"SseKmsEncryptedObjectsStatus"` -} - -// String returns the string representation -func (s SseKmsEncryptedObjects) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s SseKmsEncryptedObjects) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *SseKmsEncryptedObjects) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "SseKmsEncryptedObjects"} - if s.Status == nil { - invalidParams.Add(request.NewErrParamRequired("Status")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetStatus sets the Status field's value. -func (s *SseKmsEncryptedObjects) SetStatus(v string) *SseKmsEncryptedObjects { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/StorageClassAnalysis -type StorageClassAnalysis struct { - _ struct{} `type:"structure"` - - // A container used to describe how data related to the storage class analysis - // should be exported. - DataExport *StorageClassAnalysisDataExport `type:"structure"` -} - -// String returns the string representation -func (s StorageClassAnalysis) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s StorageClassAnalysis) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StorageClassAnalysis) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StorageClassAnalysis"} - if s.DataExport != nil { - if err := s.DataExport.Validate(); err != nil { - invalidParams.AddNested("DataExport", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDataExport sets the DataExport field's value. -func (s *StorageClassAnalysis) SetDataExport(v *StorageClassAnalysisDataExport) *StorageClassAnalysis { - s.DataExport = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/StorageClassAnalysisDataExport -type StorageClassAnalysisDataExport struct { - _ struct{} `type:"structure"` - - // The place to store the data for an analysis. - // - // Destination is a required field - Destination *AnalyticsExportDestination `type:"structure" required:"true"` - - // The version of the output schema to use when exporting data. Must be V_1. - // - // OutputSchemaVersion is a required field - OutputSchemaVersion *string `type:"string" required:"true" enum:"StorageClassAnalysisSchemaVersion"` -} - -// String returns the string representation -func (s StorageClassAnalysisDataExport) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s StorageClassAnalysisDataExport) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *StorageClassAnalysisDataExport) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "StorageClassAnalysisDataExport"} - if s.Destination == nil { - invalidParams.Add(request.NewErrParamRequired("Destination")) - } - if s.OutputSchemaVersion == nil { - invalidParams.Add(request.NewErrParamRequired("OutputSchemaVersion")) - } - if s.Destination != nil { - if err := s.Destination.Validate(); err != nil { - invalidParams.AddNested("Destination", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetDestination sets the Destination field's value. -func (s *StorageClassAnalysisDataExport) SetDestination(v *AnalyticsExportDestination) *StorageClassAnalysisDataExport { - s.Destination = v - return s -} - -// SetOutputSchemaVersion sets the OutputSchemaVersion field's value. -func (s *StorageClassAnalysisDataExport) SetOutputSchemaVersion(v string) *StorageClassAnalysisDataExport { - s.OutputSchemaVersion = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Tag -type Tag struct { - _ struct{} `type:"structure"` - - // Name of the tag. - // - // Key is a required field - Key *string `min:"1" type:"string" required:"true"` - - // Value of the tag. - // - // Value is a required field - Value *string `type:"string" required:"true"` -} - -// String returns the string representation -func (s Tag) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Tag) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Tag) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Tag"} - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.Value == nil { - invalidParams.Add(request.NewErrParamRequired("Value")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetKey sets the Key field's value. -func (s *Tag) SetKey(v string) *Tag { - s.Key = &v - return s -} - -// SetValue sets the Value field's value. -func (s *Tag) SetValue(v string) *Tag { - s.Value = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Tagging -type Tagging struct { - _ struct{} `type:"structure"` - - // TagSet is a required field - TagSet []*Tag `locationNameList:"Tag" type:"list" required:"true"` -} - -// String returns the string representation -func (s Tagging) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Tagging) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *Tagging) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "Tagging"} - if s.TagSet == nil { - invalidParams.Add(request.NewErrParamRequired("TagSet")) - } - if s.TagSet != nil { - for i, v := range s.TagSet { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "TagSet", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetTagSet sets the TagSet field's value. -func (s *Tagging) SetTagSet(v []*Tag) *Tagging { - s.TagSet = v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TargetGrant -type TargetGrant struct { - _ struct{} `type:"structure"` - - Grantee *Grantee `type:"structure" xmlPrefix:"xsi" xmlURI:"http://www.w3.org/2001/XMLSchema-instance"` - - // Logging permissions assigned to the Grantee for the bucket. - Permission *string `type:"string" enum:"BucketLogsPermission"` -} - -// String returns the string representation -func (s TargetGrant) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TargetGrant) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TargetGrant) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TargetGrant"} - if s.Grantee != nil { - if err := s.Grantee.Validate(); err != nil { - invalidParams.AddNested("Grantee", err.(request.ErrInvalidParams)) - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetGrantee sets the Grantee field's value. -func (s *TargetGrant) SetGrantee(v *Grantee) *TargetGrant { - s.Grantee = v - return s -} - -// SetPermission sets the Permission field's value. -func (s *TargetGrant) SetPermission(v string) *TargetGrant { - s.Permission = &v - return s -} - -// Container for specifying the configuration when you want Amazon S3 to publish -// events to an Amazon Simple Notification Service (Amazon SNS) topic. -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TopicConfiguration -type TopicConfiguration struct { - _ struct{} `type:"structure"` - - // Events is a required field - Events []*string `locationName:"Event" type:"list" flattened:"true" required:"true"` - - // Container for object key name filtering rules. For information about key - // name filtering, go to Configuring Event Notifications (http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html) - Filter *NotificationConfigurationFilter `type:"structure"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // Amazon SNS topic ARN to which Amazon S3 will publish a message when it detects - // events of specified type. - // - // TopicArn is a required field - TopicArn *string `locationName:"Topic" type:"string" required:"true"` -} - -// String returns the string representation -func (s TopicConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TopicConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *TopicConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "TopicConfiguration"} - if s.Events == nil { - invalidParams.Add(request.NewErrParamRequired("Events")) - } - if s.TopicArn == nil { - invalidParams.Add(request.NewErrParamRequired("TopicArn")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetEvents sets the Events field's value. -func (s *TopicConfiguration) SetEvents(v []*string) *TopicConfiguration { - s.Events = v - return s -} - -// SetFilter sets the Filter field's value. -func (s *TopicConfiguration) SetFilter(v *NotificationConfigurationFilter) *TopicConfiguration { - s.Filter = v - return s -} - -// SetId sets the Id field's value. -func (s *TopicConfiguration) SetId(v string) *TopicConfiguration { - s.Id = &v - return s -} - -// SetTopicArn sets the TopicArn field's value. -func (s *TopicConfiguration) SetTopicArn(v string) *TopicConfiguration { - s.TopicArn = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/TopicConfigurationDeprecated -type TopicConfigurationDeprecated struct { - _ struct{} `type:"structure"` - - // Bucket event for which to send notifications. - Event *string `deprecated:"true" type:"string" enum:"Event"` - - Events []*string `locationName:"Event" type:"list" flattened:"true"` - - // Optional unique identifier for configurations in a notification configuration. - // If you don't provide one, Amazon S3 will assign an ID. - Id *string `type:"string"` - - // Amazon SNS topic to which Amazon S3 will publish a message to report the - // specified events for the bucket. - Topic *string `type:"string"` -} - -// String returns the string representation -func (s TopicConfigurationDeprecated) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s TopicConfigurationDeprecated) GoString() string { - return s.String() -} - -// SetEvent sets the Event field's value. -func (s *TopicConfigurationDeprecated) SetEvent(v string) *TopicConfigurationDeprecated { - s.Event = &v - return s -} - -// SetEvents sets the Events field's value. -func (s *TopicConfigurationDeprecated) SetEvents(v []*string) *TopicConfigurationDeprecated { - s.Events = v - return s -} - -// SetId sets the Id field's value. -func (s *TopicConfigurationDeprecated) SetId(v string) *TopicConfigurationDeprecated { - s.Id = &v - return s -} - -// SetTopic sets the Topic field's value. -func (s *TopicConfigurationDeprecated) SetTopic(v string) *TopicConfigurationDeprecated { - s.Topic = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/Transition -type Transition struct { - _ struct{} `type:"structure"` - - // Indicates at what date the object is to be moved or deleted. Should be in - // GMT ISO 8601 Format. - Date *time.Time `type:"timestamp" timestampFormat:"iso8601"` - - // Indicates the lifetime, in days, of the objects that are subject to the rule. - // The value must be a non-zero positive integer. - Days *int64 `type:"integer"` - - // The class of storage used to store the object. - StorageClass *string `type:"string" enum:"TransitionStorageClass"` -} - -// String returns the string representation -func (s Transition) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s Transition) GoString() string { - return s.String() -} - -// SetDate sets the Date field's value. -func (s *Transition) SetDate(v time.Time) *Transition { - s.Date = &v - return s -} - -// SetDays sets the Days field's value. -func (s *Transition) SetDays(v int64) *Transition { - s.Days = &v - return s -} - -// SetStorageClass sets the StorageClass field's value. -func (s *Transition) SetStorageClass(v string) *Transition { - s.StorageClass = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopyRequest -type UploadPartCopyInput struct { - _ struct{} `type:"structure"` - - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // The name of the source bucket and key name of the source object, separated - // by a slash (/). Must be URL-encoded. - // - // CopySource is a required field - CopySource *string `location:"header" locationName:"x-amz-copy-source" type:"string" required:"true"` - - // Copies the object if its entity tag (ETag) matches the specified tag. - CopySourceIfMatch *string `location:"header" locationName:"x-amz-copy-source-if-match" type:"string"` - - // Copies the object if it has been modified since the specified time. - CopySourceIfModifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-modified-since" type:"timestamp" timestampFormat:"rfc822"` - - // Copies the object if its entity tag (ETag) is different than the specified - // ETag. - CopySourceIfNoneMatch *string `location:"header" locationName:"x-amz-copy-source-if-none-match" type:"string"` - - // Copies the object if it hasn't been modified since the specified time. - CopySourceIfUnmodifiedSince *time.Time `location:"header" locationName:"x-amz-copy-source-if-unmodified-since" type:"timestamp" timestampFormat:"rfc822"` - - // The range of bytes to copy from the source object. The range value must use - // the form bytes=first-last, where the first and last are the zero-based byte - // offsets to copy. For example, bytes=0-9 indicates that you want to copy the - // first ten bytes of the source. You can copy a range only if the source object - // is greater than 5 GB. - CopySourceRange *string `location:"header" locationName:"x-amz-copy-source-range" type:"string"` - - // Specifies the algorithm to use when decrypting the source object (e.g., AES256). - CopySourceSSECustomerAlgorithm *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use to decrypt - // the source object. The encryption key provided in this header must be one - // that was used when the source object was created. - CopySourceSSECustomerKey *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - CopySourceSSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-copy-source-server-side-encryption-customer-key-MD5" type:"string"` - - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of part being copied. This is a positive integer between 1 and - // 10,000. - // - // PartNumber is a required field - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being copied. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s UploadPartCopyInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartCopyInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UploadPartCopyInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UploadPartCopyInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.CopySource == nil { - invalidParams.Add(request.NewErrParamRequired("CopySource")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.PartNumber == nil { - invalidParams.Add(request.NewErrParamRequired("PartNumber")) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBucket sets the Bucket field's value. -func (s *UploadPartCopyInput) SetBucket(v string) *UploadPartCopyInput { - s.Bucket = &v - return s -} - -func (s *UploadPartCopyInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetCopySource sets the CopySource field's value. -func (s *UploadPartCopyInput) SetCopySource(v string) *UploadPartCopyInput { - s.CopySource = &v - return s -} - -// SetCopySourceIfMatch sets the CopySourceIfMatch field's value. -func (s *UploadPartCopyInput) SetCopySourceIfMatch(v string) *UploadPartCopyInput { - s.CopySourceIfMatch = &v - return s -} - -// SetCopySourceIfModifiedSince sets the CopySourceIfModifiedSince field's value. -func (s *UploadPartCopyInput) SetCopySourceIfModifiedSince(v time.Time) *UploadPartCopyInput { - s.CopySourceIfModifiedSince = &v - return s -} - -// SetCopySourceIfNoneMatch sets the CopySourceIfNoneMatch field's value. -func (s *UploadPartCopyInput) SetCopySourceIfNoneMatch(v string) *UploadPartCopyInput { - s.CopySourceIfNoneMatch = &v - return s -} - -// SetCopySourceIfUnmodifiedSince sets the CopySourceIfUnmodifiedSince field's value. -func (s *UploadPartCopyInput) SetCopySourceIfUnmodifiedSince(v time.Time) *UploadPartCopyInput { - s.CopySourceIfUnmodifiedSince = &v - return s -} - -// SetCopySourceRange sets the CopySourceRange field's value. -func (s *UploadPartCopyInput) SetCopySourceRange(v string) *UploadPartCopyInput { - s.CopySourceRange = &v - return s -} - -// SetCopySourceSSECustomerAlgorithm sets the CopySourceSSECustomerAlgorithm field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerAlgorithm(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerAlgorithm = &v - return s -} - -// SetCopySourceSSECustomerKey sets the CopySourceSSECustomerKey field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerKey(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerKey = &v - return s -} - -func (s *UploadPartCopyInput) getCopySourceSSECustomerKey() (v string) { - if s.CopySourceSSECustomerKey == nil { - return v - } - return *s.CopySourceSSECustomerKey -} - -// SetCopySourceSSECustomerKeyMD5 sets the CopySourceSSECustomerKeyMD5 field's value. -func (s *UploadPartCopyInput) SetCopySourceSSECustomerKeyMD5(v string) *UploadPartCopyInput { - s.CopySourceSSECustomerKeyMD5 = &v - return s -} - -// SetKey sets the Key field's value. -func (s *UploadPartCopyInput) SetKey(v string) *UploadPartCopyInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *UploadPartCopyInput) SetPartNumber(v int64) *UploadPartCopyInput { - s.PartNumber = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *UploadPartCopyInput) SetRequestPayer(v string) *UploadPartCopyInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartCopyInput) SetSSECustomerAlgorithm(v string) *UploadPartCopyInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *UploadPartCopyInput) SetSSECustomerKey(v string) *UploadPartCopyInput { - s.SSECustomerKey = &v - return s -} - -func (s *UploadPartCopyInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartCopyInput) SetSSECustomerKeyMD5(v string) *UploadPartCopyInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *UploadPartCopyInput) SetUploadId(v string) *UploadPartCopyInput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartCopyOutput -type UploadPartCopyOutput struct { - _ struct{} `type:"structure" payload:"CopyPartResult"` - - CopyPartResult *CopyPartResult `type:"structure"` - - // The version of the source object that was copied, if you have enabled versioning - // on the source bucket. - CopySourceVersionId *string `location:"header" locationName:"x-amz-copy-source-version-id" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s UploadPartCopyOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartCopyOutput) GoString() string { - return s.String() -} - -// SetCopyPartResult sets the CopyPartResult field's value. -func (s *UploadPartCopyOutput) SetCopyPartResult(v *CopyPartResult) *UploadPartCopyOutput { - s.CopyPartResult = v - return s -} - -// SetCopySourceVersionId sets the CopySourceVersionId field's value. -func (s *UploadPartCopyOutput) SetCopySourceVersionId(v string) *UploadPartCopyOutput { - s.CopySourceVersionId = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *UploadPartCopyOutput) SetRequestCharged(v string) *UploadPartCopyOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartCopyOutput) SetSSECustomerAlgorithm(v string) *UploadPartCopyOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartCopyOutput) SetSSECustomerKeyMD5(v string) *UploadPartCopyOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *UploadPartCopyOutput) SetSSEKMSKeyId(v string) *UploadPartCopyOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *UploadPartCopyOutput) SetServerSideEncryption(v string) *UploadPartCopyOutput { - s.ServerSideEncryption = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartRequest -type UploadPartInput struct { - _ struct{} `type:"structure" payload:"Body"` - - // Object data. - Body io.ReadSeeker `type:"blob"` - - // Name of the bucket to which the multipart upload was initiated. - // - // Bucket is a required field - Bucket *string `location:"uri" locationName:"Bucket" type:"string" required:"true"` - - // Size of the body in bytes. This parameter is useful when the size of the - // body cannot be determined automatically. - ContentLength *int64 `location:"header" locationName:"Content-Length" type:"long"` - - // The base64-encoded 128-bit MD5 digest of the part data. - ContentMD5 *string `location:"header" locationName:"Content-MD5" type:"string"` - - // Object key for which the multipart upload was initiated. - // - // Key is a required field - Key *string `location:"uri" locationName:"Key" min:"1" type:"string" required:"true"` - - // Part number of part being uploaded. This is a positive integer between 1 - // and 10,000. - // - // PartNumber is a required field - PartNumber *int64 `location:"querystring" locationName:"partNumber" type:"integer" required:"true"` - - // Confirms that the requester knows that she or he will be charged for the - // request. Bucket owners need not specify this parameter in their requests. - // Documentation on downloading objects from requester pays buckets can be found - // at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html - RequestPayer *string `location:"header" locationName:"x-amz-request-payer" type:"string" enum:"RequestPayer"` - - // Specifies the algorithm to use to when encrypting the object (e.g., AES256). - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // Specifies the customer-provided encryption key for Amazon S3 to use in encrypting - // data. This value is used to store the object and then it is discarded; Amazon - // does not store the encryption key. The key must be appropriate for use with - // the algorithm specified in the x-amz-server-side​-encryption​-customer-algorithm - // header. This must be the same encryption key specified in the initiate multipart - // upload request. - SSECustomerKey *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key" type:"string"` - - // Specifies the 128-bit MD5 digest of the encryption key according to RFC 1321. - // Amazon S3 uses this header for a message integrity check to ensure the encryption - // key was transmitted without error. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // Upload ID identifying the multipart upload whose part is being uploaded. - // - // UploadId is a required field - UploadId *string `location:"querystring" locationName:"uploadId" type:"string" required:"true"` -} - -// String returns the string representation -func (s UploadPartInput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartInput) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *UploadPartInput) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "UploadPartInput"} - if s.Bucket == nil { - invalidParams.Add(request.NewErrParamRequired("Bucket")) - } - if s.Key == nil { - invalidParams.Add(request.NewErrParamRequired("Key")) - } - if s.Key != nil && len(*s.Key) < 1 { - invalidParams.Add(request.NewErrParamMinLen("Key", 1)) - } - if s.PartNumber == nil { - invalidParams.Add(request.NewErrParamRequired("PartNumber")) - } - if s.UploadId == nil { - invalidParams.Add(request.NewErrParamRequired("UploadId")) - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetBody sets the Body field's value. -func (s *UploadPartInput) SetBody(v io.ReadSeeker) *UploadPartInput { - s.Body = v - return s -} - -// SetBucket sets the Bucket field's value. -func (s *UploadPartInput) SetBucket(v string) *UploadPartInput { - s.Bucket = &v - return s -} - -func (s *UploadPartInput) getBucket() (v string) { - if s.Bucket == nil { - return v - } - return *s.Bucket -} - -// SetContentLength sets the ContentLength field's value. -func (s *UploadPartInput) SetContentLength(v int64) *UploadPartInput { - s.ContentLength = &v - return s -} - -// SetContentMD5 sets the ContentMD5 field's value. -func (s *UploadPartInput) SetContentMD5(v string) *UploadPartInput { - s.ContentMD5 = &v - return s -} - -// SetKey sets the Key field's value. -func (s *UploadPartInput) SetKey(v string) *UploadPartInput { - s.Key = &v - return s -} - -// SetPartNumber sets the PartNumber field's value. -func (s *UploadPartInput) SetPartNumber(v int64) *UploadPartInput { - s.PartNumber = &v - return s -} - -// SetRequestPayer sets the RequestPayer field's value. -func (s *UploadPartInput) SetRequestPayer(v string) *UploadPartInput { - s.RequestPayer = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartInput) SetSSECustomerAlgorithm(v string) *UploadPartInput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKey sets the SSECustomerKey field's value. -func (s *UploadPartInput) SetSSECustomerKey(v string) *UploadPartInput { - s.SSECustomerKey = &v - return s -} - -func (s *UploadPartInput) getSSECustomerKey() (v string) { - if s.SSECustomerKey == nil { - return v - } - return *s.SSECustomerKey -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartInput) SetSSECustomerKeyMD5(v string) *UploadPartInput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetUploadId sets the UploadId field's value. -func (s *UploadPartInput) SetUploadId(v string) *UploadPartInput { - s.UploadId = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/UploadPartOutput -type UploadPartOutput struct { - _ struct{} `type:"structure"` - - // Entity tag for the uploaded object. - ETag *string `location:"header" locationName:"ETag" type:"string"` - - // If present, indicates that the requester was successfully charged for the - // request. - RequestCharged *string `location:"header" locationName:"x-amz-request-charged" type:"string" enum:"RequestCharged"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header confirming the encryption algorithm - // used. - SSECustomerAlgorithm *string `location:"header" locationName:"x-amz-server-side-encryption-customer-algorithm" type:"string"` - - // If server-side encryption with a customer-provided encryption key was requested, - // the response will include this header to provide round trip message integrity - // verification of the customer-provided encryption key. - SSECustomerKeyMD5 *string `location:"header" locationName:"x-amz-server-side-encryption-customer-key-MD5" type:"string"` - - // If present, specifies the ID of the AWS Key Management Service (KMS) master - // encryption key that was used for the object. - SSEKMSKeyId *string `location:"header" locationName:"x-amz-server-side-encryption-aws-kms-key-id" type:"string"` - - // The Server-side encryption algorithm used when storing this object in S3 - // (e.g., AES256, aws:kms). - ServerSideEncryption *string `location:"header" locationName:"x-amz-server-side-encryption" type:"string" enum:"ServerSideEncryption"` -} - -// String returns the string representation -func (s UploadPartOutput) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s UploadPartOutput) GoString() string { - return s.String() -} - -// SetETag sets the ETag field's value. -func (s *UploadPartOutput) SetETag(v string) *UploadPartOutput { - s.ETag = &v - return s -} - -// SetRequestCharged sets the RequestCharged field's value. -func (s *UploadPartOutput) SetRequestCharged(v string) *UploadPartOutput { - s.RequestCharged = &v - return s -} - -// SetSSECustomerAlgorithm sets the SSECustomerAlgorithm field's value. -func (s *UploadPartOutput) SetSSECustomerAlgorithm(v string) *UploadPartOutput { - s.SSECustomerAlgorithm = &v - return s -} - -// SetSSECustomerKeyMD5 sets the SSECustomerKeyMD5 field's value. -func (s *UploadPartOutput) SetSSECustomerKeyMD5(v string) *UploadPartOutput { - s.SSECustomerKeyMD5 = &v - return s -} - -// SetSSEKMSKeyId sets the SSEKMSKeyId field's value. -func (s *UploadPartOutput) SetSSEKMSKeyId(v string) *UploadPartOutput { - s.SSEKMSKeyId = &v - return s -} - -// SetServerSideEncryption sets the ServerSideEncryption field's value. -func (s *UploadPartOutput) SetServerSideEncryption(v string) *UploadPartOutput { - s.ServerSideEncryption = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/VersioningConfiguration -type VersioningConfiguration struct { - _ struct{} `type:"structure"` - - // Specifies whether MFA delete is enabled in the bucket versioning configuration. - // This element is only returned if the bucket has been configured with MFA - // delete. If the bucket has never been so configured, this element is not returned. - MFADelete *string `locationName:"MfaDelete" type:"string" enum:"MFADelete"` - - // The versioning state of the bucket. - Status *string `type:"string" enum:"BucketVersioningStatus"` -} - -// String returns the string representation -func (s VersioningConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s VersioningConfiguration) GoString() string { - return s.String() -} - -// SetMFADelete sets the MFADelete field's value. -func (s *VersioningConfiguration) SetMFADelete(v string) *VersioningConfiguration { - s.MFADelete = &v - return s -} - -// SetStatus sets the Status field's value. -func (s *VersioningConfiguration) SetStatus(v string) *VersioningConfiguration { - s.Status = &v - return s -} - -// See also, https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01/WebsiteConfiguration -type WebsiteConfiguration struct { - _ struct{} `type:"structure"` - - ErrorDocument *ErrorDocument `type:"structure"` - - IndexDocument *IndexDocument `type:"structure"` - - RedirectAllRequestsTo *RedirectAllRequestsTo `type:"structure"` - - RoutingRules []*RoutingRule `locationNameList:"RoutingRule" type:"list"` -} - -// String returns the string representation -func (s WebsiteConfiguration) String() string { - return awsutil.Prettify(s) -} - -// GoString returns the string representation -func (s WebsiteConfiguration) GoString() string { - return s.String() -} - -// Validate inspects the fields of the type to determine if they are valid. -func (s *WebsiteConfiguration) Validate() error { - invalidParams := request.ErrInvalidParams{Context: "WebsiteConfiguration"} - if s.ErrorDocument != nil { - if err := s.ErrorDocument.Validate(); err != nil { - invalidParams.AddNested("ErrorDocument", err.(request.ErrInvalidParams)) - } - } - if s.IndexDocument != nil { - if err := s.IndexDocument.Validate(); err != nil { - invalidParams.AddNested("IndexDocument", err.(request.ErrInvalidParams)) - } - } - if s.RedirectAllRequestsTo != nil { - if err := s.RedirectAllRequestsTo.Validate(); err != nil { - invalidParams.AddNested("RedirectAllRequestsTo", err.(request.ErrInvalidParams)) - } - } - if s.RoutingRules != nil { - for i, v := range s.RoutingRules { - if v == nil { - continue - } - if err := v.Validate(); err != nil { - invalidParams.AddNested(fmt.Sprintf("%s[%v]", "RoutingRules", i), err.(request.ErrInvalidParams)) - } - } - } - - if invalidParams.Len() > 0 { - return invalidParams - } - return nil -} - -// SetErrorDocument sets the ErrorDocument field's value. -func (s *WebsiteConfiguration) SetErrorDocument(v *ErrorDocument) *WebsiteConfiguration { - s.ErrorDocument = v - return s -} - -// SetIndexDocument sets the IndexDocument field's value. -func (s *WebsiteConfiguration) SetIndexDocument(v *IndexDocument) *WebsiteConfiguration { - s.IndexDocument = v - return s -} - -// SetRedirectAllRequestsTo sets the RedirectAllRequestsTo field's value. -func (s *WebsiteConfiguration) SetRedirectAllRequestsTo(v *RedirectAllRequestsTo) *WebsiteConfiguration { - s.RedirectAllRequestsTo = v - return s -} - -// SetRoutingRules sets the RoutingRules field's value. -func (s *WebsiteConfiguration) SetRoutingRules(v []*RoutingRule) *WebsiteConfiguration { - s.RoutingRules = v - return s -} - -const ( - // AnalyticsS3ExportFileFormatCsv is a AnalyticsS3ExportFileFormat enum value - AnalyticsS3ExportFileFormatCsv = "CSV" -) - -const ( - // BucketAccelerateStatusEnabled is a BucketAccelerateStatus enum value - BucketAccelerateStatusEnabled = "Enabled" - - // BucketAccelerateStatusSuspended is a BucketAccelerateStatus enum value - BucketAccelerateStatusSuspended = "Suspended" -) - -const ( - // BucketCannedACLPrivate is a BucketCannedACL enum value - BucketCannedACLPrivate = "private" - - // BucketCannedACLPublicRead is a BucketCannedACL enum value - BucketCannedACLPublicRead = "public-read" - - // BucketCannedACLPublicReadWrite is a BucketCannedACL enum value - BucketCannedACLPublicReadWrite = "public-read-write" - - // BucketCannedACLAuthenticatedRead is a BucketCannedACL enum value - BucketCannedACLAuthenticatedRead = "authenticated-read" -) - -const ( - // BucketLocationConstraintEu is a BucketLocationConstraint enum value - BucketLocationConstraintEu = "EU" - - // BucketLocationConstraintEuWest1 is a BucketLocationConstraint enum value - BucketLocationConstraintEuWest1 = "eu-west-1" - - // BucketLocationConstraintUsWest1 is a BucketLocationConstraint enum value - BucketLocationConstraintUsWest1 = "us-west-1" - - // BucketLocationConstraintUsWest2 is a BucketLocationConstraint enum value - BucketLocationConstraintUsWest2 = "us-west-2" - - // BucketLocationConstraintApSouth1 is a BucketLocationConstraint enum value - BucketLocationConstraintApSouth1 = "ap-south-1" - - // BucketLocationConstraintApSoutheast1 is a BucketLocationConstraint enum value - BucketLocationConstraintApSoutheast1 = "ap-southeast-1" - - // BucketLocationConstraintApSoutheast2 is a BucketLocationConstraint enum value - BucketLocationConstraintApSoutheast2 = "ap-southeast-2" - - // BucketLocationConstraintApNortheast1 is a BucketLocationConstraint enum value - BucketLocationConstraintApNortheast1 = "ap-northeast-1" - - // BucketLocationConstraintSaEast1 is a BucketLocationConstraint enum value - BucketLocationConstraintSaEast1 = "sa-east-1" - - // BucketLocationConstraintCnNorth1 is a BucketLocationConstraint enum value - BucketLocationConstraintCnNorth1 = "cn-north-1" - - // BucketLocationConstraintEuCentral1 is a BucketLocationConstraint enum value - BucketLocationConstraintEuCentral1 = "eu-central-1" -) - -const ( - // BucketLogsPermissionFullControl is a BucketLogsPermission enum value - BucketLogsPermissionFullControl = "FULL_CONTROL" - - // BucketLogsPermissionRead is a BucketLogsPermission enum value - BucketLogsPermissionRead = "READ" - - // BucketLogsPermissionWrite is a BucketLogsPermission enum value - BucketLogsPermissionWrite = "WRITE" -) - -const ( - // BucketVersioningStatusEnabled is a BucketVersioningStatus enum value - BucketVersioningStatusEnabled = "Enabled" - - // BucketVersioningStatusSuspended is a BucketVersioningStatus enum value - BucketVersioningStatusSuspended = "Suspended" -) - -// Requests Amazon S3 to encode the object keys in the response and specifies -// the encoding method to use. An object key may contain any Unicode character; -// however, XML 1.0 parser cannot parse some characters, such as characters -// with an ASCII value from 0 to 10. For characters that are not supported in -// XML 1.0, you can add this parameter to request that Amazon S3 encode the -// keys in the response. -const ( - // EncodingTypeUrl is a EncodingType enum value - EncodingTypeUrl = "url" -) - -// Bucket event for which to send notifications. -const ( - // EventS3ReducedRedundancyLostObject is a Event enum value - EventS3ReducedRedundancyLostObject = "s3:ReducedRedundancyLostObject" - - // EventS3ObjectCreated is a Event enum value - EventS3ObjectCreated = "s3:ObjectCreated:*" - - // EventS3ObjectCreatedPut is a Event enum value - EventS3ObjectCreatedPut = "s3:ObjectCreated:Put" - - // EventS3ObjectCreatedPost is a Event enum value - EventS3ObjectCreatedPost = "s3:ObjectCreated:Post" - - // EventS3ObjectCreatedCopy is a Event enum value - EventS3ObjectCreatedCopy = "s3:ObjectCreated:Copy" - - // EventS3ObjectCreatedCompleteMultipartUpload is a Event enum value - EventS3ObjectCreatedCompleteMultipartUpload = "s3:ObjectCreated:CompleteMultipartUpload" - - // EventS3ObjectRemoved is a Event enum value - EventS3ObjectRemoved = "s3:ObjectRemoved:*" - - // EventS3ObjectRemovedDelete is a Event enum value - EventS3ObjectRemovedDelete = "s3:ObjectRemoved:Delete" - - // EventS3ObjectRemovedDeleteMarkerCreated is a Event enum value - EventS3ObjectRemovedDeleteMarkerCreated = "s3:ObjectRemoved:DeleteMarkerCreated" -) - -const ( - // ExpirationStatusEnabled is a ExpirationStatus enum value - ExpirationStatusEnabled = "Enabled" - - // ExpirationStatusDisabled is a ExpirationStatus enum value - ExpirationStatusDisabled = "Disabled" -) - -const ( - // ExpressionTypeSql is a ExpressionType enum value - ExpressionTypeSql = "SQL" -) - -const ( - // FileHeaderInfoUse is a FileHeaderInfo enum value - FileHeaderInfoUse = "USE" - - // FileHeaderInfoIgnore is a FileHeaderInfo enum value - FileHeaderInfoIgnore = "IGNORE" - - // FileHeaderInfoNone is a FileHeaderInfo enum value - FileHeaderInfoNone = "NONE" -) - -const ( - // FilterRuleNamePrefix is a FilterRuleName enum value - FilterRuleNamePrefix = "prefix" - - // FilterRuleNameSuffix is a FilterRuleName enum value - FilterRuleNameSuffix = "suffix" -) - -const ( - // InventoryFormatCsv is a InventoryFormat enum value - InventoryFormatCsv = "CSV" - - // InventoryFormatOrc is a InventoryFormat enum value - InventoryFormatOrc = "ORC" -) - -const ( - // InventoryFrequencyDaily is a InventoryFrequency enum value - InventoryFrequencyDaily = "Daily" - - // InventoryFrequencyWeekly is a InventoryFrequency enum value - InventoryFrequencyWeekly = "Weekly" -) - -const ( - // InventoryIncludedObjectVersionsAll is a InventoryIncludedObjectVersions enum value - InventoryIncludedObjectVersionsAll = "All" - - // InventoryIncludedObjectVersionsCurrent is a InventoryIncludedObjectVersions enum value - InventoryIncludedObjectVersionsCurrent = "Current" -) - -const ( - // InventoryOptionalFieldSize is a InventoryOptionalField enum value - InventoryOptionalFieldSize = "Size" - - // InventoryOptionalFieldLastModifiedDate is a InventoryOptionalField enum value - InventoryOptionalFieldLastModifiedDate = "LastModifiedDate" - - // InventoryOptionalFieldStorageClass is a InventoryOptionalField enum value - InventoryOptionalFieldStorageClass = "StorageClass" - - // InventoryOptionalFieldEtag is a InventoryOptionalField enum value - InventoryOptionalFieldEtag = "ETag" - - // InventoryOptionalFieldIsMultipartUploaded is a InventoryOptionalField enum value - InventoryOptionalFieldIsMultipartUploaded = "IsMultipartUploaded" - - // InventoryOptionalFieldReplicationStatus is a InventoryOptionalField enum value - InventoryOptionalFieldReplicationStatus = "ReplicationStatus" - - // InventoryOptionalFieldEncryptionStatus is a InventoryOptionalField enum value - InventoryOptionalFieldEncryptionStatus = "EncryptionStatus" -) - -const ( - // MFADeleteEnabled is a MFADelete enum value - MFADeleteEnabled = "Enabled" - - // MFADeleteDisabled is a MFADelete enum value - MFADeleteDisabled = "Disabled" -) - -const ( - // MFADeleteStatusEnabled is a MFADeleteStatus enum value - MFADeleteStatusEnabled = "Enabled" - - // MFADeleteStatusDisabled is a MFADeleteStatus enum value - MFADeleteStatusDisabled = "Disabled" -) - -const ( - // MetadataDirectiveCopy is a MetadataDirective enum value - MetadataDirectiveCopy = "COPY" - - // MetadataDirectiveReplace is a MetadataDirective enum value - MetadataDirectiveReplace = "REPLACE" -) - -const ( - // ObjectCannedACLPrivate is a ObjectCannedACL enum value - ObjectCannedACLPrivate = "private" - - // ObjectCannedACLPublicRead is a ObjectCannedACL enum value - ObjectCannedACLPublicRead = "public-read" - - // ObjectCannedACLPublicReadWrite is a ObjectCannedACL enum value - ObjectCannedACLPublicReadWrite = "public-read-write" - - // ObjectCannedACLAuthenticatedRead is a ObjectCannedACL enum value - ObjectCannedACLAuthenticatedRead = "authenticated-read" - - // ObjectCannedACLAwsExecRead is a ObjectCannedACL enum value - ObjectCannedACLAwsExecRead = "aws-exec-read" - - // ObjectCannedACLBucketOwnerRead is a ObjectCannedACL enum value - ObjectCannedACLBucketOwnerRead = "bucket-owner-read" - - // ObjectCannedACLBucketOwnerFullControl is a ObjectCannedACL enum value - ObjectCannedACLBucketOwnerFullControl = "bucket-owner-full-control" -) - -const ( - // ObjectStorageClassStandard is a ObjectStorageClass enum value - ObjectStorageClassStandard = "STANDARD" - - // ObjectStorageClassReducedRedundancy is a ObjectStorageClass enum value - ObjectStorageClassReducedRedundancy = "REDUCED_REDUNDANCY" - - // ObjectStorageClassGlacier is a ObjectStorageClass enum value - ObjectStorageClassGlacier = "GLACIER" -) - -const ( - // ObjectVersionStorageClassStandard is a ObjectVersionStorageClass enum value - ObjectVersionStorageClassStandard = "STANDARD" -) - -const ( - // OwnerOverrideDestination is a OwnerOverride enum value - OwnerOverrideDestination = "Destination" -) - -const ( - // PayerRequester is a Payer enum value - PayerRequester = "Requester" - - // PayerBucketOwner is a Payer enum value - PayerBucketOwner = "BucketOwner" -) - -const ( - // PermissionFullControl is a Permission enum value - PermissionFullControl = "FULL_CONTROL" - - // PermissionWrite is a Permission enum value - PermissionWrite = "WRITE" - - // PermissionWriteAcp is a Permission enum value - PermissionWriteAcp = "WRITE_ACP" - - // PermissionRead is a Permission enum value - PermissionRead = "READ" - - // PermissionReadAcp is a Permission enum value - PermissionReadAcp = "READ_ACP" -) - -const ( - // ProtocolHttp is a Protocol enum value - ProtocolHttp = "http" - - // ProtocolHttps is a Protocol enum value - ProtocolHttps = "https" -) - -const ( - // QuoteFieldsAlways is a QuoteFields enum value - QuoteFieldsAlways = "ALWAYS" - - // QuoteFieldsAsneeded is a QuoteFields enum value - QuoteFieldsAsneeded = "ASNEEDED" -) - -const ( - // ReplicationRuleStatusEnabled is a ReplicationRuleStatus enum value - ReplicationRuleStatusEnabled = "Enabled" - - // ReplicationRuleStatusDisabled is a ReplicationRuleStatus enum value - ReplicationRuleStatusDisabled = "Disabled" -) - -const ( - // ReplicationStatusComplete is a ReplicationStatus enum value - ReplicationStatusComplete = "COMPLETE" - - // ReplicationStatusPending is a ReplicationStatus enum value - ReplicationStatusPending = "PENDING" - - // ReplicationStatusFailed is a ReplicationStatus enum value - ReplicationStatusFailed = "FAILED" - - // ReplicationStatusReplica is a ReplicationStatus enum value - ReplicationStatusReplica = "REPLICA" -) - -// If present, indicates that the requester was successfully charged for the -// request. -const ( - // RequestChargedRequester is a RequestCharged enum value - RequestChargedRequester = "requester" -) - -// Confirms that the requester knows that she or he will be charged for the -// request. Bucket owners need not specify this parameter in their requests. -// Documentation on downloading objects from requester pays buckets can be found -// at http://docs.aws.amazon.com/AmazonS3/latest/dev/ObjectsinRequesterPaysBuckets.html -const ( - // RequestPayerRequester is a RequestPayer enum value - RequestPayerRequester = "requester" -) - -const ( - // RestoreRequestTypeSelect is a RestoreRequestType enum value - RestoreRequestTypeSelect = "SELECT" -) - -const ( - // ServerSideEncryptionAes256 is a ServerSideEncryption enum value - ServerSideEncryptionAes256 = "AES256" - - // ServerSideEncryptionAwsKms is a ServerSideEncryption enum value - ServerSideEncryptionAwsKms = "aws:kms" -) - -const ( - // SseKmsEncryptedObjectsStatusEnabled is a SseKmsEncryptedObjectsStatus enum value - SseKmsEncryptedObjectsStatusEnabled = "Enabled" - - // SseKmsEncryptedObjectsStatusDisabled is a SseKmsEncryptedObjectsStatus enum value - SseKmsEncryptedObjectsStatusDisabled = "Disabled" -) - -const ( - // StorageClassStandard is a StorageClass enum value - StorageClassStandard = "STANDARD" - - // StorageClassReducedRedundancy is a StorageClass enum value - StorageClassReducedRedundancy = "REDUCED_REDUNDANCY" - - // StorageClassStandardIa is a StorageClass enum value - StorageClassStandardIa = "STANDARD_IA" -) - -const ( - // StorageClassAnalysisSchemaVersionV1 is a StorageClassAnalysisSchemaVersion enum value - StorageClassAnalysisSchemaVersionV1 = "V_1" -) - -const ( - // TaggingDirectiveCopy is a TaggingDirective enum value - TaggingDirectiveCopy = "COPY" - - // TaggingDirectiveReplace is a TaggingDirective enum value - TaggingDirectiveReplace = "REPLACE" -) - -const ( - // TierStandard is a Tier enum value - TierStandard = "Standard" - - // TierBulk is a Tier enum value - TierBulk = "Bulk" - - // TierExpedited is a Tier enum value - TierExpedited = "Expedited" -) - -const ( - // TransitionStorageClassGlacier is a TransitionStorageClass enum value - TransitionStorageClassGlacier = "GLACIER" - - // TransitionStorageClassStandardIa is a TransitionStorageClass enum value - TransitionStorageClassStandardIa = "STANDARD_IA" -) - -const ( - // TypeCanonicalUser is a Type enum value - TypeCanonicalUser = "CanonicalUser" - - // TypeAmazonCustomerByEmail is a Type enum value - TypeAmazonCustomerByEmail = "AmazonCustomerByEmail" - - // TypeGroup is a Type enum value - TypeGroup = "Group" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go deleted file mode 100644 index bc68a46..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location.go +++ /dev/null @@ -1,106 +0,0 @@ -package s3 - -import ( - "io/ioutil" - "regexp" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" -) - -var reBucketLocation = regexp.MustCompile(`>([^<>]+)<\/Location`) - -// NormalizeBucketLocation is a utility function which will update the -// passed in value to always be a region ID. Generally this would be used -// with GetBucketLocation API operation. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -func NormalizeBucketLocation(loc string) string { - switch loc { - case "": - loc = "us-east-1" - case "EU": - loc = "eu-west-1" - } - - return loc -} - -// NormalizeBucketLocationHandler is a request handler which will update the -// GetBucketLocation's result LocationConstraint value to always be a region ID. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -// -// req, result := svc.GetBucketLocationRequest(&s3.GetBucketLocationInput{ -// Bucket: aws.String(bucket), -// }) -// req.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) -// err := req.Send() -var NormalizeBucketLocationHandler = request.NamedHandler{ - Name: "awssdk.s3.NormalizeBucketLocation", - Fn: func(req *request.Request) { - if req.Error != nil { - return - } - - out := req.Data.(*GetBucketLocationOutput) - loc := NormalizeBucketLocation(aws.StringValue(out.LocationConstraint)) - out.LocationConstraint = aws.String(loc) - }, -} - -// WithNormalizeBucketLocation is a request option which will update the -// GetBucketLocation's result LocationConstraint value to always be a region ID. -// -// Replaces empty string with "us-east-1", and "EU" with "eu-west-1". -// -// See http://docs.aws.amazon.com/AmazonS3/latest/API/RESTBucketGETlocation.html -// for more information on the values that can be returned. -// -// result, err := svc.GetBucketLocationWithContext(ctx, -// &s3.GetBucketLocationInput{ -// Bucket: aws.String(bucket), -// }, -// s3.WithNormalizeBucketLocation, -// ) -func WithNormalizeBucketLocation(r *request.Request) { - r.Handlers.Unmarshal.PushBackNamed(NormalizeBucketLocationHandler) -} - -func buildGetBucketLocation(r *request.Request) { - if r.DataFilled() { - out := r.Data.(*GetBucketLocationOutput) - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "failed reading response body", err) - return - } - - match := reBucketLocation.FindSubmatch(b) - if len(match) > 1 { - loc := string(match[1]) - out.LocationConstraint = aws.String(loc) - } - } -} - -func populateLocationConstraint(r *request.Request) { - if r.ParamsFilled() && aws.StringValue(r.Config.Region) != "us-east-1" { - in := r.Params.(*CreateBucketInput) - if in.CreateBucketConfiguration == nil { - r.Params = awsutil.CopyOf(r.Params) - in = r.Params.(*CreateBucketInput) - in.CreateBucketConfiguration = &CreateBucketConfiguration{ - LocationConstraint: r.Config.Region, - } - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go deleted file mode 100644 index c5984cf..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/bucket_location_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package s3_test - -import ( - "bytes" - "io/ioutil" - "net/http" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awsutil" - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -var s3LocationTests = []struct { - body string - loc string -}{ - {``, ``}, - {`EU`, `EU`}, -} - -func TestGetBucketLocation(t *testing.T) { - for _, test := range s3LocationTests { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - reader := ioutil.NopCloser(bytes.NewReader([]byte(test.body))) - r.HTTPResponse = &http.Response{StatusCode: 200, Body: reader} - }) - - resp, err := s.GetBucketLocation(&s3.GetBucketLocationInput{Bucket: aws.String("bucket")}) - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - if test.loc == "" { - if v := resp.LocationConstraint; v != nil { - t.Errorf("expect location constraint to be nil, got %s", *v) - } - } else { - if e, a := test.loc, *resp.LocationConstraint; e != a { - t.Errorf("expect %s location constraint, got %v", e, a) - } - } - } -} - -func TestNormalizeBucketLocation(t *testing.T) { - cases := []struct { - In, Out string - }{ - {"", "us-east-1"}, - {"EU", "eu-west-1"}, - {"us-east-1", "us-east-1"}, - {"something", "something"}, - } - - for i, c := range cases { - actual := s3.NormalizeBucketLocation(c.In) - if e, a := c.Out, actual; e != a { - t.Errorf("%d, expect %s bucket location, got %s", i, e, a) - } - } -} - -func TestWithNormalizeBucketLocation(t *testing.T) { - req := &request.Request{} - req.ApplyOptions(s3.WithNormalizeBucketLocation) - - cases := []struct { - In, Out string - }{ - {"", "us-east-1"}, - {"EU", "eu-west-1"}, - {"us-east-1", "us-east-1"}, - {"something", "something"}, - } - - for i, c := range cases { - req.Data = &s3.GetBucketLocationOutput{ - LocationConstraint: aws.String(c.In), - } - req.Handlers.Unmarshal.Run(req) - - v := req.Data.(*s3.GetBucketLocationOutput).LocationConstraint - if e, a := c.Out, aws.StringValue(v); e != a { - t.Errorf("%d, expect %s bucket location, got %s", i, e, a) - } - } -} - -func TestPopulateLocationConstraint(t *testing.T) { - s := s3.New(unit.Session) - in := &s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - } - req, _ := s.CreateBucketRequest(in) - if err := req.Build(); err != nil { - t.Fatalf("expect no error, got %v", err) - } - - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - if e, a := "mock-region", *(v[0].(*string)); e != a { - t.Errorf("expect %s location constraint, got %s", e, a) - } - if v := in.CreateBucketConfiguration; v != nil { - // don't modify original params - t.Errorf("expect create bucket Configuration to be nil, got %s", *v) - } -} - -func TestNoPopulateLocationConstraintIfProvided(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{}, - }) - if err := req.Build(); err != nil { - t.Fatalf("expect no error, got %v", err) - } - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - if l := len(v); l != 0 { - t.Errorf("expect no values, got %d", l) - } -} - -func TestNoPopulateLocationConstraintIfClassic(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{Region: aws.String("us-east-1")}) - req, _ := s.CreateBucketRequest(&s3.CreateBucketInput{ - Bucket: aws.String("bucket"), - }) - if err := req.Build(); err != nil { - t.Fatalf("expect no error, got %v", err) - } - v, _ := awsutil.ValuesAtPath(req.Params, "CreateBucketConfiguration.LocationConstraint") - if l := len(v); l != 0 { - t.Errorf("expect no values, got %d", l) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go b/vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go deleted file mode 100644 index 9fc5df9..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/content_md5.go +++ /dev/null @@ -1,36 +0,0 @@ -package s3 - -import ( - "crypto/md5" - "encoding/base64" - "io" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// contentMD5 computes and sets the HTTP Content-MD5 header for requests that -// require it. -func contentMD5(r *request.Request) { - h := md5.New() - - // hash the body. seek back to the first position after reading to reset - // the body for transmission. copy errors may be assumed to be from the - // body. - _, err := io.Copy(h, r.Body) - if err != nil { - r.Error = awserr.New("ContentMD5", "failed to read body", err) - return - } - _, err = r.Body.Seek(0, 0) - if err != nil { - r.Error = awserr.New("ContentMD5", "failed to seek body", err) - return - } - - // encode the md5 checksum in base64 and set the request header. - sum := h.Sum(nil) - sum64 := make([]byte, base64.StdEncoding.EncodedLen(len(sum))) - base64.StdEncoding.Encode(sum64, sum) - r.HTTPRequest.Header.Set("Content-MD5", string(sum64)) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go deleted file mode 100644 index 899d5e8..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations.go +++ /dev/null @@ -1,64 +0,0 @@ -package s3 - -import ( - "github.com/aws/aws-sdk-go/aws/client" - "github.com/aws/aws-sdk-go/aws/request" -) - -func init() { - initClient = defaultInitClientFn - initRequest = defaultInitRequestFn -} - -func defaultInitClientFn(c *client.Client) { - // Support building custom endpoints based on config - c.Handlers.Build.PushFront(updateEndpointForS3Config) - - // Require SSL when using SSE keys - c.Handlers.Validate.PushBack(validateSSERequiresSSL) - c.Handlers.Build.PushBack(computeSSEKeys) - - // S3 uses custom error unmarshaling logic - c.Handlers.UnmarshalError.Clear() - c.Handlers.UnmarshalError.PushBack(unmarshalError) -} - -func defaultInitRequestFn(r *request.Request) { - // Add reuest handlers for specific platforms. - // e.g. 100-continue support for PUT requests using Go 1.6 - platformRequestHandlers(r) - - switch r.Operation.Name { - case opPutBucketCors, opPutBucketLifecycle, opPutBucketPolicy, - opPutBucketTagging, opDeleteObjects, opPutBucketLifecycleConfiguration, - opPutBucketReplication: - // These S3 operations require Content-MD5 to be set - r.Handlers.Build.PushBack(contentMD5) - case opGetBucketLocation: - // GetBucketLocation has custom parsing logic - r.Handlers.Unmarshal.PushFront(buildGetBucketLocation) - case opCreateBucket: - // Auto-populate LocationConstraint with current region - r.Handlers.Validate.PushFront(populateLocationConstraint) - case opCopyObject, opUploadPartCopy, opCompleteMultipartUpload: - r.Handlers.Unmarshal.PushFront(copyMultipartStatusOKUnmarhsalError) - } -} - -// bucketGetter is an accessor interface to grab the "Bucket" field from -// an S3 type. -type bucketGetter interface { - getBucket() string -} - -// sseCustomerKeyGetter is an accessor interface to grab the "SSECustomerKey" -// field from an S3 type. -type sseCustomerKeyGetter interface { - getSSECustomerKey() string -} - -// copySourceSSECustomerKeyGetter is an accessor interface to grab the -// "CopySourceSSECustomerKey" field from an S3 type. -type copySourceSSECustomerKeyGetter interface { - getCopySourceSSECustomerKey() string -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go deleted file mode 100644 index 6628ecb..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/customizations_test.go +++ /dev/null @@ -1,171 +0,0 @@ -package s3_test - -import ( - "crypto/md5" - "encoding/base64" - "io/ioutil" - "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/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func assertMD5(t *testing.T, req *request.Request) { - err := req.Build() - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - b, _ := ioutil.ReadAll(req.HTTPRequest.Body) - out := md5.Sum(b) - if len(b) == 0 { - t.Error("expected non-empty value") - } - if e, a := base64.StdEncoding.EncodeToString(out[:]), req.HTTPRequest.Header.Get("Content-MD5"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestMD5InPutBucketCors(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketCorsRequest(&s3.PutBucketCorsInput{ - Bucket: aws.String("bucketname"), - CORSConfiguration: &s3.CORSConfiguration{ - CORSRules: []*s3.CORSRule{ - { - AllowedMethods: []*string{aws.String("GET")}, - AllowedOrigins: []*string{aws.String("*")}, - }, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketLifecycle(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketLifecycleRequest(&s3.PutBucketLifecycleInput{ - Bucket: aws.String("bucketname"), - LifecycleConfiguration: &s3.LifecycleConfiguration{ - Rules: []*s3.Rule{ - { - ID: aws.String("ID"), - Prefix: aws.String("Prefix"), - Status: aws.String("Enabled"), - }, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketPolicy(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketPolicyRequest(&s3.PutBucketPolicyInput{ - Bucket: aws.String("bucketname"), - Policy: aws.String("{}"), - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketTagging(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketTaggingRequest(&s3.PutBucketTaggingInput{ - Bucket: aws.String("bucketname"), - Tagging: &s3.Tagging{ - TagSet: []*s3.Tag{ - {Key: aws.String("KEY"), Value: aws.String("VALUE")}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InDeleteObjects(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.DeleteObjectsRequest(&s3.DeleteObjectsInput{ - Bucket: aws.String("bucketname"), - Delete: &s3.Delete{ - Objects: []*s3.ObjectIdentifier{ - {Key: aws.String("key")}, - }, - }, - }) - assertMD5(t, req) -} - -func TestMD5InPutBucketLifecycleConfiguration(t *testing.T) { - svc := s3.New(unit.Session) - req, _ := svc.PutBucketLifecycleConfigurationRequest(&s3.PutBucketLifecycleConfigurationInput{ - Bucket: aws.String("bucketname"), - LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ - {Prefix: aws.String("prefix"), Status: aws.String(s3.ExpirationStatusEnabled)}, - }, - }, - }) - assertMD5(t, req) -} - -const ( - metaKeyPrefix = `X-Amz-Meta-` - utf8KeySuffix = `My-Info` - utf8Value = "hello-世界\u0444" -) - -func TestPutObjectMetadataWithUnicode(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - if e, a := utf8Value, r.Header.Get(metaKeyPrefix+utf8KeySuffix); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - })) - svc := s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - DisableSSL: aws.Bool(true), - }) - - _, err := svc.PutObject(&s3.PutObjectInput{ - Bucket: aws.String("my_bucket"), - Key: aws.String("my_key"), - Body: strings.NewReader(""), - Metadata: func() map[string]*string { - v := map[string]*string{} - v[utf8KeySuffix] = aws.String(utf8Value) - return v - }(), - }) - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } -} - -func TestGetObjectMetadataWithUnicode(t *testing.T) { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.Header().Set(metaKeyPrefix+utf8KeySuffix, utf8Value) - })) - svc := s3.New(unit.Session, &aws.Config{ - Endpoint: aws.String(server.URL), - DisableSSL: aws.Bool(true), - }) - - resp, err := svc.GetObject(&s3.GetObjectInput{ - Bucket: aws.String("my_bucket"), - Key: aws.String("my_key"), - }) - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - resp.Body.Close() - - if e, a := utf8Value, *resp.Metadata[utf8KeySuffix]; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go deleted file mode 100644 index 0def022..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc.go +++ /dev/null @@ -1,26 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -// Package s3 provides the client and types for making API -// requests to Amazon Simple Storage Service. -// -// See https://docs.aws.amazon.com/goto/WebAPI/s3-2006-03-01 for more information on this service. -// -// See s3 package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/ -// -// Using the Client -// -// To contact Amazon Simple Storage 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 Amazon Simple Storage Service client S3 for more -// information on creating client for this service. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/#New -package s3 diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go b/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go deleted file mode 100644 index 39b912c..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/doc_custom.go +++ /dev/null @@ -1,109 +0,0 @@ -// Upload Managers -// -// The s3manager package's Uploader provides concurrent upload of content to S3 -// by taking advantage of S3's Multipart APIs. The Uploader also supports both -// io.Reader for streaming uploads, and will also take advantage of io.ReadSeeker -// for optimizations if the Body satisfies that type. Once the Uploader instance -// is created you can call Upload concurrently from multiple goroutines safely. -// -// // The session the S3 Uploader will use -// sess := session.Must(session.NewSession()) -// -// // Create an uploader with the session and default options -// uploader := s3manager.NewUploader(sess) -// -// f, err := os.Open(filename) -// if err != nil { -// return fmt.Errorf("failed to open file %q, %v", filename, err) -// } -// -// // Upload the file to S3. -// result, err := uploader.Upload(&s3manager.UploadInput{ -// Bucket: aws.String(myBucket), -// Key: aws.String(myString), -// Body: f, -// }) -// if err != nil { -// return fmt.Errorf("failed to upload file, %v", err) -// } -// fmt.Printf("file uploaded to, %s\n", aws.StringValue(result.Location)) -// -// See the s3manager package's Uploader type documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Uploader -// -// Download Manager -// -// The s3manager package's Downloader provides concurrently downloading of Objects -// from S3. The Downloader will write S3 Object content with an io.WriterAt. -// Once the Downloader instance is created you can call Download concurrently from -// multiple goroutines safely. -// -// // The session the S3 Downloader will use -// sess := session.Must(session.NewSession()) -// -// // Create a downloader with the session and default options -// downloader := s3manager.NewDownloader(sess) -// -// // Create a file to write the S3 Object contents to. -// f, err := os.Create(filename) -// if err != nil { -// return fmt.Errorf("failed to create file %q, %v", filename, err) -// } -// -// // Write the contents of S3 Object to the file -// n, err := downloader.Download(f, &s3.GetObjectInput{ -// Bucket: aws.String(myBucket), -// Key: aws.String(myString), -// }) -// if err != nil { -// return fmt.Errorf("failed to download file, %v", err) -// } -// fmt.Printf("file downloaded, %d bytes\n", n) -// -// See the s3manager package's Downloader type documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#Downloader -// -// Get Bucket Region -// -// GetBucketRegion will attempt to get the region for a bucket using a region -// hint to determine which AWS partition to perform the query on. Use this utility -// to determine the region a bucket is in. -// -// sess := session.Must(session.NewSession()) -// -// bucket := "my-bucket" -// region, err := s3manager.GetBucketRegion(ctx, sess, bucket, "us-west-2") -// if err != nil { -// if aerr, ok := err.(awserr.Error); ok && aerr.Code() == "NotFound" { -// fmt.Fprintf(os.Stderr, "unable to find bucket %s's region not found\n", bucket) -// } -// return err -// } -// fmt.Printf("Bucket %s is in %s region\n", bucket, region) -// -// See the s3manager package's GetBucketRegion function documentation for more information -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion -// -// S3 Crypto Client -// -// The s3crypto package provides the tools to upload and download encrypted -// content from S3. The Encryption and Decryption clients can be used concurrently -// once the client is created. -// -// sess := session.Must(session.NewSession()) -// -// // Create the decryption client. -// svc := s3crypto.NewDecryptionClient(sess) -// -// // The object will be downloaded from S3 and decrypted locally. By metadata -// // about the object's encryption will instruct the decryption client how -// // decrypt the content of the object. By default KMS is used for keys. -// result, err := svc.GetObject(&s3.GetObjectInput { -// Bucket: aws.String(myBucket), -// Key: aws.String(myKey), -// }) -// -// See the s3crypto package documentation for more information. -// https://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3crypto/ -// -package s3 diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go b/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go deleted file mode 100644 index 931cb17..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/errors.go +++ /dev/null @@ -1,48 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -const ( - - // ErrCodeBucketAlreadyExists for service response error code - // "BucketAlreadyExists". - // - // The requested bucket name is not available. The bucket namespace is shared - // by all users of the system. Please select a different name and try again. - ErrCodeBucketAlreadyExists = "BucketAlreadyExists" - - // ErrCodeBucketAlreadyOwnedByYou for service response error code - // "BucketAlreadyOwnedByYou". - ErrCodeBucketAlreadyOwnedByYou = "BucketAlreadyOwnedByYou" - - // ErrCodeNoSuchBucket for service response error code - // "NoSuchBucket". - // - // The specified bucket does not exist. - ErrCodeNoSuchBucket = "NoSuchBucket" - - // ErrCodeNoSuchKey for service response error code - // "NoSuchKey". - // - // The specified key does not exist. - ErrCodeNoSuchKey = "NoSuchKey" - - // ErrCodeNoSuchUpload for service response error code - // "NoSuchUpload". - // - // The specified multipart upload does not exist. - ErrCodeNoSuchUpload = "NoSuchUpload" - - // ErrCodeObjectAlreadyInActiveTierError for service response error code - // "ObjectAlreadyInActiveTierError". - // - // This operation is not allowed against this storage tier - ErrCodeObjectAlreadyInActiveTierError = "ObjectAlreadyInActiveTierError" - - // ErrCodeObjectNotInActiveTierError for service response error code - // "ObjectNotInActiveTierError". - // - // The source object of the COPY operation is not in the active tier and is - // only stored in Amazon Glacier. - ErrCodeObjectNotInActiveTierError = "ObjectNotInActiveTierError" -) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go deleted file mode 100644 index 18af38a..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/examples_test.go +++ /dev/null @@ -1,2223 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3_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/s3" -) - -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 abort a multipart upload -// -// The following example aborts a multipart upload. -func ExampleS3_AbortMultipartUpload_shared00() { - svc := s3.New(session.New()) - input := &s3.AbortMultipartUploadInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("bigobject"), - UploadId: aws.String("xadcOB_7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"), - } - - result, err := svc.AbortMultipartUpload(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchUpload: - fmt.Println(s3.ErrCodeNoSuchUpload, 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 complete multipart upload -// -// The following example completes a multipart upload. -func ExampleS3_CompleteMultipartUpload_shared00() { - svc := s3.New(session.New()) - input := &s3.CompleteMultipartUploadInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("bigobject"), - MultipartUpload: &s3.CompletedMultipartUpload{ - Parts: []*s3.CompletedPart{ - { - ETag: aws.String("\"d8c2eafd90c266e19ab9dcacc479f8af\""), - PartNumber: aws.Int64(1), - }, - { - ETag: aws.String("\"d8c2eafd90c266e19ab9dcacc479f8af\""), - PartNumber: aws.Int64(2), - }, - }, - }, - UploadId: aws.String("7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"), - } - - result, err := svc.CompleteMultipartUpload(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 copy an object -// -// The following example copies an object from one bucket to another. -func ExampleS3_CopyObject_shared00() { - svc := s3.New(session.New()) - input := &s3.CopyObjectInput{ - Bucket: aws.String("destinationbucket"), - CopySource: aws.String("/sourcebucket/HappyFacejpg"), - Key: aws.String("HappyFaceCopyjpg"), - } - - result, err := svc.CopyObject(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeObjectNotInActiveTierError: - fmt.Println(s3.ErrCodeObjectNotInActiveTierError, 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 create a bucket in a specific region -// -// The following example creates a bucket. The request specifies an AWS region where -// to create the bucket. -func ExampleS3_CreateBucket_shared00() { - svc := s3.New(session.New()) - input := &s3.CreateBucketInput{ - Bucket: aws.String("examplebucket"), - CreateBucketConfiguration: &s3.CreateBucketConfiguration{ - LocationConstraint: aws.String("eu-west-1"), - }, - } - - result, err := svc.CreateBucket(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeBucketAlreadyExists: - fmt.Println(s3.ErrCodeBucketAlreadyExists, aerr.Error()) - case s3.ErrCodeBucketAlreadyOwnedByYou: - fmt.Println(s3.ErrCodeBucketAlreadyOwnedByYou, 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 create a bucket -// -// The following example creates a bucket. -func ExampleS3_CreateBucket_shared01() { - svc := s3.New(session.New()) - input := &s3.CreateBucketInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.CreateBucket(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeBucketAlreadyExists: - fmt.Println(s3.ErrCodeBucketAlreadyExists, aerr.Error()) - case s3.ErrCodeBucketAlreadyOwnedByYou: - fmt.Println(s3.ErrCodeBucketAlreadyOwnedByYou, 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 initiate a multipart upload -// -// The following example initiates a multipart upload. -func ExampleS3_CreateMultipartUpload_shared00() { - svc := s3.New(session.New()) - input := &s3.CreateMultipartUploadInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("largeobject"), - } - - result, err := svc.CreateMultipartUpload(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 delete a bucket -// -// The following example deletes the specified bucket. -func ExampleS3_DeleteBucket_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketInput{ - Bucket: aws.String("forrandall2"), - } - - result, err := svc.DeleteBucket(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 delete cors configuration on a bucket. -// -// The following example deletes CORS configuration on a bucket. -func ExampleS3_DeleteBucketCors_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketCorsInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.DeleteBucketCors(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 delete lifecycle configuration on a bucket. -// -// The following example deletes lifecycle configuration on a bucket. -func ExampleS3_DeleteBucketLifecycle_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketLifecycleInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.DeleteBucketLifecycle(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 delete bucket policy -// -// The following example deletes bucket policy on the specified bucket. -func ExampleS3_DeleteBucketPolicy_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketPolicyInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.DeleteBucketPolicy(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 delete bucket replication configuration -// -// The following example deletes replication configuration set on bucket. -func ExampleS3_DeleteBucketReplication_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketReplicationInput{ - Bucket: aws.String("example"), - } - - result, err := svc.DeleteBucketReplication(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 delete bucket tags -// -// The following example deletes bucket tags. -func ExampleS3_DeleteBucketTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketTaggingInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.DeleteBucketTagging(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 delete bucket website configuration -// -// The following example deletes bucket website configuration. -func ExampleS3_DeleteBucketWebsite_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteBucketWebsiteInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.DeleteBucketWebsite(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 delete an object (from a non-versioned bucket) -// -// The following example deletes an object from a non-versioned bucket. -func ExampleS3_DeleteObject_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectInput{ - Bucket: aws.String("ExampleBucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.DeleteObject(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 delete an object -// -// The following example deletes an object from an S3 bucket. -func ExampleS3_DeleteObject_shared01() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("objectkey.jpg"), - } - - result, err := svc.DeleteObject(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 remove tag set from an object version -// -// The following example removes tag set associated with the specified object version. -// The request specifies both the object key and object version. -func ExampleS3_DeleteObjectTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectTaggingInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"), - } - - result, err := svc.DeleteObjectTagging(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 remove tag set from an object -// -// The following example removes tag set associated with the specified object. If the -// bucket is versioning enabled, the operation removes tag set from the latest object -// version. -func ExampleS3_DeleteObjectTagging_shared01() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectTaggingInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.DeleteObjectTagging(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 delete multiple object versions from a versioned bucket -// -// The following example deletes objects from a bucket. The request specifies object -// versions. S3 deletes specific object versions and returns the key and versions of -// deleted objects in the response. -func ExampleS3_DeleteObjects_shared00() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectsInput{ - Bucket: aws.String("examplebucket"), - Delete: &s3.Delete{ - Objects: []*s3.ObjectIdentifier{ - { - Key: aws.String("HappyFace.jpg"), - VersionId: aws.String("2LWg7lQLnY41.maGB5Z6SWW.dcq0vx7b"), - }, - { - Key: aws.String("HappyFace.jpg"), - VersionId: aws.String("yoz3HB.ZhCS_tKVEmIOr7qYyyAaZSKVd"), - }, - }, - Quiet: aws.Bool(false), - }, - } - - result, err := svc.DeleteObjects(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 delete multiple objects from a versioned bucket -// -// The following example deletes objects from a bucket. The bucket is versioned, and -// the request does not specify the object version to delete. In this case, all versions -// remain in the bucket and S3 adds a delete marker. -func ExampleS3_DeleteObjects_shared01() { - svc := s3.New(session.New()) - input := &s3.DeleteObjectsInput{ - Bucket: aws.String("examplebucket"), - Delete: &s3.Delete{ - Objects: []*s3.ObjectIdentifier{ - { - Key: aws.String("objectkey1"), - }, - { - Key: aws.String("objectkey2"), - }, - }, - Quiet: aws.Bool(false), - }, - } - - result, err := svc.DeleteObjects(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 cors configuration set on a bucket -// -// The following example returns cross-origin resource sharing (CORS) configuration -// set on a bucket. -func ExampleS3_GetBucketCors_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketCorsInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketCors(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 a bucket acl -// -// The following example gets ACL on the specified bucket. -func ExampleS3_GetBucketLifecycle_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketLifecycleInput{ - Bucket: aws.String("acl1"), - } - - result, err := svc.GetBucketLifecycle(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 lifecycle configuration on a bucket -// -// The following example retrieves lifecycle configuration on set on a bucket. -func ExampleS3_GetBucketLifecycleConfiguration_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketLifecycleConfigurationInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketLifecycleConfiguration(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 bucket location -// -// The following example returns bucket location. -func ExampleS3_GetBucketLocation_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketLocationInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketLocation(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 notification configuration set on a bucket -// -// The following example returns notification configuration set on a bucket. -func ExampleS3_GetBucketNotification_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketNotificationConfigurationRequest{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketNotification(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 notification configuration set on a bucket -// -// The following example returns notification configuration set on a bucket. -func ExampleS3_GetBucketNotification_shared01() { - svc := s3.New(session.New()) - input := &s3.GetBucketNotificationConfigurationRequest{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketNotification(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 bucket policy -// -// The following example returns bucket policy associated with a bucket. -func ExampleS3_GetBucketPolicy_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketPolicyInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketPolicy(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 replication configuration set on a bucket -// -// The following example returns replication configuration set on a bucket. -func ExampleS3_GetBucketReplication_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketReplicationInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketReplication(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 bucket versioning configuration -// -// The following example retrieves bucket versioning configuration. -func ExampleS3_GetBucketRequestPayment_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketRequestPaymentInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketRequestPayment(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 tag set associated with a bucket -// -// The following example returns tag set associated with a bucket -func ExampleS3_GetBucketTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketTaggingInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketTagging(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 bucket versioning configuration -// -// The following example retrieves bucket versioning configuration. -func ExampleS3_GetBucketVersioning_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketVersioningInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketVersioning(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 bucket website configuration -// -// The following example retrieves website configuration of a bucket. -func ExampleS3_GetBucketWebsite_shared00() { - svc := s3.New(session.New()) - input := &s3.GetBucketWebsiteInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.GetBucketWebsite(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 retrieve an object -// -// The following example retrieves an object for an S3 bucket. -func ExampleS3_GetObject_shared00() { - svc := s3.New(session.New()) - input := &s3.GetObjectInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.GetObject(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchKey: - fmt.Println(s3.ErrCodeNoSuchKey, 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 retrieve a byte range of an object -// -// The following example retrieves an object for an S3 bucket. The request specifies -// the range header to retrieve a specific byte range. -func ExampleS3_GetObject_shared01() { - svc := s3.New(session.New()) - input := &s3.GetObjectInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("SampleFile.txt"), - Range: aws.String("bytes=0-9"), - } - - result, err := svc.GetObject(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchKey: - fmt.Println(s3.ErrCodeNoSuchKey, 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 retrieve object ACL -// -// The following example retrieves access control list (ACL) of an object. -func ExampleS3_GetObjectAcl_shared00() { - svc := s3.New(session.New()) - input := &s3.GetObjectAclInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.GetObjectAcl(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchKey: - fmt.Println(s3.ErrCodeNoSuchKey, 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 retrieve tag set of an object -// -// The following example retrieves tag set of an object. -func ExampleS3_GetObjectTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.GetObjectTaggingInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.GetObjectTagging(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 retrieve tag set of a specific object version -// -// The following example retrieves tag set of an object. The request specifies object -// version. -func ExampleS3_GetObjectTagging_shared01() { - svc := s3.New(session.New()) - input := &s3.GetObjectTaggingInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("exampleobject"), - VersionId: aws.String("ydlaNkwWm0SfKJR.T1b1fIdPRbldTYRI"), - } - - result, err := svc.GetObjectTagging(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 retrieve torrent files for an object -// -// The following example retrieves torrent files of an object. -func ExampleS3_GetObjectTorrent_shared00() { - svc := s3.New(session.New()) - input := &s3.GetObjectTorrentInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.GetObjectTorrent(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 determine if bucket exists -// -// This operation checks to see if a bucket exists. -func ExampleS3_HeadBucket_shared00() { - svc := s3.New(session.New()) - input := &s3.HeadBucketInput{ - Bucket: aws.String("acl1"), - } - - result, err := svc.HeadBucket(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchBucket: - fmt.Println(s3.ErrCodeNoSuchBucket, 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 retrieve metadata of an object without returning the object itself -// -// The following example retrieves an object metadata. -func ExampleS3_HeadObject_shared00() { - svc := s3.New(session.New()) - input := &s3.HeadObjectInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.HeadObject(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 list object versions -// -// The following example return versions of an object with specific key name prefix. -// The request limits the number of items returned to two. If there are are more than -// two object version, S3 returns NextToken in the response. You can specify this token -// value in your next request to fetch next set of object versions. -func ExampleS3_ListBuckets_shared00() { - svc := s3.New(session.New()) - input := &s3.ListBucketsInput{} - - result, err := svc.ListBuckets(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 list in-progress multipart uploads on a bucket -// -// The following example lists in-progress multipart uploads on a specific bucket. -func ExampleS3_ListMultipartUploads_shared00() { - svc := s3.New(session.New()) - input := &s3.ListMultipartUploadsInput{ - Bucket: aws.String("examplebucket"), - } - - result, err := svc.ListMultipartUploads(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) -} - -// List next set of multipart uploads when previous result is truncated -// -// The following example specifies the upload-id-marker and key-marker from previous -// truncated response to retrieve next setup of multipart uploads. -func ExampleS3_ListMultipartUploads_shared01() { - svc := s3.New(session.New()) - input := &s3.ListMultipartUploadsInput{ - Bucket: aws.String("examplebucket"), - KeyMarker: aws.String("nextkeyfrompreviousresponse"), - MaxUploads: aws.Int64(2), - UploadIdMarker: aws.String("valuefrompreviousresponse"), - } - - result, err := svc.ListMultipartUploads(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 list object versions -// -// The following example return versions of an object with specific key name prefix. -// The request limits the number of items returned to two. If there are are more than -// two object version, S3 returns NextToken in the response. You can specify this token -// value in your next request to fetch next set of object versions. -func ExampleS3_ListObjectVersions_shared00() { - svc := s3.New(session.New()) - input := &s3.ListObjectVersionsInput{ - Bucket: aws.String("examplebucket"), - Prefix: aws.String("HappyFace.jpg"), - } - - result, err := svc.ListObjectVersions(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 list objects in a bucket -// -// The following example list two objects in a bucket. -func ExampleS3_ListObjects_shared00() { - svc := s3.New(session.New()) - input := &s3.ListObjectsInput{ - Bucket: aws.String("examplebucket"), - MaxKeys: aws.Int64(2), - } - - result, err := svc.ListObjects(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchBucket: - fmt.Println(s3.ErrCodeNoSuchBucket, 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 object list -// -// The following example retrieves object list. The request specifies max keys to limit -// response to include only 2 object keys. -func ExampleS3_ListObjectsV2_shared00() { - svc := s3.New(session.New()) - input := &s3.ListObjectsV2Input{ - Bucket: aws.String("examplebucket"), - MaxKeys: aws.Int64(2), - } - - result, err := svc.ListObjectsV2(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchBucket: - fmt.Println(s3.ErrCodeNoSuchBucket, 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 list parts of a multipart upload. -// -// The following example lists parts uploaded for a specific multipart upload. -func ExampleS3_ListParts_shared00() { - svc := s3.New(session.New()) - input := &s3.ListPartsInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("bigobject"), - UploadId: aws.String("example7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"), - } - - result, err := svc.ListParts(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) -} - -// Put bucket acl -// -// The following example replaces existing ACL on a bucket. The ACL grants the bucket -// owner (specified using the owner ID) and write permission to the LogDelivery group. -// Because this is a replace operation, you must specify all the grants in your request. -// To incrementally add or remove ACL grants, you might use the console. -func ExampleS3_PutBucketAcl_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketAclInput{ - Bucket: aws.String("examplebucket"), - GrantFullControl: aws.String("id=examplee7a2f25102679df27bb0ae12b3f85be6f290b936c4393484"), - GrantWrite: aws.String("uri=http://acs.amazonaws.com/groups/s3/LogDelivery"), - } - - result, err := svc.PutBucketAcl(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 set cors configuration on a bucket. -// -// The following example enables PUT, POST, and DELETE requests from www.example.com, -// and enables GET requests from any domain. -func ExampleS3_PutBucketCors_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketCorsInput{ - Bucket: aws.String(""), - CORSConfiguration: &s3.CORSConfiguration{ - CORSRules: []*s3.CORSRule{ - { - AllowedHeaders: []*string{ - aws.String("*"), - }, - AllowedMethods: []*string{ - aws.String("PUT"), - aws.String("POST"), - aws.String("DELETE"), - }, - AllowedOrigins: []*string{ - aws.String("http://www.example.com"), - }, - ExposeHeaders: []*string{ - aws.String("x-amz-server-side-encryption"), - }, - MaxAgeSeconds: aws.Int64(3000), - }, - { - AllowedHeaders: []*string{ - aws.String("Authorization"), - }, - AllowedMethods: []*string{ - aws.String("GET"), - }, - AllowedOrigins: []*string{ - aws.String("*"), - }, - MaxAgeSeconds: aws.Int64(3000), - }, - }, - }, - } - - result, err := svc.PutBucketCors(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) -} - -// Put bucket lifecycle -// -// The following example replaces existing lifecycle configuration, if any, on the specified -// bucket. -func ExampleS3_PutBucketLifecycleConfiguration_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketLifecycleConfigurationInput{ - Bucket: aws.String("examplebucket"), - LifecycleConfiguration: &s3.BucketLifecycleConfiguration{ - Rules: []*s3.LifecycleRule{ - { - ID: aws.String("TestOnly"), - Status: aws.String("Enabled"), - Transitions: []*s3.Transition{ - { - Days: aws.Int64(365), - StorageClass: aws.String("GLACIER"), - }, - }, - }, - }, - }, - } - - result, err := svc.PutBucketLifecycleConfiguration(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) -} - -// Set logging configuration for a bucket -// -// The following example sets logging policy on a bucket. For the Log Delivery group -// to deliver logs to the destination bucket, it needs permission for the READ_ACP action -// which the policy grants. -func ExampleS3_PutBucketLogging_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketLoggingInput{ - Bucket: aws.String("sourcebucket"), - BucketLoggingStatus: &s3.BucketLoggingStatus{ - LoggingEnabled: &s3.LoggingEnabled{ - TargetBucket: aws.String("targetbucket"), - TargetGrants: []*s3.TargetGrant{ - { - Permission: aws.String("READ"), - }, - }, - TargetPrefix: aws.String("MyBucketLogs/"), - }, - }, - } - - result, err := svc.PutBucketLogging(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) -} - -// Set notification configuration for a bucket -// -// The following example sets notification configuration on a bucket to publish the -// object created events to an SNS topic. -func ExampleS3_PutBucketNotificationConfiguration_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketNotificationConfigurationInput{ - Bucket: aws.String("examplebucket"), - NotificationConfiguration: &s3.NotificationConfiguration{ - TopicConfigurations: []*s3.TopicConfiguration{ - { - Events: []*string{ - aws.String("s3:ObjectCreated:*"), - }, - TopicArn: aws.String("arn:aws:sns:us-west-2:123456789012:s3-notification-topic"), - }, - }, - }, - } - - result, err := svc.PutBucketNotificationConfiguration(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) -} - -// Set bucket policy -// -// The following example sets a permission policy on a bucket. -func ExampleS3_PutBucketPolicy_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketPolicyInput{ - Bucket: aws.String("examplebucket"), - Policy: aws.String("{\"Version\": \"2012-10-17\", \"Statement\": [{ \"Sid\": \"id-1\",\"Effect\": \"Allow\",\"Principal\": {\"AWS\": \"arn:aws:iam::123456789012:root\"}, \"Action\": [ \"s3:PutObject\",\"s3:PutObjectAcl\"], \"Resource\": [\"arn:aws:s3:::acl3/*\" ] } ]}"), - } - - result, err := svc.PutBucketPolicy(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) -} - -// Set replication configuration on a bucket -// -// The following example sets replication configuration on a bucket. -func ExampleS3_PutBucketReplication_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketReplicationInput{ - Bucket: aws.String("examplebucket"), - ReplicationConfiguration: &s3.ReplicationConfiguration{ - Role: aws.String("arn:aws:iam::123456789012:role/examplerole"), - Rules: []*s3.ReplicationRule{ - { - Prefix: aws.String(""), - Status: aws.String("Enabled"), - }, - }, - }, - } - - result, err := svc.PutBucketReplication(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) -} - -// Set request payment configuration on a bucket. -// -// The following example sets request payment configuration on a bucket so that person -// requesting the download is charged. -func ExampleS3_PutBucketRequestPayment_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketRequestPaymentInput{ - Bucket: aws.String("examplebucket"), - RequestPaymentConfiguration: &s3.RequestPaymentConfiguration{ - Payer: aws.String("Requester"), - }, - } - - result, err := svc.PutBucketRequestPayment(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) -} - -// Set tags on a bucket -// -// The following example sets tags on a bucket. Any existing tags are replaced. -func ExampleS3_PutBucketTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketTaggingInput{ - Bucket: aws.String("examplebucket"), - Tagging: &s3.Tagging{ - TagSet: []*s3.Tag{ - { - Key: aws.String("Key1"), - Value: aws.String("Value1"), - }, - { - Key: aws.String("Key2"), - Value: aws.String("Value2"), - }, - }, - }, - } - - result, err := svc.PutBucketTagging(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) -} - -// Set versioning configuration on a bucket -// -// The following example sets versioning configuration on bucket. The configuration -// enables versioning on the bucket. -func ExampleS3_PutBucketVersioning_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketVersioningInput{ - Bucket: aws.String("examplebucket"), - VersioningConfiguration: &s3.VersioningConfiguration{ - MFADelete: aws.String("Disabled"), - Status: aws.String("Enabled"), - }, - } - - result, err := svc.PutBucketVersioning(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) -} - -// Set website configuration on a bucket -// -// The following example adds website configuration to a bucket. -func ExampleS3_PutBucketWebsite_shared00() { - svc := s3.New(session.New()) - input := &s3.PutBucketWebsiteInput{ - Bucket: aws.String("examplebucket"), - WebsiteConfiguration: &s3.WebsiteConfiguration{ - ErrorDocument: &s3.ErrorDocument{ - Key: aws.String("error.html"), - }, - IndexDocument: &s3.IndexDocument{ - Suffix: aws.String("index.html"), - }, - }, - } - - result, err := svc.PutBucketWebsite(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 upload an object and specify server-side encryption and object tags -// -// The following example uploads and object. The request specifies the optional server-side -// encryption option. The request also specifies optional object tags. If the bucket -// is versioning enabled, S3 returns version ID in response. -func ExampleS3_PutObject_shared00() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")), - Bucket: aws.String("examplebucket"), - Key: aws.String("exampleobject"), - ServerSideEncryption: aws.String("AES256"), - Tagging: aws.String("key1=value1&key2=value2"), - } - - result, err := svc.PutObject(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 upload an object and specify canned ACL. -// -// The following example uploads and object. The request specifies optional canned ACL -// (access control list) to all READ access to authenticated users. If the bucket is -// versioning enabled, S3 returns version ID in response. -func ExampleS3_PutObject_shared01() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - ACL: aws.String("authenticated-read"), - Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")), - Bucket: aws.String("examplebucket"), - Key: aws.String("exampleobject"), - } - - result, err := svc.PutObject(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 upload an object -// -// The following example uploads an object to a versioning-enabled bucket. The source -// file is specified using Windows file syntax. S3 returns VersionId of the newly created -// object. -func ExampleS3_PutObject_shared02() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")), - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.PutObject(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 create an object. -// -// The following example creates an object. If the bucket is versioning enabled, S3 -// returns version ID in response. -func ExampleS3_PutObject_shared03() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")), - Bucket: aws.String("examplebucket"), - Key: aws.String("objectkey"), - } - - result, err := svc.PutObject(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 upload an object and specify optional tags -// -// The following example uploads an object. The request specifies optional object tags. -// The bucket is versioned, therefore S3 returns version ID of the newly created object. -func ExampleS3_PutObject_shared04() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("c:\\HappyFace.jpg")), - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - Tagging: aws.String("key1=value1&key2=value2"), - } - - result, err := svc.PutObject(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 upload object and specify user-defined metadata -// -// The following example creates an object. The request also specifies optional metadata. -// If the bucket is versioning enabled, S3 returns version ID in response. -func ExampleS3_PutObject_shared05() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("filetoupload")), - Bucket: aws.String("examplebucket"), - Key: aws.String("exampleobject"), - Metadata: map[string]*string{ - "metadata1": aws.String("value1"), - "metadata2": aws.String("value2"), - }, - } - - result, err := svc.PutObject(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 upload an object (specify optional headers) -// -// The following example uploads an object. The request specifies optional request headers -// to directs S3 to use specific storage class and use server-side encryption. -func ExampleS3_PutObject_shared06() { - svc := s3.New(session.New()) - input := &s3.PutObjectInput{ - Body: aws.ReadSeekCloser(strings.NewReader("HappyFace.jpg")), - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - ServerSideEncryption: aws.String("AES256"), - StorageClass: aws.String("STANDARD_IA"), - } - - result, err := svc.PutObject(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 grant permissions using object ACL -// -// The following example adds grants to an object ACL. The first permission grants user1 -// and user2 FULL_CONTROL and the AllUsers group READ permission. -func ExampleS3_PutObjectAcl_shared00() { - svc := s3.New(session.New()) - input := &s3.PutObjectAclInput{ - AccessControlPolicy: &s3.AccessControlPolicy{}, - Bucket: aws.String("examplebucket"), - GrantFullControl: aws.String("emailaddress=user1@example.com,emailaddress=user2@example.com"), - GrantRead: aws.String("uri=http://acs.amazonaws.com/groups/global/AllUsers"), - Key: aws.String("HappyFace.jpg"), - } - - result, err := svc.PutObjectAcl(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeNoSuchKey: - fmt.Println(s3.ErrCodeNoSuchKey, 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 add tags to an existing object -// -// The following example adds tags to an existing object. -func ExampleS3_PutObjectTagging_shared00() { - svc := s3.New(session.New()) - input := &s3.PutObjectTaggingInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("HappyFace.jpg"), - Tagging: &s3.Tagging{ - TagSet: []*s3.Tag{ - { - Key: aws.String("Key3"), - Value: aws.String("Value3"), - }, - { - Key: aws.String("Key4"), - Value: aws.String("Value4"), - }, - }, - }, - } - - result, err := svc.PutObjectTagging(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 restore an archived object -// -// The following example restores for one day an archived copy of an object back into -// Amazon S3 bucket. -func ExampleS3_RestoreObject_shared00() { - svc := s3.New(session.New()) - input := &s3.RestoreObjectInput{ - Bucket: aws.String("examplebucket"), - Key: aws.String("archivedobjectkey"), - RestoreRequest: &s3.RestoreRequest{ - Days: aws.Int64(1), - GlacierJobParameters: &s3.GlacierJobParameters{ - Tier: aws.String("Expedited"), - }, - }, - } - - result, err := svc.RestoreObject(input) - if err != nil { - if aerr, ok := err.(awserr.Error); ok { - switch aerr.Code() { - case s3.ErrCodeObjectAlreadyInActiveTierError: - fmt.Println(s3.ErrCodeObjectAlreadyInActiveTierError, 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 upload a part -// -// The following example uploads part 1 of a multipart upload. The example specifies -// a file name for the part data. The Upload ID is same that is returned by the initiate -// multipart upload. -func ExampleS3_UploadPart_shared00() { - svc := s3.New(session.New()) - input := &s3.UploadPartInput{ - Body: aws.ReadSeekCloser(strings.NewReader("fileToUpload")), - Bucket: aws.String("examplebucket"), - Key: aws.String("examplelargeobject"), - PartNumber: aws.Int64(1), - UploadId: aws.String("xadcOB_7YPBOJuoFiQ9cz4P3Pe6FIZwO4f7wN93uHsNBEw97pl5eNwzExg0LAT2dUN91cOmrEQHDsP3WA60CEg--"), - } - - result, err := svc.UploadPart(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 upload a part by copying byte range from an existing object as data source -// -// The following example uploads a part of a multipart upload by copying a specified -// byte range from an existing object as data source. -func ExampleS3_UploadPartCopy_shared00() { - svc := s3.New(session.New()) - input := &s3.UploadPartCopyInput{ - Bucket: aws.String("examplebucket"), - CopySource: aws.String("/bucketname/sourceobjectkey"), - CopySourceRange: aws.String("bytes=1-100000"), - Key: aws.String("examplelargeobject"), - PartNumber: aws.Int64(2), - UploadId: aws.String("exampleuoh_10OhKhT7YukE9bjzTPRiuaCotmZM_pFngJFir9OZNrSr5cWa3cq3LZSUsfjI4FI7PkP91We7Nrw--"), - } - - result, err := svc.UploadPartCopy(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 upload a part by copying data from an existing object as data source -// -// The following example uploads a part of a multipart upload by copying data from an -// existing object as data source. -func ExampleS3_UploadPartCopy_shared01() { - svc := s3.New(session.New()) - input := &s3.UploadPartCopyInput{ - Bucket: aws.String("examplebucket"), - CopySource: aws.String("/bucketname/sourceobjectkey"), - Key: aws.String("examplelargeobject"), - PartNumber: aws.Int64(1), - UploadId: aws.String("exampleuoh_10OhKhT7YukE9bjzTPRiuaCotmZM_pFngJFir9OZNrSr5cWa3cq3LZSUsfjI4FI7PkP91We7Nrw--"), - } - - result, err := svc.UploadPartCopy(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) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go deleted file mode 100644 index a7fbc2d..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket.go +++ /dev/null @@ -1,155 +0,0 @@ -package s3 - -import ( - "fmt" - "net/url" - "regexp" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -// an operationBlacklist is a list of operation names that should a -// request handler should not be executed with. -type operationBlacklist []string - -// Continue will return true of the Request's operation name is not -// in the blacklist. False otherwise. -func (b operationBlacklist) Continue(r *request.Request) bool { - for i := 0; i < len(b); i++ { - if b[i] == r.Operation.Name { - return false - } - } - return true -} - -var accelerateOpBlacklist = operationBlacklist{ - opListBuckets, opCreateBucket, opDeleteBucket, -} - -// Request handler to automatically add the bucket name to the endpoint domain -// if possible. This style of bucket is valid for all bucket names which are -// DNS compatible and do not contain "." -func updateEndpointForS3Config(r *request.Request) { - forceHostStyle := aws.BoolValue(r.Config.S3ForcePathStyle) - accelerate := aws.BoolValue(r.Config.S3UseAccelerate) - - if accelerate && accelerateOpBlacklist.Continue(r) { - if forceHostStyle { - if r.Config.Logger != nil { - r.Config.Logger.Log("ERROR: aws.Config.S3UseAccelerate is not compatible with aws.Config.S3ForcePathStyle, ignoring S3ForcePathStyle.") - } - } - updateEndpointForAccelerate(r) - } else if !forceHostStyle && r.Operation.Name != opGetBucketLocation { - updateEndpointForHostStyle(r) - } -} - -func updateEndpointForHostStyle(r *request.Request) { - bucket, ok := bucketNameFromReqParams(r.Params) - if !ok { - // Ignore operation requests if the bucketname was not provided - // if this is an input validation error the validation handler - // will report it. - return - } - - if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { - // bucket name must be valid to put into the host - return - } - - moveBucketToHost(r.HTTPRequest.URL, bucket) -} - -var ( - accelElem = []byte("s3-accelerate.dualstack.") -) - -func updateEndpointForAccelerate(r *request.Request) { - bucket, ok := bucketNameFromReqParams(r.Params) - if !ok { - // Ignore operation requests if the bucketname was not provided - // if this is an input validation error the validation handler - // will report it. - return - } - - if !hostCompatibleBucketName(r.HTTPRequest.URL, bucket) { - r.Error = awserr.New("InvalidParameterException", - fmt.Sprintf("bucket name %s is not compatible with S3 Accelerate", bucket), - nil) - return - } - - parts := strings.Split(r.HTTPRequest.URL.Host, ".") - if len(parts) < 3 { - r.Error = awserr.New("InvalidParameterExecption", - fmt.Sprintf("unable to update endpoint host for S3 accelerate, hostname invalid, %s", - r.HTTPRequest.URL.Host), nil) - return - } - - if parts[0] == "s3" || strings.HasPrefix(parts[0], "s3-") { - parts[0] = "s3-accelerate" - } - for i := 1; i+1 < len(parts); i++ { - if parts[i] == aws.StringValue(r.Config.Region) { - parts = append(parts[:i], parts[i+1:]...) - break - } - } - - r.HTTPRequest.URL.Host = strings.Join(parts, ".") - - moveBucketToHost(r.HTTPRequest.URL, bucket) -} - -// Attempts to retrieve the bucket name from the request input parameters. -// If no bucket is found, or the field is empty "", false will be returned. -func bucketNameFromReqParams(params interface{}) (string, bool) { - if iface, ok := params.(bucketGetter); ok { - b := iface.getBucket() - return b, len(b) > 0 - } - - return "", false -} - -// hostCompatibleBucketName returns true if the request should -// put the bucket in the host. This is false if S3ForcePathStyle is -// explicitly set or if the bucket is not DNS compatible. -func hostCompatibleBucketName(u *url.URL, bucket string) bool { - // Bucket might be DNS compatible but dots in the hostname will fail - // certificate validation, so do not use host-style. - if u.Scheme == "https" && strings.Contains(bucket, ".") { - return false - } - - // if the bucket is DNS compatible - return dnsCompatibleBucketName(bucket) -} - -var reDomain = regexp.MustCompile(`^[a-z0-9][a-z0-9\.\-]{1,61}[a-z0-9]$`) -var reIPAddress = regexp.MustCompile(`^(\d+\.){3}\d+$`) - -// dnsCompatibleBucketName returns true if the bucket name is DNS compatible. -// Buckets created outside of the classic region MUST be DNS compatible. -func dnsCompatibleBucketName(bucket string) bool { - return reDomain.MatchString(bucket) && - !reIPAddress.MatchString(bucket) && - !strings.Contains(bucket, "..") -} - -// moveBucketToHost moves the bucket name from the URI path to URL host. -func moveBucketToHost(u *url.URL, bucket string) { - u.Host = bucket + "." + u.Host - u.Path = strings.Replace(u.Path, "/{Bucket}", "", -1) - if u.Path == "" { - u.Path = "/" - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go deleted file mode 100644 index 094fa65..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/host_style_bucket_test.go +++ /dev/null @@ -1,127 +0,0 @@ -package s3_test - -import ( - "net/url" - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -type s3BucketTest struct { - bucket string - url string - errCode string -} - -var ( - sslTests = []s3BucketTest{ - {"abc", "https://abc.s3.mock-region.amazonaws.com/", ""}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c", ""}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c", ""}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc", ""}, - } - - nosslTests = []s3BucketTest{ - {"a.b.c", "http://a.b.c.s3.mock-region.amazonaws.com/", ""}, - {"a..bc", "http://s3.mock-region.amazonaws.com/a..bc", ""}, - } - - forcepathTests = []s3BucketTest{ - {"abc", "https://s3.mock-region.amazonaws.com/abc", ""}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/a%24b%24c", ""}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/a.b.c", ""}, - {"a..bc", "https://s3.mock-region.amazonaws.com/a..bc", ""}, - } - - accelerateTests = []s3BucketTest{ - {"abc", "https://abc.s3-accelerate.amazonaws.com/", ""}, - {"a.b.c", "https://s3.mock-region.amazonaws.com/%7BBucket%7D", "InvalidParameterException"}, - {"a$b$c", "https://s3.mock-region.amazonaws.com/%7BBucket%7D", "InvalidParameterException"}, - } - - accelerateNoSSLTests = []s3BucketTest{ - {"abc", "http://abc.s3-accelerate.amazonaws.com/", ""}, - {"a.b.c", "http://a.b.c.s3-accelerate.amazonaws.com/", ""}, - {"a$b$c", "http://s3.mock-region.amazonaws.com/%7BBucket%7D", "InvalidParameterException"}, - } - - accelerateDualstack = []s3BucketTest{ - {"abc", "https://abc.s3-accelerate.dualstack.amazonaws.com/", ""}, - {"a.b.c", "https://s3.dualstack.mock-region.amazonaws.com/%7BBucket%7D", "InvalidParameterException"}, - {"a$b$c", "https://s3.dualstack.mock-region.amazonaws.com/%7BBucket%7D", "InvalidParameterException"}, - } -) - -func runTests(t *testing.T, svc *s3.S3, tests []s3BucketTest) { - for i, test := range tests { - req, _ := svc.ListObjectsRequest(&s3.ListObjectsInput{Bucket: &test.bucket}) - req.Build() - if e, a := test.url, req.HTTPRequest.URL.String(); e != a { - t.Errorf("%d, expect url %s, got %s", i, e, a) - } - if test.errCode != "" { - if err := req.Error; err == nil { - t.Fatalf("%d, expect no error", i) - } - if a, e := req.Error.(awserr.Error).Code(), test.errCode; !strings.Contains(a, e) { - t.Errorf("%d, expect error code to contain %q, got %q", i, e, a) - } - } - } -} - -func TestAccelerateBucketBuild(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{S3UseAccelerate: aws.Bool(true)}) - runTests(t, s, accelerateTests) -} - -func TestAccelerateNoSSLBucketBuild(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{S3UseAccelerate: aws.Bool(true), DisableSSL: aws.Bool(true)}) - runTests(t, s, accelerateNoSSLTests) -} - -func TestAccelerateDualstackBucketBuild(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{ - S3UseAccelerate: aws.Bool(true), - UseDualStack: aws.Bool(true), - }) - runTests(t, s, accelerateDualstack) -} - -func TestHostStyleBucketBuild(t *testing.T) { - s := s3.New(unit.Session) - runTests(t, s, sslTests) -} - -func TestHostStyleBucketBuildNoSSL(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - runTests(t, s, nosslTests) -} - -func TestPathStyleBucketBuild(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{S3ForcePathStyle: aws.Bool(true)}) - runTests(t, s, forcepathTests) -} - -func TestHostStyleBucketGetBucketLocation(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.GetBucketLocationRequest(&s3.GetBucketLocationInput{ - Bucket: aws.String("bucket"), - }) - - req.Build() - if req.Error != nil { - t.Fatalf("expect no error, got %v", req.Error) - } - u, _ := url.Parse(req.HTTPRequest.URL.String()) - if e, a := "bucket", u.Host; strings.Contains(a, e) { - t.Errorf("expect %s to not be in %s", e, a) - } - if e, a := "bucket", u.Path; !strings.Contains(a, e) { - t.Errorf("expect %s to be in %s", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go deleted file mode 100644 index 8e6f330..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers.go +++ /dev/null @@ -1,8 +0,0 @@ -// +build !go1.6 - -package s3 - -import "github.com/aws/aws-sdk-go/aws/request" - -func platformRequestHandlers(r *request.Request) { -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go deleted file mode 100644 index 14d05f7..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build go1.6 - -package s3 - -import ( - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -func platformRequestHandlers(r *request.Request) { - if r.Operation.HTTPMethod == "PUT" { - // 100-Continue should only be used on put requests. - r.Handlers.Sign.PushBack(add100Continue) - } -} - -func add100Continue(r *request.Request) { - if aws.BoolValue(r.Config.S3Disable100Continue) { - return - } - if r.HTTPRequest.ContentLength < 1024*1024*2 { - // Ignore requests smaller than 2MB. This helps prevent delaying - // requests unnecessarily. - return - } - - r.HTTPRequest.Header.Set("Expect", "100-Continue") -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6_test.go deleted file mode 100644 index 0675537..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/platform_handlers_go1.6_test.go +++ /dev/null @@ -1,83 +0,0 @@ -// +build go1.6 - -package s3_test - -import ( - "bytes" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestAdd100Continue_Added(t *testing.T) { - svc := s3.New(unit.Session) - r, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("dest"), - Body: bytes.NewReader(make([]byte, 1024*1024*5)), - }) - - err := r.Sign() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := "100-Continue", r.HTTPRequest.Header.Get("Expect"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestAdd100Continue_SkipDisabled(t *testing.T) { - svc := s3.New(unit.Session, aws.NewConfig().WithS3Disable100Continue(true)) - r, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("dest"), - Body: bytes.NewReader(make([]byte, 1024*1024*5)), - }) - - err := r.Sign() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if r.HTTPRequest.Header.Get("Expect") != "" { - t.Errorf("expected empty value, but received %s", r.HTTPRequest.Header.Get("Expect")) - } -} - -func TestAdd100Continue_SkipNonPUT(t *testing.T) { - svc := s3.New(unit.Session) - r, _ := svc.GetObjectRequest(&s3.GetObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("dest"), - }) - - err := r.Sign() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if r.HTTPRequest.Header.Get("Expect") != "" { - t.Errorf("expected empty value, but received %s", r.HTTPRequest.Header.Get("Expect")) - } -} - -func TestAdd100Continue_SkipTooSmall(t *testing.T) { - svc := s3.New(unit.Session) - r, _ := svc.PutObjectRequest(&s3.PutObjectInput{ - Bucket: aws.String("bucket"), - Key: aws.String("dest"), - Body: bytes.NewReader(make([]byte, 1024*1024*1)), - }) - - err := r.Sign() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if r.HTTPRequest.Header.Get("Expect") != "" { - t.Errorf("expected empty value, but received %s", r.HTTPRequest.Header.Get("Expect")) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go b/vendor/github.com/aws/aws-sdk-go/service/s3/service.go deleted file mode 100644 index 614e477..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/service.go +++ /dev/null @@ -1,93 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -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/restxml" -) - -// S3 provides the API operation methods for making requests to -// Amazon Simple Storage Service. See this package's package overview docs -// for details on the service. -// -// S3 methods are safe to use concurrently. It is not safe to -// modify mutate any of the struct's properties though. -type S3 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 = "s3" // Service endpoint prefix API calls made to. - EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. -) - -// New creates a new instance of the S3 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 S3 client from just a session. -// svc := s3.New(mySession) -// -// // Create a S3 client with additional configuration -// svc := s3.New(mySession, aws.NewConfig().WithRegion("us-west-2")) -func New(p client.ConfigProvider, cfgs ...*aws.Config) *S3 { - 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) *S3 { - svc := &S3{ - Client: client.New( - cfg, - metadata.ClientInfo{ - ServiceName: ServiceName, - SigningName: signingName, - SigningRegion: signingRegion, - Endpoint: endpoint, - APIVersion: "2006-03-01", - }, - handlers, - ), - } - - // Handlers - svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) - svc.Handlers.Build.PushBackNamed(restxml.BuildHandler) - svc.Handlers.Unmarshal.PushBackNamed(restxml.UnmarshalHandler) - svc.Handlers.UnmarshalMeta.PushBackNamed(restxml.UnmarshalMetaHandler) - svc.Handlers.UnmarshalError.PushBackNamed(restxml.UnmarshalErrorHandler) - - // Run custom client initialization if present - if initClient != nil { - initClient(svc.Client) - } - - return svc -} - -// newRequest creates a new request for a S3 operation and runs any -// custom request initialization. -func (c *S3) 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/s3/sse.go b/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go deleted file mode 100644 index 8010c4f..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/sse.go +++ /dev/null @@ -1,54 +0,0 @@ -package s3 - -import ( - "crypto/md5" - "encoding/base64" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -var errSSERequiresSSL = awserr.New("ConfigError", "cannot send SSE keys over HTTP.", nil) - -func validateSSERequiresSSL(r *request.Request) { - if r.HTTPRequest.URL.Scheme == "https" { - return - } - - if iface, ok := r.Params.(sseCustomerKeyGetter); ok { - if len(iface.getSSECustomerKey()) > 0 { - r.Error = errSSERequiresSSL - return - } - } - - if iface, ok := r.Params.(copySourceSSECustomerKeyGetter); ok { - if len(iface.getCopySourceSSECustomerKey()) > 0 { - r.Error = errSSERequiresSSL - return - } - } -} - -func computeSSEKeys(r *request.Request) { - headers := []string{ - "x-amz-server-side-encryption-customer-key", - "x-amz-copy-source-server-side-encryption-customer-key", - } - - for _, h := range headers { - md5h := h + "-md5" - if key := r.HTTPRequest.Header.Get(h); key != "" { - // Base64-encode the value - b64v := base64.StdEncoding.EncodeToString([]byte(key)) - r.HTTPRequest.Header.Set(h, b64v) - - // Add MD5 if it wasn't computed - if r.HTTPRequest.Header.Get(md5h) == "" { - sum := md5.Sum([]byte(key)) - b64sum := base64.StdEncoding.EncodeToString(sum[:]) - r.HTTPRequest.Header.Set(md5h, b64sum) - } - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go deleted file mode 100644 index 50ff99c..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/sse_test.go +++ /dev/null @@ -1,111 +0,0 @@ -package s3_test - -import ( - "strings" - "testing" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -func TestSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - }) - err := req.Build() - - if err == nil { - t.Error("expected an error") - } - if e, a := "ConfigError", err.(awserr.Error).Code(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if !strings.Contains(err.(awserr.Error).Message(), "cannot send SSE keys over HTTP") { - t.Errorf("expected error to contain 'cannot send SSE keys over HTTP', but received %s", err.(awserr.Error).Message()) - } -} - -func TestCopySourceSSECustomerKeyOverHTTPError(t *testing.T) { - s := s3.New(unit.Session, &aws.Config{DisableSSL: aws.Bool(true)}) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - if err == nil { - t.Error("expected an error") - } - if e, a := "ConfigError", err.(awserr.Error).Code(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if !strings.Contains(err.(awserr.Error).Message(), "cannot send SSE keys over HTTP") { - t.Errorf("expected error to contain 'cannot send SSE keys over HTTP', but received %s", err.(awserr.Error).Message()) - } -} - -func TestComputeSSEKeys(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - }) - err := req.Build() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "PG4LipwVIkqCKLmpjKFTHQ==", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestComputeSSEKeysShortcircuit(t *testing.T) { - s := s3.New(unit.Session) - req, _ := s.CopyObjectRequest(&s3.CopyObjectInput{ - Bucket: aws.String("bucket"), - CopySource: aws.String("bucket/source"), - Key: aws.String("dest"), - SSECustomerKey: aws.String("key"), - CopySourceSSECustomerKey: aws.String("key"), - SSECustomerKeyMD5: aws.String("MD5"), - CopySourceSSECustomerKeyMD5: aws.String("MD5"), - }) - err := req.Build() - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := "a2V5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "a2V5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "MD5", req.HTTPRequest.Header.Get("x-amz-server-side-encryption-customer-key-md5"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "MD5", req.HTTPRequest.Header.Get("x-amz-copy-source-server-side-encryption-customer-key-md5"); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go deleted file mode 100644 index 5a78fd3..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error.go +++ /dev/null @@ -1,35 +0,0 @@ -package s3 - -import ( - "bytes" - "io/ioutil" - "net/http" - - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -func copyMultipartStatusOKUnmarhsalError(r *request.Request) { - b, err := ioutil.ReadAll(r.HTTPResponse.Body) - if err != nil { - r.Error = awserr.New("SerializationError", "unable to read response body", err) - return - } - body := bytes.NewReader(b) - r.HTTPResponse.Body = ioutil.NopCloser(body) - defer body.Seek(0, 0) - - if body.Len() == 0 { - // If there is no body don't attempt to parse the body. - return - } - - unmarshalError(r) - if err, ok := r.Error.(awserr.Error); ok && err != nil { - if err.Code() == "SerializationError" { - r.Error = nil - return - } - r.HTTPResponse.StatusCode = http.StatusServiceUnavailable - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go deleted file mode 100644 index cf195c5..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/statusok_error_test.go +++ /dev/null @@ -1,166 +0,0 @@ -package s3_test - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -const errMsg = `ErrorCodemessage bodyrequestIDhostID=` - -var lastModifiedTime = time.Date(2009, 11, 23, 0, 0, 0, 0, time.UTC) - -func TestCopyObjectNoError(t *testing.T) { - const successMsg = ` - -2009-11-23T0:00:00Z"1da64c7f13d1e8dbeaea40b905fd586c"` - - res, err := newCopyTestSvc(successMsg).CopyObject(&s3.CopyObjectInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/exists.txt"), - Key: aws.String("destination.txt"), - }) - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - if e, a := fmt.Sprintf(`%q`, "1da64c7f13d1e8dbeaea40b905fd586c"), *res.CopyObjectResult.ETag; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := lastModifiedTime, *res.CopyObjectResult.LastModified; !e.Equal(a) { - t.Errorf("expected %v, but received %v", e, a) - } -} - -func TestCopyObjectError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).CopyObject(&s3.CopyObjectInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - }) - - if err == nil { - t.Error("expected error, but received none") - } - e := err.(awserr.Error) - - if e, a := "ErrorCode", e.Code(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "message body", e.Message(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestUploadPartCopySuccess(t *testing.T) { - const successMsg = ` - -2009-11-23T0:00:00Z"1da64c7f13d1e8dbeaea40b905fd586c"` - - res, err := newCopyTestSvc(successMsg).UploadPartCopy(&s3.UploadPartCopyInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - PartNumber: aws.Int64(0), - UploadId: aws.String("uploadID"), - }) - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - if e, a := fmt.Sprintf(`%q`, "1da64c7f13d1e8dbeaea40b905fd586c"), *res.CopyPartResult.ETag; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := lastModifiedTime, *res.CopyPartResult.LastModified; !e.Equal(a) { - t.Errorf("expected %v, but received %v", e, a) - } -} - -func TestUploadPartCopyError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).UploadPartCopy(&s3.UploadPartCopyInput{ - Bucket: aws.String("bucketname"), - CopySource: aws.String("bucketname/doesnotexist.txt"), - Key: aws.String("destination.txt"), - PartNumber: aws.Int64(0), - UploadId: aws.String("uploadID"), - }) - - if err == nil { - t.Error("expected an error") - } - e := err.(awserr.Error) - - if e, a := "ErrorCode", e.Code(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "message body", e.Message(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestCompleteMultipartUploadSuccess(t *testing.T) { - const successMsg = ` - -locationNamebucketNamekeyName"etagVal"` - res, err := newCopyTestSvc(successMsg).CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("key"), - UploadId: aws.String("uploadID"), - }) - - if err != nil { - t.Errorf("expected no error, but received %v", err) - } - - if e, a := `"etagVal"`, *res.ETag; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "bucketName", *res.Bucket; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "keyName", *res.Key; e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "locationName", *res.Location; e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func TestCompleteMultipartUploadError(t *testing.T) { - _, err := newCopyTestSvc(errMsg).CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucketname"), - Key: aws.String("key"), - UploadId: aws.String("uploadID"), - }) - - if err == nil { - t.Error("expected an error") - } - e := err.(awserr.Error) - - if e, a := "ErrorCode", e.Code(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } - if e, a := "message body", e.Message(); e != a { - t.Errorf("expected %s, but received %s", e, a) - } -} - -func newCopyTestSvc(errMsg string) *s3.S3 { - server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - http.Error(w, errMsg, http.StatusOK) - })) - return s3.New(unit.Session, aws.NewConfig(). - WithEndpoint(server.URL). - WithDisableSSL(true). - WithMaxRetries(0). - WithS3ForcePathStyle(true)) -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go deleted file mode 100644 index bcca862..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error.go +++ /dev/null @@ -1,103 +0,0 @@ -package s3 - -import ( - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" - "github.com/aws/aws-sdk-go/aws/request" -) - -type xmlErrorResponse struct { - XMLName xml.Name `xml:"Error"` - Code string `xml:"Code"` - Message string `xml:"Message"` -} - -func unmarshalError(r *request.Request) { - defer r.HTTPResponse.Body.Close() - defer io.Copy(ioutil.Discard, r.HTTPResponse.Body) - - hostID := r.HTTPResponse.Header.Get("X-Amz-Id-2") - - // Bucket exists in a different region, and request needs - // to be made to the correct region. - if r.HTTPResponse.StatusCode == http.StatusMovedPermanently { - r.Error = requestFailure{ - RequestFailure: awserr.NewRequestFailure( - awserr.New("BucketRegionError", - fmt.Sprintf("incorrect region, the bucket is not in '%s' region", - aws.StringValue(r.Config.Region)), - nil), - r.HTTPResponse.StatusCode, - r.RequestID, - ), - hostID: hostID, - } - return - } - - var errCode, errMsg string - - // Attempt to parse error from body if it is known - resp := &xmlErrorResponse{} - err := xml.NewDecoder(r.HTTPResponse.Body).Decode(resp) - if err != nil && err != io.EOF { - errCode = "SerializationError" - errMsg = "failed to decode S3 XML error response" - } else { - errCode = resp.Code - errMsg = resp.Message - err = nil - } - - // Fallback to status code converted to message if still no error code - if len(errCode) == 0 { - statusText := http.StatusText(r.HTTPResponse.StatusCode) - errCode = strings.Replace(statusText, " ", "", -1) - errMsg = statusText - } - - r.Error = requestFailure{ - RequestFailure: awserr.NewRequestFailure( - awserr.New(errCode, errMsg, err), - r.HTTPResponse.StatusCode, - r.RequestID, - ), - hostID: hostID, - } -} - -// A RequestFailure provides access to the S3 Request ID and Host ID values -// returned from API operation errors. Getting the error as a string will -// return the formated error with the same information as awserr.RequestFailure, -// while also adding the HostID value from the response. -type RequestFailure interface { - awserr.RequestFailure - - // Host ID is the S3 Host ID needed for debug, and contacting support - HostID() string -} - -type requestFailure struct { - awserr.RequestFailure - - hostID string -} - -func (r requestFailure) Error() string { - extra := fmt.Sprintf("status code: %d, request id: %s, host id: %s", - r.StatusCode(), r.RequestID(), r.hostID) - return awserr.SprintError(r.Code(), r.Message(), extra, r.OrigErr()) -} -func (r requestFailure) String() string { - return r.Error() -} -func (r requestFailure) HostID() string { - return r.hostID -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_leak_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_leak_test.go deleted file mode 100644 index 857bbaa..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_leak_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package s3 - -import ( - "net/http" - "testing" - - "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/awstesting" -) - -func TestUnmarhsalErrorLeak(t *testing.T) { - req := &request.Request{ - HTTPRequest: &http.Request{ - Header: make(http.Header), - Body: &awstesting.ReadCloser{Size: 2048}, - }, - } - req.HTTPResponse = &http.Response{ - Body: &awstesting.ReadCloser{Size: 2048}, - Header: http.Header{ - "X-Amzn-Requestid": []string{"1"}, - }, - StatusCode: http.StatusOK, - } - - reader := req.HTTPResponse.Body.(*awstesting.ReadCloser) - unmarshalError(req) - - if req.Error == nil { - t.Error("expected an error, but received none") - } - - if !reader.Closed { - t.Error("expected reader to be closed") - } - - if e, a := 0, reader.Size; e != a { - t.Errorf("expected %d, but received %d", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go b/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go deleted file mode 100644 index fc6a14d..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/unmarshal_error_test.go +++ /dev/null @@ -1,253 +0,0 @@ -package s3_test - -import ( - "bytes" - "fmt" - "io/ioutil" - "net/http" - "strings" - "testing" - - "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/awstesting/unit" - "github.com/aws/aws-sdk-go/service/s3" -) - -type testErrorCase struct { - RespFn func() *http.Response - ReqID, HostID string - Code, Msg string - WithoutStatusMsg bool -} - -var testUnmarshalCases = []testErrorCase{ - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 301, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: -1, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "BucketRegionError", Msg: "incorrect region, the bucket is not in 'mock-region' region", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 403, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: 0, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "Forbidden", Msg: "Forbidden", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 400, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: 0, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "BadRequest", Msg: "Bad Request", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 404, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: 0, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "NotFound", Msg: "Not Found", - }, - { - // SDK only reads request ID and host ID from the header. The values - // in message body are ignored. - RespFn: func() *http.Response { - body := `SomeExceptionException messageignored-request-idignored-host-id` - return &http.Response{ - StatusCode: 500, - Header: http.Header{ - "X-Amz-Request-Id": []string{"taken-request-id"}, - "X-Amz-Id-2": []string{"taken-host-id"}, - }, - Body: ioutil.NopCloser(strings.NewReader(body)), - ContentLength: int64(len(body)), - } - }, - ReqID: "taken-request-id", - HostID: "taken-host-id", - Code: "SomeException", Msg: "Exception message", - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 404, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: -1, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "NotFound", Msg: "Not Found", WithoutStatusMsg: true, - }, - { - RespFn: func() *http.Response { - return &http.Response{ - StatusCode: 404, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(bytes.NewReader(nil)), - ContentLength: -1, - } - }, - ReqID: "abc123", - HostID: "321cba", - Code: "NotFound", Msg: "Not Found", - }, -} - -func TestUnmarshalError(t *testing.T) { - for i, c := range testUnmarshalCases { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = c.RespFn() - if !c.WithoutStatusMsg { - r.HTTPResponse.Status = fmt.Sprintf("%d%s", - r.HTTPResponse.StatusCode, - http.StatusText(r.HTTPResponse.StatusCode)) - } - }) - _, err := s.PutBucketAcl(&s3.PutBucketAclInput{ - Bucket: aws.String("bucket"), ACL: aws.String("public-read"), - }) - - if err == nil { - t.Fatalf("%d, expected error, got nil", i) - } - if e, a := c.Code, err.(awserr.Error).Code(); e != a { - t.Errorf("%d, Code: expect %s, got %s", i, e, a) - } - if e, a := c.Msg, err.(awserr.Error).Message(); e != a { - t.Errorf("%d, Message: expect %s, got %s", i, e, a) - } - if e, a := c.ReqID, err.(awserr.RequestFailure).RequestID(); e != a { - t.Errorf("%d, RequestID: expect %s, got %s", i, e, a) - } - if e, a := c.HostID, err.(s3.RequestFailure).HostID(); e != a { - t.Errorf("%d, HostID: expect %s, got %s", i, e, a) - } - } -} - -const completeMultiResp = ` -163 - - -https://bucket.s3-us-west-2.amazonaws.com/keybucketkey"a7d414b9133d6483d9a1c4e04e856e3b-2" -0 -` - -func Test200NoErrorUnmarshalError(t *testing.T) { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(strings.NewReader(completeMultiResp)), - ContentLength: -1, - } - r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode) - }) - _, err := s.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucket"), Key: aws.String("key"), - UploadId: aws.String("id"), - MultipartUpload: &s3.CompletedMultipartUpload{Parts: []*s3.CompletedPart{ - {ETag: aws.String("etag"), PartNumber: aws.Int64(1)}, - }}, - }) - - if err != nil { - t.Fatalf("expect no error, got %v", err) - } -} - -const completeMultiErrResp = `SomeExceptionException message` - -func Test200WithErrorUnmarshalError(t *testing.T) { - s := s3.New(unit.Session) - s.Handlers.Send.Clear() - s.Handlers.Send.PushBack(func(r *request.Request) { - r.HTTPResponse = &http.Response{ - StatusCode: 200, - Header: http.Header{ - "X-Amz-Request-Id": []string{"abc123"}, - "X-Amz-Id-2": []string{"321cba"}, - }, - Body: ioutil.NopCloser(strings.NewReader(completeMultiErrResp)), - ContentLength: -1, - } - r.HTTPResponse.Status = http.StatusText(r.HTTPResponse.StatusCode) - }) - _, err := s.CompleteMultipartUpload(&s3.CompleteMultipartUploadInput{ - Bucket: aws.String("bucket"), Key: aws.String("key"), - UploadId: aws.String("id"), - MultipartUpload: &s3.CompletedMultipartUpload{Parts: []*s3.CompletedPart{ - {ETag: aws.String("etag"), PartNumber: aws.Int64(1)}, - }}, - }) - - if err == nil { - t.Fatalf("expected error, got nil") - } - if e, a := "SomeException", err.(awserr.Error).Code(); e != a { - t.Errorf("Code: expect %s, got %s", e, a) - } - if e, a := "Exception message", err.(awserr.Error).Message(); e != a { - t.Errorf("Message: expect %s, got %s", e, a) - } - if e, a := "abc123", err.(s3.RequestFailure).RequestID(); e != a { - t.Errorf("RequestID: expect %s, got %s", e, a) - } - if e, a := "321cba", err.(s3.RequestFailure).HostID(); e != a { - t.Errorf("HostID: expect %s, got %s", e, a) - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go b/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go deleted file mode 100644 index 2596c69..0000000 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/waiters.go +++ /dev/null @@ -1,214 +0,0 @@ -// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. - -package s3 - -import ( - "time" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/request" -) - -// WaitUntilBucketExists uses the Amazon S3 API operation -// HeadBucket 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 *S3) WaitUntilBucketExists(input *HeadBucketInput) error { - return c.WaitUntilBucketExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilBucketExistsWithContext is an extended version of WaitUntilBucketExists. -// 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 *S3) WaitUntilBucketExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilBucketExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 301, - }, - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 403, - }, - { - State: request.RetryWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadBucketInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadBucketRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilBucketNotExists uses the Amazon S3 API operation -// HeadBucket 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 *S3) WaitUntilBucketNotExists(input *HeadBucketInput) error { - return c.WaitUntilBucketNotExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilBucketNotExistsWithContext is an extended version of WaitUntilBucketNotExists. -// 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 *S3) WaitUntilBucketNotExistsWithContext(ctx aws.Context, input *HeadBucketInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilBucketNotExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadBucketInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadBucketRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilObjectExists uses the Amazon S3 API operation -// HeadObject 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 *S3) WaitUntilObjectExists(input *HeadObjectInput) error { - return c.WaitUntilObjectExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilObjectExistsWithContext is an extended version of WaitUntilObjectExists. -// 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 *S3) WaitUntilObjectExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilObjectExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 200, - }, - { - State: request.RetryWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadObjectInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadObjectRequest(inCpy) - req.SetContext(ctx) - req.ApplyOptions(opts...) - return req, nil - }, - } - w.ApplyOptions(opts...) - - return w.WaitWithContext(ctx) -} - -// WaitUntilObjectNotExists uses the Amazon S3 API operation -// HeadObject 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 *S3) WaitUntilObjectNotExists(input *HeadObjectInput) error { - return c.WaitUntilObjectNotExistsWithContext(aws.BackgroundContext(), input) -} - -// WaitUntilObjectNotExistsWithContext is an extended version of WaitUntilObjectNotExists. -// 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 *S3) WaitUntilObjectNotExistsWithContext(ctx aws.Context, input *HeadObjectInput, opts ...request.WaiterOption) error { - w := request.Waiter{ - Name: "WaitUntilObjectNotExists", - MaxAttempts: 20, - Delay: request.ConstantWaiterDelay(5 * time.Second), - Acceptors: []request.WaiterAcceptor{ - { - State: request.SuccessWaiterState, - Matcher: request.StatusWaiterMatch, - Expected: 404, - }, - }, - Logger: c.Config.Logger, - NewRequest: func(opts []request.Option) (*request.Request, error) { - var inCpy *HeadObjectInput - if input != nil { - tmp := *input - inCpy = &tmp - } - req, _ := c.HeadObjectRequest(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/sts/api.go b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go deleted file mode 100644 index 23f0a06..0000000 --- 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) -// } -// -// See also, 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. -// -// See also, 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) -// } -// -// See also, 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. -// -// See also, 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) -// } -// -// See also, 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. -// -// See also, 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) -// } -// -// See also, 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. -// -// See also, 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) -// } -// -// See also, 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. -// See also, 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) -// } -// -// See also, 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. -// -// See also, 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) -// } -// -// See also, 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. -// -// See also, 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() -} - -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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. -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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 -} - -// See also, 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. -// See also, 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 4010cc7..0000000 --- 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 18972b1..0000000 --- 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 ef681ab..0000000 --- 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 contact 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 e24884e..0000000 --- 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 d61a993..0000000 --- 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 1ee5839..0000000 --- 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/bgentry/go-netrc/.hgignore b/vendor/github.com/bgentry/go-netrc/.hgignore deleted file mode 100644 index 0871e01..0000000 --- a/vendor/github.com/bgentry/go-netrc/.hgignore +++ /dev/null @@ -1,3 +0,0 @@ -syntax: glob -*.8 -*.a diff --git a/vendor/github.com/bgentry/go-netrc/LICENSE b/vendor/github.com/bgentry/go-netrc/LICENSE deleted file mode 100644 index aade9a5..0000000 --- a/vendor/github.com/bgentry/go-netrc/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Original version Copyright © 2010 Fazlul Shahriar . Newer -portions Copyright © 2014 Blake Gentry . - -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/bgentry/go-netrc/README.md b/vendor/github.com/bgentry/go-netrc/README.md deleted file mode 100644 index 6759f7a..0000000 --- a/vendor/github.com/bgentry/go-netrc/README.md +++ /dev/null @@ -1,9 +0,0 @@ -# go-netrc - -A Golang package for reading and writing netrc files. This package can parse netrc -files, make changes to them, and then serialize them back to netrc format, while -preserving any whitespace that was present in the source file. - -[![GoDoc](https://godoc.org/github.com/bgentry/go-netrc?status.png)][godoc] - -[godoc]: https://godoc.org/github.com/bgentry/go-netrc "go-netrc on Godoc.org" diff --git a/vendor/github.com/bgentry/go-netrc/netrc/netrc.go b/vendor/github.com/bgentry/go-netrc/netrc/netrc.go deleted file mode 100644 index ea49987..0000000 --- a/vendor/github.com/bgentry/go-netrc/netrc/netrc.go +++ /dev/null @@ -1,510 +0,0 @@ -package netrc - -import ( - "bufio" - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "strings" - "sync" - "unicode" - "unicode/utf8" -) - -type tkType int - -const ( - tkMachine tkType = iota - tkDefault - tkLogin - tkPassword - tkAccount - tkMacdef - tkComment - tkWhitespace -) - -var keywords = map[string]tkType{ - "machine": tkMachine, - "default": tkDefault, - "login": tkLogin, - "password": tkPassword, - "account": tkAccount, - "macdef": tkMacdef, - "#": tkComment, -} - -type Netrc struct { - tokens []*token - machines []*Machine - macros Macros - updateLock sync.Mutex -} - -// FindMachine returns the Machine in n named by name. If a machine named by -// name exists, it is returned. If no Machine with name name is found and there -// is a ``default'' machine, the ``default'' machine is returned. Otherwise, nil -// is returned. -func (n *Netrc) FindMachine(name string) (m *Machine) { - // TODO(bgentry): not safe for concurrency - var def *Machine - for _, m = range n.machines { - if m.Name == name { - return m - } - if m.IsDefault() { - def = m - } - } - if def == nil { - return nil - } - return def -} - -// MarshalText implements the encoding.TextMarshaler interface to encode a -// Netrc into text format. -func (n *Netrc) MarshalText() (text []byte, err error) { - // TODO(bgentry): not safe for concurrency - for i := range n.tokens { - switch n.tokens[i].kind { - case tkComment, tkDefault, tkWhitespace: // always append these types - text = append(text, n.tokens[i].rawkind...) - default: - if n.tokens[i].value != "" { // skip empty-value tokens - text = append(text, n.tokens[i].rawkind...) - } - } - if n.tokens[i].kind == tkMacdef { - text = append(text, ' ') - text = append(text, n.tokens[i].macroName...) - } - text = append(text, n.tokens[i].rawvalue...) - } - return -} - -func (n *Netrc) NewMachine(name, login, password, account string) *Machine { - n.updateLock.Lock() - defer n.updateLock.Unlock() - - prefix := "\n" - if len(n.tokens) == 0 { - prefix = "" - } - m := &Machine{ - Name: name, - Login: login, - Password: password, - Account: account, - - nametoken: &token{ - kind: tkMachine, - rawkind: []byte(prefix + "machine"), - value: name, - rawvalue: []byte(" " + name), - }, - logintoken: &token{ - kind: tkLogin, - rawkind: []byte("\n\tlogin"), - value: login, - rawvalue: []byte(" " + login), - }, - passtoken: &token{ - kind: tkPassword, - rawkind: []byte("\n\tpassword"), - value: password, - rawvalue: []byte(" " + password), - }, - accounttoken: &token{ - kind: tkAccount, - rawkind: []byte("\n\taccount"), - value: account, - rawvalue: []byte(" " + account), - }, - } - n.insertMachineTokensBeforeDefault(m) - for i := range n.machines { - if n.machines[i].IsDefault() { - n.machines = append(append(n.machines[:i], m), n.machines[i:]...) - return m - } - } - n.machines = append(n.machines, m) - return m -} - -func (n *Netrc) insertMachineTokensBeforeDefault(m *Machine) { - newtokens := []*token{m.nametoken} - if m.logintoken.value != "" { - newtokens = append(newtokens, m.logintoken) - } - if m.passtoken.value != "" { - newtokens = append(newtokens, m.passtoken) - } - if m.accounttoken.value != "" { - newtokens = append(newtokens, m.accounttoken) - } - for i := range n.tokens { - if n.tokens[i].kind == tkDefault { - // found the default, now insert tokens before it - n.tokens = append(n.tokens[:i], append(newtokens, n.tokens[i:]...)...) - return - } - } - // didn't find a default, just add the newtokens to the end - n.tokens = append(n.tokens, newtokens...) - return -} - -func (n *Netrc) RemoveMachine(name string) { - n.updateLock.Lock() - defer n.updateLock.Unlock() - - for i := range n.machines { - if n.machines[i] != nil && n.machines[i].Name == name { - m := n.machines[i] - for _, t := range []*token{ - m.nametoken, m.logintoken, m.passtoken, m.accounttoken, - } { - n.removeToken(t) - } - n.machines = append(n.machines[:i], n.machines[i+1:]...) - return - } - } -} - -func (n *Netrc) removeToken(t *token) { - if t != nil { - for i := range n.tokens { - if n.tokens[i] == t { - n.tokens = append(n.tokens[:i], n.tokens[i+1:]...) - return - } - } - } -} - -// Machine contains information about a remote machine. -type Machine struct { - Name string - Login string - Password string - Account string - - nametoken *token - logintoken *token - passtoken *token - accounttoken *token -} - -// IsDefault returns true if the machine is a "default" token, denoted by an -// empty name. -func (m *Machine) IsDefault() bool { - return m.Name == "" -} - -// UpdatePassword sets the password for the Machine m. -func (m *Machine) UpdatePassword(newpass string) { - m.Password = newpass - updateTokenValue(m.passtoken, newpass) -} - -// UpdateLogin sets the login for the Machine m. -func (m *Machine) UpdateLogin(newlogin string) { - m.Login = newlogin - updateTokenValue(m.logintoken, newlogin) -} - -// UpdateAccount sets the login for the Machine m. -func (m *Machine) UpdateAccount(newaccount string) { - m.Account = newaccount - updateTokenValue(m.accounttoken, newaccount) -} - -func updateTokenValue(t *token, value string) { - oldvalue := t.value - t.value = value - newraw := make([]byte, len(t.rawvalue)) - copy(newraw, t.rawvalue) - t.rawvalue = append( - bytes.TrimSuffix(newraw, []byte(oldvalue)), - []byte(value)..., - ) -} - -// Macros contains all the macro definitions in a netrc file. -type Macros map[string]string - -type token struct { - kind tkType - macroName string - value string - rawkind []byte - rawvalue []byte -} - -// Error represents a netrc file parse error. -type Error struct { - LineNum int // Line number - Msg string // Error message -} - -// Error returns a string representation of error e. -func (e *Error) Error() string { - return fmt.Sprintf("line %d: %s", e.LineNum, e.Msg) -} - -func (e *Error) BadDefaultOrder() bool { - return e.Msg == errBadDefaultOrder -} - -const errBadDefaultOrder = "default token must appear after all machine tokens" - -// scanLinesKeepPrefix is a split function for a Scanner that returns each line -// of text. The returned token may include newlines if they are before the -// first non-space character. The returned line may be empty. The end-of-line -// marker is one optional carriage return followed by one mandatory newline. In -// regular expression notation, it is `\r?\n`. The last non-empty line of -// input will be returned even if it has no newline. -func scanLinesKeepPrefix(data []byte, atEOF bool) (advance int, token []byte, err error) { - if atEOF && len(data) == 0 { - return 0, nil, nil - } - // Skip leading spaces. - start := 0 - for width := 0; start < len(data); start += width { - var r rune - r, width = utf8.DecodeRune(data[start:]) - if !unicode.IsSpace(r) { - break - } - } - if i := bytes.IndexByte(data[start:], '\n'); i >= 0 { - // We have a full newline-terminated line. - return start + i, data[0 : start+i], nil - } - // If we're at EOF, we have a final, non-terminated line. Return it. - if atEOF { - return len(data), data, nil - } - // Request more data. - return 0, nil, nil -} - -// scanWordsKeepPrefix is a split function for a Scanner that returns each -// space-separated word of text, with prefixing spaces included. It will never -// return an empty string. The definition of space is set by unicode.IsSpace. -// -// Adapted from bufio.ScanWords(). -func scanTokensKeepPrefix(data []byte, atEOF bool) (advance int, token []byte, err error) { - // Skip leading spaces. - start := 0 - for width := 0; start < len(data); start += width { - var r rune - r, width = utf8.DecodeRune(data[start:]) - if !unicode.IsSpace(r) { - break - } - } - if atEOF && len(data) == 0 || start == len(data) { - return len(data), data, nil - } - if len(data) > start && data[start] == '#' { - return scanLinesKeepPrefix(data, atEOF) - } - // Scan until space, marking end of word. - for width, i := 0, start; i < len(data); i += width { - var r rune - r, width = utf8.DecodeRune(data[i:]) - if unicode.IsSpace(r) { - return i, data[:i], nil - } - } - // If we're at EOF, we have a final, non-empty, non-terminated word. Return it. - if atEOF && len(data) > start { - return len(data), data, nil - } - // Request more data. - return 0, nil, nil -} - -func newToken(rawb []byte) (*token, error) { - _, tkind, err := bufio.ScanWords(rawb, true) - if err != nil { - return nil, err - } - var ok bool - t := token{rawkind: rawb} - t.kind, ok = keywords[string(tkind)] - if !ok { - trimmed := strings.TrimSpace(string(tkind)) - if trimmed == "" { - t.kind = tkWhitespace // whitespace-only, should happen only at EOF - return &t, nil - } - if strings.HasPrefix(trimmed, "#") { - t.kind = tkComment // this is a comment - return &t, nil - } - return &t, fmt.Errorf("keyword expected; got " + string(tkind)) - } - return &t, nil -} - -func scanValue(scanner *bufio.Scanner, pos int) ([]byte, string, int, error) { - if scanner.Scan() { - raw := scanner.Bytes() - pos += bytes.Count(raw, []byte{'\n'}) - return raw, strings.TrimSpace(string(raw)), pos, nil - } - if err := scanner.Err(); err != nil { - return nil, "", pos, &Error{pos, err.Error()} - } - return nil, "", pos, nil -} - -func parse(r io.Reader, pos int) (*Netrc, error) { - b, err := ioutil.ReadAll(r) - if err != nil { - return nil, err - } - - nrc := Netrc{machines: make([]*Machine, 0, 20), macros: make(Macros, 10)} - - defaultSeen := false - var currentMacro *token - var m *Machine - var t *token - scanner := bufio.NewScanner(bytes.NewReader(b)) - scanner.Split(scanTokensKeepPrefix) - - for scanner.Scan() { - rawb := scanner.Bytes() - if len(rawb) == 0 { - break - } - pos += bytes.Count(rawb, []byte{'\n'}) - t, err = newToken(rawb) - if err != nil { - if currentMacro == nil { - return nil, &Error{pos, err.Error()} - } - currentMacro.rawvalue = append(currentMacro.rawvalue, rawb...) - continue - } - - if currentMacro != nil && bytes.Contains(rawb, []byte{'\n', '\n'}) { - // if macro rawvalue + rawb would contain \n\n, then macro def is over - currentMacro.value = strings.TrimLeft(string(currentMacro.rawvalue), "\r\n") - nrc.macros[currentMacro.macroName] = currentMacro.value - currentMacro = nil - } - - switch t.kind { - case tkMacdef: - if _, t.macroName, pos, err = scanValue(scanner, pos); err != nil { - return nil, &Error{pos, err.Error()} - } - currentMacro = t - case tkDefault: - if defaultSeen { - return nil, &Error{pos, "multiple default token"} - } - if m != nil { - nrc.machines, m = append(nrc.machines, m), nil - } - m = new(Machine) - m.Name = "" - defaultSeen = true - case tkMachine: - if defaultSeen { - return nil, &Error{pos, errBadDefaultOrder} - } - if m != nil { - nrc.machines, m = append(nrc.machines, m), nil - } - m = new(Machine) - if t.rawvalue, m.Name, pos, err = scanValue(scanner, pos); err != nil { - return nil, &Error{pos, err.Error()} - } - t.value = m.Name - m.nametoken = t - case tkLogin: - if m == nil || m.Login != "" { - return nil, &Error{pos, "unexpected token login "} - } - if t.rawvalue, m.Login, pos, err = scanValue(scanner, pos); err != nil { - return nil, &Error{pos, err.Error()} - } - t.value = m.Login - m.logintoken = t - case tkPassword: - if m == nil || m.Password != "" { - return nil, &Error{pos, "unexpected token password"} - } - if t.rawvalue, m.Password, pos, err = scanValue(scanner, pos); err != nil { - return nil, &Error{pos, err.Error()} - } - t.value = m.Password - m.passtoken = t - case tkAccount: - if m == nil || m.Account != "" { - return nil, &Error{pos, "unexpected token account"} - } - if t.rawvalue, m.Account, pos, err = scanValue(scanner, pos); err != nil { - return nil, &Error{pos, err.Error()} - } - t.value = m.Account - m.accounttoken = t - } - - nrc.tokens = append(nrc.tokens, t) - } - - if err := scanner.Err(); err != nil { - return nil, err - } - - if m != nil { - nrc.machines, m = append(nrc.machines, m), nil - } - return &nrc, nil -} - -// ParseFile opens the file at filename and then passes its io.Reader to -// Parse(). -func ParseFile(filename string) (*Netrc, error) { - fd, err := os.Open(filename) - if err != nil { - return nil, err - } - defer fd.Close() - return Parse(fd) -} - -// Parse parses from the the Reader r as a netrc file and returns the set of -// machine information and macros defined in it. The ``default'' machine, -// which is intended to be used when no machine name matches, is identified -// by an empty machine name. There can be only one ``default'' machine. -// -// If there is a parsing error, an Error is returned. -func Parse(r io.Reader) (*Netrc, error) { - return parse(r, 1) -} - -// FindMachine parses the netrc file identified by filename and returns the -// Machine named by name. If a problem occurs parsing the file at filename, an -// error is returned. If a machine named by name exists, it is returned. If no -// Machine with name name is found and there is a ``default'' machine, the -// ``default'' machine is returned. Otherwise, nil is returned. -func FindMachine(filename, name string) (m *Machine, err error) { - n, err := ParseFile(filename) - if err != nil { - return nil, err - } - return n.FindMachine(name), nil -} diff --git a/vendor/github.com/bgentry/go-netrc/netrc/netrc_test.go b/vendor/github.com/bgentry/go-netrc/netrc/netrc_test.go deleted file mode 100644 index 70ceacf..0000000 --- a/vendor/github.com/bgentry/go-netrc/netrc/netrc_test.go +++ /dev/null @@ -1,559 +0,0 @@ -// Copyright © 2010 Fazlul Shahriar and -// Copyright © 2014 Blake Gentry . -// See LICENSE file for license details. - -package netrc - -import ( - "bytes" - "fmt" - "io" - "io/ioutil" - "os" - "strings" - "testing" -) - -var expectedMachines = []*Machine{ - &Machine{Name: "mail.google.com", Login: "joe@gmail.com", Password: "somethingSecret", Account: "justagmail"}, - &Machine{Name: "ray", Login: "demo", Password: "mypassword", Account: ""}, - &Machine{Name: "weirdlogin", Login: "uname", Password: "pass#pass", Account: ""}, - &Machine{Name: "", Login: "anonymous", Password: "joe@example.com", Account: ""}, -} -var expectedMacros = Macros{ - "allput": "put src/*", - "allput2": " put src/*\nput src2/*", -} - -func eqMachine(a *Machine, b *Machine) bool { - return a.Name == b.Name && - a.Login == b.Login && - a.Password == b.Password && - a.Account == b.Account -} - -func testExpected(n *Netrc, t *testing.T) { - if len(expectedMachines) != len(n.machines) { - t.Errorf("expected %d machines, got %d", len(expectedMachines), len(n.machines)) - } else { - for i, e := range expectedMachines { - if !eqMachine(e, n.machines[i]) { - t.Errorf("bad machine; expected %v, got %v\n", e, n.machines[i]) - } - } - } - - if len(expectedMacros) != len(n.macros) { - t.Errorf("expected %d macros, got %d", len(expectedMacros), len(n.macros)) - } else { - for k, v := range expectedMacros { - if v != n.macros[k] { - t.Errorf("bad macro for %s; expected %q, got %q\n", k, v, n.macros[k]) - } - } - } -} - -var newTokenTests = []struct { - rawkind string - tkind tkType -}{ - {"machine", tkMachine}, - {"\n\n\tmachine", tkMachine}, - {"\n machine", tkMachine}, - {"default", tkDefault}, - {"login", tkLogin}, - {"password", tkPassword}, - {"account", tkAccount}, - {"macdef", tkMacdef}, - {"\n # comment stuff ", tkComment}, - {"\n # I am another comment", tkComment}, - {"\n\t\n ", tkWhitespace}, -} - -var newTokenInvalidTests = []string{ - " junk", - "sdfdsf", - "account#unspaced comment", -} - -func TestNewToken(t *testing.T) { - for _, tktest := range newTokenTests { - tok, err := newToken([]byte(tktest.rawkind)) - if err != nil { - t.Fatal(err) - } - if tok.kind != tktest.tkind { - t.Errorf("expected tok.kind %d, got %d", tktest.tkind, tok.kind) - } - if string(tok.rawkind) != tktest.rawkind { - t.Errorf("expected tok.rawkind %q, got %q", tktest.rawkind, string(tok.rawkind)) - } - } - - for _, tktest := range newTokenInvalidTests { - _, err := newToken([]byte(tktest)) - if err == nil { - t.Errorf("expected error with %q, got none", tktest) - } - } -} - -func TestParse(t *testing.T) { - r := netrcReader("examples/good.netrc", t) - n, err := Parse(r) - if err != nil { - t.Fatal(err) - } - testExpected(n, t) -} - -func TestParseFile(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - testExpected(n, t) - - _, err = ParseFile("examples/bad_default_order.netrc") - if err == nil { - t.Error("expected an error parsing bad_default_order.netrc, got none") - } else if !err.(*Error).BadDefaultOrder() { - t.Error("expected BadDefaultOrder() to be true, got false") - } - - _, err = ParseFile("examples/this_file_doesnt_exist.netrc") - if err == nil { - t.Error("expected an error loading this_file_doesnt_exist.netrc, got none") - } else if _, ok := err.(*os.PathError); !ok { - t.Errorf("expected *os.Error, got %v", err) - } -} - -func TestFindMachine(t *testing.T) { - m, err := FindMachine("examples/good.netrc", "ray") - if err != nil { - t.Fatal(err) - } - if !eqMachine(m, expectedMachines[1]) { - t.Errorf("bad machine; expected %v, got %v\n", expectedMachines[1], m) - } - if m.IsDefault() { - t.Errorf("expected m.IsDefault() to be false") - } - - m, err = FindMachine("examples/good.netrc", "non.existent") - if err != nil { - t.Fatal(err) - } - if !eqMachine(m, expectedMachines[3]) { - t.Errorf("bad machine; expected %v, got %v\n", expectedMachines[3], m) - } - if !m.IsDefault() { - t.Errorf("expected m.IsDefault() to be true") - } -} - -func TestNetrcFindMachine(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - - m := n.FindMachine("ray") - if !eqMachine(m, expectedMachines[1]) { - t.Errorf("bad machine; expected %v, got %v\n", expectedMachines[1], m) - } - if m.IsDefault() { - t.Errorf("expected def to be false") - } - - n = &Netrc{} - m = n.FindMachine("nonexistent") - if m != nil { - t.Errorf("expected nil, got %v", m) - } -} - -func TestMarshalText(t *testing.T) { - // load up expected netrc Marshal output - expected, err := ioutil.ReadAll(netrcReader("examples/good.netrc", t)) - if err != nil { - t.Fatal(err) - } - - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - - result, err := n.MarshalText() - if err != nil { - t.Fatal(err) - } - if string(result) != string(expected) { - t.Errorf("expected:\n%q\ngot:\n%q", string(expected), string(result)) - } - - // make sure tokens w/ no value are not serialized - m := n.FindMachine("mail.google.com") - m.UpdatePassword("") - result, err = n.MarshalText() - if err != nil { - t.Fatal(err) - } - if strings.Contains(string(result), "\tpassword \n") { - fmt.Println(string(result)) - t.Errorf("expected zero-value password token to not be serialzed") - } -} - -var newMachineTests = []struct { - name string - login string - password string - account string -}{ - {"heroku.com", "dodging-samurai-42@heroku.com", "octocatdodgeballchampions", "2011+2013"}, - {"bgentry.io", "special@test.com", "noacct", ""}, - {"github.io", "2@test.com", "", "acctwithnopass"}, - {"someotherapi.com", "", "passonly", ""}, -} - -func TestNewMachine(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - testNewMachine(t, n) - n = &Netrc{} - testNewMachine(t, n) - - // make sure that tokens without a value are not serialized at all - for _, test := range newMachineTests { - n = &Netrc{} - _ = n.NewMachine(test.name, test.login, test.password, test.account) - - bodyb, _ := n.MarshalText() - body := string(bodyb) - - // ensure desired values are present when they should be - if !strings.Contains(body, "machine") { - t.Errorf("NewMachine() %s missing keyword 'machine'", test.name) - } - if !strings.Contains(body, test.name) { - t.Errorf("NewMachine() %s missing value %q", test.name, test.name) - } - if test.login != "" && !strings.Contains(body, "login "+test.login) { - t.Errorf("NewMachine() %s missing value %q", test.name, "login "+test.login) - } - if test.password != "" && !strings.Contains(body, "password "+test.password) { - t.Errorf("NewMachine() %s missing value %q", test.name, "password "+test.password) - } - if test.account != "" && !strings.Contains(body, "account "+test.account) { - t.Errorf("NewMachine() %s missing value %q", test.name, "account "+test.account) - } - - // ensure undesired values are not present when they shouldn't be - if test.login == "" && strings.Contains(body, "login") { - t.Errorf("NewMachine() %s contains unexpected value %q", test.name, "login") - } - if test.password == "" && strings.Contains(body, "password") { - t.Errorf("NewMachine() %s contains unexpected value %q", test.name, "password") - } - if test.account == "" && strings.Contains(body, "account") { - t.Errorf("NewMachine() %s contains unexpected value %q", test.name, "account") - } - } -} - -func testNewMachine(t *testing.T, n *Netrc) { - for _, test := range newMachineTests { - mcount := len(n.machines) - // sanity check - bodyb, _ := n.MarshalText() - body := string(bodyb) - for _, value := range []string{test.name, test.login, test.password, test.account} { - if value != "" && strings.Contains(body, value) { - t.Errorf("MarshalText() before NewMachine() contained unexpected %q", value) - } - } - - // test prefix for machine token - prefix := "\n" - if len(n.tokens) == 0 { - prefix = "" - } - - m := n.NewMachine(test.name, test.login, test.password, test.account) - if m == nil { - t.Fatalf("NewMachine() returned nil") - } - - if len(n.machines) != mcount+1 { - t.Errorf("n.machines count expected %d, got %d", mcount+1, len(n.machines)) - } - // check values - if m.Name != test.name { - t.Errorf("m.Name expected %q, got %q", test.name, m.Name) - } - if m.Login != test.login { - t.Errorf("m.Login expected %q, got %q", test.login, m.Login) - } - if m.Password != test.password { - t.Errorf("m.Password expected %q, got %q", test.password, m.Password) - } - if m.Account != test.account { - t.Errorf("m.Account expected %q, got %q", test.account, m.Account) - } - // check tokens - checkToken(t, "nametoken", m.nametoken, tkMachine, prefix+"machine", test.name) - checkToken(t, "logintoken", m.logintoken, tkLogin, "\n\tlogin", test.login) - checkToken(t, "passtoken", m.passtoken, tkPassword, "\n\tpassword", test.password) - checkToken(t, "accounttoken", m.accounttoken, tkAccount, "\n\taccount", test.account) - // check marshal output - bodyb, _ = n.MarshalText() - body = string(bodyb) - for _, value := range []string{test.name, test.login, test.password, test.account} { - if !strings.Contains(body, value) { - t.Errorf("MarshalText() after NewMachine() did not include %q as expected", value) - } - } - } -} - -func checkToken(t *testing.T, name string, tok *token, kind tkType, rawkind, value string) { - if tok == nil { - t.Errorf("%s not defined", name) - return - } - if tok.kind != kind { - t.Errorf("%s expected kind %d, got %d", name, kind, tok.kind) - } - if string(tok.rawkind) != rawkind { - t.Errorf("%s expected rawkind %q, got %q", name, rawkind, string(tok.rawkind)) - } - if tok.value != value { - t.Errorf("%s expected value %q, got %q", name, value, tok.value) - } - if tok.value != value { - t.Errorf("%s expected value %q, got %q", name, value, tok.value) - } -} - -func TestNewMachineGoesBeforeDefault(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - m := n.NewMachine("mymachine", "mylogin", "mypassword", "myaccount") - if m2 := n.machines[len(n.machines)-2]; m2 != m { - t.Errorf("expected machine %v, got %v", m, m2) - } -} - -func TestRemoveMachine(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - - tests := []string{"mail.google.com", "weirdlogin"} - - for _, name := range tests { - mcount := len(n.machines) - // sanity check - m := n.FindMachine(name) - if m == nil { - t.Fatalf("machine %q not found", name) - } - if m.IsDefault() { - t.Fatalf("expected machine %q, got default instead", name) - } - n.RemoveMachine(name) - - if len(n.machines) != mcount-1 { - t.Errorf("n.machines count expected %d, got %d", mcount-1, len(n.machines)) - } - - // make sure Machine is no longer returned by FindMachine() - if m2 := n.FindMachine(name); m2 != nil && !m2.IsDefault() { - t.Errorf("Machine %q not removed from Machines list", name) - } - - // make sure tokens are not present in tokens list - for _, token := range []*token{m.nametoken, m.logintoken, m.passtoken, m.accounttoken} { - if token != nil { - for _, tok2 := range n.tokens { - if tok2 == token { - t.Errorf("token not removed from tokens list: %v", token) - break - } - } - } - } - - bodyb, _ := n.MarshalText() - body := string(bodyb) - for _, value := range []string{m.Name, m.Login, m.Password, m.Account} { - if value != "" && strings.Contains(body, value) { - t.Errorf("MarshalText() after RemoveMachine() contained unexpected %q", value) - } - } - } -} - -func TestUpdateLogin(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - - tests := []struct { - exists bool - name string - oldlogin string - newlogin string - }{ - {true, "mail.google.com", "joe@gmail.com", "joe2@gmail.com"}, - {false, "heroku.com", "", "dodging-samurai-42@heroku.com"}, - } - - bodyb, _ := n.MarshalText() - body := string(bodyb) - for _, test := range tests { - if strings.Contains(body, test.newlogin) { - t.Errorf("MarshalText() before UpdateLogin() contained unexpected %q", test.newlogin) - } - } - - for _, test := range tests { - m := n.FindMachine(test.name) - if m.IsDefault() == test.exists { - t.Errorf("expected machine %s to not exist, but it did", test.name) - } else { - if !test.exists { - m = n.NewMachine(test.name, test.newlogin, "", "") - } - if m == nil { - t.Errorf("machine %s was nil", test.name) - continue - } - m.UpdateLogin(test.newlogin) - m := n.FindMachine(test.name) - if m.Login != test.newlogin { - t.Errorf("expected new login %q, got %q", test.newlogin, m.Login) - } - if m.logintoken.value != test.newlogin { - t.Errorf("expected m.logintoken %q, got %q", test.newlogin, m.logintoken.value) - } - } - } - - bodyb, _ = n.MarshalText() - body = string(bodyb) - for _, test := range tests { - if test.exists && strings.Contains(body, test.oldlogin) { - t.Errorf("MarshalText() after UpdateLogin() contained unexpected %q", test.oldlogin) - } - if !strings.Contains(body, test.newlogin) { - t.Errorf("MarshalText after UpdatePassword did not contain %q as expected", test.newlogin) - } - } -} - -func TestUpdatePassword(t *testing.T) { - n, err := ParseFile("examples/good.netrc") - if err != nil { - t.Fatal(err) - } - - tests := []struct { - exists bool - name string - oldpassword string - newpassword string - }{ - {true, "ray", "mypassword", "supernewpass"}, - {false, "heroku.com", "", "octocatdodgeballchampions"}, - } - - bodyb, _ := n.MarshalText() - body := string(bodyb) - for _, test := range tests { - if test.exists && !strings.Contains(body, test.oldpassword) { - t.Errorf("MarshalText() before UpdatePassword() did not include %q as expected", test.oldpassword) - } - if strings.Contains(body, test.newpassword) { - t.Errorf("MarshalText() before UpdatePassword() contained unexpected %q", test.newpassword) - } - } - - for _, test := range tests { - m := n.FindMachine(test.name) - if m.IsDefault() == test.exists { - t.Errorf("expected machine %s to not exist, but it did", test.name) - } else { - if !test.exists { - m = n.NewMachine(test.name, "", test.newpassword, "") - } - if m == nil { - t.Errorf("machine %s was nil", test.name) - continue - } - m.UpdatePassword(test.newpassword) - m = n.FindMachine(test.name) - if m.Password != test.newpassword { - t.Errorf("expected new password %q, got %q", test.newpassword, m.Password) - } - if m.passtoken.value != test.newpassword { - t.Errorf("expected m.passtoken %q, got %q", test.newpassword, m.passtoken.value) - } - } - } - - bodyb, _ = n.MarshalText() - body = string(bodyb) - for _, test := range tests { - if test.exists && strings.Contains(body, test.oldpassword) { - t.Errorf("MarshalText() after UpdatePassword() contained unexpected %q", test.oldpassword) - } - if !strings.Contains(body, test.newpassword) { - t.Errorf("MarshalText() after UpdatePassword() did not contain %q as expected", test.newpassword) - } - } -} - -func TestNewFile(t *testing.T) { - var n Netrc - - result, err := n.MarshalText() - if err != nil { - t.Fatal(err) - } - if string(result) != "" { - t.Errorf("expected empty result=\"\", got %q", string(result)) - } - - n.NewMachine("netrctest.heroku.com", "auser", "apassword", "") - - result, err = n.MarshalText() - if err != nil { - t.Fatal(err) - } - expected := `machine netrctest.heroku.com - login auser - password apassword` - - if string(result) != expected { - t.Errorf("expected result:\n%q\ngot:\n%q", expected, string(result)) - } -} - -func netrcReader(filename string, t *testing.T) io.Reader { - b, err := ioutil.ReadFile(filename) - if err != nil { - t.Fatal(err) - } - return bytes.NewReader(b) -} diff --git a/vendor/github.com/bgentry/speakeasy/.gitignore b/vendor/github.com/bgentry/speakeasy/.gitignore deleted file mode 100644 index 9e13114..0000000 --- a/vendor/github.com/bgentry/speakeasy/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -example/example -example/example.exe diff --git a/vendor/github.com/bgentry/speakeasy/LICENSE b/vendor/github.com/bgentry/speakeasy/LICENSE deleted file mode 100644 index 37d60fc..0000000 --- a/vendor/github.com/bgentry/speakeasy/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -MIT License - -Copyright (c) 2017 Blake Gentry - -This license applies to the non-Windows portions of this library. The Windows -portion maintains its own Apache 2.0 license. - -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/bgentry/speakeasy/LICENSE_WINDOWS b/vendor/github.com/bgentry/speakeasy/LICENSE_WINDOWS deleted file mode 100644 index ff177f6..0000000 --- a/vendor/github.com/bgentry/speakeasy/LICENSE_WINDOWS +++ /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 [2013] [the CloudFoundry Authors] - -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/bgentry/speakeasy/Readme.md b/vendor/github.com/bgentry/speakeasy/Readme.md deleted file mode 100644 index fceda75..0000000 --- a/vendor/github.com/bgentry/speakeasy/Readme.md +++ /dev/null @@ -1,30 +0,0 @@ -# Speakeasy - -This package provides cross-platform Go (#golang) helpers for taking user input -from the terminal while not echoing the input back (similar to `getpasswd`). The -package uses syscalls to avoid any dependence on cgo, and is therefore -compatible with cross-compiling. - -[![GoDoc](https://godoc.org/github.com/bgentry/speakeasy?status.png)][godoc] - -## Unicode - -Multi-byte unicode characters work successfully on Mac OS X. On Windows, -however, this may be problematic (as is UTF in general on Windows). Other -platforms have not been tested. - -## License - -The code herein was not written by me, but was compiled from two separate open -source packages. Unix portions were imported from [gopass][gopass], while -Windows portions were imported from the [CloudFoundry Go CLI][cf-cli]'s -[Windows terminal helpers][cf-ui-windows]. - -The [license for the windows portion](./LICENSE_WINDOWS) has been copied exactly -from the source (though I attempted to fill in the correct owner in the -boilerplate copyright notice). - -[cf-cli]: https://github.com/cloudfoundry/cli "CloudFoundry Go CLI" -[cf-ui-windows]: https://github.com/cloudfoundry/cli/blob/master/src/cf/terminal/ui_windows.go "CloudFoundry Go CLI Windows input helpers" -[godoc]: https://godoc.org/github.com/bgentry/speakeasy "speakeasy on Godoc.org" -[gopass]: https://code.google.com/p/gopass "gopass" diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy.go b/vendor/github.com/bgentry/speakeasy/speakeasy.go deleted file mode 100644 index 71c1dd1..0000000 --- a/vendor/github.com/bgentry/speakeasy/speakeasy.go +++ /dev/null @@ -1,49 +0,0 @@ -package speakeasy - -import ( - "fmt" - "io" - "os" - "strings" -) - -// Ask the user to enter a password with input hidden. prompt is a string to -// display before the user's input. Returns the provided password, or an error -// if the command failed. -func Ask(prompt string) (password string, err error) { - return FAsk(os.Stdout, prompt) -} - -// FAsk is the same as Ask, except it is possible to specify the file to write -// the prompt to. If 'nil' is passed as the writer, no prompt will be written. -func FAsk(wr io.Writer, prompt string) (password string, err error) { - if wr != nil && prompt != "" { - fmt.Fprint(wr, prompt) // Display the prompt. - } - password, err = getPassword() - - // Carriage return after the user input. - if wr != nil { - fmt.Fprintln(wr, "") - } - return -} - -func readline() (value string, err error) { - var valb []byte - var n int - b := make([]byte, 1) - for { - // read one byte at a time so we don't accidentally read extra bytes - n, err = os.Stdin.Read(b) - if err != nil && err != io.EOF { - return "", err - } - if n == 0 || b[0] == '\n' { - break - } - valb = append(valb, b[0]) - } - - return strings.TrimSuffix(string(valb), "\r"), nil -} diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go b/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go deleted file mode 100644 index d99fda1..0000000 --- a/vendor/github.com/bgentry/speakeasy/speakeasy_unix.go +++ /dev/null @@ -1,93 +0,0 @@ -// based on https://code.google.com/p/gopass -// Author: johnsiilver@gmail.com (John Doak) -// -// Original code is based on code by RogerV in the golang-nuts thread: -// https://groups.google.com/group/golang-nuts/browse_thread/thread/40cc41e9d9fc9247 - -// +build darwin dragonfly freebsd linux netbsd openbsd solaris - -package speakeasy - -import ( - "fmt" - "os" - "os/signal" - "strings" - "syscall" -) - -const sttyArg0 = "/bin/stty" - -var ( - sttyArgvEOff = []string{"stty", "-echo"} - sttyArgvEOn = []string{"stty", "echo"} -) - -// getPassword gets input hidden from the terminal from a user. This is -// accomplished by turning off terminal echo, reading input from the user and -// finally turning on terminal echo. -func getPassword() (password string, err error) { - sig := make(chan os.Signal, 10) - brk := make(chan bool) - - // File descriptors for stdin, stdout, and stderr. - fd := []uintptr{os.Stdin.Fd(), os.Stdout.Fd(), os.Stderr.Fd()} - - // Setup notifications of termination signals to channel sig, create a process to - // watch for these signals so we can turn back on echo if need be. - signal.Notify(sig, syscall.SIGHUP, syscall.SIGINT, syscall.SIGKILL, syscall.SIGQUIT, - syscall.SIGTERM) - go catchSignal(fd, sig, brk) - - // Turn off the terminal echo. - pid, err := echoOff(fd) - if err != nil { - return "", err - } - - // Turn on the terminal echo and stop listening for signals. - defer signal.Stop(sig) - defer close(brk) - defer echoOn(fd) - - syscall.Wait4(pid, nil, 0, nil) - - line, err := readline() - if err == nil { - password = strings.TrimSpace(line) - } else { - err = fmt.Errorf("failed during password entry: %s", err) - } - - return password, err -} - -// echoOff turns off the terminal echo. -func echoOff(fd []uintptr) (int, error) { - pid, err := syscall.ForkExec(sttyArg0, sttyArgvEOff, &syscall.ProcAttr{Dir: "", Files: fd}) - if err != nil { - return 0, fmt.Errorf("failed turning off console echo for password entry:\n\t%s", err) - } - return pid, nil -} - -// echoOn turns back on the terminal echo. -func echoOn(fd []uintptr) { - // Turn on the terminal echo. - pid, e := syscall.ForkExec(sttyArg0, sttyArgvEOn, &syscall.ProcAttr{Dir: "", Files: fd}) - if e == nil { - syscall.Wait4(pid, nil, 0, nil) - } -} - -// catchSignal tries to catch SIGKILL, SIGQUIT and SIGINT so that we can turn -// terminal echo back on before the program ends. Otherwise the user is left -// with echo off on their terminal. -func catchSignal(fd []uintptr, sig chan os.Signal, brk chan bool) { - select { - case <-sig: - echoOn(fd) - os.Exit(-1) - case <-brk: - } -} diff --git a/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go b/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go deleted file mode 100644 index c2093a8..0000000 --- a/vendor/github.com/bgentry/speakeasy/speakeasy_windows.go +++ /dev/null @@ -1,41 +0,0 @@ -// +build windows - -package speakeasy - -import ( - "syscall" -) - -// SetConsoleMode function can be used to change value of ENABLE_ECHO_INPUT: -// http://msdn.microsoft.com/en-us/library/windows/desktop/ms686033(v=vs.85).aspx -const ENABLE_ECHO_INPUT = 0x0004 - -func getPassword() (password string, err error) { - var oldMode uint32 - - err = syscall.GetConsoleMode(syscall.Stdin, &oldMode) - if err != nil { - return - } - - var newMode uint32 = (oldMode &^ ENABLE_ECHO_INPUT) - - err = setConsoleMode(syscall.Stdin, newMode) - defer setConsoleMode(syscall.Stdin, oldMode) - if err != nil { - return - } - - return readline() -} - -func setConsoleMode(console syscall.Handle, mode uint32) (err error) { - dll := syscall.MustLoadDLL("kernel32") - proc := dll.MustFindProc("SetConsoleMode") - r, _, err := proc.Call(uintptr(console), uintptr(mode)) - - if r == 0 { - return err - } - return nil -} diff --git a/vendor/github.com/blang/semver/.travis.yml b/vendor/github.com/blang/semver/.travis.yml deleted file mode 100644 index 102fb9a..0000000 --- a/vendor/github.com/blang/semver/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: go -matrix: - include: - - go: 1.4.3 - - go: 1.5.4 - - go: 1.6.3 - - go: 1.7 - - go: tip - allow_failures: - - go: tip -install: -- go get golang.org/x/tools/cmd/cover -- go get github.com/mattn/goveralls -script: -- echo "Test and track coverage" ; $HOME/gopath/bin/goveralls -package "." -service=travis-ci - -repotoken $COVERALLS_TOKEN -- echo "Build examples" ; cd examples && go build -- echo "Check if gofmt'd" ; diff -u <(echo -n) <(gofmt -d -s .) -env: - global: - secure: HroGEAUQpVq9zX1b1VIkraLiywhGbzvNnTZq2TMxgK7JHP8xqNplAeF1izrR2i4QLL9nsY+9WtYss4QuPvEtZcVHUobw6XnL6radF7jS1LgfYZ9Y7oF+zogZ2I5QUMRLGA7rcxQ05s7mKq3XZQfeqaNts4bms/eZRefWuaFZbkw= diff --git a/vendor/github.com/blang/semver/LICENSE b/vendor/github.com/blang/semver/LICENSE deleted file mode 100644 index 5ba5c86..0000000 --- a/vendor/github.com/blang/semver/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License - -Copyright (c) 2014 Benedikt Lang - -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/blang/semver/README.md b/vendor/github.com/blang/semver/README.md deleted file mode 100644 index 08b2e4a..0000000 --- a/vendor/github.com/blang/semver/README.md +++ /dev/null @@ -1,194 +0,0 @@ -semver for golang [![Build Status](https://travis-ci.org/blang/semver.svg?branch=master)](https://travis-ci.org/blang/semver) [![GoDoc](https://godoc.org/github.com/blang/semver?status.png)](https://godoc.org/github.com/blang/semver) [![Coverage Status](https://img.shields.io/coveralls/blang/semver.svg)](https://coveralls.io/r/blang/semver?branch=master) -====== - -semver is a [Semantic Versioning](http://semver.org/) library written in golang. It fully covers spec version `2.0.0`. - -Usage ------ -```bash -$ go get github.com/blang/semver -``` -Note: Always vendor your dependencies or fix on a specific version tag. - -```go -import github.com/blang/semver -v1, err := semver.Make("1.0.0-beta") -v2, err := semver.Make("2.0.0-beta") -v1.Compare(v2) -``` - -Also check the [GoDocs](http://godoc.org/github.com/blang/semver). - -Why should I use this lib? ------ - -- Fully spec compatible -- No reflection -- No regex -- Fully tested (Coverage >99%) -- Readable parsing/validation errors -- Fast (See [Benchmarks](#benchmarks)) -- Only Stdlib -- Uses values instead of pointers -- Many features, see below - - -Features ------ - -- Parsing and validation at all levels -- Comparator-like comparisons -- Compare Helper Methods -- InPlace manipulation -- Ranges `>=1.0.0 <2.0.0 || >=3.0.0 !3.0.1-beta.1` -- Wildcards `>=1.x`, `<=2.5.x` -- Sortable (implements sort.Interface) -- database/sql compatible (sql.Scanner/Valuer) -- encoding/json compatible (json.Marshaler/Unmarshaler) - -Ranges ------- - -A `Range` is a set of conditions which specify which versions satisfy the range. - -A condition is composed of an operator and a version. The supported operators are: - -- `<1.0.0` Less than `1.0.0` -- `<=1.0.0` Less than or equal to `1.0.0` -- `>1.0.0` Greater than `1.0.0` -- `>=1.0.0` Greater than or equal to `1.0.0` -- `1.0.0`, `=1.0.0`, `==1.0.0` Equal to `1.0.0` -- `!1.0.0`, `!=1.0.0` Not equal to `1.0.0`. Excludes version `1.0.0`. - -Note that spaces between the operator and the version will be gracefully tolerated. - -A `Range` can link multiple `Ranges` separated by space: - -Ranges can be linked by logical AND: - - - `>1.0.0 <2.0.0` would match between both ranges, so `1.1.1` and `1.8.7` but not `1.0.0` or `2.0.0` - - `>1.0.0 <3.0.0 !2.0.3-beta.2` would match every version between `1.0.0` and `3.0.0` except `2.0.3-beta.2` - -Ranges can also be linked by logical OR: - - - `<2.0.0 || >=3.0.0` would match `1.x.x` and `3.x.x` but not `2.x.x` - -AND has a higher precedence than OR. It's not possible to use brackets. - -Ranges can be combined by both AND and OR - - - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` - -Range usage: - -``` -v, err := semver.Parse("1.2.3") -range, err := semver.ParseRange(">1.0.0 <2.0.0 || >=3.0.0") -if range(v) { - //valid -} - -``` - -Example ------ - -Have a look at full examples in [examples/main.go](examples/main.go) - -```go -import github.com/blang/semver - -v, err := semver.Make("0.0.1-alpha.preview+123.github") -fmt.Printf("Major: %d\n", v.Major) -fmt.Printf("Minor: %d\n", v.Minor) -fmt.Printf("Patch: %d\n", v.Patch) -fmt.Printf("Pre: %s\n", v.Pre) -fmt.Printf("Build: %s\n", v.Build) - -// Prerelease versions array -if len(v.Pre) > 0 { - fmt.Println("Prerelease versions:") - for i, pre := range v.Pre { - fmt.Printf("%d: %q\n", i, pre) - } -} - -// Build meta data array -if len(v.Build) > 0 { - fmt.Println("Build meta data:") - for i, build := range v.Build { - fmt.Printf("%d: %q\n", i, build) - } -} - -v001, err := semver.Make("0.0.1") -// Compare using helpers: v.GT(v2), v.LT, v.GTE, v.LTE -v001.GT(v) == true -v.LT(v001) == true -v.GTE(v) == true -v.LTE(v) == true - -// Or use v.Compare(v2) for comparisons (-1, 0, 1): -v001.Compare(v) == 1 -v.Compare(v001) == -1 -v.Compare(v) == 0 - -// Manipulate Version in place: -v.Pre[0], err = semver.NewPRVersion("beta") -if err != nil { - fmt.Printf("Error parsing pre release version: %q", err) -} - -fmt.Println("\nValidate versions:") -v.Build[0] = "?" - -err = v.Validate() -if err != nil { - fmt.Printf("Validation failed: %s\n", err) -} -``` - - -Benchmarks ------ - - BenchmarkParseSimple-4 5000000 390 ns/op 48 B/op 1 allocs/op - BenchmarkParseComplex-4 1000000 1813 ns/op 256 B/op 7 allocs/op - BenchmarkParseAverage-4 1000000 1171 ns/op 163 B/op 4 allocs/op - BenchmarkStringSimple-4 20000000 119 ns/op 16 B/op 1 allocs/op - BenchmarkStringLarger-4 10000000 206 ns/op 32 B/op 2 allocs/op - BenchmarkStringComplex-4 5000000 324 ns/op 80 B/op 3 allocs/op - BenchmarkStringAverage-4 5000000 273 ns/op 53 B/op 2 allocs/op - BenchmarkValidateSimple-4 200000000 9.33 ns/op 0 B/op 0 allocs/op - BenchmarkValidateComplex-4 3000000 469 ns/op 0 B/op 0 allocs/op - BenchmarkValidateAverage-4 5000000 256 ns/op 0 B/op 0 allocs/op - BenchmarkCompareSimple-4 100000000 11.8 ns/op 0 B/op 0 allocs/op - BenchmarkCompareComplex-4 50000000 30.8 ns/op 0 B/op 0 allocs/op - BenchmarkCompareAverage-4 30000000 41.5 ns/op 0 B/op 0 allocs/op - BenchmarkSort-4 3000000 419 ns/op 256 B/op 2 allocs/op - BenchmarkRangeParseSimple-4 2000000 850 ns/op 192 B/op 5 allocs/op - BenchmarkRangeParseAverage-4 1000000 1677 ns/op 400 B/op 10 allocs/op - BenchmarkRangeParseComplex-4 300000 5214 ns/op 1440 B/op 30 allocs/op - BenchmarkRangeMatchSimple-4 50000000 25.6 ns/op 0 B/op 0 allocs/op - BenchmarkRangeMatchAverage-4 30000000 56.4 ns/op 0 B/op 0 allocs/op - BenchmarkRangeMatchComplex-4 10000000 153 ns/op 0 B/op 0 allocs/op - -See benchmark cases at [semver_test.go](semver_test.go) - - -Motivation ------ - -I simply couldn't find any lib supporting the full spec. Others were just wrong or used reflection and regex which i don't like. - - -Contribution ------ - -Feel free to make a pull request. For bigger changes create a issue first to discuss about it. - - -License ------ - -See [LICENSE](LICENSE) file. diff --git a/vendor/github.com/blang/semver/json.go b/vendor/github.com/blang/semver/json.go deleted file mode 100644 index a74bf7c..0000000 --- a/vendor/github.com/blang/semver/json.go +++ /dev/null @@ -1,23 +0,0 @@ -package semver - -import ( - "encoding/json" -) - -// MarshalJSON implements the encoding/json.Marshaler interface. -func (v Version) MarshalJSON() ([]byte, error) { - return json.Marshal(v.String()) -} - -// UnmarshalJSON implements the encoding/json.Unmarshaler interface. -func (v *Version) UnmarshalJSON(data []byte) (err error) { - var versionString string - - if err = json.Unmarshal(data, &versionString); err != nil { - return - } - - *v, err = Parse(versionString) - - return -} diff --git a/vendor/github.com/blang/semver/json_test.go b/vendor/github.com/blang/semver/json_test.go deleted file mode 100644 index c635dea..0000000 --- a/vendor/github.com/blang/semver/json_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package semver - -import ( - "encoding/json" - "strconv" - "testing" -) - -func TestJSONMarshal(t *testing.T) { - versionString := "3.1.4-alpha.1.5.9+build.2.6.5" - v, err := Parse(versionString) - if err != nil { - t.Fatal(err) - } - - versionJSON, err := json.Marshal(v) - if err != nil { - t.Fatal(err) - } - - quotedVersionString := strconv.Quote(versionString) - - if string(versionJSON) != quotedVersionString { - t.Fatalf("JSON marshaled semantic version not equal: expected %q, got %q", quotedVersionString, string(versionJSON)) - } -} - -func TestJSONUnmarshal(t *testing.T) { - versionString := "3.1.4-alpha.1.5.9+build.2.6.5" - quotedVersionString := strconv.Quote(versionString) - - var v Version - if err := json.Unmarshal([]byte(quotedVersionString), &v); err != nil { - t.Fatal(err) - } - - if v.String() != versionString { - t.Fatalf("JSON unmarshaled semantic version not equal: expected %q, got %q", versionString, v.String()) - } - - badVersionString := strconv.Quote("3.1.4.1.5.9.2.6.5-other-digits-of-pi") - if err := json.Unmarshal([]byte(badVersionString), &v); err == nil { - t.Fatal("expected JSON unmarshal error, got nil") - } - - if err := json.Unmarshal([]byte("3.1"), &v); err == nil { - t.Fatal("expected JSON unmarshal error, got nil") - } -} diff --git a/vendor/github.com/blang/semver/package.json b/vendor/github.com/blang/semver/package.json deleted file mode 100644 index 1cf8ebd..0000000 --- a/vendor/github.com/blang/semver/package.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "author": "blang", - "bugs": { - "URL": "https://github.com/blang/semver/issues", - "url": "https://github.com/blang/semver/issues" - }, - "gx": { - "dvcsimport": "github.com/blang/semver" - }, - "gxVersion": "0.10.0", - "language": "go", - "license": "MIT", - "name": "semver", - "releaseCmd": "git commit -a -m \"gx publish $VERSION\"", - "version": "3.5.1" -} - diff --git a/vendor/github.com/blang/semver/range.go b/vendor/github.com/blang/semver/range.go deleted file mode 100644 index fca406d..0000000 --- a/vendor/github.com/blang/semver/range.go +++ /dev/null @@ -1,416 +0,0 @@ -package semver - -import ( - "fmt" - "strconv" - "strings" - "unicode" -) - -type wildcardType int - -const ( - noneWildcard wildcardType = iota - majorWildcard wildcardType = 1 - minorWildcard wildcardType = 2 - patchWildcard wildcardType = 3 -) - -func wildcardTypefromInt(i int) wildcardType { - switch i { - case 1: - return majorWildcard - case 2: - return minorWildcard - case 3: - return patchWildcard - default: - return noneWildcard - } -} - -type comparator func(Version, Version) bool - -var ( - compEQ comparator = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == 0 - } - compNE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) != 0 - } - compGT = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == 1 - } - compGE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) >= 0 - } - compLT = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) == -1 - } - compLE = func(v1 Version, v2 Version) bool { - return v1.Compare(v2) <= 0 - } -) - -type versionRange struct { - v Version - c comparator -} - -// rangeFunc creates a Range from the given versionRange. -func (vr *versionRange) rangeFunc() Range { - return Range(func(v Version) bool { - return vr.c(v, vr.v) - }) -} - -// Range represents a range of versions. -// A Range can be used to check if a Version satisfies it: -// -// range, err := semver.ParseRange(">1.0.0 <2.0.0") -// range(semver.MustParse("1.1.1") // returns true -type Range func(Version) bool - -// OR combines the existing Range with another Range using logical OR. -func (rf Range) OR(f Range) Range { - return Range(func(v Version) bool { - return rf(v) || f(v) - }) -} - -// AND combines the existing Range with another Range using logical AND. -func (rf Range) AND(f Range) Range { - return Range(func(v Version) bool { - return rf(v) && f(v) - }) -} - -// ParseRange parses a range and returns a Range. -// If the range could not be parsed an error is returned. -// -// Valid ranges are: -// - "<1.0.0" -// - "<=1.0.0" -// - ">1.0.0" -// - ">=1.0.0" -// - "1.0.0", "=1.0.0", "==1.0.0" -// - "!1.0.0", "!=1.0.0" -// -// A Range can consist of multiple ranges separated by space: -// Ranges can be linked by logical AND: -// - ">1.0.0 <2.0.0" would match between both ranges, so "1.1.1" and "1.8.7" but not "1.0.0" or "2.0.0" -// - ">1.0.0 <3.0.0 !2.0.3-beta.2" would match every version between 1.0.0 and 3.0.0 except 2.0.3-beta.2 -// -// Ranges can also be linked by logical OR: -// - "<2.0.0 || >=3.0.0" would match "1.x.x" and "3.x.x" but not "2.x.x" -// -// AND has a higher precedence than OR. It's not possible to use brackets. -// -// Ranges can be combined by both AND and OR -// -// - `>1.0.0 <2.0.0 || >3.0.0 !4.2.1` would match `1.2.3`, `1.9.9`, `3.1.1`, but not `4.2.1`, `2.1.1` -func ParseRange(s string) (Range, error) { - parts := splitAndTrim(s) - orParts, err := splitORParts(parts) - if err != nil { - return nil, err - } - expandedParts, err := expandWildcardVersion(orParts) - if err != nil { - return nil, err - } - var orFn Range - for _, p := range expandedParts { - var andFn Range - for _, ap := range p { - opStr, vStr, err := splitComparatorVersion(ap) - if err != nil { - return nil, err - } - vr, err := buildVersionRange(opStr, vStr) - if err != nil { - return nil, fmt.Errorf("Could not parse Range %q: %s", ap, err) - } - rf := vr.rangeFunc() - - // Set function - if andFn == nil { - andFn = rf - } else { // Combine with existing function - andFn = andFn.AND(rf) - } - } - if orFn == nil { - orFn = andFn - } else { - orFn = orFn.OR(andFn) - } - - } - return orFn, nil -} - -// splitORParts splits the already cleaned parts by '||'. -// Checks for invalid positions of the operator and returns an -// error if found. -func splitORParts(parts []string) ([][]string, error) { - var ORparts [][]string - last := 0 - for i, p := range parts { - if p == "||" { - if i == 0 { - return nil, fmt.Errorf("First element in range is '||'") - } - ORparts = append(ORparts, parts[last:i]) - last = i + 1 - } - } - if last == len(parts) { - return nil, fmt.Errorf("Last element in range is '||'") - } - ORparts = append(ORparts, parts[last:]) - return ORparts, nil -} - -// buildVersionRange takes a slice of 2: operator and version -// and builds a versionRange, otherwise an error. -func buildVersionRange(opStr, vStr string) (*versionRange, error) { - c := parseComparator(opStr) - if c == nil { - return nil, fmt.Errorf("Could not parse comparator %q in %q", opStr, strings.Join([]string{opStr, vStr}, "")) - } - v, err := Parse(vStr) - if err != nil { - return nil, fmt.Errorf("Could not parse version %q in %q: %s", vStr, strings.Join([]string{opStr, vStr}, ""), err) - } - - return &versionRange{ - v: v, - c: c, - }, nil - -} - -// inArray checks if a byte is contained in an array of bytes -func inArray(s byte, list []byte) bool { - for _, el := range list { - if el == s { - return true - } - } - return false -} - -// splitAndTrim splits a range string by spaces and cleans whitespaces -func splitAndTrim(s string) (result []string) { - last := 0 - var lastChar byte - excludeFromSplit := []byte{'>', '<', '='} - for i := 0; i < len(s); i++ { - if s[i] == ' ' && !inArray(lastChar, excludeFromSplit) { - if last < i-1 { - result = append(result, s[last:i]) - } - last = i + 1 - } else if s[i] != ' ' { - lastChar = s[i] - } - } - if last < len(s)-1 { - result = append(result, s[last:]) - } - - for i, v := range result { - result[i] = strings.Replace(v, " ", "", -1) - } - - // parts := strings.Split(s, " ") - // for _, x := range parts { - // if s := strings.TrimSpace(x); len(s) != 0 { - // result = append(result, s) - // } - // } - return -} - -// splitComparatorVersion splits the comparator from the version. -// Input must be free of leading or trailing spaces. -func splitComparatorVersion(s string) (string, string, error) { - i := strings.IndexFunc(s, unicode.IsDigit) - if i == -1 { - return "", "", fmt.Errorf("Could not get version from string: %q", s) - } - return strings.TrimSpace(s[0:i]), s[i:], nil -} - -// getWildcardType will return the type of wildcard that the -// passed version contains -func getWildcardType(vStr string) wildcardType { - parts := strings.Split(vStr, ".") - nparts := len(parts) - wildcard := parts[nparts-1] - - possibleWildcardType := wildcardTypefromInt(nparts) - if wildcard == "x" { - return possibleWildcardType - } - - return noneWildcard -} - -// createVersionFromWildcard will convert a wildcard version -// into a regular version, replacing 'x's with '0's, handling -// special cases like '1.x.x' and '1.x' -func createVersionFromWildcard(vStr string) string { - // handle 1.x.x - vStr2 := strings.Replace(vStr, ".x.x", ".x", 1) - vStr2 = strings.Replace(vStr2, ".x", ".0", 1) - parts := strings.Split(vStr2, ".") - - // handle 1.x - if len(parts) == 2 { - return vStr2 + ".0" - } - - return vStr2 -} - -// incrementMajorVersion will increment the major version -// of the passed version -func incrementMajorVersion(vStr string) (string, error) { - parts := strings.Split(vStr, ".") - i, err := strconv.Atoi(parts[0]) - if err != nil { - return "", err - } - parts[0] = strconv.Itoa(i + 1) - - return strings.Join(parts, "."), nil -} - -// incrementMajorVersion will increment the minor version -// of the passed version -func incrementMinorVersion(vStr string) (string, error) { - parts := strings.Split(vStr, ".") - i, err := strconv.Atoi(parts[1]) - if err != nil { - return "", err - } - parts[1] = strconv.Itoa(i + 1) - - return strings.Join(parts, "."), nil -} - -// expandWildcardVersion will expand wildcards inside versions -// following these rules: -// -// * when dealing with patch wildcards: -// >= 1.2.x will become >= 1.2.0 -// <= 1.2.x will become < 1.3.0 -// > 1.2.x will become >= 1.3.0 -// < 1.2.x will become < 1.2.0 -// != 1.2.x will become < 1.2.0 >= 1.3.0 -// -// * when dealing with minor wildcards: -// >= 1.x will become >= 1.0.0 -// <= 1.x will become < 2.0.0 -// > 1.x will become >= 2.0.0 -// < 1.0 will become < 1.0.0 -// != 1.x will become < 1.0.0 >= 2.0.0 -// -// * when dealing with wildcards without -// version operator: -// 1.2.x will become >= 1.2.0 < 1.3.0 -// 1.x will become >= 1.0.0 < 2.0.0 -func expandWildcardVersion(parts [][]string) ([][]string, error) { - var expandedParts [][]string - for _, p := range parts { - var newParts []string - for _, ap := range p { - if strings.Index(ap, "x") != -1 { - opStr, vStr, err := splitComparatorVersion(ap) - if err != nil { - return nil, err - } - - versionWildcardType := getWildcardType(vStr) - flatVersion := createVersionFromWildcard(vStr) - - var resultOperator string - var shouldIncrementVersion bool - switch opStr { - case ">": - resultOperator = ">=" - shouldIncrementVersion = true - case ">=": - resultOperator = ">=" - case "<": - resultOperator = "<" - case "<=": - resultOperator = "<" - shouldIncrementVersion = true - case "", "=", "==": - newParts = append(newParts, ">="+flatVersion) - resultOperator = "<" - shouldIncrementVersion = true - case "!=", "!": - newParts = append(newParts, "<"+flatVersion) - resultOperator = ">=" - shouldIncrementVersion = true - } - - var resultVersion string - if shouldIncrementVersion { - switch versionWildcardType { - case patchWildcard: - resultVersion, _ = incrementMinorVersion(flatVersion) - case minorWildcard: - resultVersion, _ = incrementMajorVersion(flatVersion) - } - } else { - resultVersion = flatVersion - } - - ap = resultOperator + resultVersion - } - newParts = append(newParts, ap) - } - expandedParts = append(expandedParts, newParts) - } - - return expandedParts, nil -} - -func parseComparator(s string) comparator { - switch s { - case "==": - fallthrough - case "": - fallthrough - case "=": - return compEQ - case ">": - return compGT - case ">=": - return compGE - case "<": - return compLT - case "<=": - return compLE - case "!": - fallthrough - case "!=": - return compNE - } - - return nil -} - -// MustParseRange is like ParseRange but panics if the range cannot be parsed. -func MustParseRange(s string) Range { - r, err := ParseRange(s) - if err != nil { - panic(`semver: ParseRange(` + s + `): ` + err.Error()) - } - return r -} diff --git a/vendor/github.com/blang/semver/range_test.go b/vendor/github.com/blang/semver/range_test.go deleted file mode 100644 index 83ee9c7..0000000 --- a/vendor/github.com/blang/semver/range_test.go +++ /dev/null @@ -1,581 +0,0 @@ -package semver - -import ( - "reflect" - "strings" - "testing" -) - -type wildcardTypeTest struct { - input string - wildcardType wildcardType -} - -type comparatorTest struct { - input string - comparator func(comparator) bool -} - -func TestParseComparator(t *testing.T) { - compatorTests := []comparatorTest{ - {">", testGT}, - {">=", testGE}, - {"<", testLT}, - {"<=", testLE}, - {"", testEQ}, - {"=", testEQ}, - {"==", testEQ}, - {"!=", testNE}, - {"!", testNE}, - {"-", nil}, - {"<==", nil}, - {"<<", nil}, - {">>", nil}, - } - - for _, tc := range compatorTests { - if c := parseComparator(tc.input); c == nil { - if tc.comparator != nil { - t.Errorf("Comparator nil for case %q\n", tc.input) - } - } else if !tc.comparator(c) { - t.Errorf("Invalid comparator for case %q\n", tc.input) - } - } -} - -var ( - v1 = MustParse("1.2.2") - v2 = MustParse("1.2.3") - v3 = MustParse("1.2.4") -) - -func testEQ(f comparator) bool { - return f(v1, v1) && !f(v1, v2) -} - -func testNE(f comparator) bool { - return !f(v1, v1) && f(v1, v2) -} - -func testGT(f comparator) bool { - return f(v2, v1) && f(v3, v2) && !f(v1, v2) && !f(v1, v1) -} - -func testGE(f comparator) bool { - return f(v2, v1) && f(v3, v2) && !f(v1, v2) -} - -func testLT(f comparator) bool { - return f(v1, v2) && f(v2, v3) && !f(v2, v1) && !f(v1, v1) -} - -func testLE(f comparator) bool { - return f(v1, v2) && f(v2, v3) && !f(v2, v1) -} - -func TestSplitAndTrim(t *testing.T) { - tests := []struct { - i string - s []string - }{ - {"1.2.3 1.2.3", []string{"1.2.3", "1.2.3"}}, - {" 1.2.3 1.2.3 ", []string{"1.2.3", "1.2.3"}}, // Spaces - {" >= 1.2.3 <= 1.2.3 ", []string{">=1.2.3", "<=1.2.3"}}, // Spaces between operator and version - {"1.2.3 || >=1.2.3 <1.2.3", []string{"1.2.3", "||", ">=1.2.3", "<1.2.3"}}, - {" 1.2.3 || >=1.2.3 <1.2.3 ", []string{"1.2.3", "||", ">=1.2.3", "<1.2.3"}}, - } - - for _, tc := range tests { - p := splitAndTrim(tc.i) - if !reflect.DeepEqual(p, tc.s) { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.s, p) - } - } -} - -func TestSplitComparatorVersion(t *testing.T) { - tests := []struct { - i string - p []string - }{ - {">1.2.3", []string{">", "1.2.3"}}, - {">=1.2.3", []string{">=", "1.2.3"}}, - {"<1.2.3", []string{"<", "1.2.3"}}, - {"<=1.2.3", []string{"<=", "1.2.3"}}, - {"1.2.3", []string{"", "1.2.3"}}, - {"=1.2.3", []string{"=", "1.2.3"}}, - {"==1.2.3", []string{"==", "1.2.3"}}, - {"!=1.2.3", []string{"!=", "1.2.3"}}, - {"!1.2.3", []string{"!", "1.2.3"}}, - {"error", nil}, - } - for _, tc := range tests { - if op, v, err := splitComparatorVersion(tc.i); err != nil { - if tc.p != nil { - t.Errorf("Invalid for case %q: Expected %q, got error %q", tc.i, tc.p, err) - } - } else if op != tc.p[0] { - t.Errorf("Invalid operator for case %q: Expected %q, got: %q", tc.i, tc.p[0], op) - } else if v != tc.p[1] { - t.Errorf("Invalid version for case %q: Expected %q, got: %q", tc.i, tc.p[1], v) - } - - } -} - -func TestBuildVersionRange(t *testing.T) { - tests := []struct { - opStr string - vStr string - c func(comparator) bool - v string - }{ - {">", "1.2.3", testGT, "1.2.3"}, - {">=", "1.2.3", testGE, "1.2.3"}, - {"<", "1.2.3", testLT, "1.2.3"}, - {"<=", "1.2.3", testLE, "1.2.3"}, - {"", "1.2.3", testEQ, "1.2.3"}, - {"=", "1.2.3", testEQ, "1.2.3"}, - {"==", "1.2.3", testEQ, "1.2.3"}, - {"!=", "1.2.3", testNE, "1.2.3"}, - {"!", "1.2.3", testNE, "1.2.3"}, - {">>", "1.2.3", nil, ""}, // Invalid comparator - {"=", "invalid", nil, ""}, // Invalid version - } - - for _, tc := range tests { - if r, err := buildVersionRange(tc.opStr, tc.vStr); err != nil { - if tc.c != nil { - t.Errorf("Invalid for case %q: Expected %q, got error %q", strings.Join([]string{tc.opStr, tc.vStr}, ""), tc.v, err) - } - } else if r == nil { - t.Errorf("Invalid for case %q: got nil", strings.Join([]string{tc.opStr, tc.vStr}, "")) - } else { - // test version - if tv := MustParse(tc.v); !r.v.EQ(tv) { - t.Errorf("Invalid for case %q: Expected version %q, got: %q", strings.Join([]string{tc.opStr, tc.vStr}, ""), tv, r.v) - } - // test comparator - if r.c == nil { - t.Errorf("Invalid for case %q: got nil comparator", strings.Join([]string{tc.opStr, tc.vStr}, "")) - continue - } - if !tc.c(r.c) { - t.Errorf("Invalid comparator for case %q\n", strings.Join([]string{tc.opStr, tc.vStr}, "")) - } - } - } - -} - -func TestSplitORParts(t *testing.T) { - tests := []struct { - i []string - o [][]string - }{ - {[]string{">1.2.3", "||", "<1.2.3", "||", "=1.2.3"}, [][]string{ - []string{">1.2.3"}, - []string{"<1.2.3"}, - []string{"=1.2.3"}, - }}, - {[]string{">1.2.3", "<1.2.3", "||", "=1.2.3"}, [][]string{ - []string{">1.2.3", "<1.2.3"}, - []string{"=1.2.3"}, - }}, - {[]string{">1.2.3", "||"}, nil}, - {[]string{"||", ">1.2.3"}, nil}, - } - for _, tc := range tests { - o, err := splitORParts(tc.i) - if err != nil && tc.o != nil { - t.Errorf("Unexpected error for case %q: %s", tc.i, err) - } - if !reflect.DeepEqual(tc.o, o) { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.o, o) - } - } -} - -func TestGetWildcardType(t *testing.T) { - wildcardTypeTests := []wildcardTypeTest{ - {"x", majorWildcard}, - {"1.x", minorWildcard}, - {"1.2.x", patchWildcard}, - {"fo.o.b.ar", noneWildcard}, - } - - for _, tc := range wildcardTypeTests { - o := getWildcardType(tc.input) - if o != tc.wildcardType { - t.Errorf("Invalid for case: %q: Expected %q, got: %q", tc.input, tc.wildcardType, o) - } - } -} - -func TestCreateVersionFromWildcard(t *testing.T) { - tests := []struct { - i string - s string - }{ - {"1.2.x", "1.2.0"}, - {"1.x", "1.0.0"}, - } - - for _, tc := range tests { - p := createVersionFromWildcard(tc.i) - if p != tc.s { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.s, p) - } - } -} - -func TestIncrementMajorVersion(t *testing.T) { - tests := []struct { - i string - s string - }{ - {"1.2.3", "2.2.3"}, - {"1.2", "2.2"}, - {"foo.bar", ""}, - } - - for _, tc := range tests { - p, _ := incrementMajorVersion(tc.i) - if p != tc.s { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.s, p) - } - } -} - -func TestIncrementMinorVersion(t *testing.T) { - tests := []struct { - i string - s string - }{ - {"1.2.3", "1.3.3"}, - {"1.2", "1.3"}, - {"foo.bar", ""}, - } - - for _, tc := range tests { - p, _ := incrementMinorVersion(tc.i) - if p != tc.s { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.s, p) - } - } -} - -func TestExpandWildcardVersion(t *testing.T) { - tests := []struct { - i [][]string - o [][]string - }{ - {[][]string{[]string{"foox"}}, nil}, - {[][]string{[]string{">=1.2.x"}}, [][]string{[]string{">=1.2.0"}}}, - {[][]string{[]string{"<=1.2.x"}}, [][]string{[]string{"<1.3.0"}}}, - {[][]string{[]string{">1.2.x"}}, [][]string{[]string{">=1.3.0"}}}, - {[][]string{[]string{"<1.2.x"}}, [][]string{[]string{"<1.2.0"}}}, - {[][]string{[]string{"!=1.2.x"}}, [][]string{[]string{"<1.2.0", ">=1.3.0"}}}, - {[][]string{[]string{">=1.x"}}, [][]string{[]string{">=1.0.0"}}}, - {[][]string{[]string{"<=1.x"}}, [][]string{[]string{"<2.0.0"}}}, - {[][]string{[]string{">1.x"}}, [][]string{[]string{">=2.0.0"}}}, - {[][]string{[]string{"<1.x"}}, [][]string{[]string{"<1.0.0"}}}, - {[][]string{[]string{"!=1.x"}}, [][]string{[]string{"<1.0.0", ">=2.0.0"}}}, - {[][]string{[]string{"1.2.x"}}, [][]string{[]string{">=1.2.0", "<1.3.0"}}}, - {[][]string{[]string{"1.x"}}, [][]string{[]string{">=1.0.0", "<2.0.0"}}}, - } - - for _, tc := range tests { - o, _ := expandWildcardVersion(tc.i) - if !reflect.DeepEqual(tc.o, o) { - t.Errorf("Invalid for case %q: Expected %q, got: %q", tc.i, tc.o, o) - } - } -} - -func TestVersionRangeToRange(t *testing.T) { - vr := versionRange{ - v: MustParse("1.2.3"), - c: compLT, - } - rf := vr.rangeFunc() - if !rf(MustParse("1.2.2")) || rf(MustParse("1.2.3")) { - t.Errorf("Invalid conversion to range func") - } -} - -func TestRangeAND(t *testing.T) { - v := MustParse("1.2.2") - v1 := MustParse("1.2.1") - v2 := MustParse("1.2.3") - rf1 := Range(func(v Version) bool { - return v.GT(v1) - }) - rf2 := Range(func(v Version) bool { - return v.LT(v2) - }) - rf := rf1.AND(rf2) - if rf(v1) { - t.Errorf("Invalid rangefunc, accepted: %s", v1) - } - if rf(v2) { - t.Errorf("Invalid rangefunc, accepted: %s", v2) - } - if !rf(v) { - t.Errorf("Invalid rangefunc, did not accept: %s", v) - } -} - -func TestRangeOR(t *testing.T) { - tests := []struct { - v Version - b bool - }{ - {MustParse("1.2.0"), true}, - {MustParse("1.2.2"), false}, - {MustParse("1.2.4"), true}, - } - v1 := MustParse("1.2.1") - v2 := MustParse("1.2.3") - rf1 := Range(func(v Version) bool { - return v.LT(v1) - }) - rf2 := Range(func(v Version) bool { - return v.GT(v2) - }) - rf := rf1.OR(rf2) - for _, tc := range tests { - if r := rf(tc.v); r != tc.b { - t.Errorf("Invalid for case %q: Expected %t, got %t", tc.v, tc.b, r) - } - } -} - -func TestParseRange(t *testing.T) { - type tv struct { - v string - b bool - } - tests := []struct { - i string - t []tv - }{ - // Simple expressions - {">1.2.3", []tv{ - {"1.2.2", false}, - {"1.2.3", false}, - {"1.2.4", true}, - }}, - {">=1.2.3", []tv{ - {"1.2.3", true}, - {"1.2.4", true}, - {"1.2.2", false}, - }}, - {"<1.2.3", []tv{ - {"1.2.2", true}, - {"1.2.3", false}, - {"1.2.4", false}, - }}, - {"<=1.2.3", []tv{ - {"1.2.2", true}, - {"1.2.3", true}, - {"1.2.4", false}, - }}, - {"1.2.3", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - }}, - {"=1.2.3", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - }}, - {"==1.2.3", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - }}, - {"!=1.2.3", []tv{ - {"1.2.2", true}, - {"1.2.3", false}, - {"1.2.4", true}, - }}, - {"!1.2.3", []tv{ - {"1.2.2", true}, - {"1.2.3", false}, - {"1.2.4", true}, - }}, - // Simple Expression errors - {">>1.2.3", nil}, - {"!1.2.3", nil}, - {"1.0", nil}, - {"string", nil}, - {"", nil}, - {"fo.ob.ar.x", nil}, - // AND Expressions - {">1.2.2 <1.2.4", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - }}, - {"<1.2.2 <1.2.4", []tv{ - {"1.2.1", true}, - {"1.2.2", false}, - {"1.2.3", false}, - {"1.2.4", false}, - }}, - {">1.2.2 <1.2.5 !=1.2.4", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - {"1.2.5", false}, - }}, - {">1.2.2 <1.2.5 !1.2.4", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - {"1.2.5", false}, - }}, - // OR Expressions - {">1.2.2 || <1.2.4", []tv{ - {"1.2.2", true}, - {"1.2.3", true}, - {"1.2.4", true}, - }}, - {"<1.2.2 || >1.2.4", []tv{ - {"1.2.2", false}, - {"1.2.3", false}, - {"1.2.4", false}, - }}, - // Wildcard expressions - {">1.x", []tv{ - {"0.1.9", false}, - {"1.2.6", false}, - {"1.9.0", false}, - {"2.0.0", true}, - }}, - {">1.2.x", []tv{ - {"1.1.9", false}, - {"1.2.6", false}, - {"1.3.0", true}, - }}, - // Combined Expressions - {">1.2.2 <1.2.4 || >=2.0.0", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - {"2.0.0", true}, - {"2.0.1", true}, - }}, - {"1.x || >=2.0.x <2.2.x", []tv{ - {"0.9.2", false}, - {"1.2.2", true}, - {"2.0.0", true}, - {"2.1.8", true}, - {"2.2.0", false}, - }}, - {">1.2.2 <1.2.4 || >=2.0.0 <3.0.0", []tv{ - {"1.2.2", false}, - {"1.2.3", true}, - {"1.2.4", false}, - {"2.0.0", true}, - {"2.0.1", true}, - {"2.9.9", true}, - {"3.0.0", false}, - }}, - } - - for _, tc := range tests { - r, err := ParseRange(tc.i) - if err != nil && tc.t != nil { - t.Errorf("Error parsing range %q: %s", tc.i, err) - continue - } - for _, tvc := range tc.t { - v := MustParse(tvc.v) - if res := r(v); res != tvc.b { - t.Errorf("Invalid for case %q matching %q: Expected %t, got: %t", tc.i, tvc.v, tvc.b, res) - } - } - - } -} - -func TestMustParseRange(t *testing.T) { - testCase := ">1.2.2 <1.2.4 || >=2.0.0 <3.0.0" - r := MustParseRange(testCase) - if !r(MustParse("1.2.3")) { - t.Errorf("Unexpected range behavior on MustParseRange") - } -} - -func TestMustParseRange_panic(t *testing.T) { - defer func() { - if recover() == nil { - t.Errorf("Should have panicked") - } - }() - _ = MustParseRange("invalid version") -} - -func BenchmarkRangeParseSimple(b *testing.B) { - const VERSION = ">1.0.0" - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - ParseRange(VERSION) - } -} - -func BenchmarkRangeParseAverage(b *testing.B) { - const VERSION = ">=1.0.0 <2.0.0" - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - ParseRange(VERSION) - } -} - -func BenchmarkRangeParseComplex(b *testing.B) { - const VERSION = ">=1.0.0 <2.0.0 || >=3.0.1 <4.0.0 !=3.0.3 || >=5.0.0" - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - ParseRange(VERSION) - } -} - -func BenchmarkRangeMatchSimple(b *testing.B) { - const VERSION = ">1.0.0" - r, _ := ParseRange(VERSION) - v := MustParse("2.0.0") - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - r(v) - } -} - -func BenchmarkRangeMatchAverage(b *testing.B) { - const VERSION = ">=1.0.0 <2.0.0" - r, _ := ParseRange(VERSION) - v := MustParse("1.2.3") - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - r(v) - } -} - -func BenchmarkRangeMatchComplex(b *testing.B) { - const VERSION = ">=1.0.0 <2.0.0 || >=3.0.1 <4.0.0 !=3.0.3 || >=5.0.0" - r, _ := ParseRange(VERSION) - v := MustParse("5.0.1") - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - r(v) - } -} diff --git a/vendor/github.com/blang/semver/semver.go b/vendor/github.com/blang/semver/semver.go deleted file mode 100644 index 8ee0842..0000000 --- a/vendor/github.com/blang/semver/semver.go +++ /dev/null @@ -1,418 +0,0 @@ -package semver - -import ( - "errors" - "fmt" - "strconv" - "strings" -) - -const ( - numbers string = "0123456789" - alphas = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-" - alphanum = alphas + numbers -) - -// SpecVersion is the latest fully supported spec version of semver -var SpecVersion = Version{ - Major: 2, - Minor: 0, - Patch: 0, -} - -// Version represents a semver compatible version -type Version struct { - Major uint64 - Minor uint64 - Patch uint64 - Pre []PRVersion - Build []string //No Precendence -} - -// Version to string -func (v Version) String() string { - b := make([]byte, 0, 5) - b = strconv.AppendUint(b, v.Major, 10) - b = append(b, '.') - b = strconv.AppendUint(b, v.Minor, 10) - b = append(b, '.') - b = strconv.AppendUint(b, v.Patch, 10) - - if len(v.Pre) > 0 { - b = append(b, '-') - b = append(b, v.Pre[0].String()...) - - for _, pre := range v.Pre[1:] { - b = append(b, '.') - b = append(b, pre.String()...) - } - } - - if len(v.Build) > 0 { - b = append(b, '+') - b = append(b, v.Build[0]...) - - for _, build := range v.Build[1:] { - b = append(b, '.') - b = append(b, build...) - } - } - - return string(b) -} - -// Equals checks if v is equal to o. -func (v Version) Equals(o Version) bool { - return (v.Compare(o) == 0) -} - -// EQ checks if v is equal to o. -func (v Version) EQ(o Version) bool { - return (v.Compare(o) == 0) -} - -// NE checks if v is not equal to o. -func (v Version) NE(o Version) bool { - return (v.Compare(o) != 0) -} - -// GT checks if v is greater than o. -func (v Version) GT(o Version) bool { - return (v.Compare(o) == 1) -} - -// GTE checks if v is greater than or equal to o. -func (v Version) GTE(o Version) bool { - return (v.Compare(o) >= 0) -} - -// GE checks if v is greater than or equal to o. -func (v Version) GE(o Version) bool { - return (v.Compare(o) >= 0) -} - -// LT checks if v is less than o. -func (v Version) LT(o Version) bool { - return (v.Compare(o) == -1) -} - -// LTE checks if v is less than or equal to o. -func (v Version) LTE(o Version) bool { - return (v.Compare(o) <= 0) -} - -// LE checks if v is less than or equal to o. -func (v Version) LE(o Version) bool { - return (v.Compare(o) <= 0) -} - -// Compare compares Versions v to o: -// -1 == v is less than o -// 0 == v is equal to o -// 1 == v is greater than o -func (v Version) Compare(o Version) int { - if v.Major != o.Major { - if v.Major > o.Major { - return 1 - } - return -1 - } - if v.Minor != o.Minor { - if v.Minor > o.Minor { - return 1 - } - return -1 - } - if v.Patch != o.Patch { - if v.Patch > o.Patch { - return 1 - } - return -1 - } - - // Quick comparison if a version has no prerelease versions - if len(v.Pre) == 0 && len(o.Pre) == 0 { - return 0 - } else if len(v.Pre) == 0 && len(o.Pre) > 0 { - return 1 - } else if len(v.Pre) > 0 && len(o.Pre) == 0 { - return -1 - } - - i := 0 - for ; i < len(v.Pre) && i < len(o.Pre); i++ { - if comp := v.Pre[i].Compare(o.Pre[i]); comp == 0 { - continue - } else if comp == 1 { - return 1 - } else { - return -1 - } - } - - // If all pr versions are the equal but one has further prversion, this one greater - if i == len(v.Pre) && i == len(o.Pre) { - return 0 - } else if i == len(v.Pre) && i < len(o.Pre) { - return -1 - } else { - return 1 - } - -} - -// Validate validates v and returns error in case -func (v Version) Validate() error { - // Major, Minor, Patch already validated using uint64 - - for _, pre := range v.Pre { - if !pre.IsNum { //Numeric prerelease versions already uint64 - if len(pre.VersionStr) == 0 { - return fmt.Errorf("Prerelease can not be empty %q", pre.VersionStr) - } - if !containsOnly(pre.VersionStr, alphanum) { - return fmt.Errorf("Invalid character(s) found in prerelease %q", pre.VersionStr) - } - } - } - - for _, build := range v.Build { - if len(build) == 0 { - return fmt.Errorf("Build meta data can not be empty %q", build) - } - if !containsOnly(build, alphanum) { - return fmt.Errorf("Invalid character(s) found in build meta data %q", build) - } - } - - return nil -} - -// New is an alias for Parse and returns a pointer, parses version string and returns a validated Version or error -func New(s string) (vp *Version, err error) { - v, err := Parse(s) - vp = &v - return -} - -// Make is an alias for Parse, parses version string and returns a validated Version or error -func Make(s string) (Version, error) { - return Parse(s) -} - -// ParseTolerant allows for certain version specifications that do not strictly adhere to semver -// specs to be parsed by this library. It does so by normalizing versions before passing them to -// Parse(). It currently trims spaces, removes a "v" prefix, and adds a 0 patch number to versions -// with only major and minor components specified -func ParseTolerant(s string) (Version, error) { - s = strings.TrimSpace(s) - s = strings.TrimPrefix(s, "v") - - // Split into major.minor.(patch+pr+meta) - parts := strings.SplitN(s, ".", 3) - if len(parts) < 3 { - if strings.ContainsAny(parts[len(parts)-1], "+-") { - return Version{}, errors.New("Short version cannot contain PreRelease/Build meta data") - } - for len(parts) < 3 { - parts = append(parts, "0") - } - s = strings.Join(parts, ".") - } - - return Parse(s) -} - -// Parse parses version string and returns a validated Version or error -func Parse(s string) (Version, error) { - if len(s) == 0 { - return Version{}, errors.New("Version string empty") - } - - // Split into major.minor.(patch+pr+meta) - parts := strings.SplitN(s, ".", 3) - if len(parts) != 3 { - return Version{}, errors.New("No Major.Minor.Patch elements found") - } - - // Major - if !containsOnly(parts[0], numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in major number %q", parts[0]) - } - if hasLeadingZeroes(parts[0]) { - return Version{}, fmt.Errorf("Major number must not contain leading zeroes %q", parts[0]) - } - major, err := strconv.ParseUint(parts[0], 10, 64) - if err != nil { - return Version{}, err - } - - // Minor - if !containsOnly(parts[1], numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in minor number %q", parts[1]) - } - if hasLeadingZeroes(parts[1]) { - return Version{}, fmt.Errorf("Minor number must not contain leading zeroes %q", parts[1]) - } - minor, err := strconv.ParseUint(parts[1], 10, 64) - if err != nil { - return Version{}, err - } - - v := Version{} - v.Major = major - v.Minor = minor - - var build, prerelease []string - patchStr := parts[2] - - if buildIndex := strings.IndexRune(patchStr, '+'); buildIndex != -1 { - build = strings.Split(patchStr[buildIndex+1:], ".") - patchStr = patchStr[:buildIndex] - } - - if preIndex := strings.IndexRune(patchStr, '-'); preIndex != -1 { - prerelease = strings.Split(patchStr[preIndex+1:], ".") - patchStr = patchStr[:preIndex] - } - - if !containsOnly(patchStr, numbers) { - return Version{}, fmt.Errorf("Invalid character(s) found in patch number %q", patchStr) - } - if hasLeadingZeroes(patchStr) { - return Version{}, fmt.Errorf("Patch number must not contain leading zeroes %q", patchStr) - } - patch, err := strconv.ParseUint(patchStr, 10, 64) - if err != nil { - return Version{}, err - } - - v.Patch = patch - - // Prerelease - for _, prstr := range prerelease { - parsedPR, err := NewPRVersion(prstr) - if err != nil { - return Version{}, err - } - v.Pre = append(v.Pre, parsedPR) - } - - // Build meta data - for _, str := range build { - if len(str) == 0 { - return Version{}, errors.New("Build meta data is empty") - } - if !containsOnly(str, alphanum) { - return Version{}, fmt.Errorf("Invalid character(s) found in build meta data %q", str) - } - v.Build = append(v.Build, str) - } - - return v, nil -} - -// MustParse is like Parse but panics if the version cannot be parsed. -func MustParse(s string) Version { - v, err := Parse(s) - if err != nil { - panic(`semver: Parse(` + s + `): ` + err.Error()) - } - return v -} - -// PRVersion represents a PreRelease Version -type PRVersion struct { - VersionStr string - VersionNum uint64 - IsNum bool -} - -// NewPRVersion creates a new valid prerelease version -func NewPRVersion(s string) (PRVersion, error) { - if len(s) == 0 { - return PRVersion{}, errors.New("Prerelease is empty") - } - v := PRVersion{} - if containsOnly(s, numbers) { - if hasLeadingZeroes(s) { - return PRVersion{}, fmt.Errorf("Numeric PreRelease version must not contain leading zeroes %q", s) - } - num, err := strconv.ParseUint(s, 10, 64) - - // Might never be hit, but just in case - if err != nil { - return PRVersion{}, err - } - v.VersionNum = num - v.IsNum = true - } else if containsOnly(s, alphanum) { - v.VersionStr = s - v.IsNum = false - } else { - return PRVersion{}, fmt.Errorf("Invalid character(s) found in prerelease %q", s) - } - return v, nil -} - -// IsNumeric checks if prerelease-version is numeric -func (v PRVersion) IsNumeric() bool { - return v.IsNum -} - -// Compare compares two PreRelease Versions v and o: -// -1 == v is less than o -// 0 == v is equal to o -// 1 == v is greater than o -func (v PRVersion) Compare(o PRVersion) int { - if v.IsNum && !o.IsNum { - return -1 - } else if !v.IsNum && o.IsNum { - return 1 - } else if v.IsNum && o.IsNum { - if v.VersionNum == o.VersionNum { - return 0 - } else if v.VersionNum > o.VersionNum { - return 1 - } else { - return -1 - } - } else { // both are Alphas - if v.VersionStr == o.VersionStr { - return 0 - } else if v.VersionStr > o.VersionStr { - return 1 - } else { - return -1 - } - } -} - -// PreRelease version to string -func (v PRVersion) String() string { - if v.IsNum { - return strconv.FormatUint(v.VersionNum, 10) - } - return v.VersionStr -} - -func containsOnly(s string, set string) bool { - return strings.IndexFunc(s, func(r rune) bool { - return !strings.ContainsRune(set, r) - }) == -1 -} - -func hasLeadingZeroes(s string) bool { - return len(s) > 1 && s[0] == '0' -} - -// NewBuildVersion creates a new valid build version -func NewBuildVersion(s string) (string, error) { - if len(s) == 0 { - return "", errors.New("Buildversion is empty") - } - if !containsOnly(s, alphanum) { - return "", fmt.Errorf("Invalid character(s) found in build meta data %q", s) - } - return s, nil -} diff --git a/vendor/github.com/blang/semver/semver_test.go b/vendor/github.com/blang/semver/semver_test.go deleted file mode 100644 index b3e1fd4..0000000 --- a/vendor/github.com/blang/semver/semver_test.go +++ /dev/null @@ -1,458 +0,0 @@ -package semver - -import ( - "testing" -) - -func prstr(s string) PRVersion { - return PRVersion{s, 0, false} -} - -func prnum(i uint64) PRVersion { - return PRVersion{"", i, true} -} - -type formatTest struct { - v Version - result string -} - -var formatTests = []formatTest{ - {Version{1, 2, 3, nil, nil}, "1.2.3"}, - {Version{0, 0, 1, nil, nil}, "0.0.1"}, - {Version{0, 0, 1, []PRVersion{prstr("alpha"), prstr("preview")}, []string{"123", "456"}}, "0.0.1-alpha.preview+123.456"}, - {Version{1, 2, 3, []PRVersion{prstr("alpha"), prnum(1)}, []string{"123", "456"}}, "1.2.3-alpha.1+123.456"}, - {Version{1, 2, 3, []PRVersion{prstr("alpha"), prnum(1)}, nil}, "1.2.3-alpha.1"}, - {Version{1, 2, 3, nil, []string{"123", "456"}}, "1.2.3+123.456"}, - // Prereleases and build metadata hyphens - {Version{1, 2, 3, []PRVersion{prstr("alpha"), prstr("b-eta")}, []string{"123", "b-uild"}}, "1.2.3-alpha.b-eta+123.b-uild"}, - {Version{1, 2, 3, nil, []string{"123", "b-uild"}}, "1.2.3+123.b-uild"}, - {Version{1, 2, 3, []PRVersion{prstr("alpha"), prstr("b-eta")}, nil}, "1.2.3-alpha.b-eta"}, -} - -var tolerantFormatTests = []formatTest{ - {Version{1, 2, 3, nil, nil}, "v1.2.3"}, - {Version{1, 2, 3, nil, nil}, " 1.2.3 "}, - {Version{1, 2, 0, nil, nil}, "1.2"}, - {Version{1, 0, 0, nil, nil}, "1"}, -} - -func TestStringer(t *testing.T) { - for _, test := range formatTests { - if res := test.v.String(); res != test.result { - t.Errorf("Stringer, expected %q but got %q", test.result, res) - } - } -} - -func TestParse(t *testing.T) { - for _, test := range formatTests { - if v, err := Parse(test.result); err != nil { - t.Errorf("Error parsing %q: %q", test.result, err) - } else if comp := v.Compare(test.v); comp != 0 { - t.Errorf("Parsing, expected %q but got %q, comp: %d ", test.v, v, comp) - } else if err := v.Validate(); err != nil { - t.Errorf("Error validating parsed version %q: %q", test.v, err) - } - } -} - -func TestParseTolerant(t *testing.T) { - for _, test := range tolerantFormatTests { - if v, err := ParseTolerant(test.result); err != nil { - t.Errorf("Error parsing %q: %q", test.result, err) - } else if comp := v.Compare(test.v); comp != 0 { - t.Errorf("Parsing, expected %q but got %q, comp: %d ", test.v, v, comp) - } else if err := v.Validate(); err != nil { - t.Errorf("Error validating parsed version %q: %q", test.v, err) - } - } -} - -func TestMustParse(t *testing.T) { - _ = MustParse("32.2.1-alpha") -} - -func TestMustParse_panic(t *testing.T) { - defer func() { - if recover() == nil { - t.Errorf("Should have panicked") - } - }() - _ = MustParse("invalid version") -} - -func TestValidate(t *testing.T) { - for _, test := range formatTests { - if err := test.v.Validate(); err != nil { - t.Errorf("Error validating %q: %q", test.v, err) - } - } -} - -type compareTest struct { - v1 Version - v2 Version - result int -} - -var compareTests = []compareTest{ - {Version{1, 0, 0, nil, nil}, Version{1, 0, 0, nil, nil}, 0}, - {Version{2, 0, 0, nil, nil}, Version{1, 0, 0, nil, nil}, 1}, - {Version{0, 1, 0, nil, nil}, Version{0, 1, 0, nil, nil}, 0}, - {Version{0, 2, 0, nil, nil}, Version{0, 1, 0, nil, nil}, 1}, - {Version{0, 0, 1, nil, nil}, Version{0, 0, 1, nil, nil}, 0}, - {Version{0, 0, 2, nil, nil}, Version{0, 0, 1, nil, nil}, 1}, - {Version{1, 2, 3, nil, nil}, Version{1, 2, 3, nil, nil}, 0}, - {Version{2, 2, 4, nil, nil}, Version{1, 2, 4, nil, nil}, 1}, - {Version{1, 3, 3, nil, nil}, Version{1, 2, 3, nil, nil}, 1}, - {Version{1, 2, 4, nil, nil}, Version{1, 2, 3, nil, nil}, 1}, - - // Spec Examples #11 - {Version{1, 0, 0, nil, nil}, Version{2, 0, 0, nil, nil}, -1}, - {Version{2, 0, 0, nil, nil}, Version{2, 1, 0, nil, nil}, -1}, - {Version{2, 1, 0, nil, nil}, Version{2, 1, 1, nil, nil}, -1}, - - // Spec Examples #9 - {Version{1, 0, 0, nil, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil}, 1}, - {Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha"), prnum(1)}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("alpha"), prnum(1)}, nil}, Version{1, 0, 0, []PRVersion{prstr("alpha"), prstr("beta")}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("alpha"), prstr("beta")}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta")}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("beta")}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(2)}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(2)}, nil}, Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(11)}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("beta"), prnum(11)}, nil}, Version{1, 0, 0, []PRVersion{prstr("rc"), prnum(1)}, nil}, -1}, - {Version{1, 0, 0, []PRVersion{prstr("rc"), prnum(1)}, nil}, Version{1, 0, 0, nil, nil}, -1}, - - // Ignore Build metadata - {Version{1, 0, 0, nil, []string{"1", "2", "3"}}, Version{1, 0, 0, nil, nil}, 0}, -} - -func TestCompare(t *testing.T) { - for _, test := range compareTests { - if res := test.v1.Compare(test.v2); res != test.result { - t.Errorf("Comparing %q : %q, expected %d but got %d", test.v1, test.v2, test.result, res) - } - //Test counterpart - if res := test.v2.Compare(test.v1); res != -test.result { - t.Errorf("Comparing %q : %q, expected %d but got %d", test.v2, test.v1, -test.result, res) - } - } -} - -type wrongformatTest struct { - v *Version - str string -} - -var wrongformatTests = []wrongformatTest{ - {nil, ""}, - {nil, "."}, - {nil, "1."}, - {nil, ".1"}, - {nil, "a.b.c"}, - {nil, "1.a.b"}, - {nil, "1.1.a"}, - {nil, "1.a.1"}, - {nil, "a.1.1"}, - {nil, ".."}, - {nil, "1.."}, - {nil, "1.1."}, - {nil, "1..1"}, - {nil, "1.1.+123"}, - {nil, "1.1.-beta"}, - {nil, "-1.1.1"}, - {nil, "1.-1.1"}, - {nil, "1.1.-1"}, - // giant numbers - {nil, "20000000000000000000.1.1"}, - {nil, "1.20000000000000000000.1"}, - {nil, "1.1.20000000000000000000"}, - {nil, "1.1.1-20000000000000000000"}, - // Leading zeroes - {nil, "01.1.1"}, - {nil, "001.1.1"}, - {nil, "1.01.1"}, - {nil, "1.001.1"}, - {nil, "1.1.01"}, - {nil, "1.1.001"}, - {nil, "1.1.1-01"}, - {nil, "1.1.1-001"}, - {nil, "1.1.1-beta.01"}, - {nil, "1.1.1-beta.001"}, - {&Version{0, 0, 0, []PRVersion{prstr("!")}, nil}, "0.0.0-!"}, - {&Version{0, 0, 0, nil, []string{"!"}}, "0.0.0+!"}, - // empty prversion - {&Version{0, 0, 0, []PRVersion{prstr(""), prstr("alpha")}, nil}, "0.0.0-.alpha"}, - // empty build meta data - {&Version{0, 0, 0, []PRVersion{prstr("alpha")}, []string{""}}, "0.0.0-alpha+"}, - {&Version{0, 0, 0, []PRVersion{prstr("alpha")}, []string{"test", ""}}, "0.0.0-alpha+test."}, -} - -func TestWrongFormat(t *testing.T) { - for _, test := range wrongformatTests { - - if res, err := Parse(test.str); err == nil { - t.Errorf("Parsing wrong format version %q, expected error but got %q", test.str, res) - } - - if test.v != nil { - if err := test.v.Validate(); err == nil { - t.Errorf("Validating wrong format version %q (%q), expected error", test.v, test.str) - } - } - } -} - -var wrongTolerantFormatTests = []wrongformatTest{ - {nil, "1.0+abc"}, - {nil, "1.0-rc.1"}, -} - -func TestWrongTolerantFormat(t *testing.T) { - for _, test := range wrongTolerantFormatTests { - if res, err := ParseTolerant(test.str); err == nil { - t.Errorf("Parsing wrong format version %q, expected error but got %q", test.str, res) - } - } -} - -func TestCompareHelper(t *testing.T) { - v := Version{1, 0, 0, []PRVersion{prstr("alpha")}, nil} - v1 := Version{1, 0, 0, nil, nil} - if !v.EQ(v) { - t.Errorf("%q should be equal to %q", v, v) - } - if !v.Equals(v) { - t.Errorf("%q should be equal to %q", v, v) - } - if !v1.NE(v) { - t.Errorf("%q should not be equal to %q", v1, v) - } - if !v.GTE(v) { - t.Errorf("%q should be greater than or equal to %q", v, v) - } - if !v.LTE(v) { - t.Errorf("%q should be less than or equal to %q", v, v) - } - if !v.LT(v1) { - t.Errorf("%q should be less than %q", v, v1) - } - if !v.LTE(v1) { - t.Errorf("%q should be less than or equal %q", v, v1) - } - if !v.LE(v1) { - t.Errorf("%q should be less than or equal %q", v, v1) - } - if !v1.GT(v) { - t.Errorf("%q should be greater than %q", v1, v) - } - if !v1.GTE(v) { - t.Errorf("%q should be greater than or equal %q", v1, v) - } - if !v1.GE(v) { - t.Errorf("%q should be greater than or equal %q", v1, v) - } -} - -func TestPreReleaseVersions(t *testing.T) { - p1, err := NewPRVersion("123") - if !p1.IsNumeric() { - t.Errorf("Expected numeric prversion, got %q", p1) - } - if p1.VersionNum != 123 { - t.Error("Wrong prversion number") - } - if err != nil { - t.Errorf("Not expected error %q", err) - } - p2, err := NewPRVersion("alpha") - if p2.IsNumeric() { - t.Errorf("Expected non-numeric prversion, got %q", p2) - } - if p2.VersionStr != "alpha" { - t.Error("Wrong prversion string") - } - if err != nil { - t.Errorf("Not expected error %q", err) - } -} - -func TestBuildMetaDataVersions(t *testing.T) { - _, err := NewBuildVersion("123") - if err != nil { - t.Errorf("Unexpected error %q", err) - } - - _, err = NewBuildVersion("build") - if err != nil { - t.Errorf("Unexpected error %q", err) - } - - _, err = NewBuildVersion("test?") - if err == nil { - t.Error("Expected error, got none") - } - - _, err = NewBuildVersion("") - if err == nil { - t.Error("Expected error, got none") - } -} - -func TestNewHelper(t *testing.T) { - v, err := New("1.2.3") - if err != nil { - t.Fatalf("Unexpected error %q", err) - } - - // New returns pointer - if v == nil { - t.Fatal("Version is nil") - } - if v.Compare(Version{1, 2, 3, nil, nil}) != 0 { - t.Fatal("Unexpected comparison problem") - } -} - -func TestMakeHelper(t *testing.T) { - v, err := Make("1.2.3") - if err != nil { - t.Fatalf("Unexpected error %q", err) - } - if v.Compare(Version{1, 2, 3, nil, nil}) != 0 { - t.Fatal("Unexpected comparison problem") - } -} - -func BenchmarkParseSimple(b *testing.B) { - const VERSION = "0.0.1" - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - Parse(VERSION) - } -} - -func BenchmarkParseComplex(b *testing.B) { - const VERSION = "0.0.1-alpha.preview+123.456" - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - Parse(VERSION) - } -} - -func BenchmarkParseAverage(b *testing.B) { - l := len(formatTests) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - Parse(formatTests[n%l].result) - } -} - -func BenchmarkParseTolerantAverage(b *testing.B) { - l := len(tolerantFormatTests) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - ParseTolerant(tolerantFormatTests[n%l].result) - } -} - -func BenchmarkStringSimple(b *testing.B) { - const VERSION = "0.0.1" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.String() - } -} - -func BenchmarkStringLarger(b *testing.B) { - const VERSION = "11.15.2012" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.String() - } -} - -func BenchmarkStringComplex(b *testing.B) { - const VERSION = "0.0.1-alpha.preview+123.456" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.String() - } -} - -func BenchmarkStringAverage(b *testing.B) { - l := len(formatTests) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - formatTests[n%l].v.String() - } -} - -func BenchmarkValidateSimple(b *testing.B) { - const VERSION = "0.0.1" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.Validate() - } -} - -func BenchmarkValidateComplex(b *testing.B) { - const VERSION = "0.0.1-alpha.preview+123.456" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.Validate() - } -} - -func BenchmarkValidateAverage(b *testing.B) { - l := len(formatTests) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - formatTests[n%l].v.Validate() - } -} - -func BenchmarkCompareSimple(b *testing.B) { - const VERSION = "0.0.1" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.Compare(v) - } -} - -func BenchmarkCompareComplex(b *testing.B) { - const VERSION = "0.0.1-alpha.preview+123.456" - v, _ := Parse(VERSION) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - v.Compare(v) - } -} - -func BenchmarkCompareAverage(b *testing.B) { - l := len(compareTests) - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - compareTests[n%l].v1.Compare((compareTests[n%l].v2)) - } -} diff --git a/vendor/github.com/blang/semver/sort.go b/vendor/github.com/blang/semver/sort.go deleted file mode 100644 index e18f880..0000000 --- a/vendor/github.com/blang/semver/sort.go +++ /dev/null @@ -1,28 +0,0 @@ -package semver - -import ( - "sort" -) - -// Versions represents multiple versions. -type Versions []Version - -// Len returns length of version collection -func (s Versions) Len() int { - return len(s) -} - -// Swap swaps two versions inside the collection by its indices -func (s Versions) Swap(i, j int) { - s[i], s[j] = s[j], s[i] -} - -// Less checks if version at index i is less than version at index j -func (s Versions) Less(i, j int) bool { - return s[i].LT(s[j]) -} - -// Sort sorts a slice of versions -func Sort(versions []Version) { - sort.Sort(Versions(versions)) -} diff --git a/vendor/github.com/blang/semver/sort_test.go b/vendor/github.com/blang/semver/sort_test.go deleted file mode 100644 index 6889397..0000000 --- a/vendor/github.com/blang/semver/sort_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package semver - -import ( - "reflect" - "testing" -) - -func TestSort(t *testing.T) { - v100, _ := Parse("1.0.0") - v010, _ := Parse("0.1.0") - v001, _ := Parse("0.0.1") - versions := []Version{v010, v100, v001} - Sort(versions) - - correct := []Version{v001, v010, v100} - if !reflect.DeepEqual(versions, correct) { - t.Fatalf("Sort returned wrong order: %s", versions) - } -} - -func BenchmarkSort(b *testing.B) { - v100, _ := Parse("1.0.0") - v010, _ := Parse("0.1.0") - v001, _ := Parse("0.0.1") - b.ReportAllocs() - b.ResetTimer() - for n := 0; n < b.N; n++ { - Sort([]Version{v010, v100, v001}) - } -} diff --git a/vendor/github.com/blang/semver/sql.go b/vendor/github.com/blang/semver/sql.go deleted file mode 100644 index eb4d802..0000000 --- a/vendor/github.com/blang/semver/sql.go +++ /dev/null @@ -1,30 +0,0 @@ -package semver - -import ( - "database/sql/driver" - "fmt" -) - -// Scan implements the database/sql.Scanner interface. -func (v *Version) Scan(src interface{}) (err error) { - var str string - switch src := src.(type) { - case string: - str = src - case []byte: - str = string(src) - default: - return fmt.Errorf("Version.Scan: cannot convert %T to string.", src) - } - - if t, err := Parse(str); err == nil { - *v = t - } - - return -} - -// Value implements the database/sql/driver.Valuer interface. -func (v Version) Value() (driver.Value, error) { - return v.String(), nil -} diff --git a/vendor/github.com/blang/semver/sql_test.go b/vendor/github.com/blang/semver/sql_test.go deleted file mode 100644 index ebf48b5..0000000 --- a/vendor/github.com/blang/semver/sql_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package semver - -import ( - "testing" -) - -type scanTest struct { - val interface{} - shouldError bool - expected string -} - -var scanTests = []scanTest{ - {"1.2.3", false, "1.2.3"}, - {[]byte("1.2.3"), false, "1.2.3"}, - {7, true, ""}, - {7e4, true, ""}, - {true, true, ""}, -} - -func TestScanString(t *testing.T) { - for _, tc := range scanTests { - s := &Version{} - err := s.Scan(tc.val) - if tc.shouldError { - if err == nil { - t.Fatalf("Scan did not return an error on %v (%T)", tc.val, tc.val) - } - } else { - if err != nil { - t.Fatalf("Scan returned an unexpected error: %s (%T) on %v (%T)", tc.val, tc.val, tc.val, tc.val) - } - if val, _ := s.Value(); val != tc.expected { - t.Errorf("Wrong Value returned, expected %q, got %q", tc.expected, val) - } - } - } -} diff --git a/vendor/github.com/cjoudrey/gluahttp/.gitignore b/vendor/github.com/cjoudrey/gluahttp/.gitignore deleted file mode 100644 index daf913b..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/.gitignore +++ /dev/null @@ -1,24 +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 -*.test -*.prof diff --git a/vendor/github.com/cjoudrey/gluahttp/.travis.yml b/vendor/github.com/cjoudrey/gluahttp/.travis.yml deleted file mode 100644 index 21346e3..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/.travis.yml +++ /dev/null @@ -1,15 +0,0 @@ -language: go - -go: - - 1.4 - - 1.5 - - 1.6 - -install: - - go get github.com/yuin/gopher-lua - -script: - - go test -v - -notifications: - email: false diff --git a/vendor/github.com/cjoudrey/gluahttp/LICENSE b/vendor/github.com/cjoudrey/gluahttp/LICENSE deleted file mode 100644 index 56a399a..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Christian Joudrey - -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/cjoudrey/gluahttp/README.md b/vendor/github.com/cjoudrey/gluahttp/README.md deleted file mode 100644 index 9a3dcca..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/README.md +++ /dev/null @@ -1,235 +0,0 @@ -# gluahttp - -[![](https://travis-ci.org/cjoudrey/gluahttp.svg)](https://travis-ci.org/cjoudrey/gluahttp) - -gluahttp provides an easy way to make HTTP requests from within [GopherLua](https://github.com/yuin/gopher-lua). - -## Installation - -``` -go get github.com/cjoudrey/gluahttp -``` - -## Usage - -```go -import "github.com/yuin/gopher-lua" -import "github.com/cjoudrey/gluahttp" - -func main() { - L := lua.NewState() - defer L.Close() - - L.PreloadModule("http", NewHttpModule(&http.Client{}).Loader) - - if err := L.DoString(` - - local http = require("http") - - response, error_message = http.request("GET", "http://example.com", { - query="page=1" - headers={ - Accept="*/*" - } - }) - - `); err != nil { - panic(err) - } -} -``` - -## API - -- [`http.delete(url [, options])`](#httpdeleteurl--options) -- [`http.get(url [, options])`](#httpgeturl--options) -- [`http.head(url [, options])`](#httpheadurl--options) -- [`http.patch(url [, options])`](#httppatchurl--options) -- [`http.post(url [, options])`](#httpposturl--options) -- [`http.put(url [, options])`](#httpputurl--options) -- [`http.request(method, url [, options])`](#httprequestmethod-url--options) -- [`http.request_batch(requests)`](#httprequest_batchrequests) -- [`http.response`](#httpresponse) - -### http.delete(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.get(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.head(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.patch(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.post(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.put(url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.request(method, url [, options]) - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| method | String | The HTTP request method | -| url | String | URL of the resource to load | -| options | Table | Additional options | - -**Options** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| query | String | URL encoded query params | -| cookies | Table | Additional cookies to send with the request | -| body | String | Request body. | -| form | String | Deprecated. URL encoded request body. This will also set the `Content-Type` header to `application/x-www-form-urlencoded` | -| headers | Table | Additional headers to send with the request | - -**Returns** - -[http.response](#httpresponse) or (nil, error message) - -### http.request_batch(requests) - -**Attributes** - -| Name | Type | Description | -| -------- | ----- | ----------- | -| requests | Table | A table of requests to send. Each request item is by itself a table containing [http.request](#httprequestmethod-url--options) parameters for the request | - -**Returns** - -[[http.response](#httpresponse)] or ([[http.response](#httpresponse)], [error message]) - -### http.response - -The `http.response` table contains information about a completed HTTP request. - -**Attributes** - -| Name | Type | Description | -| ----------- | ------ | ----------- | -| body | String | The HTTP response body | -| body_size | Number | The size of the HTTP reponse body in bytes | -| headers | Table | The HTTP response headers | -| cookies | Table | The cookies sent by the server in the HTTP response | -| status_code | Number | The HTTP response status code | -| url | String | The final URL the request ended pointing to after redirects | diff --git a/vendor/github.com/cjoudrey/gluahttp/gluahttp.go b/vendor/github.com/cjoudrey/gluahttp/gluahttp.go deleted file mode 100644 index 567743f..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/gluahttp.go +++ /dev/null @@ -1,212 +0,0 @@ -package gluahttp - -import "github.com/yuin/gopher-lua" -import "net/http" -import "fmt" -import "errors" -import "io/ioutil" -import "strings" - -type httpModule struct { - client *http.Client -} - -type empty struct{} - -func NewHttpModule(client *http.Client) *httpModule { - return &httpModule{ - client: client, - } -} - -func (h *httpModule) Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ - "get": h.get, - "delete": h.delete, - "head": h.head, - "patch": h.patch, - "post": h.post, - "put": h.put, - "request": h.request, - "request_batch": h.requestBatch, - }) - registerHttpResponseType(mod, L) - L.Push(mod) - return 1 -} - -func (h *httpModule) get(L *lua.LState) int { - return h.doRequestAndPush(L, "get", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) delete(L *lua.LState) int { - return h.doRequestAndPush(L, "delete", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) head(L *lua.LState) int { - return h.doRequestAndPush(L, "head", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) patch(L *lua.LState) int { - return h.doRequestAndPush(L, "patch", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) post(L *lua.LState) int { - return h.doRequestAndPush(L, "post", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) put(L *lua.LState) int { - return h.doRequestAndPush(L, "put", L.ToString(1), L.ToTable(2)) -} - -func (h *httpModule) request(L *lua.LState) int { - return h.doRequestAndPush(L, L.ToString(1), L.ToString(2), L.ToTable(3)) -} - -func (h *httpModule) requestBatch(L *lua.LState) int { - requests := L.ToTable(1) - amountRequests := requests.Len() - - errs := make([]error, amountRequests) - responses := make([]*lua.LUserData, amountRequests) - sem := make(chan empty, amountRequests) - - i := 0 - - requests.ForEach(func(_ lua.LValue, value lua.LValue) { - requestTable := toTable(value) - - if requestTable != nil { - method := requestTable.RawGet(lua.LNumber(1)).String() - url := requestTable.RawGet(lua.LNumber(2)).String() - options := toTable(requestTable.RawGet(lua.LNumber(3))) - - go func(i int, L *lua.LState, method string, url string, options *lua.LTable) { - response, err := h.doRequest(L, method, url, options) - - if err == nil { - errs[i] = nil - responses[i] = response - } else { - errs[i] = err - responses[i] = nil - } - - sem <- empty{} - }(i, L, method, url, options) - } else { - errs[i] = errors.New("Request must be a table") - responses[i] = nil - sem <- empty{} - } - - i = i + 1 - }) - - for i = 0; i < amountRequests; i++ { - <-sem - } - - hasErrors := false - errorsTable := L.NewTable() - responsesTable := L.NewTable() - for i = 0; i < amountRequests; i++ { - if errs[i] == nil { - responsesTable.Append(responses[i]) - errorsTable.Append(lua.LNil) - } else { - responsesTable.Append(lua.LNil) - errorsTable.Append(lua.LString(fmt.Sprintf("%s", errs[i]))) - hasErrors = true - } - } - - if hasErrors { - L.Push(responsesTable) - L.Push(errorsTable) - return 2 - } else { - L.Push(responsesTable) - return 1 - } -} - -func (h *httpModule) doRequest(L *lua.LState, method string, url string, options *lua.LTable) (*lua.LUserData, error) { - req, err := http.NewRequest(strings.ToUpper(method), url, nil) - if err != nil { - return nil, err - } - - if options != nil { - if reqCookies, ok := options.RawGet(lua.LString("cookies")).(*lua.LTable); ok { - reqCookies.ForEach(func(key lua.LValue, value lua.LValue) { - req.AddCookie(&http.Cookie{Name: key.String(), Value: value.String()}) - }) - } - - switch reqQuery := options.RawGet(lua.LString("query")).(type) { - case lua.LString: - req.URL.RawQuery = reqQuery.String() - } - - body := options.RawGet(lua.LString("body")) - if _, ok := body.(lua.LString); !ok { - // "form" is deprecated. - body = options.RawGet(lua.LString("form")) - // Only set the Content-Type to application/x-www-form-urlencoded - // when someone uses "form", not for "body". - if _, ok := body.(lua.LString); ok { - req.Header.Set("Content-Type", "application/x-www-form-urlencoded") - } - } - - switch reqBody := body.(type) { - case lua.LString: - body := reqBody.String() - req.ContentLength = int64(len(body)) - req.Body = ioutil.NopCloser(strings.NewReader(body)) - } - - // Set these last. That way the code above doesn't overwrite them. - if reqHeaders, ok := options.RawGet(lua.LString("headers")).(*lua.LTable); ok { - reqHeaders.ForEach(func(key lua.LValue, value lua.LValue) { - req.Header.Set(key.String(), value.String()) - }) - } - } - - res, err := h.client.Do(req) - - if err != nil { - return nil, err - } - - defer res.Body.Close() - body, err := ioutil.ReadAll(res.Body) - - if err != nil { - return nil, err - } - - return newHttpResponse(res, &body, len(body), L), nil -} - -func (h *httpModule) doRequestAndPush(L *lua.LState, method string, url string, options *lua.LTable) int { - response, err := h.doRequest(L, method, url, options) - - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(fmt.Sprintf("%s", err))) - return 2 - } - - L.Push(response) - return 1 -} - -func toTable(v lua.LValue) *lua.LTable { - if lv, ok := v.(*lua.LTable); ok { - return lv - } - return nil -} diff --git a/vendor/github.com/cjoudrey/gluahttp/gluahttp_test.go b/vendor/github.com/cjoudrey/gluahttp/gluahttp_test.go deleted file mode 100644 index 34c11e7..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/gluahttp_test.go +++ /dev/null @@ -1,433 +0,0 @@ -package gluahttp - -import "github.com/yuin/gopher-lua" -import "testing" -import "io/ioutil" -import "net/http" -import "net" -import "fmt" -import "net/http/cookiejar" -import "strings" - -func TestRequestNoMethod(t *testing.T) { - if err := evalLua(t, ` - local http = require("http") - response, error = http.request() - - assert_equal(nil, response) - assert_contains('unsupported protocol scheme ""', error) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestNoUrl(t *testing.T) { - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("get") - - assert_equal(nil, response) - assert_contains('unsupported protocol scheme ""', error) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestBatch(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - responses, errors = http.request_batch({ - {"get", "http://`+listener.Addr().String()+`", {query="page=1"}}, - {"post", "http://`+listener.Addr().String()+`/set_cookie"}, - {"post", ""}, - 1 - }) - - assert_equal(nil, errors[1]) - assert_equal(nil, errors[2]) - assert_contains('unsupported protocol scheme ""', errors[3]) - assert_equal('Request must be a table', errors[4]) - - assert_equal('Requested GET / with query "page=1"', responses[1]["body"]) - assert_equal('Cookie set!', responses[2]["body"]) - assert_equal('12345', responses[2]["cookies"]["session_id"]) - assert_equal(nil, responses[3]) - assert_equal(nil, responses[4]) - - responses, errors = http.request_batch({ - {"get", "http://`+listener.Addr().String()+`/get_cookie"} - }) - - assert_equal(nil, errors) - assert_equal("session_id=12345", responses[1]["body"]) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestGet(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("get", "http://`+listener.Addr().String()+`") - - assert_equal('Requested GET / with query ""', response['body']) - assert_equal(200, response['status_code']) - assert_equal('29', response['headers']['Content-Length']) - assert_equal('text/plain; charset=utf-8', response['headers']['Content-Type']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestGetWithRedirect(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("get", "http://`+listener.Addr().String()+`/redirect") - - assert_equal('Requested GET / with query ""', response['body']) - assert_equal(200, response['status_code']) - assert_equal('http://`+listener.Addr().String()+`/', response['url']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestPostForm(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("post", "http://`+listener.Addr().String()+`", { - form="username=bob&password=secret" - }) - - assert_equal( - 'Requested POST / with query ""' .. - 'Content-Type: application/x-www-form-urlencoded' .. - 'Content-Length: 28' .. - 'Body: username=bob&password=secret', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestHeaders(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("post", "http://`+listener.Addr().String()+`", { - headers={ - ["Content-Type"]="application/json" - } - }) - - assert_equal( - 'Requested POST / with query ""' .. - 'Content-Type: application/json' .. - 'Content-Length: 0' .. - 'Body: ', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestQuery(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.request("get", "http://`+listener.Addr().String()+`", { - query="page=2" - }) - - assert_equal('Requested GET / with query "page=2"', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestGet(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.get("http://`+listener.Addr().String()+`", { - query="page=1" - }) - - assert_equal('Requested GET / with query "page=1"', response['body']) - assert_equal(200, response['status_code']) - assert_equal('35', response['headers']['Content-Length']) - assert_equal('text/plain; charset=utf-8', response['headers']['Content-Type']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestDelete(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.delete("http://`+listener.Addr().String()+`", { - query="page=1" - }) - - assert_equal('Requested DELETE / with query "page=1"', response['body']) - assert_equal(200, response['status_code']) - assert_equal('38', response['headers']['Content-Length']) - assert_equal('text/plain; charset=utf-8', response['headers']['Content-Type']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestHead(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.head("http://`+listener.Addr().String()+`/head", { - query="page=1" - }) - - assert_equal(200, response['status_code']) - assert_equal("/head?page=1", response['headers']['X-Request-Uri']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestPost(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.post("http://`+listener.Addr().String()+`", { - body="username=bob&password=secret" - }) - - assert_equal( - 'Requested POST / with query ""' .. - 'Content-Type: ' .. - 'Content-Length: 28' .. - 'Body: username=bob&password=secret', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestPatch(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.patch("http://`+listener.Addr().String()+`", { - body='{"username":"bob"}', - headers={ - ["Content-Type"]="application/json" - } - }) - - assert_equal( - 'Requested PATCH / with query ""' .. - 'Content-Type: application/json' .. - 'Content-Length: 18' .. - 'Body: {"username":"bob"}', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestPut(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.put("http://`+listener.Addr().String()+`", { - body="username=bob&password=secret", - headers={ - ["Content-Type"]="application/x-www-form-urlencoded" - } - }) - - assert_equal( - 'Requested PUT / with query ""' .. - 'Content-Type: application/x-www-form-urlencoded' .. - 'Content-Length: 28' .. - 'Body: username=bob&password=secret', response['body']) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestResponseCookies(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.get("http://`+listener.Addr().String()+`/set_cookie") - - assert_equal('Cookie set!', response["body"]) - assert_equal('12345', response["cookies"]["session_id"]) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestRequestCookies(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.get("http://`+listener.Addr().String()+`/get_cookie", { - cookies={ - ["session_id"]="test" - } - }) - - assert_equal('session_id=test', response["body"]) - assert_equal(15, response["body_size"]) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestResponseBodySize(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.get("http://`+listener.Addr().String()+`/") - - assert_equal(29, response["body_size"]) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestResponseBody(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - response, error = http.get("http://`+listener.Addr().String()+`/") - - assert_equal("Requested XXX / with query \"\"", string.gsub(response.body, "GET", "XXX")) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func TestResponseUrl(t *testing.T) { - listener, _ := net.Listen("tcp", "127.0.0.1:0") - setupServer(listener) - - if err := evalLua(t, ` - local http = require("http") - - response, error = http.get("http://`+listener.Addr().String()+`/redirect") - assert_equal("http://`+listener.Addr().String()+`/", response["url"]) - - response, error = http.get("http://`+listener.Addr().String()+`/get_cookie") - assert_equal("http://`+listener.Addr().String()+`/get_cookie", response["url"]) - `); err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } -} - -func evalLua(t *testing.T, script string) error { - L := lua.NewState() - defer L.Close() - - cookieJar, _ := cookiejar.New(nil) - - L.PreloadModule("http", NewHttpModule(&http.Client{ - Jar: cookieJar, - }, - ).Loader) - - L.SetGlobal("assert_equal", L.NewFunction(func(L *lua.LState) int { - expected := L.Get(1) - actual := L.Get(2) - - if expected.Type() != actual.Type() || expected.String() != actual.String() { - t.Errorf("Expected %s %q, got %s %q", expected.Type(), expected, actual.Type(), actual) - } - - return 0 - })) - - L.SetGlobal("assert_contains", L.NewFunction(func(L *lua.LState) int { - contains := L.Get(1) - actual := L.Get(2) - - if !strings.Contains(actual.String(), contains.String()) { - t.Errorf("Expected %s %q contains %s %q", actual.Type(), actual, contains.Type(), contains) - } - - return 0 - })) - - return L.DoString(script) -} - -func setupServer(listener net.Listener) { - mux := http.NewServeMux() - mux.HandleFunc("/", func(w http.ResponseWriter, req *http.Request) { - fmt.Fprintf(w, "Requested %s / with query %q", req.Method, req.URL.RawQuery) - - if req.Method == "POST" || req.Method == "PATCH" || req.Method == "PUT" { - body, _ := ioutil.ReadAll(req.Body) - fmt.Fprintf(w, "Content-Type: %s", req.Header.Get("Content-Type")) - fmt.Fprintf(w, "Content-Length: %s", req.Header.Get("Content-Length")) - fmt.Fprintf(w, "Body: %s", body) - } - }) - mux.HandleFunc("/head", func(w http.ResponseWriter, req *http.Request) { - if req.Method == "HEAD" { - w.Header().Set("X-Request-Uri", req.URL.String()) - w.WriteHeader(http.StatusOK) - } else { - w.WriteHeader(http.StatusNotFound) - } - }) - mux.HandleFunc("/set_cookie", func(w http.ResponseWriter, req *http.Request) { - http.SetCookie(w, &http.Cookie{Name: "session_id", Value: "12345"}) - fmt.Fprint(w, "Cookie set!") - }) - mux.HandleFunc("/get_cookie", func(w http.ResponseWriter, req *http.Request) { - session_id, _ := req.Cookie("session_id") - fmt.Fprint(w, session_id) - }) - mux.HandleFunc("/redirect", func(w http.ResponseWriter, req *http.Request) { - http.Redirect(w, req, "/", http.StatusFound) - }) - s := &http.Server{ - Handler: mux, - } - go s.Serve(listener) -} diff --git a/vendor/github.com/cjoudrey/gluahttp/httpresponsetype.go b/vendor/github.com/cjoudrey/gluahttp/httpresponsetype.go deleted file mode 100644 index 744a587..0000000 --- a/vendor/github.com/cjoudrey/gluahttp/httpresponsetype.go +++ /dev/null @@ -1,98 +0,0 @@ -package gluahttp - -import "github.com/yuin/gopher-lua" -import "net/http" - -const luaHttpResponseTypeName = "http.response" - -type luaHttpResponse struct { - res *http.Response - body lua.LString - bodySize int -} - -func registerHttpResponseType(module *lua.LTable, L *lua.LState) { - mt := L.NewTypeMetatable(luaHttpResponseTypeName) - L.SetField(mt, "__index", L.NewFunction(httpResponseIndex)) - - L.SetField(module, "response", mt) -} - -func newHttpResponse(res *http.Response, body *[]byte, bodySize int, L *lua.LState) *lua.LUserData { - ud := L.NewUserData() - ud.Value = &luaHttpResponse{ - res: res, - body: lua.LString(*body), - bodySize: bodySize, - } - L.SetMetatable(ud, L.GetTypeMetatable(luaHttpResponseTypeName)) - return ud -} - -func checkHttpResponse(L *lua.LState) *luaHttpResponse { - ud := L.CheckUserData(1) - if v, ok := ud.Value.(*luaHttpResponse); ok { - return v - } - L.ArgError(1, "http.response expected") - return nil -} - -func httpResponseIndex(L *lua.LState) int { - res := checkHttpResponse(L) - - switch L.CheckString(2) { - case "headers": - return httpResponseHeaders(res, L) - case "cookies": - return httpResponseCookies(res, L) - case "status_code": - return httpResponseStatusCode(res, L) - case "url": - return httpResponseUrl(res, L) - case "body": - return httpResponseBody(res, L) - case "body_size": - return httpResponseBodySize(res, L) - } - - return 0 -} - -func httpResponseHeaders(res *luaHttpResponse, L *lua.LState) int { - headers := L.NewTable() - for key, _ := range res.res.Header { - headers.RawSetString(key, lua.LString(res.res.Header.Get(key))) - } - L.Push(headers) - return 1 -} - -func httpResponseCookies(res *luaHttpResponse, L *lua.LState) int { - cookies := L.NewTable() - for _, cookie := range res.res.Cookies() { - cookies.RawSetString(cookie.Name, lua.LString(cookie.Value)) - } - L.Push(cookies) - return 1 -} - -func httpResponseStatusCode(res *luaHttpResponse, L *lua.LState) int { - L.Push(lua.LNumber(res.res.StatusCode)) - return 1 -} - -func httpResponseUrl(res *luaHttpResponse, L *lua.LState) int { - L.Push(lua.LString(res.res.Request.URL.String())) - return 1 -} - -func httpResponseBody(res *luaHttpResponse, L *lua.LState) int { - L.Push(res.body) - return 1 -} - -func httpResponseBodySize(res *luaHttpResponse, L *lua.LState) int { - L.Push(lua.LNumber(res.bodySize)) - return 1 -} diff --git a/vendor/github.com/cjoudrey/gluaurl/.gitignore b/vendor/github.com/cjoudrey/gluaurl/.gitignore deleted file mode 100644 index daf913b..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/.gitignore +++ /dev/null @@ -1,24 +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 -*.test -*.prof diff --git a/vendor/github.com/cjoudrey/gluaurl/.travis.yml b/vendor/github.com/cjoudrey/gluaurl/.travis.yml deleted file mode 100644 index 7a3d33a..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/.travis.yml +++ /dev/null @@ -1,14 +0,0 @@ -language: go - -go: - - 1.3 - - 1.4 - -install: - - go get github.com/yuin/gopher-lua - -script: - - go test -v - -notifications: - email: false diff --git a/vendor/github.com/cjoudrey/gluaurl/LICENSE b/vendor/github.com/cjoudrey/gluaurl/LICENSE deleted file mode 100644 index 56a399a..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2015 Christian Joudrey - -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/cjoudrey/gluaurl/README.md b/vendor/github.com/cjoudrey/gluaurl/README.md deleted file mode 100644 index fc82b5f..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/README.md +++ /dev/null @@ -1,109 +0,0 @@ -# gluaurl - -[![](https://travis-ci.org/cjoudrey/gluaurl.svg)](https://travis-ci.org/cjoudrey/gluaurl) - -gluahttp provides an easy way to parse and build URLs from within [GopherLua](https://github.com/yuin/gopher-lua). - -## Installation - -``` -go get github.com/cjoudrey/gluaurl -``` - -## Usage - -```go -import "github.com/yuin/gopher-lua" -import "github.com/cjoudrey/gluaurl" - -func main() { - L := lua.NewState() - defer L.Close() - - L.PreloadModule("url", gluaurl.Loader) - - if err := L.DoString(` - - local url = require("url") - - parsed_url = url.parse("http://example.com/") - - print(parsed_url.host) - - `); err != nil { - panic(err) - } -} -``` - -## API - -- [`url.parse(url)`](#urlparseurl) -- [`url.build(options)`](#urlbuildoptions) -- [`url.build_query_string(query_params)`](#urlbuild_query_stringquery_params) -- [`url.resolve(from, to)`](#urlresolvefrom-to) - -### url.parse(url) - -Parse URL into a table of key/value components. - -**Attributes** - -| Name | Type | Description | -| ------- | ------ | ----------- | -| url | String | URL to parsed | - -**Returns** - -Table with parsed URL or (nil, error message) - -| Name | Type | Description | -| -------- | ------ | ----------- | -| scheme | String | Scheme of the URL | -| username | String | Username | -| password | String | Password | -| host | String | Host and port of the URL | -| path | String | Path | -| query | String | Query string | -| fragment | String | Fragment | - -### url.build(options) - -Assemble a URL string from a table of URL components. - -**Attributes** - -| Name | Type | Description | -| ------- | ----- | ----------- | -| options | Table | Table with URL components, see [`url.parse`](#urlparseurl) for list of valid components | - -**Returns** - -String - -### url.build_query_string(query_params) - -Assemble table of query string parameters into a string. - -**Attributes** - -| Name | Type | Description | -| ------------ | ----- | ----------- | -| query_params | Table | Table with query parameters | - -**Returns** - -String - -### url.resolve(from, to) - -Take a base URL, and a href URL, and resolve them as a browser would for an anchor tag. - -| Name | Type | Description | -| ---- | ------ | ----------- | -| from | String | base URL | -| to | String | href URL | - -**Returns** - -String or (nil, error message) diff --git a/vendor/github.com/cjoudrey/gluaurl/gluaurl.go b/vendor/github.com/cjoudrey/gluaurl/gluaurl.go deleted file mode 100644 index 287769a..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/gluaurl.go +++ /dev/null @@ -1,178 +0,0 @@ -package gluaurl - -import "github.com/yuin/gopher-lua" -import "net/url" -import "strings" -import "fmt" -import "sort" -import "regexp" - -var rBracket = regexp.MustCompile("\\[\\]$") - -func Loader(L *lua.LState) int { - mod := L.SetFuncs(L.NewTable(), map[string]lua.LGFunction{ - "parse": parse, - "build": build, - "build_query_string": buildQueryString, - "resolve": resolve, - }) - L.Push(mod) - return 1 -} - -func parse(L *lua.LState) int { - parsed := L.NewTable() - - url, err := url.Parse(L.CheckString(1)) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(fmt.Sprintf("%s", err))) - return 2 - } - - parsed.RawSetString("scheme", lua.LString(url.Scheme)) - - if url.User != nil { - parsed.RawSetString("username", lua.LString(url.User.Username())) - - if password, hasPassword := url.User.Password(); hasPassword { - parsed.RawSetString("password", lua.LString(password)) - } else { - parsed.RawSetString("password", lua.LNil) - } - - } else { - parsed.RawSetString("username", lua.LNil) - parsed.RawSetString("password", lua.LNil) - } - - parsed.RawSetString("host", lua.LString(url.Host)) - parsed.RawSetString("path", lua.LString(url.Path)) - parsed.RawSetString("query", lua.LString(url.RawQuery)) - parsed.RawSetString("fragment", lua.LString(url.Fragment)) - - L.Push(parsed) - - return 1 -} - -func build(L *lua.LState) int { - options := L.CheckTable(1) - - buildUrl := url.URL{} - - if scheme := options.RawGetString("scheme"); scheme != lua.LNil { - buildUrl.Scheme = scheme.String() - } - - if username := options.RawGetString("username"); username != lua.LNil { - if password := options.RawGetString("password"); password != lua.LNil { - buildUrl.User = url.UserPassword(username.String(), password.String()) - } else { - buildUrl.User = url.User(username.String()) - } - } - - if host := options.RawGetString("host"); host != lua.LNil { - buildUrl.Host = host.String() - } - - if path := options.RawGetString("path"); path != lua.LNil { - buildUrl.Path = path.String() - } - - if query := options.RawGetString("query"); query != lua.LNil { - buildUrl.RawQuery = query.String() - } - - if fragment := options.RawGetString("fragment"); fragment != lua.LNil { - buildUrl.Fragment = fragment.String() - } - - L.Push(lua.LString(buildUrl.String())) - - return 1 -} - -func buildQueryString(L *lua.LState) int { - options := L.CheckTable(1) - - ret := make([]string, 0) - - options.ForEach(func(key, value lua.LValue) { - toQueryString(key.String(), value, &ret) - }) - - sort.Strings(ret) - - L.Push(lua.LString(strings.Join(ret, "&"))) - - return 1 -} - -func toQueryString(prefix string, lv lua.LValue, ret *[]string) { - switch v := lv.(type) { - case lua.LBool: - *ret = append(*ret, url.QueryEscape(prefix)+"="+v.String()) - break - - case lua.LNumber: - *ret = append(*ret, url.QueryEscape(prefix)+"="+v.String()) - break - - case lua.LString: - *ret = append(*ret, url.QueryEscape(prefix)+"="+url.QueryEscape(v.String())) - break - - case *lua.LTable: - maxn := v.MaxN() - if maxn == 0 { - ret2 := make([]string, 0) - v.ForEach(func(key lua.LValue, value lua.LValue) { - toQueryString(prefix+"["+key.String()+"]", value, &ret2) - }) - sort.Strings(ret2) - *ret = append(*ret, strings.Join(ret2, "&")) - } else { - ret2 := make([]string, 0) - for i := 1; i <= maxn; i++ { - vi := v.RawGetInt(i) - - if rBracket.MatchString(prefix) { - ret2 = append(ret2, url.QueryEscape(prefix)+"="+vi.String()) - } else { - if vi.Type() == lua.LTTable { - toQueryString(fmt.Sprintf("%s[%d]", prefix, i-1), vi, &ret2) - } else { - toQueryString(prefix+"[]", vi, &ret2) - } - } - } - *ret = append(*ret, strings.Join(ret2, "&")) - } - break - } -} - -func resolve(L *lua.LState) int { - from := L.CheckString(1) - to := L.CheckString(2) - - fromUrl, err := url.Parse(from) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(fmt.Sprintf("%s", err))) - return 2 - } - - toUrl, err := url.Parse(to) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(fmt.Sprintf("%s", err))) - return 2 - } - - resolvedUrl := fromUrl.ResolveReference(toUrl).String() - L.Push(lua.LString(resolvedUrl)) - return 1 -} diff --git a/vendor/github.com/cjoudrey/gluaurl/gluaurl_test.go b/vendor/github.com/cjoudrey/gluaurl/gluaurl_test.go deleted file mode 100644 index a21a675..0000000 --- a/vendor/github.com/cjoudrey/gluaurl/gluaurl_test.go +++ /dev/null @@ -1,250 +0,0 @@ -package gluaurl - -import "github.com/yuin/gopher-lua" -import "testing" -import "os" -import "bytes" -import "io" -import "strings" - -func TestParse(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -parsed = url.parse("http://bob:secret@example.com:8080/products?page=2#something") - -print(parsed.scheme) -print(parsed.username) -print(parsed.password) -print(parsed.host) -print(parsed.path) -print(parsed.query) -print(parsed.fragment) -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := `http -bob -secret -example.com:8080 -/products -page=2 -something -`; expected != output { - t.Errorf("Expected output does not match actual output\nExpected: %s\nActual: %s", expected, output) - } - } -} - -func TestParseOnlyHost(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -parsed = url.parse("https://example.com") - -print(parsed.scheme) -print(parsed.username) -print(parsed.password) -print(parsed.host) -print(parsed.path) -print(parsed.query) -print(parsed.fragment) -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := `https -nil -nil -example.com - - - -`; expected != output { - t.Errorf("Expected output does not match actual output\nExpected: %s\nActual: %s", expected, output) - } - } -} - -func TestBuild(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -built = url.build({ - scheme="https", - username="bob", - password="secret", - host="example.com:8080", - path="/products", - query="page=2", - fragment="something" -}) - -print(built) -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := `https://bob:secret@example.com:8080/products?page=2#something -`; expected != output { - t.Errorf("Expected output does not match actual output\nExpected: %s\nActual: %s", expected, output) - } - } -} - -func TestBuildEmpty(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -built = url.build({}) - -print(built) -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := ` -`; expected != output { - t.Errorf("Expected output does not match actual output\nExpected: %s\nActual: %s", expected, output) - } - } -} - -func TestBuildQueryString(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -function assert_query_string(options, expected, message) - actual = url.build_query_string(options) - - if expected ~= actual then - print("Failed to build '" .. message .. "'") - print("Expected:") - print(expected) - print("Actual:") - print(actual) - end -end - -assert_query_string( - {foo="bar", baz=42, quux="All your base are belong to us"}, - "baz=42&foo=bar&quux=All+your+base+are+belong+to+us", - "simple" -) - -assert_query_string( - {someName={1, 2, 3}, regularThing="blah"}, - "regularThing=blah&someName%5B%5D=1&someName%5B%5D=2&someName%5B%5D=3", - "with array" -) - -assert_query_string( - {foo={"a", "b", "c"}}, - "foo%5B%5D=a&foo%5B%5D=b&foo%5B%5D=c", - "with array of strings" -) - -assert_query_string( - {foo={"baz", 42, "All your base are belong to us"}}, - "foo%5B%5D=baz&foo%5B%5D=42&foo%5B%5D=All+your+base+are+belong+to+us", - "more array" -) - -assert_query_string( - {foo={bar="baz", beep=42, quux="All your base are belong to us"}}, - "foo%5Bbar%5D=baz&foo%5Bbeep%5D=42&foo%5Bquux%5D=All+your+base+are+belong+to+us", - "even more arrays" -) - -assert_query_string( - {a={1,2}, b={c=3, d={4,5}, e={ x={6}, y=7, z={8,9} }, f=true, g=false, h=""}, i={10,11}, j=true, k=false, l={"",0}, m="cowboy hat?" }, - "a%5B%5D=1&a%5B%5D=2&b%5Bc%5D=3&b%5Bd%5D%5B%5D=4&b%5Bd%5D%5B%5D=5&b%5Be%5D%5Bx%5D%5B%5D=6&b%5Be%5D%5By%5D=7&b%5Be%5D%5Bz%5D%5B%5D=8&b%5Be%5D%5Bz%5D%5B%5D=9&b%5Bf%5D=true&b%5Bg%5D=false&b%5Bh%5D=&i%5B%5D=10&i%5B%5D=11&j=true&k=false&l%5B%5D=&l%5B%5D=0&m=cowboy+hat%3F", - "huge structure" -) - -assert_query_string( - { a={0, { 1, 2 }, { 3, { 4, 5 }, { 6 } }, { b= { 7, { 8, 9 }, { { c=10, d=11 } }, { { 12 } }, { { { 13 } } }, { e= { f= { g={ 14, { 15 } } } } }, 16 } }, 17 } }, - "a%5B%5D=0&a%5B1%5D%5B%5D=1&a%5B1%5D%5B%5D=2&a%5B2%5D%5B%5D=3&a%5B2%5D%5B1%5D%5B%5D=4&a%5B2%5D%5B1%5D%5B%5D=5&a%5B2%5D%5B2%5D%5B%5D=6&a%5B3%5D%5Bb%5D%5B%5D=7&a%5B3%5D%5Bb%5D%5B1%5D%5B%5D=8&a%5B3%5D%5Bb%5D%5B1%5D%5B%5D=9&a%5B3%5D%5Bb%5D%5B2%5D%5B0%5D%5Bc%5D=10&a%5B3%5D%5Bb%5D%5B2%5D%5B0%5D%5Bd%5D=11&a%5B3%5D%5Bb%5D%5B3%5D%5B0%5D%5B%5D=12&a%5B3%5D%5Bb%5D%5B4%5D%5B0%5D%5B0%5D%5B%5D=13&a%5B3%5D%5Bb%5D%5B5%5D%5Be%5D%5Bf%5D%5Bg%5D%5B%5D=14&a%5B3%5D%5Bb%5D%5B5%5D%5Be%5D%5Bf%5D%5Bg%5D%5B1%5D%5B%5D=15&a%5B3%5D%5Bb%5D%5B%5D=16&a%5B%5D=17", - "nested arrays" -) - -assert_query_string( - { a= {1,2,3}, ["b[]"]= {4,5,6}, ["c[d]"]= {7,8,9}, e= { f= {10}, g= {11,12}, h= 13 } }, - "a%5B%5D=1&a%5B%5D=2&a%5B%5D=3&b%5B%5D=4&b%5B%5D=5&b%5B%5D=6&c%5Bd%5D%5B%5D=7&c%5Bd%5D%5B%5D=8&c%5Bd%5D%5B%5D=9&e%5Bf%5D%5B%5D=10&e%5Bg%5D%5B%5D=11&e%5Bg%5D%5B%5D=12&e%5Bh%5D=13", - "make sure params are not double-encoded" -) - -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := ``; expected != output { - t.Error(output) - } - } -} - -func TestResolve(t *testing.T) { - output, err := evalScript(` -local url = require("url") - -print(url.resolve('/one/two/three', 'four')) -print(url.resolve('http://example.com/', '/one')) -print(url.resolve('http://example.com/one', '/two')) -print(url.resolve('https://example.com/one', '//example2.com')) -`) - - if err != nil { - t.Errorf("Failed to evaluate script: %s", err) - } else { - if expected := `/one/two/four -http://example.com/one -http://example.com/two -https://example2.com -`; expected != output { - t.Errorf("Expected output does not match actual output\nExpected: %s\nActual: %s", expected, output) - } - } -} - -func evalScript(script string) (string, error) { - L := lua.NewState() - defer L.Close() - - L.PreloadModule("url", Loader) - - var err error - - out := captureStdout(func() { - err = L.DoString(script) - }) - - return out, err -} - -func captureStdout(inner func()) string { - oldStdout := os.Stdout - r, w, _ := os.Pipe() - os.Stdout = w - - outC := make(chan string) - go func() { - var buf bytes.Buffer - io.Copy(&buf, r) - outC <- buf.String() - }() - - inner() - - w.Close() - os.Stdout = oldStdout - out := strings.Replace(<-outC, "\r", "", -1) - - return out -} diff --git a/vendor/github.com/go-ini/ini/.gitignore b/vendor/github.com/go-ini/ini/.gitignore deleted file mode 100644 index 1241112..0000000 --- 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 b097527..0000000 --- a/vendor/github.com/go-ini/ini/.travis.yml +++ /dev/null @@ -1,15 +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 - - mkdir -p $HOME/gopath/src/gopkg.in - - ln -s $HOME/gopath/src/github.com/go-ini/ini $HOME/gopath/src/gopkg.in/ini.v1 - - 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 d361bbc..0000000 --- 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 1316911..0000000 --- a/vendor/github.com/go-ini/ini/Makefile +++ /dev/null @@ -1,15 +0,0 @@ -.PHONY: build test bench vet coverage - -build: vet bench - -test: - go test -v -cover -race - -bench: - go test -v -cover -race -test.bench=. -test.benchmem - -vet: - go vet - -coverage: - go test -coverprofile=c.out && go tool cover -html=c.out && rm c.out \ No newline at end of file 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 f4ff27c..0000000 --- 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 69aefef..0000000 --- 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/bench_test.go b/vendor/github.com/go-ini/ini/bench_test.go deleted file mode 100644 index fc18024..0000000 --- a/vendor/github.com/go-ini/ini/bench_test.go +++ /dev/null @@ -1,118 +0,0 @@ -// Copyright 2017 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_test - -import ( - "testing" - - "gopkg.in/ini.v1" -) - -func newTestFile(block bool) *ini.File { - c, _ := ini.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/error.go b/vendor/github.com/go-ini/ini/error.go deleted file mode 100644 index 80afe74..0000000 --- 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/file.go b/vendor/github.com/go-ini/ini/file.go deleted file mode 100644 index ce26c3b..0000000 --- a/vendor/github.com/go-ini/ini/file.go +++ /dev/null @@ -1,398 +0,0 @@ -// Copyright 2017 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" - "io" - "io/ioutil" - "os" - "strings" - "sync" -) - -// File represents a combination of a or more INI file(s) in memory. -type File struct { - options LoadOptions - dataSources []dataSource - - // Should make things safe, but sometimes doesn't matter. - BlockMode bool - lock sync.RWMutex - - // To keep data in order. - sectionList []string - // Actual data is stored here. - sections map[string]*Section - - 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, - } -} - -// 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 - } - 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 - } - - if PrettySection { - // Put a line between sections - if _, err := buf.WriteString(LineBreak); 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 - } - } - - for _, val := range key.nestedValues { - if _, err := buf.WriteString(indent + " " + 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/file_test.go b/vendor/github.com/go-ini/ini/file_test.go deleted file mode 100644 index 11612eb..0000000 --- a/vendor/github.com/go-ini/ini/file_test.go +++ /dev/null @@ -1,355 +0,0 @@ -// Copyright 2017 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_test - -import ( - "bytes" - "testing" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -func TestEmpty(t *testing.T) { - Convey("Create an empty object", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - // Should only have the default section - So(len(f.Sections()), ShouldEqual, 1) - - // Default section should not contain any key - So(len(f.Section("").Keys()), ShouldBeZeroValue) - }) -} - -func TestFile_NewSection(t *testing.T) { - Convey("Create a new section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - sec, err := f.NewSection("author") - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(sec.Name(), ShouldEqual, "author") - - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author"}) - - Convey("With duplicated name", func() { - sec, err := f.NewSection("author") - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - - // Does nothing if section already exists - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author"}) - }) - - Convey("With empty string", func() { - _, err := f.NewSection("") - So(err, ShouldNotBeNil) - }) - }) -} - -func TestFile_NewRawSection(t *testing.T) { - Convey("Create a new raw section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000`) - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(sec.Name(), ShouldEqual, "comments") - - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "comments"}) - So(f.Section("comments").Body(), ShouldEqual, `1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000`) - - Convey("With duplicated name", func() { - sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000`) - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "comments"}) - - // Overwrite previous existed section - So(f.Section("comments").Body(), ShouldEqual, `1111111111111111111000000000000000001110000`) - }) - - Convey("With empty string", func() { - _, err := f.NewRawSection("", "") - So(err, ShouldNotBeNil) - }) - }) -} - -func TestFile_NewSections(t *testing.T) { - Convey("Create new sections", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - So(f.NewSections("package", "author"), ShouldBeNil) - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "package", "author"}) - - Convey("With duplicated name", func() { - So(f.NewSections("author", "features"), ShouldBeNil) - - // Ignore section already exists - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "package", "author", "features"}) - }) - - Convey("With empty string", func() { - So(f.NewSections("", ""), ShouldNotBeNil) - }) - }) -} - -func TestFile_GetSection(t *testing.T) { - Convey("Get a section", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - sec, err := f.GetSection("author") - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(sec.Name(), ShouldEqual, "author") - - Convey("Section not exists", func() { - _, err := f.GetSection("404") - So(err, ShouldNotBeNil) - }) - }) -} - -func TestFile_Section(t *testing.T) { - Convey("Get a section", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - sec := f.Section("author") - So(sec, ShouldNotBeNil) - So(sec.Name(), ShouldEqual, "author") - - Convey("Section not exists", func() { - sec := f.Section("404") - So(sec, ShouldNotBeNil) - So(sec.Name(), ShouldEqual, "404") - }) - }) - - Convey("Get default section in lower case with insensitive load", t, func() { - f, err := ini.InsensitiveLoad([]byte(` -[default] -NAME = ini -VERSION = v1`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("name").String(), ShouldEqual, "ini") - So(f.Section("").Key("version").String(), ShouldEqual, "v1") - }) -} - -func TestFile_Sections(t *testing.T) { - Convey("Get all sections", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - secs := f.Sections() - names := []string{ini.DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"} - So(len(secs), ShouldEqual, len(names)) - for i, name := range names { - So(secs[i].Name(), ShouldEqual, name) - } - }) -} - -func TestFile_ChildSections(t *testing.T) { - Convey("Get child sections by parent name", t, func() { - f, err := ini.Load([]byte(` -[node] -[node.biz1] -[node.biz2] -[node.biz3] -[node.bizN] -`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - children := f.ChildSections("node") - names := []string{"node.biz1", "node.biz2", "node.biz3", "node.bizN"} - So(len(children), ShouldEqual, len(names)) - for i, name := range names { - So(children[i].Name(), ShouldEqual, name) - } - }) -} - -func TestFile_SectionStrings(t *testing.T) { - Convey("Get all section names", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.SectionStrings(), ShouldResemble, []string{ini.DEFAULT_SECTION, "author", "package", "package.sub", "features", "types", "array", "note", "comments", "string escapes", "advance"}) - }) -} - -func TestFile_DeleteSection(t *testing.T) { - Convey("Delete a section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - f.NewSections("author", "package", "features") - f.DeleteSection("features") - f.DeleteSection("") - So(f.SectionStrings(), ShouldResemble, []string{"author", "package"}) - }) -} - -func TestFile_Append(t *testing.T) { - Convey("Append a data source", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - So(f.Append(_MINIMAL_CONF, []byte(` -[author] -NAME = Unknwon`)), ShouldBeNil) - - Convey("With bad input", func() { - So(f.Append(123), ShouldNotBeNil) - So(f.Append(_MINIMAL_CONF, 123), ShouldNotBeNil) - }) - }) -} - -func TestFile_WriteTo(t *testing.T) { - Convey("Write content to somewhere", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - f.Section("author").Comment = `Information about package author -# Bio can be written in multiple lines.` - f.Section("author").Key("NAME").Comment = "This is author name" - f.Section("note").NewBooleanKey("boolean_key") - f.Section("note").NewKey("more", "notes") - - var buf bytes.Buffer - _, err = f.WriteTo(&buf) - 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 -boolean_key -more = notes - -; 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 - -`) - }) -} - -func TestFile_SaveTo(t *testing.T) { - Convey("Write content to somewhere", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.SaveTo("testdata/conf_out.ini"), ShouldBeNil) - So(f.SaveToIndent("testdata/conf_out.ini", "\t"), ShouldBeNil) - }) -} 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 535d358..0000000 --- a/vendor/github.com/go-ini/ini/ini.go +++ /dev/null @@ -1,194 +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" - "fmt" - "io" - "io/ioutil" - "os" - "regexp" - "runtime" -) - -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.32.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) -} - -// 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 -} - -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 - // AllowNestedValues indicates whether to allow AWS-like nested values. - // Docs: http://docs.aws.amazon.com/cli/latest/topic/config-vars.html#nested-values - AllowNestedValues 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 - // UnescapeValueCommentSymbols indicates to unescape comment symbols (\# and \;) inside value to regular format - // when value is NOT surrounded by any quotes. - // Note: UNSTABLE, behavior might change to only unescape inside double quotes but may noy necessary at all. - UnescapeValueCommentSymbols 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...) -} diff --git a/vendor/github.com/go-ini/ini/ini_internal_test.go b/vendor/github.com/go-ini/ini/ini_internal_test.go deleted file mode 100644 index 257ef1e..0000000 --- a/vendor/github.com/go-ini/ini/ini_internal_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 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_Version(t *testing.T) { - Convey("Get version", t, func() { - So(Version(), ShouldEqual, _VERSION) - }) -} - -func Test_isSlice(t *testing.T) { - Convey("Check if a string is in the slice", t, func() { - ss := []string{"a", "b", "c"} - So(inSlice("a", ss), ShouldBeTrue) - So(inSlice("d", ss), ShouldBeFalse) - }) -} 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 3e6992d..0000000 --- a/vendor/github.com/go-ini/ini/ini_test.go +++ /dev/null @@ -1,336 +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_test - -import ( - "bytes" - "io/ioutil" - "testing" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -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` - _MINIMAL_CONF = "testdata/minimal.ini" - _FULL_CONF = "testdata/full.ini" - _NOT_FOUND_CONF = "testdata/404.ini" -) - -func TestLoad(t *testing.T) { - Convey("Load from good data sources", t, func() { - f, err := ini.Load([]byte(` -NAME = ini -VERSION = v1 -IMPORT_PATH = gopkg.in/%(NAME)s.%(VERSION)s`), - "testdata/minimal.ini", - ioutil.NopCloser(bytes.NewReader([]byte(` -[author] -NAME = Unknwon -`))), - ) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - // Vaildate values make sure all sources are loaded correctly - sec := f.Section("") - So(sec.Key("NAME").String(), ShouldEqual, "ini") - So(sec.Key("VERSION").String(), ShouldEqual, "v1") - So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "gopkg.in/ini.v1") - - sec = f.Section("author") - So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") - So(sec.Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("Load from bad data sources", t, func() { - Convey("Invalid input", func() { - _, err := ini.Load(_NOT_FOUND_CONF) - So(err, ShouldNotBeNil) - }) - - Convey("Unsupported type", func() { - _, err := ini.Load(123) - So(err, ShouldNotBeNil) - }) - }) -} - -func TestLoadSources(t *testing.T) { - Convey("Load from data sources with options", t, func() { - Convey("Ignore nonexistent files", func() { - f, err := ini.LooseLoad(_NOT_FOUND_CONF, _MINIMAL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - Convey("Inverse case", func() { - _, err = ini.Load(_NOT_FOUND_CONF) - So(err, ShouldNotBeNil) - }) - }) - - Convey("Insensitive to section and key names", func() { - f, err := ini.InsensitiveLoad(_MINIMAL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("Author").Key("e-mail").String(), ShouldEqual, "u@gogs.io") - - Convey("Write out", func() { - var buf bytes.Buffer - _, err := f.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `[author] -e-mail = u@gogs.io - -`) - }) - - Convey("Inverse case", func() { - f, err := ini.Load(_MINIMAL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("Author").Key("e-mail").String(), ShouldBeEmpty) - }) - }) - - Convey("Ignore continuation lines", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - IgnoreContinuation: true, - }, []byte(` -key1=a\b\ -key2=c\d\ -key3=value`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("key1").String(), ShouldEqual, `a\b\`) - So(f.Section("").Key("key2").String(), ShouldEqual, `c\d\`) - So(f.Section("").Key("key3").String(), ShouldEqual, "value") - - Convey("Inverse case", func() { - f, err := ini.Load([]byte(` -key1=a\b\ -key2=c\d\`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("key1").String(), ShouldEqual, `a\bkey2=c\d`) - }) - }) - - Convey("Ignore inline comments", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - IgnoreInlineComment: true, - }, []byte(` -key1=value ;comment -key2=value2 #comment2`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("key1").String(), ShouldEqual, `value ;comment`) - So(f.Section("").Key("key2").String(), ShouldEqual, `value2 #comment2`) - - Convey("Inverse case", func() { - f, err := ini.Load([]byte(` -key1=value ;comment -key2=value2 #comment2`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("key1").String(), ShouldEqual, `value`) - So(f.Section("").Key("key1").Comment, ShouldEqual, `;comment`) - So(f.Section("").Key("key2").String(), ShouldEqual, `value2`) - So(f.Section("").Key("key2").Comment, ShouldEqual, `#comment2`) - }) - }) - - Convey("Allow boolean type keys", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - AllowBooleanKeys: true, - }, []byte(` -key1=hello -#key2 -key3`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").KeyStrings(), ShouldResemble, []string{"key1", "key3"}) - So(f.Section("").Key("key3").MustBool(false), ShouldBeTrue) - - Convey("Write out", func() { - var buf bytes.Buffer - _, err := f.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `key1 = hello -# key2 -key3 -`) - }) - - Convey("Inverse case", func() { - _, err := ini.Load([]byte(` -key1=hello -#key2 -key3`)) - So(err, ShouldNotBeNil) - }) - }) - - Convey("Allow shadow keys", func() { - f, err := ini.ShadowLoad([]byte(` -[remote "origin"] -url = https://github.com/Antergone/test1.git -url = https://github.com/Antergone/test2.git -fetch = +refs/heads/*:refs/remotes/origin/*`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test1.git") - So(f.Section(`remote "origin"`).Key("url").ValueWithShadows(), ShouldResemble, []string{ - "https://github.com/Antergone/test1.git", - "https://github.com/Antergone/test2.git", - }) - So(f.Section(`remote "origin"`).Key("fetch").String(), ShouldEqual, "+refs/heads/*:refs/remotes/origin/*") - - Convey("Write out", func() { - var buf bytes.Buffer - _, err := f.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 -fetch = +refs/heads/*:refs/remotes/origin/* - -`) - }) - - Convey("Inverse case", func() { - f, err := ini.Load([]byte(` -[remote "origin"] -url = https://github.com/Antergone/test1.git -url = https://github.com/Antergone/test2.git`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section(`remote "origin"`).Key("url").String(), ShouldEqual, "https://github.com/Antergone/test2.git") - }) - }) - - Convey("Unescape double quotes inside value", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - UnescapeValueDoubleQuotes: true, - }, []byte(` -create_repo="创建了仓库 %s"`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("create_repo").String(), ShouldEqual, `创建了仓库 %s`) - - Convey("Inverse case", func() { - f, err := ini.Load([]byte(` -create_repo="创建了仓库 %s"`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("create_repo").String(), ShouldEqual, `"创建了仓库 %s"`) - }) - }) - - Convey("Unescape comment symbols inside value", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - IgnoreInlineComment: true, - UnescapeValueCommentSymbols: true, - }, []byte(` -key = test value more text -`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("key").String(), ShouldEqual, `test value more text`) - }) - - Convey("Allow unparseable sections", func() { - f, err := ini.LoadSources(ini.LoadOptions{ - Insensitive: true, - UnparseableSections: []string{"core_lesson", "comments"}, - }, []byte(` -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 `)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("score").String(), ShouldEqual, "3") - So(f.Section("").Body(), ShouldBeEmpty) - So(f.Section("core_lesson").Body(), ShouldEqual, `my lesson state data – 1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000 – end my lesson state data`) - So(f.Section("comments").Body(), ShouldEqual, `<1> This slide has the fuel listed in the wrong units `) - - Convey("Write out", func() { - var buf bytes.Buffer - _, err := f.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `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 -`) - }) - - Convey("Inverse case", func() { - _, err := ini.Load([]byte(` -[CORE_LESSON] -my lesson state data – 1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000 – end my lesson state data`)) - So(err, ShouldNotBeNil) - }) - }) - }) -} 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 7c8566a..0000000 --- a/vendor/github.com/go-ini/ini/key.go +++ /dev/null @@ -1,751 +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 - Comment string - name string - value string - isAutoIncrement bool - isBooleanType bool - - isShadow bool - shadows []*Key - - nestedValues []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) -} - -func (k *Key) addNestedValue(val string) error { - if k.isAutoIncrement || k.isBooleanType { - return errors.New("cannot add nested value to auto-increment or boolean key") - } - - k.nestedValues = append(k.nestedValues, val) - return nil -} - -func (k *Key) AddNestedValue(val string) error { - if !k.s.f.options.AllowNestedValues { - return errors.New("nested value is not allowed") - } - return k.addNestedValue(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 -} - -// NestedValues returns nested values stored in the key. -// It is possible returned value is nil if no nested values stored in the key. -func (k *Key) NestedValues() []string { - return k.nestedValues -} - -// 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 || k == nk { - // 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 a13ad95..0000000 --- a/vendor/github.com/go-ini/ini/key_test.go +++ /dev/null @@ -1,523 +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_test - -import ( - "bytes" - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -func TestKey_AddShadow(t *testing.T) { - Convey("Add shadow to a key", t, func() { - f, err := ini.ShadowLoad([]byte(` -[notes] --: note1`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(k.AddShadow("ini.v1"), ShouldBeNil) - So(k.ValueWithShadows(), ShouldResemble, []string{"ini", "ini.v1"}) - - Convey("Add shadow to boolean key", func() { - k, err := f.Section("").NewBooleanKey("published") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.AddShadow("beta"), ShouldNotBeNil) - }) - - Convey("Add shadow to auto-increment key", func() { - So(f.Section("notes").Key("#1").AddShadow("beta"), ShouldNotBeNil) - }) - }) - - Convey("Shadow is not allowed", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(k.AddShadow("ini.v1"), ShouldNotBeNil) - }) -} - -// 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()) - } -} - -func TestKey_Helpers(t *testing.T) { - Convey("Getting and setting values", t, func() { - f, err := ini.Load(_FULL_CONF) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - Convey("Get string representation", func() { - sec := f.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("With ValueMapper", func() { - f.ValueMapper = func(in string) string { - if in == "gopkg.in/%(NAME)s.%(VERSION)s" { - return "github.com/go-ini/ini" - } - return in - } - So(sec.Key("IMPORT_PATH").String(), ShouldEqual, "github.com/go-ini/ini") - }) - }) - - Convey("Get values in non-default section", func() { - sec := f.Section("author") - So(sec, ShouldNotBeNil) - So(sec.Key("NAME").String(), ShouldEqual, "Unknwon") - So(sec.Key("GITHUB").String(), ShouldEqual, "https://github.com/Unknwon") - - sec = f.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 := f.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 := f.Section("package.sub").ParentKeys() - for _, k := range parentKeys { - So(k.Name(), ShouldEqual, "CLONE_URL") - } - }) - - Convey("Get overwrite value", func() { - So(f.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("Get sections", func() { - sections := f.Sections() - for i, name := range []string{ini.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(f.Section("package.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - So(f.Section("package.fake.sub").Key("CLONE_URL").String(), ShouldEqual, "https://gopkg.in/ini.v1") - }) - - Convey("Get multiple line value", func() { - So(f.Section("author").Key("BIO").String(), ShouldEqual, "Gopher.\nCoding addict.\nGood man.\n") - }) - - Convey("Get values with type", func() { - sec := f.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 := f.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 := f.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 := f.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 := f.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 := f.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 := f.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 := f.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 := f.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) - }) - }) -} - -func TestKey_StringsWithShadows(t *testing.T) { - Convey("Get strings of shadows of a key", t, func() { - f, err := ini.ShadowLoad([]byte("")) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NUMS", "1,2") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("NUMS", "4,5,6") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(k.StringsWithShadows(","), ShouldResemble, []string{"1", "2", "4", "5", "6"}) - }) -} - -func TestKey_SetValue(t *testing.T) { - Convey("Set value of key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.Value(), ShouldEqual, "ini") - - k.SetValue("ini.v1") - So(k.Value(), ShouldEqual, "ini.v1") - }) -} - -func TestKey_NestedValues(t *testing.T) { - Convey("Read and write nested values", t, func() { - f, err := ini.LoadSources(ini.LoadOptions{ - AllowNestedValues: true, - }, []byte(` -aws_access_key_id = foo -aws_secret_access_key = bar -region = us-west-2 -s3 = - max_concurrent_requests=10 - max_queue_size=1000`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("").Key("s3").NestedValues(), ShouldResemble, []string{"max_concurrent_requests=10", "max_queue_size=1000"}) - - var buf bytes.Buffer - _, err = f.WriteTo(&buf) - So(err, ShouldBeNil) - So(buf.String(), ShouldEqual, `aws_access_key_id = foo -aws_secret_access_key = bar -region = us-west-2 -s3 = - max_concurrent_requests=10 - max_queue_size=1000 - -`) - }) -} - -func TestRecursiveValues(t *testing.T) { - Convey("Recursive values should not reflect on same key", t, func() { - f, err := ini.Load([]byte(` -NAME = ini -[package] -NAME = %(NAME)s`)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - So(f.Section("package").Key("NAME").String(), ShouldEqual, "ini") - }) -} 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 db3af8f..0000000 --- a/vendor/github.com/go-ini/ini/parser.go +++ /dev/null @@ -1,401 +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, unescapeValueCommentSymbols 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] - } else if len(valQuote) == 0 && unescapeValueCommentSymbols { - if strings.Contains(line, `\;`) { - line = strings.Replace(line, `\;`, ";", -1) - } - if strings.Contains(line, `\#`) { - line = strings.Replace(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. - name := DEFAULT_SECTION - if f.options.Insensitive { - name = strings.ToLower(DEFAULT_SECTION) - } - section, _ := f.NewSection(name) - - // This "last" is not strictly equivalent to "previous one" if current key is not the first nested key - var isLastValueEmpty bool - var lastRegularKey *Key - - var line []byte - var inUnparseableSection bool - for !p.isEOF { - line, err = p.readUntil('\n') - if err != nil { - return err - } - - if f.options.AllowNestedValues && - isLastValueEmpty && len(line) > 0 { - if line[0] == ' ' || line[0] == '\t' { - lastRegularKey.addNestedValue(string(bytes.TrimSpace(line))) - continue - } - } - - 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, - f.options.UnescapeValueCommentSymbols) - 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, - f.options.UnescapeValueCommentSymbols) - if err != nil { - return err - } - isLastValueEmpty = len(value) == 0 - - key, err := section.NewKey(kname, value) - if err != nil { - return err - } - key.isAutoIncrement = isAutoIncr - key.Comment = strings.TrimSpace(p.comment.String()) - p.comment.Reset() - lastRegularKey = key - } - 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 bb0f266..0000000 --- a/vendor/github.com/go-ini/ini/parser_test.go +++ /dev/null @@ -1,77 +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_test - -import ( - "testing" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -func TestBOM(t *testing.T) { - Convey("Test handling BOM", t, func() { - Convey("UTF-8-BOM", func() { - f, err := ini.Load("testdata/UTF-8-BOM.ini") - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.Section("author").Key("E-MAIL").String(), ShouldEqual, "u@gogs.io") - }) - - Convey("UTF-16-LE-BOM", func() { - f, err := ini.Load("testdata/UTF-16-LE-BOM.ini") - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - }) - - Convey("UTF-16-BE-BOM", func() { - }) - }) -} - -func TestBadLoad(t *testing.T) { - Convey("Load with bad data", t, func() { - Convey("Bad section name", func() { - _, err := ini.Load([]byte("[]")) - So(err, ShouldNotBeNil) - - _, err = ini.Load([]byte("[")) - So(err, ShouldNotBeNil) - }) - - Convey("Bad keys", func() { - _, err := ini.Load([]byte(`"""name`)) - So(err, ShouldNotBeNil) - - _, err = ini.Load([]byte(`"""name"""`)) - So(err, ShouldNotBeNil) - - _, err = ini.Load([]byte(`""=1`)) - So(err, ShouldNotBeNil) - - _, err = ini.Load([]byte(`=`)) - So(err, ShouldNotBeNil) - - _, err = ini.Load([]byte(`name`)) - So(err, ShouldNotBeNil) - }) - - Convey("Bad values", func() { - _, err := ini.Load([]byte(`name="""Unknwon`)) - So(err, ShouldNotBeNil) - }) - }) -} 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 d8a4026..0000000 --- a/vendor/github.com/go-ini/ini/section.go +++ /dev/null @@ -1,257 +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) -} - -// SetBody updates body content only if section is raw. -func (s *Section) SetBody(body string) { - if !s.isRawSection { - return - } - s.rawBody = body -} - -// 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. -// TODO: delete me in v2 -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 e9c3478..0000000 --- a/vendor/github.com/go-ini/ini/section_test.go +++ /dev/null @@ -1,313 +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_test - -import ( - "testing" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -func TestSection_SetBody(t *testing.T) { - Convey("Set body of raw section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - sec, err := f.NewRawSection("comments", `1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000`) - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(sec.Body(), ShouldEqual, `1111111111111111111000000000000000001110000 -111111111111111111100000000000111000000000`) - - sec.SetBody("1111111111111111111000000000000000001110000") - So(sec.Body(), ShouldEqual, `1111111111111111111000000000000000001110000`) - - Convey("Set for non-raw section", func() { - sec, err := f.NewSection("author") - So(err, ShouldBeNil) - So(sec, ShouldNotBeNil) - So(sec.Body(), ShouldBeEmpty) - - sec.SetBody("1111111111111111111000000000000000001110000") - So(sec.Body(), ShouldBeEmpty) - }) - }) -} - -func TestSection_NewKey(t *testing.T) { - Convey("Create a new key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.Name(), ShouldEqual, "NAME") - So(k.Value(), ShouldEqual, "ini") - - Convey("With duplicated name", func() { - k, err := f.Section("").NewKey("NAME", "ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - // Overwrite previous existed key - So(k.Value(), ShouldEqual, "ini.v1") - }) - - Convey("With empty string", func() { - _, err := f.Section("").NewKey("", "") - So(err, ShouldNotBeNil) - }) - }) - - Convey("Create keys with same name and allow shadow", t, func() { - f, err := ini.ShadowLoad([]byte("")) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("NAME", "ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(k.ValueWithShadows(), ShouldResemble, []string{"ini", "ini.v1"}) - }) -} - -func TestSection_NewBooleanKey(t *testing.T) { - Convey("Create a new boolean key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewBooleanKey("start-ssh-server") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.Name(), ShouldEqual, "start-ssh-server") - So(k.Value(), ShouldEqual, "true") - - Convey("With empty string", func() { - _, err := f.Section("").NewBooleanKey("") - So(err, ShouldNotBeNil) - }) - }) -} - -func TestSection_GetKey(t *testing.T) { - Convey("Get a key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - k, err = f.Section("").GetKey("NAME") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.Name(), ShouldEqual, "NAME") - So(k.Value(), ShouldEqual, "ini") - - Convey("Key not exists", func() { - _, err := f.Section("").GetKey("404") - So(err, ShouldNotBeNil) - }) - - Convey("Key exists in parent section", func() { - k, err := f.Section("parent").NewKey("AGE", "18") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - k, err = f.Section("parent.child.son").GetKey("AGE") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - So(k.Value(), ShouldEqual, "18") - }) - }) -} - -func TestSection_HasKey(t *testing.T) { - Convey("Check if a key exists", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(f.Section("").HasKey("NAME"), ShouldBeTrue) - So(f.Section("").Haskey("NAME"), ShouldBeTrue) - So(f.Section("").HasKey("404"), ShouldBeFalse) - So(f.Section("").Haskey("404"), ShouldBeFalse) - }) -} - -func TestSection_HasValue(t *testing.T) { - Convey("Check if contains a value in any key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(f.Section("").HasValue("ini"), ShouldBeTrue) - So(f.Section("").HasValue("404"), ShouldBeFalse) - }) -} - -func TestSection_Key(t *testing.T) { - Convey("Get a key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - k = f.Section("").Key("NAME") - So(k, ShouldNotBeNil) - So(k.Name(), ShouldEqual, "NAME") - So(k.Value(), ShouldEqual, "ini") - - Convey("Key not exists", func() { - k := f.Section("").Key("404") - So(k, ShouldNotBeNil) - So(k.Name(), ShouldEqual, "404") - }) - - Convey("Key exists in parent section", func() { - k, err := f.Section("parent").NewKey("AGE", "18") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - k = f.Section("parent.child.son").Key("AGE") - So(k, ShouldNotBeNil) - So(k.Value(), ShouldEqual, "18") - }) - }) -} - -func TestSection_Keys(t *testing.T) { - Convey("Get all keys in a section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("VERSION", "v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - keys := f.Section("").Keys() - names := []string{"NAME", "VERSION", "IMPORT_PATH"} - So(len(keys), ShouldEqual, len(names)) - for i, name := range names { - So(keys[i].Name(), ShouldEqual, name) - } - }) -} - -func TestSection_ParentKeys(t *testing.T) { - Convey("Get all keys of parent sections", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("package").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("package").NewKey("VERSION", "v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("package").NewKey("IMPORT_PATH", "gopkg.in/ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - keys := f.Section("package.sub.sub2").ParentKeys() - names := []string{"NAME", "VERSION", "IMPORT_PATH"} - So(len(keys), ShouldEqual, len(names)) - for i, name := range names { - So(keys[i].Name(), ShouldEqual, name) - } - }) -} - -func TestSection_KeyStrings(t *testing.T) { - Convey("Get all key names in a section", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("VERSION", "v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(f.Section("").KeyStrings(), ShouldResemble, []string{"NAME", "VERSION", "IMPORT_PATH"}) - }) -} - -func TestSection_KeyHash(t *testing.T) { - Convey("Get clone of key hash", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("VERSION", "v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - k, err = f.Section("").NewKey("IMPORT_PATH", "gopkg.in/ini.v1") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - hash := f.Section("").KeysHash() - relation := map[string]string{ - "NAME": "ini", - "VERSION": "v1", - "IMPORT_PATH": "gopkg.in/ini.v1", - } - for k, v := range hash { - So(v, ShouldEqual, relation[k]) - } - }) -} - -func TestSection_DeleteKey(t *testing.T) { - Convey("Delete a key", t, func() { - f := ini.Empty() - So(f, ShouldNotBeNil) - - k, err := f.Section("").NewKey("NAME", "ini") - So(err, ShouldBeNil) - So(k, ShouldNotBeNil) - - So(f.Section("").HasKey("NAME"), ShouldBeTrue) - f.Section("").DeleteKey("NAME") - So(f.Section("").HasKey("NAME"), ShouldBeFalse) - }) -} 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 9719dc6..0000000 --- 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 && int64(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 75987ea..0000000 --- a/vendor/github.com/go-ini/ini/struct_test.go +++ /dev/null @@ -1,387 +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_test - -import ( - "bytes" - "fmt" - "strings" - "testing" - "time" - - . "github.com/smartystreets/goconvey/convey" - "gopkg.in/ini.v1" -) - -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_MapToStruct(t *testing.T) { - Convey("Map to struct", t, func() { - Convey("Map file to struct", func() { - ts := new(testStruct) - So(ini.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 := ini.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() { - f, err := ini.Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - So(f.MapTo(testStruct{}), ShouldNotBeNil) - }) - - Convey("Map to unsupported type", func() { - f, err := ini.Load([]byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - So(f, ShouldNotBeNil) - - f.NameMapper = func(raw string) string { - if raw == "Byte" { - return "NAME" - } - return raw - } - So(f.MapTo(&unsupport{}), ShouldNotBeNil) - So(f.MapTo(&unsupport2{}), ShouldNotBeNil) - So(f.MapTo(&unsupport4{}), ShouldNotBeNil) - }) - - Convey("Map to omitempty field", func() { - ts := new(testStruct) - So(ini.MapTo(ts, []byte(_CONF_DATA_STRUCT)), ShouldBeNil) - - So(ts.Omitted, ShouldEqual, true) - }) - - Convey("Map with shadows", func() { - f, err := ini.LoadSources(ini.LoadOptions{AllowShadows: true}, []byte(_CONF_DATA_STRUCT)) - So(err, ShouldBeNil) - ts := new(testStruct) - So(f.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(ini.MapTo(&testStruct{}, "hi"), ShouldNotBeNil) - }) - - Convey("Map to wrong types and gain default values", func() { - f, err := ini.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(f.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() { - f, err := ini.Load([]byte(` -name=bruce -age=a30`)) - So(err, ShouldBeNil) - - type Strict struct { - Name string `ini:"name"` - Age int `ini:"age"` - } - s := new(Strict) - - So(f.Section("").StrictMapTo(s), ShouldNotBeNil) - }) - - Convey("Map slice in strict mode", t, func() { - f, err := ini.Load([]byte(` -names=alice, bruce`)) - So(err, ShouldBeNil) - - type Strict struct { - Names []string `ini:"names"` - } - s := new(Strict) - - So(f.Section("").StrictMapTo(s), ShouldBeNil) - So(fmt.Sprint(s.Names), ShouldEqual, "[alice bruce]") - }) -} - -func Test_ReflectFromStruct(t *testing.T) { - 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 := ini.Empty() - So(ini.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(ini.ReflectFrom(cfg, Author{}), ShouldNotBeNil) - }) - - Convey("Reflect from struct with omitempty", func() { - cfg := ini.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(ini.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(ini.MapToWithMapper(&testMapper{}, ini.TitleUnderscore, []byte("packag_name=ini")), ShouldBeNil) - - cfg, err := ini.Load([]byte("PACKAGE_NAME=ini")) - So(err, ShouldBeNil) - So(cfg, ShouldNotBeNil) - - cfg.NameMapper = ini.AllCapsUnderscore - tg := new(testMapper) - So(cfg.MapTo(tg), ShouldBeNil) - So(tg.PackageName, ShouldEqual, "ini") - }) -} - -type testDurationStruct struct { - Duration time.Duration `ini:"Duration"` -} - -func Test_Duration(t *testing.T) { - Convey("Duration less than 16m50s", t, func() { - ds := new(testDurationStruct) - So(ini.MapTo(ds, []byte("Duration=16m49s")), ShouldBeNil) - - dur, err := time.ParseDuration("16m49s") - So(err, ShouldBeNil) - So(ds.Duration.Seconds(), ShouldEqual, dur.Seconds()) - }) -} diff --git a/vendor/github.com/go-serve/bindatafs/.gitignore b/vendor/github.com/go-serve/bindatafs/.gitignore deleted file mode 100644 index 68da9a7..0000000 --- a/vendor/github.com/go-serve/bindatafs/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Ignore dependency flags generated by make -*.dep diff --git a/vendor/github.com/go-serve/bindatafs/.travis.yml b/vendor/github.com/go-serve/bindatafs/.travis.yml deleted file mode 100644 index baadbb7..0000000 --- a/vendor/github.com/go-serve/bindatafs/.travis.yml +++ /dev/null @@ -1,21 +0,0 @@ -language: go - -sudo: false - -before_script: - - go get github.com/mattn/goveralls - -script: - - make test - - $HOME/gopath/bin/goveralls -service=travis-ci -ignore='examples/*' - -os: - - linux - - osx - -go: - - 1.4 - - 1.5 - - 1.6 - - 1.7 - - tip diff --git a/vendor/github.com/go-serve/bindatafs/CONTRIBUTING.md b/vendor/github.com/go-serve/bindatafs/CONTRIBUTING.md deleted file mode 100644 index d0e2d90..0000000 --- a/vendor/github.com/go-serve/bindatafs/CONTRIBUTING.md +++ /dev/null @@ -1,77 +0,0 @@ -## Contribution guidelines. - -So you wish to contribute to this project? Fantastic! -Here are a few guidelines to help you do this in a -streamlined fashion. - - -## Bug reports - -When supplying a bug report, please consider the following guidelines. -These serve to make it easier for us to address the issue and find a solution. -Most of these are pretty self-evident, but sometimes it is still necessary -to reiterate them. - -* Be clear in the way you express the problem. Use simple language and - just enough of it to clearly define the issue. Not everyone is a native - English speaker. And while most can handle themselves pretty well, - it helps to stay away from more esoteric vocabulary. - - Be patient with non-native English speakers. If their bug reports - or comments are hard to understand, just ask for clarification. - Do not start guessing at their meaning, as this may just lead to - more confusion and misunderstandings. -* Clearly define any information which is relevant to the problem. - This includes library versions, operating system and any other - external dependencies which may be needed. -* Where applicable, provide a step-by-step listing of the way to - reproduce the problem. Make sure this is the simplest possible - way to do so. Omit any and all unneccesary steps, because they may - just complicate our understanding of the real problem. - If need be, create a whole new code project on your local machine, - which specifically tries to create the problem you are running into; - nothing more, nothing less. - - Include this program in the bug report. It often suffices to paste - the code in a [Gist](https://gist.github.com) or on the - [Go playground](http://play.golang.org). -* If possible, provide us with a listing of the steps you have already - undertaken to solve the problem. This can save us a great deal of - wasted time, trying out solutions you have already covered. - - -## Pull requests - -Bug reports are great. Supplying fixes to bugs is even better. -When submitting a pull request, the following guidelines are -good to keep in mind: - -* `go fmt`: **Always** run your code through `go fmt`, before - committing it. Code has to be readable by many different - people. And the only way this will be as painless as possible, - is if we all stick to the same code style. - - Some of our projects may have automated build-servers hooked up - to commit hooks. These will vet any submitted code and determine - if it meets a set of properties. One of which is code formatting. - These servers will outright deny a submission which has not been - run through `go fmt`, even if the code itself is correct. - - We try to maintain a zero-tolerance policy on this matter, - because consistently formatted code makes life a great deal - easier for everyone involved. -* Commit log messages: When committing changes, do so often and - clearly -- Even if you have changed only 1 character in a code - comment. This means that commit log messages should clearly state - exactly what the change does and why. If it fixes a known issue, - then mention the issue number in the commit log. E.g.: - - > Fixes return value for `foo/boo.Baz()` to be consistent with - > the rest of the API. This addresses issue #32 - - Do not pile a lot of unrelated changes into a single commit. - Pick and choose only those changes for a single commit, which are - directly related. We would much rather see a hundred commits - saying nothing but `"Runs go fmt"` in between any real fixes - than have these style changes embedded in those real fixes. - It creates a lot of noise when trying to review code. diff --git a/vendor/github.com/go-serve/bindatafs/LICENSE.md b/vendor/github.com/go-serve/bindatafs/LICENSE.md deleted file mode 100644 index 0346264..0000000 --- a/vendor/github.com/go-serve/bindatafs/LICENSE.md +++ /dev/null @@ -1,26 +0,0 @@ -The MIT License (MIT) -===================== - -Copyright © 2016 Yeung Shu Hung ([Koala Yeung](https://github,com/yookoala), -koalay at gmail.com) - -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-serve/bindatafs/Makefile b/vendor/github.com/go-serve/bindatafs/Makefile deleted file mode 100644 index ad8df51..0000000 --- a/vendor/github.com/go-serve/bindatafs/Makefile +++ /dev/null @@ -1,30 +0,0 @@ -# -# This file is only used to standardize testing -# environment. It doesn't build any binary. Nor -# does it needed in the installation process. -# -# For installation details, please read README.md -# - -test: timestamp test.dep - @echo - @echo "== Run tests" - go test -v -cover ./... - -test.dep: - @echo - @echo "== Install test dependencies" - go get -u golang.org/x/tools/godoc/vfs - touch test.dep - -generate: timestamp - @echo - @echo "== Generate assets.go" - go generate ./examples/... - -timestamp: - @echo - @echo "== Ensure timestamp of local assets" - TZ=Asia/Hong_Kong find ./examples/. -type f -exec touch -t 201611210125.30 "{}" \; - -.PHONY: test generate timestamp diff --git a/vendor/github.com/go-serve/bindatafs/README.md b/vendor/github.com/go-serve/bindatafs/README.md deleted file mode 100644 index adb5c95..0000000 --- a/vendor/github.com/go-serve/bindatafs/README.md +++ /dev/null @@ -1,73 +0,0 @@ -# bindatafs [![Documentations][godoc-badge]][godoc] [![Travis CI results][travis-badge]][travis] [![Coverage Status][coveralls-badge]][coveralls] - -[travis]: https://travis-ci.org/go-serve/bindatafs -[travis-badge]: https://api.travis-ci.org/go-serve/bindatafs.svg?branch=master -[godoc]: https://godoc.org/github.com/go-serve/bindatafs -[godoc-badge]: https://img.shields.io/badge/godoc-reference-5272B4.svg -[coveralls]: https://coveralls.io/github/go-restit/lzjson?branch=master -[coveralls-badge]: https://coveralls.io/repos/github/go-restit/lzjson/badge.svg?branch=master - -[repository]: https://github.com/go-serve/bindatafs -[go-bindata]: https://github.com/jteeuwen/go-bindata -[http.FileServer]: https://golang.org/pkg/net/http/#FileServer - - -**bindatafs** helps to serve [go-bindata][go-bindata]-generated assets with -[http.FileServer][http.FileServer]. - - -## Install - -``` -go get -u github.com/go-serve/bindatafs -``` - - -## Example - -```go - -package main - -import ( - "net/http" - - "github.com/go-serve/bindatafs" - "golang.org/x/tools/godoc/vfs/httpfs" -) - -// FileSystem returns a Filesystem implementation for the given assets -func FileSystem() bindatafs.FileSystem { - // assume you have Asset, AssetDir, AssetInfo are generated by go-bindata - return bindatafs.New("assets://", Asset, AssetDir, AssetInfo) -} - -func main() { - handler := http.FileServer(httpfs.New(FileSystem())) - http.ListenAndServe(":8080", handler) -} - -``` - -For more examples, please read the [Documentations][godoc]. - - -## Author -This software is written by [Koala Yeung](https://github.com/yookoala) (koalay at gmail.com). - - -## Licence -This software is licenced under the MIT License. You may obtain a copy of the -licence in the [LICENSE.md][LICENSE.md] file in this repository. - -[LICENSE.md]: LICENSE.md - - -## Contributing and Bug Report -Pull requests are welcomed. Please read the [CONTRIBUTING.md][CONTRIBUTING.md] -for details. - -Bug reports are always welcome to our [issue tracker][issues]. - -[CONTRIBUTING.md]: CONTRIBUTING.md -[issues]: https://github.com/go-serve/goserve/issues diff --git a/vendor/github.com/go-serve/bindatafs/bindatafs.go b/vendor/github.com/go-serve/bindatafs/bindatafs.go deleted file mode 100644 index 44ebfe6..0000000 --- a/vendor/github.com/go-serve/bindatafs/bindatafs.go +++ /dev/null @@ -1,170 +0,0 @@ -// Package bindatafs provides wrapper vfs.FileSystem implementation to bridge -// go-bindata-generated assets to be served by http.FileServer. -package bindatafs - -import ( - "bytes" - "os" - "path" - "syscall" - - "golang.org/x/tools/godoc/vfs" -) - -// FileSystem is a copy of vfs interface FileSystem -type FileSystem interface { - vfs.Opener - Lstat(path string) (os.FileInfo, error) - Stat(path string) (os.FileInfo, error) - ReadDir(path string) ([]os.FileInfo, error) - String() string -} - -// New returns a FileSystem implementation of the given go-bindata generated assets -func New(name string, Asset AssetFunc, AssetDir AssetDirFunc, AssetInfo AssetInfoFunc) FileSystem { - return &binAssets{ - name: name, - Asset: Asset, - AssetDir: AssetDir, - AssetInfo: AssetInfo, - } -} - -// AssetFunc is the Assets() function generated by go-bindata -type AssetFunc func(name string) ([]byte, error) - -// AssetDirFunc is the AssetDir() function generated by go-bindata -type AssetDirFunc func(name string) ([]string, error) - -// AssetInfoFunc is the AssetInfo() function generated by go-bindata -type AssetInfoFunc func(name string) (os.FileInfo, error) - -type binAssets struct { - name string - Asset AssetFunc - AssetDir AssetDirFunc - AssetInfo AssetInfoFunc -} - -func (binAssets *binAssets) Open(pathname string) (file vfs.ReadSeekCloser, err error) { - - pathname = binAssets.pathname(pathname) - - // if is dir, return a dummy assetDir - if _, err = binAssets.AssetDir(pathname); err == nil { - err = &os.PathError{ - Op: "Open", - Path: pathname, - Err: syscall.ENOENT, - } - return - } - - // if is a file, return buffered data - var data []byte - if data, err = binAssets.Asset(pathname); err == nil { - file = &FileReader{Reader: bytes.NewReader(data)} - return - } - - err = &os.PathError{ - Op: "Open", - Path: pathname, - Err: syscall.ENOENT, - } - return -} - -func (binAssets *binAssets) Lstat(pathname string) (fi os.FileInfo, err error) { - return binAssets.Stat(pathname) -} - -func (binAssets binAssets) pathname(pathname string) string { - if len(pathname) > 0 && pathname[0] == '/' { - return pathname[1:] - } - return pathname -} - -func (binAssets *binAssets) Stat(pathname string) (fi os.FileInfo, err error) { - - pathname = binAssets.pathname(pathname) - - // if is dir, return a dummy assetDir - if _, err = binAssets.AssetDir(pathname); err == nil { - fi = &dirInfo{name: path.Base(pathname)} - return - } - - // if is a file, return buffered data - if fi, err = binAssets.AssetInfo(pathname); err == nil { - fi = &fileInfo{name: path.Base(pathname), FileInfo: fi} - return - } - - // return standard not found signal - err = &os.PathError{ - Op: "Stat", - Path: pathname, - Err: syscall.ENOENT, - } - return -} - -func (binAssets *binAssets) ReadDir(pathname string) (fiList []os.FileInfo, err error) { - - pathname = binAssets.pathname(pathname) - - // if is a file, return error - if _, err = binAssets.AssetInfo(pathname); err == nil { - err = &os.PathError{ - Op: "ReadDir", - Path: pathname, - Err: syscall.ENOENT, - } - return - } - - // if is dir, return a dummy assetDir - var names []string - if names, err = binAssets.AssetDir(pathname); err != nil { - err = &os.PathError{ - Op: "ReadDir", - Path: pathname, - Err: syscall.ENOENT, - } - return - } - - // read all names entity to file info - fiList = make([]os.FileInfo, len(names)) - for i, name := range names { - fiList[i], err = binAssets.Stat(path.Join(pathname, name)) - } - - return -} - -func (binAssets *binAssets) String() string { - return binAssets.name -} - -// FileReader implements vfs.ReadSeekCloser -type FileReader struct { - *bytes.Reader -} - -// Read implements io.Reader -func (r *FileReader) Read(p []byte) (int, error) { - return r.Reader.Read(p) -} - -// Seek implements io.Seeker -func (r *FileReader) Seek(offset int64, whence int) (int64, error) { - return r.Reader.Seek(offset, whence) -} - -// Close implements io.Closer -func (r *FileReader) Close() error { - return nil -} diff --git a/vendor/github.com/go-serve/bindatafs/bindatafs_test.go b/vendor/github.com/go-serve/bindatafs/bindatafs_test.go deleted file mode 100644 index 3cf114a..0000000 --- a/vendor/github.com/go-serve/bindatafs/bindatafs_test.go +++ /dev/null @@ -1,353 +0,0 @@ -package bindatafs_test - -import ( - "fmt" - "io/ioutil" - "os" - "testing" - - "golang.org/x/tools/godoc/vfs" - - "github.com/go-serve/bindatafs" - "github.com/go-serve/bindatafs/examples/example1" -) - -const ASSETS_PATH = "./examples/example1/assets/" - -func TestFileSystem(t *testing.T) { - var vfsFS vfs.FileSystem = bindatafs.New("assets://", nil, nil, nil) - _ = vfsFS // just to prove bindatafs.FileSystem implements http.FileSystem -} - -func msgNotFound(op, pathname string) string { - return fmt.Sprintf("%s %s: no such file or directory", op, pathname) -} - -func fileInfoEqual(src, target os.FileInfo) (err error) { - if want, have := src.Name(), target.Name(); want != have { - err = fmt.Errorf("Name(): expected %#v, got %#v", want, have) - return - } - if want, have := src.IsDir(), target.IsDir(); want != have { - err = fmt.Errorf("IsDir(): expected %#v, got %#v", want, have) - return - } - if src.IsDir() { - if want, have := int64(0), target.Size(); want != have { - err = fmt.Errorf("Size(): expected %#v, got %#v", want, have) - return - } - if want, have := os.ModeDir, target.Mode()&os.ModeType; want != have { - err = fmt.Errorf("Mode():\nexpected %b\ngot %b", want, have) - return - } - if want, have := os.FileMode(0777), target.Mode()&os.ModePerm; want != have { - err = fmt.Errorf("Mode():\nexpected %b\ngot %b", want, have) - return - } - if want, have := int64(0), target.ModTime().Unix(); want != have { - err = fmt.Errorf("Modtime(): expected %#v, got %#v", want, have) - return - } - } else { - if want, have := src.Size(), target.Size(); want != have { - err = fmt.Errorf("Size(): expected %#v, got %#v", want, have) - return - } - if want, have := os.FileMode(0444), target.Mode()&os.ModePerm; want != have { - err = fmt.Errorf("Mode():\nexpected %b\ngot %b", want, have) - return - } - if want, have := src.ModTime().Unix(), target.ModTime().Unix(); want != have { - err = fmt.Errorf("Modtime(): expected %#v, got %#v", want, have) - return - } - } - return -} - -func TestFileSystem_Open(t *testing.T) { - fs := example1.FileSystem() - tests := []struct { - desc string - path string - err string - }{ - { - desc: "test open file", - path: "hello.txt", - }, - { - desc: "test open sub-directory file", - path: "hello/world.txt", - }, - { - desc: "test open directory", - path: "hello", - err: msgNotFound("Open", "hello"), - }, - { - desc: "test open non-exists path", - path: "notfound", - err: msgNotFound("Open", "notfound"), - }, - } - - for i, test := range tests { - t.Logf("test fs.Open %d: %s", i+1, test.desc) - - // get the file/dir in the bindatafs - file, err := fs.Open(test.path) - if test.err != "" { - if err == nil { - t.Errorf("expected error %#v, got nil", test.err) - } else if want, have := test.err, err.Error(); want != have { - t.Errorf("expected error %#v, got %#v", want, have) - } - continue - } - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - - fileBytes, err := ioutil.ReadAll(file) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - defer file.Close() - - // get the counter part in the source assets - srcFile, err := os.Open(ASSETS_PATH + test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - defer srcFile.Close() - srcFileBytes, err := ioutil.ReadAll(srcFile) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - - if want, have := string(srcFileBytes), string(fileBytes); want != have { - t.Errorf("unexpected content for %#v", test.path) - t.Logf("expected:\n%s\ngot:\n%s", want, have) - } - - } -} - -func TestFileSystem_Stat(t *testing.T) { - - fs := example1.FileSystem() - assetvfs := vfs.OS(ASSETS_PATH) - - tests := []struct { - desc string - path string - err string - }{ - { - desc: "test open file", - path: "hello.txt", - }, - { - desc: "test open sub-directory file", - path: "hello/world.txt", - }, - { - desc: "test open directory", - path: "hello", - }, - { - desc: "test open non-exists path", - path: "notfound", - err: msgNotFound("Stat", "notfound"), - }, - } - - for i, test := range tests { - t.Logf("test fs.Stat %d: %s", i+1, test.desc) - - // get the file/dir in the bindatafs - targetStat, err := fs.Stat(test.path) - if test.err != "" { - if err == nil { - t.Errorf("expected error %#v, got nil", test.err) - } else if want, have := test.err, err.Error(); want != have { - t.Errorf("expected error %#v, got %#v", want, have) - } - continue - } - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - if targetStat == nil { - t.Errorf("targetStat is nil") - continue - } - - // get the counter part in the source assets - srcFile, err := os.Open(ASSETS_PATH + test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - continue - } - defer srcFile.Close() - srcStat, err := srcFile.Stat() - - if err = fileInfoEqual(srcStat, targetStat); err != nil { - t.Errorf("error: %s", err.Error()) - } - - // get the counter part in vfs.OS file system - vfsStat, err := assetvfs.Stat(test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - continue - } - if err = fileInfoEqual(vfsStat, targetStat); err != nil { - t.Errorf("error: %s", err.Error()) - } - - } - - for i, test := range tests { - t.Logf("test fs.Lstat %d: %s", i+1, test.desc) - - // get the file/dir in the bindatafs - targetStat, err := fs.Lstat(test.path) - if test.err != "" { - if err == nil { - t.Errorf("expected error %#v, got nil", test.err) - } else if want, have := test.err, err.Error(); want != have { - t.Errorf("expected error %#v, got %#v", want, have) - } - continue - } - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - if targetStat == nil { - t.Errorf("targetStat is nil") - continue - } - - // get the counter part in the source assets - srcFile, err := os.Open(ASSETS_PATH + test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - continue - } - defer srcFile.Close() - srcStat, err := srcFile.Stat() - - if err = fileInfoEqual(srcStat, targetStat); err != nil { - t.Errorf("error: %s", err.Error()) - } - - // get the counter part in vfs.OS file system - vfsStat, err := assetvfs.Stat(test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - continue - } - if err = fileInfoEqual(vfsStat, targetStat); err != nil { - t.Errorf("error: %s", err.Error()) - } - } - -} - -func TestFileSystem_Readdir(t *testing.T) { - - fs := example1.FileSystem() - assetvfs := vfs.OS(ASSETS_PATH) - - tests := []struct { - desc string - path string - err string - files map[string]string - }{ - { - desc: "test open file", - path: "hello.txt", - err: msgNotFound("ReadDir", "hello.txt"), - }, - { - desc: "test open sub-directory file", - path: "hello/world.txt", - err: msgNotFound("ReadDir", "hello/world.txt"), - }, - { - desc: "test open directory", - path: "hello", - files: map[string]string{ - "bar.txt": "file", - "world.txt": "file", - }, - }, - { - desc: "test open root directory", - path: "", - files: map[string]string{ - "hello": "dir", - "hello.txt": "file", - "index.html": "file", - }, - }, - { - desc: "test open non-exists path", - path: "notfound", - err: msgNotFound("ReadDir", "notfound"), - }, - } - - for i, test := range tests { - t.Logf("test fs.ReadDir %d: %s", i+1, test.desc) - - fsList, err := fs.ReadDir(test.path) - if test.err != "" { - if err == nil { - t.Errorf("expected error %#v, got nil", test.err) - } else if want, have := test.err, err.Error(); want != have { - t.Errorf("expected %#v, got %#v", want, have) - } - continue - } - - if want, have := len(test.files), len(fsList); want != have { - t.Errorf("expected len(fsList) to be %d, got %d", want, have) - } - - vfsList, err := assetvfs.ReadDir(test.path) - if err != nil { - t.Errorf("unexpected error: %s", err.Error()) - } - vfsMap := make(map[string]os.FileInfo) - for _, fi := range vfsList { - vfsMap[fi.Name()] = fi - } - - for _, fi := range fsList { - if _, ok := test.files[fi.Name()]; !ok { - t.Errorf("unexpected entity: %s", fi.Name()) - } - if _, ok := vfsMap[fi.Name()]; !ok { - t.Errorf("unexpected entity: %s", fi.Name()) - } - } - - } - -} - -func TestFileSystem_String(t *testing.T) { - fs := bindatafs.New("hello", nil, nil, nil) - if want, have := "hello", fs.String(); want != have { - t.Logf("expected %#v, got %#v", want, have) - } -} diff --git a/vendor/github.com/go-serve/bindatafs/example_bindatafs_fs_test.go b/vendor/github.com/go-serve/bindatafs/example_bindatafs_fs_test.go deleted file mode 100644 index f36f04b..0000000 --- a/vendor/github.com/go-serve/bindatafs/example_bindatafs_fs_test.go +++ /dev/null @@ -1,59 +0,0 @@ -package bindatafs_test - -import ( - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - - "github.com/go-serve/bindatafs" - "github.com/go-serve/bindatafs/examples/example1" - "golang.org/x/tools/godoc/vfs/httpfs" -) - -func exampleFsIndex(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, "Hello Index\n") -} - -func ExampleFileSystem() { - - // create vfs.FileSystem implementation for - // the go-bindata generated assets - assetsfs := bindatafs.New( - "assets://", - example1.Asset, - example1.AssetDir, - example1.AssetInfo, - ) - - // serve the files with http - mux := http.NewServeMux() - mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(httpfs.New(assetsfs)))) - mux.Handle("/", http.HandlerFunc(exampleFsIndex)) - - // production: uncomment this - //http.ListenAndServe(":8080", mux) - - // below are for testings, can be removed for production - - // test the mux with httptest server - server := httptest.NewServer(mux) - defer server.Close() - - // examine the index - resp, _ := http.Get(server.URL) - defer resp.Body.Close() - body, _ := ioutil.ReadAll(resp.Body) - fmt.Printf("%s", body) - - // examine an asset - resp, _ = http.Get(server.URL + "/assets/hello.txt") - defer resp.Body.Close() - body, _ = ioutil.ReadAll(resp.Body) - fmt.Printf("%s", body) - - // Output: - // Hello Index - // Hello World -} diff --git a/vendor/github.com/go-serve/bindatafs/example_bindatafs_test.go b/vendor/github.com/go-serve/bindatafs/example_bindatafs_test.go deleted file mode 100644 index 7474205..0000000 --- a/vendor/github.com/go-serve/bindatafs/example_bindatafs_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package bindatafs_test - -import ( - "fmt" - "net/http" - - "github.com/go-serve/bindatafs" - "github.com/go-serve/bindatafs/examples/example1" - "golang.org/x/tools/godoc/vfs/httpfs" -) - -func exampleIndex(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, "Hello Index\n") -} - -func Example() { - - // create vfs.FileSystem implementation for - // the go-bindata generated assets - assetsfs := bindatafs.New( - "assets://", - example1.Asset, - example1.AssetDir, - example1.AssetInfo, - ) - - // serve the files with http - mux := http.NewServeMux() - mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(httpfs.New(assetsfs)))) - mux.Handle("/", http.HandlerFunc(exampleIndex)) - - // serve the mux - http.ListenAndServe(":8080", mux) -} diff --git a/vendor/github.com/go-serve/bindatafs/example_bindatafs_union_test.go b/vendor/github.com/go-serve/bindatafs/example_bindatafs_union_test.go deleted file mode 100644 index 6f374b4..0000000 --- a/vendor/github.com/go-serve/bindatafs/example_bindatafs_union_test.go +++ /dev/null @@ -1,81 +0,0 @@ -package bindatafs_test - -import ( - "fmt" - "io/ioutil" - "net/http" - "net/http/httptest" - - "github.com/go-serve/bindatafs" - "github.com/go-serve/bindatafs/examples/example1" - "github.com/go-serve/bindatafs/examples/example2" - "golang.org/x/tools/godoc/vfs" - "golang.org/x/tools/godoc/vfs/httpfs" -) - -func exampleUnionIndex(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - fmt.Fprintf(w, "Hello Index\n") -} - -func ExampleFileSystem_union() { - - // create vfs.FileSystem implementation for - // the go-bindata generated assets - assetsfs1 := bindatafs.New( - "assets1://", - example1.Asset, - example1.AssetDir, - example1.AssetInfo, - ) - - assetsfs2 := bindatafs.New( - "assets2://", - example2.Asset, - example2.AssetDir, - example2.AssetInfo, - ) - - // compose 2 assets set into the same - // namespace - assetsfs := vfs.NameSpace{} - assetsfs.Bind("/", assetsfs2, "/", vfs.BindAfter) - assetsfs.Bind("/", assetsfs1, "/", vfs.BindAfter) - - // serve the files with http - mux := http.NewServeMux() - mux.Handle("/assets/", http.StripPrefix("/assets/", http.FileServer(httpfs.New(assetsfs)))) - mux.Handle("/", http.HandlerFunc(exampleUnionIndex)) - - // production: uncomment this - //http.ListenAndServe(":8080", mux) - - // below are for testings, can be removed for production - - // test the mux with httptest server - server := httptest.NewServer(mux) - defer server.Close() - - // examine the index - resp, _ := http.Get(server.URL) - defer resp.Body.Close() - body, _ := ioutil.ReadAll(resp.Body) - fmt.Printf("%s", body) - - // examine an asset - resp, _ = http.Get(server.URL + "/assets/hello.txt") - defer resp.Body.Close() - body, _ = ioutil.ReadAll(resp.Body) - fmt.Printf("%s", body) - - // examine an asset - resp, _ = http.Get(server.URL + "/assets/css/style.css") - defer resp.Body.Close() - body, _ = ioutil.ReadAll(resp.Body) - fmt.Printf("%s", body) - - // Output: - // Hello Index - // Hello CSS Assets - // body { background-color: #AFA; } -} diff --git a/vendor/github.com/go-serve/bindatafs/fileinfo.go b/vendor/github.com/go-serve/bindatafs/fileinfo.go deleted file mode 100644 index 0b3b2ed..0000000 --- a/vendor/github.com/go-serve/bindatafs/fileinfo.go +++ /dev/null @@ -1,79 +0,0 @@ -package bindatafs - -import ( - "os" - "time" -) - -// fileInfo implements FileInfo -type fileInfo struct { - name string - os.FileInfo -} - -// Name implements os.FileInfo -func (fi *fileInfo) Name() string { - return fi.name -} - -// Size gives length in bytes for regular files; -// system-dependent for others -func (fi *fileInfo) Size() int64 { - return fi.FileInfo.Size() -} - -// Mode gives file mode bits -func (fi *fileInfo) Mode() os.FileMode { - return fi.FileInfo.Mode()&os.ModeType | 0444 -} - -// ModTime gives modification time -func (fi *fileInfo) ModTime() (t time.Time) { - return fi.FileInfo.ModTime() -} - -// IsDir is abbreviation for Mode().IsDir() -func (fi *fileInfo) IsDir() bool { - return fi.Mode().IsDir() -} - -// Sys gives underlying data source (can return nil) -func (fi *fileInfo) Sys() interface{} { - return nil -} - -// dirInfo implements FileInfo for directory in the assets -type dirInfo struct { - name string -} - -// Name gives base name of the file -func (fi *dirInfo) Name() string { - return fi.name -} - -// Size gives length in bytes for regular files; -// system-dependent for others -func (fi *dirInfo) Size() int64 { - return 0 // hard code 0 for now (originally system-dependent) -} - -// Mode gives file mode bits -func (fi *dirInfo) Mode() os.FileMode { - return os.ModeDir | 0777 -} - -// ModTime gives modification time -func (fi *dirInfo) ModTime() (t time.Time) { - return time.Unix(0, 0) -} - -// IsDir is abbreviation for Mode().IsDir() -func (fi *dirInfo) IsDir() bool { - return fi.Mode().IsDir() -} - -// Sys gives underlying data source (can return nil) -func (fi *dirInfo) Sys() interface{} { - return nil -} diff --git a/vendor/github.com/go-serve/bindatafs/fileinfo_test.go b/vendor/github.com/go-serve/bindatafs/fileinfo_test.go deleted file mode 100644 index 55aadd8..0000000 --- a/vendor/github.com/go-serve/bindatafs/fileinfo_test.go +++ /dev/null @@ -1,18 +0,0 @@ -package bindatafs - -import ( - "os" - "testing" -) - -func Test_fileInfo(t *testing.T) { - var i os.FileInfo = &fileInfo{} - _ = i - t.Log("*bindatafs.FileInfo{} implements os.FileInfo interface") -} - -func Test_dirInfo(t *testing.T) { - var i os.FileInfo = &dirInfo{} - _ = i - t.Log("*bindatafs.DirInfo{} implements os.FileInfo interface") -} diff --git a/vendor/github.com/hashicorp/errwrap/LICENSE b/vendor/github.com/hashicorp/errwrap/LICENSE deleted file mode 100644 index c33dcc7..0000000 --- a/vendor/github.com/hashicorp/errwrap/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/errwrap/README.md b/vendor/github.com/hashicorp/errwrap/README.md deleted file mode 100644 index 1c95f59..0000000 --- a/vendor/github.com/hashicorp/errwrap/README.md +++ /dev/null @@ -1,89 +0,0 @@ -# errwrap - -`errwrap` is a package for Go that formalizes the pattern of wrapping errors -and checking if an error contains another error. - -There is a common pattern in Go of taking a returned `error` value and -then wrapping it (such as with `fmt.Errorf`) before returning it. The problem -with this pattern is that you completely lose the original `error` structure. - -Arguably the _correct_ approach is that you should make a custom structure -implementing the `error` interface, and have the original error as a field -on that structure, such [as this example](http://golang.org/pkg/os/#PathError). -This is a good approach, but you have to know the entire chain of possible -rewrapping that happens, when you might just care about one. - -`errwrap` formalizes this pattern (it doesn't matter what approach you use -above) by giving a single interface for wrapping errors, checking if a specific -error is wrapped, and extracting that error. - -## Installation and Docs - -Install using `go get github.com/hashicorp/errwrap`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/errwrap - -## Usage - -#### Basic Usage - -Below is a very basic example of its usage: - -```go -// A function that always returns an error, but wraps it, like a real -// function might. -func tryOpen() error { - _, err := os.Open("/i/dont/exist") - if err != nil { - return errwrap.Wrapf("Doesn't exist: {{err}}", err) - } - - return nil -} - -func main() { - err := tryOpen() - - // We can use the Contains helpers to check if an error contains - // another error. It is safe to do this with a nil error, or with - // an error that doesn't even use the errwrap package. - if errwrap.Contains(err, ErrNotExist) { - // Do something - } - if errwrap.ContainsType(err, new(os.PathError)) { - // Do something - } - - // Or we can use the associated `Get` functions to just extract - // a specific error. This would return nil if that specific error doesn't - // exist. - perr := errwrap.GetType(err, new(os.PathError)) -} -``` - -#### Custom Types - -If you're already making custom types that properly wrap errors, then -you can get all the functionality of `errwraps.Contains` and such by -implementing the `Wrapper` interface with just one function. Example: - -```go -type AppError { - Code ErrorCode - Err error -} - -func (e *AppError) WrappedErrors() []error { - return []error{e.Err} -} -``` - -Now this works: - -```go -err := &AppError{Err: fmt.Errorf("an error")} -if errwrap.ContainsType(err, fmt.Errorf("")) { - // This will work! -} -``` diff --git a/vendor/github.com/hashicorp/errwrap/errwrap.go b/vendor/github.com/hashicorp/errwrap/errwrap.go deleted file mode 100644 index a733bef..0000000 --- a/vendor/github.com/hashicorp/errwrap/errwrap.go +++ /dev/null @@ -1,169 +0,0 @@ -// Package errwrap implements methods to formalize error wrapping in Go. -// -// All of the top-level functions that take an `error` are built to be able -// to take any error, not just wrapped errors. This allows you to use errwrap -// without having to type-check and type-cast everywhere. -package errwrap - -import ( - "errors" - "reflect" - "strings" -) - -// WalkFunc is the callback called for Walk. -type WalkFunc func(error) - -// Wrapper is an interface that can be implemented by custom types to -// have all the Contains, Get, etc. functions in errwrap work. -// -// When Walk reaches a Wrapper, it will call the callback for every -// wrapped error in addition to the wrapper itself. Since all the top-level -// functions in errwrap use Walk, this means that all those functions work -// with your custom type. -type Wrapper interface { - WrappedErrors() []error -} - -// Wrap defines that outer wraps inner, returning an error type that -// can be cleanly used with the other methods in this package, such as -// Contains, GetAll, etc. -// -// This function won't modify the error message at all (the outer message -// will be used). -func Wrap(outer, inner error) error { - return &wrappedError{ - Outer: outer, - Inner: inner, - } -} - -// Wrapf wraps an error with a formatting message. This is similar to using -// `fmt.Errorf` to wrap an error. If you're using `fmt.Errorf` to wrap -// errors, you should replace it with this. -// -// format is the format of the error message. The string '{{err}}' will -// be replaced with the original error message. -func Wrapf(format string, err error) error { - outerMsg := "" - if err != nil { - outerMsg = err.Error() - } - - outer := errors.New(strings.Replace( - format, "{{err}}", outerMsg, -1)) - - return Wrap(outer, err) -} - -// Contains checks if the given error contains an error with the -// message msg. If err is not a wrapped error, this will always return -// false unless the error itself happens to match this msg. -func Contains(err error, msg string) bool { - return len(GetAll(err, msg)) > 0 -} - -// ContainsType checks if the given error contains an error with -// the same concrete type as v. If err is not a wrapped error, this will -// check the err itself. -func ContainsType(err error, v interface{}) bool { - return len(GetAllType(err, v)) > 0 -} - -// Get is the same as GetAll but returns the deepest matching error. -func Get(err error, msg string) error { - es := GetAll(err, msg) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetType is the same as GetAllType but returns the deepest matching error. -func GetType(err error, v interface{}) error { - es := GetAllType(err, v) - if len(es) > 0 { - return es[len(es)-1] - } - - return nil -} - -// GetAll gets all the errors that might be wrapped in err with the -// given message. The order of the errors is such that the outermost -// matching error (the most recent wrap) is index zero, and so on. -func GetAll(err error, msg string) []error { - var result []error - - Walk(err, func(err error) { - if err.Error() == msg { - result = append(result, err) - } - }) - - return result -} - -// GetAllType gets all the errors that are the same type as v. -// -// The order of the return value is the same as described in GetAll. -func GetAllType(err error, v interface{}) []error { - var result []error - - var search string - if v != nil { - search = reflect.TypeOf(v).String() - } - Walk(err, func(err error) { - var needle string - if err != nil { - needle = reflect.TypeOf(err).String() - } - - if needle == search { - result = append(result, err) - } - }) - - return result -} - -// Walk walks all the wrapped errors in err and calls the callback. If -// err isn't a wrapped error, this will be called once for err. If err -// is a wrapped error, the callback will be called for both the wrapper -// that implements error as well as the wrapped error itself. -func Walk(err error, cb WalkFunc) { - if err == nil { - return - } - - switch e := err.(type) { - case *wrappedError: - cb(e.Outer) - Walk(e.Inner, cb) - case Wrapper: - cb(err) - - for _, err := range e.WrappedErrors() { - Walk(err, cb) - } - default: - cb(err) - } -} - -// wrappedError is an implementation of error that has both the -// outer and inner errors. -type wrappedError struct { - Outer error - Inner error -} - -func (w *wrappedError) Error() string { - return w.Outer.Error() -} - -func (w *wrappedError) WrappedErrors() []error { - return []error{w.Outer, w.Inner} -} diff --git a/vendor/github.com/hashicorp/errwrap/errwrap_test.go b/vendor/github.com/hashicorp/errwrap/errwrap_test.go deleted file mode 100644 index 5ae5f8e..0000000 --- a/vendor/github.com/hashicorp/errwrap/errwrap_test.go +++ /dev/null @@ -1,94 +0,0 @@ -package errwrap - -import ( - "fmt" - "testing" -) - -func TestWrappedError_impl(t *testing.T) { - var _ error = new(wrappedError) -} - -func TestGetAll(t *testing.T) { - cases := []struct { - Err error - Msg string - Len int - }{ - {}, - { - fmt.Errorf("foo"), - "foo", - 1, - }, - { - fmt.Errorf("bar"), - "foo", - 0, - }, - { - Wrapf("bar", fmt.Errorf("foo")), - "foo", - 1, - }, - { - Wrapf("{{err}}", fmt.Errorf("foo")), - "foo", - 2, - }, - { - Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), - "foo", - 1, - }, - } - - for i, tc := range cases { - actual := GetAll(tc.Err, tc.Msg) - if len(actual) != tc.Len { - t.Fatalf("%d: bad: %#v", i, actual) - } - for _, v := range actual { - if v.Error() != tc.Msg { - t.Fatalf("%d: bad: %#v", i, actual) - } - } - } -} - -func TestGetAllType(t *testing.T) { - cases := []struct { - Err error - Type interface{} - Len int - }{ - {}, - { - fmt.Errorf("foo"), - "foo", - 0, - }, - { - fmt.Errorf("bar"), - fmt.Errorf("foo"), - 1, - }, - { - Wrapf("bar", fmt.Errorf("foo")), - fmt.Errorf("baz"), - 2, - }, - { - Wrapf("bar", Wrapf("baz", fmt.Errorf("foo"))), - Wrapf("", nil), - 0, - }, - } - - for i, tc := range cases { - actual := GetAllType(tc.Err, tc.Type) - if len(actual) != tc.Len { - t.Fatalf("%d: bad: %#v", i, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/go-cleanhttp/LICENSE b/vendor/github.com/hashicorp/go-cleanhttp/LICENSE deleted file mode 100644 index e87a115..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/LICENSE +++ /dev/null @@ -1,363 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-cleanhttp/README.md b/vendor/github.com/hashicorp/go-cleanhttp/README.md deleted file mode 100644 index 036e531..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/README.md +++ /dev/null @@ -1,30 +0,0 @@ -# cleanhttp - -Functions for accessing "clean" Go http.Client values - -------------- - -The Go standard library contains a default `http.Client` called -`http.DefaultClient`. It is a common idiom in Go code to start with -`http.DefaultClient` and tweak it as necessary, and in fact, this is -encouraged; from the `http` package documentation: - -> The Client's Transport typically has internal state (cached TCP connections), -so Clients should be reused instead of created as needed. Clients are safe for -concurrent use by multiple goroutines. - -Unfortunately, this is a shared value, and it is not uncommon for libraries to -assume that they are free to modify it at will. With enough dependencies, it -can be very easy to encounter strange problems and race conditions due to -manipulation of this shared value across libraries and goroutines (clients are -safe for concurrent use, but writing values to the client struct itself is not -protected). - -Making things worse is the fact that a bare `http.Client` will use a default -`http.Transport` called `http.DefaultTransport`, which is another global value -that behaves the same way. So it is not simply enough to replace -`http.DefaultClient` with `&http.Client{}`. - -This repository provides some simple functions to get a "clean" `http.Client` --- one that uses the same default values as the Go standard library, but -returns a client that does not share any state with other clients. diff --git a/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go b/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go deleted file mode 100644 index 8d306bf..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/cleanhttp.go +++ /dev/null @@ -1,57 +0,0 @@ -package cleanhttp - -import ( - "net" - "net/http" - "runtime" - "time" -) - -// DefaultTransport returns a new http.Transport with similar default values to -// http.DefaultTransport, but with idle connections and keepalives disabled. -func DefaultTransport() *http.Transport { - transport := DefaultPooledTransport() - transport.DisableKeepAlives = true - transport.MaxIdleConnsPerHost = -1 - return transport -} - -// DefaultPooledTransport returns a new http.Transport with similar default -// values to http.DefaultTransport. Do not use this for transient transports as -// it can leak file descriptors over time. Only use this for transports that -// will be re-used for the same host(s). -func DefaultPooledTransport() *http.Transport { - transport := &http.Transport{ - Proxy: http.ProxyFromEnvironment, - DialContext: (&net.Dialer{ - Timeout: 30 * time.Second, - KeepAlive: 30 * time.Second, - DualStack: true, - }).DialContext, - MaxIdleConns: 100, - IdleConnTimeout: 90 * time.Second, - TLSHandshakeTimeout: 10 * time.Second, - ExpectContinueTimeout: 1 * time.Second, - MaxIdleConnsPerHost: runtime.GOMAXPROCS(0) + 1, - } - return transport -} - -// DefaultClient returns a new http.Client with similar default values to -// http.Client, but with a non-shared Transport, idle connections disabled, and -// keepalives disabled. -func DefaultClient() *http.Client { - return &http.Client{ - Transport: DefaultTransport(), - } -} - -// DefaultPooledClient returns a new http.Client with similar default values to -// http.Client, but with a shared Transport. Do not use this function for -// transient clients as it can leak file descriptors over time. Only use this -// for clients that will be re-used for the same host(s). -func DefaultPooledClient() *http.Client { - return &http.Client{ - Transport: DefaultPooledTransport(), - } -} diff --git a/vendor/github.com/hashicorp/go-cleanhttp/doc.go b/vendor/github.com/hashicorp/go-cleanhttp/doc.go deleted file mode 100644 index 0584109..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Package cleanhttp offers convenience utilities for acquiring "clean" -// http.Transport and http.Client structs. -// -// Values set on http.DefaultClient and http.DefaultTransport affect all -// callers. This can have detrimental effects, esepcially in TLS contexts, -// where client or root certificates set to talk to multiple endpoints can end -// up displacing each other, leading to hard-to-debug issues. This package -// provides non-shared http.Client and http.Transport structs to ensure that -// the configuration will not be overwritten by other parts of the application -// or dependencies. -// -// The DefaultClient and DefaultTransport functions disable idle connections -// and keepalives. Without ensuring that idle connections are closed before -// garbage collection, short-term clients/transports can leak file descriptors, -// eventually leading to "too many open files" errors. If you will be -// connecting to the same hosts repeatedly from the same client, you can use -// DefaultPooledClient to receive a client that has connection pooling -// semantics similar to http.DefaultClient. -// -package cleanhttp diff --git a/vendor/github.com/hashicorp/go-cleanhttp/handlers.go b/vendor/github.com/hashicorp/go-cleanhttp/handlers.go deleted file mode 100644 index 7eda377..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/handlers.go +++ /dev/null @@ -1,43 +0,0 @@ -package cleanhttp - -import ( - "net/http" - "strings" - "unicode" -) - -// HandlerInput provides input options to cleanhttp's handlers -type HandlerInput struct { - ErrStatus int -} - -// PrintablePathCheckHandler is a middleware that ensures the request path -// contains only printable runes. -func PrintablePathCheckHandler(next http.Handler, input *HandlerInput) http.Handler { - // Nil-check on input to make it optional - if input == nil { - input = &HandlerInput{ - ErrStatus: http.StatusBadRequest, - } - } - - // Default to http.StatusBadRequest on error - if input.ErrStatus == 0 { - input.ErrStatus = http.StatusBadRequest - } - - return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - // Check URL path for non-printable characters - idx := strings.IndexFunc(r.URL.Path, func(c rune) bool { - return !unicode.IsPrint(c) - }) - - if idx != -1 { - w.WriteHeader(input.ErrStatus) - return - } - - next.ServeHTTP(w, r) - return - }) -} diff --git a/vendor/github.com/hashicorp/go-cleanhttp/handlers_test.go b/vendor/github.com/hashicorp/go-cleanhttp/handlers_test.go deleted file mode 100644 index 95ef812..0000000 --- a/vendor/github.com/hashicorp/go-cleanhttp/handlers_test.go +++ /dev/null @@ -1,72 +0,0 @@ -package cleanhttp - -import ( - "fmt" - "net/http" - "net/http/httptest" - "testing" -) - -func TestPrintablePathCheckHandler(t *testing.T) { - getTestHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - fmt.Fprintln(w, "Hello, client") - }) - - cases := map[string]struct { - path string - expectCode int - input *HandlerInput - }{ - "valid nil input": { - path: "/valid", - expectCode: http.StatusOK, - input: nil, - }, - - "valid empty error status": { - path: "/valid", - expectCode: http.StatusOK, - input: &HandlerInput{}, - }, - - "invalid newline": { - path: "/invalid\n", - expectCode: http.StatusBadRequest, - }, - - "invalid carriage return": { - path: "/invalid\r", - expectCode: http.StatusBadRequest, - }, - - "invalid null": { - path: "/invalid\x00", - expectCode: http.StatusBadRequest, - }, - - "invalid alternate status": { - path: "/invalid\n", - expectCode: http.StatusInternalServerError, - input: &HandlerInput{ - ErrStatus: http.StatusInternalServerError, - }, - }, - } - - for name, tc := range cases { - t.Run(name, func(t *testing.T) { - // Create test HTTP server - ts := httptest.NewServer(PrintablePathCheckHandler(getTestHandler, tc.input)) - defer ts.Close() - - res, err := http.Get(ts.URL + tc.path) - if err != nil { - t.Fatal(err) - } - - if tc.expectCode != res.StatusCode { - t.Fatalf("expected %d, got :%d", tc.expectCode, res.StatusCode) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/.travis.yml b/vendor/github.com/hashicorp/go-getter/.travis.yml deleted file mode 100644 index da804c2..0000000 --- a/vendor/github.com/hashicorp/go-getter/.travis.yml +++ /dev/null @@ -1,23 +0,0 @@ -sudo: false - -addons: - apt: - sources: - - sourceline: 'ppa:git-core/ppa' - packages: - - git - -language: go - -go: - - 1.8.x - - 1.9.x - - master - -branches: - only: - - master - -matrix: - allow_failures: - - go: master diff --git a/vendor/github.com/hashicorp/go-getter/LICENSE b/vendor/github.com/hashicorp/go-getter/LICENSE deleted file mode 100644 index c33dcc7..0000000 --- a/vendor/github.com/hashicorp/go-getter/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-getter/README.md b/vendor/github.com/hashicorp/go-getter/README.md deleted file mode 100644 index 40ace74..0000000 --- a/vendor/github.com/hashicorp/go-getter/README.md +++ /dev/null @@ -1,301 +0,0 @@ -# go-getter - -[![Build Status](http://img.shields.io/travis/hashicorp/go-getter.svg?style=flat-square)][travis] -[![Build status](https://ci.appveyor.com/api/projects/status/ulq3qr43n62croyq/branch/master?svg=true)][appveyor] -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[travis]: http://travis-ci.org/hashicorp/go-getter -[godocs]: http://godoc.org/github.com/hashicorp/go-getter -[appveyor]: https://ci.appveyor.com/project/hashicorp/go-getter/branch/master - -go-getter is a library for Go (golang) for downloading files or directories -from various sources using a URL as the primary form of input. - -The power of this library is being flexible in being able to download -from a number of different sources (file paths, Git, HTTP, Mercurial, etc.) -using a single string as input. This removes the burden of knowing how to -download from a variety of sources from the implementer. - -The concept of a _detector_ automatically turns invalid URLs into proper -URLs. For example: "github.com/hashicorp/go-getter" would turn into a -Git URL. Or "./foo" would turn into a file URL. These are extensible. - -This library is used by [Terraform](https://terraform.io) for -downloading modules and [Nomad](https://nomadproject.io) for downloading -binaries. - -## Installation and Usage - -Package documentation can be found on -[GoDoc](http://godoc.org/github.com/hashicorp/go-getter). - -Installation can be done with a normal `go get`: - -``` -$ go get github.com/hashicorp/go-getter -``` - -go-getter also has a command you can use to test URL strings: - -``` -$ go install github.com/hashicorp/go-getter/cmd/go-getter -... - -$ go-getter github.com/foo/bar ./foo -... -``` - -The command is useful for verifying URL structures. - -## URL Format - -go-getter uses a single string URL as input to download from a variety of -protocols. go-getter has various "tricks" with this URL to do certain things. -This section documents the URL format. - -### Supported Protocols and Detectors - -**Protocols** are used to download files/directories using a specific -mechanism. Example protocols are Git and HTTP. - -**Detectors** are used to transform a valid or invalid URL into another -URL if it matches a certain pattern. Example: "github.com/user/repo" is -automatically transformed into a fully valid Git URL. This allows go-getter -to be very user friendly. - -go-getter out of the box supports the following protocols. Additional protocols -can be augmented at runtime by implementing the `Getter` interface. - - * Local files - * Git - * Mercurial - * HTTP - * Amazon S3 - -In addition to the above protocols, go-getter has what are called "detectors." -These take a URL and attempt to automatically choose the best protocol for -it, which might involve even changing the protocol. The following detection -is built-in by default: - - * File paths such as "./foo" are automatically changed to absolute - file URLs. - * GitHub URLs, such as "github.com/mitchellh/vagrant" are automatically - changed to Git protocol over HTTP. - * BitBucket URLs, such as "bitbucket.org/mitchellh/vagrant" are automatically - changed to a Git or mercurial protocol using the BitBucket API. - -### Forced Protocol - -In some cases, the protocol to use is ambiguous depending on the source -URL. For example, "http://github.com/mitchellh/vagrant.git" could reference -an HTTP URL or a Git URL. Forced protocol syntax is used to disambiguate this -URL. - -Forced protocol can be done by prefixing the URL with the protocol followed -by double colons. For example: `git::http://github.com/mitchellh/vagrant.git` -would download the given HTTP URL using the Git protocol. - -Forced protocols will also override any detectors. - -In the absense of a forced protocol, detectors may be run on the URL, transforming -the protocol anyways. The above example would've used the Git protocol either -way since the Git detector would've detected it was a GitHub URL. - -### Protocol-Specific Options - -Each protocol can support protocol-specific options to configure that -protocol. For example, the `git` protocol supports specifying a `ref` -query parameter that tells it what ref to checkout for that Git -repository. - -The options are specified as query parameters on the URL (or URL-like string) -given to go-getter. Using the Git example above, the URL below is a valid -input to go-getter: - - github.com/hashicorp/go-getter?ref=abcd1234 - -The protocol-specific options are documented below the URL format -section. But because they are part of the URL, we point it out here so -you know they exist. - -### Subdirectories - -If you want to download only a specific subdirectory from a downloaded -directory, you can specify a subdirectory after a double-slash `//`. -go-getter will first download the URL specified _before_ the double-slash -(as if you didn't specify a double-slash), but will then copy the -path after the double slash into the target directory. - -For example, if you're downloading this GitHub repository, but you only -want to download the `test-fixtures` directory, you can do the following: - -``` -https://github.com/hashicorp/go-getter.git//test-fixtures -``` - -If you downloaded this to the `/tmp` directory, then the file -`/tmp/archive.gz` would exist. Notice that this file is in the `test-fixtures` -directory in this repository, but because we specified a subdirectory, -go-getter automatically copied only that directory contents. - -Subdirectory paths may contain may also use filesystem glob patterns. -The path must match _exactly one_ entry or go-getter will return an error. -This is useful if you're not sure the exact directory name but it follows -a predictable naming structure. - -For example, the following URL would also work: - -``` -https://github.com/hashicorp/go-getter.git//test-* -``` - -### Checksumming - -For file downloads of any protocol, go-getter can automatically verify -a checksum for you. Note that checksumming only works for downloading files, -not directories, but checksumming will work for any protocol. - -To checksum a file, append a `checksum` query parameter to the URL. -The paramter value should be in the format of `type:value`, where -type is "md5", "sha1", "sha256", or "sha512". The "value" should be -the actual checksum value. go-getter will parse out this query parameter -automatically and use it to verify the checksum. An example URL -is shown below: - -``` -./foo.txt?checksum=md5:b7d96c89d09d9e204f5fedc4d5d55b21 -``` - -The checksum query parameter is never sent to the backend protocol -implementation. It is used at a higher level by go-getter itself. - -### Unarchiving - -go-getter will automatically unarchive files into a file or directory -based on the extension of the file being requested (over any protocol). -This works for both file and directory downloads. - -go-getter looks for an `archive` query parameter to specify the format of -the archive. If this isn't specified, go-getter will use the extension of -the path to see if it appears archived. Unarchiving can be explicitly -disabled by setting the `archive` query parameter to `false`. - -The following archive formats are supported: - - * `tar.gz` and `tgz` - * `tar.bz2` and `tbz2` - * `tar.xz` and `txz` - * `zip` - * `gz` - * `bz2` - * `xz` - -For example, an example URL is shown below: - -``` -./foo.zip -``` - -This will automatically be inferred to be a ZIP file and will be extracted. -You can also be explicit about the archive type: - -``` -./some/other/path?archive=zip -``` - -And finally, you can disable archiving completely: - -``` -./some/path?archive=false -``` - -You can combine unarchiving with the other features of go-getter such -as checksumming. The special `archive` query parameter will be removed -from the URL before going to the final protocol downloader. - -## Protocol-Specific Options - -This section documents the protocol-specific options that can be specified -for go-getter. These options should be appended to the input as normal query -parameters. Depending on the usage of go-getter, applications may provide -alternate ways of inputting options. For example, [Nomad](https://www.nomadproject.io) -provides a nice options block for specifying options rather than in the URL. - -## General (All Protocols) - -The options below are available to all protocols: - - * `archive` - The archive format to use to unarchive this file, or "" (empty - string) to disable unarchiving. For more details, see the complete section - on archive support above. - - * `checksum` - Checksum to verify the downloaded file or archive. See - the entire section on checksumming above for format and more details. - - * `filename` - When in file download mode, allows specifying the name of the - downloaded file on disk. Has no effect in directory mode. - -### Local Files (`file`) - -None - -### Git (`git`) - - * `ref` - The Git ref to checkout. This is a ref, so it can point to - a commit SHA, a branch name, etc. If it is a named ref such as a branch - name, go-getter will update it to the latest on each get. - - * `sshkey` - An SSH private key to use during clones. The provided key must - be a base64-encoded string. For example, to generate a suitable `sshkey` - from a private key file on disk, you would run `base64 -w0 `. - - **Note**: Git 2.3+ is required to use this feature. - -### Mercurial (`hg`) - - * `rev` - The Mercurial revision to checkout. - -### HTTP (`http`) - -#### Basic Authentication - -To use HTTP basic authentication with go-getter, simply prepend `username:password@` to the -hostname in the URL such as `https://Aladdin:OpenSesame@www.example.com/index.html`. All special -characters, including the username and password, must be URL encoded. - -### S3 (`s3`) - -S3 takes various access configurations in the URL. Note that it will also -read these from standard AWS environment variables if they're set. S3 compliant servers like Minio -are also supported. If the query parameters are present, these take priority. - - * `aws_access_key_id` - AWS access key. - * `aws_access_key_secret` - AWS access key secret. - * `aws_access_token` - AWS access token if this is being used. - -#### Using IAM Instance Profiles with S3 - -If you use go-getter and want to use an EC2 IAM Instance Profile to avoid -using credentials, then just omit these and the profile, if available will -be used automatically. - -### Using S3 with Minio - If you use go-gitter for Minio support, you must consider the following: - - * `aws_access_key_id` (required) - Minio access key. - * `aws_access_key_secret` (required) - Minio access key secret. - * `region` (optional - defaults to us-east-1) - Region identifier to use. - * `version` (optional - defaults to Minio default) - Configuration file format. - -#### S3 Bucket Examples - -S3 has several addressing schemes used to reference your bucket. These are -listed here: http://docs.aws.amazon.com/AmazonS3/latest/dev/UsingBucket.html#access-bucket-intro - -Some examples for these addressing schemes: -- s3::https://s3.amazonaws.com/bucket/foo -- s3::https://s3-eu-west-1.amazonaws.com/bucket/foo -- bucket.s3.amazonaws.com/foo -- bucket.s3-eu-west-1.amazonaws.com/foo/bar -- "s3::http://127.0.0.1:9000/test-bucket/hello.txt?aws_access_key_id=KEYID&aws_access_key_secret=SECRETKEY®ion=us-east-2" - diff --git a/vendor/github.com/hashicorp/go-getter/appveyor.yml b/vendor/github.com/hashicorp/go-getter/appveyor.yml deleted file mode 100644 index ec48d45..0000000 --- a/vendor/github.com/hashicorp/go-getter/appveyor.yml +++ /dev/null @@ -1,16 +0,0 @@ -version: "build-{branch}-{build}" -image: Visual Studio 2017 -clone_folder: c:\gopath\github.com\hashicorp\go-getter -environment: - GOPATH: c:\gopath -install: -- cmd: >- - echo %Path% - - go version - - go env - - go get -d -v -t ./... -build_script: -- cmd: go test -v ./... diff --git a/vendor/github.com/hashicorp/go-getter/client.go b/vendor/github.com/hashicorp/go-getter/client.go deleted file mode 100644 index 6e5ab82..0000000 --- a/vendor/github.com/hashicorp/go-getter/client.go +++ /dev/null @@ -1,352 +0,0 @@ -package getter - -import ( - "bytes" - "crypto/md5" - "crypto/sha1" - "crypto/sha256" - "crypto/sha512" - "encoding/hex" - "fmt" - "hash" - "io" - "io/ioutil" - "os" - "path/filepath" - "strconv" - "strings" - - urlhelper "github.com/hashicorp/go-getter/helper/url" -) - -// Client is a client for downloading things. -// -// Top-level functions such as Get are shortcuts for interacting with a client. -// Using a client directly allows more fine-grained control over how downloading -// is done, as well as customizing the protocols supported. -type Client struct { - // Src is the source URL to get. - // - // Dst is the path to save the downloaded thing as. If Dir is set to - // true, then this should be a directory. If the directory doesn't exist, - // it will be created for you. - // - // Pwd is the working directory for detection. If this isn't set, some - // detection may fail. Client will not default pwd to the current - // working directory for security reasons. - Src string - Dst string - Pwd string - - // Mode is the method of download the client will use. See ClientMode - // for documentation. - Mode ClientMode - - // Detectors is the list of detectors that are tried on the source. - // If this is nil, then the default Detectors will be used. - Detectors []Detector - - // Decompressors is the map of decompressors supported by this client. - // If this is nil, then the default value is the Decompressors global. - Decompressors map[string]Decompressor - - // Getters is the map of protocols supported by this client. If this - // is nil, then the default Getters variable will be used. - Getters map[string]Getter - - // Dir, if true, tells the Client it is downloading a directory (versus - // a single file). This distinction is necessary since filenames and - // directory names follow the same format so disambiguating is impossible - // without knowing ahead of time. - // - // WARNING: deprecated. If Mode is set, that will take precedence. - Dir bool -} - -// Get downloads the configured source to the destination. -func (c *Client) Get() error { - // Store this locally since there are cases we swap this - mode := c.Mode - if mode == ClientModeInvalid { - if c.Dir { - mode = ClientModeDir - } else { - mode = ClientModeFile - } - } - - // Default decompressor value - decompressors := c.Decompressors - if decompressors == nil { - decompressors = Decompressors - } - - // Detect the URL. This is safe if it is already detected. - detectors := c.Detectors - if detectors == nil { - detectors = Detectors - } - src, err := Detect(c.Src, c.Pwd, detectors) - if err != nil { - return err - } - - // Determine if we have a forced protocol, i.e. "git::http://..." - force, src := getForcedGetter(src) - - // If there is a subdir component, then we download the root separately - // and then copy over the proper subdir. - var realDst string - dst := c.Dst - src, subDir := SourceDirSubdir(src) - if subDir != "" { - tmpDir, err := ioutil.TempDir("", "tf") - if err != nil { - return err - } - if err := os.RemoveAll(tmpDir); err != nil { - return err - } - defer os.RemoveAll(tmpDir) - - realDst = dst - dst = tmpDir - } - - u, err := urlhelper.Parse(src) - if err != nil { - return err - } - if force == "" { - force = u.Scheme - } - - getters := c.Getters - if getters == nil { - getters = Getters - } - - g, ok := getters[force] - if !ok { - return fmt.Errorf( - "download not supported for scheme '%s'", force) - } - - // We have magic query parameters that we use to signal different features - q := u.Query() - - // Determine if we have an archive type - archiveV := q.Get("archive") - if archiveV != "" { - // Delete the paramter since it is a magic parameter we don't - // want to pass on to the Getter - q.Del("archive") - u.RawQuery = q.Encode() - - // If we can parse the value as a bool and it is false, then - // set the archive to "-" which should never map to a decompressor - if b, err := strconv.ParseBool(archiveV); err == nil && !b { - archiveV = "-" - } - } - if archiveV == "" { - // We don't appear to... but is it part of the filename? - matchingLen := 0 - for k, _ := range decompressors { - if strings.HasSuffix(u.Path, "."+k) && len(k) > matchingLen { - archiveV = k - matchingLen = len(k) - } - } - } - - // If we have a decompressor, then we need to change the destination - // to download to a temporary path. We unarchive this into the final, - // real path. - var decompressDst string - var decompressDir bool - decompressor := decompressors[archiveV] - if decompressor != nil { - // Create a temporary directory to store our archive. We delete - // this at the end of everything. - td, err := ioutil.TempDir("", "getter") - if err != nil { - return fmt.Errorf( - "Error creating temporary directory for archive: %s", err) - } - defer os.RemoveAll(td) - - // Swap the download directory to be our temporary path and - // store the old values. - decompressDst = dst - decompressDir = mode != ClientModeFile - dst = filepath.Join(td, "archive") - mode = ClientModeFile - } - - // Determine if we have a checksum - var checksumHash hash.Hash - var checksumValue []byte - if v := q.Get("checksum"); v != "" { - // Delete the query parameter if we have it. - q.Del("checksum") - u.RawQuery = q.Encode() - - // Determine the checksum hash type - checksumType := "" - idx := strings.Index(v, ":") - if idx > -1 { - checksumType = v[:idx] - } - switch checksumType { - case "md5": - checksumHash = md5.New() - case "sha1": - checksumHash = sha1.New() - case "sha256": - checksumHash = sha256.New() - case "sha512": - checksumHash = sha512.New() - default: - return fmt.Errorf( - "unsupported checksum type: %s", checksumType) - } - - // Get the remainder of the value and parse it into bytes - b, err := hex.DecodeString(v[idx+1:]) - if err != nil { - return fmt.Errorf("invalid checksum: %s", err) - } - - // Set our value - checksumValue = b - } - - if mode == ClientModeAny { - // Ask the getter which client mode to use - mode, err = g.ClientMode(u) - if err != nil { - return err - } - - // Destination is the base name of the URL path in "any" mode when - // a file source is detected. - if mode == ClientModeFile { - filename := filepath.Base(u.Path) - - // Determine if we have a custom file name - if v := q.Get("filename"); v != "" { - // Delete the query parameter if we have it. - q.Del("filename") - u.RawQuery = q.Encode() - - filename = v - } - - dst = filepath.Join(dst, filename) - } - } - - // If we're not downloading a directory, then just download the file - // and return. - if mode == ClientModeFile { - err := g.GetFile(dst, u) - if err != nil { - return err - } - - if checksumHash != nil { - if err := checksum(dst, checksumHash, checksumValue); err != nil { - return err - } - } - - if decompressor != nil { - // We have a decompressor, so decompress the current destination - // into the final destination with the proper mode. - err := decompressor.Decompress(decompressDst, dst, decompressDir) - if err != nil { - return err - } - - // Swap the information back - dst = decompressDst - if decompressDir { - mode = ClientModeAny - } else { - mode = ClientModeFile - } - } - - // We check the dir value again because it can be switched back - // if we were unarchiving. If we're still only Get-ing a file, then - // we're done. - if mode == ClientModeFile { - return nil - } - } - - // If we're at this point we're either downloading a directory or we've - // downloaded and unarchived a directory and we're just checking subdir. - // In the case we have a decompressor we don't Get because it was Get - // above. - if decompressor == nil { - // If we're getting a directory, then this is an error. You cannot - // checksum a directory. TODO: test - if checksumHash != nil { - return fmt.Errorf( - "checksum cannot be specified for directory download") - } - - // We're downloading a directory, which might require a bit more work - // if we're specifying a subdir. - err := g.Get(dst, u) - if err != nil { - err = fmt.Errorf("error downloading '%s': %s", src, err) - return err - } - } - - // If we have a subdir, copy that over - if subDir != "" { - if err := os.RemoveAll(realDst); err != nil { - return err - } - if err := os.MkdirAll(realDst, 0755); err != nil { - return err - } - - // Process any globs - subDir, err := SubdirGlob(dst, subDir) - if err != nil { - return err - } - - return copyDir(realDst, subDir, false) - } - - return nil -} - -// checksum is a simple method to compute the checksum of a source file -// and compare it to the given expected value. -func checksum(source string, h hash.Hash, v []byte) error { - f, err := os.Open(source) - if err != nil { - return fmt.Errorf("Failed to open file for checksum: %s", err) - } - defer f.Close() - - if _, err := io.Copy(h, f); err != nil { - return fmt.Errorf("Failed to hash: %s", err) - } - - if actual := h.Sum(nil); !bytes.Equal(actual, v) { - return fmt.Errorf( - "Checksums did not match.\nExpected: %s\nGot: %s", - hex.EncodeToString(v), - hex.EncodeToString(actual)) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-getter/client_mode.go b/vendor/github.com/hashicorp/go-getter/client_mode.go deleted file mode 100644 index 7f02509..0000000 --- a/vendor/github.com/hashicorp/go-getter/client_mode.go +++ /dev/null @@ -1,24 +0,0 @@ -package getter - -// ClientMode is the mode that the client operates in. -type ClientMode uint - -const ( - ClientModeInvalid ClientMode = iota - - // ClientModeAny downloads anything it can. In this mode, dst must - // be a directory. If src is a file, it is saved into the directory - // with the basename of the URL. If src is a directory or archive, - // it is unpacked directly into dst. - ClientModeAny - - // ClientModeFile downloads a single file. In this mode, dst must - // be a file path (doesn't have to exist). src must point to a single - // file. It is saved as dst. - ClientModeFile - - // ClientModeDir downloads a directory. In this mode, dst must be - // a directory path (doesn't have to exist). src must point to an - // archive or directory (such as in s3). - ClientModeDir -) diff --git a/vendor/github.com/hashicorp/go-getter/copy_dir.go b/vendor/github.com/hashicorp/go-getter/copy_dir.go deleted file mode 100644 index 2f58e8a..0000000 --- a/vendor/github.com/hashicorp/go-getter/copy_dir.go +++ /dev/null @@ -1,78 +0,0 @@ -package getter - -import ( - "io" - "os" - "path/filepath" - "strings" -) - -// copyDir copies the src directory contents into dst. Both directories -// should already exist. -// -// If ignoreDot is set to true, then dot-prefixed files/folders are ignored. -func copyDir(dst string, src string, ignoreDot bool) error { - src, err := filepath.EvalSymlinks(src) - if err != nil { - return err - } - - walkFn := func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - if path == src { - return nil - } - - if ignoreDot && strings.HasPrefix(filepath.Base(path), ".") { - // Skip any dot files - if info.IsDir() { - return filepath.SkipDir - } else { - return nil - } - } - - // The "path" has the src prefixed to it. We need to join our - // destination with the path without the src on it. - dstPath := filepath.Join(dst, path[len(src):]) - - // If we have a directory, make that subdirectory, then continue - // the walk. - if info.IsDir() { - if path == filepath.Join(src, dst) { - // dst is in src; don't walk it. - return nil - } - - if err := os.MkdirAll(dstPath, 0755); err != nil { - return err - } - - return nil - } - - // If we have a file, copy the contents. - srcF, err := os.Open(path) - if err != nil { - return err - } - defer srcF.Close() - - dstF, err := os.Create(dstPath) - if err != nil { - return err - } - defer dstF.Close() - - if _, err := io.Copy(dstF, srcF); err != nil { - return err - } - - // Chmod it - return os.Chmod(dstPath, info.Mode()) - } - - return filepath.Walk(src, walkFn) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress.go b/vendor/github.com/hashicorp/go-getter/decompress.go deleted file mode 100644 index fc5681d..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress.go +++ /dev/null @@ -1,33 +0,0 @@ -package getter - -// Decompressor defines the interface that must be implemented to add -// support for decompressing a type. -type Decompressor interface { - // Decompress should decompress src to dst. dir specifies whether dst - // is a directory or single file. src is guaranteed to be a single file - // that exists. dst is not guaranteed to exist already. - Decompress(dst, src string, dir bool) error -} - -// Decompressors is the mapping of extension to the Decompressor implementation -// that will decompress that extension/type. -var Decompressors map[string]Decompressor - -func init() { - tbzDecompressor := new(TarBzip2Decompressor) - tgzDecompressor := new(TarGzipDecompressor) - txzDecompressor := new(TarXzDecompressor) - - Decompressors = map[string]Decompressor{ - "bz2": new(Bzip2Decompressor), - "gz": new(GzipDecompressor), - "xz": new(XzDecompressor), - "tar.bz2": tbzDecompressor, - "tar.gz": tgzDecompressor, - "tar.xz": txzDecompressor, - "tbz2": tbzDecompressor, - "tgz": tgzDecompressor, - "txz": txzDecompressor, - "zip": new(ZipDecompressor), - } -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_bzip2.go b/vendor/github.com/hashicorp/go-getter/decompress_bzip2.go deleted file mode 100644 index 339f4cf..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_bzip2.go +++ /dev/null @@ -1,45 +0,0 @@ -package getter - -import ( - "compress/bzip2" - "fmt" - "io" - "os" - "path/filepath" -) - -// Bzip2Decompressor is an implementation of Decompressor that can -// decompress bz2 files. -type Bzip2Decompressor struct{} - -func (d *Bzip2Decompressor) Decompress(dst, src string, dir bool) error { - // Directory isn't supported at all - if dir { - return fmt.Errorf("bzip2-compressed files can only unarchive to a single file") - } - - // If we're going into a directory we should make that first - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // Bzip2 compression is second - bzipR := bzip2.NewReader(f) - - // Copy it out - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, bzipR) - return err -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go b/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go deleted file mode 100644 index 9d49c47..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_bzip2_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestBzip2Decompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "single.bz2", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.bz2", - true, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-bz2", tc.Input) - } - - TestDecompressor(t, new(Bzip2Decompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_gzip.go b/vendor/github.com/hashicorp/go-getter/decompress_gzip.go deleted file mode 100644 index 5ebf709..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_gzip.go +++ /dev/null @@ -1,49 +0,0 @@ -package getter - -import ( - "compress/gzip" - "fmt" - "io" - "os" - "path/filepath" -) - -// GzipDecompressor is an implementation of Decompressor that can -// decompress gzip files. -type GzipDecompressor struct{} - -func (d *GzipDecompressor) Decompress(dst, src string, dir bool) error { - // Directory isn't supported at all - if dir { - return fmt.Errorf("gzip-compressed files can only unarchive to a single file") - } - - // If we're going into a directory we should make that first - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // gzip compression is second - gzipR, err := gzip.NewReader(f) - if err != nil { - return err - } - defer gzipR.Close() - - // Copy it out - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, gzipR) - return err -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go b/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go deleted file mode 100644 index 0aa9e27..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_gzip_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestGzipDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "single.gz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.gz", - true, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-gz", tc.Input) - } - - TestDecompressor(t, new(GzipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tar.go b/vendor/github.com/hashicorp/go-getter/decompress_tar.go deleted file mode 100644 index 543c30d..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tar.go +++ /dev/null @@ -1,112 +0,0 @@ -package getter - -import ( - "archive/tar" - "fmt" - "io" - "os" - "path/filepath" -) - -// untar is a shared helper for untarring an archive. The reader should provide -// an uncompressed view of the tar archive. -func untar(input io.Reader, dst, src string, dir bool) error { - tarR := tar.NewReader(input) - done := false - for { - hdr, err := tarR.Next() - if err == io.EOF { - if !done { - // Empty archive - return fmt.Errorf("empty archive: %s", src) - } - - return nil - } - if err != nil { - return err - } - - if hdr.Typeflag == tar.TypeXGlobalHeader || hdr.Typeflag == tar.TypeXHeader { - // don't unpack extended headers as files - continue - } - - path := dst - if dir { - path = filepath.Join(path, hdr.Name) - } - - if hdr.FileInfo().IsDir() { - if !dir { - return fmt.Errorf("expected a single file: %s", src) - } - - // A directory, just make the directory and continue unarchiving... - if err := os.MkdirAll(path, 0755); err != nil { - return err - } - - continue - } else { - // There is no ordering guarantee that a file in a directory is - // listed before the directory - dstPath := filepath.Dir(path) - - // Check that the directory exists, otherwise create it - if _, err := os.Stat(dstPath); os.IsNotExist(err) { - if err := os.MkdirAll(dstPath, 0755); err != nil { - return err - } - } - } - - // We have a file. If we already decoded, then it is an error - if !dir && done { - return fmt.Errorf("expected a single file, got multiple: %s", src) - } - - // Mark that we're done so future in single file mode errors - done = true - - // Open the file for writing - dstF, err := os.Create(path) - if err != nil { - return err - } - _, err = io.Copy(dstF, tarR) - dstF.Close() - if err != nil { - return err - } - - // Chmod the file - if err := os.Chmod(path, hdr.FileInfo().Mode()); err != nil { - return err - } - } -} - -// tarDecompressor is an implementation of Decompressor that can -// unpack tar files. -type tarDecompressor struct{} - -func (d *tarDecompressor) Decompress(dst, src string, dir bool) error { - // If we're going into a directory we should make that first - mkdir := dst - if !dir { - mkdir = filepath.Dir(dst) - } - if err := os.MkdirAll(mkdir, 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - return untar(f, dst, src, dir) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tar_test.go b/vendor/github.com/hashicorp/go-getter/decompress_tar_test.go deleted file mode 100644 index 7b3975c..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tar_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTar(t *testing.T) { - cases := []TestDecompressCase{ - { - "extended_header.tar", - true, - false, - []string{"directory/", "directory/a", "directory/b"}, - "", - }, - { - "implied_dir.tar", - true, - false, - []string{"directory/", "directory/sub/", "directory/sub/a", "directory/sub/b"}, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-tar", tc.Input) - } - - TestDecompressor(t, new(tarDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tbz2.go b/vendor/github.com/hashicorp/go-getter/decompress_tbz2.go deleted file mode 100644 index 5391b5c..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tbz2.go +++ /dev/null @@ -1,33 +0,0 @@ -package getter - -import ( - "compress/bzip2" - "os" - "path/filepath" -) - -// TarBzip2Decompressor is an implementation of Decompressor that can -// decompress tar.bz2 files. -type TarBzip2Decompressor struct{} - -func (d *TarBzip2Decompressor) Decompress(dst, src string, dir bool) error { - // If we're going into a directory we should make that first - mkdir := dst - if !dir { - mkdir = filepath.Dir(dst) - } - if err := os.MkdirAll(mkdir, 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // Bzip2 compression is second - bzipR := bzip2.NewReader(f) - return untar(bzipR, dst, src, dir) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go b/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go deleted file mode 100644 index 8df6477..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tbz2_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTarBzip2Decompressor(t *testing.T) { - orderingPaths := []string{"workers/", "workers/mq/", "workers/mq/__init__.py"} - - cases := []TestDecompressCase{ - { - "empty.tar.bz2", - false, - true, - nil, - "", - }, - - { - "single.tar.bz2", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.tar.bz2", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.tar.bz2", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.tar.bz2", - false, - true, - nil, - "", - }, - - // Tests when the file is listed before the parent folder - { - "ordering.tar.bz2", - true, - false, - orderingPaths, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-tbz2", tc.Input) - } - - TestDecompressor(t, new(TarBzip2Decompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_testing.go b/vendor/github.com/hashicorp/go-getter/decompress_testing.go deleted file mode 100644 index 82b8ab4..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_testing.go +++ /dev/null @@ -1,135 +0,0 @@ -package getter - -import ( - "crypto/md5" - "encoding/hex" - "io" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "runtime" - "sort" - "strings" - - "github.com/mitchellh/go-testing-interface" -) - -// TestDecompressCase is a single test case for testing decompressors -type TestDecompressCase struct { - Input string // Input is the complete path to the input file - Dir bool // Dir is whether or not we're testing directory mode - Err bool // Err is whether we expect an error or not - DirList []string // DirList is the list of files for Dir mode - FileMD5 string // FileMD5 is the expected MD5 for a single file -} - -// TestDecompressor is a helper function for testing generic decompressors. -func TestDecompressor(t testing.T, d Decompressor, cases []TestDecompressCase) { - for _, tc := range cases { - t.Logf("Testing: %s", tc.Input) - - // Temporary dir to store stuff - td, err := ioutil.TempDir("", "getter") - if err != nil { - t.Fatalf("err: %s", err) - } - - // Destination is always joining result so that we have a new path - dst := filepath.Join(td, "subdir", "result") - - // We use a function so defers work - func() { - defer os.RemoveAll(td) - - // Decompress - err := d.Decompress(dst, tc.Input, tc.Dir) - if (err != nil) != tc.Err { - t.Fatalf("err %s: %s", tc.Input, err) - } - if tc.Err { - return - } - - // If it isn't a directory, then check for a single file - if !tc.Dir { - fi, err := os.Stat(dst) - if err != nil { - t.Fatalf("err %s: %s", tc.Input, err) - } - if fi.IsDir() { - t.Fatalf("err %s: expected file, got directory", tc.Input) - } - if tc.FileMD5 != "" { - actual := testMD5(t, dst) - expected := tc.FileMD5 - if actual != expected { - t.Fatalf("err %s: expected MD5 %s, got %s", tc.Input, expected, actual) - } - } - - return - } - - // Convert expected for windows - expected := tc.DirList - if runtime.GOOS == "windows" { - for i, v := range expected { - expected[i] = strings.Replace(v, "/", "\\", -1) - } - } - - // Directory, check for the correct contents - actual := testListDir(t, dst) - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad %s\n\n%#v\n\n%#v", tc.Input, actual, expected) - } - }() - } -} - -func testListDir(t testing.T, path string) []string { - var result []string - err := filepath.Walk(path, func(sub string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - sub = strings.TrimPrefix(sub, path) - if sub == "" { - return nil - } - sub = sub[1:] // Trim the leading path sep. - - // If it is a dir, add trailing sep - if info.IsDir() { - sub += string(os.PathSeparator) - } - - result = append(result, sub) - return nil - }) - if err != nil { - t.Fatalf("err: %s", err) - } - - sort.Strings(result) - return result -} - -func testMD5(t testing.T, path string) string { - f, err := os.Open(path) - if err != nil { - t.Fatalf("err: %s", err) - } - defer f.Close() - - h := md5.New() - _, err = io.Copy(h, f) - if err != nil { - t.Fatalf("err: %s", err) - } - - result := h.Sum(nil) - return hex.EncodeToString(result) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tgz.go b/vendor/github.com/hashicorp/go-getter/decompress_tgz.go deleted file mode 100644 index 65eb70d..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tgz.go +++ /dev/null @@ -1,39 +0,0 @@ -package getter - -import ( - "compress/gzip" - "fmt" - "os" - "path/filepath" -) - -// TarGzipDecompressor is an implementation of Decompressor that can -// decompress tar.gzip files. -type TarGzipDecompressor struct{} - -func (d *TarGzipDecompressor) Decompress(dst, src string, dir bool) error { - // If we're going into a directory we should make that first - mkdir := dst - if !dir { - mkdir = filepath.Dir(dst) - } - if err := os.MkdirAll(mkdir, 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // Gzip compression is second - gzipR, err := gzip.NewReader(f) - if err != nil { - return fmt.Errorf("Error opening a gzip reader for %s: %s", src, err) - } - defer gzipR.Close() - - return untar(gzipR, dst, src, dir) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go b/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go deleted file mode 100644 index b101747..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_tgz_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTarGzipDecompressor(t *testing.T) { - - multiplePaths := []string{"dir/", "dir/test2", "test1"} - orderingPaths := []string{"workers/", "workers/mq/", "workers/mq/__init__.py"} - - cases := []TestDecompressCase{ - { - "empty.tar.gz", - false, - true, - nil, - "", - }, - - { - "single.tar.gz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.tar.gz", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.tar.gz", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.tar.gz", - false, - true, - nil, - "", - }, - - { - "multiple_dir.tar.gz", - true, - false, - multiplePaths, - "", - }, - - // Tests when the file is listed before the parent folder - { - "ordering.tar.gz", - true, - false, - orderingPaths, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-tgz", tc.Input) - } - - TestDecompressor(t, new(TarGzipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_txz.go b/vendor/github.com/hashicorp/go-getter/decompress_txz.go deleted file mode 100644 index 5e151c1..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_txz.go +++ /dev/null @@ -1,39 +0,0 @@ -package getter - -import ( - "fmt" - "os" - "path/filepath" - - "github.com/ulikunitz/xz" -) - -// TarXzDecompressor is an implementation of Decompressor that can -// decompress tar.xz files. -type TarXzDecompressor struct{} - -func (d *TarXzDecompressor) Decompress(dst, src string, dir bool) error { - // If we're going into a directory we should make that first - mkdir := dst - if !dir { - mkdir = filepath.Dir(dst) - } - if err := os.MkdirAll(mkdir, 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // xz compression is second - txzR, err := xz.NewReader(f) - if err != nil { - return fmt.Errorf("Error opening an xz reader for %s: %s", src, err) - } - - return untar(txzR, dst, src, dir) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_txz_test.go b/vendor/github.com/hashicorp/go-getter/decompress_txz_test.go deleted file mode 100644 index 30b572d..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_txz_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestTarXzDecompressor(t *testing.T) { - - multiplePaths := []string{"dir/", "dir/test2", "test1"} - orderingPaths := []string{"workers/", "workers/mq/", "workers/mq/__init__.py"} - - cases := []TestDecompressCase{ - { - "empty.tar.xz", - false, - true, - nil, - "", - }, - - { - "single.tar.xz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.tar.xz", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.tar.xz", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.tar.xz", - false, - true, - nil, - "", - }, - - { - "multiple_dir.tar.xz", - true, - false, - multiplePaths, - "", - }, - - // Tests when the file is listed before the parent folder - { - "ordering.tar.xz", - true, - false, - orderingPaths, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-txz", tc.Input) - } - - TestDecompressor(t, new(TarXzDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_xz.go b/vendor/github.com/hashicorp/go-getter/decompress_xz.go deleted file mode 100644 index 4e37aba..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_xz.go +++ /dev/null @@ -1,49 +0,0 @@ -package getter - -import ( - "fmt" - "io" - "os" - "path/filepath" - - "github.com/ulikunitz/xz" -) - -// XzDecompressor is an implementation of Decompressor that can -// decompress xz files. -type XzDecompressor struct{} - -func (d *XzDecompressor) Decompress(dst, src string, dir bool) error { - // Directory isn't supported at all - if dir { - return fmt.Errorf("xz-compressed files can only unarchive to a single file") - } - - // If we're going into a directory we should make that first - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // File first - f, err := os.Open(src) - if err != nil { - return err - } - defer f.Close() - - // xz compression is second - xzR, err := xz.NewReader(f) - if err != nil { - return err - } - - // Copy it out - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, xzR) - return err -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_xz_test.go b/vendor/github.com/hashicorp/go-getter/decompress_xz_test.go deleted file mode 100644 index f3ba8ab..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_xz_test.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestXzDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "single.xz", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.xz", - true, - true, - nil, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-xz", tc.Input) - } - - TestDecompressor(t, new(XzDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_zip.go b/vendor/github.com/hashicorp/go-getter/decompress_zip.go deleted file mode 100644 index a065c07..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_zip.go +++ /dev/null @@ -1,96 +0,0 @@ -package getter - -import ( - "archive/zip" - "fmt" - "io" - "os" - "path/filepath" -) - -// ZipDecompressor is an implementation of Decompressor that can -// decompress tar.gzip files. -type ZipDecompressor struct{} - -func (d *ZipDecompressor) Decompress(dst, src string, dir bool) error { - // If we're going into a directory we should make that first - mkdir := dst - if !dir { - mkdir = filepath.Dir(dst) - } - if err := os.MkdirAll(mkdir, 0755); err != nil { - return err - } - - // Open the zip - zipR, err := zip.OpenReader(src) - if err != nil { - return err - } - defer zipR.Close() - - // Check the zip integrity - if len(zipR.File) == 0 { - // Empty archive - return fmt.Errorf("empty archive: %s", src) - } - if !dir && len(zipR.File) > 1 { - return fmt.Errorf("expected a single file: %s", src) - } - - // Go through and unarchive - for _, f := range zipR.File { - path := dst - if dir { - path = filepath.Join(path, f.Name) - } - - if f.FileInfo().IsDir() { - if !dir { - return fmt.Errorf("expected a single file: %s", src) - } - - // A directory, just make the directory and continue unarchiving... - if err := os.MkdirAll(path, 0755); err != nil { - return err - } - - continue - } - - // Create the enclosing directories if we must. ZIP files aren't - // required to contain entries for just the directories so this - // can happen. - if dir { - if err := os.MkdirAll(filepath.Dir(path), 0755); err != nil { - return err - } - } - - // Open the file for reading - srcF, err := f.Open() - if err != nil { - return err - } - - // Open the file for writing - dstF, err := os.Create(path) - if err != nil { - srcF.Close() - return err - } - _, err = io.Copy(dstF, srcF) - srcF.Close() - dstF.Close() - if err != nil { - return err - } - - // Chmod the file - if err := os.Chmod(path, f.Mode()); err != nil { - return err - } - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go b/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go deleted file mode 100644 index cbdd241..0000000 --- a/vendor/github.com/hashicorp/go-getter/decompress_zip_test.go +++ /dev/null @@ -1,80 +0,0 @@ -package getter - -import ( - "path/filepath" - "testing" -) - -func TestZipDecompressor(t *testing.T) { - cases := []TestDecompressCase{ - { - "empty.zip", - false, - true, - nil, - "", - }, - - { - "single.zip", - false, - false, - nil, - "d3b07384d113edec49eaa6238ad5ff00", - }, - - { - "single.zip", - true, - false, - []string{"file"}, - "", - }, - - { - "multiple.zip", - true, - false, - []string{"file1", "file2"}, - "", - }, - - { - "multiple.zip", - false, - true, - nil, - "", - }, - - { - "subdir.zip", - true, - false, - []string{"file1", "subdir/", "subdir/child"}, - "", - }, - - { - "subdir_empty.zip", - true, - false, - []string{"file1", "subdir/"}, - "", - }, - - { - "subdir_missing_dir.zip", - true, - false, - []string{"file1", "subdir/", "subdir/child"}, - "", - }, - } - - for i, tc := range cases { - cases[i].Input = filepath.Join("./test-fixtures", "decompress-zip", tc.Input) - } - - TestDecompressor(t, new(ZipDecompressor), cases) -} diff --git a/vendor/github.com/hashicorp/go-getter/detect.go b/vendor/github.com/hashicorp/go-getter/detect.go deleted file mode 100644 index c369551..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect.go +++ /dev/null @@ -1,103 +0,0 @@ -package getter - -import ( - "fmt" - "path/filepath" - - "github.com/hashicorp/go-getter/helper/url" -) - -// Detector defines the interface that an invalid URL or a URL with a blank -// scheme is passed through in order to determine if its shorthand for -// something else well-known. -type Detector interface { - // Detect will detect whether the string matches a known pattern to - // turn it into a proper URL. - Detect(string, string) (string, bool, error) -} - -// Detectors is the list of detectors that are tried on an invalid URL. -// This is also the order they're tried (index 0 is first). -var Detectors []Detector - -func init() { - Detectors = []Detector{ - new(GitHubDetector), - new(BitBucketDetector), - new(S3Detector), - new(FileDetector), - } -} - -// Detect turns a source string into another source string if it is -// detected to be of a known pattern. -// -// The third parameter should be the list of detectors to use in the -// order to try them. If you don't want to configure this, just use -// the global Detectors variable. -// -// This is safe to be called with an already valid source string: Detect -// will just return it. -func Detect(src string, pwd string, ds []Detector) (string, error) { - getForce, getSrc := getForcedGetter(src) - - // Separate out the subdir if there is one, we don't pass that to detect - getSrc, subDir := SourceDirSubdir(getSrc) - - u, err := url.Parse(getSrc) - if err == nil && u.Scheme != "" { - // Valid URL - return src, nil - } - - for _, d := range ds { - result, ok, err := d.Detect(getSrc, pwd) - if err != nil { - return "", err - } - if !ok { - continue - } - - var detectForce string - detectForce, result = getForcedGetter(result) - result, detectSubdir := SourceDirSubdir(result) - - // If we have a subdir from the detection, then prepend it to our - // requested subdir. - if detectSubdir != "" { - if subDir != "" { - subDir = filepath.Join(detectSubdir, subDir) - } else { - subDir = detectSubdir - } - } - - if subDir != "" { - u, err := url.Parse(result) - if err != nil { - return "", fmt.Errorf("Error parsing URL: %s", err) - } - u.Path += "//" + subDir - - // a subdir may contain wildcards, but in order to support them we - // have to ensure the path isn't escaped. - u.RawPath = u.Path - - result = u.String() - } - - // Preserve the forced getter if it exists. We try to use the - // original set force first, followed by any force set by the - // detector. - if getForce != "" { - result = fmt.Sprintf("%s::%s", getForce, result) - } else if detectForce != "" { - result = fmt.Sprintf("%s::%s", detectForce, result) - } - - return result, nil - } - - return "", fmt.Errorf("invalid source string: %s", src) -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go b/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go deleted file mode 100644 index a183a17..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_bitbucket.go +++ /dev/null @@ -1,66 +0,0 @@ -package getter - -import ( - "encoding/json" - "fmt" - "net/http" - "net/url" - "strings" -) - -// BitBucketDetector implements Detector to detect BitBucket URLs and turn -// them into URLs that the Git or Hg Getter can understand. -type BitBucketDetector struct{} - -func (d *BitBucketDetector) Detect(src, _ string) (string, bool, error) { - if len(src) == 0 { - return "", false, nil - } - - if strings.HasPrefix(src, "bitbucket.org/") { - return d.detectHTTP(src) - } - - return "", false, nil -} - -func (d *BitBucketDetector) detectHTTP(src string) (string, bool, error) { - u, err := url.Parse("https://" + src) - if err != nil { - return "", true, fmt.Errorf("error parsing BitBucket URL: %s", err) - } - - // We need to get info on this BitBucket repository to determine whether - // it is Git or Hg. - var info struct { - SCM string `json:"scm"` - } - infoUrl := "https://api.bitbucket.org/1.0/repositories" + u.Path - resp, err := http.Get(infoUrl) - if err != nil { - return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) - } - if resp.StatusCode == 403 { - // A private repo - return "", true, fmt.Errorf( - "shorthand BitBucket URL can't be used for private repos, " + - "please use a full URL") - } - dec := json.NewDecoder(resp.Body) - if err := dec.Decode(&info); err != nil { - return "", true, fmt.Errorf("error looking up BitBucket URL: %s", err) - } - - switch info.SCM { - case "git": - if !strings.HasSuffix(u.Path, ".git") { - u.Path += ".git" - } - - return "git::" + u.String(), true, nil - case "hg": - return "hg::" + u.String(), true, nil - default: - return "", true, fmt.Errorf("unknown BitBucket SCM type: %s", info.SCM) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go b/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go deleted file mode 100644 index 202c932..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_bitbucket_test.go +++ /dev/null @@ -1,67 +0,0 @@ -package getter - -import ( - "net/http" - "strings" - "testing" -) - -const testBBUrl = "https://bitbucket.org/hashicorp/tf-test-git" - -func TestBitBucketDetector(t *testing.T) { - t.Parallel() - - if _, err := http.Get(testBBUrl); err != nil { - t.Log("internet may not be working, skipping BB tests") - t.Skip() - } - - cases := []struct { - Input string - Output string - }{ - // HTTP - { - "bitbucket.org/hashicorp/tf-test-git", - "git::https://bitbucket.org/hashicorp/tf-test-git.git", - }, - { - "bitbucket.org/hashicorp/tf-test-git.git", - "git::https://bitbucket.org/hashicorp/tf-test-git.git", - }, - { - "bitbucket.org/hashicorp/tf-test-hg", - "hg::https://bitbucket.org/hashicorp/tf-test-hg", - }, - } - - pwd := "/pwd" - f := new(BitBucketDetector) - for i, tc := range cases { - var err error - for i := 0; i < 3; i++ { - var output string - var ok bool - output, ok, err = f.Detect(tc.Input, pwd) - if err != nil { - if strings.Contains(err.Error(), "invalid character") { - continue - } - - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - - break - } - if i >= 3 { - t.Fatalf("failure from bitbucket: %s", err) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_file.go b/vendor/github.com/hashicorp/go-getter/detect_file.go deleted file mode 100644 index 4ef41ea..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_file.go +++ /dev/null @@ -1,67 +0,0 @@ -package getter - -import ( - "fmt" - "os" - "path/filepath" - "runtime" -) - -// FileDetector implements Detector to detect file paths. -type FileDetector struct{} - -func (d *FileDetector) Detect(src, pwd string) (string, bool, error) { - if len(src) == 0 { - return "", false, nil - } - - if !filepath.IsAbs(src) { - if pwd == "" { - return "", true, fmt.Errorf( - "relative paths require a module with a pwd") - } - - // Stat the pwd to determine if its a symbolic link. If it is, - // then the pwd becomes the original directory. Otherwise, - // `filepath.Join` below does some weird stuff. - // - // We just ignore if the pwd doesn't exist. That error will be - // caught later when we try to use the URL. - if fi, err := os.Lstat(pwd); !os.IsNotExist(err) { - if err != nil { - return "", true, err - } - if fi.Mode()&os.ModeSymlink != 0 { - pwd, err = filepath.EvalSymlinks(pwd) - if err != nil { - return "", true, err - } - - // The symlink itself might be a relative path, so we have to - // resolve this to have a correctly rooted URL. - pwd, err = filepath.Abs(pwd) - if err != nil { - return "", true, err - } - } - } - - src = filepath.Join(pwd, src) - } - - return fmtFileURL(src), true, nil -} - -func fmtFileURL(path string) string { - if runtime.GOOS == "windows" { - // Make sure we're using "/" on Windows. URLs are "/"-based. - path = filepath.ToSlash(path) - return fmt.Sprintf("file://%s", path) - } - - // Make sure that we don't start with "/" since we add that below. - if path[0] == '/' { - path = path[1:] - } - return fmt.Sprintf("file:///%s", path) -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_file_test.go b/vendor/github.com/hashicorp/go-getter/detect_file_test.go deleted file mode 100644 index 106702a..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_file_test.go +++ /dev/null @@ -1,118 +0,0 @@ -package getter - -import ( - "fmt" - "os" - "path/filepath" - "runtime" - "strings" - "testing" -) - -type fileTest struct { - in, pwd, out string - err bool -} - -var fileTests = []fileTest{ - {"./foo", "/pwd", "file:///pwd/foo", false}, - {"./foo?foo=bar", "/pwd", "file:///pwd/foo?foo=bar", false}, - {"foo", "/pwd", "file:///pwd/foo", false}, -} - -var unixFileTests = []fileTest{ - {"./foo", "test-fixtures/detect-file-symlink-pwd/syml/pwd", - "test-fixtures/detect-file-symlink-pwd/real/foo", false}, - - {"/foo", "/pwd", "file:///foo", false}, - {"/foo?bar=baz", "/pwd", "file:///foo?bar=baz", false}, -} - -var winFileTests = []fileTest{ - {"/foo", "/pwd", "file:///pwd/foo", false}, - {`C:\`, `/pwd`, `file://C:/`, false}, - {`C:\?bar=baz`, `/pwd`, `file://C:/?bar=baz`, false}, -} - -func TestFileDetector(t *testing.T) { - if runtime.GOOS == "windows" { - fileTests = append(fileTests, winFileTests...) - } else { - fileTests = append(fileTests, unixFileTests...) - } - - // Get the pwd - pwdRoot, err := os.Getwd() - if err != nil { - t.Fatalf("err: %s", err) - } - pwdRoot, err = filepath.Abs(pwdRoot) - if err != nil { - t.Fatalf("err: %s", err) - } - - f := new(FileDetector) - for i, tc := range fileTests { - t.Run(fmt.Sprintf("%d", i), func(t *testing.T) { - pwd := tc.pwd - if !filepath.IsAbs(pwd) { - pwd = filepath.Join(pwdRoot, pwd) - } - - out, ok, err := f.Detect(tc.in, pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - expected := tc.out - if !strings.HasPrefix(expected, "file://") { - expected = "file://" + filepath.Join(pwdRoot, expected) - } - - if out != expected { - t.Fatalf("input: %q\npwd: %q\nexpected: %q\nbad output: %#v", - tc.in, pwd, expected, out) - } - }) - } -} - -var noPwdFileTests = []fileTest{ - {in: "./foo", pwd: "", out: "", err: true}, - {in: "foo", pwd: "", out: "", err: true}, -} - -var noPwdUnixFileTests = []fileTest{ - {in: "/foo", pwd: "", out: "file:///foo", err: false}, -} - -var noPwdWinFileTests = []fileTest{ - {in: "/foo", pwd: "", out: "", err: true}, - {in: `C:\`, pwd: ``, out: `file://C:/`, err: false}, -} - -func TestFileDetector_noPwd(t *testing.T) { - if runtime.GOOS == "windows" { - noPwdFileTests = append(noPwdFileTests, noPwdWinFileTests...) - } else { - noPwdFileTests = append(noPwdFileTests, noPwdUnixFileTests...) - } - - f := new(FileDetector) - for i, tc := range noPwdFileTests { - out, ok, err := f.Detect(tc.in, tc.pwd) - if err != nil != tc.err { - t.Fatalf("%d: err: %s", i, err) - } - if !ok { - t.Fatal("not ok") - } - - if out != tc.out { - t.Fatalf("%d: bad: %#v", i, out) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_file_unix_test.go b/vendor/github.com/hashicorp/go-getter/detect_file_unix_test.go deleted file mode 100644 index 657f1a4..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_file_unix_test.go +++ /dev/null @@ -1,70 +0,0 @@ -// +build test unix - -package getter - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -// If a relative symlink is passed in as the pwd to Detect, the resulting URL -// can have an invalid path. -func TestFileDetector_relativeSymlink(t *testing.T) { - tmpDir, err := ioutil.TempDir("", "go-getter") - if err != nil { - t.Fatal(err) - } - - defer os.RemoveAll(tmpDir) - - // We may have a symlinked tmp dir, - // e.g. OSX uses /var -> /private/var - tmpDir, err = filepath.EvalSymlinks(tmpDir) - if err != nil { - t.Fatal(err) - } - - err = os.Mkdir(filepath.Join(tmpDir, "realPWD"), 0755) - if err != nil { - t.Fatal(err) - } - - subdir := filepath.Join(tmpDir, "subdir") - err = os.Mkdir(subdir, 0755) - if err != nil { - t.Fatal(err) - } - - prevDir, err := os.Getwd() - if err != nil { - t.Fatal(err) - } - defer os.Chdir(prevDir) - - err = os.Chdir(subdir) - if err != nil { - t.Fatal(err) - } - - err = os.Symlink("../realPWD", "linkedPWD") - if err != nil { - t.Fatal(err) - } - - // if detech doesn't fully resolve the pwd symlink, the output will be the - // invalid path: "file:///../modules/foo" - f := new(FileDetector) - out, ok, err := f.Detect("../modules/foo", "./linkedPWD") - if err != nil { - t.Fatalf("err: %v", err) - } - if !ok { - t.Fatal("not ok") - } - if out != "file://"+filepath.Join(tmpDir, "modules/foo") { - t.Logf("expected: %v", "file://"+filepath.Join(tmpDir, "modules/foo")) - t.Fatalf("bad: %v", out) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_github.go b/vendor/github.com/hashicorp/go-getter/detect_github.go deleted file mode 100644 index c084ad9..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_github.go +++ /dev/null @@ -1,73 +0,0 @@ -package getter - -import ( - "fmt" - "net/url" - "strings" -) - -// GitHubDetector implements Detector to detect GitHub URLs and turn -// them into URLs that the Git Getter can understand. -type GitHubDetector struct{} - -func (d *GitHubDetector) Detect(src, _ string) (string, bool, error) { - if len(src) == 0 { - return "", false, nil - } - - if strings.HasPrefix(src, "github.com/") { - return d.detectHTTP(src) - } else if strings.HasPrefix(src, "git@github.com:") { - return d.detectSSH(src) - } - - return "", false, nil -} - -func (d *GitHubDetector) detectHTTP(src string) (string, bool, error) { - parts := strings.Split(src, "/") - if len(parts) < 3 { - return "", false, fmt.Errorf( - "GitHub URLs should be github.com/username/repo") - } - - urlStr := fmt.Sprintf("https://%s", strings.Join(parts[:3], "/")) - url, err := url.Parse(urlStr) - if err != nil { - return "", true, fmt.Errorf("error parsing GitHub URL: %s", err) - } - - if !strings.HasSuffix(url.Path, ".git") { - url.Path += ".git" - } - - if len(parts) > 3 { - url.Path += "//" + strings.Join(parts[3:], "/") - } - - return "git::" + url.String(), true, nil -} - -func (d *GitHubDetector) detectSSH(src string) (string, bool, error) { - idx := strings.Index(src, ":") - qidx := strings.Index(src, "?") - if qidx == -1 { - qidx = len(src) - } - - var u url.URL - u.Scheme = "ssh" - u.User = url.User("git") - u.Host = "github.com" - u.Path = src[idx+1 : qidx] - if qidx < len(src) { - q, err := url.ParseQuery(src[qidx+1:]) - if err != nil { - return "", true, fmt.Errorf("error parsing GitHub SSH URL: %s", err) - } - - u.RawQuery = q.Encode() - } - - return "git::" + u.String(), true, nil -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_github_test.go b/vendor/github.com/hashicorp/go-getter/detect_github_test.go deleted file mode 100644 index 43ed9fc..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_github_test.go +++ /dev/null @@ -1,55 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestGitHubDetector(t *testing.T) { - cases := []struct { - Input string - Output string - }{ - // HTTP - {"github.com/hashicorp/foo", "git::https://github.com/hashicorp/foo.git"}, - {"github.com/hashicorp/foo.git", "git::https://github.com/hashicorp/foo.git"}, - { - "github.com/hashicorp/foo/bar", - "git::https://github.com/hashicorp/foo.git//bar", - }, - { - "github.com/hashicorp/foo?foo=bar", - "git::https://github.com/hashicorp/foo.git?foo=bar", - }, - { - "github.com/hashicorp/foo.git?foo=bar", - "git::https://github.com/hashicorp/foo.git?foo=bar", - }, - - // SSH - {"git@github.com:hashicorp/foo.git", "git::ssh://git@github.com/hashicorp/foo.git"}, - { - "git@github.com:hashicorp/foo.git//bar", - "git::ssh://git@github.com/hashicorp/foo.git//bar", - }, - { - "git@github.com:hashicorp/foo.git?foo=bar", - "git::ssh://git@github.com/hashicorp/foo.git?foo=bar", - }, - } - - pwd := "/pwd" - f := new(GitHubDetector) - for i, tc := range cases { - output, ok, err := f.Detect(tc.Input, pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_s3.go b/vendor/github.com/hashicorp/go-getter/detect_s3.go deleted file mode 100644 index 8e0f4a0..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_s3.go +++ /dev/null @@ -1,61 +0,0 @@ -package getter - -import ( - "fmt" - "net/url" - "strings" -) - -// S3Detector implements Detector to detect S3 URLs and turn -// them into URLs that the S3 getter can understand. -type S3Detector struct{} - -func (d *S3Detector) Detect(src, _ string) (string, bool, error) { - if len(src) == 0 { - return "", false, nil - } - - if strings.Contains(src, ".amazonaws.com/") { - return d.detectHTTP(src) - } - - return "", false, nil -} - -func (d *S3Detector) detectHTTP(src string) (string, bool, error) { - parts := strings.Split(src, "/") - if len(parts) < 2 { - return "", false, fmt.Errorf( - "URL is not a valid S3 URL") - } - - hostParts := strings.Split(parts[0], ".") - if len(hostParts) == 3 { - return d.detectPathStyle(hostParts[0], parts[1:]) - } else if len(hostParts) == 4 { - return d.detectVhostStyle(hostParts[1], hostParts[0], parts[1:]) - } else { - return "", false, fmt.Errorf( - "URL is not a valid S3 URL") - } -} - -func (d *S3Detector) detectPathStyle(region string, parts []string) (string, bool, error) { - urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s", region, strings.Join(parts, "/")) - url, err := url.Parse(urlStr) - if err != nil { - return "", false, fmt.Errorf("error parsing S3 URL: %s", err) - } - - return "s3::" + url.String(), true, nil -} - -func (d *S3Detector) detectVhostStyle(region, bucket string, parts []string) (string, bool, error) { - urlStr := fmt.Sprintf("https://%s.amazonaws.com/%s/%s", region, bucket, strings.Join(parts, "/")) - url, err := url.Parse(urlStr) - if err != nil { - return "", false, fmt.Errorf("error parsing S3 URL: %s", err) - } - - return "s3::" + url.String(), true, nil -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_s3_test.go b/vendor/github.com/hashicorp/go-getter/detect_s3_test.go deleted file mode 100644 index f410c78..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_s3_test.go +++ /dev/null @@ -1,84 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestS3Detector(t *testing.T) { - cases := []struct { - Input string - Output string - }{ - // Virtual hosted style - { - "bucket.s3.amazonaws.com/foo", - "s3::https://s3.amazonaws.com/bucket/foo", - }, - { - "bucket.s3.amazonaws.com/foo/bar", - "s3::https://s3.amazonaws.com/bucket/foo/bar", - }, - { - "bucket.s3.amazonaws.com/foo/bar.baz", - "s3::https://s3.amazonaws.com/bucket/foo/bar.baz", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo/bar", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar", - }, - { - "bucket.s3-eu-west-1.amazonaws.com/foo/bar.baz", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - }, - // Path style - { - "s3.amazonaws.com/bucket/foo", - "s3::https://s3.amazonaws.com/bucket/foo", - }, - { - "s3.amazonaws.com/bucket/foo/bar", - "s3::https://s3.amazonaws.com/bucket/foo/bar", - }, - { - "s3.amazonaws.com/bucket/foo/bar.baz", - "s3::https://s3.amazonaws.com/bucket/foo/bar.baz", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar", - }, - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz", - }, - // Misc tests - { - "s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz?version=1234", - "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz?version=1234", - }, - } - - pwd := "/pwd" - f := new(S3Detector) - for i, tc := range cases { - output, ok, err := f.Detect(tc.Input, pwd) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("not ok") - } - - if output != tc.Output { - t.Fatalf("%d: bad: %#v", i, output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/detect_test.go b/vendor/github.com/hashicorp/go-getter/detect_test.go deleted file mode 100644 index 2a1c202..0000000 --- a/vendor/github.com/hashicorp/go-getter/detect_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package getter - -import ( - "testing" -) - -func TestDetect(t *testing.T) { - cases := []struct { - Input string - Pwd string - Output string - Err bool - }{ - {"./foo", "/foo", "file:///foo/foo", false}, - {"git::./foo", "/foo", "git::file:///foo/foo", false}, - { - "git::github.com/hashicorp/foo", - "", - "git::https://github.com/hashicorp/foo.git", - false, - }, - { - "./foo//bar", - "/foo", - "file:///foo/foo//bar", - false, - }, - { - "git::github.com/hashicorp/foo//bar", - "", - "git::https://github.com/hashicorp/foo.git//bar", - false, - }, - { - "git::https://github.com/hashicorp/consul.git", - "", - "git::https://github.com/hashicorp/consul.git", - false, - }, - { - "./foo/archive//*", - "/bar", - "file:///bar/foo/archive//*", - false, - }, - } - - for i, tc := range cases { - output, err := Detect(tc.Input, tc.Pwd, Detectors) - if err != nil != tc.Err { - t.Fatalf("%d: bad err: %s", i, err) - } - if output != tc.Output { - t.Fatalf("%d: bad output: %s\nexpected: %s", i, output, tc.Output) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/folder_storage.go b/vendor/github.com/hashicorp/go-getter/folder_storage.go deleted file mode 100644 index 647ccf4..0000000 --- a/vendor/github.com/hashicorp/go-getter/folder_storage.go +++ /dev/null @@ -1,65 +0,0 @@ -package getter - -import ( - "crypto/md5" - "encoding/hex" - "fmt" - "os" - "path/filepath" -) - -// FolderStorage is an implementation of the Storage interface that manages -// modules on the disk. -type FolderStorage struct { - // StorageDir is the directory where the modules will be stored. - StorageDir string -} - -// Dir implements Storage.Dir -func (s *FolderStorage) Dir(key string) (d string, e bool, err error) { - d = s.dir(key) - _, err = os.Stat(d) - if err == nil { - // Directory exists - e = true - return - } - if os.IsNotExist(err) { - // Directory doesn't exist - d = "" - e = false - err = nil - return - } - - // An error - d = "" - e = false - return -} - -// Get implements Storage.Get -func (s *FolderStorage) Get(key string, source string, update bool) error { - dir := s.dir(key) - if !update { - if _, err := os.Stat(dir); err == nil { - // If the directory already exists, then we're done since - // we're not updating. - return nil - } else if !os.IsNotExist(err) { - // If the error we got wasn't a file-not-exist error, then - // something went wrong and we should report it. - return fmt.Errorf("Error reading module directory: %s", err) - } - } - - // Get the source. This always forces an update. - return Get(dir, source) -} - -// dir returns the directory name internally that we'll use to map to -// internally. -func (s *FolderStorage) dir(key string) string { - sum := md5.Sum([]byte(key)) - return filepath.Join(s.StorageDir, hex.EncodeToString(sum[:])) -} diff --git a/vendor/github.com/hashicorp/go-getter/folder_storage_test.go b/vendor/github.com/hashicorp/go-getter/folder_storage_test.go deleted file mode 100644 index feb8d34..0000000 --- a/vendor/github.com/hashicorp/go-getter/folder_storage_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "testing" -) - -func TestFolderStorage_impl(t *testing.T) { - var _ Storage = new(FolderStorage) -} - -func TestFolderStorage(t *testing.T) { - s := &FolderStorage{StorageDir: tempDir(t)} - - module := testModule("basic") - - // A module shouldn't exist at first... - _, ok, err := s.Dir(module) - if err != nil { - t.Fatalf("err: %s", err) - } - if ok { - t.Fatal("should not exist") - } - - key := "foo" - - // We can get it - err = s.Get(key, module, false) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Now the module exists - dir, ok, err := s.Dir(key) - if err != nil { - t.Fatalf("err: %s", err) - } - if !ok { - t.Fatal("should exist") - } - - mainPath := filepath.Join(dir, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get.go b/vendor/github.com/hashicorp/go-getter/get.go deleted file mode 100644 index e6053d9..0000000 --- a/vendor/github.com/hashicorp/go-getter/get.go +++ /dev/null @@ -1,146 +0,0 @@ -// getter is a package for downloading files or directories from a variety of -// protocols. -// -// getter is unique in its ability to download both directories and files. -// It also detects certain source strings to be protocol-specific URLs. For -// example, "github.com/hashicorp/go-getter" would turn into a Git URL and -// use the Git protocol. -// -// Protocols and detectors are extensible. -// -// To get started, see Client. -package getter - -import ( - "bytes" - "fmt" - "net/url" - "os/exec" - "regexp" - "syscall" - - cleanhttp "github.com/hashicorp/go-cleanhttp" -) - -// Getter defines the interface that schemes must implement to download -// things. -type Getter interface { - // Get downloads the given URL into the given directory. This always - // assumes that we're updating and gets the latest version that it can. - // - // The directory may already exist (if we're updating). If it is in a - // format that isn't understood, an error should be returned. Get shouldn't - // simply nuke the directory. - Get(string, *url.URL) error - - // GetFile downloads the give URL into the given path. The URL must - // reference a single file. If possible, the Getter should check if - // the remote end contains the same file and no-op this operation. - GetFile(string, *url.URL) error - - // ClientMode returns the mode based on the given URL. This is used to - // allow clients to let the getters decide which mode to use. - ClientMode(*url.URL) (ClientMode, error) -} - -// Getters is the mapping of scheme to the Getter implementation that will -// be used to get a dependency. -var Getters map[string]Getter - -// forcedRegexp is the regular expression that finds forced getters. This -// syntax is schema::url, example: git::https://foo.com -var forcedRegexp = regexp.MustCompile(`^([A-Za-z0-9]+)::(.+)$`) - -// httpClient is the default client to be used by HttpGetters. -var httpClient = cleanhttp.DefaultClient() - -func init() { - httpGetter := &HttpGetter{ - Netrc: true, - } - - Getters = map[string]Getter{ - "file": new(FileGetter), - "git": new(GitGetter), - "hg": new(HgGetter), - "s3": new(S3Getter), - "http": httpGetter, - "https": httpGetter, - } -} - -// Get downloads the directory specified by src into the folder specified by -// dst. If dst already exists, Get will attempt to update it. -// -// src is a URL, whereas dst is always just a file path to a folder. This -// folder doesn't need to exist. It will be created if it doesn't exist. -func Get(dst, src string) error { - return (&Client{ - Src: src, - Dst: dst, - Dir: true, - Getters: Getters, - }).Get() -} - -// GetAny downloads a URL into the given destination. Unlike Get or -// GetFile, both directories and files are supported. -// -// dst must be a directory. If src is a file, it will be downloaded -// into dst with the basename of the URL. If src is a directory or -// archive, it will be unpacked directly into dst. -func GetAny(dst, src string) error { - return (&Client{ - Src: src, - Dst: dst, - Mode: ClientModeAny, - Getters: Getters, - }).Get() -} - -// GetFile downloads the file specified by src into the path specified by -// dst. -func GetFile(dst, src string) error { - return (&Client{ - Src: src, - Dst: dst, - Dir: false, - Getters: Getters, - }).Get() -} - -// getRunCommand is a helper that will run a command and capture the output -// in the case an error happens. -func getRunCommand(cmd *exec.Cmd) error { - var buf bytes.Buffer - cmd.Stdout = &buf - cmd.Stderr = &buf - err := cmd.Run() - if err == nil { - return nil - } - if exiterr, ok := err.(*exec.ExitError); ok { - // The program has exited with an exit code != 0 - if status, ok := exiterr.Sys().(syscall.WaitStatus); ok { - return fmt.Errorf( - "%s exited with %d: %s", - cmd.Path, - status.ExitStatus(), - buf.String()) - } - } - - return fmt.Errorf("error running %s: %s", cmd.Path, buf.String()) -} - -// getForcedGetter takes a source and returns the tuple of the forced -// getter and the raw URL (without the force syntax). -func getForcedGetter(src string) (string, string) { - var forced string - if ms := forcedRegexp.FindStringSubmatch(src); ms != nil { - forced = ms[1] - src = ms[2] - } - - return forced, src -} diff --git a/vendor/github.com/hashicorp/go-getter/get_file.go b/vendor/github.com/hashicorp/go-getter/get_file.go deleted file mode 100644 index e5d2d61..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_file.go +++ /dev/null @@ -1,32 +0,0 @@ -package getter - -import ( - "net/url" - "os" -) - -// FileGetter is a Getter implementation that will download a module from -// a file scheme. -type FileGetter struct { - // Copy, if set to true, will copy data instead of using a symlink - Copy bool -} - -func (g *FileGetter) ClientMode(u *url.URL) (ClientMode, error) { - path := u.Path - if u.RawPath != "" { - path = u.RawPath - } - - fi, err := os.Stat(path) - if err != nil { - return 0, err - } - - // Check if the source is a directory. - if fi.IsDir() { - return ClientModeDir, nil - } - - return ClientModeFile, nil -} diff --git a/vendor/github.com/hashicorp/go-getter/get_file_test.go b/vendor/github.com/hashicorp/go-getter/get_file_test.go deleted file mode 100644 index c16e484..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_file_test.go +++ /dev/null @@ -1,202 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "testing" -) - -func TestFileGetter_impl(t *testing.T) { - var _ Getter = new(FileGetter) -} - -func TestFileGetter(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink == 0 { - t.Fatal("destination is not a symlink") - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestFileGetter_sourceFile(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a source URL that is a path to a file - u := testModuleURL("basic") - u.Path += "/main.tf" - if err := g.Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_sourceNoExist(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a source URL that doesn't exist - u := testModuleURL("basic") - u.Path += "/main" - if err := g.Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_dir(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - if err := os.MkdirAll(dst, 0755); err != nil { - t.Fatalf("err: %s", err) - } - - // With a dir that exists that isn't a symlink - if err := g.Get(dst, testModuleURL("basic")); err == nil { - t.Fatal("should error") - } -} - -func TestFileGetter_dirSymlink(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - dst2 := tempDir(t) - - // Make parents - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - t.Fatalf("err: %s", err) - } - if err := os.MkdirAll(dst2, 0755); err != nil { - t.Fatalf("err: %s", err) - } - - // Make a symlink - if err := os.Symlink(dst2, dst); err != nil { - t.Fatalf("err: %s", err) - } - - // With a dir that exists that isn't a symlink - if err := g.Get(dst, testModuleURL("basic")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestFileGetter_GetFile(t *testing.T) { - g := new(FileGetter) - dst := tempFile(t) - - // With a dir that doesn't exist - if err := g.GetFile(dst, testModuleURL("basic-file/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink == 0 { - t.Fatal("destination is not a symlink") - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestFileGetter_GetFile_Copy(t *testing.T) { - g := new(FileGetter) - g.Copy = true - - dst := tempFile(t) - - // With a dir that doesn't exist - if err := g.GetFile(dst, testModuleURL("basic-file/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the destination folder is a symlink - fi, err := os.Lstat(dst) - if err != nil { - t.Fatalf("err: %s", err) - } - if fi.Mode()&os.ModeSymlink != 0 { - t.Fatal("destination is a symlink") - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -// https://github.com/hashicorp/terraform/issues/8418 -func TestFileGetter_percent2F(t *testing.T) { - g := new(FileGetter) - dst := tempDir(t) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic%2Ftest")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestFileGetter_ClientMode_notexist(t *testing.T) { - g := new(FileGetter) - - u := testURL("nonexistent") - if _, err := g.ClientMode(u); err == nil { - t.Fatal("expect source file error") - } -} - -func TestFileGetter_ClientMode_file(t *testing.T) { - g := new(FileGetter) - - // Check the client mode when pointed at a file. - mode, err := g.ClientMode(testModuleURL("basic-file/foo.txt")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeFile { - t.Fatal("expect ClientModeFile") - } -} - -func TestFileGetter_ClientMode_dir(t *testing.T) { - g := new(FileGetter) - - // Check the client mode when pointed at a directory. - mode, err := g.ClientMode(testModuleURL("basic")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeDir { - t.Fatal("expect ClientModeDir") - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get_file_unix.go b/vendor/github.com/hashicorp/go-getter/get_file_unix.go deleted file mode 100644 index c89a2d5..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_file_unix.go +++ /dev/null @@ -1,103 +0,0 @@ -// +build !windows - -package getter - -import ( - "fmt" - "io" - "net/url" - "os" - "path/filepath" -) - -func (g *FileGetter) Get(dst string, u *url.URL) error { - path := u.Path - if u.RawPath != "" { - path = u.RawPath - } - - // The source path must exist and be a directory to be usable. - if fi, err := os.Stat(path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if !fi.IsDir() { - return fmt.Errorf("source path must be a directory") - } - - fi, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - mode := fi.Mode() - if mode&os.ModeSymlink == 0 { - return fmt.Errorf("destination exists and is not a symlink") - } - - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - return os.Symlink(path, dst) -} - -func (g *FileGetter) GetFile(dst string, u *url.URL) error { - path := u.Path - if u.RawPath != "" { - path = u.RawPath - } - - // The source path must exist and be a file to be usable. - if fi, err := os.Stat(path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if fi.IsDir() { - return fmt.Errorf("source path must be a file") - } - - _, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // If we're not copying, just symlink and we're done - if !g.Copy { - return os.Symlink(path, dst) - } - - // Copy - srcF, err := os.Open(path) - if err != nil { - return err - } - defer srcF.Close() - - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, srcF) - return err -} diff --git a/vendor/github.com/hashicorp/go-getter/get_file_windows.go b/vendor/github.com/hashicorp/go-getter/get_file_windows.go deleted file mode 100644 index f87ed0a..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_file_windows.go +++ /dev/null @@ -1,120 +0,0 @@ -// +build windows - -package getter - -import ( - "fmt" - "io" - "net/url" - "os" - "os/exec" - "path/filepath" - "strings" -) - -func (g *FileGetter) Get(dst string, u *url.URL) error { - path := u.Path - if u.RawPath != "" { - path = u.RawPath - } - - // The source path must exist and be a directory to be usable. - if fi, err := os.Stat(path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if !fi.IsDir() { - return fmt.Errorf("source path must be a directory") - } - - fi, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - mode := fi.Mode() - if mode&os.ModeSymlink == 0 { - return fmt.Errorf("destination exists and is not a symlink") - } - - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - sourcePath := toBackslash(path) - - // Use mklink to create a junction point - output, err := exec.Command("cmd", "/c", "mklink", "/J", dst, sourcePath).CombinedOutput() - if err != nil { - return fmt.Errorf("failed to run mklink %v %v: %v %q", dst, sourcePath, err, output) - } - - return nil -} - -func (g *FileGetter) GetFile(dst string, u *url.URL) error { - path := u.Path - if u.RawPath != "" { - path = u.RawPath - } - - // The source path must exist and be a directory to be usable. - if fi, err := os.Stat(path); err != nil { - return fmt.Errorf("source path error: %s", err) - } else if fi.IsDir() { - return fmt.Errorf("source path must be a file") - } - - _, err := os.Lstat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - // If the destination already exists, it must be a symlink - if err == nil { - // Remove the destination - if err := os.Remove(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - // If we're not copying, just symlink and we're done - if !g.Copy { - return os.Symlink(path, dst) - } - - // Copy - srcF, err := os.Open(path) - if err != nil { - return err - } - defer srcF.Close() - - dstF, err := os.Create(dst) - if err != nil { - return err - } - defer dstF.Close() - - _, err = io.Copy(dstF, srcF) - return err -} - -// toBackslash returns the result of replacing each slash character -// in path with a backslash ('\') character. Multiple separators are -// replaced by multiple backslashes. -func toBackslash(path string) string { - return strings.Replace(path, "/", "\\", -1) -} diff --git a/vendor/github.com/hashicorp/go-getter/get_git.go b/vendor/github.com/hashicorp/go-getter/get_git.go deleted file mode 100644 index 6f5d914..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_git.go +++ /dev/null @@ -1,242 +0,0 @@ -package getter - -import ( - "encoding/base64" - "fmt" - "io/ioutil" - "net/url" - "os" - "os/exec" - "path/filepath" - "strings" - - urlhelper "github.com/hashicorp/go-getter/helper/url" - "github.com/hashicorp/go-version" -) - -// GitGetter is a Getter implementation that will download a module from -// a git repository. -type GitGetter struct{} - -func (g *GitGetter) ClientMode(_ *url.URL) (ClientMode, error) { - return ClientModeDir, nil -} - -func (g *GitGetter) Get(dst string, u *url.URL) error { - if _, err := exec.LookPath("git"); err != nil { - return fmt.Errorf("git must be available and on the PATH") - } - - // Extract some query parameters we use - var ref, sshKey string - q := u.Query() - if len(q) > 0 { - ref = q.Get("ref") - q.Del("ref") - - sshKey = q.Get("sshkey") - q.Del("sshkey") - - // Copy the URL - var newU url.URL = *u - u = &newU - u.RawQuery = q.Encode() - } - - var sshKeyFile string - if sshKey != "" { - // Check that the git version is sufficiently new. - if err := checkGitVersion("2.3"); err != nil { - return fmt.Errorf("Error using ssh key: %v", err) - } - - // We have an SSH key - decode it. - raw, err := base64.StdEncoding.DecodeString(sshKey) - if err != nil { - return err - } - - // Create a temp file for the key and ensure it is removed. - fh, err := ioutil.TempFile("", "go-getter") - if err != nil { - return err - } - sshKeyFile = fh.Name() - defer os.Remove(sshKeyFile) - - // Set the permissions prior to writing the key material. - if err := os.Chmod(sshKeyFile, 0600); err != nil { - return err - } - - // Write the raw key into the temp file. - _, err = fh.Write(raw) - fh.Close() - if err != nil { - return err - } - } - - // Clone or update the repository - _, err := os.Stat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - if err == nil { - err = g.update(dst, sshKeyFile, ref) - } else { - err = g.clone(dst, sshKeyFile, u) - } - if err != nil { - return err - } - - // Next: check out the proper tag/branch if it is specified, and checkout - if ref != "" { - if err := g.checkout(dst, ref); err != nil { - return err - } - } - - // Lastly, download any/all submodules. - return g.fetchSubmodules(dst, sshKeyFile) -} - -// GetFile for Git doesn't support updating at this time. It will download -// the file every time. -func (g *GitGetter) GetFile(dst string, u *url.URL) error { - td, err := ioutil.TempDir("", "getter-git") - if err != nil { - return err - } - if err := os.RemoveAll(td); err != nil { - return err - } - - // Get the filename, and strip the filename from the URL so we can - // just get the repository directly. - filename := filepath.Base(u.Path) - u.Path = filepath.Dir(u.Path) - - // Get the full repository - if err := g.Get(td, u); err != nil { - return err - } - - // Copy the single file - u, err = urlhelper.Parse(fmtFileURL(filepath.Join(td, filename))) - if err != nil { - return err - } - - fg := &FileGetter{Copy: true} - return fg.GetFile(dst, u) -} - -func (g *GitGetter) checkout(dst string, ref string) error { - cmd := exec.Command("git", "checkout", ref) - cmd.Dir = dst - return getRunCommand(cmd) -} - -func (g *GitGetter) clone(dst, sshKeyFile string, u *url.URL) error { - cmd := exec.Command("git", "clone", u.String(), dst) - setupGitEnv(cmd, sshKeyFile) - return getRunCommand(cmd) -} - -func (g *GitGetter) update(dst, sshKeyFile, ref string) error { - // Determine if we're a branch. If we're NOT a branch, then we just - // switch to master prior to checking out - cmd := exec.Command("git", "show-ref", "-q", "--verify", "refs/heads/"+ref) - cmd.Dir = dst - - if getRunCommand(cmd) != nil { - // Not a branch, switch to master. This will also catch non-existent - // branches, in which case we want to switch to master and then - // checkout the proper branch later. - ref = "master" - } - - // We have to be on a branch to pull - if err := g.checkout(dst, ref); err != nil { - return err - } - - cmd = exec.Command("git", "pull", "--ff-only") - cmd.Dir = dst - setupGitEnv(cmd, sshKeyFile) - return getRunCommand(cmd) -} - -// fetchSubmodules downloads any configured submodules recursively. -func (g *GitGetter) fetchSubmodules(dst, sshKeyFile string) error { - cmd := exec.Command("git", "submodule", "update", "--init", "--recursive") - cmd.Dir = dst - setupGitEnv(cmd, sshKeyFile) - return getRunCommand(cmd) -} - -// setupGitEnv sets up the environment for the given command. This is used to -// pass configuration data to git and ssh and enables advanced cloning methods. -func setupGitEnv(cmd *exec.Cmd, sshKeyFile string) { - const gitSSHCommand = "GIT_SSH_COMMAND=" - var sshCmd []string - - // If we have an existing GIT_SSH_COMMAND, we need to append our options. - // We will also remove our old entry to make sure the behavior is the same - // with versions of Go < 1.9. - env := os.Environ() - for i, v := range env { - if strings.HasPrefix(v, gitSSHCommand) { - sshCmd = []string{v} - - env[i], env[len(env)-1] = env[len(env)-1], env[i] - env = env[:len(env)-1] - break - } - } - - if len(sshCmd) == 0 { - sshCmd = []string{gitSSHCommand + "ssh"} - } - - if sshKeyFile != "" { - // We have an SSH key temp file configured, tell ssh about this. - sshCmd = append(sshCmd, "-i", sshKeyFile) - } - - env = append(env, strings.Join(sshCmd, " ")) - cmd.Env = env -} - -// checkGitVersion is used to check the version of git installed on the system -// against a known minimum version. Returns an error if the installed version -// is older than the given minimum. -func checkGitVersion(min string) error { - want, err := version.NewVersion(min) - if err != nil { - return err - } - - out, err := exec.Command("git", "version").Output() - if err != nil { - return err - } - - fields := strings.Fields(string(out)) - if len(fields) != 3 { - return fmt.Errorf("Unexpected 'git version' output: %q", string(out)) - } - - have, err := version.NewVersion(fields[2]) - if err != nil { - return err - } - - if have.LessThan(want) { - return fmt.Errorf("Required git version = %s, have %s", want, have) - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-getter/get_git_test.go b/vendor/github.com/hashicorp/go-getter/get_git_test.go deleted file mode 100644 index 1d2b9f0..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_git_test.go +++ /dev/null @@ -1,423 +0,0 @@ -package getter - -import ( - "encoding/base64" - "io/ioutil" - "net/url" - "os" - "os/exec" - "path/filepath" - "runtime" - "strings" - "testing" -) - -var testHasGit bool - -func init() { - if _, err := exec.LookPath("git"); err == nil { - testHasGit = true - } -} - -func TestGitGetter_impl(t *testing.T) { - var _ Getter = new(GitGetter) -} - -func TestGitGetter(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - repo := testGitRepo(t, "basic") - repo.commitFile("foo.txt", "hello") - - // With a dir that doesn't exist - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "foo.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_branch(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - repo := testGitRepo(t, "branch") - repo.git("checkout", "-b", "test-branch") - repo.commitFile("branch.txt", "branch") - - q := repo.url.Query() - q.Add("ref", "test-branch") - repo.url.RawQuery = q.Encode() - - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "branch.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "branch.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_branchUpdate(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // First setup the state with a fresh branch - repo := testGitRepo(t, "branch-update") - repo.git("checkout", "-b", "test-branch") - repo.commitFile("branch.txt", "branch") - - // Get the "test-branch" branch - q := repo.url.Query() - q.Add("ref", "test-branch") - repo.url.RawQuery = q.Encode() - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "branch.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Commit an update to the branch - repo.commitFile("branch-update.txt", "branch-update") - - // Get again should work - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "branch-update.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_tag(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - repo := testGitRepo(t, "tag") - repo.commitFile("tag.txt", "tag") - repo.git("tag", "v1.0") - - q := repo.url.Query() - q.Add("ref", "v1.0") - repo.url.RawQuery = q.Encode() - - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "tag.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "tag.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_GetFile(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempFile(t) - - repo := testGitRepo(t, "file") - repo.commitFile("file.txt", "hello") - - // Download the file - repo.url.Path = filepath.Join(repo.url.Path, "file.txt") - if err := g.GetFile(dst, repo.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "hello") -} - -func TestGitGetter_gitVersion(t *testing.T) { - dir, err := ioutil.TempDir("", "go-getter") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(dir) - - script := filepath.Join(dir, "git") - err = ioutil.WriteFile( - script, - []byte("#!/bin/sh\necho git version 2.0\n"), - 0700) - if err != nil { - t.Fatal(err) - } - - defer func(v string) { - os.Setenv("PATH", v) - }(os.Getenv("PATH")) - - os.Setenv("PATH", dir) - - // Asking for a higher version throws an error - if err := checkGitVersion("2.3"); err == nil { - t.Fatal("expect git version error") - } - - // Passes when version is satisfied - if err := checkGitVersion("1.9"); err != nil { - t.Fatal(err) - } -} - -func TestGitGetter_sshKey(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - encodedKey := base64.StdEncoding.EncodeToString([]byte(testGitToken)) - - u, err := url.Parse("ssh://git@github.com/hashicorp/test-private-repo" + - "?sshkey=" + encodedKey) - if err != nil { - t.Fatal(err) - } - - if err := g.Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - readmePath := filepath.Join(dst, "README.md") - if _, err := os.Stat(readmePath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGitGetter_submodule(t *testing.T) { - if !testHasGit { - t.Log("git not found, skipping") - t.Skip() - } - - g := new(GitGetter) - dst := tempDir(t) - - // Set up the grandchild - gc := testGitRepo(t, "grandchild") - gc.commitFile("grandchild.txt", "grandchild") - - // Set up the child - c := testGitRepo(t, "child") - c.commitFile("child.txt", "child") - c.git("submodule", "add", gc.dir) - c.git("commit", "-m", "Add grandchild submodule") - - // Set up the parent - p := testGitRepo(t, "parent") - p.commitFile("parent.txt", "parent") - p.git("submodule", "add", c.dir) - p.git("commit", "-m", "Add child submodule") - - // Clone the root repository - if err := g.Get(dst, p.url); err != nil { - t.Fatalf("err: %s", err) - } - - // Check that the files exist - for _, path := range []string{ - filepath.Join(dst, "parent.txt"), - filepath.Join(dst, "child", "child.txt"), - filepath.Join(dst, "child", "grandchild", "grandchild.txt"), - } { - if _, err := os.Stat(path); err != nil { - t.Fatalf("err: %s", err) - } - } -} - -func TestGitGetter_setupGitEnv_sshKey(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skipf("skipping on windows since the test requires sh") - return - } - - cmd := exec.Command("/bin/sh", "-c", "echo $GIT_SSH_COMMAND") - setupGitEnv(cmd, "/tmp/foo.pem") - out, err := cmd.Output() - if err != nil { - t.Fatal(err) - } - - actual := strings.TrimSpace(string(out)) - if actual != "ssh -i /tmp/foo.pem" { - t.Fatalf("unexpected GIT_SSH_COMMAND: %q", actual) - } -} - -func TestGitGetter_setupGitEnvWithExisting_sshKey(t *testing.T) { - if runtime.GOOS == "windows" { - t.Skipf("skipping on windows since the test requires sh") - return - } - - // start with an existing ssh command configuration - os.Setenv("GIT_SSH_COMMAND", "ssh -o StrictHostKeyChecking=no") - defer os.Setenv("GIT_SSH_COMMAND", "") - - cmd := exec.Command("/bin/sh", "-c", "echo $GIT_SSH_COMMAND") - setupGitEnv(cmd, "/tmp/foo.pem") - out, err := cmd.Output() - if err != nil { - t.Fatal(err) - } - - actual := strings.TrimSpace(string(out)) - if actual != "ssh -o StrictHostKeyChecking=no -i /tmp/foo.pem" { - t.Fatalf("unexpected GIT_SSH_COMMAND: %q", actual) - } -} - -// gitRepo is a helper struct which controls a single temp git repo. -type gitRepo struct { - t *testing.T - url *url.URL - dir string -} - -// testGitRepo creates a new test git repository. -func testGitRepo(t *testing.T, name string) *gitRepo { - dir, err := ioutil.TempDir("", "go-getter") - if err != nil { - t.Fatal(err) - } - dir = filepath.Join(dir, name) - if err := os.Mkdir(dir, 0700); err != nil { - t.Fatal(err) - } - - r := &gitRepo{ - t: t, - dir: dir, - } - - url, err := url.Parse("file://" + r.dir) - if err != nil { - t.Fatal(err) - } - r.url = url - - r.git("init") - r.git("config", "user.name", "go-getter") - r.git("config", "user.email", "go-getter@hashicorp.com") - - return r -} - -// git runs a git command against the repo. -func (r *gitRepo) git(args ...string) { - cmd := exec.Command("git", args...) - cmd.Dir = r.dir - if err := cmd.Run(); err != nil { - r.t.Fatal(err) - } -} - -// commitFile writes and commits a text file to the repo. -func (r *gitRepo) commitFile(file, content string) { - path := filepath.Join(r.dir, file) - if err := ioutil.WriteFile(path, []byte(content), 0600); err != nil { - r.t.Fatal(err) - } - r.git("add", file) - r.git("commit", "-m", "Adding "+file) -} - -// This is a read-only deploy key for an empty test repository. -var testGitToken = `-----BEGIN RSA PRIVATE KEY----- -MIIEpgIBAAKCAQEArGJ7eweUMiT58m424ZHLu6UordeoTcOTPEMeOjIL2GuVhPU+ -Y6sdW3gMKEYFKo5ywXxVgNo8VCI8Ny8+PPfR+BNJaAI+VYNDU5rvD3ecfIjH3We4 -VyRbT/PcxNK1XJcE260P6nVXrnNLJQBbsP6tjqSswwVy/9gCiI0aa4GxvK4R1ZPJ -H6ONYXzwgYR0QAH6jhyENe5skbH+40fT2u/I3z99HggqKOCJpgq9JkAWdXdqJPO7 -kcGP6I6lTE1Cjpi7GEuVx6iWeflmX3uveOLTJohVkhAzGxIk5rIgbqkDoiNJ1RFl -MxFCc/LkmqdYiW6DgrWZJhlY9wB+YFWi3O/2BwIDAQABAoIBAQCE9LROcMsBXfmV -3SHhGqUrRjg41NOPnt+JpC7FLeJq+pdo5ApJrynGabHewhqr9xBVYUNFTY0oSvts -iLiVJ4K/tohwewJ+y+36ps3pfRSqDIkyoBPSykzPPsQw3l9ZWXU6xaE38Wc+Othj -YoJV4igUk7hX9nT7FSznCwWsk2x1m/w40PVDeWp0VOqGz407oPpirL8wS6yxwrcL -IR/XtEXOiOoJmHMdxlNwVOTdMz5mtCGJcl2IqjLZLP0az0SxAkTLrDeR+R9tTY/T -cbdZS3aBVi/9pXQ9yG+QcVrV1PKGdSzOoS1QB0746n9qW4pM93PoRkeENBAM44Gx -zJvanaqRAoGBANU7HbhkUzBiotEhFlf4uQ3cKFzlSMoJAX27OKR8MDD2vLEL0lBv -biYBntMBU/L3A7nr/oVHJRS3dGVEoJdmvoXB+eCpNhyYiZKDXrPfaY3ifRKvcIoq -XuWYkIGB0X1Djf7Sj6ruSxcm8y6M4l2kQq7bo7HXHvJuPRuG930OzAopAoGBAM72 -A0+3xTQrzbHcffPJPw8GUvk8tVmypHojQyXdX283GDW7LYvHd+x6rCNDIdXiZ25L -M3YKEcZMPpjnjEH5CRUHyubocelyRiz7P2Hwj3MOSO5g11nLbSlkLYvoG4uuH8ck -2trIRJ81OnVwwIj61CNMCG3CyYk6GN5ShDCJNWSvAoGBAKScyKrrOJWn8A4GvxsW -9rXOepKMp47hOPd5q5bAEOwb7zu25pwWCjDpG1XGNqrhK01C9PCrJeNCZWcwfdGk -Df1w7JkVyKJ21+314Qx3syNH8EqWigkAANa62wQ/1hwgJOTOZP8Oi4XKGf6b4L1t -69TV1x+Z9Vgu5pnzregrnjVRAoGBAIm1KhjmB4KiTti1BN2sn5fItnb+jRClDEn0 -op5UQUcIGsTNyg2C6Onh6h4AckgVwIqj4Rb+tjsCyngFQc83/HIQ4FJqgjk5/zW4 -68CoR1rgO2jZ6RDnibgL3z6Db6iucJiajkEbFoX07fPs1T+P3o2p7sXR4TW9AYUU -1L5S3cMjAoGBAKd+zv8xjwN9bw9wGz3l/5lWni6muXpmJ7a43Hj562jspb+moMqM -thGypwYJHZX05VkSk8iXvZehE+Czj6xu9P5FtxKCWgMT6hc8qvCq4n41Ndx59zkN -yuFmGAiAN8bAZgSQYyIUnWENsqFJNkj/HHR4MA/O2gY1zPq/PFCvQ9Q4 ------END RSA PRIVATE KEY-----` diff --git a/vendor/github.com/hashicorp/go-getter/get_hg.go b/vendor/github.com/hashicorp/go-getter/get_hg.go deleted file mode 100644 index 820bdd4..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_hg.go +++ /dev/null @@ -1,131 +0,0 @@ -package getter - -import ( - "fmt" - "io/ioutil" - "net/url" - "os" - "os/exec" - "path/filepath" - "runtime" - - urlhelper "github.com/hashicorp/go-getter/helper/url" -) - -// HgGetter is a Getter implementation that will download a module from -// a Mercurial repository. -type HgGetter struct{} - -func (g *HgGetter) ClientMode(_ *url.URL) (ClientMode, error) { - return ClientModeDir, nil -} - -func (g *HgGetter) Get(dst string, u *url.URL) error { - if _, err := exec.LookPath("hg"); err != nil { - return fmt.Errorf("hg must be available and on the PATH") - } - - newURL, err := urlhelper.Parse(u.String()) - if err != nil { - return err - } - if fixWindowsDrivePath(newURL) { - // See valid file path form on http://www.selenic.com/hg/help/urls - newURL.Path = fmt.Sprintf("/%s", newURL.Path) - } - - // Extract some query parameters we use - var rev string - q := newURL.Query() - if len(q) > 0 { - rev = q.Get("rev") - q.Del("rev") - - newURL.RawQuery = q.Encode() - } - - _, err = os.Stat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - if err != nil { - if err := g.clone(dst, newURL); err != nil { - return err - } - } - - if err := g.pull(dst, newURL); err != nil { - return err - } - - return g.update(dst, newURL, rev) -} - -// GetFile for Hg doesn't support updating at this time. It will download -// the file every time. -func (g *HgGetter) GetFile(dst string, u *url.URL) error { - td, err := ioutil.TempDir("", "getter-hg") - if err != nil { - return err - } - if err := os.RemoveAll(td); err != nil { - return err - } - - // Get the filename, and strip the filename from the URL so we can - // just get the repository directly. - filename := filepath.Base(u.Path) - u.Path = filepath.ToSlash(filepath.Dir(u.Path)) - - // If we're on Windows, we need to set the host to "localhost" for hg - if runtime.GOOS == "windows" { - u.Host = "localhost" - } - - // Get the full repository - if err := g.Get(td, u); err != nil { - return err - } - - // Copy the single file - u, err = urlhelper.Parse(fmtFileURL(filepath.Join(td, filename))) - if err != nil { - return err - } - - fg := &FileGetter{Copy: true} - return fg.GetFile(dst, u) -} - -func (g *HgGetter) clone(dst string, u *url.URL) error { - cmd := exec.Command("hg", "clone", "-U", u.String(), dst) - return getRunCommand(cmd) -} - -func (g *HgGetter) pull(dst string, u *url.URL) error { - cmd := exec.Command("hg", "pull") - cmd.Dir = dst - return getRunCommand(cmd) -} - -func (g *HgGetter) update(dst string, u *url.URL, rev string) error { - args := []string{"update"} - if rev != "" { - args = append(args, rev) - } - - cmd := exec.Command("hg", args...) - cmd.Dir = dst - return getRunCommand(cmd) -} - -func fixWindowsDrivePath(u *url.URL) bool { - // hg assumes a file:/// prefix for Windows drive letter file paths. - // (e.g. file:///c:/foo/bar) - // If the URL Path does not begin with a '/' character, the resulting URL - // path will have a file:// prefix. (e.g. file://c:/foo/bar) - // See http://www.selenic.com/hg/help/urls and the examples listed in - // http://selenic.com/repo/hg-stable/file/1265a3a71d75/mercurial/util.py#l1936 - return runtime.GOOS == "windows" && u.Scheme == "file" && - len(u.Path) > 1 && u.Path[0] != '/' && u.Path[1] == ':' -} diff --git a/vendor/github.com/hashicorp/go-getter/get_hg_test.go b/vendor/github.com/hashicorp/go-getter/get_hg_test.go deleted file mode 100644 index 9a5ce5d..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_hg_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package getter - -import ( - "os" - "os/exec" - "path/filepath" - "testing" -) - -var testHasHg bool - -func init() { - if _, err := exec.LookPath("hg"); err == nil { - testHasHg = true - } -} - -func TestHgGetter_impl(t *testing.T) { - var _ Getter = new(HgGetter) -} - -func TestHgGetter(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempDir(t) - - // With a dir that doesn't exist - if err := g.Get(dst, testModuleURL("basic-hg")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHgGetter_branch(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempDir(t) - - url := testModuleURL("basic-hg") - q := url.Query() - q.Add("rev", "test-branch") - url.RawQuery = q.Encode() - - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - - // Get again should work - if err := g.Get(dst, url); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath = filepath.Join(dst, "main_branch.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHgGetter_GetFile(t *testing.T) { - if !testHasHg { - t.Log("hg not found, skipping") - t.Skip() - } - - g := new(HgGetter) - dst := tempFile(t) - - // Download - if err := g.GetFile(dst, testModuleURL("basic-hg/foo.txt")); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "Hello\n") -} diff --git a/vendor/github.com/hashicorp/go-getter/get_http.go b/vendor/github.com/hashicorp/go-getter/get_http.go deleted file mode 100644 index 9acc72c..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_http.go +++ /dev/null @@ -1,247 +0,0 @@ -package getter - -import ( - "encoding/xml" - "fmt" - "io" - "io/ioutil" - "net/http" - "net/url" - "os" - "path/filepath" - "strings" -) - -// HttpGetter is a Getter implementation that will download from an HTTP -// endpoint. -// -// For file downloads, HTTP is used directly. -// -// The protocol for downloading a directory from an HTTP endpoing is as follows: -// -// An HTTP GET request is made to the URL with the additional GET parameter -// "terraform-get=1". This lets you handle that scenario specially if you -// wish. The response must be a 2xx. -// -// First, a header is looked for "X-Terraform-Get" which should contain -// a source URL to download. -// -// If the header is not present, then a meta tag is searched for named -// "terraform-get" and the content should be a source URL. -// -// The source URL, whether from the header or meta tag, must be a fully -// formed URL. The shorthand syntax of "github.com/foo/bar" or relative -// paths are not allowed. -type HttpGetter struct { - // Netrc, if true, will lookup and use auth information found - // in the user's netrc file if available. - Netrc bool - - // Client is the http.Client to use for Get requests. - // This defaults to a cleanhttp.DefaultClient if left unset. - Client *http.Client -} - -func (g *HttpGetter) ClientMode(u *url.URL) (ClientMode, error) { - if strings.HasSuffix(u.Path, "/") { - return ClientModeDir, nil - } - return ClientModeFile, nil -} - -func (g *HttpGetter) Get(dst string, u *url.URL) error { - // Copy the URL so we can modify it - var newU url.URL = *u - u = &newU - - if g.Netrc { - // Add auth from netrc if we can - if err := addAuthFromNetrc(u); err != nil { - return err - } - } - - if g.Client == nil { - g.Client = httpClient - } - - // Add terraform-get to the parameter. - q := u.Query() - q.Add("terraform-get", "1") - u.RawQuery = q.Encode() - - // Get the URL - resp, err := g.Client.Get(u.String()) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode < 200 || resp.StatusCode >= 300 { - return fmt.Errorf("bad response code: %d", resp.StatusCode) - } - - // Extract the source URL - var source string - if v := resp.Header.Get("X-Terraform-Get"); v != "" { - source = v - } else { - source, err = g.parseMeta(resp.Body) - if err != nil { - return err - } - } - if source == "" { - return fmt.Errorf("no source URL was returned") - } - - // If there is a subdir component, then we download the root separately - // into a temporary directory, then copy over the proper subdir. - source, subDir := SourceDirSubdir(source) - if subDir == "" { - return Get(dst, source) - } - - // We have a subdir, time to jump some hoops - return g.getSubdir(dst, source, subDir) -} - -func (g *HttpGetter) GetFile(dst string, u *url.URL) error { - if g.Netrc { - // Add auth from netrc if we can - if err := addAuthFromNetrc(u); err != nil { - return err - } - } - - if g.Client == nil { - g.Client = httpClient - } - - resp, err := g.Client.Get(u.String()) - if err != nil { - return err - } - defer resp.Body.Close() - if resp.StatusCode != 200 { - return fmt.Errorf("bad response code: %d", resp.StatusCode) - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - f, err := os.Create(dst) - if err != nil { - return err - } - defer f.Close() - - _, err = io.Copy(f, resp.Body) - return err -} - -// getSubdir downloads the source into the destination, but with -// the proper subdir. -func (g *HttpGetter) getSubdir(dst, source, subDir string) error { - // Create a temporary directory to store the full source - td, err := ioutil.TempDir("", "tf") - if err != nil { - return err - } - defer os.RemoveAll(td) - - // We have to create a subdirectory that doesn't exist for the file - // getter to work. - td = filepath.Join(td, "data") - - // Download that into the given directory - if err := Get(td, source); err != nil { - return err - } - - // Process any globbing - sourcePath, err := SubdirGlob(td, subDir) - if err != nil { - return err - } - - // Make sure the subdir path actually exists - if _, err := os.Stat(sourcePath); err != nil { - return fmt.Errorf( - "Error downloading %s: %s", source, err) - } - - // Copy the subdirectory into our actual destination. - if err := os.RemoveAll(dst); err != nil { - return err - } - - // Make the final destination - if err := os.MkdirAll(dst, 0755); err != nil { - return err - } - - return copyDir(dst, sourcePath, false) -} - -// parseMeta looks for the first meta tag in the given reader that -// will give us the source URL. -func (g *HttpGetter) parseMeta(r io.Reader) (string, error) { - d := xml.NewDecoder(r) - d.CharsetReader = charsetReader - d.Strict = false - var err error - var t xml.Token - for { - t, err = d.Token() - if err != nil { - if err == io.EOF { - err = nil - } - return "", err - } - if e, ok := t.(xml.StartElement); ok && strings.EqualFold(e.Name.Local, "body") { - return "", nil - } - if e, ok := t.(xml.EndElement); ok && strings.EqualFold(e.Name.Local, "head") { - return "", nil - } - e, ok := t.(xml.StartElement) - if !ok || !strings.EqualFold(e.Name.Local, "meta") { - continue - } - if attrValue(e.Attr, "name") != "terraform-get" { - continue - } - if f := attrValue(e.Attr, "content"); f != "" { - return f, nil - } - } -} - -// attrValue returns the attribute value for the case-insensitive key -// `name', or the empty string if nothing is found. -func attrValue(attrs []xml.Attr, name string) string { - for _, a := range attrs { - if strings.EqualFold(a.Name.Local, name) { - return a.Value - } - } - return "" -} - -// charsetReader returns a reader for the given charset. Currently -// it only supports UTF-8 and ASCII. Otherwise, it returns a meaningful -// error which is printed by go get, so the user can find why the package -// wasn't downloaded if the encoding is not supported. Note that, in -// order to reduce potential errors, ASCII is treated as UTF-8 (i.e. characters -// greater than 0x7f are not rejected). -func charsetReader(charset string, input io.Reader) (io.Reader, error) { - switch strings.ToLower(charset) { - case "ascii": - return input, nil - default: - return nil, fmt.Errorf("can't decode XML document using charset %q", charset) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get_http_test.go b/vendor/github.com/hashicorp/go-getter/get_http_test.go deleted file mode 100644 index fea3440..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_http_test.go +++ /dev/null @@ -1,322 +0,0 @@ -package getter - -import ( - "errors" - "fmt" - "net" - "net/http" - "net/url" - "os" - "path/filepath" - "testing" -) - -func TestHttpGetter_impl(t *testing.T) { - var _ Getter = new(HttpGetter) -} - -func TestHttpGetter_header(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/header" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_meta(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_metaSubdir(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta-subdir" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_metaSubdirGlob(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta-subdir-glob" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_none(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/none" - - // Get it! - if err := g.Get(dst, &u); err == nil { - t.Fatal("should error") - } -} - -func TestHttpGetter_file(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempFile(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/file" - - // Get it! - if err := g.GetFile(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "Hello\n") -} - -func TestHttpGetter_auth(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta-auth" - u.User = url.UserPassword("foo", "bar") - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestHttpGetter_authNetrc(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/meta" - - // Write the netrc file - path, closer := tempFileContents(t, fmt.Sprintf(testHttpNetrc, ln.Addr().String())) - defer closer() - defer tempEnv(t, "NETRC", path)() - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -// test round tripper that only returns an error -type errRoundTripper struct{} - -func (errRoundTripper) RoundTrip(r *http.Request) (*http.Response, error) { - return nil, errors.New("test round tripper") -} - -// verify that the default httpClient no longer comes from http.DefaultClient -func TestHttpGetter_cleanhttp(t *testing.T) { - ln := testHttpServer(t) - defer ln.Close() - - // break the default http client - http.DefaultClient.Transport = errRoundTripper{} - defer func() { - http.DefaultClient.Transport = http.DefaultTransport - }() - - g := new(HttpGetter) - dst := tempDir(t) - - var u url.URL - u.Scheme = "http" - u.Host = ln.Addr().String() - u.Path = "/header" - - // Get it! - if err := g.Get(dst, &u); err != nil { - t.Fatalf("err: %s", err) - } -} - -func testHttpServer(t *testing.T) net.Listener { - ln, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - mux := http.NewServeMux() - mux.HandleFunc("/file", testHttpHandlerFile) - mux.HandleFunc("/header", testHttpHandlerHeader) - mux.HandleFunc("/meta", testHttpHandlerMeta) - mux.HandleFunc("/meta-auth", testHttpHandlerMetaAuth) - mux.HandleFunc("/meta-subdir", testHttpHandlerMetaSubdir) - mux.HandleFunc("/meta-subdir-glob", testHttpHandlerMetaSubdirGlob) - - var server http.Server - server.Handler = mux - go server.Serve(ln) - - return ln -} - -func testHttpHandlerFile(w http.ResponseWriter, r *http.Request) { - w.Write([]byte("Hello\n")) -} - -func testHttpHandlerHeader(w http.ResponseWriter, r *http.Request) { - w.Header().Add("X-Terraform-Get", testModuleURL("basic").String()) - w.WriteHeader(200) -} - -func testHttpHandlerMeta(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic").String()))) -} - -func testHttpHandlerMetaAuth(w http.ResponseWriter, r *http.Request) { - user, pass, ok := r.BasicAuth() - if !ok { - w.WriteHeader(401) - return - } - - if user != "foo" || pass != "bar" { - w.WriteHeader(401) - return - } - - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic").String()))) -} - -func testHttpHandlerMetaSubdir(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic//subdir").String()))) -} - -func testHttpHandlerMetaSubdirGlob(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(fmt.Sprintf(testHttpMetaStr, testModuleURL("basic//sub*").String()))) -} - -func testHttpHandlerNone(w http.ResponseWriter, r *http.Request) { - w.Write([]byte(testHttpNoneStr)) -} - -const testHttpMetaStr = ` - - - - - -` - -const testHttpNoneStr = ` - - - - -` - -const testHttpNetrc = ` -machine %s -login foo -password bar -` diff --git a/vendor/github.com/hashicorp/go-getter/get_mock.go b/vendor/github.com/hashicorp/go-getter/get_mock.go deleted file mode 100644 index 882e694..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_mock.go +++ /dev/null @@ -1,52 +0,0 @@ -package getter - -import ( - "net/url" -) - -// MockGetter is an implementation of Getter that can be used for tests. -type MockGetter struct { - // Proxy, if set, will be called after recording the calls below. - // If it isn't set, then the *Err values will be returned. - Proxy Getter - - GetCalled bool - GetDst string - GetURL *url.URL - GetErr error - - GetFileCalled bool - GetFileDst string - GetFileURL *url.URL - GetFileErr error -} - -func (g *MockGetter) Get(dst string, u *url.URL) error { - g.GetCalled = true - g.GetDst = dst - g.GetURL = u - - if g.Proxy != nil { - return g.Proxy.Get(dst, u) - } - - return g.GetErr -} - -func (g *MockGetter) GetFile(dst string, u *url.URL) error { - g.GetFileCalled = true - g.GetFileDst = dst - g.GetFileURL = u - - if g.Proxy != nil { - return g.Proxy.GetFile(dst, u) - } - return g.GetFileErr -} - -func (g *MockGetter) ClientMode(u *url.URL) (ClientMode, error) { - if l := len(u.Path); l > 0 && u.Path[l-1:] == "/" { - return ClientModeDir, nil - } - return ClientModeFile, nil -} diff --git a/vendor/github.com/hashicorp/go-getter/get_s3.go b/vendor/github.com/hashicorp/go-getter/get_s3.go deleted file mode 100644 index ebb3217..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_s3.go +++ /dev/null @@ -1,270 +0,0 @@ -package getter - -import ( - "fmt" - "io" - "net/url" - "os" - "path/filepath" - "strings" - - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" - "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/s3" -) - -// S3Getter is a Getter implementation that will download a module from -// a S3 bucket. -type S3Getter struct{} - -func (g *S3Getter) ClientMode(u *url.URL) (ClientMode, error) { - // Parse URL - region, bucket, path, _, creds, err := g.parseUrl(u) - if err != nil { - return 0, err - } - - // Create client config - config := g.getAWSConfig(region, u, creds) - sess := session.New(config) - client := s3.New(sess) - - // List the object(s) at the given prefix - req := &s3.ListObjectsInput{ - Bucket: aws.String(bucket), - Prefix: aws.String(path), - } - resp, err := client.ListObjects(req) - if err != nil { - return 0, err - } - - for _, o := range resp.Contents { - // Use file mode on exact match. - if *o.Key == path { - return ClientModeFile, nil - } - - // Use dir mode if child keys are found. - if strings.HasPrefix(*o.Key, path+"/") { - return ClientModeDir, nil - } - } - - // There was no match, so just return file mode. The download is going - // to fail but we will let S3 return the proper error later. - return ClientModeFile, nil -} - -func (g *S3Getter) Get(dst string, u *url.URL) error { - // Parse URL - region, bucket, path, _, creds, err := g.parseUrl(u) - if err != nil { - return err - } - - // Remove destination if it already exists - _, err = os.Stat(dst) - if err != nil && !os.IsNotExist(err) { - return err - } - - if err == nil { - // Remove the destination - if err := os.RemoveAll(dst); err != nil { - return err - } - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - config := g.getAWSConfig(region, u, creds) - sess := session.New(config) - client := s3.New(sess) - - // List files in path, keep listing until no more objects are found - lastMarker := "" - hasMore := true - for hasMore { - req := &s3.ListObjectsInput{ - Bucket: aws.String(bucket), - Prefix: aws.String(path), - } - if lastMarker != "" { - req.Marker = aws.String(lastMarker) - } - - resp, err := client.ListObjects(req) - if err != nil { - return err - } - - hasMore = aws.BoolValue(resp.IsTruncated) - - // Get each object storing each file relative to the destination path - for _, object := range resp.Contents { - lastMarker = aws.StringValue(object.Key) - objPath := aws.StringValue(object.Key) - - // If the key ends with a backslash assume it is a directory and ignore - if strings.HasSuffix(objPath, "/") { - continue - } - - // Get the object destination path - objDst, err := filepath.Rel(path, objPath) - if err != nil { - return err - } - objDst = filepath.Join(dst, objDst) - - if err := g.getObject(client, objDst, bucket, objPath, ""); err != nil { - return err - } - } - } - - return nil -} - -func (g *S3Getter) GetFile(dst string, u *url.URL) error { - region, bucket, path, version, creds, err := g.parseUrl(u) - if err != nil { - return err - } - - config := g.getAWSConfig(region, u, creds) - sess := session.New(config) - client := s3.New(sess) - return g.getObject(client, dst, bucket, path, version) -} - -func (g *S3Getter) getObject(client *s3.S3, dst, bucket, key, version string) error { - req := &s3.GetObjectInput{ - Bucket: aws.String(bucket), - Key: aws.String(key), - } - if version != "" { - req.VersionId = aws.String(version) - } - - resp, err := client.GetObject(req) - if err != nil { - return err - } - - // Create all the parent directories - if err := os.MkdirAll(filepath.Dir(dst), 0755); err != nil { - return err - } - - f, err := os.Create(dst) - if err != nil { - return err - } - defer f.Close() - - _, err = io.Copy(f, resp.Body) - return err -} - -func (g *S3Getter) getAWSConfig(region string, url *url.URL, creds *credentials.Credentials) *aws.Config { - conf := &aws.Config{} - if creds == nil { - // Grab the metadata URL - metadataURL := os.Getenv("AWS_METADATA_URL") - if metadataURL == "" { - metadataURL = "http://169.254.169.254:80/latest" - } - - creds = credentials.NewChainCredentials( - []credentials.Provider{ - &credentials.EnvProvider{}, - &credentials.SharedCredentialsProvider{Filename: "", Profile: ""}, - &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(&aws.Config{ - Endpoint: aws.String(metadataURL), - })), - }, - }) - } - - if creds != nil { - conf.Endpoint = &url.Host - conf.S3ForcePathStyle = aws.Bool(true) - if url.Scheme == "http" { - conf.DisableSSL = aws.Bool(true) - } - } - - conf.Credentials = creds - if region != "" { - conf.Region = aws.String(region) - } - - return conf -} - -func (g *S3Getter) parseUrl(u *url.URL) (region, bucket, path, version string, creds *credentials.Credentials, err error) { - // This just check whether we are dealing with S3 or - // any other S3 compliant service. S3 has a predictable - // url as others do not - if strings.Contains(u.Host, "amazonaws.com") { - // Expected host style: s3.amazonaws.com. They always have 3 parts, - // although the first may differ if we're accessing a specific region. - hostParts := strings.Split(u.Host, ".") - if len(hostParts) != 3 { - err = fmt.Errorf("URL is not a valid S3 URL") - return - } - - // Parse the region out of the first part of the host - region = strings.TrimPrefix(strings.TrimPrefix(hostParts[0], "s3-"), "s3") - if region == "" { - region = "us-east-1" - } - - pathParts := strings.SplitN(u.Path, "/", 3) - if len(pathParts) != 3 { - err = fmt.Errorf("URL is not a valid S3 URL") - return - } - - bucket = pathParts[1] - path = pathParts[2] - version = u.Query().Get("version") - - } else { - pathParts := strings.SplitN(u.Path, "/", 3) - if len(pathParts) != 3 { - err = fmt.Errorf("URL is not a valid S3 complaint URL") - return - } - bucket = pathParts[1] - path = pathParts[2] - version = u.Query().Get("version") - region = u.Query().Get("region") - if region == "" { - region = "us-east-1" - } - } - - _, hasAwsId := u.Query()["aws_access_key_id"] - _, hasAwsSecret := u.Query()["aws_access_key_secret"] - _, hasAwsToken := u.Query()["aws_access_token"] - if hasAwsId || hasAwsSecret || hasAwsToken { - creds = credentials.NewStaticCredentials( - u.Query().Get("aws_access_key_id"), - u.Query().Get("aws_access_key_secret"), - u.Query().Get("aws_access_token"), - ) - } - - return -} diff --git a/vendor/github.com/hashicorp/go-getter/get_s3_test.go b/vendor/github.com/hashicorp/go-getter/get_s3_test.go deleted file mode 100644 index 1d9e026..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_s3_test.go +++ /dev/null @@ -1,250 +0,0 @@ -package getter - -import ( - "net/url" - "os" - "path/filepath" - "testing" - - "github.com/aws/aws-sdk-go/aws/awserr" -) - -func init() { - // These are well known restricted IAM keys to a HashiCorp-managed bucket - // in a private AWS account that only has access to the open source test - // resources. - // - // We do the string concat below to avoid AWS autodetection of a key. This - // key is locked down an IAM policy that is read-only so we're purposely - // exposing it. - os.Setenv("AWS_ACCESS_KEY", "AKIAJCTNQ"+"IOBWAYXKGZA") - os.Setenv("AWS_SECRET_KEY", "jcQOTYdXNzU5MO"+"5ExqbE1U995dIfKCKQtiVobMvr") -} - -func TestS3Getter_impl(t *testing.T) { - var _ Getter = new(S3Getter) -} - -func TestS3Getter(t *testing.T) { - g := new(S3Getter) - dst := tempDir(t) - - // With a dir that doesn't exist - err := g.Get( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestS3Getter_subdir(t *testing.T) { - g := new(S3Getter) - dst := tempDir(t) - - // With a dir that doesn't exist - err := g.Get( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/subfolder")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - subPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(subPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestS3Getter_GetFile(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/main.tf")) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - if _, err := os.Stat(dst); err != nil { - t.Fatalf("err: %s", err) - } - assertContents(t, dst, "# Main\n") -} - -func TestS3Getter_GetFile_badParams(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/main.tf?aws_access_key_id=foo&aws_access_key_secret=bar&aws_access_token=baz")) - if err == nil { - t.Fatalf("expected error, got none") - } - - if reqerr, ok := err.(awserr.RequestFailure); !ok || reqerr.StatusCode() != 403 { - t.Fatalf("expected InvalidAccessKeyId error") - } -} - -func TestS3Getter_GetFile_notfound(t *testing.T) { - g := new(S3Getter) - dst := tempFile(t) - - // Download - err := g.GetFile( - dst, testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/404.tf")) - if err == nil { - t.Fatalf("expected error, got none") - } -} - -func TestS3Getter_ClientMode_dir(t *testing.T) { - g := new(S3Getter) - - // Check client mode on a key prefix with only a single key. - mode, err := g.ClientMode( - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeDir { - t.Fatal("expect ClientModeDir") - } -} - -func TestS3Getter_ClientMode_file(t *testing.T) { - g := new(S3Getter) - - // Check client mode on a key prefix which contains sub-keys. - mode, err := g.ClientMode( - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/folder/main.tf")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeFile { - t.Fatal("expect ClientModeFile") - } -} - -func TestS3Getter_ClientMode_notfound(t *testing.T) { - g := new(S3Getter) - - // Check the client mode when a non-existent key is looked up. This does not - // return an error, but rather should just return the file mode so that S3 - // can return an appropriate error later on. This also checks that the - // prefix is handled properly (e.g., "/fold" and "/folder" don't put the - // client mode into "dir". - mode, err := g.ClientMode( - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/fold")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeFile { - t.Fatal("expect ClientModeFile") - } -} - -func TestS3Getter_ClientMode_collision(t *testing.T) { - g := new(S3Getter) - - // Check that the client mode is "file" if there is both an object and a - // folder with a common prefix (i.e., a "collision" in the namespace). - mode, err := g.ClientMode( - testURL("https://s3.amazonaws.com/hc-oss-test/go-getter/collision/foo")) - if err != nil { - t.Fatalf("err: %s", err) - } - if mode != ClientModeFile { - t.Fatal("expect ClientModeFile") - } -} - -func TestS3Getter_Url(t *testing.T) { - var s3tests = []struct { - name string - url string - region string - bucket string - path string - version string - }{ - { - name: "AWSv1234", - url: "s3::https://s3-eu-west-1.amazonaws.com/bucket/foo/bar.baz?version=1234", - region: "eu-west-1", - bucket: "bucket", - path: "foo/bar.baz", - version: "1234", - }, - { - name: "localhost-1", - url: "s3::http://127.0.0.1:9000/test-bucket/hello.txt?aws_access_key_id=TESTID&aws_access_key_secret=TestSecret®ion=us-east-2&version=1", - region: "us-east-2", - bucket: "test-bucket", - path: "hello.txt", - version: "1", - }, - { - name: "localhost-2", - url: "s3::http://127.0.0.1:9000/test-bucket/hello.txt?aws_access_key_id=TESTID&aws_access_key_secret=TestSecret&version=1", - region: "us-east-1", - bucket: "test-bucket", - path: "hello.txt", - version: "1", - }, - { - name: "localhost-3", - url: "s3::http://127.0.0.1:9000/test-bucket/hello.txt?aws_access_key_id=TESTID&aws_access_key_secret=TestSecret", - region: "us-east-1", - bucket: "test-bucket", - path: "hello.txt", - version: "", - }, - } - - for i, pt := range s3tests { - t.Run(pt.name, func(t *testing.T) { - g := new(S3Getter) - forced, src := getForcedGetter(pt.url) - u, err := url.Parse(src) - - if err != nil { - t.Errorf("test %d: unexpected error: %s", i, err) - } - if forced != "s3" { - t.Fatalf("expected forced protocol to be s3") - } - - region, bucket, path, version, creds, err := g.parseUrl(u) - - if err != nil { - t.Fatalf("err: %s", err) - } - if region != pt.region { - t.Fatalf("expected %s, got %s", pt.region, region) - } - if bucket != pt.bucket { - t.Fatalf("expected %s, got %s", pt.bucket, bucket) - } - if path != pt.path { - t.Fatalf("expected %s, got %s", pt.path, path) - } - if version != pt.version { - t.Fatalf("expected %s, got %s", pt.version, version) - } - if &creds == nil { - t.Fatalf("expected to not be nil") - } - }) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/get_test.go b/vendor/github.com/hashicorp/go-getter/get_test.go deleted file mode 100644 index 123c6a3..0000000 --- a/vendor/github.com/hashicorp/go-getter/get_test.go +++ /dev/null @@ -1,380 +0,0 @@ -package getter - -import ( - "os" - "path/filepath" - "strings" - "testing" -) - -func TestGet_badSchema(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - u = strings.Replace(u, "file", "nope", -1) - - if err := Get(dst, u); err == nil { - t.Fatal("should error") - } -} - -func TestGet_file(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -// https://github.com/hashicorp/terraform/issues/11438 -func TestGet_fileDecompressorExt(t *testing.T) { - dst := tempDir(t) - u := testModule("basic-tgz") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -// https://github.com/hashicorp/terraform/issues/8418 -func TestGet_filePercent2F(t *testing.T) { - dst := tempDir(t) - u := testModule("basic%2Ftest") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileDetect(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "basic") - pwd, err := os.Getwd() - if err != nil { - t.Fatalf("err: %s", err) - } - - client := &Client{ - Src: u, - Dst: dst, - Pwd: pwd, - Dir: true, - } - - if err := client.Get(); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileForced(t *testing.T) { - dst := tempDir(t) - u := testModule("basic") - u = "file::" + u - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_fileSubdir(t *testing.T) { - dst := tempDir(t) - u := testModule("basic//subdir") - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "sub.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_archive(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "archive.tar.gz") - u, _ = filepath.Abs(u) - - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGetAny_archive(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "archive.tar.gz") - u, _ = filepath.Abs(u) - - if err := GetAny(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "main.tf") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_archiveRooted(t *testing.T) { - dst := tempDir(t) - u := testModule("archive-rooted/archive.tar.gz") - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "root", "hello.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_archiveSubdirWild(t *testing.T) { - dst := tempDir(t) - u := testModule("archive-rooted/archive.tar.gz") - u += "//*" - if err := Get(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "hello.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGet_archiveSubdirWildMultiMatch(t *testing.T) { - dst := tempDir(t) - u := testModule("archive-rooted-multi/archive.tar.gz") - u += "//*" - if err := Get(dst, u); err == nil { - t.Fatal("should error") - } else if !strings.Contains(err.Error(), "multiple") { - t.Fatalf("err: %s", err) - } -} - -func TestGetAny_file(t *testing.T) { - dst := tempDir(t) - u := testModule("basic-file/foo.txt") - - if err := GetAny(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "foo.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestGetAny_dir(t *testing.T) { - dst := tempDir(t) - u := filepath.Join("./test-fixtures", "basic") - u, _ = filepath.Abs(u) - - if err := GetAny(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - check := []string{ - "main.tf", - "foo/main.tf", - } - - for _, name := range check { - mainPath := filepath.Join(dst, name) - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } - } -} - -func TestGetFile(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file/foo.txt") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archive(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file-archive/archive.tar.gz") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archiveChecksum(t *testing.T) { - dst := tempFile(t) - u := testModule( - "basic-file-archive/archive.tar.gz?checksum=md5:fbd90037dacc4b1ab40811d610dde2f0") - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") -} - -func TestGetFile_archiveNoUnarchive(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file-archive/archive.tar.gz") - u += "?archive=false" - - if err := GetFile(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - // Verify the main file exists - actual := testMD5(t, dst) - expected := "fbd90037dacc4b1ab40811d610dde2f0" - if actual != expected { - t.Fatalf("bad: %s", actual) - } -} - -func TestGetFile_checksum(t *testing.T) { - cases := []struct { - Append string - Err bool - }{ - { - "", - false, - }, - - // MD5 - { - "?checksum=md5:09f7e02f1290be211da707a266f153b3", - false, - }, - { - "?checksum=md5:09f7e02f1290be211da707a266f153b4", - true, - }, - - // SHA1 - { - "?checksum=sha1:1d229271928d3f9e2bb0375bd6ce5db6c6d348d9", - false, - }, - { - "?checksum=sha1:1d229271928d3f9e2bb0375bd6ce5db6c6d348d0", - true, - }, - - // SHA256 - { - "?checksum=sha256:66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f18", - false, - }, - { - "?checksum=sha256:66a045b452102c59d840ec097d59d9467e13a3f34f6494e539ffd32c1bb35f19", - true, - }, - - // SHA512 - { - "?checksum=sha512:c2bad2223811194582af4d1508ac02cd69eeeeedeeb98d54fcae4dcefb13cc882e7640328206603d3fb9cd5f949a9be0db054dd34fbfa190c498a5fe09750cef", - false, - }, - { - "?checksum=sha512:c2bad2223811194582af4d1508ac02cd69eeeeedeeb98d54fcae4dcefb13cc882e7640328206603d3fb9cd5f949a9be0db054dd34fbfa190c498a5fe09750ced", - true, - }, - } - - for _, tc := range cases { - u := testModule("basic-file/foo.txt") + tc.Append - - func() { - dst := tempFile(t) - defer os.Remove(dst) - if err := GetFile(dst, u); (err != nil) != tc.Err { - t.Fatalf("append: %s\n\nerr: %s", tc.Append, err) - } - - // Verify the main file exists - assertContents(t, dst, "Hello\n") - }() - } -} - -func TestGetFile_checksumURL(t *testing.T) { - dst := tempFile(t) - u := testModule("basic-file/foo.txt") + "?checksum=md5:09f7e02f1290be211da707a266f153b3" - - getter := &MockGetter{Proxy: new(FileGetter)} - client := &Client{ - Src: u, - Dst: dst, - Dir: false, - Getters: map[string]Getter{ - "file": getter, - }, - } - - if err := client.Get(); err != nil { - t.Fatalf("err: %s", err) - } - - if v := getter.GetFileURL.Query().Get("checksum"); v != "" { - t.Fatalf("bad: %s", v) - } -} - -func TestGetFile_filename(t *testing.T) { - dst := tempDir(t) - u := testModule("basic-file/foo.txt") - - u += "?filename=bar.txt" - - if err := GetAny(dst, u); err != nil { - t.Fatalf("err: %s", err) - } - - mainPath := filepath.Join(dst, "bar.txt") - if _, err := os.Stat(mainPath); err != nil { - t.Fatalf("err: %s", err) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/helper/url/url.go b/vendor/github.com/hashicorp/go-getter/helper/url/url.go deleted file mode 100644 index 02497c2..0000000 --- a/vendor/github.com/hashicorp/go-getter/helper/url/url.go +++ /dev/null @@ -1,14 +0,0 @@ -package url - -import ( - "net/url" -) - -// Parse parses rawURL into a URL structure. -// The rawURL may be relative or absolute. -// -// Parse is a wrapper for the Go stdlib net/url Parse function, but returns -// Windows "safe" URLs on Windows platforms. -func Parse(rawURL string) (*url.URL, error) { - return parse(rawURL) -} diff --git a/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go b/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go deleted file mode 100644 index ce3226b..0000000 --- a/vendor/github.com/hashicorp/go-getter/helper/url/url_test.go +++ /dev/null @@ -1,88 +0,0 @@ -package url - -import ( - "runtime" - "testing" -) - -type parseTest struct { - rawURL string - scheme string - host string - path string - str string - err bool -} - -var parseTests = []parseTest{ - { - rawURL: "/foo/bar", - scheme: "", - host: "", - path: "/foo/bar", - str: "/foo/bar", - err: false, - }, - { - rawURL: "file:///dir/", - scheme: "file", - host: "", - path: "/dir/", - str: "file:///dir/", - err: false, - }, -} - -var winParseTests = []parseTest{ - { - rawURL: `C:\`, - scheme: ``, - host: ``, - path: `C:/`, - str: `C:/`, - err: false, - }, - { - rawURL: `file://C:\`, - scheme: `file`, - host: ``, - path: `C:/`, - str: `file://C:/`, - err: false, - }, - { - rawURL: `file:///C:\`, - scheme: `file`, - host: ``, - path: `C:/`, - str: `file://C:/`, - err: false, - }, -} - -func TestParse(t *testing.T) { - if runtime.GOOS == "windows" { - parseTests = append(parseTests, winParseTests...) - } - for i, pt := range parseTests { - url, err := Parse(pt.rawURL) - if err != nil && !pt.err { - t.Errorf("test %d: unexpected error: %s", i, err) - } - if err == nil && pt.err { - t.Errorf("test %d: expected an error", i) - } - if url.Scheme != pt.scheme { - t.Errorf("test %d: expected Scheme = %q, got %q", i, pt.scheme, url.Scheme) - } - if url.Host != pt.host { - t.Errorf("test %d: expected Host = %q, got %q", i, pt.host, url.Host) - } - if url.Path != pt.path { - t.Errorf("test %d: expected Path = %q, got %q", i, pt.path, url.Path) - } - if url.String() != pt.str { - t.Errorf("test %d: expected url.String() = %q, got %q", i, pt.str, url.String()) - } - } -} diff --git a/vendor/github.com/hashicorp/go-getter/helper/url/url_unix.go b/vendor/github.com/hashicorp/go-getter/helper/url/url_unix.go deleted file mode 100644 index ed1352a..0000000 --- a/vendor/github.com/hashicorp/go-getter/helper/url/url_unix.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build !windows - -package url - -import ( - "net/url" -) - -func parse(rawURL string) (*url.URL, error) { - return url.Parse(rawURL) -} diff --git a/vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go b/vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go deleted file mode 100644 index 4655226..0000000 --- a/vendor/github.com/hashicorp/go-getter/helper/url/url_windows.go +++ /dev/null @@ -1,40 +0,0 @@ -package url - -import ( - "fmt" - "net/url" - "path/filepath" - "strings" -) - -func parse(rawURL string) (*url.URL, error) { - // Make sure we're using "/" since URLs are "/"-based. - rawURL = filepath.ToSlash(rawURL) - - u, err := url.Parse(rawURL) - if err != nil { - return nil, err - } - - if len(rawURL) > 1 && rawURL[1] == ':' { - // Assume we're dealing with a drive letter file path where the drive - // letter has been parsed into the URL Scheme, and the rest of the path - // has been parsed into the URL Path without the leading ':' character. - u.Path = fmt.Sprintf("%s:%s", string(rawURL[0]), u.Path) - u.Scheme = "" - } - - if len(u.Host) > 1 && u.Host[1] == ':' && strings.HasPrefix(rawURL, "file://") { - // Assume we're dealing with a drive letter file path where the drive - // letter has been parsed into the URL Host. - u.Path = fmt.Sprintf("%s%s", u.Host, u.Path) - u.Host = "" - } - - // Remove leading slash for absolute file paths. - if len(u.Path) > 2 && u.Path[0] == '/' && u.Path[2] == ':' { - u.Path = u.Path[1:] - } - - return u, err -} diff --git a/vendor/github.com/hashicorp/go-getter/module_test.go b/vendor/github.com/hashicorp/go-getter/module_test.go deleted file mode 100644 index 1c81273..0000000 --- a/vendor/github.com/hashicorp/go-getter/module_test.go +++ /dev/null @@ -1,78 +0,0 @@ -package getter - -import ( - "io/ioutil" - "net/url" - "os" - "path/filepath" - "reflect" - "testing" - - urlhelper "github.com/hashicorp/go-getter/helper/url" -) - -const fixtureDir = "./test-fixtures" - -func tempDir(t *testing.T) string { - dir, err := ioutil.TempDir("", "tf") - if err != nil { - t.Fatalf("err: %s", err) - } - if err := os.RemoveAll(dir); err != nil { - t.Fatalf("err: %s", err) - } - - return dir -} - -func tempFile(t *testing.T) string { - dir := tempDir(t) - return filepath.Join(dir, "foo") -} - -func testModule(n string) string { - p := filepath.Join(fixtureDir, n) - p, err := filepath.Abs(p) - if err != nil { - panic(err) - } - return fmtFileURL(p) -} - -func testModuleURL(n string) *url.URL { - n, subDir := SourceDirSubdir(n) - u, err := urlhelper.Parse(testModule(n)) - if err != nil { - panic(err) - } - if subDir != "" { - u.Path += "//" + subDir - u.RawPath = u.Path - } - - return u -} - -func testURL(s string) *url.URL { - u, err := urlhelper.Parse(s) - if err != nil { - panic(err) - } - - return u -} - -func testStorage(t *testing.T) Storage { - return &FolderStorage{StorageDir: tempDir(t)} -} - -func assertContents(t *testing.T, path string, contents string) { - data, err := ioutil.ReadFile(path) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(data, []byte(contents)) { - t.Fatalf("bad. expected:\n\n%s\n\nGot:\n\n%s", contents, string(data)) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/netrc.go b/vendor/github.com/hashicorp/go-getter/netrc.go deleted file mode 100644 index c7f6a3f..0000000 --- a/vendor/github.com/hashicorp/go-getter/netrc.go +++ /dev/null @@ -1,67 +0,0 @@ -package getter - -import ( - "fmt" - "net/url" - "os" - "runtime" - - "github.com/bgentry/go-netrc/netrc" - "github.com/mitchellh/go-homedir" -) - -// addAuthFromNetrc adds auth information to the URL from the user's -// netrc file if it can be found. This will only add the auth info -// if the URL doesn't already have auth info specified and the -// the username is blank. -func addAuthFromNetrc(u *url.URL) error { - // If the URL already has auth information, do nothing - if u.User != nil && u.User.Username() != "" { - return nil - } - - // Get the netrc file path - path := os.Getenv("NETRC") - if path == "" { - filename := ".netrc" - if runtime.GOOS == "windows" { - filename = "_netrc" - } - - var err error - path, err = homedir.Expand("~/" + filename) - if err != nil { - return err - } - } - - // If the file is not a file, then do nothing - if fi, err := os.Stat(path); err != nil { - // File doesn't exist, do nothing - if os.IsNotExist(err) { - return nil - } - - // Some other error! - return err - } else if fi.IsDir() { - // File is directory, ignore - return nil - } - - // Load up the netrc file - net, err := netrc.ParseFile(path) - if err != nil { - return fmt.Errorf("Error parsing netrc file at %q: %s", path, err) - } - - machine := net.FindMachine(u.Host) - if machine == nil { - // Machine not found, no problem - return nil - } - - // Set the user info - u.User = url.UserPassword(machine.Login, machine.Password) - return nil -} diff --git a/vendor/github.com/hashicorp/go-getter/netrc_test.go b/vendor/github.com/hashicorp/go-getter/netrc_test.go deleted file mode 100644 index e222c96..0000000 --- a/vendor/github.com/hashicorp/go-getter/netrc_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package getter - -import ( - "net/url" - "testing" -) - -func TestAddAuthFromNetrc(t *testing.T) { - defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")() - - u, err := url.Parse("http://example.com") - if err != nil { - t.Fatalf("err: %s", err) - } - - if err := addAuthFromNetrc(u); err != nil { - t.Fatalf("err: %s", err) - } - - expected := "http://foo:bar@example.com" - actual := u.String() - if expected != actual { - t.Fatalf("Mismatch: %q != %q", actual, expected) - } -} - -func TestAddAuthFromNetrc_hasAuth(t *testing.T) { - defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")() - - u, err := url.Parse("http://username:password@example.com") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := u.String() - if err := addAuthFromNetrc(u); err != nil { - t.Fatalf("err: %s", err) - } - - actual := u.String() - if expected != actual { - t.Fatalf("Mismatch: %q != %q", actual, expected) - } -} - -func TestAddAuthFromNetrc_hasUsername(t *testing.T) { - defer tempEnv(t, "NETRC", "./test-fixtures/netrc/basic")() - - u, err := url.Parse("http://username@example.com") - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := u.String() - if err := addAuthFromNetrc(u); err != nil { - t.Fatalf("err: %s", err) - } - - actual := u.String() - if expected != actual { - t.Fatalf("Mismatch: %q != %q", actual, expected) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/source.go b/vendor/github.com/hashicorp/go-getter/source.go deleted file mode 100644 index c63f2bb..0000000 --- a/vendor/github.com/hashicorp/go-getter/source.go +++ /dev/null @@ -1,62 +0,0 @@ -package getter - -import ( - "fmt" - "path/filepath" - "strings" -) - -// SourceDirSubdir takes a source and returns a tuple of the URL without -// the subdir and the URL with the subdir. -func SourceDirSubdir(src string) (string, string) { - // Calcaulate an offset to avoid accidentally marking the scheme - // as the dir. - var offset int - if idx := strings.Index(src, "://"); idx > -1 { - offset = idx + 3 - } - - // First see if we even have an explicit subdir - idx := strings.Index(src[offset:], "//") - if idx == -1 { - return src, "" - } - - idx += offset - subdir := src[idx+2:] - src = src[:idx] - - // Next, check if we have query parameters and push them onto the - // URL. - if idx = strings.Index(subdir, "?"); idx > -1 { - query := subdir[idx:] - subdir = subdir[:idx] - src += query - } - - return src, subdir -} - -// SubdirGlob returns the actual subdir with globbing processed. -// -// dst should be a destination directory that is already populated (the -// download is complete) and subDir should be the set subDir. If subDir -// is an empty string, this returns an empty string. -// -// The returned path is the full absolute path. -func SubdirGlob(dst, subDir string) (string, error) { - matches, err := filepath.Glob(filepath.Join(dst, subDir)) - if err != nil { - return "", err - } - - if len(matches) == 0 { - return "", fmt.Errorf("subdir %q not found", subDir) - } - - if len(matches) > 1 { - return "", fmt.Errorf("subdir %q matches multiple paths", subDir) - } - - return matches[0], nil -} diff --git a/vendor/github.com/hashicorp/go-getter/source_test.go b/vendor/github.com/hashicorp/go-getter/source_test.go deleted file mode 100644 index 213324a..0000000 --- a/vendor/github.com/hashicorp/go-getter/source_test.go +++ /dev/null @@ -1,98 +0,0 @@ -package getter - -import ( - "io/ioutil" - "os" - "path/filepath" - "testing" -) - -func TestSourceDirSubdir(t *testing.T) { - cases := []struct { - Input string - Dir, Sub string - }{ - { - "hashicorp.com", - "hashicorp.com", "", - }, - { - "hashicorp.com//foo", - "hashicorp.com", "foo", - }, - { - "hashicorp.com//foo?bar=baz", - "hashicorp.com?bar=baz", "foo", - }, - { - "https://hashicorp.com/path//*?archive=foo", - "https://hashicorp.com/path?archive=foo", "*", - }, - { - "file://foo//bar", - "file://foo", "bar", - }, - } - - for i, tc := range cases { - adir, asub := SourceDirSubdir(tc.Input) - if adir != tc.Dir { - t.Fatalf("%d: bad dir: %#v", i, adir) - } - if asub != tc.Sub { - t.Fatalf("%d: bad sub: %#v", i, asub) - } - } -} - -func TestSourceSubdirGlob(t *testing.T) { - td, err := ioutil.TempDir("", "subdir-glob") - if err != nil { - t.Fatal(err) - } - defer os.RemoveAll(td) - - if err := os.Mkdir(filepath.Join(td, "subdir"), 0755); err != nil { - t.Fatal(err) - } - - if err := os.Mkdir(filepath.Join(td, "subdir/one"), 0755); err != nil { - t.Fatal(err) - } - - if err := os.Mkdir(filepath.Join(td, "subdir/two"), 0755); err != nil { - t.Fatal(err) - } - - subdir := filepath.Join(td, "subdir") - - // match the exact directory - res, err := SubdirGlob(td, "subdir") - if err != nil { - t.Fatal(err) - } - if res != subdir { - t.Fatalf(`expected "subdir", got: %q`, subdir) - } - - // single match from a wildcard - res, err = SubdirGlob(td, "*") - if err != nil { - t.Fatal(err) - } - if res != subdir { - t.Fatalf(`expected "subdir", got: %q`, subdir) - } - - // multiple matches - res, err = SubdirGlob(td, "subdir/*") - if err == nil { - t.Fatalf("expected multiple matches, got %q", res) - } - - // non-existent - res, err = SubdirGlob(td, "foo") - if err == nil { - t.Fatalf("expected no matches, got %q", res) - } -} diff --git a/vendor/github.com/hashicorp/go-getter/storage.go b/vendor/github.com/hashicorp/go-getter/storage.go deleted file mode 100644 index 2bc6b9e..0000000 --- a/vendor/github.com/hashicorp/go-getter/storage.go +++ /dev/null @@ -1,13 +0,0 @@ -package getter - -// Storage is an interface that knows how to lookup downloaded directories -// as well as download and update directories from their sources into the -// proper location. -type Storage interface { - // Dir returns the directory on local disk where the directory source - // can be loaded from. - Dir(string) (string, bool, error) - - // Get will download and optionally update the given directory. - Get(string, string, bool) error -} diff --git a/vendor/github.com/hashicorp/go-getter/util_test.go b/vendor/github.com/hashicorp/go-getter/util_test.go deleted file mode 100644 index a3e7d82..0000000 --- a/vendor/github.com/hashicorp/go-getter/util_test.go +++ /dev/null @@ -1,49 +0,0 @@ -package getter - -import ( - "io" - "io/ioutil" - "os" - "strings" - "testing" -) - -// tempEnv sets the env var temporarily and returns a function that should -// be deferred to clean it up. -func tempEnv(t *testing.T, k, v string) func() { - old := os.Getenv(k) - - // Set env - if err := os.Setenv(k, v); err != nil { - t.Fatalf("err: %s", err) - } - - // Easy cleanup - return func() { - if err := os.Setenv(k, old); err != nil { - t.Fatalf("err: %s", err) - } - } -} - -// tempFileContents writes a temporary file and returns the path and a function -// to clean it up. -func tempFileContents(t *testing.T, contents string) (string, func()) { - tf, err := ioutil.TempFile("", "getter") - if err != nil { - t.Fatalf("err: %s", err) - } - - if _, err := io.Copy(tf, strings.NewReader(contents)); err != nil { - t.Fatalf("err: %s", err) - } - - tf.Close() - - path := tf.Name() - return path, func() { - if err := os.Remove(path); err != nil { - t.Fatalf("err: %s", err) - } - } -} diff --git a/vendor/github.com/hashicorp/go-hclog/LICENSE b/vendor/github.com/hashicorp/go-hclog/LICENSE deleted file mode 100644 index abaf1e4..0000000 --- a/vendor/github.com/hashicorp/go-hclog/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2017 HashiCorp - -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/hashicorp/go-hclog/README.md b/vendor/github.com/hashicorp/go-hclog/README.md deleted file mode 100644 index 614342b..0000000 --- a/vendor/github.com/hashicorp/go-hclog/README.md +++ /dev/null @@ -1,123 +0,0 @@ -# go-hclog - -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[godocs]: https://godoc.org/github.com/hashicorp/go-hclog - -`go-hclog` is a package for Go that provides a simple key/value logging -interface for use in development and production environments. - -It provides logging levels that provide decreased output based upon the -desired amount of output, unlike the standard library `log` package. - -It does not provide `Printf` style logging, only key/value logging that is -exposed as arguments to the logging functions for simplicity. - -It provides a human readable output mode for use in development as well as -JSON output mode for production. - -## Stability Note - -While this library is fully open source and HashiCorp will be maintaining it -(since we are and will be making extensive use of it), the API and output -format is subject to minor changes as we fully bake and vet it in our projects. -This notice will be removed once it's fully integrated into our major projects -and no further changes are anticipated. - -## Installation and Docs - -Install using `go get github.com/hashicorp/go-hclog`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/go-hclog - -## Usage - -### Use the global logger - -```go -hclog.Default().Info("hello world") -``` - -```text -2017-07-05T16:15:55.167-0700 [INFO ] hello world -``` - -(Note timestamps are removed in future examples for brevity.) - -### Create a new logger - -```go -appLogger := hclog.New(&hclog.LoggerOptions{ - Name: "my-app", - Level: hclog.LevelFromString("DEBUG"), -}) -``` - -### Emit an Info level message with 2 key/value pairs - -```go -input := "5.5" -_, err := strconv.ParseInt(input, 10, 32) -if err != nil { - appLogger.Info("Invalid input for ParseInt", "input", input, "error", err) -} -``` - -```text -... [INFO ] my-app: Invalid input for ParseInt: input=5.5 error="strconv.ParseInt: parsing "5.5": invalid syntax" -``` - -### Create a new Logger for a major subsystem - -```go -subsystemLogger := appLogger.Named("transport") -subsystemLogger.Info("we are transporting something") -``` - -```text -... [INFO ] my-app.transport: we are transporting something -``` - -Notice that logs emitted by `subsystemLogger` contain `my-app.transport`, -reflecting both the application and subsystem names. - -### Create a new Logger with fixed key/value pairs - -Using `With()` will include a specific key-value pair in all messages emitted -by that logger. - -```go -requestID := "5fb446b6-6eba-821d-df1b-cd7501b6a363" -requestLogger := subsystemLogger.With("request", requestID) -requestLogger.Info("we are transporting a request") -``` - -```text -... [INFO ] my-app.transport: we are transporting a request: request=5fb446b6-6eba-821d-df1b-cd7501b6a363 -``` - -This allows sub Loggers to be context specific without having to thread that -into all the callers. - -### Use this with code that uses the standard library logger - -If you want to use the standard library's `log.Logger` interface you can wrap -`hclog.Logger` by calling the `StandardLogger()` method. This allows you to use -it with the familiar `Println()`, `Printf()`, etc. For example: - -```go -stdLogger := appLogger.StandardLogger(&hclog.StandardLoggerOptions{ - InferLevels: true, -}) -// Printf() is provided by stdlib log.Logger interface, not hclog.Logger -stdLogger.Printf("[DEBUG] %+v", stdLogger) -``` - -```text -... [DEBUG] my-app: &{mu:{state:0 sema:0} prefix: flag:0 out:0xc42000a0a0 buf:[]} -``` - -Notice that if `appLogger` is initialized with the `INFO` log level _and_ you -specify `InferLevels: true`, you will not see any output here. You must change -`appLogger` to `DEBUG` to see output. See the docs for more information. diff --git a/vendor/github.com/hashicorp/go-hclog/global.go b/vendor/github.com/hashicorp/go-hclog/global.go deleted file mode 100644 index 55ce439..0000000 --- a/vendor/github.com/hashicorp/go-hclog/global.go +++ /dev/null @@ -1,34 +0,0 @@ -package hclog - -import ( - "sync" -) - -var ( - protect sync.Once - def Logger - - // The options used to create the Default logger. These are - // read only when the Default logger is created, so set them - // as soon as the process starts. - DefaultOptions = &LoggerOptions{ - Level: DefaultLevel, - Output: DefaultOutput, - } -) - -// Return a logger that is held globally. This can be a good starting -// place, and then you can use .With() and .Name() to create sub-loggers -// to be used in more specific contexts. -func Default() Logger { - protect.Do(func() { - def = New(DefaultOptions) - }) - - return def -} - -// A short alias for Default() -func L() Logger { - return Default() -} diff --git a/vendor/github.com/hashicorp/go-hclog/int.go b/vendor/github.com/hashicorp/go-hclog/int.go deleted file mode 100644 index 20adcfb..0000000 --- a/vendor/github.com/hashicorp/go-hclog/int.go +++ /dev/null @@ -1,404 +0,0 @@ -package hclog - -import ( - "bufio" - "encoding" - "encoding/json" - "fmt" - "log" - "os" - "runtime" - "strconv" - "strings" - "sync" - "time" -) - -var ( - _levelToBracket = map[Level]string{ - Debug: "[DEBUG]", - Trace: "[TRACE]", - Info: "[INFO ]", - Warn: "[WARN ]", - Error: "[ERROR]", - } -) - -// Given the options (nil for defaults), create a new Logger -func New(opts *LoggerOptions) Logger { - if opts == nil { - opts = &LoggerOptions{} - } - - output := opts.Output - if output == nil { - output = os.Stderr - } - - level := opts.Level - if level == NoLevel { - level = DefaultLevel - } - - mtx := opts.Mutex - if mtx == nil { - mtx = new(sync.Mutex) - } - - return &intLogger{ - m: mtx, - json: opts.JSONFormat, - caller: opts.IncludeLocation, - name: opts.Name, - w: bufio.NewWriter(output), - level: level, - } -} - -// The internal logger implementation. Internal in that it is defined entirely -// by this package. -type intLogger struct { - json bool - caller bool - name string - - // this is a pointer so that it's shared by any derived loggers, since - // those derived loggers share the bufio.Writer as well. - m *sync.Mutex - w *bufio.Writer - level Level - - implied []interface{} -} - -// Make sure that intLogger is a Logger -var _ Logger = &intLogger{} - -// The time format to use for logging. This is a version of RFC3339 that -// contains millisecond precision -const TimeFormat = "2006-01-02T15:04:05.000Z0700" - -// Log a message and a set of key/value pairs if the given level is at -// or more severe that the threshold configured in the Logger. -func (z *intLogger) Log(level Level, msg string, args ...interface{}) { - if level < z.level { - return - } - - t := time.Now() - - z.m.Lock() - defer z.m.Unlock() - - if z.json { - z.logJson(t, level, msg, args...) - } else { - z.log(t, level, msg, args...) - } - - z.w.Flush() -} - -// Cleanup a path by returning the last 2 segments of the path only. -func trimCallerPath(path string) string { - // lovely borrowed from zap - // nb. To make sure we trim the path correctly on Windows too, we - // counter-intuitively need to use '/' and *not* os.PathSeparator here, - // because the path given originates from Go stdlib, specifically - // runtime.Caller() which (as of Mar/17) returns forward slashes even on - // Windows. - // - // See https://github.com/golang/go/issues/3335 - // and https://github.com/golang/go/issues/18151 - // - // for discussion on the issue on Go side. - // - - // Find the last separator. - // - idx := strings.LastIndexByte(path, '/') - if idx == -1 { - return path - } - - // Find the penultimate separator. - idx = strings.LastIndexByte(path[:idx], '/') - if idx == -1 { - return path - } - - return path[idx+1:] -} - -// Non-JSON logging format function -func (z *intLogger) log(t time.Time, level Level, msg string, args ...interface{}) { - z.w.WriteString(t.Format(TimeFormat)) - z.w.WriteByte(' ') - - s, ok := _levelToBracket[level] - if ok { - z.w.WriteString(s) - } else { - z.w.WriteString("[UNKN ]") - } - - if z.caller { - if _, file, line, ok := runtime.Caller(3); ok { - z.w.WriteByte(' ') - z.w.WriteString(trimCallerPath(file)) - z.w.WriteByte(':') - z.w.WriteString(strconv.Itoa(line)) - z.w.WriteByte(':') - } - } - - z.w.WriteByte(' ') - - if z.name != "" { - z.w.WriteString(z.name) - z.w.WriteString(": ") - } - - z.w.WriteString(msg) - - args = append(z.implied, args...) - - var stacktrace CapturedStacktrace - - if args != nil && len(args) > 0 { - if len(args)%2 != 0 { - cs, ok := args[len(args)-1].(CapturedStacktrace) - if ok { - args = args[:len(args)-1] - stacktrace = cs - } else { - args = append(args, "") - } - } - - z.w.WriteByte(':') - - FOR: - for i := 0; i < len(args); i = i + 2 { - var val string - - switch st := args[i+1].(type) { - case string: - val = st - case int: - val = strconv.FormatInt(int64(st), 10) - case int64: - val = strconv.FormatInt(int64(st), 10) - case int32: - val = strconv.FormatInt(int64(st), 10) - case int16: - val = strconv.FormatInt(int64(st), 10) - case int8: - val = strconv.FormatInt(int64(st), 10) - case uint: - val = strconv.FormatUint(uint64(st), 10) - case uint64: - val = strconv.FormatUint(uint64(st), 10) - case uint32: - val = strconv.FormatUint(uint64(st), 10) - case uint16: - val = strconv.FormatUint(uint64(st), 10) - case uint8: - val = strconv.FormatUint(uint64(st), 10) - case CapturedStacktrace: - stacktrace = st - continue FOR - default: - val = fmt.Sprintf("%v", st) - } - - z.w.WriteByte(' ') - z.w.WriteString(args[i].(string)) - z.w.WriteByte('=') - - if strings.ContainsAny(val, " \t\n\r") { - z.w.WriteByte('"') - z.w.WriteString(val) - z.w.WriteByte('"') - } else { - z.w.WriteString(val) - } - } - } - - z.w.WriteString("\n") - - if stacktrace != "" { - z.w.WriteString(string(stacktrace)) - } -} - -// JSON logging function -func (z *intLogger) logJson(t time.Time, level Level, msg string, args ...interface{}) { - vals := map[string]interface{}{ - "@message": msg, - "@timestamp": t.Format("2006-01-02T15:04:05.000000Z07:00"), - } - - var levelStr string - switch level { - case Error: - levelStr = "error" - case Warn: - levelStr = "warn" - case Info: - levelStr = "info" - case Debug: - levelStr = "debug" - case Trace: - levelStr = "trace" - default: - levelStr = "all" - } - - vals["@level"] = levelStr - - if z.name != "" { - vals["@module"] = z.name - } - - if z.caller { - if _, file, line, ok := runtime.Caller(3); ok { - vals["@caller"] = fmt.Sprintf("%s:%d", file, line) - } - } - - if args != nil && len(args) > 0 { - if len(args)%2 != 0 { - cs, ok := args[len(args)-1].(CapturedStacktrace) - if ok { - args = args[:len(args)-1] - vals["stacktrace"] = cs - } else { - args = append(args, "") - } - } - - for i := 0; i < len(args); i = i + 2 { - if _, ok := args[i].(string); !ok { - // As this is the logging function not much we can do here - // without injecting into logs... - continue - } - val := args[i+1] - // Check if val is of type error. If error type doesn't - // implement json.Marshaler or encoding.TextMarshaler - // then set val to err.Error() so that it gets marshaled - if err, ok := val.(error); ok { - switch err.(type) { - case json.Marshaler, encoding.TextMarshaler: - default: - val = err.Error() - } - } - vals[args[i].(string)] = val - } - } - - err := json.NewEncoder(z.w).Encode(vals) - if err != nil { - panic(err) - } -} - -// Emit the message and args at DEBUG level -func (z *intLogger) Debug(msg string, args ...interface{}) { - z.Log(Debug, msg, args...) -} - -// Emit the message and args at TRACE level -func (z *intLogger) Trace(msg string, args ...interface{}) { - z.Log(Trace, msg, args...) -} - -// Emit the message and args at INFO level -func (z *intLogger) Info(msg string, args ...interface{}) { - z.Log(Info, msg, args...) -} - -// Emit the message and args at WARN level -func (z *intLogger) Warn(msg string, args ...interface{}) { - z.Log(Warn, msg, args...) -} - -// Emit the message and args at ERROR level -func (z *intLogger) Error(msg string, args ...interface{}) { - z.Log(Error, msg, args...) -} - -// Indicate that the logger would emit TRACE level logs -func (z *intLogger) IsTrace() bool { - return z.level == Trace -} - -// Indicate that the logger would emit DEBUG level logs -func (z *intLogger) IsDebug() bool { - return z.level <= Debug -} - -// Indicate that the logger would emit INFO level logs -func (z *intLogger) IsInfo() bool { - return z.level <= Info -} - -// Indicate that the logger would emit WARN level logs -func (z *intLogger) IsWarn() bool { - return z.level <= Warn -} - -// Indicate that the logger would emit ERROR level logs -func (z *intLogger) IsError() bool { - return z.level <= Error -} - -// Return a sub-Logger for which every emitted log message will contain -// the given key/value pairs. This is used to create a context specific -// Logger. -func (z *intLogger) With(args ...interface{}) Logger { - var nz intLogger = *z - - nz.implied = append(nz.implied, args...) - - return &nz -} - -// Create a new sub-Logger that a name decending from the current name. -// This is used to create a subsystem specific Logger. -func (z *intLogger) Named(name string) Logger { - var nz intLogger = *z - - if nz.name != "" { - nz.name = nz.name + "." + name - } else { - nz.name = name - } - - return &nz -} - -// Create a new sub-Logger with an explicit name. This ignores the current -// name. This is used to create a standalone logger that doesn't fall -// within the normal hierarchy. -func (z *intLogger) ResetNamed(name string) Logger { - var nz intLogger = *z - - nz.name = name - - return &nz -} - -// Create a *log.Logger that will send it's data through this Logger. This -// allows packages that expect to be using the standard library log to actually -// use this logger. -func (z *intLogger) StandardLogger(opts *StandardLoggerOptions) *log.Logger { - if opts == nil { - opts = &StandardLoggerOptions{} - } - - return log.New(&stdlogAdapter{z, opts.InferLevels}, "", 0) -} diff --git a/vendor/github.com/hashicorp/go-hclog/log.go b/vendor/github.com/hashicorp/go-hclog/log.go deleted file mode 100644 index dbc4198..0000000 --- a/vendor/github.com/hashicorp/go-hclog/log.go +++ /dev/null @@ -1,142 +0,0 @@ -package hclog - -import ( - "io" - "log" - "os" - "strings" - "sync" -) - -var ( - DefaultOutput = os.Stderr - DefaultLevel = Info -) - -type Level int - -const ( - // This is a special level used to indicate that no level has been - // set and allow for a default to be used. - NoLevel Level = 0 - - // The most verbose level. Intended to be used for the tracing of actions - // in code, such as function enters/exits, etc. - Trace Level = 1 - - // For programmer lowlevel analysis. - Debug Level = 2 - - // For information about steady state operations. - Info Level = 3 - - // For information about rare but handled events. - Warn Level = 4 - - // For information about unrecoverable events. - Error Level = 5 -) - -// LevelFromString returns a Level type for the named log level, or "NoLevel" if -// the level string is invalid. This facilitates setting the log level via -// config or environment variable by name in a predictable way. -func LevelFromString(levelStr string) Level { - // We don't care about case. Accept "INFO" or "info" - levelStr = strings.ToLower(strings.TrimSpace(levelStr)) - switch levelStr { - case "trace": - return Trace - case "debug": - return Debug - case "info": - return Info - case "warn": - return Warn - case "error": - return Error - default: - return NoLevel - } -} - -// The main Logger interface. All code should code against this interface only. -type Logger interface { - // Args are alternating key, val pairs - // keys must be strings - // vals can be any type, but display is implementation specific - // Emit a message and key/value pairs at the TRACE level - Trace(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the DEBUG level - Debug(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the INFO level - Info(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the WARN level - Warn(msg string, args ...interface{}) - - // Emit a message and key/value pairs at the ERROR level - Error(msg string, args ...interface{}) - - // Indicate if TRACE logs would be emitted. This and the other Is* guards - // are used to elide expensive logging code based on the current level. - IsTrace() bool - - // Indicate if DEBUG logs would be emitted. This and the other Is* guards - IsDebug() bool - - // Indicate if INFO logs would be emitted. This and the other Is* guards - IsInfo() bool - - // Indicate if WARN logs would be emitted. This and the other Is* guards - IsWarn() bool - - // Indicate if ERROR logs would be emitted. This and the other Is* guards - IsError() bool - - // Creates a sublogger that will always have the given key/value pairs - With(args ...interface{}) Logger - - // Create a logger that will prepend the name string on the front of all messages. - // If the logger already has a name, the new value will be appended to the current - // name. That way, a major subsystem can use this to decorate all it's own logs - // without losing context. - Named(name string) Logger - - // Create a logger that will prepend the name string on the front of all messages. - // This sets the name of the logger to the value directly, unlike Named which honor - // the current name as well. - ResetNamed(name string) Logger - - // Return a value that conforms to the stdlib log.Logger interface - StandardLogger(opts *StandardLoggerOptions) *log.Logger -} - -type StandardLoggerOptions struct { - // Indicate that some minimal parsing should be done on strings to try - // and detect their level and re-emit them. - // This supports the strings like [ERROR], [ERR] [TRACE], [WARN], [INFO], - // [DEBUG] and strip it off before reapplying it. - InferLevels bool -} - -type LoggerOptions struct { - // Name of the subsystem to prefix logs with - Name string - - // The threshold for the logger. Anything less severe is supressed - Level Level - - // Where to write the logs to. Defaults to os.Stdout if nil - Output io.Writer - - // An optional mutex pointer in case Output is shared - Mutex *sync.Mutex - - // Control if the output should be in JSON. - JSONFormat bool - - // Include file and line information in each log line - IncludeLocation bool -} diff --git a/vendor/github.com/hashicorp/go-hclog/logger_test.go b/vendor/github.com/hashicorp/go-hclog/logger_test.go deleted file mode 100644 index 729d273..0000000 --- a/vendor/github.com/hashicorp/go-hclog/logger_test.go +++ /dev/null @@ -1,300 +0,0 @@ -package hclog - -import ( - "bytes" - "encoding/json" - "errors" - "fmt" - "strconv" - "strings" - "testing" - - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -func TestLogger(t *testing.T) { - t.Run("formats log entries", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - }) - - logger.Info("this is test", "who", "programmer", "why", "testing") - - str := buf.String() - - dataIdx := strings.IndexByte(str, ' ') - - // ts := str[:dataIdx] - rest := str[dataIdx+1:] - - assert.Equal(t, "[INFO ] test: this is test: who=programmer why=testing\n", rest) - }) - - t.Run("quotes values with spaces", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - }) - - logger.Info("this is test", "who", "programmer", "why", "testing is fun") - - str := buf.String() - - dataIdx := strings.IndexByte(str, ' ') - - // ts := str[:dataIdx] - rest := str[dataIdx+1:] - - assert.Equal(t, "[INFO ] test: this is test: who=programmer why=\"testing is fun\"\n", rest) - }) - - t.Run("outputs stack traces", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - }) - - logger.Info("who", "programmer", "why", "testing", Stacktrace()) - - lines := strings.Split(buf.String(), "\n") - - require.True(t, len(lines) > 1) - - assert.Equal(t, "github.com/hashicorp/go-hclog.Stacktrace", lines[1]) - }) - - t.Run("outputs stack traces with it's given a name", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - }) - - logger.Info("who", "programmer", "why", "testing", "foo", Stacktrace()) - - lines := strings.Split(buf.String(), "\n") - - require.True(t, len(lines) > 1) - - assert.Equal(t, "github.com/hashicorp/go-hclog.Stacktrace", lines[1]) - }) - - t.Run("includes the caller location", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - IncludeLocation: true, - }) - - logger.Info("this is test", "who", "programmer", "why", "testing is fun") - - str := buf.String() - - dataIdx := strings.IndexByte(str, ' ') - - // ts := str[:dataIdx] - rest := str[dataIdx+1:] - - // This test will break if you move this around, it's line dependent, just fyi - assert.Equal(t, "[INFO ] go-hclog/logger_test.go:100: test: this is test: who=programmer why=\"testing is fun\"\n", rest) - }) - - t.Run("prefixes the name", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - // No name! - Output: &buf, - }) - - logger.Info("this is test") - str := buf.String() - dataIdx := strings.IndexByte(str, ' ') - rest := str[dataIdx+1:] - assert.Equal(t, "[INFO ] this is test\n", rest) - - buf.Reset() - - another := logger.Named("sublogger") - another.Info("this is test") - str = buf.String() - dataIdx = strings.IndexByte(str, ' ') - rest = str[dataIdx+1:] - assert.Equal(t, "[INFO ] sublogger: this is test\n", rest) - }) -} - -func TestLogger_JSON(t *testing.T) { - t.Run("json formatting", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - JSONFormat: true, - }) - - logger.Info("this is test", "who", "programmer", "why", "testing is fun") - - b := buf.Bytes() - - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - t.Fatal(err) - } - - assert.Equal(t, "this is test", raw["@message"]) - assert.Equal(t, "programmer", raw["who"]) - assert.Equal(t, "testing is fun", raw["why"]) - }) - t.Run("json formatting error type", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - JSONFormat: true, - }) - - errMsg := errors.New("this is an error") - logger.Info("this is test", "who", "programmer", "err", errMsg) - - b := buf.Bytes() - - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - t.Fatal(err) - } - - assert.Equal(t, "this is test", raw["@message"]) - assert.Equal(t, "programmer", raw["who"]) - assert.Equal(t, errMsg.Error(), raw["err"]) - }) - t.Run("json formatting custom error type json marshaler", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - JSONFormat: true, - }) - - errMsg := &customErrJSON{"this is an error"} - rawMsg, err := errMsg.MarshalJSON() - if err != nil { - t.Fatal(err) - } - expectedMsg, err := strconv.Unquote(string(rawMsg)) - if err != nil { - t.Fatal(err) - } - - logger.Info("this is test", "who", "programmer", "err", errMsg) - - b := buf.Bytes() - - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - t.Fatal(err) - } - - assert.Equal(t, "this is test", raw["@message"]) - assert.Equal(t, "programmer", raw["who"]) - assert.Equal(t, expectedMsg, raw["err"]) - }) - t.Run("json formatting custom error type text marshaler", func(t *testing.T) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - JSONFormat: true, - }) - - errMsg := &customErrText{"this is an error"} - rawMsg, err := errMsg.MarshalText() - if err != nil { - t.Fatal(err) - } - expectedMsg := string(rawMsg) - - logger.Info("this is test", "who", "programmer", "err", errMsg) - - b := buf.Bytes() - - var raw map[string]interface{} - if err := json.Unmarshal(b, &raw); err != nil { - t.Fatal(err) - } - - assert.Equal(t, "this is test", raw["@message"]) - assert.Equal(t, "programmer", raw["who"]) - assert.Equal(t, expectedMsg, raw["err"]) - }) -} - -type customErrJSON struct { - Message string -} - -// error impl. -func (c *customErrJSON) Error() string { - return c.Message -} - -// json.Marshaler impl. -func (c customErrJSON) MarshalJSON() ([]byte, error) { - return []byte(strconv.Quote(fmt.Sprintf("json-marshaler: %s", c.Message))), nil -} - -type customErrText struct { - Message string -} - -// error impl. -func (c *customErrText) Error() string { - return c.Message -} - -// text.Marshaler impl. -func (c customErrText) MarshalText() ([]byte, error) { - return []byte(fmt.Sprintf("text-marshaler: %s", c.Message)), nil -} - -func BenchmarkLogger(b *testing.B) { - b.Run("info with 10 pairs", func(b *testing.B) { - var buf bytes.Buffer - - logger := New(&LoggerOptions{ - Name: "test", - Output: &buf, - IncludeLocation: true, - }) - - for i := 0; i < b.N; i++ { - logger.Info("this is some message", - "name", "foo", - "what", "benchmarking yourself", - "why", "to see what's slow", - "k4", "value", - "k5", "value", - "k6", "value", - "k7", "value", - "k8", "value", - "k9", "value", - "k10", "value", - ) - } - }) -} diff --git a/vendor/github.com/hashicorp/go-hclog/stacktrace.go b/vendor/github.com/hashicorp/go-hclog/stacktrace.go deleted file mode 100644 index 8af1a3b..0000000 --- a/vendor/github.com/hashicorp/go-hclog/stacktrace.go +++ /dev/null @@ -1,108 +0,0 @@ -// Copyright (c) 2016 Uber Technologies, 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. - -package hclog - -import ( - "bytes" - "runtime" - "strconv" - "strings" - "sync" -) - -var ( - _stacktraceIgnorePrefixes = []string{ - "runtime.goexit", - "runtime.main", - } - _stacktracePool = sync.Pool{ - New: func() interface{} { - return newProgramCounters(64) - }, - } -) - -// A stacktrace gathered by a previous call to log.Stacktrace. If passed -// to a logging function, the stacktrace will be appended. -type CapturedStacktrace string - -// Gather a stacktrace of the current goroutine and return it to be passed -// to a logging function. -func Stacktrace() CapturedStacktrace { - return CapturedStacktrace(takeStacktrace()) -} - -func takeStacktrace() string { - programCounters := _stacktracePool.Get().(*programCounters) - defer _stacktracePool.Put(programCounters) - - var buffer bytes.Buffer - - for { - // Skip the call to runtime.Counters and takeStacktrace so that the - // program counters start at the caller of takeStacktrace. - n := runtime.Callers(2, programCounters.pcs) - if n < cap(programCounters.pcs) { - programCounters.pcs = programCounters.pcs[:n] - break - } - // Don't put the too-short counter slice back into the pool; this lets - // the pool adjust if we consistently take deep stacktraces. - programCounters = newProgramCounters(len(programCounters.pcs) * 2) - } - - i := 0 - frames := runtime.CallersFrames(programCounters.pcs) - for frame, more := frames.Next(); more; frame, more = frames.Next() { - if shouldIgnoreStacktraceFunction(frame.Function) { - continue - } - if i != 0 { - buffer.WriteByte('\n') - } - i++ - buffer.WriteString(frame.Function) - buffer.WriteByte('\n') - buffer.WriteByte('\t') - buffer.WriteString(frame.File) - buffer.WriteByte(':') - buffer.WriteString(strconv.Itoa(int(frame.Line))) - } - - return buffer.String() -} - -func shouldIgnoreStacktraceFunction(function string) bool { - for _, prefix := range _stacktraceIgnorePrefixes { - if strings.HasPrefix(function, prefix) { - return true - } - } - return false -} - -type programCounters struct { - pcs []uintptr -} - -func newProgramCounters(size int) *programCounters { - return &programCounters{make([]uintptr, size)} -} diff --git a/vendor/github.com/hashicorp/go-hclog/stdlog.go b/vendor/github.com/hashicorp/go-hclog/stdlog.go deleted file mode 100644 index 2bb927f..0000000 --- a/vendor/github.com/hashicorp/go-hclog/stdlog.go +++ /dev/null @@ -1,62 +0,0 @@ -package hclog - -import ( - "bytes" - "strings" -) - -// Provides a io.Writer to shim the data out of *log.Logger -// and back into our Logger. This is basically the only way to -// build upon *log.Logger. -type stdlogAdapter struct { - hl Logger - inferLevels bool -} - -// Take the data, infer the levels if configured, and send it through -// a regular Logger -func (s *stdlogAdapter) Write(data []byte) (int, error) { - str := string(bytes.TrimRight(data, " \t\n")) - - if s.inferLevels { - level, str := s.pickLevel(str) - switch level { - case Trace: - s.hl.Trace(str) - case Debug: - s.hl.Debug(str) - case Info: - s.hl.Info(str) - case Warn: - s.hl.Warn(str) - case Error: - s.hl.Error(str) - default: - s.hl.Info(str) - } - } else { - s.hl.Info(str) - } - - return len(data), nil -} - -// Detect, based on conventions, what log level this is -func (s *stdlogAdapter) pickLevel(str string) (Level, string) { - switch { - case strings.HasPrefix(str, "[DEBUG]"): - return Debug, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[TRACE]"): - return Trace, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[INFO]"): - return Info, strings.TrimSpace(str[6:]) - case strings.HasPrefix(str, "[WARN]"): - return Warn, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[ERROR]"): - return Error, strings.TrimSpace(str[7:]) - case strings.HasPrefix(str, "[ERR]"): - return Error, strings.TrimSpace(str[5:]) - default: - return Info, str - } -} diff --git a/vendor/github.com/hashicorp/go-hclog/stdlog_test.go b/vendor/github.com/hashicorp/go-hclog/stdlog_test.go deleted file mode 100644 index 8de180c..0000000 --- a/vendor/github.com/hashicorp/go-hclog/stdlog_test.go +++ /dev/null @@ -1,63 +0,0 @@ -package hclog - -import ( - "testing" - - "github.com/stretchr/testify/assert" -) - -func TestStdlogAdapter(t *testing.T) { - t.Run("picks debug level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[DEBUG] coffee?") - - assert.Equal(t, Debug, level) - assert.Equal(t, "coffee?", rest) - }) - - t.Run("picks trace level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[TRACE] coffee?") - - assert.Equal(t, Trace, level) - assert.Equal(t, "coffee?", rest) - }) - - t.Run("picks info level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[INFO] coffee?") - - assert.Equal(t, Info, level) - assert.Equal(t, "coffee?", rest) - }) - - t.Run("picks warn level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[WARN] coffee?") - - assert.Equal(t, Warn, level) - assert.Equal(t, "coffee?", rest) - }) - - t.Run("picks error level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[ERROR] coffee?") - - assert.Equal(t, Error, level) - assert.Equal(t, "coffee?", rest) - }) - - t.Run("picks error as err level", func(t *testing.T) { - var s stdlogAdapter - - level, rest := s.pickLevel("[ERR] coffee?") - - assert.Equal(t, Error, level) - assert.Equal(t, "coffee?", rest) - }) -} diff --git a/vendor/github.com/hashicorp/go-multierror/.travis.yml b/vendor/github.com/hashicorp/go-multierror/.travis.yml deleted file mode 100644 index 304a835..0000000 --- a/vendor/github.com/hashicorp/go-multierror/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -sudo: false - -language: go - -go: - - 1.x - -branches: - only: - - master - -script: make test testrace diff --git a/vendor/github.com/hashicorp/go-multierror/LICENSE b/vendor/github.com/hashicorp/go-multierror/LICENSE deleted file mode 100644 index 82b4de9..0000000 --- a/vendor/github.com/hashicorp/go-multierror/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/go-multierror/Makefile b/vendor/github.com/hashicorp/go-multierror/Makefile deleted file mode 100644 index b97cd6e..0000000 --- a/vendor/github.com/hashicorp/go-multierror/Makefile +++ /dev/null @@ -1,31 +0,0 @@ -TEST?=./... - -default: test - -# test runs the test suite and vets the code. -test: generate - @echo "==> Running tests..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -parallel=10 ${TESTARGS} - -# testrace runs the race checker -testrace: generate - @echo "==> Running tests (race)..." - @go list $(TEST) \ - | grep -v "/vendor/" \ - | xargs -n1 go test -timeout=60s -race ${TESTARGS} - -# updatedeps installs all the dependencies needed to run and build. -updatedeps: - @sh -c "'${CURDIR}/scripts/deps.sh' '${NAME}'" - -# generate runs `go generate` to build the dynamically generated source files. -generate: - @echo "==> Generating..." - @find . -type f -name '.DS_Store' -delete - @go list ./... \ - | grep -v "/vendor/" \ - | xargs -n1 go generate - -.PHONY: default test testrace updatedeps generate diff --git a/vendor/github.com/hashicorp/go-multierror/README.md b/vendor/github.com/hashicorp/go-multierror/README.md deleted file mode 100644 index ead5830..0000000 --- a/vendor/github.com/hashicorp/go-multierror/README.md +++ /dev/null @@ -1,97 +0,0 @@ -# go-multierror - -[![Build Status](http://img.shields.io/travis/hashicorp/go-multierror.svg?style=flat-square)][travis] -[![Go Documentation](http://img.shields.io/badge/go-documentation-blue.svg?style=flat-square)][godocs] - -[travis]: https://travis-ci.org/hashicorp/go-multierror -[godocs]: https://godoc.org/github.com/hashicorp/go-multierror - -`go-multierror` is a package for Go that provides a mechanism for -representing a list of `error` values as a single `error`. - -This allows a function in Go to return an `error` that might actually -be a list of errors. If the caller knows this, they can unwrap the -list and access the errors. If the caller doesn't know, the error -formats to a nice human-readable format. - -`go-multierror` implements the -[errwrap](https://github.com/hashicorp/errwrap) interface so that it can -be used with that library, as well. - -## Installation and Docs - -Install using `go get github.com/hashicorp/go-multierror`. - -Full documentation is available at -http://godoc.org/github.com/hashicorp/go-multierror - -## Usage - -go-multierror is easy to use and purposely built to be unobtrusive in -existing Go applications/libraries that may not be aware of it. - -**Building a list of errors** - -The `Append` function is used to create a list of errors. This function -behaves a lot like the Go built-in `append` function: it doesn't matter -if the first argument is nil, a `multierror.Error`, or any other `error`, -the function behaves as you would expect. - -```go -var result error - -if err := step1(); err != nil { - result = multierror.Append(result, err) -} -if err := step2(); err != nil { - result = multierror.Append(result, err) -} - -return result -``` - -**Customizing the formatting of the errors** - -By specifying a custom `ErrorFormat`, you can customize the format -of the `Error() string` function: - -```go -var result *multierror.Error - -// ... accumulate errors here, maybe using Append - -if result != nil { - result.ErrorFormat = func([]error) string { - return "errors!" - } -} -``` - -**Accessing the list of errors** - -`multierror.Error` implements `error` so if the caller doesn't know about -multierror, it will work just fine. But if you're aware a multierror might -be returned, you can use type switches to access the list of errors: - -```go -if err := something(); err != nil { - if merr, ok := err.(*multierror.Error); ok { - // Use merr.Errors - } -} -``` - -**Returning a multierror only if there are errors** - -If you build a `multierror.Error`, you can use the `ErrorOrNil` function -to return an `error` implementation only if there are errors to return: - -```go -var result *multierror.Error - -// ... accumulate errors here - -// Return the `error` only if errors were added to the multierror, otherwise -// return nil since there are no errors. -return result.ErrorOrNil() -``` diff --git a/vendor/github.com/hashicorp/go-multierror/append.go b/vendor/github.com/hashicorp/go-multierror/append.go deleted file mode 100644 index 775b6e7..0000000 --- a/vendor/github.com/hashicorp/go-multierror/append.go +++ /dev/null @@ -1,41 +0,0 @@ -package multierror - -// Append is a helper function that will append more errors -// onto an Error in order to create a larger multi-error. -// -// If err is not a multierror.Error, then it will be turned into -// one. If any of the errs are multierr.Error, they will be flattened -// one level into err. -func Append(err error, errs ...error) *Error { - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Go through each error and flatten - for _, e := range errs { - switch e := e.(type) { - case *Error: - if e != nil { - err.Errors = append(err.Errors, e.Errors...) - } - default: - if e != nil { - err.Errors = append(err.Errors, e) - } - } - } - - return err - default: - newErrs := make([]error, 0, len(errs)+1) - if err != nil { - newErrs = append(newErrs, err) - } - newErrs = append(newErrs, errs...) - - return Append(&Error{}, newErrs...) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/append_test.go b/vendor/github.com/hashicorp/go-multierror/append_test.go deleted file mode 100644 index 58ddafa..0000000 --- a/vendor/github.com/hashicorp/go-multierror/append_test.go +++ /dev/null @@ -1,82 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestAppend_Error(t *testing.T) { - original := &Error{ - Errors: []error{errors.New("foo")}, - } - - result := Append(original, errors.New("bar")) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - original = &Error{} - result = Append(original, errors.New("bar")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - // Test when a typed nil is passed - var e *Error - result = Append(e, errors.New("baz")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } - - // Test flattening - original = &Error{ - Errors: []error{errors.New("foo")}, - } - - result = Append(original, Append(nil, errors.New("foo"), errors.New("bar"))) - if len(result.Errors) != 3 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NilError(t *testing.T) { - var err error - result := Append(err, errors.New("bar")) - if len(result.Errors) != 1 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NilErrorArg(t *testing.T) { - var err error - var nilErr *Error - result := Append(err, nilErr) - if len(result.Errors) != 0 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NilErrorIfaceArg(t *testing.T) { - var err error - var nilErr error - result := Append(err, nilErr) - if len(result.Errors) != 0 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NonError(t *testing.T) { - original := errors.New("foo") - result := Append(original, errors.New("bar")) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} - -func TestAppend_NonError_Error(t *testing.T) { - original := errors.New("foo") - result := Append(original, Append(nil, errors.New("bar"))) - if len(result.Errors) != 2 { - t.Fatalf("wrong len: %d", len(result.Errors)) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/flatten.go b/vendor/github.com/hashicorp/go-multierror/flatten.go deleted file mode 100644 index aab8e9a..0000000 --- a/vendor/github.com/hashicorp/go-multierror/flatten.go +++ /dev/null @@ -1,26 +0,0 @@ -package multierror - -// Flatten flattens the given error, merging any *Errors together into -// a single *Error. -func Flatten(err error) error { - // If it isn't an *Error, just return the error as-is - if _, ok := err.(*Error); !ok { - return err - } - - // Otherwise, make the result and flatten away! - flatErr := new(Error) - flatten(err, flatErr) - return flatErr -} - -func flatten(err error, flatErr *Error) { - switch err := err.(type) { - case *Error: - for _, e := range err.Errors { - flatten(e, flatErr) - } - default: - flatErr.Errors = append(flatErr.Errors, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/flatten_test.go b/vendor/github.com/hashicorp/go-multierror/flatten_test.go deleted file mode 100644 index 9fbacad..0000000 --- a/vendor/github.com/hashicorp/go-multierror/flatten_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package multierror - -import ( - "errors" - "fmt" - "reflect" - "strings" - "testing" -) - -func TestFlatten(t *testing.T) { - original := &Error{ - Errors: []error{ - errors.New("one"), - &Error{ - Errors: []error{ - errors.New("two"), - &Error{ - Errors: []error{ - errors.New("three"), - }, - }, - }, - }, - }, - } - - expected := strings.TrimSpace(` -3 errors occurred: - -* one -* two -* three - `) - actual := fmt.Sprintf("%s", Flatten(original)) - - if expected != actual { - t.Fatalf("expected: %s, got: %s", expected, actual) - } -} - -func TestFlatten_nonError(t *testing.T) { - err := errors.New("foo") - actual := Flatten(err) - if !reflect.DeepEqual(actual, err) { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/format.go b/vendor/github.com/hashicorp/go-multierror/format.go deleted file mode 100644 index 6c7a3cc..0000000 --- a/vendor/github.com/hashicorp/go-multierror/format.go +++ /dev/null @@ -1,27 +0,0 @@ -package multierror - -import ( - "fmt" - "strings" -) - -// ErrorFormatFunc is a function callback that is called by Error to -// turn the list of errors into a string. -type ErrorFormatFunc func([]error) string - -// ListFormatFunc is a basic formatter that outputs the number of errors -// that occurred along with a bullet point list of the errors. -func ListFormatFunc(es []error) string { - if len(es) == 1 { - return fmt.Sprintf("1 error occurred:\n\n* %s", es[0]) - } - - points := make([]string, len(es)) - for i, err := range es { - points[i] = fmt.Sprintf("* %s", err) - } - - return fmt.Sprintf( - "%d errors occurred:\n\n%s", - len(es), strings.Join(points, "\n")) -} diff --git a/vendor/github.com/hashicorp/go-multierror/format_test.go b/vendor/github.com/hashicorp/go-multierror/format_test.go deleted file mode 100644 index 3359e02..0000000 --- a/vendor/github.com/hashicorp/go-multierror/format_test.go +++ /dev/null @@ -1,38 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestListFormatFuncSingle(t *testing.T) { - expected := `1 error occurred: - -* foo` - - errors := []error{ - errors.New("foo"), - } - - actual := ListFormatFunc(errors) - if actual != expected { - t.Fatalf("bad: %#v", actual) - } -} - -func TestListFormatFuncMultiple(t *testing.T) { - expected := `2 errors occurred: - -* foo -* bar` - - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - actual := ListFormatFunc(errors) - if actual != expected { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/multierror.go b/vendor/github.com/hashicorp/go-multierror/multierror.go deleted file mode 100644 index 89b1422..0000000 --- a/vendor/github.com/hashicorp/go-multierror/multierror.go +++ /dev/null @@ -1,51 +0,0 @@ -package multierror - -import ( - "fmt" -) - -// Error is an error type to track multiple errors. This is used to -// accumulate errors in cases and return them as a single "error". -type Error struct { - Errors []error - ErrorFormat ErrorFormatFunc -} - -func (e *Error) Error() string { - fn := e.ErrorFormat - if fn == nil { - fn = ListFormatFunc - } - - return fn(e.Errors) -} - -// ErrorOrNil returns an error interface if this Error represents -// a list of errors, or returns nil if the list of errors is empty. This -// function is useful at the end of accumulation to make sure that the value -// returned represents the existence of errors. -func (e *Error) ErrorOrNil() error { - if e == nil { - return nil - } - if len(e.Errors) == 0 { - return nil - } - - return e -} - -func (e *Error) GoString() string { - return fmt.Sprintf("*%#v", *e) -} - -// WrappedErrors returns the list of errors that this Error is wrapping. -// It is an implementation of the errwrap.Wrapper interface so that -// multierror.Error can be used with that library. -// -// This method is not safe to be called concurrently and is no different -// than accessing the Errors field directly. It is implemented only to -// satisfy the errwrap.Wrapper interface. -func (e *Error) WrappedErrors() []error { - return e.Errors -} diff --git a/vendor/github.com/hashicorp/go-multierror/multierror_test.go b/vendor/github.com/hashicorp/go-multierror/multierror_test.go deleted file mode 100644 index 5567d1c..0000000 --- a/vendor/github.com/hashicorp/go-multierror/multierror_test.go +++ /dev/null @@ -1,70 +0,0 @@ -package multierror - -import ( - "errors" - "reflect" - "testing" -) - -func TestError_Impl(t *testing.T) { - var _ error = new(Error) -} - -func TestErrorError_custom(t *testing.T) { - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - fn := func(es []error) string { - return "foo" - } - - multi := &Error{Errors: errors, ErrorFormat: fn} - if multi.Error() != "foo" { - t.Fatalf("bad: %s", multi.Error()) - } -} - -func TestErrorError_default(t *testing.T) { - expected := `2 errors occurred: - -* foo -* bar` - - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - multi := &Error{Errors: errors} - if multi.Error() != expected { - t.Fatalf("bad: %s", multi.Error()) - } -} - -func TestErrorErrorOrNil(t *testing.T) { - err := new(Error) - if err.ErrorOrNil() != nil { - t.Fatalf("bad: %#v", err.ErrorOrNil()) - } - - err.Errors = []error{errors.New("foo")} - if v := err.ErrorOrNil(); v == nil { - t.Fatal("should not be nil") - } else if !reflect.DeepEqual(v, err) { - t.Fatalf("bad: %#v", v) - } -} - -func TestErrorWrappedErrors(t *testing.T) { - errors := []error{ - errors.New("foo"), - errors.New("bar"), - } - - multi := &Error{Errors: errors} - if !reflect.DeepEqual(multi.Errors, multi.WrappedErrors()) { - t.Fatalf("bad: %s", multi.WrappedErrors()) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/prefix.go b/vendor/github.com/hashicorp/go-multierror/prefix.go deleted file mode 100644 index 5c477ab..0000000 --- a/vendor/github.com/hashicorp/go-multierror/prefix.go +++ /dev/null @@ -1,37 +0,0 @@ -package multierror - -import ( - "fmt" - - "github.com/hashicorp/errwrap" -) - -// Prefix is a helper function that will prefix some text -// to the given error. If the error is a multierror.Error, then -// it will be prefixed to each wrapped error. -// -// This is useful to use when appending multiple multierrors -// together in order to give better scoping. -func Prefix(err error, prefix string) error { - if err == nil { - return nil - } - - format := fmt.Sprintf("%s {{err}}", prefix) - switch err := err.(type) { - case *Error: - // Typed nils can reach here, so initialize if we are nil - if err == nil { - err = new(Error) - } - - // Wrap each of the errors - for i, e := range err.Errors { - err.Errors[i] = errwrap.Wrapf(format, e) - } - - return err - default: - return errwrap.Wrapf(format, err) - } -} diff --git a/vendor/github.com/hashicorp/go-multierror/prefix_test.go b/vendor/github.com/hashicorp/go-multierror/prefix_test.go deleted file mode 100644 index 1d4a6f6..0000000 --- a/vendor/github.com/hashicorp/go-multierror/prefix_test.go +++ /dev/null @@ -1,33 +0,0 @@ -package multierror - -import ( - "errors" - "testing" -) - -func TestPrefix_Error(t *testing.T) { - original := &Error{ - Errors: []error{errors.New("foo")}, - } - - result := Prefix(original, "bar") - if result.(*Error).Errors[0].Error() != "bar foo" { - t.Fatalf("bad: %s", result) - } -} - -func TestPrefix_NilError(t *testing.T) { - var err error - result := Prefix(err, "bar") - if result != nil { - t.Fatalf("bad: %#v", result) - } -} - -func TestPrefix_NonError(t *testing.T) { - original := errors.New("foo") - result := Prefix(original, "bar") - if result.Error() != "bar foo" { - t.Fatalf("bad: %s", result) - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/.gitignore b/vendor/github.com/hashicorp/go-plugin/.gitignore deleted file mode 100644 index e43b0f9..0000000 --- a/vendor/github.com/hashicorp/go-plugin/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.DS_Store diff --git a/vendor/github.com/hashicorp/go-plugin/LICENSE b/vendor/github.com/hashicorp/go-plugin/LICENSE deleted file mode 100644 index 82b4de9..0000000 --- a/vendor/github.com/hashicorp/go-plugin/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/go-plugin/README.md b/vendor/github.com/hashicorp/go-plugin/README.md deleted file mode 100644 index e4558db..0000000 --- a/vendor/github.com/hashicorp/go-plugin/README.md +++ /dev/null @@ -1,168 +0,0 @@ -# Go Plugin System over RPC - -`go-plugin` is a Go (golang) plugin system over RPC. It is the plugin system -that has been in use by HashiCorp tooling for over 4 years. While initially -created for [Packer](https://www.packer.io), it is additionally in use by -[Terraform](https://www.terraform.io), [Nomad](https://www.nomadproject.io), and -[Vault](https://www.vaultproject.io). - -While the plugin system is over RPC, it is currently only designed to work -over a local [reliable] network. Plugins over a real network are not supported -and will lead to unexpected behavior. - -This plugin system has been used on millions of machines across many different -projects and has proven to be battle hardened and ready for production use. - -## Features - -The HashiCorp plugin system supports a number of features: - -**Plugins are Go interface implementations.** This makes writing and consuming -plugins feel very natural. To a plugin author: you just implement an -interface as if it were going to run in the same process. For a plugin user: -you just use and call functions on an interface as if it were in the same -process. This plugin system handles the communication in between. - -**Cross-language support.** Plugins can be written (and consumed) by -almost every major language. This library supports serving plugins via -[gRPC](http://www.grpc.io). gRPC-based plugins enable plugins to be written -in any language. - -**Complex arguments and return values are supported.** This library -provides APIs for handling complex arguments and return values such -as interfaces, `io.Reader/Writer`, etc. We do this by giving you a library -(`MuxBroker`) for creating new connections between the client/server to -serve additional interfaces or transfer raw data. - -**Bidirectional communication.** Because the plugin system supports -complex arguments, the host process can send it interface implementations -and the plugin can call back into the host process. - -**Built-in Logging.** Any plugins that use the `log` standard library -will have log data automatically sent to the host process. The host -process will mirror this output prefixed with the path to the plugin -binary. This makes debugging with plugins simple. If the host system -uses [hclog](https://github.com/hashicorp/go-hclog) then the log data -will be structured. If the plugin also uses hclog, logs from the plugin -will be sent to the host hclog and be structured. - -**Protocol Versioning.** A very basic "protocol version" is supported that -can be incremented to invalidate any previous plugins. This is useful when -interface signatures are changing, protocol level changes are necessary, -etc. When a protocol version is incompatible, a human friendly error -message is shown to the end user. - -**Stdout/Stderr Syncing.** While plugins are subprocesses, they can continue -to use stdout/stderr as usual and the output will get mirrored back to -the host process. The host process can control what `io.Writer` these -streams go to to prevent this from happening. - -**TTY Preservation.** Plugin subprocesses are connected to the identical -stdin file descriptor as the host process, allowing software that requires -a TTY to work. For example, a plugin can execute `ssh` and even though there -are multiple subprocesses and RPC happening, it will look and act perfectly -to the end user. - -**Host upgrade while a plugin is running.** Plugins can be "reattached" -so that the host process can be upgraded while the plugin is still running. -This requires the host/plugin to know this is possible and daemonize -properly. `NewClient` takes a `ReattachConfig` to determine if and how to -reattach. - -**Cryptographically Secure Plugins.** Plugins can be verified with an expected -checksum and RPC communications can be configured to use TLS. The host process -must be properly secured to protect this configuration. - -## Architecture - -The HashiCorp plugin system works by launching subprocesses and communicating -over RPC (using standard `net/rpc` or [gRPC](http://www.grpc.io)). A single -connection is made between any plugin and the host process. For net/rpc-based -plugins, we use a [connection multiplexing](https://github.com/hashicorp/yamux) -library to multiplex any other connections on top. For gRPC-based plugins, -the HTTP2 protocol handles multiplexing. - -This architecture has a number of benefits: - - * Plugins can't crash your host process: A panic in a plugin doesn't - panic the plugin user. - - * Plugins are very easy to write: just write a Go application and `go build`. - Or use any other language to write a gRPC server with a tiny amount of - boilerplate to support go-plugin. - - * Plugins are very easy to install: just put the binary in a location where - the host will find it (depends on the host but this library also provides - helpers), and the plugin host handles the rest. - - * Plugins can be relatively secure: The plugin only has access to the - interfaces and args given to it, not to the entire memory space of the - process. Additionally, go-plugin can communicate with the plugin over - TLS. - -## Usage - -To use the plugin system, you must take the following steps. These are -high-level steps that must be done. Examples are available in the -`examples/` directory. - - 1. Choose the interface(s) you want to expose for plugins. - - 2. For each interface, implement an implementation of that interface - that communicates over a `net/rpc` connection or other a - [gRPC](http://www.grpc.io) connection or both. You'll have to implement - both a client and server implementation. - - 3. Create a `Plugin` implementation that knows how to create the RPC - client/server for a given plugin type. - - 4. Plugin authors call `plugin.Serve` to serve a plugin from the - `main` function. - - 5. Plugin users use `plugin.Client` to launch a subprocess and request - an interface implementation over RPC. - -That's it! In practice, step 2 is the most tedious and time consuming step. -Even so, it isn't very difficult and you can see examples in the `examples/` -directory as well as throughout our various open source projects. - -For complete API documentation, see [GoDoc](https://godoc.org/github.com/hashicorp/go-plugin). - -## Roadmap - -Our plugin system is constantly evolving. As we use the plugin system for -new projects or for new features in existing projects, we constantly find -improvements we can make. - -At this point in time, the roadmap for the plugin system is: - -**Semantic Versioning.** Plugins will be able to implement a semantic version. -This plugin system will give host processes a system for constraining -versions. This is in addition to the protocol versioning already present -which is more for larger underlying changes. - -**Plugin fetching.** We will integrate with [go-getter](https://github.com/hashicorp/go-getter) -to support automatic download + install of plugins. Paired with cryptographically -secure plugins (above), we can make this a safe operation for an amazing -user experience. - -## What About Shared Libraries? - -When we started using plugins (late 2012, early 2013), plugins over RPC -were the only option since Go didn't support dynamic library loading. Today, -Go still doesn't support dynamic library loading, but they do intend to. -Since 2012, our plugin system has stabilized from millions of users using it, -and has many benefits we've come to value greatly. - -For example, we intend to use this plugin system in -[Vault](https://www.vaultproject.io), and dynamic library loading will -simply never be acceptable in Vault for security reasons. That is an extreme -example, but we believe our library system has more upsides than downsides -over dynamic library loading and since we've had it built and tested for years, -we'll likely continue to use it. - -Shared libraries have one major advantage over our system which is much -higher performance. In real world scenarios across our various tools, -we've never required any more performance out of our plugin system and it -has seen very high throughput, so this isn't a concern for us at the moment. - diff --git a/vendor/github.com/hashicorp/go-plugin/client.go b/vendor/github.com/hashicorp/go-plugin/client.go deleted file mode 100644 index b3e3b78..0000000 --- a/vendor/github.com/hashicorp/go-plugin/client.go +++ /dev/null @@ -1,794 +0,0 @@ -package plugin - -import ( - "bufio" - "context" - "crypto/subtle" - "crypto/tls" - "errors" - "fmt" - "hash" - "io" - "io/ioutil" - "log" - "net" - "os" - "os/exec" - "path/filepath" - "strconv" - "strings" - "sync" - "sync/atomic" - "time" - "unicode" - - hclog "github.com/hashicorp/go-hclog" -) - -// If this is 1, then we've called CleanupClients. This can be used -// by plugin RPC implementations to change error behavior since you -// can expected network connection errors at this point. This should be -// read by using sync/atomic. -var Killed uint32 = 0 - -// This is a slice of the "managed" clients which are cleaned up when -// calling Cleanup -var managedClients = make([]*Client, 0, 5) -var managedClientsLock sync.Mutex - -// Error types -var ( - // ErrProcessNotFound is returned when a client is instantiated to - // reattach to an existing process and it isn't found. - ErrProcessNotFound = errors.New("Reattachment process not found") - - // ErrChecksumsDoNotMatch is returned when binary's checksum doesn't match - // the one provided in the SecureConfig. - ErrChecksumsDoNotMatch = errors.New("checksums did not match") - - // ErrSecureNoChecksum is returned when an empty checksum is provided to the - // SecureConfig. - ErrSecureConfigNoChecksum = errors.New("no checksum provided") - - // ErrSecureNoHash is returned when a nil Hash object is provided to the - // SecureConfig. - ErrSecureConfigNoHash = errors.New("no hash implementation provided") - - // ErrSecureConfigAndReattach is returned when both Reattach and - // SecureConfig are set. - ErrSecureConfigAndReattach = errors.New("only one of Reattach or SecureConfig can be set") -) - -// Client handles the lifecycle of a plugin application. It launches -// plugins, connects to them, dispenses interface implementations, and handles -// killing the process. -// -// Plugin hosts should use one Client for each plugin executable. To -// dispense a plugin type, use the `Client.Client` function, and then -// cal `Dispense`. This awkward API is mostly historical but is used to split -// the client that deals with subprocess management and the client that -// does RPC management. -// -// See NewClient and ClientConfig for using a Client. -type Client struct { - config *ClientConfig - exited bool - doneLogging chan struct{} - l sync.Mutex - address net.Addr - process *os.Process - client ClientProtocol - protocol Protocol - logger hclog.Logger - doneCtx context.Context -} - -// ClientConfig is the configuration used to initialize a new -// plugin client. After being used to initialize a plugin client, -// that configuration must not be modified again. -type ClientConfig struct { - // HandshakeConfig is the configuration that must match servers. - HandshakeConfig - - // Plugins are the plugins that can be consumed. - Plugins map[string]Plugin - - // One of the following must be set, but not both. - // - // Cmd is the unstarted subprocess for starting the plugin. If this is - // set, then the Client starts the plugin process on its own and connects - // to it. - // - // Reattach is configuration for reattaching to an existing plugin process - // that is already running. This isn't common. - Cmd *exec.Cmd - Reattach *ReattachConfig - - // SecureConfig is configuration for verifying the integrity of the - // executable. It can not be used with Reattach. - SecureConfig *SecureConfig - - // TLSConfig is used to enable TLS on the RPC client. - TLSConfig *tls.Config - - // Managed represents if the client should be managed by the - // plugin package or not. If true, then by calling CleanupClients, - // it will automatically be cleaned up. Otherwise, the client - // user is fully responsible for making sure to Kill all plugin - // clients. By default the client is _not_ managed. - Managed bool - - // The minimum and maximum port to use for communicating with - // the subprocess. If not set, this defaults to 10,000 and 25,000 - // respectively. - MinPort, MaxPort uint - - // StartTimeout is the timeout to wait for the plugin to say it - // has started successfully. - StartTimeout time.Duration - - // If non-nil, then the stderr of the client will be written to here - // (as well as the log). This is the original os.Stderr of the subprocess. - // This isn't the output of synced stderr. - Stderr io.Writer - - // SyncStdout, SyncStderr can be set to override the - // respective os.Std* values in the plugin. Care should be taken to - // avoid races here. If these are nil, then this will automatically be - // hooked up to os.Stdin, Stdout, and Stderr, respectively. - // - // If the default values (nil) are used, then this package will not - // sync any of these streams. - SyncStdout io.Writer - SyncStderr io.Writer - - // AllowedProtocols is a list of allowed protocols. If this isn't set, - // then only netrpc is allowed. This is so that older go-plugin systems - // can show friendly errors if they see a plugin with an unknown - // protocol. - // - // By setting this, you can cause an error immediately on plugin start - // if an unsupported protocol is used with a good error message. - // - // If this isn't set at all (nil value), then only net/rpc is accepted. - // This is done for legacy reasons. You must explicitly opt-in to - // new protocols. - AllowedProtocols []Protocol - - // Logger is the logger that the client will used. If none is provided, - // it will default to hclog's default logger. - Logger hclog.Logger -} - -// ReattachConfig is used to configure a client to reattach to an -// already-running plugin process. You can retrieve this information by -// calling ReattachConfig on Client. -type ReattachConfig struct { - Protocol Protocol - Addr net.Addr - Pid int -} - -// SecureConfig is used to configure a client to verify the integrity of an -// executable before running. It does this by verifying the checksum is -// expected. Hash is used to specify the hashing method to use when checksumming -// the file. The configuration is verified by the client by calling the -// SecureConfig.Check() function. -// -// The host process should ensure the checksum was provided by a trusted and -// authoritative source. The binary should be installed in such a way that it -// can not be modified by an unauthorized user between the time of this check -// and the time of execution. -type SecureConfig struct { - Checksum []byte - Hash hash.Hash -} - -// Check takes the filepath to an executable and returns true if the checksum of -// the file matches the checksum provided in the SecureConfig. -func (s *SecureConfig) Check(filePath string) (bool, error) { - if len(s.Checksum) == 0 { - return false, ErrSecureConfigNoChecksum - } - - if s.Hash == nil { - return false, ErrSecureConfigNoHash - } - - file, err := os.Open(filePath) - if err != nil { - return false, err - } - defer file.Close() - - _, err = io.Copy(s.Hash, file) - if err != nil { - return false, err - } - - sum := s.Hash.Sum(nil) - - return subtle.ConstantTimeCompare(sum, s.Checksum) == 1, nil -} - -// This makes sure all the managed subprocesses are killed and properly -// logged. This should be called before the parent process running the -// plugins exits. -// -// This must only be called _once_. -func CleanupClients() { - // Set the killed to true so that we don't get unexpected panics - atomic.StoreUint32(&Killed, 1) - - // Kill all the managed clients in parallel and use a WaitGroup - // to wait for them all to finish up. - var wg sync.WaitGroup - managedClientsLock.Lock() - for _, client := range managedClients { - wg.Add(1) - - go func(client *Client) { - client.Kill() - wg.Done() - }(client) - } - managedClientsLock.Unlock() - - log.Println("[DEBUG] plugin: waiting for all plugin processes to complete...") - wg.Wait() -} - -// Creates a new plugin client which manages the lifecycle of an external -// plugin and gets the address for the RPC connection. -// -// The client must be cleaned up at some point by calling Kill(). If -// the client is a managed client (created with NewManagedClient) you -// can just call CleanupClients at the end of your program and they will -// be properly cleaned. -func NewClient(config *ClientConfig) (c *Client) { - if config.MinPort == 0 && config.MaxPort == 0 { - config.MinPort = 10000 - config.MaxPort = 25000 - } - - if config.StartTimeout == 0 { - config.StartTimeout = 1 * time.Minute - } - - if config.Stderr == nil { - config.Stderr = ioutil.Discard - } - - if config.SyncStdout == nil { - config.SyncStdout = ioutil.Discard - } - if config.SyncStderr == nil { - config.SyncStderr = ioutil.Discard - } - - if config.AllowedProtocols == nil { - config.AllowedProtocols = []Protocol{ProtocolNetRPC} - } - - if config.Logger == nil { - config.Logger = hclog.New(&hclog.LoggerOptions{ - Output: hclog.DefaultOutput, - Level: hclog.Trace, - Name: "plugin", - }) - } - - c = &Client{ - config: config, - logger: config.Logger, - } - if config.Managed { - managedClientsLock.Lock() - managedClients = append(managedClients, c) - managedClientsLock.Unlock() - } - - return -} - -// Client returns the protocol client for this connection. -// -// Subsequent calls to this will return the same client. -func (c *Client) Client() (ClientProtocol, error) { - _, err := c.Start() - if err != nil { - return nil, err - } - - c.l.Lock() - defer c.l.Unlock() - - if c.client != nil { - return c.client, nil - } - - switch c.protocol { - case ProtocolNetRPC: - c.client, err = newRPCClient(c) - - case ProtocolGRPC: - c.client, err = newGRPCClient(c.doneCtx, c) - - default: - return nil, fmt.Errorf("unknown server protocol: %s", c.protocol) - } - - if err != nil { - c.client = nil - return nil, err - } - - return c.client, nil -} - -// Tells whether or not the underlying process has exited. -func (c *Client) Exited() bool { - c.l.Lock() - defer c.l.Unlock() - return c.exited -} - -// End the executing subprocess (if it is running) and perform any cleanup -// tasks necessary such as capturing any remaining logs and so on. -// -// This method blocks until the process successfully exits. -// -// This method can safely be called multiple times. -func (c *Client) Kill() { - // Grab a lock to read some private fields. - c.l.Lock() - process := c.process - addr := c.address - doneCh := c.doneLogging - c.l.Unlock() - - // If there is no process, we never started anything. Nothing to kill. - if process == nil { - return - } - - // We need to check for address here. It is possible that the plugin - // started (process != nil) but has no address (addr == nil) if the - // plugin failed at startup. If we do have an address, we need to close - // the plugin net connections. - graceful := false - if addr != nil { - // Close the client to cleanly exit the process. - client, err := c.Client() - if err == nil { - err = client.Close() - - // If there is no error, then we attempt to wait for a graceful - // exit. If there was an error, we assume that graceful cleanup - // won't happen and just force kill. - graceful = err == nil - if err != nil { - // If there was an error just log it. We're going to force - // kill in a moment anyways. - c.logger.Warn("error closing client during Kill", "err", err) - } - } - } - - // If we're attempting a graceful exit, then we wait for a short period - // of time to allow that to happen. To wait for this we just wait on the - // doneCh which would be closed if the process exits. - if graceful { - select { - case <-doneCh: - return - case <-time.After(250 * time.Millisecond): - } - } - - // If graceful exiting failed, just kill it - process.Kill() - - // Wait for the client to finish logging so we have a complete log - <-doneCh -} - -// Starts the underlying subprocess, communicating with it to negotiate -// a port for RPC connections, and returning the address to connect via RPC. -// -// This method is safe to call multiple times. Subsequent calls have no effect. -// Once a client has been started once, it cannot be started again, even if -// it was killed. -func (c *Client) Start() (addr net.Addr, err error) { - c.l.Lock() - defer c.l.Unlock() - - if c.address != nil { - return c.address, nil - } - - // If one of cmd or reattach isn't set, then it is an error. We wrap - // this in a {} for scoping reasons, and hopeful that the escape - // analysis will pop the stock here. - { - cmdSet := c.config.Cmd != nil - attachSet := c.config.Reattach != nil - secureSet := c.config.SecureConfig != nil - if cmdSet == attachSet { - return nil, fmt.Errorf("Only one of Cmd or Reattach must be set") - } - - if secureSet && attachSet { - return nil, ErrSecureConfigAndReattach - } - } - - // Create the logging channel for when we kill - c.doneLogging = make(chan struct{}) - // Create a context for when we kill - var ctxCancel context.CancelFunc - c.doneCtx, ctxCancel = context.WithCancel(context.Background()) - - if c.config.Reattach != nil { - // Verify the process still exists. If not, then it is an error - p, err := os.FindProcess(c.config.Reattach.Pid) - if err != nil { - return nil, err - } - - // Attempt to connect to the addr since on Unix systems FindProcess - // doesn't actually return an error if it can't find the process. - conn, err := net.Dial( - c.config.Reattach.Addr.Network(), - c.config.Reattach.Addr.String()) - if err != nil { - p.Kill() - return nil, ErrProcessNotFound - } - conn.Close() - - // Goroutine to mark exit status - go func(pid int) { - // Wait for the process to die - pidWait(pid) - - // Log so we can see it - c.logger.Debug("reattached plugin process exited") - - // Mark it - c.l.Lock() - defer c.l.Unlock() - c.exited = true - - // Close the logging channel since that doesn't work on reattach - close(c.doneLogging) - - // Cancel the context - ctxCancel() - }(p.Pid) - - // Set the address and process - c.address = c.config.Reattach.Addr - c.process = p - c.protocol = c.config.Reattach.Protocol - if c.protocol == "" { - // Default the protocol to net/rpc for backwards compatibility - c.protocol = ProtocolNetRPC - } - - return c.address, nil - } - - env := []string{ - fmt.Sprintf("%s=%s", c.config.MagicCookieKey, c.config.MagicCookieValue), - fmt.Sprintf("PLUGIN_MIN_PORT=%d", c.config.MinPort), - fmt.Sprintf("PLUGIN_MAX_PORT=%d", c.config.MaxPort), - } - - stdout_r, stdout_w := io.Pipe() - stderr_r, stderr_w := io.Pipe() - - cmd := c.config.Cmd - cmd.Env = append(cmd.Env, os.Environ()...) - cmd.Env = append(cmd.Env, env...) - cmd.Stdin = os.Stdin - cmd.Stderr = stderr_w - cmd.Stdout = stdout_w - - if c.config.SecureConfig != nil { - if ok, err := c.config.SecureConfig.Check(cmd.Path); err != nil { - return nil, fmt.Errorf("error verifying checksum: %s", err) - } else if !ok { - return nil, ErrChecksumsDoNotMatch - } - } - - c.logger.Debug("starting plugin", "path", cmd.Path, "args", cmd.Args) - err = cmd.Start() - if err != nil { - return - } - - // Set the process - c.process = cmd.Process - - // Make sure the command is properly cleaned up if there is an error - defer func() { - r := recover() - - if err != nil || r != nil { - cmd.Process.Kill() - } - - if r != nil { - panic(r) - } - }() - - // Start goroutine to wait for process to exit - exitCh := make(chan struct{}) - go func() { - // Make sure we close the write end of our stderr/stdout so - // that the readers send EOF properly. - defer stderr_w.Close() - defer stdout_w.Close() - - // Wait for the command to end. - cmd.Wait() - - // Log and make sure to flush the logs write away - c.logger.Debug("plugin process exited", "path", cmd.Path) - os.Stderr.Sync() - - // Mark that we exited - close(exitCh) - - // Cancel the context, marking that we exited - ctxCancel() - - // Set that we exited, which takes a lock - c.l.Lock() - defer c.l.Unlock() - c.exited = true - }() - - // Start goroutine that logs the stderr - go c.logStderr(stderr_r) - - // Start a goroutine that is going to be reading the lines - // out of stdout - linesCh := make(chan []byte) - go func() { - defer close(linesCh) - - buf := bufio.NewReader(stdout_r) - for { - line, err := buf.ReadBytes('\n') - if line != nil { - linesCh <- line - } - - if err == io.EOF { - return - } - } - }() - - // Make sure after we exit we read the lines from stdout forever - // so they don't block since it is an io.Pipe - defer func() { - go func() { - for _ = range linesCh { - } - }() - }() - - // Some channels for the next step - timeout := time.After(c.config.StartTimeout) - - // Start looking for the address - c.logger.Debug("waiting for RPC address", "path", cmd.Path) - select { - case <-timeout: - err = errors.New("timeout while waiting for plugin to start") - case <-exitCh: - err = errors.New("plugin exited before we could connect") - case lineBytes := <-linesCh: - // Trim the line and split by "|" in order to get the parts of - // the output. - line := strings.TrimSpace(string(lineBytes)) - parts := strings.SplitN(line, "|", 6) - if len(parts) < 4 { - err = fmt.Errorf( - "Unrecognized remote plugin message: %s\n\n"+ - "This usually means that the plugin is either invalid or simply\n"+ - "needs to be recompiled to support the latest protocol.", line) - return - } - - // Check the core protocol. Wrapped in a {} for scoping. - { - var coreProtocol int64 - coreProtocol, err = strconv.ParseInt(parts[0], 10, 0) - if err != nil { - err = fmt.Errorf("Error parsing core protocol version: %s", err) - return - } - - if int(coreProtocol) != CoreProtocolVersion { - err = fmt.Errorf("Incompatible core API version with plugin. "+ - "Plugin version: %s, Core version: %d\n\n"+ - "To fix this, the plugin usually only needs to be recompiled.\n"+ - "Please report this to the plugin author.", parts[0], CoreProtocolVersion) - return - } - } - - // Parse the protocol version - var protocol int64 - protocol, err = strconv.ParseInt(parts[1], 10, 0) - if err != nil { - err = fmt.Errorf("Error parsing protocol version: %s", err) - return - } - - // Test the API version - if uint(protocol) != c.config.ProtocolVersion { - err = fmt.Errorf("Incompatible API version with plugin. "+ - "Plugin version: %s, Core version: %d", parts[1], c.config.ProtocolVersion) - return - } - - switch parts[2] { - case "tcp": - addr, err = net.ResolveTCPAddr("tcp", parts[3]) - case "unix": - addr, err = net.ResolveUnixAddr("unix", parts[3]) - default: - err = fmt.Errorf("Unknown address type: %s", parts[3]) - } - - // If we have a server type, then record that. We default to net/rpc - // for backwards compatibility. - c.protocol = ProtocolNetRPC - if len(parts) >= 5 { - c.protocol = Protocol(parts[4]) - } - - found := false - for _, p := range c.config.AllowedProtocols { - if p == c.protocol { - found = true - break - } - } - if !found { - err = fmt.Errorf("Unsupported plugin protocol %q. Supported: %v", - c.protocol, c.config.AllowedProtocols) - return - } - - } - - c.address = addr - return -} - -// ReattachConfig returns the information that must be provided to NewClient -// to reattach to the plugin process that this client started. This is -// useful for plugins that detach from their parent process. -// -// If this returns nil then the process hasn't been started yet. Please -// call Start or Client before calling this. -func (c *Client) ReattachConfig() *ReattachConfig { - c.l.Lock() - defer c.l.Unlock() - - if c.address == nil { - return nil - } - - if c.config.Cmd != nil && c.config.Cmd.Process == nil { - return nil - } - - // If we connected via reattach, just return the information as-is - if c.config.Reattach != nil { - return c.config.Reattach - } - - return &ReattachConfig{ - Protocol: c.protocol, - Addr: c.address, - Pid: c.config.Cmd.Process.Pid, - } -} - -// Protocol returns the protocol of server on the remote end. This will -// start the plugin process if it isn't already started. Errors from -// starting the plugin are surpressed and ProtocolInvalid is returned. It -// is recommended you call Start explicitly before calling Protocol to ensure -// no errors occur. -func (c *Client) Protocol() Protocol { - _, err := c.Start() - if err != nil { - return ProtocolInvalid - } - - return c.protocol -} - -func netAddrDialer(addr net.Addr) func(string, time.Duration) (net.Conn, error) { - return func(_ string, _ time.Duration) (net.Conn, error) { - // Connect to the client - conn, err := net.Dial(addr.Network(), addr.String()) - if err != nil { - return nil, err - } - if tcpConn, ok := conn.(*net.TCPConn); ok { - // Make sure to set keep alive so that the connection doesn't die - tcpConn.SetKeepAlive(true) - } - - return conn, nil - } -} - -// dialer is compatible with grpc.WithDialer and creates the connection -// to the plugin. -func (c *Client) dialer(_ string, timeout time.Duration) (net.Conn, error) { - conn, err := netAddrDialer(c.address)("", timeout) - if err != nil { - return nil, err - } - - // If we have a TLS config we wrap our connection. We only do this - // for net/rpc since gRPC uses its own mechanism for TLS. - if c.protocol == ProtocolNetRPC && c.config.TLSConfig != nil { - conn = tls.Client(conn, c.config.TLSConfig) - } - - return conn, nil -} - -func (c *Client) logStderr(r io.Reader) { - bufR := bufio.NewReader(r) - for { - line, err := bufR.ReadString('\n') - if line != "" { - c.config.Stderr.Write([]byte(line)) - line = strings.TrimRightFunc(line, unicode.IsSpace) - - l := c.logger.Named(filepath.Base(c.config.Cmd.Path)) - - entry, err := parseJSON(line) - // If output is not JSON format, print directly to Debug - if err != nil { - l.Debug(line) - } else { - out := flattenKVPairs(entry.KVPairs) - - l = l.With("timestamp", entry.Timestamp.Format(hclog.TimeFormat)) - switch hclog.LevelFromString(entry.Level) { - case hclog.Trace: - l.Trace(entry.Message, out...) - case hclog.Debug: - l.Debug(entry.Message, out...) - case hclog.Info: - l.Info(entry.Message, out...) - case hclog.Warn: - l.Warn(entry.Message, out...) - case hclog.Error: - l.Error(entry.Message, out...) - } - } - } - - if err == io.EOF { - break - } - } - - // Flag that we've completed logging for others - close(c.doneLogging) -} diff --git a/vendor/github.com/hashicorp/go-plugin/client_posix_test.go b/vendor/github.com/hashicorp/go-plugin/client_posix_test.go deleted file mode 100644 index 523ec11..0000000 --- a/vendor/github.com/hashicorp/go-plugin/client_posix_test.go +++ /dev/null @@ -1,104 +0,0 @@ -// +build !windows - -package plugin - -import ( - "os" - "reflect" - "syscall" - "testing" - "time" -) - -func TestClient_testInterfaceReattach(t *testing.T) { - // Setup the process for daemonization - process := helperProcess("test-interface-daemon") - if process.SysProcAttr == nil { - process.SysProcAttr = &syscall.SysProcAttr{} - } - process.SysProcAttr.Setsid = true - syscall.Umask(0) - - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Start it so we can get the reattach info - if _, err := c.Start(); err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // New client with reattach info - reattach := c.ReattachConfig() - if reattach == nil { - c.Kill() - t.Fatal("reattach config should be non-nil") - } - - // Find the process and defer a kill so we know it is gone - p, err := os.FindProcess(reattach.Pid) - if err != nil { - c.Kill() - t.Fatalf("couldn't find process: %s", err) - } - defer p.Kill() - - // Reattach - c = NewClient(&ClientConfig{ - Reattach: reattach, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Start shouldn't error - if _, err := c.Start(); err != nil { - t.Fatalf("err: %s", err) - } - - // It should still be alive - time.Sleep(1 * time.Second) - if c.Exited() { - t.Fatal("should not be exited") - } - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Test the resulting reattach config - reattach2 := c.ReattachConfig() - if reattach2 == nil { - t.Fatal("reattach from reattached should not be nil") - } - if !reflect.DeepEqual(reattach, reattach2) { - t.Fatalf("bad: %#v", reattach) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/client_test.go b/vendor/github.com/hashicorp/go-plugin/client_test.go deleted file mode 100644 index 1747868..0000000 --- a/vendor/github.com/hashicorp/go-plugin/client_test.go +++ /dev/null @@ -1,931 +0,0 @@ -package plugin - -import ( - "bytes" - "crypto/sha256" - "io" - "io/ioutil" - "net" - "os" - "path/filepath" - "strings" - "testing" - "time" - - hclog "github.com/hashicorp/go-hclog" -) - -func TestClient(t *testing.T) { - process := helperProcess("mock") - c := NewClient(&ClientConfig{Cmd: process, HandshakeConfig: testHandshake}) - defer c.Kill() - - // Test that it parses the proper address - addr, err := c.Start() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - if addr.Network() != "tcp" { - t.Fatalf("bad: %#v", addr) - } - - if addr.String() != ":1234" { - t.Fatalf("bad: %#v", addr) - } - - // Test that it exits properly if killed - c.Kill() - - if process.ProcessState == nil { - t.Fatal("should have process state") - } - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -// This tests a bug where Kill would start -func TestClient_killStart(t *testing.T) { - // Create a temporary dir to store the result file - td, err := ioutil.TempDir("", "plugin") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.RemoveAll(td) - - // Start the client - path := filepath.Join(td, "booted") - process := helperProcess("bad-version", path) - c := NewClient(&ClientConfig{Cmd: process, HandshakeConfig: testHandshake}) - defer c.Kill() - - // Verify our path doesn't exist - if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) { - t.Fatalf("bad: %s", err) - } - - // Test that it parses the proper address - if _, err := c.Start(); err == nil { - t.Fatal("expected error") - } - - // Verify we started - if _, err := os.Stat(path); err != nil { - t.Fatalf("bad: %s", err) - } - if err := os.Remove(path); err != nil { - t.Fatalf("bad: %s", err) - } - - // Test that Kill does nothing really - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } - - if process.ProcessState == nil { - t.Fatal("should have no process state") - } - - // Verify our path doesn't exist - if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) { - t.Fatalf("bad: %s", err) - } -} - -func TestClient_testCleanup(t *testing.T) { - // Create a temporary dir to store the result file - td, err := ioutil.TempDir("", "plugin") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.RemoveAll(td) - - // Create a path that the helper process will write on cleanup - path := filepath.Join(td, "output") - - // Test the cleanup - process := helperProcess("cleanup", path) - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Grab the client so the process starts - if _, err := c.Client(); err != nil { - c.Kill() - t.Fatalf("err: %s", err) - } - - // Kill it gracefully - c.Kill() - - // Test for the file - if _, err := os.Stat(path); err != nil { - t.Fatalf("err: %s", err) - } -} - -func TestClient_testInterface(t *testing.T) { - process := helperProcess("test-interface") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer c.Kill() - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_grpc_servercrash(t *testing.T) { - process := helperProcess("test-grpc") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - AllowedProtocols: []Protocol{ProtocolGRPC}, - }) - defer c.Kill() - - if _, err := c.Start(); err != nil { - t.Fatalf("err: %s", err) - } - - if v := c.Protocol(); v != ProtocolGRPC { - t.Fatalf("bad: %s", v) - } - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - _, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - c.process.Kill() - - select { - case <-c.doneCtx.Done(): - case <-time.After(time.Second * 2): - t.Fatal("Context was not closed") - } -} - -func TestClient_grpc(t *testing.T) { - process := helperProcess("test-grpc") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - AllowedProtocols: []Protocol{ProtocolGRPC}, - }) - defer c.Kill() - - if _, err := c.Start(); err != nil { - t.Fatalf("err: %s", err) - } - - if v := c.Protocol(); v != ProtocolGRPC { - t.Fatalf("bad: %s", v) - } - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_grpcNotAllowed(t *testing.T) { - process := helperProcess("test-grpc") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer c.Kill() - - if _, err := c.Start(); err == nil { - t.Fatal("should error") - } -} - -func TestClient_cmdAndReattach(t *testing.T) { - config := &ClientConfig{ - Cmd: helperProcess("start-timeout"), - Reattach: &ReattachConfig{}, - } - - c := NewClient(config) - defer c.Kill() - - _, err := c.Start() - if err == nil { - t.Fatal("err should not be nil") - } -} - -func TestClient_reattach(t *testing.T) { - process := helperProcess("test-interface") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer c.Kill() - - // Grab the RPC client - _, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Get the reattach configuration - reattach := c.ReattachConfig() - - // Create a new client - c = NewClient(&ClientConfig{ - Reattach: reattach, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_reattachNoProtocol(t *testing.T) { - process := helperProcess("test-interface") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer c.Kill() - - // Grab the RPC client - _, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Get the reattach configuration - reattach := c.ReattachConfig() - reattach.Protocol = "" - - // Create a new client - c = NewClient(&ClientConfig{ - Reattach: reattach, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_reattachGRPC(t *testing.T) { - process := helperProcess("test-grpc") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - AllowedProtocols: []Protocol{ProtocolGRPC}, - }) - defer c.Kill() - - // Grab the RPC client - _, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Get the reattach configuration - reattach := c.ReattachConfig() - - // Create a new client - c = NewClient(&ClientConfig{ - Reattach: reattach, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - AllowedProtocols: []Protocol{ProtocolGRPC}, - }) - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_reattachNotFound(t *testing.T) { - // Find a bad pid - var pid int = 5000 - for i := pid; i < 32000; i++ { - if _, err := os.FindProcess(i); err != nil { - pid = i - break - } - } - - // Addr that won't work - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - addr := l.Addr() - l.Close() - - // Reattach - c := NewClient(&ClientConfig{ - Reattach: &ReattachConfig{ - Addr: addr, - Pid: pid, - }, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Start shouldn't error - if _, err := c.Start(); err == nil { - t.Fatal("should error") - } else if err != ErrProcessNotFound { - t.Fatalf("err: %s", err) - } -} - -func TestClientStart_badVersion(t *testing.T) { - config := &ClientConfig{ - Cmd: helperProcess("bad-version"), - StartTimeout: 50 * time.Millisecond, - HandshakeConfig: testHandshake, - } - - c := NewClient(config) - defer c.Kill() - - _, err := c.Start() - if err == nil { - t.Fatal("err should not be nil") - } -} - -func TestClient_Start_Timeout(t *testing.T) { - config := &ClientConfig{ - Cmd: helperProcess("start-timeout"), - StartTimeout: 50 * time.Millisecond, - HandshakeConfig: testHandshake, - } - - c := NewClient(config) - defer c.Kill() - - _, err := c.Start() - if err == nil { - t.Fatal("err should not be nil") - } -} - -func TestClient_Stderr(t *testing.T) { - stderr := new(bytes.Buffer) - process := helperProcess("stderr") - c := NewClient(&ClientConfig{ - Cmd: process, - Stderr: stderr, - HandshakeConfig: testHandshake, - }) - defer c.Kill() - - if _, err := c.Start(); err != nil { - t.Fatalf("err: %s", err) - } - - for !c.Exited() { - time.Sleep(10 * time.Millisecond) - } - - if !strings.Contains(stderr.String(), "HELLO\n") { - t.Fatalf("bad log data: '%s'", stderr.String()) - } - - if !strings.Contains(stderr.String(), "WORLD\n") { - t.Fatalf("bad log data: '%s'", stderr.String()) - } -} - -func TestClient_StderrJSON(t *testing.T) { - stderr := new(bytes.Buffer) - process := helperProcess("stderr-json") - c := NewClient(&ClientConfig{ - Cmd: process, - Stderr: stderr, - HandshakeConfig: testHandshake, - }) - defer c.Kill() - - if _, err := c.Start(); err != nil { - t.Fatalf("err: %s", err) - } - - for !c.Exited() { - time.Sleep(10 * time.Millisecond) - } - - if !strings.Contains(stderr.String(), "[\"HELLO\"]\n") { - t.Fatalf("bad log data: '%s'", stderr.String()) - } - - if !strings.Contains(stderr.String(), "12345\n") { - t.Fatalf("bad log data: '%s'", stderr.String()) - } -} - -func TestClient_Stdin(t *testing.T) { - // Overwrite stdin for this test with a temporary file - tf, err := ioutil.TempFile("", "terraform") - if err != nil { - t.Fatalf("err: %s", err) - } - defer os.Remove(tf.Name()) - defer tf.Close() - - if _, err = tf.WriteString("hello"); err != nil { - t.Fatalf("error: %s", err) - } - - if err = tf.Sync(); err != nil { - t.Fatalf("error: %s", err) - } - - if _, err = tf.Seek(0, 0); err != nil { - t.Fatalf("error: %s", err) - } - - oldStdin := os.Stdin - defer func() { os.Stdin = oldStdin }() - os.Stdin = tf - - process := helperProcess("stdin") - c := NewClient(&ClientConfig{Cmd: process, HandshakeConfig: testHandshake}) - defer c.Kill() - - _, err = c.Start() - if err != nil { - t.Fatalf("error: %s", err) - } - - for { - if c.Exited() { - break - } - - time.Sleep(50 * time.Millisecond) - } - - if !process.ProcessState.Success() { - t.Fatal("process didn't exit cleanly") - } -} - -func TestClient_SecureConfig(t *testing.T) { - // Test failure case - secureConfig := &SecureConfig{ - Checksum: []byte{'1'}, - Hash: sha256.New(), - } - process := helperProcess("test-interface") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - SecureConfig: secureConfig, - }) - - // Grab the RPC client, should error - _, err := c.Client() - c.Kill() - if err != ErrChecksumsDoNotMatch { - t.Fatalf("err should be %s, got %s", ErrChecksumsDoNotMatch, err) - } - - // Get the checksum of the executable - file, err := os.Open(os.Args[0]) - if err != nil { - t.Fatal(err) - } - defer file.Close() - - hash := sha256.New() - - _, err = io.Copy(hash, file) - if err != nil { - t.Fatal(err) - } - - sum := hash.Sum(nil) - - secureConfig = &SecureConfig{ - Checksum: sum, - Hash: sha256.New(), - } - - c = NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - SecureConfig: secureConfig, - }) - defer c.Kill() - - // Grab the RPC client - _, err = c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } -} - -func TestClient_TLS(t *testing.T) { - // Test failure case - process := helperProcess("test-interface-tls") - cBad := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer cBad.Kill() - - // Grab the RPC client - clientBad, err := cBad.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := clientBad.Dispense("test") - if err == nil { - t.Fatal("expected error, got nil") - } - - cBad.Kill() - - // Add TLS config to client - tlsConfig, err := helperTLSProvider() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - process = helperProcess("test-interface-tls") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - TLSConfig: tlsConfig, - }) - defer c.Kill() - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err = client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_TLS_grpc(t *testing.T) { - // Add TLS config to client - tlsConfig, err := helperTLSProvider() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - process := helperProcess("test-grpc-tls") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - TLSConfig: tlsConfig, - AllowedProtocols: []Protocol{ProtocolGRPC}, - }) - defer c.Kill() - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} - -func TestClient_secureConfigAndReattach(t *testing.T) { - config := &ClientConfig{ - SecureConfig: &SecureConfig{}, - Reattach: &ReattachConfig{}, - } - - c := NewClient(config) - defer c.Kill() - - _, err := c.Start() - if err != ErrSecureConfigAndReattach { - t.Fatalf("err should not be %s, got %s", ErrSecureConfigAndReattach, err) - } -} - -func TestClient_ping(t *testing.T) { - process := helperProcess("test-interface") - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - defer c.Kill() - - // Get the client - client, err := c.Client() - if err != nil { - t.Fatalf("err: %s", err) - } - - // Ping, should work - if err := client.Ping(); err != nil { - t.Fatalf("err: %s", err) - } - - // Kill it - c.Kill() - if err := client.Ping(); err == nil { - t.Fatal("should error") - } -} - -func TestClient_logger(t *testing.T) { - t.Run("net/rpc", func(t *testing.T) { testClient_logger(t, "netrpc") }) - t.Run("grpc", func(t *testing.T) { testClient_logger(t, "grpc") }) -} - -func testClient_logger(t *testing.T, proto string) { - var buffer bytes.Buffer - stderr := io.MultiWriter(os.Stderr, &buffer) - // Custom hclog.Logger - clientLogger := hclog.New(&hclog.LoggerOptions{ - Name: "test-logger", - Level: hclog.Trace, - Output: stderr, - }) - - process := helperProcess("test-interface-logger-" + proto) - c := NewClient(&ClientConfig{ - Cmd: process, - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - Logger: clientLogger, - AllowedProtocols: []Protocol{ProtocolNetRPC, ProtocolGRPC}, - }) - defer c.Kill() - - // Grab the RPC client - client, err := c.Client() - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - // Grab the impl - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err should be nil, got %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - { - // Discard everything else, and capture the output we care about - buffer.Reset() - impl.PrintKV("foo", "bar") - time.Sleep(100 * time.Millisecond) - line, err := buffer.ReadString('\n') - if err != nil { - t.Fatal(err) - } - if !strings.Contains(line, "foo=bar") { - t.Fatalf("bad: %q", line) - } - } - - { - // Try an integer type - buffer.Reset() - impl.PrintKV("foo", 12) - time.Sleep(100 * time.Millisecond) - line, err := buffer.ReadString('\n') - if err != nil { - t.Fatal(err) - } - if !strings.Contains(line, "foo=12") { - t.Fatalf("bad: %q", line) - } - } - - // Kill it - c.Kill() - - // Test that it knows it is exited - if !c.Exited() { - t.Fatal("should say client has exited") - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/discover.go b/vendor/github.com/hashicorp/go-plugin/discover.go deleted file mode 100644 index d22c566..0000000 --- a/vendor/github.com/hashicorp/go-plugin/discover.go +++ /dev/null @@ -1,28 +0,0 @@ -package plugin - -import ( - "path/filepath" -) - -// Discover discovers plugins that are in a given directory. -// -// The directory doesn't need to be absolute. For example, "." will work fine. -// -// This currently assumes any file matching the glob is a plugin. -// In the future this may be smarter about checking that a file is -// executable and so on. -// -// TODO: test -func Discover(glob, dir string) ([]string, error) { - var err error - - // Make the directory absolute if it isn't already - if !filepath.IsAbs(dir) { - dir, err = filepath.Abs(dir) - if err != nil { - return nil, err - } - } - - return filepath.Glob(filepath.Join(dir, glob)) -} diff --git a/vendor/github.com/hashicorp/go-plugin/error.go b/vendor/github.com/hashicorp/go-plugin/error.go deleted file mode 100644 index 22a7baa..0000000 --- a/vendor/github.com/hashicorp/go-plugin/error.go +++ /dev/null @@ -1,24 +0,0 @@ -package plugin - -// This is a type that wraps error types so that they can be messaged -// across RPC channels. Since "error" is an interface, we can't always -// gob-encode the underlying structure. This is a valid error interface -// implementer that we will push across. -type BasicError struct { - Message string -} - -// NewBasicError is used to create a BasicError. -// -// err is allowed to be nil. -func NewBasicError(err error) *BasicError { - if err == nil { - return nil - } - - return &BasicError{err.Error()} -} - -func (e *BasicError) Error() string { - return e.Message -} diff --git a/vendor/github.com/hashicorp/go-plugin/error_test.go b/vendor/github.com/hashicorp/go-plugin/error_test.go deleted file mode 100644 index e3aeff5..0000000 --- a/vendor/github.com/hashicorp/go-plugin/error_test.go +++ /dev/null @@ -1,26 +0,0 @@ -package plugin - -import ( - "errors" - "testing" -) - -func TestBasicError_ImplementsError(t *testing.T) { - var _ error = new(BasicError) -} - -func TestBasicError_MatchesMessage(t *testing.T) { - err := errors.New("foo") - wrapped := NewBasicError(err) - - if wrapped.Error() != err.Error() { - t.Fatalf("bad: %#v", wrapped.Error()) - } -} - -func TestNewBasicError_nil(t *testing.T) { - r := NewBasicError(nil) - if r != nil { - t.Fatalf("bad: %#v", r) - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_broker.go b/vendor/github.com/hashicorp/go-plugin/grpc_broker.go deleted file mode 100644 index 49fd21c..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_broker.go +++ /dev/null @@ -1,455 +0,0 @@ -package plugin - -import ( - "context" - "crypto/tls" - "errors" - "fmt" - "log" - "net" - "sync" - "sync/atomic" - "time" - - "github.com/oklog/run" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" -) - -// streamer interface is used in the broker to send/receive connection -// information. -type streamer interface { - Send(*ConnInfo) error - Recv() (*ConnInfo, error) - Close() -} - -// sendErr is used to pass errors back during a send. -type sendErr struct { - i *ConnInfo - ch chan error -} - -// gRPCBrokerServer is used by the plugin to start a stream and to send -// connection information to/from the plugin. Implements GRPCBrokerServer and -// streamer interfaces. -type gRPCBrokerServer struct { - // send is used to send connection info to the gRPC stream. - send chan *sendErr - - // recv is used to receive connection info from the gRPC stream. - recv chan *ConnInfo - - // quit closes down the stream. - quit chan struct{} - - // o is used to ensure we close the quit channel only once. - o sync.Once -} - -func newGRPCBrokerServer() *gRPCBrokerServer { - return &gRPCBrokerServer{ - send: make(chan *sendErr), - recv: make(chan *ConnInfo), - quit: make(chan struct{}), - } -} - -// StartStream implements the GRPCBrokerServer interface and will block until -// the quit channel is closed or the context reports Done. The stream will pass -// connection information to/from the client. -func (s *gRPCBrokerServer) StartStream(stream GRPCBroker_StartStreamServer) error { - doneCh := stream.Context().Done() - defer s.Close() - - // Proccess send stream - go func() { - for { - select { - case <-doneCh: - return - case <-s.quit: - return - case se := <-s.send: - err := stream.Send(se.i) - se.ch <- err - } - } - }() - - // Process receive stream - for { - i, err := stream.Recv() - if err != nil { - return err - } - select { - case <-doneCh: - return nil - case <-s.quit: - return nil - case s.recv <- i: - } - } - - return nil -} - -// Send is used by the GRPCBroker to pass connection information into the stream -// to the client. -func (s *gRPCBrokerServer) Send(i *ConnInfo) error { - ch := make(chan error) - defer close(ch) - - select { - case <-s.quit: - return errors.New("broker closed") - case s.send <- &sendErr{ - i: i, - ch: ch, - }: - } - - return <-ch -} - -// Recv is used by the GRPCBroker to pass connection information that has been -// sent from the client from the stream to the broker. -func (s *gRPCBrokerServer) Recv() (*ConnInfo, error) { - select { - case <-s.quit: - return nil, errors.New("broker closed") - case i := <-s.recv: - return i, nil - } -} - -// Close closes the quit channel, shutting down the stream. -func (s *gRPCBrokerServer) Close() { - s.o.Do(func() { - close(s.quit) - }) -} - -// gRPCBrokerClientImpl is used by the client to start a stream and to send -// connection information to/from the client. Implements GRPCBrokerClient and -// streamer interfaces. -type gRPCBrokerClientImpl struct { - // client is the underlying GRPC client used to make calls to the server. - client GRPCBrokerClient - - // send is used to send connection info to the gRPC stream. - send chan *sendErr - - // recv is used to receive connection info from the gRPC stream. - recv chan *ConnInfo - - // quit closes down the stream. - quit chan struct{} - - // o is used to ensure we close the quit channel only once. - o sync.Once -} - -func newGRPCBrokerClient(conn *grpc.ClientConn) *gRPCBrokerClientImpl { - return &gRPCBrokerClientImpl{ - client: NewGRPCBrokerClient(conn), - send: make(chan *sendErr), - recv: make(chan *ConnInfo), - quit: make(chan struct{}), - } -} - -// StartStream implements the GRPCBrokerClient interface and will block until -// the quit channel is closed or the context reports Done. The stream will pass -// connection information to/from the plugin. -func (s *gRPCBrokerClientImpl) StartStream() error { - ctx, cancelFunc := context.WithCancel(context.Background()) - defer cancelFunc() - defer s.Close() - - stream, err := s.client.StartStream(ctx) - if err != nil { - return err - } - doneCh := stream.Context().Done() - - go func() { - for { - select { - case <-doneCh: - return - case <-s.quit: - return - case se := <-s.send: - err := stream.Send(se.i) - se.ch <- err - } - } - }() - - for { - i, err := stream.Recv() - if err != nil { - return err - } - select { - case <-doneCh: - return nil - case <-s.quit: - return nil - case s.recv <- i: - } - } - - return nil -} - -// Send is used by the GRPCBroker to pass connection information into the stream -// to the plugin. -func (s *gRPCBrokerClientImpl) Send(i *ConnInfo) error { - ch := make(chan error) - defer close(ch) - - select { - case <-s.quit: - return errors.New("broker closed") - case s.send <- &sendErr{ - i: i, - ch: ch, - }: - } - - return <-ch -} - -// Recv is used by the GRPCBroker to pass connection information that has been -// sent from the plugin to the broker. -func (s *gRPCBrokerClientImpl) Recv() (*ConnInfo, error) { - select { - case <-s.quit: - return nil, errors.New("broker closed") - case i := <-s.recv: - return i, nil - } -} - -// Close closes the quit channel, shutting down the stream. -func (s *gRPCBrokerClientImpl) Close() { - s.o.Do(func() { - close(s.quit) - }) -} - -// GRPCBroker is responsible for brokering connections by unique ID. -// -// It is used by plugins to create multiple gRPC connections and data -// streams between the plugin process and the host process. -// -// This allows a plugin to request a channel with a specific ID to connect to -// or accept a connection from, and the broker handles the details of -// holding these channels open while they're being negotiated. -// -// The Plugin interface has access to these for both Server and Client. -// The broker can be used by either (optionally) to reserve and connect to -// new streams. This is useful for complex args and return values, -// or anything else you might need a data stream for. -type GRPCBroker struct { - nextId uint32 - streamer streamer - streams map[uint32]*gRPCBrokerPending - tls *tls.Config - doneCh chan struct{} - o sync.Once - - sync.Mutex -} - -type gRPCBrokerPending struct { - ch chan *ConnInfo - doneCh chan struct{} -} - -func newGRPCBroker(s streamer, tls *tls.Config) *GRPCBroker { - return &GRPCBroker{ - streamer: s, - streams: make(map[uint32]*gRPCBrokerPending), - tls: tls, - doneCh: make(chan struct{}), - } -} - -// Accept accepts a connection by ID. -// -// This should not be called multiple times with the same ID at one time. -func (b *GRPCBroker) Accept(id uint32) (net.Listener, error) { - listener, err := serverListener() - if err != nil { - return nil, err - } - - err = b.streamer.Send(&ConnInfo{ - ServiceId: id, - Network: listener.Addr().Network(), - Address: listener.Addr().String(), - }) - if err != nil { - return nil, err - } - - return listener, nil -} - -// AcceptAndServe is used to accept a specific stream ID and immediately -// serve a gRPC server on that stream ID. This is used to easily serve -// complex arguments. Each AcceptAndServe call opens a new listener socket and -// sends the connection info down the stream to the dialer. Since a new -// connection is opened every call, these calls should be used sparingly. -// Multiple gRPC server implementations can be registered to a single -// AcceptAndServe call. -func (b *GRPCBroker) AcceptAndServe(id uint32, s func([]grpc.ServerOption) *grpc.Server) { - listener, err := b.Accept(id) - if err != nil { - log.Printf("[ERR] plugin: plugin acceptAndServe error: %s", err) - return - } - defer listener.Close() - - var opts []grpc.ServerOption - if b.tls != nil { - opts = []grpc.ServerOption{grpc.Creds(credentials.NewTLS(b.tls))} - } - - server := s(opts) - - // Here we use a run group to close this goroutine if the server is shutdown - // or the broker is shutdown. - var g run.Group - { - // Serve on the listener, if shutting down call GracefulStop. - g.Add(func() error { - return server.Serve(listener) - }, func(err error) { - server.GracefulStop() - }) - } - { - // block on the closeCh or the doneCh. If we are shutting down close the - // closeCh. - closeCh := make(chan struct{}) - g.Add(func() error { - select { - case <-b.doneCh: - case <-closeCh: - } - return nil - }, func(err error) { - close(closeCh) - }) - } - - // Block until we are done - g.Run() -} - -// Close closes the stream and all servers. -func (b *GRPCBroker) Close() error { - b.streamer.Close() - b.o.Do(func() { - close(b.doneCh) - }) - return nil -} - -// Dial opens a connection by ID. -func (b *GRPCBroker) Dial(id uint32) (conn *grpc.ClientConn, err error) { - var c *ConnInfo - - // Open the stream - p := b.getStream(id) - select { - case c = <-p.ch: - close(p.doneCh) - case <-time.After(5 * time.Second): - return nil, fmt.Errorf("timeout waiting for connection info") - } - - var addr net.Addr - switch c.Network { - case "tcp": - addr, err = net.ResolveTCPAddr("tcp", c.Address) - case "unix": - addr, err = net.ResolveUnixAddr("unix", c.Address) - default: - err = fmt.Errorf("Unknown address type: %s", c.Address) - } - if err != nil { - return nil, err - } - - return dialGRPCConn(b.tls, netAddrDialer(addr)) -} - -// NextId returns a unique ID to use next. -// -// It is possible for very long-running plugin hosts to wrap this value, -// though it would require a very large amount of calls. In practice -// we've never seen it happen. -func (m *GRPCBroker) NextId() uint32 { - return atomic.AddUint32(&m.nextId, 1) -} - -// Run starts the brokering and should be executed in a goroutine, since it -// blocks forever, or until the session closes. -// -// Uses of GRPCBroker never need to call this. It is called internally by -// the plugin host/client. -func (m *GRPCBroker) Run() { - for { - stream, err := m.streamer.Recv() - if err != nil { - // Once we receive an error, just exit - break - } - - // Initialize the waiter - p := m.getStream(stream.ServiceId) - select { - case p.ch <- stream: - default: - } - - go m.timeoutWait(stream.ServiceId, p) - } -} - -func (m *GRPCBroker) getStream(id uint32) *gRPCBrokerPending { - m.Lock() - defer m.Unlock() - - p, ok := m.streams[id] - if ok { - return p - } - - m.streams[id] = &gRPCBrokerPending{ - ch: make(chan *ConnInfo, 1), - doneCh: make(chan struct{}), - } - return m.streams[id] -} - -func (m *GRPCBroker) timeoutWait(id uint32, p *gRPCBrokerPending) { - // Wait for the stream to either be picked up and connected, or - // for a timeout. - select { - case <-p.doneCh: - case <-time.After(5 * time.Second): - } - - m.Lock() - defer m.Unlock() - - // Delete the stream so no one else can grab it - delete(m.streams, id) -} diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_broker.pb.go b/vendor/github.com/hashicorp/go-plugin/grpc_broker.pb.go deleted file mode 100644 index d490daf..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_broker.pb.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_broker.proto - -/* -Package plugin is a generated protocol buffer package. - -It is generated from these files: - grpc_broker.proto - -It has these top-level messages: - ConnInfo -*/ -package plugin - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type ConnInfo struct { - ServiceId uint32 `protobuf:"varint,1,opt,name=service_id,json=serviceId" json:"service_id,omitempty"` - Network string `protobuf:"bytes,2,opt,name=network" json:"network,omitempty"` - Address string `protobuf:"bytes,3,opt,name=address" json:"address,omitempty"` -} - -func (m *ConnInfo) Reset() { *m = ConnInfo{} } -func (m *ConnInfo) String() string { return proto.CompactTextString(m) } -func (*ConnInfo) ProtoMessage() {} -func (*ConnInfo) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *ConnInfo) GetServiceId() uint32 { - if m != nil { - return m.ServiceId - } - return 0 -} - -func (m *ConnInfo) GetNetwork() string { - if m != nil { - return m.Network - } - return "" -} - -func (m *ConnInfo) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -func init() { - proto.RegisterType((*ConnInfo)(nil), "plugin.ConnInfo") -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for GRPCBroker service - -type GRPCBrokerClient interface { - StartStream(ctx context.Context, opts ...grpc.CallOption) (GRPCBroker_StartStreamClient, error) -} - -type gRPCBrokerClient struct { - cc *grpc.ClientConn -} - -func NewGRPCBrokerClient(cc *grpc.ClientConn) GRPCBrokerClient { - return &gRPCBrokerClient{cc} -} - -func (c *gRPCBrokerClient) StartStream(ctx context.Context, opts ...grpc.CallOption) (GRPCBroker_StartStreamClient, error) { - stream, err := grpc.NewClientStream(ctx, &_GRPCBroker_serviceDesc.Streams[0], c.cc, "/plugin.GRPCBroker/StartStream", opts...) - if err != nil { - return nil, err - } - x := &gRPCBrokerStartStreamClient{stream} - return x, nil -} - -type GRPCBroker_StartStreamClient interface { - Send(*ConnInfo) error - Recv() (*ConnInfo, error) - grpc.ClientStream -} - -type gRPCBrokerStartStreamClient struct { - grpc.ClientStream -} - -func (x *gRPCBrokerStartStreamClient) Send(m *ConnInfo) error { - return x.ClientStream.SendMsg(m) -} - -func (x *gRPCBrokerStartStreamClient) Recv() (*ConnInfo, error) { - m := new(ConnInfo) - if err := x.ClientStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -// Server API for GRPCBroker service - -type GRPCBrokerServer interface { - StartStream(GRPCBroker_StartStreamServer) error -} - -func RegisterGRPCBrokerServer(s *grpc.Server, srv GRPCBrokerServer) { - s.RegisterService(&_GRPCBroker_serviceDesc, srv) -} - -func _GRPCBroker_StartStream_Handler(srv interface{}, stream grpc.ServerStream) error { - return srv.(GRPCBrokerServer).StartStream(&gRPCBrokerStartStreamServer{stream}) -} - -type GRPCBroker_StartStreamServer interface { - Send(*ConnInfo) error - Recv() (*ConnInfo, error) - grpc.ServerStream -} - -type gRPCBrokerStartStreamServer struct { - grpc.ServerStream -} - -func (x *gRPCBrokerStartStreamServer) Send(m *ConnInfo) error { - return x.ServerStream.SendMsg(m) -} - -func (x *gRPCBrokerStartStreamServer) Recv() (*ConnInfo, error) { - m := new(ConnInfo) - if err := x.ServerStream.RecvMsg(m); err != nil { - return nil, err - } - return m, nil -} - -var _GRPCBroker_serviceDesc = grpc.ServiceDesc{ - ServiceName: "plugin.GRPCBroker", - HandlerType: (*GRPCBrokerServer)(nil), - Methods: []grpc.MethodDesc{}, - Streams: []grpc.StreamDesc{ - { - StreamName: "StartStream", - Handler: _GRPCBroker_StartStream_Handler, - ServerStreams: true, - ClientStreams: true, - }, - }, - Metadata: "grpc_broker.proto", -} - -func init() { proto.RegisterFile("grpc_broker.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 170 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4c, 0x2f, 0x2a, 0x48, - 0x8e, 0x4f, 0x2a, 0xca, 0xcf, 0x4e, 0x2d, 0xd2, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x62, 0x2b, - 0xc8, 0x29, 0x4d, 0xcf, 0xcc, 0x53, 0x8a, 0xe5, 0xe2, 0x70, 0xce, 0xcf, 0xcb, 0xf3, 0xcc, 0x4b, - 0xcb, 0x17, 0x92, 0xe5, 0xe2, 0x2a, 0x4e, 0x2d, 0x2a, 0xcb, 0x4c, 0x4e, 0x8d, 0xcf, 0x4c, 0x91, - 0x60, 0x54, 0x60, 0xd4, 0xe0, 0x0d, 0xe2, 0x84, 0x8a, 0x78, 0xa6, 0x08, 0x49, 0x70, 0xb1, 0xe7, - 0xa5, 0x96, 0x94, 0xe7, 0x17, 0x65, 0x4b, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x06, 0xc1, 0xb8, 0x20, - 0x99, 0xc4, 0x94, 0x94, 0xa2, 0xd4, 0xe2, 0x62, 0x09, 0x66, 0x88, 0x0c, 0x94, 0x6b, 0xe4, 0xcc, - 0xc5, 0xe5, 0x1e, 0x14, 0xe0, 0xec, 0x04, 0xb6, 0x5a, 0xc8, 0x94, 0x8b, 0x3b, 0xb8, 0x24, 0xb1, - 0xa8, 0x24, 0xb8, 0xa4, 0x28, 0x35, 0x31, 0x57, 0x48, 0x40, 0x0f, 0xe2, 0x08, 0x3d, 0x98, 0x0b, - 0xa4, 0x30, 0x44, 0x34, 0x18, 0x0d, 0x18, 0x93, 0xd8, 0xc0, 0x4e, 0x36, 0x06, 0x04, 0x00, 0x00, - 0xff, 0xff, 0x7b, 0x5d, 0xfb, 0xe1, 0xc7, 0x00, 0x00, 0x00, -} diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_broker.proto b/vendor/github.com/hashicorp/go-plugin/grpc_broker.proto deleted file mode 100644 index f578348..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_broker.proto +++ /dev/null @@ -1,14 +0,0 @@ -syntax = "proto3"; -package plugin; - -message ConnInfo { - uint32 service_id = 1; - string network = 2; - string address = 3; -} - -service GRPCBroker { - rpc StartStream(stream ConnInfo) returns (stream ConnInfo); -} - - diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_client.go b/vendor/github.com/hashicorp/go-plugin/grpc_client.go deleted file mode 100644 index 44294d0..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_client.go +++ /dev/null @@ -1,107 +0,0 @@ -package plugin - -import ( - "crypto/tls" - "fmt" - "net" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/health/grpc_health_v1" -) - -func dialGRPCConn(tls *tls.Config, dialer func(string, time.Duration) (net.Conn, error)) (*grpc.ClientConn, error) { - // Build dialing options. - opts := make([]grpc.DialOption, 0, 5) - - // We use a custom dialer so that we can connect over unix domain sockets - opts = append(opts, grpc.WithDialer(dialer)) - - // go-plugin expects to block the connection - opts = append(opts, grpc.WithBlock()) - - // Fail right away - opts = append(opts, grpc.FailOnNonTempDialError(true)) - - // If we have no TLS configuration set, we need to explicitly tell grpc - // that we're connecting with an insecure connection. - if tls == nil { - opts = append(opts, grpc.WithInsecure()) - } else { - opts = append(opts, grpc.WithTransportCredentials( - credentials.NewTLS(tls))) - } - - // Connect. Note the first parameter is unused because we use a custom - // dialer that has the state to see the address. - conn, err := grpc.Dial("unused", opts...) - if err != nil { - return nil, err - } - - return conn, nil -} - -// newGRPCClient creates a new GRPCClient. The Client argument is expected -// to be successfully started already with a lock held. -func newGRPCClient(doneCtx context.Context, c *Client) (*GRPCClient, error) { - conn, err := dialGRPCConn(c.config.TLSConfig, c.dialer) - if err != nil { - return nil, err - } - - // Start the broker. - brokerGRPCClient := newGRPCBrokerClient(conn) - broker := newGRPCBroker(brokerGRPCClient, c.config.TLSConfig) - go broker.Run() - go brokerGRPCClient.StartStream() - - return &GRPCClient{ - Conn: conn, - Plugins: c.config.Plugins, - doneCtx: doneCtx, - broker: broker, - }, nil -} - -// GRPCClient connects to a GRPCServer over gRPC to dispense plugin types. -type GRPCClient struct { - Conn *grpc.ClientConn - Plugins map[string]Plugin - - doneCtx context.Context - broker *GRPCBroker -} - -// ClientProtocol impl. -func (c *GRPCClient) Close() error { - c.broker.Close() - return c.Conn.Close() -} - -// ClientProtocol impl. -func (c *GRPCClient) Dispense(name string) (interface{}, error) { - raw, ok := c.Plugins[name] - if !ok { - return nil, fmt.Errorf("unknown plugin type: %s", name) - } - - p, ok := raw.(GRPCPlugin) - if !ok { - return nil, fmt.Errorf("plugin %q doesn't support gRPC", name) - } - - return p.GRPCClient(c.doneCtx, c.broker, c.Conn) -} - -// ClientProtocol impl. -func (c *GRPCClient) Ping() error { - client := grpc_health_v1.NewHealthClient(c.Conn) - _, err := client.Check(context.Background(), &grpc_health_v1.HealthCheckRequest{ - Service: GRPCServiceName, - }) - - return err -} diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_client_test.go b/vendor/github.com/hashicorp/go-plugin/grpc_client_test.go deleted file mode 100644 index 5566f8b..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_client_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package plugin - -import ( - "context" - "testing" - - "github.com/hashicorp/go-plugin/test/grpc" - "google.golang.org/grpc" -) - -func TestGRPCClient_App(t *testing.T) { - client, _ := TestPluginGRPCConn(t, map[string]Plugin{ - "test": new(testInterfacePlugin), - }) - defer client.Close() - - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err: %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } - - err = impl.Bidirectional() - if err != nil { - t.Fatal(err) - } -} - -func TestGRPCConn_BidirectionalPing(t *testing.T) { - conn, _ := TestGRPCConn(t, func(s *grpc.Server) { - grpctest.RegisterPingPongServer(s, &pingPongServer{}) - }) - defer conn.Close() - pingPongClient := grpctest.NewPingPongClient(conn) - - pResp, err := pingPongClient.Ping(context.Background(), &grpctest.PingRequest{}) - if err != nil { - t.Fatal(err) - } - if pResp.Msg != "pong" { - t.Fatal("Bad PingPong") - } -} - -func TestGRPCClient_Ping(t *testing.T) { - client, server := TestPluginGRPCConn(t, map[string]Plugin{ - "test": new(testInterfacePlugin), - }) - defer client.Close() - - // Run a couple pings - if err := client.Ping(); err != nil { - t.Fatalf("err: %s", err) - } - if err := client.Ping(); err != nil { - t.Fatalf("err: %s", err) - } - - // Close the remote end - server.server.Stop() - - // Test ping fails - if err := client.Ping(); err == nil { - t.Fatal("should error") - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/grpc_server.go b/vendor/github.com/hashicorp/go-plugin/grpc_server.go deleted file mode 100644 index 9ec751e..0000000 --- a/vendor/github.com/hashicorp/go-plugin/grpc_server.go +++ /dev/null @@ -1,122 +0,0 @@ -package plugin - -import ( - "bytes" - "crypto/tls" - "encoding/json" - "fmt" - "io" - "net" - - "google.golang.org/grpc" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/health" - "google.golang.org/grpc/health/grpc_health_v1" -) - -// GRPCServiceName is the name of the service that the health check should -// return as passing. -const GRPCServiceName = "plugin" - -// DefaultGRPCServer can be used with the "GRPCServer" field for Server -// as a default factory method to create a gRPC server with no extra options. -func DefaultGRPCServer(opts []grpc.ServerOption) *grpc.Server { - return grpc.NewServer(opts...) -} - -// GRPCServer is a ServerType implementation that serves plugins over -// gRPC. This allows plugins to easily be written for other languages. -// -// The GRPCServer outputs a custom configuration as a base64-encoded -// JSON structure represented by the GRPCServerConfig config structure. -type GRPCServer struct { - // Plugins are the list of plugins to serve. - Plugins map[string]Plugin - - // Server is the actual server that will accept connections. This - // will be used for plugin registration as well. - Server func([]grpc.ServerOption) *grpc.Server - - // TLS should be the TLS configuration if available. If this is nil, - // the connection will not have transport security. - TLS *tls.Config - - // DoneCh is the channel that is closed when this server has exited. - DoneCh chan struct{} - - // Stdout/StderrLis are the readers for stdout/stderr that will be copied - // to the stdout/stderr connection that is output. - Stdout io.Reader - Stderr io.Reader - - config GRPCServerConfig - server *grpc.Server - broker *GRPCBroker -} - -// ServerProtocol impl. -func (s *GRPCServer) Init() error { - // Create our server - var opts []grpc.ServerOption - if s.TLS != nil { - opts = append(opts, grpc.Creds(credentials.NewTLS(s.TLS))) - } - s.server = s.Server(opts) - - // Register the health service - healthCheck := health.NewServer() - healthCheck.SetServingStatus( - GRPCServiceName, grpc_health_v1.HealthCheckResponse_SERVING) - grpc_health_v1.RegisterHealthServer(s.server, healthCheck) - - // Register the broker service - brokerServer := newGRPCBrokerServer() - RegisterGRPCBrokerServer(s.server, brokerServer) - s.broker = newGRPCBroker(brokerServer, s.TLS) - go s.broker.Run() - - // Register all our plugins onto the gRPC server. - for k, raw := range s.Plugins { - p, ok := raw.(GRPCPlugin) - if !ok { - return fmt.Errorf("%q is not a GRPC-compatibile plugin", k) - } - - if err := p.GRPCServer(s.broker, s.server); err != nil { - return fmt.Errorf("error registring %q: %s", k, err) - } - } - - return nil -} - -// Config is the GRPCServerConfig encoded as JSON then base64. -func (s *GRPCServer) Config() string { - // Create a buffer that will contain our final contents - var buf bytes.Buffer - - // Wrap the base64 encoding with JSON encoding. - if err := json.NewEncoder(&buf).Encode(s.config); err != nil { - // We panic since ths shouldn't happen under any scenario. We - // carefully control the structure being encoded here and it should - // always be successful. - panic(err) - } - - return buf.String() -} - -func (s *GRPCServer) Serve(lis net.Listener) { - // Start serving in a goroutine - go s.server.Serve(lis) - - // Wait until graceful completion - <-s.DoneCh -} - -// GRPCServerConfig is the extra configuration passed along for consumers -// to facilitate using GRPC plugins. -type GRPCServerConfig struct { - StdoutAddr string `json:"stdout_addr"` - StderrAddr string `json:"stderr_addr"` -} diff --git a/vendor/github.com/hashicorp/go-plugin/log_entry.go b/vendor/github.com/hashicorp/go-plugin/log_entry.go deleted file mode 100644 index 2996c14..0000000 --- a/vendor/github.com/hashicorp/go-plugin/log_entry.go +++ /dev/null @@ -1,73 +0,0 @@ -package plugin - -import ( - "encoding/json" - "time" -) - -// logEntry is the JSON payload that gets sent to Stderr from the plugin to the host -type logEntry struct { - Message string `json:"@message"` - Level string `json:"@level"` - Timestamp time.Time `json:"timestamp"` - KVPairs []*logEntryKV `json:"kv_pairs"` -} - -// logEntryKV is a key value pair within the Output payload -type logEntryKV struct { - Key string `json:"key"` - Value interface{} `json:"value"` -} - -// flattenKVPairs is used to flatten KVPair slice into []interface{} -// for hclog consumption. -func flattenKVPairs(kvs []*logEntryKV) []interface{} { - var result []interface{} - for _, kv := range kvs { - result = append(result, kv.Key) - result = append(result, kv.Value) - } - - return result -} - -// parseJSON handles parsing JSON output -func parseJSON(input string) (*logEntry, error) { - var raw map[string]interface{} - entry := &logEntry{} - - err := json.Unmarshal([]byte(input), &raw) - if err != nil { - return nil, err - } - - // Parse hclog-specific objects - if v, ok := raw["@message"]; ok { - entry.Message = v.(string) - delete(raw, "@message") - } - - if v, ok := raw["@level"]; ok { - entry.Level = v.(string) - delete(raw, "@level") - } - - if v, ok := raw["@timestamp"]; ok { - t, err := time.Parse("2006-01-02T15:04:05.000000Z07:00", v.(string)) - if err != nil { - return nil, err - } - entry.Timestamp = t - delete(raw, "@timestamp") - } - - // Parse dynamic KV args from the hclog payload. - for k, v := range raw { - entry.KVPairs = append(entry.KVPairs, &logEntryKV{ - Key: k, - Value: v, - }) - } - - return entry, nil -} diff --git a/vendor/github.com/hashicorp/go-plugin/mux_broker.go b/vendor/github.com/hashicorp/go-plugin/mux_broker.go deleted file mode 100644 index 01c45ad..0000000 --- a/vendor/github.com/hashicorp/go-plugin/mux_broker.go +++ /dev/null @@ -1,204 +0,0 @@ -package plugin - -import ( - "encoding/binary" - "fmt" - "log" - "net" - "sync" - "sync/atomic" - "time" - - "github.com/hashicorp/yamux" -) - -// MuxBroker is responsible for brokering multiplexed connections by unique ID. -// -// It is used by plugins to multiplex multiple RPC connections and data -// streams on top of a single connection between the plugin process and the -// host process. -// -// This allows a plugin to request a channel with a specific ID to connect to -// or accept a connection from, and the broker handles the details of -// holding these channels open while they're being negotiated. -// -// The Plugin interface has access to these for both Server and Client. -// The broker can be used by either (optionally) to reserve and connect to -// new multiplexed streams. This is useful for complex args and return values, -// or anything else you might need a data stream for. -type MuxBroker struct { - nextId uint32 - session *yamux.Session - streams map[uint32]*muxBrokerPending - - sync.Mutex -} - -type muxBrokerPending struct { - ch chan net.Conn - doneCh chan struct{} -} - -func newMuxBroker(s *yamux.Session) *MuxBroker { - return &MuxBroker{ - session: s, - streams: make(map[uint32]*muxBrokerPending), - } -} - -// Accept accepts a connection by ID. -// -// This should not be called multiple times with the same ID at one time. -func (m *MuxBroker) Accept(id uint32) (net.Conn, error) { - var c net.Conn - p := m.getStream(id) - select { - case c = <-p.ch: - close(p.doneCh) - case <-time.After(5 * time.Second): - m.Lock() - defer m.Unlock() - delete(m.streams, id) - - return nil, fmt.Errorf("timeout waiting for accept") - } - - // Ack our connection - if err := binary.Write(c, binary.LittleEndian, id); err != nil { - c.Close() - return nil, err - } - - return c, nil -} - -// AcceptAndServe is used to accept a specific stream ID and immediately -// serve an RPC server on that stream ID. This is used to easily serve -// complex arguments. -// -// The served interface is always registered to the "Plugin" name. -func (m *MuxBroker) AcceptAndServe(id uint32, v interface{}) { - conn, err := m.Accept(id) - if err != nil { - log.Printf("[ERR] plugin: plugin acceptAndServe error: %s", err) - return - } - - serve(conn, "Plugin", v) -} - -// Close closes the connection and all sub-connections. -func (m *MuxBroker) Close() error { - return m.session.Close() -} - -// Dial opens a connection by ID. -func (m *MuxBroker) Dial(id uint32) (net.Conn, error) { - // Open the stream - stream, err := m.session.OpenStream() - if err != nil { - return nil, err - } - - // Write the stream ID onto the wire. - if err := binary.Write(stream, binary.LittleEndian, id); err != nil { - stream.Close() - return nil, err - } - - // Read the ack that we connected. Then we're off! - var ack uint32 - if err := binary.Read(stream, binary.LittleEndian, &ack); err != nil { - stream.Close() - return nil, err - } - if ack != id { - stream.Close() - return nil, fmt.Errorf("bad ack: %d (expected %d)", ack, id) - } - - return stream, nil -} - -// NextId returns a unique ID to use next. -// -// It is possible for very long-running plugin hosts to wrap this value, -// though it would require a very large amount of RPC calls. In practice -// we've never seen it happen. -func (m *MuxBroker) NextId() uint32 { - return atomic.AddUint32(&m.nextId, 1) -} - -// Run starts the brokering and should be executed in a goroutine, since it -// blocks forever, or until the session closes. -// -// Uses of MuxBroker never need to call this. It is called internally by -// the plugin host/client. -func (m *MuxBroker) Run() { - for { - stream, err := m.session.AcceptStream() - if err != nil { - // Once we receive an error, just exit - break - } - - // Read the stream ID from the stream - var id uint32 - if err := binary.Read(stream, binary.LittleEndian, &id); err != nil { - stream.Close() - continue - } - - // Initialize the waiter - p := m.getStream(id) - select { - case p.ch <- stream: - default: - } - - // Wait for a timeout - go m.timeoutWait(id, p) - } -} - -func (m *MuxBroker) getStream(id uint32) *muxBrokerPending { - m.Lock() - defer m.Unlock() - - p, ok := m.streams[id] - if ok { - return p - } - - m.streams[id] = &muxBrokerPending{ - ch: make(chan net.Conn, 1), - doneCh: make(chan struct{}), - } - return m.streams[id] -} - -func (m *MuxBroker) timeoutWait(id uint32, p *muxBrokerPending) { - // Wait for the stream to either be picked up and connected, or - // for a timeout. - timeout := false - select { - case <-p.doneCh: - case <-time.After(5 * time.Second): - timeout = true - } - - m.Lock() - defer m.Unlock() - - // Delete the stream so no one else can grab it - delete(m.streams, id) - - // If we timed out, then check if we have a channel in the buffer, - // and if so, close it. - if timeout { - select { - case s := <-p.ch: - s.Close() - } - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/plugin.go b/vendor/github.com/hashicorp/go-plugin/plugin.go deleted file mode 100644 index 79d9674..0000000 --- a/vendor/github.com/hashicorp/go-plugin/plugin.go +++ /dev/null @@ -1,58 +0,0 @@ -// The plugin package exposes functions and helpers for communicating to -// plugins which are implemented as standalone binary applications. -// -// plugin.Client fully manages the lifecycle of executing the application, -// connecting to it, and returning the RPC client for dispensing plugins. -// -// plugin.Serve fully manages listeners to expose an RPC server from a binary -// that plugin.Client can connect to. -package plugin - -import ( - "context" - "errors" - "net/rpc" - - "google.golang.org/grpc" -) - -// Plugin is the interface that is implemented to serve/connect to an -// inteface implementation. -type Plugin interface { - // Server should return the RPC server compatible struct to serve - // the methods that the Client calls over net/rpc. - Server(*MuxBroker) (interface{}, error) - - // Client returns an interface implementation for the plugin you're - // serving that communicates to the server end of the plugin. - Client(*MuxBroker, *rpc.Client) (interface{}, error) -} - -// GRPCPlugin is the interface that is implemented to serve/connect to -// a plugin over gRPC. -type GRPCPlugin interface { - // GRPCServer should register this plugin for serving with the - // given GRPCServer. Unlike Plugin.Server, this is only called once - // since gRPC plugins serve singletons. - GRPCServer(*GRPCBroker, *grpc.Server) error - - // GRPCClient should return the interface implementation for the plugin - // you're serving via gRPC. The provided context will be canceled by - // go-plugin in the event of the plugin process exiting. - GRPCClient(context.Context, *GRPCBroker, *grpc.ClientConn) (interface{}, error) -} - -// NetRPCUnsupportedPlugin implements Plugin but returns errors for the -// Server and Client functions. This will effectively disable support for -// net/rpc based plugins. -// -// This struct can be embedded in your struct. -type NetRPCUnsupportedPlugin struct{} - -func (p NetRPCUnsupportedPlugin) Server(*MuxBroker) (interface{}, error) { - return nil, errors.New("net/rpc plugin protocol not supported") -} - -func (p NetRPCUnsupportedPlugin) Client(*MuxBroker, *rpc.Client) (interface{}, error) { - return nil, errors.New("net/rpc plugin protocol not supported") -} diff --git a/vendor/github.com/hashicorp/go-plugin/plugin_test.go b/vendor/github.com/hashicorp/go-plugin/plugin_test.go deleted file mode 100644 index c1d6d4c..0000000 --- a/vendor/github.com/hashicorp/go-plugin/plugin_test.go +++ /dev/null @@ -1,557 +0,0 @@ -package plugin - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "io/ioutil" - "log" - "net/rpc" - "os" - "os/exec" - "testing" - "time" - - hclog "github.com/hashicorp/go-hclog" - "github.com/hashicorp/go-plugin/test/grpc" - "golang.org/x/net/context" - "google.golang.org/grpc" -) - -// Test that NetRPCUnsupportedPlugin implements the correct interfaces. -var _ Plugin = new(NetRPCUnsupportedPlugin) - -// testAPIVersion is the ProtocolVersion we use for testing. -var testHandshake = HandshakeConfig{ - ProtocolVersion: 1, - MagicCookieKey: "TEST_MAGIC_COOKIE", - MagicCookieValue: "test", -} - -// testInterface is the test interface we use for plugins. -type testInterface interface { - Double(int) int - PrintKV(string, interface{}) - Bidirectional() error -} - -// testInterfacePlugin is the implementation of Plugin to create -// RPC client/server implementations for testInterface. -type testInterfacePlugin struct { - Impl testInterface -} - -func (p *testInterfacePlugin) Server(b *MuxBroker) (interface{}, error) { - return &testInterfaceServer{Impl: p.impl()}, nil -} - -func (p *testInterfacePlugin) Client(b *MuxBroker, c *rpc.Client) (interface{}, error) { - return &testInterfaceClient{Client: c}, nil -} - -func (p *testInterfacePlugin) GRPCServer(b *GRPCBroker, s *grpc.Server) error { - grpctest.RegisterTestServer(s, &testGRPCServer{broker: b, Impl: p.impl()}) - return nil -} - -func (p *testInterfacePlugin) GRPCClient(doneCtx context.Context, b *GRPCBroker, c *grpc.ClientConn) (interface{}, error) { - return &testGRPCClient{broker: b, Client: grpctest.NewTestClient(c)}, nil -} - -func (p *testInterfacePlugin) impl() testInterface { - if p.Impl != nil { - return p.Impl - } - - return &testInterfaceImpl{ - logger: hclog.New(&hclog.LoggerOptions{ - Level: hclog.Trace, - Output: os.Stderr, - JSONFormat: true, - }), - } -} - -// testInterfaceImpl implements testInterface concretely -type testInterfaceImpl struct { - logger hclog.Logger -} - -func (i *testInterfaceImpl) Double(v int) int { return v * 2 } - -func (i *testInterfaceImpl) PrintKV(key string, value interface{}) { - i.logger.Info("PrintKV called", key, value) -} - -func (i *testInterfaceImpl) Bidirectional() error { - return nil -} - -// testInterfaceClient implements testInterface to communicate over RPC -type testInterfaceClient struct { - Client *rpc.Client -} - -func (impl *testInterfaceClient) Double(v int) int { - var resp int - err := impl.Client.Call("Plugin.Double", v, &resp) - if err != nil { - panic(err) - } - - return resp -} - -func (impl *testInterfaceClient) PrintKV(key string, value interface{}) { - err := impl.Client.Call("Plugin.PrintKV", map[string]interface{}{ - "key": key, - "value": value, - }, &struct{}{}) - if err != nil { - panic(err) - } -} - -func (impl *testInterfaceClient) Bidirectional() error { - return nil -} - -// testInterfaceServer is the RPC server for testInterfaceClient -type testInterfaceServer struct { - Broker *MuxBroker - Impl testInterface -} - -func (s *testInterfaceServer) Double(arg int, resp *int) error { - *resp = s.Impl.Double(arg) - return nil -} - -func (s *testInterfaceServer) PrintKV(args map[string]interface{}, _ *struct{}) error { - s.Impl.PrintKV(args["key"].(string), args["value"]) - return nil -} - -// testPluginMap can be used for tests as a plugin map -var testPluginMap = map[string]Plugin{ - "test": new(testInterfacePlugin), -} - -// testGRPCServer is the implementation of our GRPC service. -type testGRPCServer struct { - Impl testInterface - broker *GRPCBroker -} - -func (s *testGRPCServer) Double( - ctx context.Context, - req *grpctest.TestRequest) (*grpctest.TestResponse, error) { - return &grpctest.TestResponse{ - Output: int32(s.Impl.Double(int(req.Input))), - }, nil -} - -func (s *testGRPCServer) PrintKV( - ctx context.Context, - req *grpctest.PrintKVRequest) (*grpctest.PrintKVResponse, error) { - var v interface{} - switch rv := req.Value.(type) { - case *grpctest.PrintKVRequest_ValueString: - v = rv.ValueString - - case *grpctest.PrintKVRequest_ValueInt: - v = rv.ValueInt - - default: - panic(fmt.Sprintf("unknown value: %#v", req.Value)) - } - - s.Impl.PrintKV(req.Key, v) - return &grpctest.PrintKVResponse{}, nil -} - -func (s *testGRPCServer) Bidirectional(ctx context.Context, req *grpctest.BidirectionalRequest) (*grpctest.BidirectionalResponse, error) { - conn, err := s.broker.Dial(req.Id) - if err != nil { - return nil, err - } - - pingPongClient := grpctest.NewPingPongClient(conn) - resp, err := pingPongClient.Ping(ctx, &grpctest.PingRequest{}) - if err != nil { - return nil, err - } - if resp.Msg != "pong" { - return nil, errors.New("Bad PingPong") - } - - nextID := s.broker.NextId() - go s.broker.AcceptAndServe(nextID, func(opts []grpc.ServerOption) *grpc.Server { - s := grpc.NewServer(opts...) - grpctest.RegisterPingPongServer(s, &pingPongServer{}) - return s - }) - - return &grpctest.BidirectionalResponse{ - Id: nextID, - }, nil -} - -type pingPongServer struct{} - -func (p *pingPongServer) Ping(ctx context.Context, req *grpctest.PingRequest) (*grpctest.PongResponse, error) { - return &grpctest.PongResponse{ - Msg: "pong", - }, nil -} - -// testGRPCClient is an implementation of TestInterface that communicates -// over gRPC. -type testGRPCClient struct { - Client grpctest.TestClient - broker *GRPCBroker -} - -func (c *testGRPCClient) Double(v int) int { - resp, err := c.Client.Double(context.Background(), &grpctest.TestRequest{ - Input: int32(v), - }) - if err != nil { - panic(err) - } - - return int(resp.Output) -} - -func (c *testGRPCClient) PrintKV(key string, value interface{}) { - req := &grpctest.PrintKVRequest{Key: key} - switch v := value.(type) { - case string: - req.Value = &grpctest.PrintKVRequest_ValueString{ - ValueString: v, - } - - case int: - req.Value = &grpctest.PrintKVRequest_ValueInt{ - ValueInt: int32(v), - } - - default: - panic(fmt.Sprintf("unknown type: %T", value)) - } - - _, err := c.Client.PrintKV(context.Background(), req) - if err != nil { - panic(err) - } -} - -func (c *testGRPCClient) Bidirectional() error { - nextID := c.broker.NextId() - go c.broker.AcceptAndServe(nextID, func(opts []grpc.ServerOption) *grpc.Server { - s := grpc.NewServer(opts...) - grpctest.RegisterPingPongServer(s, &pingPongServer{}) - return s - }) - - resp, err := c.Client.Bidirectional(context.Background(), &grpctest.BidirectionalRequest{ - Id: nextID, - }) - if err != nil { - return err - } - - conn, err := c.broker.Dial(resp.Id) - if err != nil { - return err - } - - pingPongClient := grpctest.NewPingPongClient(conn) - pResp, err := pingPongClient.Ping(context.Background(), &grpctest.PingRequest{}) - if err != nil { - return err - } - if pResp.Msg != "pong" { - return errors.New("Bad PingPong") - } - return nil -} - -func helperProcess(s ...string) *exec.Cmd { - cs := []string{"-test.run=TestHelperProcess", "--"} - cs = append(cs, s...) - env := []string{ - "GO_WANT_HELPER_PROCESS=1", - "PLUGIN_MIN_PORT=10000", - "PLUGIN_MAX_PORT=25000", - } - - cmd := exec.Command(os.Args[0], cs...) - cmd.Env = append(env, os.Environ()...) - return cmd -} - -// This is not a real test. This is just a helper process kicked off by -// tests. -func TestHelperProcess(*testing.T) { - if os.Getenv("GO_WANT_HELPER_PROCESS") != "1" { - return - } - - defer os.Exit(0) - - args := os.Args - for len(args) > 0 { - if args[0] == "--" { - args = args[1:] - break - } - - args = args[1:] - } - - if len(args) == 0 { - fmt.Fprintf(os.Stderr, "No command\n") - os.Exit(2) - } - - // override testPluginMap with one that uses - // hclog logger on its implementation - pluginLogger := hclog.New(&hclog.LoggerOptions{ - Level: hclog.Trace, - Output: os.Stderr, - JSONFormat: true, - }) - - testPlugin := &testInterfaceImpl{ - logger: pluginLogger, - } - - testPluginMap := map[string]Plugin{ - "test": &testInterfacePlugin{Impl: testPlugin}, - } - - cmd, args := args[0], args[1:] - switch cmd { - case "bad-version": - // If we have an arg, we write there on start - if len(args) > 0 { - path := args[0] - err := ioutil.WriteFile(path, []byte("foo"), 0644) - if err != nil { - panic(err) - } - } - - fmt.Printf("%d|%d1|tcp|:1234\n", CoreProtocolVersion, testHandshake.ProtocolVersion) - <-make(chan int) - case "invalid-rpc-address": - fmt.Println("lolinvalid") - case "mock": - fmt.Printf("%d|%d|tcp|:1234\n", CoreProtocolVersion, testHandshake.ProtocolVersion) - <-make(chan int) - case "start-timeout": - time.Sleep(1 * time.Minute) - os.Exit(1) - case "stderr": - fmt.Printf("%d|%d|tcp|:1234\n", CoreProtocolVersion, testHandshake.ProtocolVersion) - os.Stderr.WriteString("HELLO\n") - os.Stderr.WriteString("WORLD\n") - case "stderr-json": - // write values that might be JSON, but aren't KVs - fmt.Printf("%d|%d|tcp|:1234\n", CoreProtocolVersion, testHandshake.ProtocolVersion) - os.Stderr.WriteString("[\"HELLO\"]\n") - os.Stderr.WriteString("12345\n") - case "stdin": - fmt.Printf("%d|%d|tcp|:1234\n", CoreProtocolVersion, testHandshake.ProtocolVersion) - data := make([]byte, 5) - if _, err := os.Stdin.Read(data); err != nil { - log.Printf("stdin read error: %s", err) - os.Exit(100) - } - - if string(data) == "hello" { - os.Exit(0) - } - - os.Exit(1) - case "cleanup": - // Create a defer to write the file. This tests that we get cleaned - // up properly versus just calling os.Exit - path := args[0] - defer func() { - err := ioutil.WriteFile(path, []byte("foo"), 0644) - if err != nil { - panic(err) - } - }() - - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Exit - return - case "test-grpc": - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - GRPCServer: DefaultGRPCServer, - }) - - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-grpc-tls": - // Serve! - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - GRPCServer: DefaultGRPCServer, - TLSProvider: helperTLSProvider, - }) - - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-interface": - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-interface-logger-netrpc": - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-interface-logger-grpc": - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - GRPCServer: DefaultGRPCServer, - }) - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-interface-daemon": - // Serve! - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - }) - - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - case "test-interface-tls": - // Serve! - Serve(&ServeConfig{ - HandshakeConfig: testHandshake, - Plugins: testPluginMap, - TLSProvider: helperTLSProvider, - }) - - // Shouldn't reach here but make sure we exit anyways - os.Exit(0) - default: - fmt.Fprintf(os.Stderr, "Unknown command: %q\n", cmd) - os.Exit(2) - } -} - -func helperTLSProvider() (*tls.Config, error) { - serverCert, err := tls.X509KeyPair([]byte(TestClusterServerCert), []byte(TestClusterServerKey)) - if err != nil { - return nil, err - } - - rootCAs := x509.NewCertPool() - rootCAs.AppendCertsFromPEM([]byte(TestClusterCACert)) - tlsConfig := &tls.Config{ - Certificates: []tls.Certificate{serverCert}, - RootCAs: rootCAs, - ClientCAs: rootCAs, - ClientAuth: tls.VerifyClientCertIfGiven, - ServerName: "127.0.0.1", - } - tlsConfig.BuildNameToCertificate() - - return tlsConfig, nil -} - -const ( - TestClusterCACert = `-----BEGIN CERTIFICATE----- -MIIDPjCCAiagAwIBAgIUfIKsF2VPT7sdFcKOHJH2Ii6K4MwwDQYJKoZIhvcNAQEL -BQAwFjEUMBIGA1UEAxMLbXl2YXVsdC5jb20wIBcNMTYwNTAyMTYwNTQyWhgPMjA2 -NjA0MjAxNjA2MTJaMBYxFDASBgNVBAMTC215dmF1bHQuY29tMIIBIjANBgkqhkiG -9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuOimEXawD2qBoLCFP3Skq5zi1XzzcMAJlfdS -xz9hfymuJb+cN8rB91HOdU9wQCwVKnkUtGWxUnMp0tT0uAZj5NzhNfyinf0JGAbP -67HDzVZhGBHlHTjPX0638yaiUx90cTnucX0N20SgCYct29dMSgcPl+W78D3Jw3xE -JsHQPYS9ASe2eONxG09F/qNw7w/RO5/6WYoV2EmdarMMxq52pPe2chtNMQdSyOUb -cCcIZyk4QVFZ1ZLl6jTnUPb+JoCx1uMxXvMek4NF/5IL0Wr9dw2gKXKVKoHDr6SY -WrCONRw61A5Zwx1V+kn73YX3USRlkufQv/ih6/xThYDAXDC9cwIDAQABo4GBMH8w -DgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFOuKvPiU -G06iHkRXAOeMiUdBfHFyMB8GA1UdIwQYMBaAFOuKvPiUG06iHkRXAOeMiUdBfHFy -MBwGA1UdEQQVMBOCC215dmF1bHQuY29thwR/AAABMA0GCSqGSIb3DQEBCwUAA4IB -AQBcN/UdAMzc7UjRdnIpZvO+5keBGhL/vjltnGM1dMWYHa60Y5oh7UIXF+P1RdNW -n7g80lOyvkSR15/r1rDkqOK8/4oruXU31EcwGhDOC4hU6yMUy4ltV/nBoodHBXNh -MfKiXeOstH1vdI6G0P6W93Bcww6RyV1KH6sT2dbETCw+iq2VN9CrruGIWzd67UT/ -spe/kYttr3UYVV3O9kqgffVVgVXg/JoRZ3J7Hy2UEXfh9UtWNanDlRuXaZgE9s/d -CpA30CHpNXvKeyNeW2ktv+2nAbSpvNW+e6MecBCTBIoDSkgU8ShbrzmDKVwNN66Q -5gn6KxUPBKHEtNzs5DgGM7nq ------END CERTIFICATE-----` - - TestClusterServerCert = `-----BEGIN CERTIFICATE----- -MIIDtzCCAp+gAwIBAgIUBLqh6ctGWVDUxFhxJX7m6S/bnrcwDQYJKoZIhvcNAQEL -BQAwFjEUMBIGA1UEAxMLbXl2YXVsdC5jb20wIBcNMTYwNTAyMTYwOTI2WhgPMjA2 -NjA0MjAxNTA5NTZaMBsxGTAXBgNVBAMTEGNlcnQubXl2YXVsdC5jb20wggEiMA0G -CSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDY3gPB29kkdbu0mPO6J0efagQhSiXB -9OyDuLf5sMk6CVDWVWal5hISkyBmw/lXgF7qC2XFKivpJOrcGQd5Ep9otBqyJLzI -b0IWdXuPIrVnXDwcdWr86ybX2iC42zKWfbXgjzGijeAVpl0UJLKBj+fk5q6NvkRL -5FUL6TRV7Krn9mrmnrV9J5IqV15pTd9W2aVJ6IqWvIPCACtZKulqWn4707uy2X2W -1Stq/5qnp1pDshiGk1VPyxCwQ6yw3iEcgecbYo3vQfhWcv7Q8LpSIM9ZYpXu6OmF -+czqRZS9gERl+wipmmrN1MdYVrTuQem21C/PNZ4jo4XUk1SFx6JrcA+lAgMBAAGj -gfUwgfIwHQYDVR0lBBYwFAYIKwYBBQUHAwEGCCsGAQUFBwMCMB0GA1UdDgQWBBSe -Cl9WV3BjGCwmS/KrDSLRjfwyqjAfBgNVHSMEGDAWgBTrirz4lBtOoh5EVwDnjIlH -QXxxcjA7BggrBgEFBQcBAQQvMC0wKwYIKwYBBQUHMAKGH2h0dHA6Ly8xMjcuMC4w -LjE6ODIwMC92MS9wa2kvY2EwIQYDVR0RBBowGIIQY2VydC5teXZhdWx0LmNvbYcE -fwAAATAxBgNVHR8EKjAoMCagJKAihiBodHRwOi8vMTI3LjAuMC4xOjgyMDAvdjEv -cGtpL2NybDANBgkqhkiG9w0BAQsFAAOCAQEAWGholPN8buDYwKbUiDavbzjsxUIX -lU4MxEqOHw7CD3qIYIauPboLvB9EldBQwhgOOy607Yvdg3rtyYwyBFwPhHo/hK3Z -6mn4hc6TF2V+AUdHBvGzp2dbYLeo8noVoWbQ/lBulggwlIHNNF6+a3kALqsqk1Ch -f/hzsjFnDhAlNcYFgG8TgfE2lE/FckvejPqBffo7Q3I+wVAw0buqiz5QL81NOT+D -Y2S9LLKLRaCsWo9wRU1Az4Rhd7vK5SEMh16jJ82GyEODWPvuxOTI1MnzfnbWyLYe -TTp6YBjGMVf1I6NEcWNur7U17uIOiQjMZ9krNvoMJ1A/cxCoZ98QHgcIPg== ------END CERTIFICATE-----` - - TestClusterServerKey = `-----BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA2N4DwdvZJHW7tJjzuidHn2oEIUolwfTsg7i3+bDJOglQ1lVm -peYSEpMgZsP5V4Be6gtlxSor6STq3BkHeRKfaLQasiS8yG9CFnV7jyK1Z1w8HHVq -/Osm19oguNsyln214I8xoo3gFaZdFCSygY/n5Oaujb5ES+RVC+k0Veyq5/Zq5p61 -fSeSKldeaU3fVtmlSeiKlryDwgArWSrpalp+O9O7stl9ltUrav+ap6daQ7IYhpNV -T8sQsEOssN4hHIHnG2KN70H4VnL+0PC6UiDPWWKV7ujphfnM6kWUvYBEZfsIqZpq -zdTHWFa07kHpttQvzzWeI6OF1JNUhceia3APpQIDAQABAoIBAQCH3vEzr+3nreug -RoPNCXcSJXXY9X+aeT0FeeGqClzIg7Wl03OwVOjVwl/2gqnhbIgK0oE8eiNwurR6 -mSPZcxV0oAJpwiKU4T/imlCDaReGXn86xUX2l82KRxthNdQH/VLKEmzij0jpx4Vh -bWx5SBPdkbmjDKX1dmTiRYWIn/KjyNPvNvmtwdi8Qluhf4eJcNEUr2BtblnGOmfL -FdSu+brPJozpoQ1QdDnbAQRgqnh7Shl0tT85whQi0uquqIj1gEOGVjmBvDDnL3GV -WOENTKqsmIIoEzdZrql1pfmYTk7WNaD92bfpN128j8BF7RmAV4/DphH0pvK05y9m -tmRhyHGxAoGBAOV2BBocsm6xup575VqmFN+EnIOiTn+haOvfdnVsyQHnth63fOQx -PNtMpTPR1OMKGpJ13e2bV0IgcYRsRkScVkUtoa/17VIgqZXffnJJ0A/HT67uKBq3 -8o7RrtyK5N20otw0lZHyqOPhyCdpSsurDhNON1kPVJVYY4N1RiIxfut/AoGBAPHz -HfsJ5ZkyELE9N/r4fce04lprxWH+mQGK0/PfjS9caXPhj/r5ZkVMvzWesF3mmnY8 -goE5S35TuTvV1+6rKGizwlCFAQlyXJiFpOryNWpLwCmDDSzLcm+sToAlML3tMgWU -jM3dWHx3C93c3ft4rSWJaUYI9JbHsMzDW6Yh+GbbAoGBANIbKwxh5Hx5XwEJP2yu -kIROYCYkMy6otHLujgBdmPyWl+suZjxoXWoMl2SIqR8vPD+Jj6mmyNJy9J6lqf3f -DRuQ+fEuBZ1i7QWfvJ+XuN0JyovJ5Iz6jC58D1pAD+p2IX3y5FXcVQs8zVJRFjzB -p0TEJOf2oqORaKWRd6ONoMKvAoGALKu6aVMWdQZtVov6/fdLIcgf0pn7Q3CCR2qe -X3Ry2L+zKJYIw0mwvDLDSt8VqQCenB3n6nvtmFFU7ds5lvM67rnhsoQcAOaAehiS -rl4xxoJd5Ewx7odRhZTGmZpEOYzFo4odxRSM9c30/u18fqV1Mm0AZtHYds4/sk6P -aUj0V+kCgYBMpGrJk8RSez5g0XZ35HfpI4ENoWbiwB59FIpWsLl2LADEh29eC455 -t9Muq7MprBVBHQo11TMLLFxDIjkuMho/gcKgpYXCt0LfiNm8EZehvLJUXH+3WqUx -we6ywrbFCs6LaxaOCtTiLsN+GbZCatITL0UJaeBmTAbiw0KQjUuZPQ== ------END RSA PRIVATE KEY-----` -) diff --git a/vendor/github.com/hashicorp/go-plugin/process.go b/vendor/github.com/hashicorp/go-plugin/process.go deleted file mode 100644 index 88c999a..0000000 --- a/vendor/github.com/hashicorp/go-plugin/process.go +++ /dev/null @@ -1,24 +0,0 @@ -package plugin - -import ( - "time" -) - -// pidAlive checks whether a pid is alive. -func pidAlive(pid int) bool { - return _pidAlive(pid) -} - -// pidWait blocks for a process to exit. -func pidWait(pid int) error { - ticker := time.NewTicker(1 * time.Second) - defer ticker.Stop() - - for range ticker.C { - if !pidAlive(pid) { - break - } - } - - return nil -} diff --git a/vendor/github.com/hashicorp/go-plugin/process_posix.go b/vendor/github.com/hashicorp/go-plugin/process_posix.go deleted file mode 100644 index 70ba546..0000000 --- a/vendor/github.com/hashicorp/go-plugin/process_posix.go +++ /dev/null @@ -1,19 +0,0 @@ -// +build !windows - -package plugin - -import ( - "os" - "syscall" -) - -// _pidAlive tests whether a process is alive or not by sending it Signal 0, -// since Go otherwise has no way to test this. -func _pidAlive(pid int) bool { - proc, err := os.FindProcess(pid) - if err == nil { - err = proc.Signal(syscall.Signal(0)) - } - - return err == nil -} diff --git a/vendor/github.com/hashicorp/go-plugin/process_windows.go b/vendor/github.com/hashicorp/go-plugin/process_windows.go deleted file mode 100644 index 9f7b018..0000000 --- a/vendor/github.com/hashicorp/go-plugin/process_windows.go +++ /dev/null @@ -1,29 +0,0 @@ -package plugin - -import ( - "syscall" -) - -const ( - // Weird name but matches the MSDN docs - exit_STILL_ACTIVE = 259 - - processDesiredAccess = syscall.STANDARD_RIGHTS_READ | - syscall.PROCESS_QUERY_INFORMATION | - syscall.SYNCHRONIZE -) - -// _pidAlive tests whether a process is alive or not -func _pidAlive(pid int) bool { - h, err := syscall.OpenProcess(processDesiredAccess, false, uint32(pid)) - if err != nil { - return false - } - - var ec uint32 - if e := syscall.GetExitCodeProcess(h, &ec); e != nil { - return false - } - - return ec == exit_STILL_ACTIVE -} diff --git a/vendor/github.com/hashicorp/go-plugin/protocol.go b/vendor/github.com/hashicorp/go-plugin/protocol.go deleted file mode 100644 index 0cfc19e..0000000 --- a/vendor/github.com/hashicorp/go-plugin/protocol.go +++ /dev/null @@ -1,45 +0,0 @@ -package plugin - -import ( - "io" - "net" -) - -// Protocol is an enum representing the types of protocols. -type Protocol string - -const ( - ProtocolInvalid Protocol = "" - ProtocolNetRPC Protocol = "netrpc" - ProtocolGRPC Protocol = "grpc" -) - -// ServerProtocol is an interface that must be implemented for new plugin -// protocols to be servers. -type ServerProtocol interface { - // Init is called once to configure and initialize the protocol, but - // not start listening. This is the point at which all validation should - // be done and errors returned. - Init() error - - // Config is extra configuration to be outputted to stdout. This will - // be automatically base64 encoded to ensure it can be parsed properly. - // This can be an empty string if additional configuration is not needed. - Config() string - - // Serve is called to serve connections on the given listener. This should - // continue until the listener is closed. - Serve(net.Listener) -} - -// ClientProtocol is an interface that must be implemented for new plugin -// protocols to be clients. -type ClientProtocol interface { - io.Closer - - // Dispense dispenses a new instance of the plugin with the given name. - Dispense(string) (interface{}, error) - - // Ping checks that the client connection is still healthy. - Ping() error -} diff --git a/vendor/github.com/hashicorp/go-plugin/rpc_client.go b/vendor/github.com/hashicorp/go-plugin/rpc_client.go deleted file mode 100644 index f30a4b1..0000000 --- a/vendor/github.com/hashicorp/go-plugin/rpc_client.go +++ /dev/null @@ -1,170 +0,0 @@ -package plugin - -import ( - "crypto/tls" - "fmt" - "io" - "net" - "net/rpc" - - "github.com/hashicorp/yamux" -) - -// RPCClient connects to an RPCServer over net/rpc to dispense plugin types. -type RPCClient struct { - broker *MuxBroker - control *rpc.Client - plugins map[string]Plugin - - // These are the streams used for the various stdout/err overrides - stdout, stderr net.Conn -} - -// newRPCClient creates a new RPCClient. The Client argument is expected -// to be successfully started already with a lock held. -func newRPCClient(c *Client) (*RPCClient, error) { - // Connect to the client - conn, err := net.Dial(c.address.Network(), c.address.String()) - if err != nil { - return nil, err - } - if tcpConn, ok := conn.(*net.TCPConn); ok { - // Make sure to set keep alive so that the connection doesn't die - tcpConn.SetKeepAlive(true) - } - - if c.config.TLSConfig != nil { - conn = tls.Client(conn, c.config.TLSConfig) - } - - // Create the actual RPC client - result, err := NewRPCClient(conn, c.config.Plugins) - if err != nil { - conn.Close() - return nil, err - } - - // Begin the stream syncing so that stdin, out, err work properly - err = result.SyncStreams( - c.config.SyncStdout, - c.config.SyncStderr) - if err != nil { - result.Close() - return nil, err - } - - return result, nil -} - -// NewRPCClient creates a client from an already-open connection-like value. -// Dial is typically used instead. -func NewRPCClient(conn io.ReadWriteCloser, plugins map[string]Plugin) (*RPCClient, error) { - // Create the yamux client so we can multiplex - mux, err := yamux.Client(conn, nil) - if err != nil { - conn.Close() - return nil, err - } - - // Connect to the control stream. - control, err := mux.Open() - if err != nil { - mux.Close() - return nil, err - } - - // Connect stdout, stderr streams - stdstream := make([]net.Conn, 2) - for i, _ := range stdstream { - stdstream[i], err = mux.Open() - if err != nil { - mux.Close() - return nil, err - } - } - - // Create the broker and start it up - broker := newMuxBroker(mux) - go broker.Run() - - // Build the client using our broker and control channel. - return &RPCClient{ - broker: broker, - control: rpc.NewClient(control), - plugins: plugins, - stdout: stdstream[0], - stderr: stdstream[1], - }, nil -} - -// SyncStreams should be called to enable syncing of stdout, -// stderr with the plugin. -// -// This will return immediately and the syncing will continue to happen -// in the background. You do not need to launch this in a goroutine itself. -// -// This should never be called multiple times. -func (c *RPCClient) SyncStreams(stdout io.Writer, stderr io.Writer) error { - go copyStream("stdout", stdout, c.stdout) - go copyStream("stderr", stderr, c.stderr) - return nil -} - -// Close closes the connection. The client is no longer usable after this -// is called. -func (c *RPCClient) Close() error { - // Call the control channel and ask it to gracefully exit. If this - // errors, then we save it so that we always return an error but we - // want to try to close the other channels anyways. - var empty struct{} - returnErr := c.control.Call("Control.Quit", true, &empty) - - // Close the other streams we have - if err := c.control.Close(); err != nil { - return err - } - if err := c.stdout.Close(); err != nil { - return err - } - if err := c.stderr.Close(); err != nil { - return err - } - if err := c.broker.Close(); err != nil { - return err - } - - // Return back the error we got from Control.Quit. This is very important - // since we MUST return non-nil error if this fails so that Client.Kill - // will properly try a process.Kill. - return returnErr -} - -func (c *RPCClient) Dispense(name string) (interface{}, error) { - p, ok := c.plugins[name] - if !ok { - return nil, fmt.Errorf("unknown plugin type: %s", name) - } - - var id uint32 - if err := c.control.Call( - "Dispenser.Dispense", name, &id); err != nil { - return nil, err - } - - conn, err := c.broker.Dial(id) - if err != nil { - return nil, err - } - - return p.Client(c.broker, rpc.NewClient(conn)) -} - -// Ping pings the connection to ensure it is still alive. -// -// The error from the RPC call is returned exactly if you want to inspect -// it for further error analysis. Any error returned from here would indicate -// that the connection to the plugin is not healthy. -func (c *RPCClient) Ping() error { - var empty struct{} - return c.control.Call("Control.Ping", true, &empty) -} diff --git a/vendor/github.com/hashicorp/go-plugin/rpc_client_test.go b/vendor/github.com/hashicorp/go-plugin/rpc_client_test.go deleted file mode 100644 index 66b29ff..0000000 --- a/vendor/github.com/hashicorp/go-plugin/rpc_client_test.go +++ /dev/null @@ -1,77 +0,0 @@ -package plugin - -import ( - "bytes" - "io" - "os" - "testing" - "time" - - hclog "github.com/hashicorp/go-hclog" -) - -func TestClient_App(t *testing.T) { - pluginLogger := hclog.New(&hclog.LoggerOptions{ - Level: hclog.Trace, - Output: os.Stderr, - JSONFormat: true, - }) - - testPlugin := &testInterfaceImpl{ - logger: pluginLogger, - } - - client, _ := TestPluginRPCConn(t, map[string]Plugin{ - "test": &testInterfacePlugin{Impl: testPlugin}, - }) - defer client.Close() - - raw, err := client.Dispense("test") - if err != nil { - t.Fatalf("err: %s", err) - } - - impl, ok := raw.(testInterface) - if !ok { - t.Fatalf("bad: %#v", raw) - } - - result := impl.Double(21) - if result != 42 { - t.Fatalf("bad: %#v", result) - } -} - -func TestClient_syncStreams(t *testing.T) { - client, server := TestPluginRPCConn(t, map[string]Plugin{}) - - // Create streams for the server that we can talk to - stdout_r, stdout_w := io.Pipe() - stderr_r, stderr_w := io.Pipe() - server.Stdout = stdout_r - server.Stderr = stderr_r - - // Start the data copying - var stdout_out, stderr_out bytes.Buffer - stdout := bytes.NewBufferString("stdouttest") - stderr := bytes.NewBufferString("stderrtest") - go client.SyncStreams(&stdout_out, &stderr_out) - go io.Copy(stdout_w, stdout) - go io.Copy(stderr_w, stderr) - - // Unfortunately I can't think of a better way to make sure all the - // copies above go through so let's just exit. - time.Sleep(100 * time.Millisecond) - - // Close everything, and lets test the result - client.Close() - stdout_w.Close() - stderr_w.Close() - - if v := stdout_out.String(); v != "stdouttest" { - t.Fatalf("bad: %s", v) - } - if v := stderr_out.String(); v != "stderrtest" { - t.Fatalf("bad: %s", v) - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/rpc_server.go b/vendor/github.com/hashicorp/go-plugin/rpc_server.go deleted file mode 100644 index 5bb18dd..0000000 --- a/vendor/github.com/hashicorp/go-plugin/rpc_server.go +++ /dev/null @@ -1,197 +0,0 @@ -package plugin - -import ( - "errors" - "fmt" - "io" - "log" - "net" - "net/rpc" - "sync" - - "github.com/hashicorp/yamux" -) - -// RPCServer listens for network connections and then dispenses interface -// implementations over net/rpc. -// -// After setting the fields below, they shouldn't be read again directly -// from the structure which may be reading/writing them concurrently. -type RPCServer struct { - Plugins map[string]Plugin - - // Stdout, Stderr are what this server will use instead of the - // normal stdin/out/err. This is because due to the multi-process nature - // of our plugin system, we can't use the normal process values so we - // make our own custom one we pipe across. - Stdout io.Reader - Stderr io.Reader - - // DoneCh should be set to a non-nil channel that will be closed - // when the control requests the RPC server to end. - DoneCh chan<- struct{} - - lock sync.Mutex -} - -// ServerProtocol impl. -func (s *RPCServer) Init() error { return nil } - -// ServerProtocol impl. -func (s *RPCServer) Config() string { return "" } - -// ServerProtocol impl. -func (s *RPCServer) Serve(lis net.Listener) { - for { - conn, err := lis.Accept() - if err != nil { - log.Printf("[ERR] plugin: plugin server: %s", err) - return - } - - go s.ServeConn(conn) - } -} - -// ServeConn runs a single connection. -// -// ServeConn blocks, serving the connection until the client hangs up. -func (s *RPCServer) ServeConn(conn io.ReadWriteCloser) { - // First create the yamux server to wrap this connection - mux, err := yamux.Server(conn, nil) - if err != nil { - conn.Close() - log.Printf("[ERR] plugin: error creating yamux server: %s", err) - return - } - - // Accept the control connection - control, err := mux.Accept() - if err != nil { - mux.Close() - if err != io.EOF { - log.Printf("[ERR] plugin: error accepting control connection: %s", err) - } - - return - } - - // Connect the stdstreams (in, out, err) - stdstream := make([]net.Conn, 2) - for i, _ := range stdstream { - stdstream[i], err = mux.Accept() - if err != nil { - mux.Close() - log.Printf("[ERR] plugin: accepting stream %d: %s", i, err) - return - } - } - - // Copy std streams out to the proper place - go copyStream("stdout", stdstream[0], s.Stdout) - go copyStream("stderr", stdstream[1], s.Stderr) - - // Create the broker and start it up - broker := newMuxBroker(mux) - go broker.Run() - - // Use the control connection to build the dispenser and serve the - // connection. - server := rpc.NewServer() - server.RegisterName("Control", &controlServer{ - server: s, - }) - server.RegisterName("Dispenser", &dispenseServer{ - broker: broker, - plugins: s.Plugins, - }) - server.ServeConn(control) -} - -// done is called internally by the control server to trigger the -// doneCh to close which is listened to by the main process to cleanly -// exit. -func (s *RPCServer) done() { - s.lock.Lock() - defer s.lock.Unlock() - - if s.DoneCh != nil { - close(s.DoneCh) - s.DoneCh = nil - } -} - -// dispenseServer dispenses variousinterface implementations for Terraform. -type controlServer struct { - server *RPCServer -} - -// Ping can be called to verify the connection (and likely the binary) -// is still alive to a plugin. -func (c *controlServer) Ping( - null bool, response *struct{}) error { - *response = struct{}{} - return nil -} - -func (c *controlServer) Quit( - null bool, response *struct{}) error { - // End the server - c.server.done() - - // Always return true - *response = struct{}{} - - return nil -} - -// dispenseServer dispenses variousinterface implementations for Terraform. -type dispenseServer struct { - broker *MuxBroker - plugins map[string]Plugin -} - -func (d *dispenseServer) Dispense( - name string, response *uint32) error { - // Find the function to create this implementation - p, ok := d.plugins[name] - if !ok { - return fmt.Errorf("unknown plugin type: %s", name) - } - - // Create the implementation first so we know if there is an error. - impl, err := p.Server(d.broker) - if err != nil { - // We turn the error into an errors error so that it works across RPC - return errors.New(err.Error()) - } - - // Reserve an ID for our implementation - id := d.broker.NextId() - *response = id - - // Run the rest in a goroutine since it can only happen once this RPC - // call returns. We wait for a connection for the plugin implementation - // and serve it. - go func() { - conn, err := d.broker.Accept(id) - if err != nil { - log.Printf("[ERR] go-plugin: plugin dispense error: %s: %s", name, err) - return - } - - serve(conn, "Plugin", impl) - }() - - return nil -} - -func serve(conn io.ReadWriteCloser, name string, v interface{}) { - server := rpc.NewServer() - if err := server.RegisterName(name, v); err != nil { - log.Printf("[ERR] go-plugin: plugin dispense error: %s", err) - return - } - - server.ServeConn(conn) -} diff --git a/vendor/github.com/hashicorp/go-plugin/server.go b/vendor/github.com/hashicorp/go-plugin/server.go deleted file mode 100644 index 1e808b9..0000000 --- a/vendor/github.com/hashicorp/go-plugin/server.go +++ /dev/null @@ -1,317 +0,0 @@ -package plugin - -import ( - "crypto/tls" - "encoding/base64" - "errors" - "fmt" - "io/ioutil" - "log" - "net" - "os" - "os/signal" - "runtime" - "strconv" - "sync/atomic" - - "github.com/hashicorp/go-hclog" - - "google.golang.org/grpc" -) - -// CoreProtocolVersion is the ProtocolVersion of the plugin system itself. -// We will increment this whenever we change any protocol behavior. This -// will invalidate any prior plugins but will at least allow us to iterate -// on the core in a safe way. We will do our best to do this very -// infrequently. -const CoreProtocolVersion = 1 - -// HandshakeConfig is the configuration used by client and servers to -// handshake before starting a plugin connection. This is embedded by -// both ServeConfig and ClientConfig. -// -// In practice, the plugin host creates a HandshakeConfig that is exported -// and plugins then can easily consume it. -type HandshakeConfig struct { - // ProtocolVersion is the version that clients must match on to - // agree they can communicate. This should match the ProtocolVersion - // set on ClientConfig when using a plugin. - ProtocolVersion uint - - // MagicCookieKey and value are used as a very basic verification - // that a plugin is intended to be launched. This is not a security - // measure, just a UX feature. If the magic cookie doesn't match, - // we show human-friendly output. - MagicCookieKey string - MagicCookieValue string -} - -// ServeConfig configures what sorts of plugins are served. -type ServeConfig struct { - // HandshakeConfig is the configuration that must match clients. - HandshakeConfig - - // TLSProvider is a function that returns a configured tls.Config. - TLSProvider func() (*tls.Config, error) - - // Plugins are the plugins that are served. - Plugins map[string]Plugin - - // GRPCServer should be non-nil to enable serving the plugins over - // gRPC. This is a function to create the server when needed with the - // given server options. The server options populated by go-plugin will - // be for TLS if set. You may modify the input slice. - // - // Note that the grpc.Server will automatically be registered with - // the gRPC health checking service. This is not optional since go-plugin - // relies on this to implement Ping(). - GRPCServer func([]grpc.ServerOption) *grpc.Server - - // Logger is used to pass a logger into the server. If none is provided the - // server will create a default logger. - Logger hclog.Logger -} - -// Protocol returns the protocol that this server should speak. -func (c *ServeConfig) Protocol() Protocol { - result := ProtocolNetRPC - if c.GRPCServer != nil { - result = ProtocolGRPC - } - - return result -} - -// Serve serves the plugins given by ServeConfig. -// -// Serve doesn't return until the plugin is done being executed. Any -// errors will be outputted to os.Stderr. -// -// This is the method that plugins should call in their main() functions. -func Serve(opts *ServeConfig) { - // Validate the handshake config - if opts.MagicCookieKey == "" || opts.MagicCookieValue == "" { - fmt.Fprintf(os.Stderr, - "Misconfigured ServeConfig given to serve this plugin: no magic cookie\n"+ - "key or value was set. Please notify the plugin author and report\n"+ - "this as a bug.\n") - os.Exit(1) - } - - // First check the cookie - if os.Getenv(opts.MagicCookieKey) != opts.MagicCookieValue { - fmt.Fprintf(os.Stderr, - "This binary is a plugin. These are not meant to be executed directly.\n"+ - "Please execute the program that consumes these plugins, which will\n"+ - "load any plugins automatically\n") - os.Exit(1) - } - - // Logging goes to the original stderr - log.SetOutput(os.Stderr) - - logger := opts.Logger - if logger == nil { - // internal logger to os.Stderr - logger = hclog.New(&hclog.LoggerOptions{ - Level: hclog.Trace, - Output: os.Stderr, - JSONFormat: true, - }) - } - - // Create our new stdout, stderr files. These will override our built-in - // stdout/stderr so that it works across the stream boundary. - stdout_r, stdout_w, err := os.Pipe() - if err != nil { - fmt.Fprintf(os.Stderr, "Error preparing plugin: %s\n", err) - os.Exit(1) - } - stderr_r, stderr_w, err := os.Pipe() - if err != nil { - fmt.Fprintf(os.Stderr, "Error preparing plugin: %s\n", err) - os.Exit(1) - } - - // Register a listener so we can accept a connection - listener, err := serverListener() - if err != nil { - logger.Error("plugin init error", "error", err) - return - } - - // Close the listener on return. We wrap this in a func() on purpose - // because the "listener" reference may change to TLS. - defer func() { - listener.Close() - }() - - var tlsConfig *tls.Config - if opts.TLSProvider != nil { - tlsConfig, err = opts.TLSProvider() - if err != nil { - logger.Error("plugin tls init", "error", err) - return - } - } - - // Create the channel to tell us when we're done - doneCh := make(chan struct{}) - - // Build the server type - var server ServerProtocol - switch opts.Protocol() { - case ProtocolNetRPC: - // If we have a TLS configuration then we wrap the listener - // ourselves and do it at that level. - if tlsConfig != nil { - listener = tls.NewListener(listener, tlsConfig) - } - - // Create the RPC server to dispense - server = &RPCServer{ - Plugins: opts.Plugins, - Stdout: stdout_r, - Stderr: stderr_r, - DoneCh: doneCh, - } - - case ProtocolGRPC: - // Create the gRPC server - server = &GRPCServer{ - Plugins: opts.Plugins, - Server: opts.GRPCServer, - TLS: tlsConfig, - Stdout: stdout_r, - Stderr: stderr_r, - DoneCh: doneCh, - } - - default: - panic("unknown server protocol: " + opts.Protocol()) - } - - // Initialize the servers - if err := server.Init(); err != nil { - logger.Error("protocol init", "error", err) - return - } - - // Build the extra configuration - extra := "" - if v := server.Config(); v != "" { - extra = base64.StdEncoding.EncodeToString([]byte(v)) - } - if extra != "" { - extra = "|" + extra - } - - logger.Debug("plugin address", "network", listener.Addr().Network(), "address", listener.Addr().String()) - - // Output the address and service name to stdout so that core can bring it up. - fmt.Printf("%d|%d|%s|%s|%s%s\n", - CoreProtocolVersion, - opts.ProtocolVersion, - listener.Addr().Network(), - listener.Addr().String(), - opts.Protocol(), - extra) - os.Stdout.Sync() - - // Eat the interrupts - ch := make(chan os.Signal, 1) - signal.Notify(ch, os.Interrupt) - go func() { - var count int32 = 0 - for { - <-ch - newCount := atomic.AddInt32(&count, 1) - logger.Debug("plugin received interrupt signal, ignoring", "count", newCount) - } - }() - - // Set our new out, err - os.Stdout = stdout_w - os.Stderr = stderr_w - - // Accept connections and wait for completion - go server.Serve(listener) - <-doneCh -} - -func serverListener() (net.Listener, error) { - if runtime.GOOS == "windows" { - return serverListener_tcp() - } - - return serverListener_unix() -} - -func serverListener_tcp() (net.Listener, error) { - minPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MIN_PORT"), 10, 32) - if err != nil { - return nil, err - } - - maxPort, err := strconv.ParseInt(os.Getenv("PLUGIN_MAX_PORT"), 10, 32) - if err != nil { - return nil, err - } - - for port := minPort; port <= maxPort; port++ { - address := fmt.Sprintf("127.0.0.1:%d", port) - listener, err := net.Listen("tcp", address) - if err == nil { - return listener, nil - } - } - - return nil, errors.New("Couldn't bind plugin TCP listener") -} - -func serverListener_unix() (net.Listener, error) { - tf, err := ioutil.TempFile("", "plugin") - if err != nil { - return nil, err - } - path := tf.Name() - - // Close the file and remove it because it has to not exist for - // the domain socket. - if err := tf.Close(); err != nil { - return nil, err - } - if err := os.Remove(path); err != nil { - return nil, err - } - - l, err := net.Listen("unix", path) - if err != nil { - return nil, err - } - - // Wrap the listener in rmListener so that the Unix domain socket file - // is removed on close. - return &rmListener{ - Listener: l, - Path: path, - }, nil -} - -// rmListener is an implementation of net.Listener that forwards most -// calls to the listener but also removes a file as part of the close. We -// use this to cleanup the unix domain socket on close. -type rmListener struct { - net.Listener - Path string -} - -func (l *rmListener) Close() error { - // Close the listener itself - if err := l.Listener.Close(); err != nil { - return err - } - - // Remove the file - return os.Remove(l.Path) -} diff --git a/vendor/github.com/hashicorp/go-plugin/server_mux.go b/vendor/github.com/hashicorp/go-plugin/server_mux.go deleted file mode 100644 index 033079e..0000000 --- a/vendor/github.com/hashicorp/go-plugin/server_mux.go +++ /dev/null @@ -1,31 +0,0 @@ -package plugin - -import ( - "fmt" - "os" -) - -// ServeMuxMap is the type that is used to configure ServeMux -type ServeMuxMap map[string]*ServeConfig - -// ServeMux is like Serve, but serves multiple types of plugins determined -// by the argument given on the command-line. -// -// This command doesn't return until the plugin is done being executed. Any -// errors are logged or output to stderr. -func ServeMux(m ServeMuxMap) { - if len(os.Args) != 2 { - fmt.Fprintf(os.Stderr, - "Invoked improperly. This is an internal command that shouldn't\n"+ - "be manually invoked.\n") - os.Exit(1) - } - - opts, ok := m[os.Args[1]] - if !ok { - fmt.Fprintf(os.Stderr, "Unknown plugin: %s\n", os.Args[1]) - os.Exit(1) - } - - Serve(opts) -} diff --git a/vendor/github.com/hashicorp/go-plugin/server_test.go b/vendor/github.com/hashicorp/go-plugin/server_test.go deleted file mode 100644 index 7faa921..0000000 --- a/vendor/github.com/hashicorp/go-plugin/server_test.go +++ /dev/null @@ -1,44 +0,0 @@ -package plugin - -import ( - "io/ioutil" - "net" - "os" - "testing" -) - -func TestRmListener_impl(t *testing.T) { - var _ net.Listener = new(rmListener) -} - -func TestRmListener(t *testing.T) { - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - tf, err := ioutil.TempFile("", "plugin") - if err != nil { - t.Fatalf("err: %s", err) - } - path := tf.Name() - - // Close the file - if err := tf.Close(); err != nil { - t.Fatalf("err: %s", err) - } - - // Create the listener and test close - rmL := &rmListener{ - Listener: l, - Path: path, - } - if err := rmL.Close(); err != nil { - t.Fatalf("err: %s", err) - } - - // File should be goe - if _, err := os.Stat(path); err == nil || !os.IsNotExist(err) { - t.Fatalf("err: %s", err) - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/stream.go b/vendor/github.com/hashicorp/go-plugin/stream.go deleted file mode 100644 index 1d547aa..0000000 --- a/vendor/github.com/hashicorp/go-plugin/stream.go +++ /dev/null @@ -1,18 +0,0 @@ -package plugin - -import ( - "io" - "log" -) - -func copyStream(name string, dst io.Writer, src io.Reader) { - if src == nil { - panic(name + ": src is nil") - } - if dst == nil { - panic(name + ": dst is nil") - } - if _, err := io.Copy(dst, src); err != nil && err != io.EOF { - log.Printf("[ERR] plugin: stream copy '%s' error: %s", name, err) - } -} diff --git a/vendor/github.com/hashicorp/go-plugin/testing.go b/vendor/github.com/hashicorp/go-plugin/testing.go deleted file mode 100644 index 2dcd35c..0000000 --- a/vendor/github.com/hashicorp/go-plugin/testing.go +++ /dev/null @@ -1,156 +0,0 @@ -package plugin - -import ( - "bytes" - "context" - "net" - "net/rpc" - - "github.com/mitchellh/go-testing-interface" - "google.golang.org/grpc" -) - -// The testing file contains test helpers that you can use outside of -// this package for making it easier to test plugins themselves. - -// TestConn is a helper function for returning a client and server -// net.Conn connected to each other. -func TestConn(t testing.T) (net.Conn, net.Conn) { - // Listen to any local port. This listener will be closed - // after a single connection is established. - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - // Start a goroutine to accept our client connection - var serverConn net.Conn - doneCh := make(chan struct{}) - go func() { - defer close(doneCh) - defer l.Close() - var err error - serverConn, err = l.Accept() - if err != nil { - t.Fatalf("err: %s", err) - } - }() - - // Connect to the server - clientConn, err := net.Dial("tcp", l.Addr().String()) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Wait for the server side to acknowledge it has connected - <-doneCh - - return clientConn, serverConn -} - -// TestRPCConn returns a rpc client and server connected to each other. -func TestRPCConn(t testing.T) (*rpc.Client, *rpc.Server) { - clientConn, serverConn := TestConn(t) - - server := rpc.NewServer() - go server.ServeConn(serverConn) - - client := rpc.NewClient(clientConn) - return client, server -} - -// TestPluginRPCConn returns a plugin RPC client and server that are connected -// together and configured. -func TestPluginRPCConn(t testing.T, ps map[string]Plugin) (*RPCClient, *RPCServer) { - // Create two net.Conns we can use to shuttle our control connection - clientConn, serverConn := TestConn(t) - - // Start up the server - server := &RPCServer{Plugins: ps, Stdout: new(bytes.Buffer), Stderr: new(bytes.Buffer)} - go server.ServeConn(serverConn) - - // Connect the client to the server - client, err := NewRPCClient(clientConn, ps) - if err != nil { - t.Fatalf("err: %s", err) - } - - return client, server -} - -// TestGRPCConn returns a gRPC client conn and grpc server that are connected -// together and configured. The register function is used to register services -// prior to the Serve call. This is used to test gRPC connections. -func TestGRPCConn(t testing.T, register func(*grpc.Server)) (*grpc.ClientConn, *grpc.Server) { - // Create a listener - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - server := grpc.NewServer() - register(server) - go server.Serve(l) - - // Connect to the server - conn, err := grpc.Dial( - l.Addr().String(), - grpc.WithBlock(), - grpc.WithInsecure()) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Connection successful, close the listener - l.Close() - - return conn, server -} - -// TestPluginGRPCConn returns a plugin gRPC client and server that are connected -// together and configured. This is used to test gRPC connections. -func TestPluginGRPCConn(t testing.T, ps map[string]Plugin) (*GRPCClient, *GRPCServer) { - // Create a listener - l, err := net.Listen("tcp", "127.0.0.1:0") - if err != nil { - t.Fatalf("err: %s", err) - } - - // Start up the server - server := &GRPCServer{ - Plugins: ps, - Server: DefaultGRPCServer, - Stdout: new(bytes.Buffer), - Stderr: new(bytes.Buffer), - } - if err := server.Init(); err != nil { - t.Fatalf("err: %s", err) - } - go server.Serve(l) - - // Connect to the server - conn, err := grpc.Dial( - l.Addr().String(), - grpc.WithBlock(), - grpc.WithInsecure()) - if err != nil { - t.Fatalf("err: %s", err) - } - - // Connection successful, close the listener - l.Close() - - brokerGRPCClient := newGRPCBrokerClient(conn) - broker := newGRPCBroker(brokerGRPCClient, nil) - go broker.Run() - go brokerGRPCClient.StartStream() - // Create the client - client := &GRPCClient{ - Conn: conn, - Plugins: ps, - broker: broker, - doneCtx: context.Background(), - } - - return client, server -} diff --git a/vendor/github.com/hashicorp/go-uuid/.travis.yml b/vendor/github.com/hashicorp/go-uuid/.travis.yml deleted file mode 100644 index 7698490..0000000 --- a/vendor/github.com/hashicorp/go-uuid/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -sudo: false - -go: - - 1.4 - - 1.5 - - 1.6 - - tip - -script: - - go test -bench . -benchmem -v ./... diff --git a/vendor/github.com/hashicorp/go-uuid/LICENSE b/vendor/github.com/hashicorp/go-uuid/LICENSE deleted file mode 100644 index e87a115..0000000 --- a/vendor/github.com/hashicorp/go-uuid/LICENSE +++ /dev/null @@ -1,363 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. "Contributor" - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. "Contributor Version" - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor's Contribution. - -1.3. "Contribution" - - means Covered Software of a particular Contributor. - -1.4. "Covered Software" - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. "Incompatible With Secondary Licenses" - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of - version 1.1 or earlier of the License, but not also under the terms of - a Secondary License. - -1.6. "Executable Form" - - means any form of the work other than Source Code Form. - -1.7. "Larger Work" - - means a work that combines Covered Software with other material, in a - separate file or files, that is not Covered Software. - -1.8. "License" - - means this document. - -1.9. "Licensable" - - means having the right to grant, to the maximum extent possible, whether - at the time of the initial grant or subsequently, any and all of the - rights conveyed by this License. - -1.10. "Modifications" - - means any of the following: - - a. any file in Source Code Form that results from an addition to, - deletion from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. "Patent Claims" of a Contributor - - means any patent claim(s), including without limitation, method, - process, and apparatus claims, in any patent Licensable by such - Contributor that would be infringed, but for the grant of the License, - by the making, using, selling, offering for sale, having made, import, - or transfer of either its Contributions or its Contributor Version. - -1.12. "Secondary License" - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. "Source Code Form" - - means the form of the work preferred for making modifications. - -1.14. "You" (or "Your") - - means an individual or a legal entity exercising rights under this - License. For legal entities, "You" includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, "control" means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or - as part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its - Contributions or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution - become effective for each Contribution on the date the Contributor first - distributes such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under - this License. No additional rights or licenses will be implied from the - distribution or licensing of Covered Software under this License. - Notwithstanding Section 2.1(b) above, no patent license is granted by a - Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party's - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of - its Contributions. - - This License does not grant any rights in the trademarks, service marks, - or logos of any Contributor (except as may be necessary to comply with - the notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this - License (see Section 10.2) or under the terms of a Secondary License (if - permitted under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its - Contributions are its original creation(s) or it has sufficient rights to - grant the rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under - applicable copyright doctrines of fair use, fair dealing, or other - equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under - the terms of this License. You must inform recipients that the Source - Code Form of the Covered Software is governed by the terms of this - License, and how they can obtain a copy of this License. You may not - attempt to alter or restrict the recipients' rights in the Source Code - Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this - License, or sublicense it under different terms, provided that the - license for the Executable Form does not attempt to limit or alter the - recipients' rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for - the Covered Software. If the Larger Work is a combination of Covered - Software with a work governed by one or more Secondary Licenses, and the - Covered Software is not Incompatible With Secondary Licenses, this - License permits You to additionally distribute such Covered Software - under the terms of such Secondary License(s), so that the recipient of - the Larger Work may, at their option, further distribute the Covered - Software under the terms of either this License or such Secondary - License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices - (including copyright notices, patent notices, disclaimers of warranty, or - limitations of liability) contained within the Source Code Form of the - Covered Software, except that You may alter any license notices to the - extent required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on - behalf of any Contributor. You must make it absolutely clear that any - such warranty, support, indemnity, or liability obligation is offered by - You alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, - judicial order, or regulation then You must: (a) comply with the terms of - this License to the maximum extent possible; and (b) describe the - limitations and the code they affect. Such description must be placed in a - text file included with all distributions of the Covered Software under - this License. Except to the extent prohibited by statute or regulation, - such description must be sufficiently detailed for a recipient of ordinary - skill to be able to understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing - basis, if such Contributor fails to notify You of the non-compliance by - some reasonable means prior to 60 days after You have come back into - compliance. Moreover, Your grants from a particular Contributor are - reinstated on an ongoing basis if such Contributor notifies You of the - non-compliance by some reasonable means, this is the first time You have - received notice of non-compliance with this License from such - Contributor, and You become compliant prior to 30 days after Your receipt - of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, - counter-claims, and cross-claims) alleging that a Contributor Version - directly or indirectly infringes any patent, then the rights granted to - You by any and all Contributors for the Covered Software under Section - 2.1 of this License shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an "as is" basis, - without warranty of any kind, either expressed, implied, or statutory, - including, without limitation, warranties that the Covered Software is free - of defects, merchantable, fit for a particular purpose or non-infringing. - The entire risk as to the quality and performance of the Covered Software - is with You. Should any Covered Software prove defective in any respect, - You (not any Contributor) assume the cost of any necessary servicing, - repair, or correction. This disclaimer of warranty constitutes an essential - part of this License. No use of any Covered Software is authorized under - this License except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from - such party's negligence to the extent applicable law prohibits such - limitation. Some jurisdictions do not allow the exclusion or limitation of - incidental or consequential damages, so this exclusion and limitation may - not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts - of a jurisdiction where the defendant maintains its principal place of - business and such litigation shall be governed by laws of that - jurisdiction, without reference to its conflict-of-law provisions. Nothing - in this Section shall prevent a party's ability to bring cross-claims or - counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject - matter hereof. If any provision of this License is held to be - unenforceable, such provision shall be reformed only to the extent - necessary to make it enforceable. Any law or regulation which provides that - the language of a contract shall be construed against the drafter shall not - be used to construe this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version - of the License under which You originally received the Covered Software, - or under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a - modified version of this License if you rename the license and remove - any references to the name of the license steward (except to note that - such modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary - Licenses If You choose to distribute Source Code Form that is - Incompatible With Secondary Licenses under the terms of this version of - the License, the notice described in Exhibit B of this License must be - attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, -then You may include the notice in a location (such as a LICENSE file in a -relevant directory) where a recipient would be likely to look for such a -notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - "Incompatible With Secondary Licenses" Notice - - This Source Code Form is "Incompatible - With Secondary Licenses", as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-uuid/README.md b/vendor/github.com/hashicorp/go-uuid/README.md deleted file mode 100644 index 02565c8..0000000 --- a/vendor/github.com/hashicorp/go-uuid/README.md +++ /dev/null @@ -1,8 +0,0 @@ -# uuid [![Build Status](https://travis-ci.org/hashicorp/go-uuid.svg?branch=master)](https://travis-ci.org/hashicorp/go-uuid) - -Generates UUID-format strings using high quality, purely random bytes. It can also parse UUID-format strings into their component bytes. - -Documentation -============= - -The full documentation is available on [Godoc](http://godoc.org/github.com/hashicorp/go-uuid). diff --git a/vendor/github.com/hashicorp/go-uuid/uuid.go b/vendor/github.com/hashicorp/go-uuid/uuid.go deleted file mode 100644 index ff9364c..0000000 --- a/vendor/github.com/hashicorp/go-uuid/uuid.go +++ /dev/null @@ -1,65 +0,0 @@ -package uuid - -import ( - "crypto/rand" - "encoding/hex" - "fmt" -) - -// GenerateRandomBytes is used to generate random bytes of given size. -func GenerateRandomBytes(size int) ([]byte, error) { - buf := make([]byte, size) - if _, err := rand.Read(buf); err != nil { - return nil, fmt.Errorf("failed to read random bytes: %v", err) - } - return buf, nil -} - -// GenerateUUID is used to generate a random UUID -func GenerateUUID() (string, error) { - buf, err := GenerateRandomBytes(16) - if err != nil { - return "", err - } - return FormatUUID(buf) -} - -func FormatUUID(buf []byte) (string, error) { - if len(buf) != 16 { - return "", fmt.Errorf("wrong length byte slice (%d)", len(buf)) - } - - return fmt.Sprintf("%08x-%04x-%04x-%04x-%12x", - buf[0:4], - buf[4:6], - buf[6:8], - buf[8:10], - buf[10:16]), nil -} - -func ParseUUID(uuid string) ([]byte, error) { - if len(uuid) != 36 { - return nil, fmt.Errorf("uuid string is wrong length") - } - - hyph := []byte("-") - - if uuid[8] != hyph[0] || - uuid[13] != hyph[0] || - uuid[18] != hyph[0] || - uuid[23] != hyph[0] { - return nil, fmt.Errorf("uuid is improperly formatted") - } - - hexStr := uuid[0:8] + uuid[9:13] + uuid[14:18] + uuid[19:23] + uuid[24:36] - - ret, err := hex.DecodeString(hexStr) - if err != nil { - return nil, err - } - if len(ret) != 16 { - return nil, fmt.Errorf("decoded hex is the wrong length") - } - - return ret, nil -} diff --git a/vendor/github.com/hashicorp/go-uuid/uuid_test.go b/vendor/github.com/hashicorp/go-uuid/uuid_test.go deleted file mode 100644 index a558fdd..0000000 --- a/vendor/github.com/hashicorp/go-uuid/uuid_test.go +++ /dev/null @@ -1,57 +0,0 @@ -package uuid - -import ( - "crypto/rand" - "reflect" - "regexp" - "testing" -) - -func TestGenerateUUID(t *testing.T) { - prev, err := GenerateUUID() - if err != nil { - t.Fatal(err) - } - for i := 0; i < 100; i++ { - id, err := GenerateUUID() - if err != nil { - t.Fatal(err) - } - if prev == id { - t.Fatalf("Should get a new ID!") - } - - matched, err := regexp.MatchString( - "[\\da-f]{8}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{4}-[\\da-f]{12}", id) - if !matched || err != nil { - t.Fatalf("expected match %s %v %s", id, matched, err) - } - } -} - -func TestParseUUID(t *testing.T) { - buf := make([]byte, 16) - if _, err := rand.Read(buf); err != nil { - t.Fatalf("failed to read random bytes: %v", err) - } - - uuidStr, err := FormatUUID(buf) - if err != nil { - t.Fatal(err) - } - - parsedStr, err := ParseUUID(uuidStr) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(parsedStr, buf) { - t.Fatalf("mismatched buffers") - } -} - -func BenchmarkGenerateUUID(b *testing.B) { - for n := 0; n < b.N; n++ { - _, _ = GenerateUUID() - } -} diff --git a/vendor/github.com/hashicorp/go-version/.travis.yml b/vendor/github.com/hashicorp/go-version/.travis.yml deleted file mode 100644 index 3f45b1e..0000000 --- a/vendor/github.com/hashicorp/go-version/.travis.yml +++ /dev/null @@ -1,12 +0,0 @@ -language: go - -go: - - 1.0 - - 1.1 - - 1.2 - - 1.3 - - 1.4 - - 1.9 - -script: - - go test diff --git a/vendor/github.com/hashicorp/go-version/LICENSE b/vendor/github.com/hashicorp/go-version/LICENSE deleted file mode 100644 index c33dcc7..0000000 --- a/vendor/github.com/hashicorp/go-version/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/go-version/README.md b/vendor/github.com/hashicorp/go-version/README.md deleted file mode 100644 index 6f3a15c..0000000 --- a/vendor/github.com/hashicorp/go-version/README.md +++ /dev/null @@ -1,65 +0,0 @@ -# Versioning Library for Go -[![Build Status](https://travis-ci.org/hashicorp/go-version.svg?branch=master)](https://travis-ci.org/hashicorp/go-version) - -go-version is a library for parsing versions and version constraints, -and verifying versions against a set of constraints. go-version -can sort a collection of versions properly, handles prerelease/beta -versions, can increment versions, etc. - -Versions used with go-version must follow [SemVer](http://semver.org/). - -## Installation and Usage - -Package documentation can be found on -[GoDoc](http://godoc.org/github.com/hashicorp/go-version). - -Installation can be done with a normal `go get`: - -``` -$ go get github.com/hashicorp/go-version -``` - -#### Version Parsing and Comparison - -```go -v1, err := version.NewVersion("1.2") -v2, err := version.NewVersion("1.5+metadata") - -// Comparison example. There is also GreaterThan, Equal, and just -// a simple Compare that returns an int allowing easy >=, <=, etc. -if v1.LessThan(v2) { - fmt.Printf("%s is less than %s", v1, v2) -} -``` - -#### Version Constraints - -```go -v1, err := version.NewVersion("1.2") - -// Constraints example. -constraints, err := version.NewConstraint(">= 1.0, < 1.4") -if constraints.Check(v1) { - fmt.Printf("%s satisfies constraints %s", v1, constraints) -} -``` - -#### Version Sorting - -```go -versionsRaw := []string{"1.1", "0.7.1", "1.4-beta", "1.4", "2"} -versions := make([]*version.Version, len(versionsRaw)) -for i, raw := range versionsRaw { - v, _ := version.NewVersion(raw) - versions[i] = v -} - -// After this, the versions are properly sorted -sort.Sort(version.Collection(versions)) -``` - -## Issues and Contributing - -If you find an issue with this library, please report an issue. If you'd -like, we welcome any contributions. Fork this library and submit a pull -request. diff --git a/vendor/github.com/hashicorp/go-version/constraint.go b/vendor/github.com/hashicorp/go-version/constraint.go deleted file mode 100644 index 8c73df0..0000000 --- a/vendor/github.com/hashicorp/go-version/constraint.go +++ /dev/null @@ -1,178 +0,0 @@ -package version - -import ( - "fmt" - "regexp" - "strings" -) - -// Constraint represents a single constraint for a version, such as -// ">= 1.0". -type Constraint struct { - f constraintFunc - check *Version - original string -} - -// Constraints is a slice of constraints. We make a custom type so that -// we can add methods to it. -type Constraints []*Constraint - -type constraintFunc func(v, c *Version) bool - -var constraintOperators map[string]constraintFunc - -var constraintRegexp *regexp.Regexp - -func init() { - constraintOperators = map[string]constraintFunc{ - "": constraintEqual, - "=": constraintEqual, - "!=": constraintNotEqual, - ">": constraintGreaterThan, - "<": constraintLessThan, - ">=": constraintGreaterThanEqual, - "<=": constraintLessThanEqual, - "~>": constraintPessimistic, - } - - ops := make([]string, 0, len(constraintOperators)) - for k := range constraintOperators { - ops = append(ops, regexp.QuoteMeta(k)) - } - - constraintRegexp = regexp.MustCompile(fmt.Sprintf( - `^\s*(%s)\s*(%s)\s*$`, - strings.Join(ops, "|"), - VersionRegexpRaw)) -} - -// NewConstraint will parse one or more constraints from the given -// constraint string. The string must be a comma-separated list of -// constraints. -func NewConstraint(v string) (Constraints, error) { - vs := strings.Split(v, ",") - result := make([]*Constraint, len(vs)) - for i, single := range vs { - c, err := parseSingle(single) - if err != nil { - return nil, err - } - - result[i] = c - } - - return Constraints(result), nil -} - -// Check tests if a version satisfies all the constraints. -func (cs Constraints) Check(v *Version) bool { - for _, c := range cs { - if !c.Check(v) { - return false - } - } - - return true -} - -// Returns the string format of the constraints -func (cs Constraints) String() string { - csStr := make([]string, len(cs)) - for i, c := range cs { - csStr[i] = c.String() - } - - return strings.Join(csStr, ",") -} - -// Check tests if a constraint is validated by the given version. -func (c *Constraint) Check(v *Version) bool { - return c.f(v, c.check) -} - -func (c *Constraint) String() string { - return c.original -} - -func parseSingle(v string) (*Constraint, error) { - matches := constraintRegexp.FindStringSubmatch(v) - if matches == nil { - return nil, fmt.Errorf("Malformed constraint: %s", v) - } - - check, err := NewVersion(matches[2]) - if err != nil { - return nil, err - } - - return &Constraint{ - f: constraintOperators[matches[1]], - check: check, - original: v, - }, nil -} - -//------------------------------------------------------------------- -// Constraint functions -//------------------------------------------------------------------- - -func constraintEqual(v, c *Version) bool { - return v.Equal(c) -} - -func constraintNotEqual(v, c *Version) bool { - return !v.Equal(c) -} - -func constraintGreaterThan(v, c *Version) bool { - return v.Compare(c) == 1 -} - -func constraintLessThan(v, c *Version) bool { - return v.Compare(c) == -1 -} - -func constraintGreaterThanEqual(v, c *Version) bool { - return v.Compare(c) >= 0 -} - -func constraintLessThanEqual(v, c *Version) bool { - return v.Compare(c) <= 0 -} - -func constraintPessimistic(v, c *Version) bool { - // If the version being checked is naturally less than the constraint, then there - // is no way for the version to be valid against the constraint - if v.LessThan(c) { - return false - } - // We'll use this more than once, so grab the length now so it's a little cleaner - // to write the later checks - cs := len(c.segments) - - // If the version being checked has less specificity than the constraint, then there - // is no way for the version to be valid against the constraint - if cs > len(v.segments) { - return false - } - - // Check the segments in the constraint against those in the version. If the version - // being checked, at any point, does not have the same values in each index of the - // constraints segments, then it cannot be valid against the constraint. - for i := 0; i < c.si-1; i++ { - if v.segments[i] != c.segments[i] { - return false - } - } - - // Check the last part of the segment in the constraint. If the version segment at - // this index is less than the constraints segment at this index, then it cannot - // be valid against the constraint - if c.segments[cs-1] > v.segments[cs-1] { - return false - } - - // If nothing has rejected the version by now, it's valid - return true -} diff --git a/vendor/github.com/hashicorp/go-version/constraint_test.go b/vendor/github.com/hashicorp/go-version/constraint_test.go deleted file mode 100644 index 2e733a4..0000000 --- a/vendor/github.com/hashicorp/go-version/constraint_test.go +++ /dev/null @@ -1,113 +0,0 @@ -package version - -import ( - "testing" -) - -func TestNewConstraint(t *testing.T) { - cases := []struct { - input string - count int - err bool - }{ - {">= 1.2", 1, false}, - {"1.0", 1, false}, - {">= 1.x", 0, true}, - {">= 1.2, < 1.0", 2, false}, - - // Out of bounds - {"11387778780781445675529500000000000000000", 0, true}, - } - - for _, tc := range cases { - v, err := NewConstraint(tc.input) - if tc.err && err == nil { - t.Fatalf("expected error for input: %s", tc.input) - } else if !tc.err && err != nil { - t.Fatalf("error for input %s: %s", tc.input, err) - } - - if len(v) != tc.count { - t.Fatalf("input: %s\nexpected len: %d\nactual: %d", - tc.input, tc.count, len(v)) - } - } -} - -func TestConstraintCheck(t *testing.T) { - cases := []struct { - constraint string - version string - check bool - }{ - {">= 1.0, < 1.2", "1.1.5", true}, - {"< 1.0, < 1.2", "1.1.5", false}, - {"= 1.0", "1.1.5", false}, - {"= 1.0", "1.0.0", true}, - {"1.0", "1.0.0", true}, - {"~> 1.0", "2.0", false}, - {"~> 1.0", "1.1", true}, - {"~> 1.0", "1.2.3", true}, - {"~> 1.0.0", "1.2.3", false}, - {"~> 1.0.0", "1.0.7", true}, - {"~> 1.0.0", "1.1.0", false}, - {"~> 1.0.7", "1.0.4", false}, - {"~> 1.0.7", "1.0.7", true}, - {"~> 1.0.7", "1.0.8", true}, - {"~> 1.0.7", "1.0.7.5", true}, - {"~> 1.0.7", "1.0.6.99", false}, - {"~> 1.0.7", "1.0.8.0", true}, - {"~> 1.0.9.5", "1.0.9.5", true}, - {"~> 1.0.9.5", "1.0.9.4", false}, - {"~> 1.0.9.5", "1.0.9.6", true}, - {"~> 1.0.9.5", "1.0.9.5.0", true}, - {"~> 1.0.9.5", "1.0.9.5.1", true}, - } - - for _, tc := range cases { - c, err := NewConstraint(tc.constraint) - if err != nil { - t.Fatalf("err: %s", err) - } - - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := c.Check(v) - expected := tc.check - if actual != expected { - t.Fatalf("Version: %s\nConstraint: %s\nExpected: %#v", - tc.version, tc.constraint, expected) - } - } -} - -func TestConstraintsString(t *testing.T) { - cases := []struct { - constraint string - result string - }{ - {">= 1.0, < 1.2", ""}, - {"~> 1.0.7", ""}, - } - - for _, tc := range cases { - c, err := NewConstraint(tc.constraint) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := c.String() - expected := tc.result - if expected == "" { - expected = tc.constraint - } - - if actual != expected { - t.Fatalf("Constraint: %s\nExpected: %#v\nActual: %s", - tc.constraint, expected, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/go-version/version.go b/vendor/github.com/hashicorp/go-version/version.go deleted file mode 100644 index bee527e..0000000 --- a/vendor/github.com/hashicorp/go-version/version.go +++ /dev/null @@ -1,326 +0,0 @@ -package version - -import ( - "bytes" - "fmt" - "reflect" - "regexp" - "strconv" - "strings" -) - -// The compiled regular expression used to test the validity of a version. -var versionRegexp *regexp.Regexp - -// The raw regular expression string used for testing the validity -// of a version. -const VersionRegexpRaw string = `v?([0-9]+(\.[0-9]+)*?)` + - `(-?([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` + - `(\+([0-9A-Za-z\-~]+(\.[0-9A-Za-z\-~]+)*))?` + - `?` - -// Version represents a single version. -type Version struct { - metadata string - pre string - segments []int64 - si int -} - -func init() { - versionRegexp = regexp.MustCompile("^" + VersionRegexpRaw + "$") -} - -// NewVersion parses the given version and returns a new -// Version. -func NewVersion(v string) (*Version, error) { - matches := versionRegexp.FindStringSubmatch(v) - if matches == nil { - return nil, fmt.Errorf("Malformed version: %s", v) - } - segmentsStr := strings.Split(matches[1], ".") - segments := make([]int64, len(segmentsStr)) - si := 0 - for i, str := range segmentsStr { - val, err := strconv.ParseInt(str, 10, 64) - if err != nil { - return nil, fmt.Errorf( - "Error parsing version: %s", err) - } - - segments[i] = int64(val) - si++ - } - - // Even though we could support more than three segments, if we - // got less than three, pad it with 0s. This is to cover the basic - // default usecase of semver, which is MAJOR.MINOR.PATCH at the minimum - for i := len(segments); i < 3; i++ { - segments = append(segments, 0) - } - - return &Version{ - metadata: matches[7], - pre: matches[4], - segments: segments, - si: si, - }, nil -} - -// Must is a helper that wraps a call to a function returning (*Version, error) -// and panics if error is non-nil. -func Must(v *Version, err error) *Version { - if err != nil { - panic(err) - } - - return v -} - -// Compare compares this version to another version. This -// returns -1, 0, or 1 if this version is smaller, equal, -// or larger than the other version, respectively. -// -// If you want boolean results, use the LessThan, Equal, -// or GreaterThan methods. -func (v *Version) Compare(other *Version) int { - // A quick, efficient equality check - if v.String() == other.String() { - return 0 - } - - segmentsSelf := v.Segments64() - segmentsOther := other.Segments64() - - // If the segments are the same, we must compare on prerelease info - if reflect.DeepEqual(segmentsSelf, segmentsOther) { - preSelf := v.Prerelease() - preOther := other.Prerelease() - if preSelf == "" && preOther == "" { - return 0 - } - if preSelf == "" { - return 1 - } - if preOther == "" { - return -1 - } - - return comparePrereleases(preSelf, preOther) - } - - // Get the highest specificity (hS), or if they're equal, just use segmentSelf length - lenSelf := len(segmentsSelf) - lenOther := len(segmentsOther) - hS := lenSelf - if lenSelf < lenOther { - hS = lenOther - } - // Compare the segments - // Because a constraint could have more/less specificity than the version it's - // checking, we need to account for a lopsided or jagged comparison - for i := 0; i < hS; i++ { - if i > lenSelf-1 { - // This means Self had the lower specificity - // Check to see if the remaining segments in Other are all zeros - if !allZero(segmentsOther[i:]) { - // if not, it means that Other has to be greater than Self - return -1 - } - break - } else if i > lenOther-1 { - // this means Other had the lower specificity - // Check to see if the remaining segments in Self are all zeros - - if !allZero(segmentsSelf[i:]) { - //if not, it means that Self has to be greater than Other - return 1 - } - break - } - lhs := segmentsSelf[i] - rhs := segmentsOther[i] - if lhs == rhs { - continue - } else if lhs < rhs { - return -1 - } - // Otherwis, rhs was > lhs, they're not equal - return 1 - } - - // if we got this far, they're equal - return 0 -} - -func allZero(segs []int64) bool { - for _, s := range segs { - if s != 0 { - return false - } - } - return true -} - -func comparePart(preSelf string, preOther string) int { - if preSelf == preOther { - return 0 - } - - var selfInt int64 - selfNumeric := true - selfInt, err := strconv.ParseInt(preSelf, 10, 64) - if err != nil { - selfNumeric = false - } - - var otherInt int64 - otherNumeric := true - otherInt, err = strconv.ParseInt(preOther, 10, 64) - if err != nil { - otherNumeric = false - } - - // if a part is empty, we use the other to decide - if preSelf == "" { - if otherNumeric { - return -1 - } - return 1 - } - - if preOther == "" { - if selfNumeric { - return 1 - } - return -1 - } - - if selfNumeric && !otherNumeric { - return -1 - } else if !selfNumeric && otherNumeric { - return 1 - } else if !selfNumeric && !otherNumeric && preSelf > preOther { - return 1 - } else if selfInt > otherInt { - return 1 - } - - return -1 -} - -func comparePrereleases(v string, other string) int { - // the same pre release! - if v == other { - return 0 - } - - // split both pre releases for analyse their parts - selfPreReleaseMeta := strings.Split(v, ".") - otherPreReleaseMeta := strings.Split(other, ".") - - selfPreReleaseLen := len(selfPreReleaseMeta) - otherPreReleaseLen := len(otherPreReleaseMeta) - - biggestLen := otherPreReleaseLen - if selfPreReleaseLen > otherPreReleaseLen { - biggestLen = selfPreReleaseLen - } - - // loop for parts to find the first difference - for i := 0; i < biggestLen; i = i + 1 { - partSelfPre := "" - if i < selfPreReleaseLen { - partSelfPre = selfPreReleaseMeta[i] - } - - partOtherPre := "" - if i < otherPreReleaseLen { - partOtherPre = otherPreReleaseMeta[i] - } - - compare := comparePart(partSelfPre, partOtherPre) - // if parts are equals, continue the loop - if compare != 0 { - return compare - } - } - - return 0 -} - -// Equal tests if two versions are equal. -func (v *Version) Equal(o *Version) bool { - return v.Compare(o) == 0 -} - -// GreaterThan tests if this version is greater than another version. -func (v *Version) GreaterThan(o *Version) bool { - return v.Compare(o) > 0 -} - -// LessThan tests if this version is less than another version. -func (v *Version) LessThan(o *Version) bool { - return v.Compare(o) < 0 -} - -// Metadata returns any metadata that was part of the version -// string. -// -// Metadata is anything that comes after the "+" in the version. -// For example, with "1.2.3+beta", the metadata is "beta". -func (v *Version) Metadata() string { - return v.metadata -} - -// Prerelease returns any prerelease data that is part of the version, -// or blank if there is no prerelease data. -// -// Prerelease information is anything that comes after the "-" in the -// version (but before any metadata). For example, with "1.2.3-beta", -// the prerelease information is "beta". -func (v *Version) Prerelease() string { - return v.pre -} - -// Segments returns the numeric segments of the version as a slice of ints. -// -// This excludes any metadata or pre-release information. For example, -// for a version "1.2.3-beta", segments will return a slice of -// 1, 2, 3. -func (v *Version) Segments() []int { - segmentSlice := make([]int, len(v.segments)) - for i, v := range v.segments { - segmentSlice[i] = int(v) - } - return segmentSlice -} - -// Segments64 returns the numeric segments of the version as a slice of int64s. -// -// This excludes any metadata or pre-release information. For example, -// for a version "1.2.3-beta", segments will return a slice of -// 1, 2, 3. -func (v *Version) Segments64() []int64 { - return v.segments -} - -// String returns the full version string included pre-release -// and metadata information. -func (v *Version) String() string { - var buf bytes.Buffer - fmtParts := make([]string, len(v.segments)) - for i, s := range v.segments { - // We can ignore err here since we've pre-parsed the values in segments - str := strconv.FormatInt(s, 10) - fmtParts[i] = str - } - fmt.Fprintf(&buf, strings.Join(fmtParts, ".")) - if v.pre != "" { - fmt.Fprintf(&buf, "-%s", v.pre) - } - if v.metadata != "" { - fmt.Fprintf(&buf, "+%s", v.metadata) - } - - return buf.String() -} diff --git a/vendor/github.com/hashicorp/go-version/version_collection.go b/vendor/github.com/hashicorp/go-version/version_collection.go deleted file mode 100644 index cc888d4..0000000 --- a/vendor/github.com/hashicorp/go-version/version_collection.go +++ /dev/null @@ -1,17 +0,0 @@ -package version - -// Collection is a type that implements the sort.Interface interface -// so that versions can be sorted. -type Collection []*Version - -func (v Collection) Len() int { - return len(v) -} - -func (v Collection) Less(i, j int) bool { - return v[i].LessThan(v[j]) -} - -func (v Collection) Swap(i, j int) { - v[i], v[j] = v[j], v[i] -} diff --git a/vendor/github.com/hashicorp/go-version/version_collection_test.go b/vendor/github.com/hashicorp/go-version/version_collection_test.go deleted file mode 100644 index 14783d7..0000000 --- a/vendor/github.com/hashicorp/go-version/version_collection_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package version - -import ( - "reflect" - "sort" - "testing" -) - -func TestCollection(t *testing.T) { - versionsRaw := []string{ - "1.1.1", - "1.0", - "1.2", - "2", - "0.7.1", - } - - versions := make([]*Version, len(versionsRaw)) - for i, raw := range versionsRaw { - v, err := NewVersion(raw) - if err != nil { - t.Fatalf("err: %s", err) - } - - versions[i] = v - } - - sort.Sort(Collection(versions)) - - actual := make([]string, len(versions)) - for i, v := range versions { - actual[i] = v.String() - } - - expected := []string{ - "0.7.1", - "1.0.0", - "1.1.1", - "1.2.0", - "2.0.0", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("bad: %#v", actual) - } -} diff --git a/vendor/github.com/hashicorp/go-version/version_test.go b/vendor/github.com/hashicorp/go-version/version_test.go deleted file mode 100644 index e60088b..0000000 --- a/vendor/github.com/hashicorp/go-version/version_test.go +++ /dev/null @@ -1,265 +0,0 @@ -package version - -import ( - "reflect" - "testing" -) - -func TestNewVersion(t *testing.T) { - cases := []struct { - version string - err bool - }{ - {"1.2.3", false}, - {"1.0", false}, - {"1", false}, - {"1.2.beta", true}, - {"foo", true}, - {"1.2-5", false}, - {"1.2-beta.5", false}, - {"\n1.2", true}, - {"1.2.0-x.Y.0+metadata", false}, - {"1.2.0-x.Y.0+metadata-width-hypen", false}, - {"1.2.3-rc1-with-hypen", false}, - {"1.2.3.4", false}, - {"1.2.0.4-x.Y.0+metadata", false}, - {"1.2.0.4-x.Y.0+metadata-width-hypen", false}, - {"1.2.0-X-1.2.0+metadata~dist", false}, - {"1.2.3.4-rc1-with-hypen", false}, - {"1.2.3.4", false}, - {"v1.2.3", false}, - {"foo1.2.3", true}, - {"1.7rc2", false}, - {"v1.7rc2", false}, - } - - for _, tc := range cases { - _, err := NewVersion(tc.version) - if tc.err && err == nil { - t.Fatalf("expected error for version: %s", tc.version) - } else if !tc.err && err != nil { - t.Fatalf("error for version %s: %s", tc.version, err) - } - } -} - -func TestVersionCompare(t *testing.T) { - cases := []struct { - v1 string - v2 string - expected int - }{ - {"1.2.3", "1.4.5", -1}, - {"1.2-beta", "1.2-beta", 0}, - {"1.2", "1.1.4", 1}, - {"1.2", "1.2-beta", 1}, - {"1.2+foo", "1.2+beta", 0}, - {"v1.2", "v1.2-beta", 1}, - {"v1.2+foo", "v1.2+beta", 0}, - {"v1.2.3.4", "v1.2.3.4", 0}, - {"v1.2.0.0", "v1.2", 0}, - {"v1.2.0.0.1", "v1.2", 1}, - {"v1.2", "v1.2.0.0", 0}, - {"v1.2", "v1.2.0.0.1", -1}, - {"v1.2.0.0", "v1.2.0.0.1", -1}, - {"v1.2.3.0", "v1.2.3.4", -1}, - {"1.7rc2", "1.7rc1", 1}, - {"1.7rc2", "1.7", -1}, - {"1.2.0", "1.2.0-X-1.2.0+metadata~dist", 1}, - } - - for _, tc := range cases { - v1, err := NewVersion(tc.v1) - if err != nil { - t.Fatalf("err: %s", err) - } - - v2, err := NewVersion(tc.v2) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v1.Compare(v2) - expected := tc.expected - if actual != expected { - t.Fatalf( - "%s <=> %s\nexpected: %d\nactual: %d", - tc.v1, tc.v2, - expected, actual) - } - } -} - -func TestComparePreReleases(t *testing.T) { - cases := []struct { - v1 string - v2 string - expected int - }{ - {"1.2-beta.2", "1.2-beta.2", 0}, - {"1.2-beta.1", "1.2-beta.2", -1}, - {"1.2-beta.2", "1.2-beta.11", -1}, - {"3.2-alpha.1", "3.2-alpha", 1}, - {"1.2-beta.2", "1.2-beta.1", 1}, - {"1.2-beta.11", "1.2-beta.2", 1}, - {"1.2-beta", "1.2-beta.3", -1}, - {"1.2-alpha", "1.2-beta.3", -1}, - {"1.2-beta", "1.2-alpha.3", 1}, - {"3.0-alpha.3", "3.0-rc.1", -1}, - {"3.0-alpha3", "3.0-rc1", -1}, - {"3.0-alpha.1", "3.0-alpha.beta", -1}, - {"5.4-alpha", "5.4-alpha.beta", 1}, - {"v1.2-beta.2", "v1.2-beta.2", 0}, - {"v1.2-beta.1", "v1.2-beta.2", -1}, - {"v3.2-alpha.1", "v3.2-alpha", 1}, - {"v3.2-rc.1-1-g123", "v3.2-rc.2", 1}, - } - - for _, tc := range cases { - v1, err := NewVersion(tc.v1) - if err != nil { - t.Fatalf("err: %s", err) - } - - v2, err := NewVersion(tc.v2) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v1.Compare(v2) - expected := tc.expected - if actual != expected { - t.Fatalf( - "%s <=> %s\nexpected: %d\nactual: %d", - tc.v1, tc.v2, - expected, actual) - } - } -} - -func TestVersionMetadata(t *testing.T) { - cases := []struct { - version string - expected string - }{ - {"1.2.3", ""}, - {"1.2-beta", ""}, - {"1.2.0-x.Y.0", ""}, - {"1.2.0-x.Y.0+metadata", "metadata"}, - {"1.2.0-metadata-1.2.0+metadata~dist", "metadata~dist"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Metadata() - expected := tc.expected - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} - -func TestVersionPrerelease(t *testing.T) { - cases := []struct { - version string - expected string - }{ - {"1.2.3", ""}, - {"1.2-beta", "beta"}, - {"1.2.0-x.Y.0", "x.Y.0"}, - {"1.2.0-x.Y.0+metadata", "x.Y.0"}, - {"1.2.0-metadata-1.2.0+metadata~dist", "metadata-1.2.0"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Prerelease() - expected := tc.expected - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} - -func TestVersionSegments(t *testing.T) { - cases := []struct { - version string - expected []int - }{ - {"1.2.3", []int{1, 2, 3}}, - {"1.2-beta", []int{1, 2, 0}}, - {"1-x.Y.0", []int{1, 0, 0}}, - {"1.2.0-x.Y.0+metadata", []int{1, 2, 0}}, - {"1.2.0-metadata-1.2.0+metadata~dist", []int{1, 2, 0}}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Segments() - expected := tc.expected - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("expected: %#v\nactual: %#v", expected, actual) - } - } -} - -func TestVersionSegments64(t *testing.T) { - cases := []struct { - version string - expected []int64 - }{ - {"1.2.3", []int64{1, 2, 3}}, - {"1.2-beta", []int64{1, 2, 0}}, - {"1-x.Y.0", []int64{1, 0, 0}}, - {"1.2.0-x.Y.0+metadata", []int64{1, 2, 0}}, - {"1.4.9223372036854775807", []int64{1, 4, 9223372036854775807}}, - } - - for _, tc := range cases { - v, err := NewVersion(tc.version) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.Segments64() - expected := tc.expected - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("expected: %#v\nactual: %#v", expected, actual) - } - } -} - -func TestVersionString(t *testing.T) { - cases := [][]string{ - {"1.2.3", "1.2.3"}, - {"1.2-beta", "1.2.0-beta"}, - {"1.2.0-x.Y.0", "1.2.0-x.Y.0"}, - {"1.2.0-x.Y.0+metadata", "1.2.0-x.Y.0+metadata"}, - {"1.2.0-metadata-1.2.0+metadata~dist", "1.2.0-metadata-1.2.0+metadata~dist"}, - } - - for _, tc := range cases { - v, err := NewVersion(tc[0]) - if err != nil { - t.Fatalf("err: %s", err) - } - - actual := v.String() - expected := tc[1] - if actual != expected { - t.Fatalf("expected: %s\nactual: %s", expected, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/.gitignore b/vendor/github.com/hashicorp/hcl/.gitignore deleted file mode 100644 index 15586a2..0000000 --- a/vendor/github.com/hashicorp/hcl/.gitignore +++ /dev/null @@ -1,9 +0,0 @@ -y.output - -# ignore intellij files -.idea -*.iml -*.ipr -*.iws - -*.test diff --git a/vendor/github.com/hashicorp/hcl/.travis.yml b/vendor/github.com/hashicorp/hcl/.travis.yml deleted file mode 100644 index cb63a32..0000000 --- a/vendor/github.com/hashicorp/hcl/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -sudo: false - -language: go - -go: - - 1.x - - tip - -branches: - only: - - master - -script: make test diff --git a/vendor/github.com/hashicorp/hcl/LICENSE b/vendor/github.com/hashicorp/hcl/LICENSE deleted file mode 100644 index c33dcc7..0000000 --- a/vendor/github.com/hashicorp/hcl/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/hcl/Makefile b/vendor/github.com/hashicorp/hcl/Makefile deleted file mode 100644 index 84fd743..0000000 --- a/vendor/github.com/hashicorp/hcl/Makefile +++ /dev/null @@ -1,18 +0,0 @@ -TEST?=./... - -default: test - -fmt: generate - go fmt ./... - -test: generate - go get -t ./... - go test $(TEST) $(TESTARGS) - -generate: - go generate ./... - -updatedeps: - go get -u golang.org/x/tools/cmd/stringer - -.PHONY: default generate test updatedeps diff --git a/vendor/github.com/hashicorp/hcl/README.md b/vendor/github.com/hashicorp/hcl/README.md deleted file mode 100644 index c822332..0000000 --- a/vendor/github.com/hashicorp/hcl/README.md +++ /dev/null @@ -1,125 +0,0 @@ -# HCL - -[![GoDoc](https://godoc.org/github.com/hashicorp/hcl?status.png)](https://godoc.org/github.com/hashicorp/hcl) [![Build Status](https://travis-ci.org/hashicorp/hcl.svg?branch=master)](https://travis-ci.org/hashicorp/hcl) - -HCL (HashiCorp Configuration Language) is a configuration language built -by HashiCorp. The goal of HCL is to build a structured configuration language -that is both human and machine friendly for use with command-line tools, but -specifically targeted towards DevOps tools, servers, etc. - -HCL is also fully JSON compatible. That is, JSON can be used as completely -valid input to a system expecting HCL. This helps makes systems -interoperable with other systems. - -HCL is heavily inspired by -[libucl](https://github.com/vstakhov/libucl), -nginx configuration, and others similar. - -## Why? - -A common question when viewing HCL is to ask the question: why not -JSON, YAML, etc.? - -Prior to HCL, the tools we built at [HashiCorp](http://www.hashicorp.com) -used a variety of configuration languages from full programming languages -such as Ruby to complete data structure languages such as JSON. What we -learned is that some people wanted human-friendly configuration languages -and some people wanted machine-friendly languages. - -JSON fits a nice balance in this, but is fairly verbose and most -importantly doesn't support comments. With YAML, we found that beginners -had a really hard time determining what the actual structure was, and -ended up guessing more often than not whether to use a hyphen, colon, etc. -in order to represent some configuration key. - -Full programming languages such as Ruby enable complex behavior -a configuration language shouldn't usually allow, and also forces -people to learn some set of Ruby. - -Because of this, we decided to create our own configuration language -that is JSON-compatible. Our configuration language (HCL) is designed -to be written and modified by humans. The API for HCL allows JSON -as an input so that it is also machine-friendly (machines can generate -JSON instead of trying to generate HCL). - -Our goal with HCL is not to alienate other configuration languages. -It is instead to provide HCL as a specialized language for our tools, -and JSON as the interoperability layer. - -## Syntax - -For a complete grammar, please see the parser itself. A high-level overview -of the syntax and grammar is listed here. - - * Single line comments start with `#` or `//` - - * Multi-line comments are wrapped in `/*` and `*/`. Nested block comments - are not allowed. A multi-line comment (also known as a block comment) - terminates at the first `*/` found. - - * Values are assigned with the syntax `key = value` (whitespace doesn't - matter). The value can be any primitive: a string, number, boolean, - object, or list. - - * Strings are double-quoted and can contain any UTF-8 characters. - Example: `"Hello, World"` - - * Multi-line strings start with `<- - echo %Path% - - go version - - go env - - go get -t ./... - -build_script: -- cmd: go test -v ./... diff --git a/vendor/github.com/hashicorp/hcl/decoder.go b/vendor/github.com/hashicorp/hcl/decoder.go deleted file mode 100644 index bed9ebb..0000000 --- a/vendor/github.com/hashicorp/hcl/decoder.go +++ /dev/null @@ -1,729 +0,0 @@ -package hcl - -import ( - "errors" - "fmt" - "reflect" - "sort" - "strconv" - "strings" - - "github.com/hashicorp/hcl/hcl/ast" - "github.com/hashicorp/hcl/hcl/parser" - "github.com/hashicorp/hcl/hcl/token" -) - -// This is the tag to use with structures to have settings for HCL -const tagName = "hcl" - -var ( - // nodeType holds a reference to the type of ast.Node - nodeType reflect.Type = findNodeType() -) - -// Unmarshal accepts a byte slice as input and writes the -// data to the value pointed to by v. -func Unmarshal(bs []byte, v interface{}) error { - root, err := parse(bs) - if err != nil { - return err - } - - return DecodeObject(v, root) -} - -// Decode reads the given input and decodes it into the structure -// given by `out`. -func Decode(out interface{}, in string) error { - obj, err := Parse(in) - if err != nil { - return err - } - - return DecodeObject(out, obj) -} - -// DecodeObject is a lower-level version of Decode. It decodes a -// raw Object into the given output. -func DecodeObject(out interface{}, n ast.Node) error { - val := reflect.ValueOf(out) - if val.Kind() != reflect.Ptr { - return errors.New("result must be a pointer") - } - - // If we have the file, we really decode the root node - if f, ok := n.(*ast.File); ok { - n = f.Node - } - - var d decoder - return d.decode("root", n, val.Elem()) -} - -type decoder struct { - stack []reflect.Kind -} - -func (d *decoder) decode(name string, node ast.Node, result reflect.Value) error { - k := result - - // If we have an interface with a valid value, we use that - // for the check. - if result.Kind() == reflect.Interface { - elem := result.Elem() - if elem.IsValid() { - k = elem - } - } - - // Push current onto stack unless it is an interface. - if k.Kind() != reflect.Interface { - d.stack = append(d.stack, k.Kind()) - - // Schedule a pop - defer func() { - d.stack = d.stack[:len(d.stack)-1] - }() - } - - switch k.Kind() { - case reflect.Bool: - return d.decodeBool(name, node, result) - case reflect.Float32, reflect.Float64: - return d.decodeFloat(name, node, result) - case reflect.Int, reflect.Int32, reflect.Int64: - return d.decodeInt(name, node, result) - case reflect.Interface: - // When we see an interface, we make our own thing - return d.decodeInterface(name, node, result) - case reflect.Map: - return d.decodeMap(name, node, result) - case reflect.Ptr: - return d.decodePtr(name, node, result) - case reflect.Slice: - return d.decodeSlice(name, node, result) - case reflect.String: - return d.decodeString(name, node, result) - case reflect.Struct: - return d.decodeStruct(name, node, result) - default: - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unknown kind to decode into: %s", name, k.Kind()), - } - } -} - -func (d *decoder) decodeBool(name string, node ast.Node, result reflect.Value) error { - switch n := node.(type) { - case *ast.LiteralType: - if n.Token.Type == token.BOOL { - v, err := strconv.ParseBool(n.Token.Text) - if err != nil { - return err - } - - result.Set(reflect.ValueOf(v)) - return nil - } - } - - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unknown type %T", name, node), - } -} - -func (d *decoder) decodeFloat(name string, node ast.Node, result reflect.Value) error { - switch n := node.(type) { - case *ast.LiteralType: - if n.Token.Type == token.FLOAT || n.Token.Type == token.NUMBER { - v, err := strconv.ParseFloat(n.Token.Text, 64) - if err != nil { - return err - } - - result.Set(reflect.ValueOf(v).Convert(result.Type())) - return nil - } - } - - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unknown type %T", name, node), - } -} - -func (d *decoder) decodeInt(name string, node ast.Node, result reflect.Value) error { - switch n := node.(type) { - case *ast.LiteralType: - switch n.Token.Type { - case token.NUMBER: - v, err := strconv.ParseInt(n.Token.Text, 0, 0) - if err != nil { - return err - } - - if result.Kind() == reflect.Interface { - result.Set(reflect.ValueOf(int(v))) - } else { - result.SetInt(v) - } - return nil - case token.STRING: - v, err := strconv.ParseInt(n.Token.Value().(string), 0, 0) - if err != nil { - return err - } - - if result.Kind() == reflect.Interface { - result.Set(reflect.ValueOf(int(v))) - } else { - result.SetInt(v) - } - return nil - } - } - - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unknown type %T", name, node), - } -} - -func (d *decoder) decodeInterface(name string, node ast.Node, result reflect.Value) error { - // When we see an ast.Node, we retain the value to enable deferred decoding. - // Very useful in situations where we want to preserve ast.Node information - // like Pos - if result.Type() == nodeType && result.CanSet() { - result.Set(reflect.ValueOf(node)) - return nil - } - - var set reflect.Value - redecode := true - - // For testing types, ObjectType should just be treated as a list. We - // set this to a temporary var because we want to pass in the real node. - testNode := node - if ot, ok := node.(*ast.ObjectType); ok { - testNode = ot.List - } - - switch n := testNode.(type) { - case *ast.ObjectList: - // If we're at the root or we're directly within a slice, then we - // decode objects into map[string]interface{}, otherwise we decode - // them into lists. - if len(d.stack) == 0 || d.stack[len(d.stack)-1] == reflect.Slice { - var temp map[string]interface{} - tempVal := reflect.ValueOf(temp) - result := reflect.MakeMap( - reflect.MapOf( - reflect.TypeOf(""), - tempVal.Type().Elem())) - - set = result - } else { - var temp []map[string]interface{} - tempVal := reflect.ValueOf(temp) - result := reflect.MakeSlice( - reflect.SliceOf(tempVal.Type().Elem()), 0, len(n.Items)) - set = result - } - case *ast.ObjectType: - // If we're at the root or we're directly within a slice, then we - // decode objects into map[string]interface{}, otherwise we decode - // them into lists. - if len(d.stack) == 0 || d.stack[len(d.stack)-1] == reflect.Slice { - var temp map[string]interface{} - tempVal := reflect.ValueOf(temp) - result := reflect.MakeMap( - reflect.MapOf( - reflect.TypeOf(""), - tempVal.Type().Elem())) - - set = result - } else { - var temp []map[string]interface{} - tempVal := reflect.ValueOf(temp) - result := reflect.MakeSlice( - reflect.SliceOf(tempVal.Type().Elem()), 0, 1) - set = result - } - case *ast.ListType: - var temp []interface{} - tempVal := reflect.ValueOf(temp) - result := reflect.MakeSlice( - reflect.SliceOf(tempVal.Type().Elem()), 0, 0) - set = result - case *ast.LiteralType: - switch n.Token.Type { - case token.BOOL: - var result bool - set = reflect.Indirect(reflect.New(reflect.TypeOf(result))) - case token.FLOAT: - var result float64 - set = reflect.Indirect(reflect.New(reflect.TypeOf(result))) - case token.NUMBER: - var result int - set = reflect.Indirect(reflect.New(reflect.TypeOf(result))) - case token.STRING, token.HEREDOC: - set = reflect.Indirect(reflect.New(reflect.TypeOf(""))) - default: - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: cannot decode into interface: %T", name, node), - } - } - default: - return fmt.Errorf( - "%s: cannot decode into interface: %T", - name, node) - } - - // Set the result to what its supposed to be, then reset - // result so we don't reflect into this method anymore. - result.Set(set) - - if redecode { - // Revisit the node so that we can use the newly instantiated - // thing and populate it. - if err := d.decode(name, node, result); err != nil { - return err - } - } - - return nil -} - -func (d *decoder) decodeMap(name string, node ast.Node, result reflect.Value) error { - if item, ok := node.(*ast.ObjectItem); ok { - node = &ast.ObjectList{Items: []*ast.ObjectItem{item}} - } - - if ot, ok := node.(*ast.ObjectType); ok { - node = ot.List - } - - n, ok := node.(*ast.ObjectList) - if !ok { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: not an object type for map (%T)", name, node), - } - } - - // If we have an interface, then we can address the interface, - // but not the slice itself, so get the element but set the interface - set := result - if result.Kind() == reflect.Interface { - result = result.Elem() - } - - resultType := result.Type() - resultElemType := resultType.Elem() - resultKeyType := resultType.Key() - if resultKeyType.Kind() != reflect.String { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: map must have string keys", name), - } - } - - // Make a map if it is nil - resultMap := result - if result.IsNil() { - resultMap = reflect.MakeMap( - reflect.MapOf(resultKeyType, resultElemType)) - } - - // Go through each element and decode it. - done := make(map[string]struct{}) - for _, item := range n.Items { - if item.Val == nil { - continue - } - - // github.com/hashicorp/terraform/issue/5740 - if len(item.Keys) == 0 { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: map must have string keys", name), - } - } - - // Get the key we're dealing with, which is the first item - keyStr := item.Keys[0].Token.Value().(string) - - // If we've already processed this key, then ignore it - if _, ok := done[keyStr]; ok { - continue - } - - // Determine the value. If we have more than one key, then we - // get the objectlist of only these keys. - itemVal := item.Val - if len(item.Keys) > 1 { - itemVal = n.Filter(keyStr) - done[keyStr] = struct{}{} - } - - // Make the field name - fieldName := fmt.Sprintf("%s.%s", name, keyStr) - - // Get the key/value as reflection values - key := reflect.ValueOf(keyStr) - val := reflect.Indirect(reflect.New(resultElemType)) - - // If we have a pre-existing value in the map, use that - oldVal := resultMap.MapIndex(key) - if oldVal.IsValid() { - val.Set(oldVal) - } - - // Decode! - if err := d.decode(fieldName, itemVal, val); err != nil { - return err - } - - // Set the value on the map - resultMap.SetMapIndex(key, val) - } - - // Set the final map if we can - set.Set(resultMap) - return nil -} - -func (d *decoder) decodePtr(name string, node ast.Node, result reflect.Value) error { - // Create an element of the concrete (non pointer) type and decode - // into that. Then set the value of the pointer to this type. - resultType := result.Type() - resultElemType := resultType.Elem() - val := reflect.New(resultElemType) - if err := d.decode(name, node, reflect.Indirect(val)); err != nil { - return err - } - - result.Set(val) - return nil -} - -func (d *decoder) decodeSlice(name string, node ast.Node, result reflect.Value) error { - // If we have an interface, then we can address the interface, - // but not the slice itself, so get the element but set the interface - set := result - if result.Kind() == reflect.Interface { - result = result.Elem() - } - // Create the slice if it isn't nil - resultType := result.Type() - resultElemType := resultType.Elem() - if result.IsNil() { - resultSliceType := reflect.SliceOf(resultElemType) - result = reflect.MakeSlice( - resultSliceType, 0, 0) - } - - // Figure out the items we'll be copying into the slice - var items []ast.Node - switch n := node.(type) { - case *ast.ObjectList: - items = make([]ast.Node, len(n.Items)) - for i, item := range n.Items { - items[i] = item - } - case *ast.ObjectType: - items = []ast.Node{n} - case *ast.ListType: - items = n.List - default: - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("unknown slice type: %T", node), - } - } - - for i, item := range items { - fieldName := fmt.Sprintf("%s[%d]", name, i) - - // Decode - val := reflect.Indirect(reflect.New(resultElemType)) - - // if item is an object that was decoded from ambiguous JSON and - // flattened, make sure it's expanded if it needs to decode into a - // defined structure. - item := expandObject(item, val) - - if err := d.decode(fieldName, item, val); err != nil { - return err - } - - // Append it onto the slice - result = reflect.Append(result, val) - } - - set.Set(result) - return nil -} - -// expandObject detects if an ambiguous JSON object was flattened to a List which -// should be decoded into a struct, and expands the ast to properly deocode. -func expandObject(node ast.Node, result reflect.Value) ast.Node { - item, ok := node.(*ast.ObjectItem) - if !ok { - return node - } - - elemType := result.Type() - - // our target type must be a struct - switch elemType.Kind() { - case reflect.Ptr: - switch elemType.Elem().Kind() { - case reflect.Struct: - //OK - default: - return node - } - case reflect.Struct: - //OK - default: - return node - } - - // A list value will have a key and field name. If it had more fields, - // it wouldn't have been flattened. - if len(item.Keys) != 2 { - return node - } - - keyToken := item.Keys[0].Token - item.Keys = item.Keys[1:] - - // we need to un-flatten the ast enough to decode - newNode := &ast.ObjectItem{ - Keys: []*ast.ObjectKey{ - &ast.ObjectKey{ - Token: keyToken, - }, - }, - Val: &ast.ObjectType{ - List: &ast.ObjectList{ - Items: []*ast.ObjectItem{item}, - }, - }, - } - - return newNode -} - -func (d *decoder) decodeString(name string, node ast.Node, result reflect.Value) error { - switch n := node.(type) { - case *ast.LiteralType: - switch n.Token.Type { - case token.NUMBER: - result.Set(reflect.ValueOf(n.Token.Text).Convert(result.Type())) - return nil - case token.STRING, token.HEREDOC: - result.Set(reflect.ValueOf(n.Token.Value()).Convert(result.Type())) - return nil - } - } - - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unknown type for string %T", name, node), - } -} - -func (d *decoder) decodeStruct(name string, node ast.Node, result reflect.Value) error { - var item *ast.ObjectItem - if it, ok := node.(*ast.ObjectItem); ok { - item = it - node = it.Val - } - - if ot, ok := node.(*ast.ObjectType); ok { - node = ot.List - } - - // Handle the special case where the object itself is a literal. Previously - // the yacc parser would always ensure top-level elements were arrays. The new - // parser does not make the same guarantees, thus we need to convert any - // top-level literal elements into a list. - if _, ok := node.(*ast.LiteralType); ok && item != nil { - node = &ast.ObjectList{Items: []*ast.ObjectItem{item}} - } - - list, ok := node.(*ast.ObjectList) - if !ok { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: not an object type for struct (%T)", name, node), - } - } - - // This slice will keep track of all the structs we'll be decoding. - // There can be more than one struct if there are embedded structs - // that are squashed. - structs := make([]reflect.Value, 1, 5) - structs[0] = result - - // Compile the list of all the fields that we're going to be decoding - // from all the structs. - type field struct { - field reflect.StructField - val reflect.Value - } - fields := []field{} - for len(structs) > 0 { - structVal := structs[0] - structs = structs[1:] - - structType := structVal.Type() - for i := 0; i < structType.NumField(); i++ { - fieldType := structType.Field(i) - tagParts := strings.Split(fieldType.Tag.Get(tagName), ",") - - // Ignore fields with tag name "-" - if tagParts[0] == "-" { - continue - } - - if fieldType.Anonymous { - fieldKind := fieldType.Type.Kind() - if fieldKind != reflect.Struct { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: unsupported type to struct: %s", - fieldType.Name, fieldKind), - } - } - - // We have an embedded field. We "squash" the fields down - // if specified in the tag. - squash := false - for _, tag := range tagParts[1:] { - if tag == "squash" { - squash = true - break - } - } - - if squash { - structs = append( - structs, result.FieldByName(fieldType.Name)) - continue - } - } - - // Normal struct field, store it away - fields = append(fields, field{fieldType, structVal.Field(i)}) - } - } - - usedKeys := make(map[string]struct{}) - decodedFields := make([]string, 0, len(fields)) - decodedFieldsVal := make([]reflect.Value, 0) - unusedKeysVal := make([]reflect.Value, 0) - for _, f := range fields { - field, fieldValue := f.field, f.val - if !fieldValue.IsValid() { - // This should never happen - panic("field is not valid") - } - - // If we can't set the field, then it is unexported or something, - // and we just continue onwards. - if !fieldValue.CanSet() { - continue - } - - fieldName := field.Name - - tagValue := field.Tag.Get(tagName) - tagParts := strings.SplitN(tagValue, ",", 2) - if len(tagParts) >= 2 { - switch tagParts[1] { - case "decodedFields": - decodedFieldsVal = append(decodedFieldsVal, fieldValue) - continue - case "key": - if item == nil { - return &parser.PosError{ - Pos: node.Pos(), - Err: fmt.Errorf("%s: %s asked for 'key', impossible", - name, fieldName), - } - } - - fieldValue.SetString(item.Keys[0].Token.Value().(string)) - continue - case "unusedKeys": - unusedKeysVal = append(unusedKeysVal, fieldValue) - continue - } - } - - if tagParts[0] != "" { - fieldName = tagParts[0] - } - - // Determine the element we'll use to decode. If it is a single - // match (only object with the field), then we decode it exactly. - // If it is a prefix match, then we decode the matches. - filter := list.Filter(fieldName) - - prefixMatches := filter.Children() - matches := filter.Elem() - if len(matches.Items) == 0 && len(prefixMatches.Items) == 0 { - continue - } - - // Track the used key - usedKeys[fieldName] = struct{}{} - - // Create the field name and decode. We range over the elements - // because we actually want the value. - fieldName = fmt.Sprintf("%s.%s", name, fieldName) - if len(prefixMatches.Items) > 0 { - if err := d.decode(fieldName, prefixMatches, fieldValue); err != nil { - return err - } - } - for _, match := range matches.Items { - var decodeNode ast.Node = match.Val - if ot, ok := decodeNode.(*ast.ObjectType); ok { - decodeNode = &ast.ObjectList{Items: ot.List.Items} - } - - if err := d.decode(fieldName, decodeNode, fieldValue); err != nil { - return err - } - } - - decodedFields = append(decodedFields, field.Name) - } - - if len(decodedFieldsVal) > 0 { - // Sort it so that it is deterministic - sort.Strings(decodedFields) - - for _, v := range decodedFieldsVal { - v.Set(reflect.ValueOf(decodedFields)) - } - } - - return nil -} - -// findNodeType returns the type of ast.Node -func findNodeType() reflect.Type { - var nodeContainer struct { - Node ast.Node - } - value := reflect.ValueOf(nodeContainer).FieldByName("Node") - return value.Type() -} diff --git a/vendor/github.com/hashicorp/hcl/decoder_test.go b/vendor/github.com/hashicorp/hcl/decoder_test.go deleted file mode 100644 index 8682f47..0000000 --- a/vendor/github.com/hashicorp/hcl/decoder_test.go +++ /dev/null @@ -1,1203 +0,0 @@ -package hcl - -import ( - "io/ioutil" - "path/filepath" - "reflect" - "testing" - "time" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl/hcl/ast" -) - -func TestDecode_interface(t *testing.T) { - cases := []struct { - File string - Err bool - Out interface{} - }{ - { - "basic.hcl", - false, - map[string]interface{}{ - "foo": "bar", - "bar": "${file(\"bing/bong.txt\")}", - }, - }, - { - "basic_squish.hcl", - false, - map[string]interface{}{ - "foo": "bar", - "bar": "${file(\"bing/bong.txt\")}", - "foo-bar": "baz", - }, - }, - { - "empty.hcl", - false, - map[string]interface{}{ - "resource": []map[string]interface{}{ - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{}, - }, - }, - }, - }, - }, - { - "tfvars.hcl", - false, - map[string]interface{}{ - "regularvar": "Should work", - "map.key1": "Value", - "map.key2": "Other value", - }, - }, - { - "escape.hcl", - false, - map[string]interface{}{ - "foo": "bar\"baz\\n", - "qux": "back\\slash", - "bar": "new\nline", - "qax": `slash\:colon`, - "nested": `${HH\\:mm\\:ss}`, - "nestedquotes": `${"\"stringwrappedinquotes\""}`, - }, - }, - { - "float.hcl", - false, - map[string]interface{}{ - "a": 1.02, - "b": 2, - }, - }, - { - "multiline_bad.hcl", - true, - nil, - }, - { - "multiline_literal.hcl", - true, - nil, - }, - { - "multiline_literal_with_hil.hcl", - false, - map[string]interface{}{"multiline_literal_with_hil": "${hello\n world}"}, - }, - { - "multiline_no_marker.hcl", - true, - nil, - }, - { - "multiline.hcl", - false, - map[string]interface{}{"foo": "bar\nbaz\n"}, - }, - { - "multiline_indented.hcl", - false, - map[string]interface{}{"foo": " bar\n baz\n"}, - }, - { - "multiline_no_hanging_indent.hcl", - false, - map[string]interface{}{"foo": " baz\n bar\n foo\n"}, - }, - { - "multiline_no_eof.hcl", - false, - map[string]interface{}{"foo": "bar\nbaz\n", "key": "value"}, - }, - { - "multiline.json", - false, - map[string]interface{}{"foo": "bar\nbaz"}, - }, - { - "null_strings.json", - false, - map[string]interface{}{ - "module": []map[string]interface{}{ - map[string]interface{}{ - "app": []map[string]interface{}{ - map[string]interface{}{"foo": ""}, - }, - }, - }, - }, - }, - { - "scientific.json", - false, - map[string]interface{}{ - "a": 1e-10, - "b": 1e+10, - "c": 1e10, - "d": 1.2e-10, - "e": 1.2e+10, - "f": 1.2e10, - }, - }, - { - "scientific.hcl", - false, - map[string]interface{}{ - "a": 1e-10, - "b": 1e+10, - "c": 1e10, - "d": 1.2e-10, - "e": 1.2e+10, - "f": 1.2e10, - }, - }, - { - "terraform_heroku.hcl", - false, - map[string]interface{}{ - "name": "terraform-test-app", - "config_vars": []map[string]interface{}{ - map[string]interface{}{ - "FOO": "bar", - }, - }, - }, - }, - { - "structure_multi.hcl", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "baz": []map[string]interface{}{ - map[string]interface{}{"key": 7}, - }, - }, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{"key": 12}, - }, - }, - }, - }, - }, - { - "structure_multi.json", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "baz": []map[string]interface{}{ - map[string]interface{}{"key": 7}, - }, - }, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{"key": 12}, - }, - }, - }, - }, - }, - { - "list_of_lists.hcl", - false, - map[string]interface{}{ - "foo": []interface{}{ - []interface{}{"foo"}, - []interface{}{"bar"}, - }, - }, - }, - { - "list_of_maps.hcl", - false, - map[string]interface{}{ - "foo": []interface{}{ - map[string]interface{}{"somekey1": "someval1"}, - map[string]interface{}{"somekey2": "someval2", "someextrakey": "someextraval"}, - }, - }, - }, - { - "assign_deep.hcl", - false, - map[string]interface{}{ - "resource": []interface{}{ - map[string]interface{}{ - "foo": []interface{}{ - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{}}}}}}}, - }, - { - "structure_list.hcl", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "key": 7, - }, - map[string]interface{}{ - "key": 12, - }, - }, - }, - }, - { - "structure_list.json", - false, - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "key": 7, - }, - map[string]interface{}{ - "key": 12, - }, - }, - }, - }, - { - "structure_list_deep.json", - false, - map[string]interface{}{ - "bar": []map[string]interface{}{ - map[string]interface{}{ - "foo": []map[string]interface{}{ - map[string]interface{}{ - "name": "terraform_example", - "ingress": []map[string]interface{}{ - map[string]interface{}{ - "from_port": 22, - }, - map[string]interface{}{ - "from_port": 80, - }, - }, - }, - }, - }, - }, - }, - }, - - { - "structure_list_empty.json", - false, - map[string]interface{}{ - "foo": []interface{}{}, - }, - }, - - { - "nested_block_comment.hcl", - false, - map[string]interface{}{ - "bar": "value", - }, - }, - - { - "unterminated_block_comment.hcl", - true, - nil, - }, - - { - "unterminated_brace.hcl", - true, - nil, - }, - - { - "nested_provider_bad.hcl", - true, - nil, - }, - - { - "object_list.json", - false, - map[string]interface{}{ - "resource": []map[string]interface{}{ - map[string]interface{}{ - "aws_instance": []map[string]interface{}{ - map[string]interface{}{ - "db": []map[string]interface{}{ - map[string]interface{}{ - "vpc": "foo", - "provisioner": []map[string]interface{}{ - map[string]interface{}{ - "file": []map[string]interface{}{ - map[string]interface{}{ - "source": "foo", - "destination": "bar", - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - }, - - // Terraform GH-8295 sanity test that basic decoding into - // interface{} works. - { - "terraform_variable_invalid.json", - false, - map[string]interface{}{ - "variable": []map[string]interface{}{ - map[string]interface{}{ - "whatever": "abc123", - }, - }, - }, - }, - - { - "interpolate.json", - false, - map[string]interface{}{ - "default": `${replace("europe-west", "-", " ")}`, - }, - }, - - { - "block_assign.hcl", - true, - nil, - }, - - { - "escape_backslash.hcl", - false, - map[string]interface{}{ - "output": []map[string]interface{}{ - map[string]interface{}{ - "one": `${replace(var.sub_domain, ".", "\\.")}`, - "two": `${replace(var.sub_domain, ".", "\\\\.")}`, - "many": `${replace(var.sub_domain, ".", "\\\\\\\\.")}`, - }, - }, - }, - }, - - { - "git_crypt.hcl", - true, - nil, - }, - - { - "object_with_bool.hcl", - false, - map[string]interface{}{ - "path": []map[string]interface{}{ - map[string]interface{}{ - "policy": "write", - "permissions": []map[string]interface{}{ - map[string]interface{}{ - "bool": []interface{}{false}, - }, - }, - }, - }, - }, - }, - } - - for _, tc := range cases { - t.Run(tc.File, func(t *testing.T) { - d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.File)) - if err != nil { - t.Fatalf("err: %s", err) - } - - var out interface{} - err = Decode(&out, string(d)) - if (err != nil) != tc.Err { - t.Fatalf("Input: %s\n\nError: %s", tc.File, err) - } - - if !reflect.DeepEqual(out, tc.Out) { - t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out) - } - - var v interface{} - err = Unmarshal(d, &v) - if (err != nil) != tc.Err { - t.Fatalf("Input: %s\n\nError: %s", tc.File, err) - } - - if !reflect.DeepEqual(v, tc.Out) { - t.Fatalf("Input: %s. Actual, Expected.\n\n%#v\n\n%#v", tc.File, out, tc.Out) - } - }) - } -} - -func TestDecode_interfaceInline(t *testing.T) { - cases := []struct { - Value string - Err bool - Out interface{} - }{ - {"t t e{{}}", true, nil}, - {"t=0t d {}", true, map[string]interface{}{"t": 0}}, - {"v=0E0v d{}", true, map[string]interface{}{"v": float64(0)}}, - } - - for _, tc := range cases { - t.Logf("Testing: %q", tc.Value) - - var out interface{} - err := Decode(&out, tc.Value) - if (err != nil) != tc.Err { - t.Fatalf("Input: %q\n\nError: %s", tc.Value, err) - } - - if !reflect.DeepEqual(out, tc.Out) { - t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out) - } - - var v interface{} - err = Unmarshal([]byte(tc.Value), &v) - if (err != nil) != tc.Err { - t.Fatalf("Input: %q\n\nError: %s", tc.Value, err) - } - - if !reflect.DeepEqual(v, tc.Out) { - t.Fatalf("Input: %q. Actual, Expected.\n\n%#v\n\n%#v", tc.Value, out, tc.Out) - } - } -} - -func TestDecode_equal(t *testing.T) { - cases := []struct { - One, Two string - }{ - { - "basic.hcl", - "basic.json", - }, - { - "float.hcl", - "float.json", - }, - /* - { - "structure.hcl", - "structure.json", - }, - */ - { - "structure.hcl", - "structure_flat.json", - }, - { - "terraform_heroku.hcl", - "terraform_heroku.json", - }, - } - - for _, tc := range cases { - p1 := filepath.Join(fixtureDir, tc.One) - p2 := filepath.Join(fixtureDir, tc.Two) - - d1, err := ioutil.ReadFile(p1) - if err != nil { - t.Fatalf("err: %s", err) - } - - d2, err := ioutil.ReadFile(p2) - if err != nil { - t.Fatalf("err: %s", err) - } - - var i1, i2 interface{} - err = Decode(&i1, string(d1)) - if err != nil { - t.Fatalf("err: %s", err) - } - - err = Decode(&i2, string(d2)) - if err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(i1, i2) { - t.Fatalf( - "%s != %s\n\n%#v\n\n%#v", - tc.One, tc.Two, - i1, i2) - } - } -} - -func TestDecode_flatMap(t *testing.T) { - var val map[string]map[string]string - - err := Decode(&val, testReadFile(t, "structure_flatmap.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := map[string]map[string]string{ - "foo": map[string]string{ - "foo": "bar", - "key": "7", - }, - } - - if !reflect.DeepEqual(val, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", val, expected) - } -} - -func TestDecode_structure(t *testing.T) { - type Embedded interface{} - - type V struct { - Embedded `hcl:"-"` - Key int - Foo string - } - - var actual V - - err := Decode(&actual, testReadFile(t, "flat.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := V{ - Key: 7, - Foo: "bar", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected) - } -} - -func TestDecode_structurePtr(t *testing.T) { - type V struct { - Key int - Foo string - } - - var actual *V - - err := Decode(&actual, testReadFile(t, "flat.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - expected := &V{ - Key: 7, - Foo: "bar", - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Actual: %#v\n\nExpected: %#v", actual, expected) - } -} - -func TestDecode_structureArray(t *testing.T) { - // This test is extracted from a failure in Consul (consul.io), - // hence the interesting structure naming. - - type KeyPolicyType string - - type KeyPolicy struct { - Prefix string `hcl:",key"` - Policy KeyPolicyType - } - - type Policy struct { - Keys []KeyPolicy `hcl:"key,expand"` - } - - expected := Policy{ - Keys: []KeyPolicy{ - KeyPolicy{ - Prefix: "", - Policy: "read", - }, - KeyPolicy{ - Prefix: "foo/", - Policy: "write", - }, - KeyPolicy{ - Prefix: "foo/bar/", - Policy: "read", - }, - KeyPolicy{ - Prefix: "foo/bar/baz", - Policy: "deny", - }, - }, - } - - files := []string{ - "decode_policy.hcl", - "decode_policy.json", - } - - for _, f := range files { - var actual Policy - - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_sliceExpand(t *testing.T) { - type testInner struct { - Name string `hcl:",key"` - Key string - } - - type testStruct struct { - Services []testInner `hcl:"service,expand"` - } - - expected := testStruct{ - Services: []testInner{ - testInner{ - Name: "my-service-0", - Key: "value", - }, - testInner{ - Name: "my-service-1", - Key: "value", - }, - }, - } - - files := []string{ - "slice_expand.hcl", - } - - for _, f := range files { - t.Logf("Testing: %s", f) - - var actual testStruct - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_structureMap(t *testing.T) { - // This test is extracted from a failure in Terraform (terraform.io), - // hence the interesting structure naming. - - type hclVariable struct { - Default interface{} - Description string - Fields []string `hcl:",decodedFields"` - } - - type rawConfig struct { - Variable map[string]hclVariable - } - - expected := rawConfig{ - Variable: map[string]hclVariable{ - "foo": hclVariable{ - Default: "bar", - Description: "bar", - Fields: []string{"Default", "Description"}, - }, - - "amis": hclVariable{ - Default: []map[string]interface{}{ - map[string]interface{}{ - "east": "foo", - }, - }, - Fields: []string{"Default"}, - }, - }, - } - - files := []string{ - "decode_tf_variable.hcl", - "decode_tf_variable.json", - } - - for _, f := range files { - t.Logf("Testing: %s", f) - - var actual rawConfig - err := Decode(&actual, testReadFile(t, f)) - if err != nil { - t.Fatalf("Input: %s\n\nerr: %s", f, err) - } - - if !reflect.DeepEqual(actual, expected) { - t.Fatalf("Input: %s\n\nActual: %#v\n\nExpected: %#v", f, actual, expected) - } - } -} - -func TestDecode_structureMapInvalid(t *testing.T) { - // Terraform GH-8295 - - type hclVariable struct { - Default interface{} - Description string - Fields []string `hcl:",decodedFields"` - } - - type rawConfig struct { - Variable map[string]*hclVariable - } - - var actual rawConfig - err := Decode(&actual, testReadFile(t, "terraform_variable_invalid.json")) - if err == nil { - t.Fatal("expected error") - } -} - -func TestDecode_interfaceNonPointer(t *testing.T) { - var value interface{} - err := Decode(value, testReadFile(t, "basic_int_string.hcl")) - if err == nil { - t.Fatal("should error") - } -} - -func TestDecode_intString(t *testing.T) { - var value struct { - Count int - } - - err := Decode(&value, testReadFile(t, "basic_int_string.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - if value.Count != 3 { - t.Fatalf("bad: %#v", value.Count) - } -} - -func TestDecode_float32(t *testing.T) { - var value struct { - A float32 `hcl:"a"` - B float32 `hcl:"b"` - } - - err := Decode(&value, testReadFile(t, "float.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - if got, want := value.A, float32(1.02); got != want { - t.Fatalf("wrong result %#v; want %#v", got, want) - } - if got, want := value.B, float32(2); got != want { - t.Fatalf("wrong result %#v; want %#v", got, want) - } -} - -func TestDecode_float64(t *testing.T) { - var value struct { - A float64 `hcl:"a"` - B float64 `hcl:"b"` - } - - err := Decode(&value, testReadFile(t, "float.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - if got, want := value.A, float64(1.02); got != want { - t.Fatalf("wrong result %#v; want %#v", got, want) - } - if got, want := value.B, float64(2); got != want { - t.Fatalf("wrong result %#v; want %#v", got, want) - } -} - -func TestDecode_intStringAliased(t *testing.T) { - var value struct { - Count time.Duration - } - - err := Decode(&value, testReadFile(t, "basic_int_string.hcl")) - if err != nil { - t.Fatalf("err: %s", err) - } - - if value.Count != time.Duration(3) { - t.Fatalf("bad: %#v", value.Count) - } -} - -func TestDecode_Node(t *testing.T) { - // given - var value struct { - Content ast.Node - Nested struct { - Content ast.Node - } - } - - content := ` -content { - hello = "world" -} -` - - // when - err := Decode(&value, content) - - // then - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - // verify ast.Node can be decoded later - var v map[string]interface{} - err = DecodeObject(&v, value.Content) - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - if v["hello"] != "world" { - t.Errorf("expected mapping to be returned") - } -} - -func TestDecode_NestedNode(t *testing.T) { - // given - var value struct { - Nested struct { - Content ast.Node - } - } - - content := ` -nested "content" { - hello = "world" -} -` - - // when - err := Decode(&value, content) - - // then - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - // verify ast.Node can be decoded later - var v map[string]interface{} - err = DecodeObject(&v, value.Nested.Content) - if err != nil { - t.Errorf("unable to decode content, %v", err) - return - } - - if v["hello"] != "world" { - t.Errorf("expected mapping to be returned") - } -} - -// https://github.com/hashicorp/hcl/issues/60 -func TestDecode_topLevelKeys(t *testing.T) { - type Template struct { - Source string - } - - templates := struct { - Templates []*Template `hcl:"template"` - }{} - - err := Decode(&templates, ` - template { - source = "blah" - } - - template { - source = "blahblah" - }`) - - if err != nil { - t.Fatal(err) - } - - if templates.Templates[0].Source != "blah" { - t.Errorf("bad source: %s", templates.Templates[0].Source) - } - - if templates.Templates[1].Source != "blahblah" { - t.Errorf("bad source: %s", templates.Templates[1].Source) - } -} - -func TestDecode_flattenedJSON(t *testing.T) { - // make sure we can also correctly extract a Name key too - type V struct { - Name string `hcl:",key"` - Description string - Default map[string]string - } - type Vars struct { - Variable []*V - } - - cases := []struct { - JSON string - Out interface{} - Expected interface{} - }{ - { // Nested object, no sibling keys - JSON: ` -{ - "var_name": { - "default": { - "key1": "a", - "key2": "b" - } - } -} - `, - Out: &[]*V{}, - Expected: &[]*V{ - &V{ - Name: "var_name", - Default: map[string]string{"key1": "a", "key2": "b"}, - }, - }, - }, - - { // Nested object with a sibling key (this worked previously) - JSON: ` -{ - "var_name": { - "description": "Described", - "default": { - "key1": "a", - "key2": "b" - } - } -} - `, - Out: &[]*V{}, - Expected: &[]*V{ - &V{ - Name: "var_name", - Description: "Described", - Default: map[string]string{"key1": "a", "key2": "b"}, - }, - }, - }, - - { // Multiple nested objects, one with a sibling key - JSON: ` -{ - "variable": { - "var_1": { - "default": { - "key1": "a", - "key2": "b" - } - }, - "var_2": { - "description": "Described", - "default": { - "key1": "a", - "key2": "b" - } - } - } -} - `, - Out: &Vars{}, - Expected: &Vars{ - Variable: []*V{ - &V{ - Name: "var_1", - Default: map[string]string{"key1": "a", "key2": "b"}, - }, - &V{ - Name: "var_2", - Description: "Described", - Default: map[string]string{"key1": "a", "key2": "b"}, - }, - }, - }, - }, - - { // Nested object to maps - JSON: ` -{ - "variable": { - "var_name": { - "description": "Described", - "default": { - "key1": "a", - "key2": "b" - } - } - } -} - `, - Out: &[]map[string]interface{}{}, - Expected: &[]map[string]interface{}{ - { - "variable": []map[string]interface{}{ - { - "var_name": []map[string]interface{}{ - { - "description": "Described", - "default": []map[string]interface{}{ - { - "key1": "a", - "key2": "b", - }, - }, - }, - }, - }, - }, - }, - }, - }, - - { // Nested object to maps without a sibling key should decode the same as above - JSON: ` -{ - "variable": { - "var_name": { - "default": { - "key1": "a", - "key2": "b" - } - } - } -} - `, - Out: &[]map[string]interface{}{}, - Expected: &[]map[string]interface{}{ - { - "variable": []map[string]interface{}{ - { - "var_name": []map[string]interface{}{ - { - "default": []map[string]interface{}{ - { - "key1": "a", - "key2": "b", - }, - }, - }, - }, - }, - }, - }, - }, - }, - - { // Nested objects, one with a sibling key, and one without - JSON: ` -{ - "variable": { - "var_1": { - "default": { - "key1": "a", - "key2": "b" - } - }, - "var_2": { - "description": "Described", - "default": { - "key1": "a", - "key2": "b" - } - } - } -} - `, - Out: &[]map[string]interface{}{}, - Expected: &[]map[string]interface{}{ - { - "variable": []map[string]interface{}{ - { - "var_1": []map[string]interface{}{ - { - "default": []map[string]interface{}{ - { - "key1": "a", - "key2": "b", - }, - }, - }, - }, - }, - }, - }, - { - "variable": []map[string]interface{}{ - { - "var_2": []map[string]interface{}{ - { - "description": "Described", - "default": []map[string]interface{}{ - { - "key1": "a", - "key2": "b", - }, - }, - }, - }, - }, - }, - }, - }, - }, - } - - for i, tc := range cases { - err := Decode(tc.Out, tc.JSON) - if err != nil { - t.Fatalf("[%d] err: %s", i, err) - } - - if !reflect.DeepEqual(tc.Out, tc.Expected) { - t.Fatalf("[%d]\ngot: %s\nexpected: %s\n", i, spew.Sdump(tc.Out), spew.Sdump(tc.Expected)) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/hcl.go b/vendor/github.com/hashicorp/hcl/hcl.go deleted file mode 100644 index 575a20b..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package hcl decodes HCL into usable Go structures. -// -// hcl input can come in either pure HCL format or JSON format. -// It can be parsed into an AST, and then decoded into a structure, -// or it can be decoded directly from a string into a structure. -// -// If you choose to parse HCL into a raw AST, the benefit is that you -// can write custom visitor implementations to implement custom -// semantic checks. By default, HCL does not perform any semantic -// checks. -package hcl diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go deleted file mode 100644 index 6e5ef65..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast.go +++ /dev/null @@ -1,219 +0,0 @@ -// Package ast declares the types used to represent syntax trees for HCL -// (HashiCorp Configuration Language) -package ast - -import ( - "fmt" - "strings" - - "github.com/hashicorp/hcl/hcl/token" -) - -// Node is an element in the abstract syntax tree. -type Node interface { - node() - Pos() token.Pos -} - -func (File) node() {} -func (ObjectList) node() {} -func (ObjectKey) node() {} -func (ObjectItem) node() {} -func (Comment) node() {} -func (CommentGroup) node() {} -func (ObjectType) node() {} -func (LiteralType) node() {} -func (ListType) node() {} - -// File represents a single HCL file -type File struct { - Node Node // usually a *ObjectList - Comments []*CommentGroup // list of all comments in the source -} - -func (f *File) Pos() token.Pos { - return f.Node.Pos() -} - -// ObjectList represents a list of ObjectItems. An HCL file itself is an -// ObjectList. -type ObjectList struct { - Items []*ObjectItem -} - -func (o *ObjectList) Add(item *ObjectItem) { - o.Items = append(o.Items, item) -} - -// Filter filters out the objects with the given key list as a prefix. -// -// The returned list of objects contain ObjectItems where the keys have -// this prefix already stripped off. This might result in objects with -// zero-length key lists if they have no children. -// -// If no matches are found, an empty ObjectList (non-nil) is returned. -func (o *ObjectList) Filter(keys ...string) *ObjectList { - var result ObjectList - for _, item := range o.Items { - // If there aren't enough keys, then ignore this - if len(item.Keys) < len(keys) { - continue - } - - match := true - for i, key := range item.Keys[:len(keys)] { - key := key.Token.Value().(string) - if key != keys[i] && !strings.EqualFold(key, keys[i]) { - match = false - break - } - } - if !match { - continue - } - - // Strip off the prefix from the children - newItem := *item - newItem.Keys = newItem.Keys[len(keys):] - result.Add(&newItem) - } - - return &result -} - -// Children returns further nested objects (key length > 0) within this -// ObjectList. This should be used with Filter to get at child items. -func (o *ObjectList) Children() *ObjectList { - var result ObjectList - for _, item := range o.Items { - if len(item.Keys) > 0 { - result.Add(item) - } - } - - return &result -} - -// Elem returns items in the list that are direct element assignments -// (key length == 0). This should be used with Filter to get at elements. -func (o *ObjectList) Elem() *ObjectList { - var result ObjectList - for _, item := range o.Items { - if len(item.Keys) == 0 { - result.Add(item) - } - } - - return &result -} - -func (o *ObjectList) Pos() token.Pos { - // always returns the uninitiliazed position - return o.Items[0].Pos() -} - -// ObjectItem represents a HCL Object Item. An item is represented with a key -// (or keys). It can be an assignment or an object (both normal and nested) -type ObjectItem struct { - // keys is only one length long if it's of type assignment. If it's a - // nested object it can be larger than one. In that case "assign" is - // invalid as there is no assignments for a nested object. - Keys []*ObjectKey - - // assign contains the position of "=", if any - Assign token.Pos - - // val is the item itself. It can be an object,list, number, bool or a - // string. If key length is larger than one, val can be only of type - // Object. - Val Node - - LeadComment *CommentGroup // associated lead comment - LineComment *CommentGroup // associated line comment -} - -func (o *ObjectItem) Pos() token.Pos { - // I'm not entirely sure what causes this, but removing this causes - // a test failure. We should investigate at some point. - if len(o.Keys) == 0 { - return token.Pos{} - } - - return o.Keys[0].Pos() -} - -// ObjectKeys are either an identifier or of type string. -type ObjectKey struct { - Token token.Token -} - -func (o *ObjectKey) Pos() token.Pos { - return o.Token.Pos -} - -// LiteralType represents a literal of basic type. Valid types are: -// token.NUMBER, token.FLOAT, token.BOOL and token.STRING -type LiteralType struct { - Token token.Token - - // comment types, only used when in a list - LeadComment *CommentGroup - LineComment *CommentGroup -} - -func (l *LiteralType) Pos() token.Pos { - return l.Token.Pos -} - -// ListStatement represents a HCL List type -type ListType struct { - Lbrack token.Pos // position of "[" - Rbrack token.Pos // position of "]" - List []Node // the elements in lexical order -} - -func (l *ListType) Pos() token.Pos { - return l.Lbrack -} - -func (l *ListType) Add(node Node) { - l.List = append(l.List, node) -} - -// ObjectType represents a HCL Object Type -type ObjectType struct { - Lbrace token.Pos // position of "{" - Rbrace token.Pos // position of "}" - List *ObjectList // the nodes in lexical order -} - -func (o *ObjectType) Pos() token.Pos { - return o.Lbrace -} - -// Comment node represents a single //, # style or /*- style commment -type Comment struct { - Start token.Pos // position of / or # - Text string -} - -func (c *Comment) Pos() token.Pos { - return c.Start -} - -// CommentGroup node represents a sequence of comments with no other tokens and -// no empty lines between. -type CommentGroup struct { - List []*Comment // len(List) > 0 -} - -func (c *CommentGroup) Pos() token.Pos { - return c.List[0].Pos() -} - -//------------------------------------------------------------------- -// GoStringer -//------------------------------------------------------------------- - -func (o *ObjectKey) GoString() string { return fmt.Sprintf("*%#v", *o) } -func (o *ObjectList) GoString() string { return fmt.Sprintf("*%#v", *o) } diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go b/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go deleted file mode 100644 index 942256c..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/ast/ast_test.go +++ /dev/null @@ -1,200 +0,0 @@ -package ast - -import ( - "reflect" - "strings" - "testing" - - "github.com/hashicorp/hcl/hcl/token" -) - -func TestObjectListFilter(t *testing.T) { - var cases = []struct { - Filter []string - Input []*ObjectItem - Output []*ObjectItem - }{ - { - []string{"foo"}, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{ - Token: token.Token{Type: token.STRING, Text: `"foo"`}, - }, - }, - }, - }, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{}, - }, - }, - }, - - { - []string{"foo"}, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - }, - []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - }, - }, - } - - for _, tc := range cases { - input := &ObjectList{Items: tc.Input} - expected := &ObjectList{Items: tc.Output} - if actual := input.Filter(tc.Filter...); !reflect.DeepEqual(actual, expected) { - t.Fatalf("in order: input, expected, actual\n\n%#v\n\n%#v\n\n%#v", input, expected, actual) - } - } -} - -func TestWalk(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - Val: &LiteralType{Token: token.Token{Type: token.STRING, Text: `"example"`}}, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - order := []string{ - "*ast.ObjectList", - "*ast.ObjectItem", - "*ast.ObjectKey", - "*ast.ObjectKey", - "*ast.LiteralType", - "*ast.ObjectItem", - "*ast.ObjectKey", - } - count := 0 - - Walk(node, func(n Node) (Node, bool) { - if n == nil { - return n, false - } - - typeName := reflect.TypeOf(n).String() - if order[count] != typeName { - t.Errorf("expected '%s' got: '%s'", order[count], typeName) - } - count++ - return n, true - }) -} - -func TestWalkEquality(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - rewritten := Walk(node, func(n Node) (Node, bool) { return n, true }) - - newNode, ok := rewritten.(*ObjectList) - if !ok { - t.Fatalf("expected Objectlist, got %T", rewritten) - } - - if !reflect.DeepEqual(node, newNode) { - t.Fatal("rewritten node is not equal to the given node") - } - - if len(newNode.Items) != 2 { - t.Error("expected newNode length 2, got: %d", len(newNode.Items)) - } - - expected := []string{ - `"foo"`, - `"bar"`, - } - - for i, item := range newNode.Items { - if len(item.Keys) != 1 { - t.Error("expected keys newNode length 1, got: %d", len(item.Keys)) - } - - if item.Keys[0].Token.Text != expected[i] { - t.Errorf("expected key %s, got %s", expected[i], item.Keys[0].Token.Text) - } - - if item.Val != nil { - t.Errorf("expected item value should be nil") - } - } -} - -func TestWalkRewrite(t *testing.T) { - items := []*ObjectItem{ - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"foo"`}}, - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"bar"`}}, - }, - }, - &ObjectItem{ - Keys: []*ObjectKey{ - &ObjectKey{Token: token.Token{Type: token.STRING, Text: `"baz"`}}, - }, - }, - } - - node := &ObjectList{Items: items} - - suffix := "_example" - node = Walk(node, func(n Node) (Node, bool) { - switch i := n.(type) { - case *ObjectKey: - i.Token.Text = i.Token.Text + suffix - n = i - } - return n, true - }).(*ObjectList) - - Walk(node, func(n Node) (Node, bool) { - switch i := n.(type) { - case *ObjectKey: - if !strings.HasSuffix(i.Token.Text, suffix) { - t.Errorf("Token '%s' should have suffix: %s", i.Token.Text, suffix) - } - } - return n, true - }) - -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go b/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go deleted file mode 100644 index ba07ad4..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/ast/walk.go +++ /dev/null @@ -1,52 +0,0 @@ -package ast - -import "fmt" - -// WalkFunc describes a function to be called for each node during a Walk. The -// returned node can be used to rewrite the AST. Walking stops the returned -// bool is false. -type WalkFunc func(Node) (Node, bool) - -// Walk traverses an AST in depth-first order: It starts by calling fn(node); -// node must not be nil. If fn returns true, Walk invokes fn recursively for -// each of the non-nil children of node, followed by a call of fn(nil). The -// returned node of fn can be used to rewrite the passed node to fn. -func Walk(node Node, fn WalkFunc) Node { - rewritten, ok := fn(node) - if !ok { - return rewritten - } - - switch n := node.(type) { - case *File: - n.Node = Walk(n.Node, fn) - case *ObjectList: - for i, item := range n.Items { - n.Items[i] = Walk(item, fn).(*ObjectItem) - } - case *ObjectKey: - // nothing to do - case *ObjectItem: - for i, k := range n.Keys { - n.Keys[i] = Walk(k, fn).(*ObjectKey) - } - - if n.Val != nil { - n.Val = Walk(n.Val, fn) - } - case *LiteralType: - // nothing to do - case *ListType: - for i, l := range n.List { - n.List[i] = Walk(l, fn) - } - case *ObjectType: - n.List = Walk(n.List, fn).(*ObjectList) - default: - // should we panic here? - fmt.Printf("unknown type: %T\n", n) - } - - fn(nil) - return rewritten -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error.go deleted file mode 100644 index 5c99381..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/error.go +++ /dev/null @@ -1,17 +0,0 @@ -package parser - -import ( - "fmt" - - "github.com/hashicorp/hcl/hcl/token" -) - -// PosError is a parse error that contains a position. -type PosError struct { - Pos token.Pos - Err error -} - -func (e *PosError) Error() string { - return fmt.Sprintf("At %s: %s", e.Pos, e.Err) -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go deleted file mode 100644 index 32399fe..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/error_test.go +++ /dev/null @@ -1,9 +0,0 @@ -package parser - -import ( - "testing" -) - -func TestPosError_impl(t *testing.T) { - var _ error = new(PosError) -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go deleted file mode 100644 index 098e1bc..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser.go +++ /dev/null @@ -1,526 +0,0 @@ -// Package parser implements a parser for HCL (HashiCorp Configuration -// Language) -package parser - -import ( - "bytes" - "errors" - "fmt" - "strings" - - "github.com/hashicorp/hcl/hcl/ast" - "github.com/hashicorp/hcl/hcl/scanner" - "github.com/hashicorp/hcl/hcl/token" -) - -type Parser struct { - sc *scanner.Scanner - - // Last read token - tok token.Token - commaPrev token.Token - - comments []*ast.CommentGroup - leadComment *ast.CommentGroup // last lead comment - lineComment *ast.CommentGroup // last line comment - - enableTrace bool - indent int - n int // buffer size (max = 1) -} - -func newParser(src []byte) *Parser { - return &Parser{ - sc: scanner.New(src), - } -} - -// Parse returns the fully parsed source and returns the abstract syntax tree. -func Parse(src []byte) (*ast.File, error) { - // normalize all line endings - // since the scanner and output only work with "\n" line endings, we may - // end up with dangling "\r" characters in the parsed data. - src = bytes.Replace(src, []byte("\r\n"), []byte("\n"), -1) - - p := newParser(src) - return p.Parse() -} - -var errEofToken = errors.New("EOF token found") - -// Parse returns the fully parsed source and returns the abstract syntax tree. -func (p *Parser) Parse() (*ast.File, error) { - f := &ast.File{} - var err, scerr error - p.sc.Error = func(pos token.Pos, msg string) { - scerr = &PosError{Pos: pos, Err: errors.New(msg)} - } - - f.Node, err = p.objectList(false) - if scerr != nil { - return nil, scerr - } - if err != nil { - return nil, err - } - - f.Comments = p.comments - return f, nil -} - -// objectList parses a list of items within an object (generally k/v pairs). -// The parameter" obj" tells this whether to we are within an object (braces: -// '{', '}') or just at the top level. If we're within an object, we end -// at an RBRACE. -func (p *Parser) objectList(obj bool) (*ast.ObjectList, error) { - defer un(trace(p, "ParseObjectList")) - node := &ast.ObjectList{} - - for { - if obj { - tok := p.scan() - p.unscan() - if tok.Type == token.RBRACE { - break - } - } - - n, err := p.objectItem() - if err == errEofToken { - break // we are finished - } - - // we don't return a nil node, because might want to use already - // collected items. - if err != nil { - return node, err - } - - node.Add(n) - - // object lists can be optionally comma-delimited e.g. when a list of maps - // is being expressed, so a comma is allowed here - it's simply consumed - tok := p.scan() - if tok.Type != token.COMMA { - p.unscan() - } - } - return node, nil -} - -func (p *Parser) consumeComment() (comment *ast.Comment, endline int) { - endline = p.tok.Pos.Line - - // count the endline if it's multiline comment, ie starting with /* - if len(p.tok.Text) > 1 && p.tok.Text[1] == '*' { - // don't use range here - no need to decode Unicode code points - for i := 0; i < len(p.tok.Text); i++ { - if p.tok.Text[i] == '\n' { - endline++ - } - } - } - - comment = &ast.Comment{Start: p.tok.Pos, Text: p.tok.Text} - p.tok = p.sc.Scan() - return -} - -func (p *Parser) consumeCommentGroup(n int) (comments *ast.CommentGroup, endline int) { - var list []*ast.Comment - endline = p.tok.Pos.Line - - for p.tok.Type == token.COMMENT && p.tok.Pos.Line <= endline+n { - var comment *ast.Comment - comment, endline = p.consumeComment() - list = append(list, comment) - } - - // add comment group to the comments list - comments = &ast.CommentGroup{List: list} - p.comments = append(p.comments, comments) - - return -} - -// objectItem parses a single object item -func (p *Parser) objectItem() (*ast.ObjectItem, error) { - defer un(trace(p, "ParseObjectItem")) - - keys, err := p.objectKey() - if len(keys) > 0 && err == errEofToken { - // We ignore eof token here since it is an error if we didn't - // receive a value (but we did receive a key) for the item. - err = nil - } - if len(keys) > 0 && err != nil && p.tok.Type == token.RBRACE { - // This is a strange boolean statement, but what it means is: - // We have keys with no value, and we're likely in an object - // (since RBrace ends an object). For this, we set err to nil so - // we continue and get the error below of having the wrong value - // type. - err = nil - - // Reset the token type so we don't think it completed fine. See - // objectType which uses p.tok.Type to check if we're done with - // the object. - p.tok.Type = token.EOF - } - if err != nil { - return nil, err - } - - o := &ast.ObjectItem{ - Keys: keys, - } - - if p.leadComment != nil { - o.LeadComment = p.leadComment - p.leadComment = nil - } - - switch p.tok.Type { - case token.ASSIGN: - o.Assign = p.tok.Pos - o.Val, err = p.object() - if err != nil { - return nil, err - } - case token.LBRACE: - o.Val, err = p.objectType() - if err != nil { - return nil, err - } - default: - keyStr := make([]string, 0, len(keys)) - for _, k := range keys { - keyStr = append(keyStr, k.Token.Text) - } - - return nil, &PosError{ - Pos: p.tok.Pos, - Err: fmt.Errorf( - "key '%s' expected start of object ('{') or assignment ('=')", - strings.Join(keyStr, " ")), - } - } - - // do a look-ahead for line comment - p.scan() - if len(keys) > 0 && o.Val.Pos().Line == keys[0].Pos().Line && p.lineComment != nil { - o.LineComment = p.lineComment - p.lineComment = nil - } - p.unscan() - return o, nil -} - -// objectKey parses an object key and returns a ObjectKey AST -func (p *Parser) objectKey() ([]*ast.ObjectKey, error) { - keyCount := 0 - keys := make([]*ast.ObjectKey, 0) - - for { - tok := p.scan() - switch tok.Type { - case token.EOF: - // It is very important to also return the keys here as well as - // the error. This is because we need to be able to tell if we - // did parse keys prior to finding the EOF, or if we just found - // a bare EOF. - return keys, errEofToken - case token.ASSIGN: - // assignment or object only, but not nested objects. this is not - // allowed: `foo bar = {}` - if keyCount > 1 { - return nil, &PosError{ - Pos: p.tok.Pos, - Err: fmt.Errorf("nested object expected: LBRACE got: %s", p.tok.Type), - } - } - - if keyCount == 0 { - return nil, &PosError{ - Pos: p.tok.Pos, - Err: errors.New("no object keys found!"), - } - } - - return keys, nil - case token.LBRACE: - var err error - - // If we have no keys, then it is a syntax error. i.e. {{}} is not - // allowed. - if len(keys) == 0 { - err = &PosError{ - Pos: p.tok.Pos, - Err: fmt.Errorf("expected: IDENT | STRING got: %s", p.tok.Type), - } - } - - // object - return keys, err - case token.IDENT, token.STRING: - keyCount++ - keys = append(keys, &ast.ObjectKey{Token: p.tok}) - case token.ILLEGAL: - return keys, &PosError{ - Pos: p.tok.Pos, - Err: fmt.Errorf("illegal character"), - } - default: - return keys, &PosError{ - Pos: p.tok.Pos, - Err: fmt.Errorf("expected: IDENT | STRING | ASSIGN | LBRACE got: %s", p.tok.Type), - } - } - } -} - -// object parses any type of object, such as number, bool, string, object or -// list. -func (p *Parser) object() (ast.Node, error) { - defer un(trace(p, "ParseType")) - tok := p.scan() - - switch tok.Type { - case token.NUMBER, token.FLOAT, token.BOOL, token.STRING, token.HEREDOC: - return p.literalType() - case token.LBRACE: - return p.objectType() - case token.LBRACK: - return p.listType() - case token.COMMENT: - // implement comment - case token.EOF: - return nil, errEofToken - } - - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf("Unknown token: %+v", tok), - } -} - -// objectType parses an object type and returns a ObjectType AST -func (p *Parser) objectType() (*ast.ObjectType, error) { - defer un(trace(p, "ParseObjectType")) - - // we assume that the currently scanned token is a LBRACE - o := &ast.ObjectType{ - Lbrace: p.tok.Pos, - } - - l, err := p.objectList(true) - - // if we hit RBRACE, we are good to go (means we parsed all Items), if it's - // not a RBRACE, it's an syntax error and we just return it. - if err != nil && p.tok.Type != token.RBRACE { - return nil, err - } - - // No error, scan and expect the ending to be a brace - if tok := p.scan(); tok.Type != token.RBRACE { - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf("object expected closing RBRACE got: %s", tok.Type), - } - } - - o.List = l - o.Rbrace = p.tok.Pos // advanced via parseObjectList - return o, nil -} - -// listType parses a list type and returns a ListType AST -func (p *Parser) listType() (*ast.ListType, error) { - defer un(trace(p, "ParseListType")) - - // we assume that the currently scanned token is a LBRACK - l := &ast.ListType{ - Lbrack: p.tok.Pos, - } - - needComma := false - for { - tok := p.scan() - if needComma { - switch tok.Type { - case token.COMMA, token.RBRACK: - default: - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf( - "error parsing list, expected comma or list end, got: %s", - tok.Type), - } - } - } - switch tok.Type { - case token.BOOL, token.NUMBER, token.FLOAT, token.STRING, token.HEREDOC: - node, err := p.literalType() - if err != nil { - return nil, err - } - - // If there is a lead comment, apply it - if p.leadComment != nil { - node.LeadComment = p.leadComment - p.leadComment = nil - } - - l.Add(node) - needComma = true - case token.COMMA: - // get next list item or we are at the end - // do a look-ahead for line comment - p.scan() - if p.lineComment != nil && len(l.List) > 0 { - lit, ok := l.List[len(l.List)-1].(*ast.LiteralType) - if ok { - lit.LineComment = p.lineComment - l.List[len(l.List)-1] = lit - p.lineComment = nil - } - } - p.unscan() - - needComma = false - continue - case token.LBRACE: - // Looks like a nested object, so parse it out - node, err := p.objectType() - if err != nil { - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf( - "error while trying to parse object within list: %s", err), - } - } - l.Add(node) - needComma = true - case token.LBRACK: - node, err := p.listType() - if err != nil { - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf( - "error while trying to parse list within list: %s", err), - } - } - l.Add(node) - case token.RBRACK: - // finished - l.Rbrack = p.tok.Pos - return l, nil - default: - return nil, &PosError{ - Pos: tok.Pos, - Err: fmt.Errorf("unexpected token while parsing list: %s", tok.Type), - } - } - } -} - -// literalType parses a literal type and returns a LiteralType AST -func (p *Parser) literalType() (*ast.LiteralType, error) { - defer un(trace(p, "ParseLiteral")) - - return &ast.LiteralType{ - Token: p.tok, - }, nil -} - -// scan returns the next token from the underlying scanner. If a token has -// been unscanned then read that instead. In the process, it collects any -// comment groups encountered, and remembers the last lead and line comments. -func (p *Parser) scan() token.Token { - // If we have a token on the buffer, then return it. - if p.n != 0 { - p.n = 0 - return p.tok - } - - // Otherwise read the next token from the scanner and Save it to the buffer - // in case we unscan later. - prev := p.tok - p.tok = p.sc.Scan() - - if p.tok.Type == token.COMMENT { - var comment *ast.CommentGroup - var endline int - - // fmt.Printf("p.tok.Pos.Line = %+v prev: %d endline %d \n", - // p.tok.Pos.Line, prev.Pos.Line, endline) - if p.tok.Pos.Line == prev.Pos.Line { - // The comment is on same line as the previous token; it - // cannot be a lead comment but may be a line comment. - comment, endline = p.consumeCommentGroup(0) - if p.tok.Pos.Line != endline { - // The next token is on a different line, thus - // the last comment group is a line comment. - p.lineComment = comment - } - } - - // consume successor comments, if any - endline = -1 - for p.tok.Type == token.COMMENT { - comment, endline = p.consumeCommentGroup(1) - } - - if endline+1 == p.tok.Pos.Line && p.tok.Type != token.RBRACE { - switch p.tok.Type { - case token.RBRACE, token.RBRACK: - // Do not count for these cases - default: - // The next token is following on the line immediately after the - // comment group, thus the last comment group is a lead comment. - p.leadComment = comment - } - } - - } - - return p.tok -} - -// unscan pushes the previously read token back onto the buffer. -func (p *Parser) unscan() { - p.n = 1 -} - -// ---------------------------------------------------------------------------- -// Parsing support - -func (p *Parser) printTrace(a ...interface{}) { - if !p.enableTrace { - return - } - - const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " - const n = len(dots) - fmt.Printf("%5d:%3d: ", p.tok.Pos.Line, p.tok.Pos.Column) - - i := 2 * p.indent - for i > n { - fmt.Print(dots) - i -= n - } - // i <= n - fmt.Print(dots[0:i]) - fmt.Println(a...) -} - -func trace(p *Parser, msg string) *Parser { - p.printTrace(msg, "(") - p.indent++ - return p -} - -// Usage pattern: defer un(trace(p, "...")) -func un(p *Parser) { - p.indent-- - p.printTrace(")") -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go deleted file mode 100644 index 2702122..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/parser/parser_test.go +++ /dev/null @@ -1,575 +0,0 @@ -package parser - -import ( - "fmt" - "io/ioutil" - "path/filepath" - "reflect" - "runtime" - "strings" - "testing" - - "github.com/hashicorp/hcl/hcl/ast" - "github.com/hashicorp/hcl/hcl/token" -) - -func TestType(t *testing.T) { - var literals = []struct { - typ token.Type - src string - }{ - {token.STRING, `foo = "foo"`}, - {token.NUMBER, `foo = 123`}, - {token.NUMBER, `foo = -29`}, - {token.FLOAT, `foo = 123.12`}, - {token.FLOAT, `foo = -123.12`}, - {token.BOOL, `foo = true`}, - {token.HEREDOC, "foo = < 0 { - s.err("unexpected null character (0x00)") - return eof - } - - // debug - // fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column) - return ch -} - -// unread unreads the previous read Rune and updates the source position -func (s *Scanner) unread() { - if err := s.buf.UnreadRune(); err != nil { - panic(err) // this is user fault, we should catch it - } - s.srcPos = s.prevPos // put back last position -} - -// peek returns the next rune without advancing the reader. -func (s *Scanner) peek() rune { - peek, _, err := s.buf.ReadRune() - if err != nil { - return eof - } - - s.buf.UnreadRune() - return peek -} - -// Scan scans the next token and returns the token. -func (s *Scanner) Scan() token.Token { - ch := s.next() - - // skip white space - for isWhitespace(ch) { - ch = s.next() - } - - var tok token.Type - - // token text markings - s.tokStart = s.srcPos.Offset - s.lastCharLen - - // token position, initial next() is moving the offset by one(size of rune - // actually), though we are interested with the starting point - s.tokPos.Offset = s.srcPos.Offset - s.lastCharLen - if s.srcPos.Column > 0 { - // common case: last character was not a '\n' - s.tokPos.Line = s.srcPos.Line - s.tokPos.Column = s.srcPos.Column - } else { - // last character was a '\n' - // (we cannot be at the beginning of the source - // since we have called next() at least once) - s.tokPos.Line = s.srcPos.Line - 1 - s.tokPos.Column = s.lastLineLen - } - - switch { - case isLetter(ch): - tok = token.IDENT - lit := s.scanIdentifier() - if lit == "true" || lit == "false" { - tok = token.BOOL - } - case isDecimal(ch): - tok = s.scanNumber(ch) - default: - switch ch { - case eof: - tok = token.EOF - case '"': - tok = token.STRING - s.scanString() - case '#', '/': - tok = token.COMMENT - s.scanComment(ch) - case '.': - tok = token.PERIOD - ch = s.peek() - if isDecimal(ch) { - tok = token.FLOAT - ch = s.scanMantissa(ch) - ch = s.scanExponent(ch) - } - case '<': - tok = token.HEREDOC - s.scanHeredoc() - case '[': - tok = token.LBRACK - case ']': - tok = token.RBRACK - case '{': - tok = token.LBRACE - case '}': - tok = token.RBRACE - case ',': - tok = token.COMMA - case '=': - tok = token.ASSIGN - case '+': - tok = token.ADD - case '-': - if isDecimal(s.peek()) { - ch := s.next() - tok = s.scanNumber(ch) - } else { - tok = token.SUB - } - default: - s.err("illegal char") - } - } - - // finish token ending - s.tokEnd = s.srcPos.Offset - - // create token literal - var tokenText string - if s.tokStart >= 0 { - tokenText = string(s.src[s.tokStart:s.tokEnd]) - } - s.tokStart = s.tokEnd // ensure idempotency of tokenText() call - - return token.Token{ - Type: tok, - Pos: s.tokPos, - Text: tokenText, - } -} - -func (s *Scanner) scanComment(ch rune) { - // single line comments - if ch == '#' || (ch == '/' && s.peek() != '*') { - if ch == '/' && s.peek() != '/' { - s.err("expected '/' for comment") - return - } - - ch = s.next() - for ch != '\n' && ch >= 0 && ch != eof { - ch = s.next() - } - if ch != eof && ch >= 0 { - s.unread() - } - return - } - - // be sure we get the character after /* This allows us to find comment's - // that are not erminated - if ch == '/' { - s.next() - ch = s.next() // read character after "/*" - } - - // look for /* - style comments - for { - if ch < 0 || ch == eof { - s.err("comment not terminated") - break - } - - ch0 := ch - ch = s.next() - if ch0 == '*' && ch == '/' { - break - } - } -} - -// scanNumber scans a HCL number definition starting with the given rune -func (s *Scanner) scanNumber(ch rune) token.Type { - if ch == '0' { - // check for hexadecimal, octal or float - ch = s.next() - if ch == 'x' || ch == 'X' { - // hexadecimal - ch = s.next() - found := false - for isHexadecimal(ch) { - ch = s.next() - found = true - } - - if !found { - s.err("illegal hexadecimal number") - } - - if ch != eof { - s.unread() - } - - return token.NUMBER - } - - // now it's either something like: 0421(octal) or 0.1231(float) - illegalOctal := false - for isDecimal(ch) { - ch = s.next() - if ch == '8' || ch == '9' { - // this is just a possibility. For example 0159 is illegal, but - // 0159.23 is valid. So we mark a possible illegal octal. If - // the next character is not a period, we'll print the error. - illegalOctal = true - } - } - - if ch == 'e' || ch == 'E' { - ch = s.scanExponent(ch) - return token.FLOAT - } - - if ch == '.' { - ch = s.scanFraction(ch) - - if ch == 'e' || ch == 'E' { - ch = s.next() - ch = s.scanExponent(ch) - } - return token.FLOAT - } - - if illegalOctal { - s.err("illegal octal number") - } - - if ch != eof { - s.unread() - } - return token.NUMBER - } - - s.scanMantissa(ch) - ch = s.next() // seek forward - if ch == 'e' || ch == 'E' { - ch = s.scanExponent(ch) - return token.FLOAT - } - - if ch == '.' { - ch = s.scanFraction(ch) - if ch == 'e' || ch == 'E' { - ch = s.next() - ch = s.scanExponent(ch) - } - return token.FLOAT - } - - if ch != eof { - s.unread() - } - return token.NUMBER -} - -// scanMantissa scans the mantissa beginning from the rune. It returns the next -// non decimal rune. It's used to determine wheter it's a fraction or exponent. -func (s *Scanner) scanMantissa(ch rune) rune { - scanned := false - for isDecimal(ch) { - ch = s.next() - scanned = true - } - - if scanned && ch != eof { - s.unread() - } - return ch -} - -// scanFraction scans the fraction after the '.' rune -func (s *Scanner) scanFraction(ch rune) rune { - if ch == '.' { - ch = s.peek() // we peek just to see if we can move forward - ch = s.scanMantissa(ch) - } - return ch -} - -// scanExponent scans the remaining parts of an exponent after the 'e' or 'E' -// rune. -func (s *Scanner) scanExponent(ch rune) rune { - if ch == 'e' || ch == 'E' { - ch = s.next() - if ch == '-' || ch == '+' { - ch = s.next() - } - ch = s.scanMantissa(ch) - } - return ch -} - -// scanHeredoc scans a heredoc string -func (s *Scanner) scanHeredoc() { - // Scan the second '<' in example: '<= len(identBytes) && identRegexp.Match(s.src[lineStart:s.srcPos.Offset-s.lastCharLen]) { - break - } - - // Not an anchor match, record the start of a new line - lineStart = s.srcPos.Offset - } - - if ch == eof { - s.err("heredoc not terminated") - return - } - } - - return -} - -// scanString scans a quoted string -func (s *Scanner) scanString() { - braces := 0 - for { - // '"' opening already consumed - // read character after quote - ch := s.next() - - if (ch == '\n' && braces == 0) || ch < 0 || ch == eof { - s.err("literal not terminated") - return - } - - if ch == '"' && braces == 0 { - break - } - - // If we're going into a ${} then we can ignore quotes for awhile - if braces == 0 && ch == '$' && s.peek() == '{' { - braces++ - s.next() - } else if braces > 0 && ch == '{' { - braces++ - } - if braces > 0 && ch == '}' { - braces-- - } - - if ch == '\\' { - s.scanEscape() - } - } - - return -} - -// scanEscape scans an escape sequence -func (s *Scanner) scanEscape() rune { - // http://en.cppreference.com/w/cpp/language/escape - ch := s.next() // read character after '/' - switch ch { - case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"': - // nothing to do - case '0', '1', '2', '3', '4', '5', '6', '7': - // octal notation - ch = s.scanDigits(ch, 8, 3) - case 'x': - // hexademical notation - ch = s.scanDigits(s.next(), 16, 2) - case 'u': - // universal character name - ch = s.scanDigits(s.next(), 16, 4) - case 'U': - // universal character name - ch = s.scanDigits(s.next(), 16, 8) - default: - s.err("illegal char escape") - } - return ch -} - -// scanDigits scans a rune with the given base for n times. For example an -// octal notation \184 would yield in scanDigits(ch, 8, 3) -func (s *Scanner) scanDigits(ch rune, base, n int) rune { - start := n - for n > 0 && digitVal(ch) < base { - ch = s.next() - if ch == eof { - // If we see an EOF, we halt any more scanning of digits - // immediately. - break - } - - n-- - } - if n > 0 { - s.err("illegal char escape") - } - - if n != start { - // we scanned all digits, put the last non digit char back, - // only if we read anything at all - s.unread() - } - - return ch -} - -// scanIdentifier scans an identifier and returns the literal string -func (s *Scanner) scanIdentifier() string { - offs := s.srcPos.Offset - s.lastCharLen - ch := s.next() - for isLetter(ch) || isDigit(ch) || ch == '-' || ch == '.' { - ch = s.next() - } - - if ch != eof { - s.unread() // we got identifier, put back latest char - } - - return string(s.src[offs:s.srcPos.Offset]) -} - -// recentPosition returns the position of the character immediately after the -// character or token returned by the last call to Scan. -func (s *Scanner) recentPosition() (pos token.Pos) { - pos.Offset = s.srcPos.Offset - s.lastCharLen - switch { - case s.srcPos.Column > 0: - // common case: last character was not a '\n' - pos.Line = s.srcPos.Line - pos.Column = s.srcPos.Column - case s.lastLineLen > 0: - // last character was a '\n' - // (we cannot be at the beginning of the source - // since we have called next() at least once) - pos.Line = s.srcPos.Line - 1 - pos.Column = s.lastLineLen - default: - // at the beginning of the source - pos.Line = 1 - pos.Column = 1 - } - return -} - -// err prints the error of any scanning to s.Error function. If the function is -// not defined, by default it prints them to os.Stderr -func (s *Scanner) err(msg string) { - s.ErrorCount++ - pos := s.recentPosition() - - if s.Error != nil { - s.Error(pos, msg) - return - } - - fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg) -} - -// isHexadecimal returns true if the given rune is a letter -func isLetter(ch rune) bool { - return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch) -} - -// isDigit returns true if the given rune is a decimal digit -func isDigit(ch rune) bool { - return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch) -} - -// isDecimal returns true if the given rune is a decimal number -func isDecimal(ch rune) bool { - return '0' <= ch && ch <= '9' -} - -// isHexadecimal returns true if the given rune is an hexadecimal number -func isHexadecimal(ch rune) bool { - return '0' <= ch && ch <= '9' || 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F' -} - -// isWhitespace returns true if the rune is a space, tab, newline or carriage return -func isWhitespace(ch rune) bool { - return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' -} - -// digitVal returns the integer value of a given octal,decimal or hexadecimal rune -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch - '0') - case 'a' <= ch && ch <= 'f': - return int(ch - 'a' + 10) - case 'A' <= ch && ch <= 'F': - return int(ch - 'A' + 10) - } - return 16 // larger than any legal digit val -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go deleted file mode 100644 index 4f2c9cb..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/scanner/scanner_test.go +++ /dev/null @@ -1,591 +0,0 @@ -package scanner - -import ( - "bytes" - "fmt" - "testing" - - "strings" - - "github.com/hashicorp/hcl/hcl/token" -) - -var f100 = strings.Repeat("f", 100) - -type tokenPair struct { - tok token.Type - text string -} - -var tokenLists = map[string][]tokenPair{ - "comment": []tokenPair{ - {token.COMMENT, "//"}, - {token.COMMENT, "////"}, - {token.COMMENT, "// comment"}, - {token.COMMENT, "// /* comment */"}, - {token.COMMENT, "// // comment //"}, - {token.COMMENT, "//" + f100}, - {token.COMMENT, "#"}, - {token.COMMENT, "##"}, - {token.COMMENT, "# comment"}, - {token.COMMENT, "# /* comment */"}, - {token.COMMENT, "# # comment #"}, - {token.COMMENT, "#" + f100}, - {token.COMMENT, "/**/"}, - {token.COMMENT, "/***/"}, - {token.COMMENT, "/* comment */"}, - {token.COMMENT, "/* // comment */"}, - {token.COMMENT, "/* /* comment */"}, - {token.COMMENT, "/*\n comment\n*/"}, - {token.COMMENT, "/*" + f100 + "*/"}, - }, - "operator": []tokenPair{ - {token.LBRACK, "["}, - {token.LBRACE, "{"}, - {token.COMMA, ","}, - {token.PERIOD, "."}, - {token.RBRACK, "]"}, - {token.RBRACE, "}"}, - {token.ASSIGN, "="}, - {token.ADD, "+"}, - {token.SUB, "-"}, - }, - "bool": []tokenPair{ - {token.BOOL, "true"}, - {token.BOOL, "false"}, - }, - "ident": []tokenPair{ - {token.IDENT, "a"}, - {token.IDENT, "a0"}, - {token.IDENT, "foobar"}, - {token.IDENT, "foo-bar"}, - {token.IDENT, "abc123"}, - {token.IDENT, "LGTM"}, - {token.IDENT, "_"}, - {token.IDENT, "_abc123"}, - {token.IDENT, "abc123_"}, - {token.IDENT, "_abc_123_"}, - {token.IDENT, "_äöü"}, - {token.IDENT, "_本"}, - {token.IDENT, "äöü"}, - {token.IDENT, "本"}, - {token.IDENT, "a۰۱۸"}, - {token.IDENT, "foo६४"}, - {token.IDENT, "bar9876"}, - }, - "heredoc": []tokenPair{ - {token.HEREDOC, "< 0 for %q", s.ErrorCount, src) - } -} - -func testTokenList(t *testing.T, tokenList []tokenPair) { - // create artifical source code - buf := new(bytes.Buffer) - for _, ident := range tokenList { - fmt.Fprintf(buf, "%s\n", ident.text) - } - - s := New(buf.Bytes()) - for _, ident := range tokenList { - tok := s.Scan() - if tok.Type != ident.tok { - t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text) - } - - if tok.Text != ident.text { - t.Errorf("text = %q want %q", tok.String(), ident.text) - } - - } -} - -func countNewlines(s string) int { - n := 0 - for _, ch := range s { - if ch == '\n' { - n++ - } - } - return n -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go deleted file mode 100644 index 5f981ea..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote.go +++ /dev/null @@ -1,241 +0,0 @@ -package strconv - -import ( - "errors" - "unicode/utf8" -) - -// ErrSyntax indicates that a value does not have the right syntax for the target type. -var ErrSyntax = errors.New("invalid syntax") - -// Unquote interprets s as a single-quoted, double-quoted, -// or backquoted Go string literal, returning the string value -// that s quotes. (If s is single-quoted, it would be a Go -// character literal; Unquote returns the corresponding -// one-character string.) -func Unquote(s string) (t string, err error) { - n := len(s) - if n < 2 { - return "", ErrSyntax - } - quote := s[0] - if quote != s[n-1] { - return "", ErrSyntax - } - s = s[1 : n-1] - - if quote != '"' { - return "", ErrSyntax - } - if !contains(s, '$') && !contains(s, '{') && contains(s, '\n') { - return "", ErrSyntax - } - - // Is it trivial? Avoid allocation. - if !contains(s, '\\') && !contains(s, quote) && !contains(s, '$') { - switch quote { - case '"': - return s, nil - case '\'': - r, size := utf8.DecodeRuneInString(s) - if size == len(s) && (r != utf8.RuneError || size != 1) { - return s, nil - } - } - } - - var runeTmp [utf8.UTFMax]byte - buf := make([]byte, 0, 3*len(s)/2) // Try to avoid more allocations. - for len(s) > 0 { - // If we're starting a '${}' then let it through un-unquoted. - // Specifically: we don't unquote any characters within the `${}` - // section. - if s[0] == '$' && len(s) > 1 && s[1] == '{' { - buf = append(buf, '$', '{') - s = s[2:] - - // Continue reading until we find the closing brace, copying as-is - braces := 1 - for len(s) > 0 && braces > 0 { - r, size := utf8.DecodeRuneInString(s) - if r == utf8.RuneError { - return "", ErrSyntax - } - - s = s[size:] - - n := utf8.EncodeRune(runeTmp[:], r) - buf = append(buf, runeTmp[:n]...) - - switch r { - case '{': - braces++ - case '}': - braces-- - } - } - if braces != 0 { - return "", ErrSyntax - } - if len(s) == 0 { - // If there's no string left, we're done! - break - } else { - // If there's more left, we need to pop back up to the top of the loop - // in case there's another interpolation in this string. - continue - } - } - - if s[0] == '\n' { - return "", ErrSyntax - } - - c, multibyte, ss, err := unquoteChar(s, quote) - if err != nil { - return "", err - } - s = ss - if c < utf8.RuneSelf || !multibyte { - buf = append(buf, byte(c)) - } else { - n := utf8.EncodeRune(runeTmp[:], c) - buf = append(buf, runeTmp[:n]...) - } - if quote == '\'' && len(s) != 0 { - // single-quoted must be single character - return "", ErrSyntax - } - } - return string(buf), nil -} - -// contains reports whether the string contains the byte c. -func contains(s string, c byte) bool { - for i := 0; i < len(s); i++ { - if s[i] == c { - return true - } - } - return false -} - -func unhex(b byte) (v rune, ok bool) { - c := rune(b) - switch { - case '0' <= c && c <= '9': - return c - '0', true - case 'a' <= c && c <= 'f': - return c - 'a' + 10, true - case 'A' <= c && c <= 'F': - return c - 'A' + 10, true - } - return -} - -func unquoteChar(s string, quote byte) (value rune, multibyte bool, tail string, err error) { - // easy cases - switch c := s[0]; { - case c == quote && (quote == '\'' || quote == '"'): - err = ErrSyntax - return - case c >= utf8.RuneSelf: - r, size := utf8.DecodeRuneInString(s) - return r, true, s[size:], nil - case c != '\\': - return rune(s[0]), false, s[1:], nil - } - - // hard case: c is backslash - if len(s) <= 1 { - err = ErrSyntax - return - } - c := s[1] - s = s[2:] - - switch c { - case 'a': - value = '\a' - case 'b': - value = '\b' - case 'f': - value = '\f' - case 'n': - value = '\n' - case 'r': - value = '\r' - case 't': - value = '\t' - case 'v': - value = '\v' - case 'x', 'u', 'U': - n := 0 - switch c { - case 'x': - n = 2 - case 'u': - n = 4 - case 'U': - n = 8 - } - var v rune - if len(s) < n { - err = ErrSyntax - return - } - for j := 0; j < n; j++ { - x, ok := unhex(s[j]) - if !ok { - err = ErrSyntax - return - } - v = v<<4 | x - } - s = s[n:] - if c == 'x' { - // single-byte string, possibly not UTF-8 - value = v - break - } - if v > utf8.MaxRune { - err = ErrSyntax - return - } - value = v - multibyte = true - case '0', '1', '2', '3', '4', '5', '6', '7': - v := rune(c) - '0' - if len(s) < 2 { - err = ErrSyntax - return - } - for j := 0; j < 2; j++ { // one digit already; two more - x := rune(s[j]) - '0' - if x < 0 || x > 7 { - err = ErrSyntax - return - } - v = (v << 3) | x - } - s = s[2:] - if v > 255 { - err = ErrSyntax - return - } - value = v - case '\\': - value = '\\' - case '\'', '"': - if c != quote { - err = ErrSyntax - return - } - value = rune(c) - default: - err = ErrSyntax - return - } - tail = s - return -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go b/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go deleted file mode 100644 index 65be375..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/strconv/quote_test.go +++ /dev/null @@ -1,96 +0,0 @@ -package strconv - -import "testing" - -type quoteTest struct { - in string - out string - ascii string -} - -var quotetests = []quoteTest{ - {"\a\b\f\r\n\t\v", `"\a\b\f\r\n\t\v"`, `"\a\b\f\r\n\t\v"`}, - {"\\", `"\\"`, `"\\"`}, - {"abc\xffdef", `"abc\xffdef"`, `"abc\xffdef"`}, - {"\u263a", `"☺"`, `"\u263a"`}, - {"\U0010ffff", `"\U0010ffff"`, `"\U0010ffff"`}, - {"\x04", `"\x04"`, `"\x04"`}, -} - -type unQuoteTest struct { - in string - out string -} - -var unquotetests = []unQuoteTest{ - {`""`, ""}, - {`"a"`, "a"}, - {`"abc"`, "abc"}, - {`"☺"`, "☺"}, - {`"hello world"`, "hello world"}, - {`"\xFF"`, "\xFF"}, - {`"\377"`, "\377"}, - {`"\u1234"`, "\u1234"}, - {`"\U00010111"`, "\U00010111"}, - {`"\U0001011111"`, "\U0001011111"}, - {`"\a\b\f\n\r\t\v\\\""`, "\a\b\f\n\r\t\v\\\""}, - {`"'"`, "'"}, - {`"${file("foo")}"`, `${file("foo")}`}, - {`"${file("\"foo\"")}"`, `${file("\"foo\"")}`}, - {`"echo ${var.region}${element(split(",",var.zones),0)}"`, - `echo ${var.region}${element(split(",",var.zones),0)}`}, - {`"${HH\\:mm\\:ss}"`, `${HH\\:mm\\:ss}`}, - {`"${\n}"`, `${\n}`}, -} - -var misquoted = []string{ - ``, - `"`, - `"a`, - `"'`, - `b"`, - `"\"`, - `"\9"`, - `"\19"`, - `"\129"`, - `'\'`, - `'\9'`, - `'\19'`, - `'\129'`, - `'ab'`, - `"\x1!"`, - `"\U12345678"`, - `"\z"`, - "`", - "`xxx", - "`\"", - `"\'"`, - `'\"'`, - "\"\n\"", - "\"\\n\n\"", - "'\n'", - `"${"`, - `"${foo{}"`, - "\"${foo}\n\"", -} - -func TestUnquote(t *testing.T) { - for _, tt := range unquotetests { - if out, err := Unquote(tt.in); err != nil || out != tt.out { - t.Errorf("Unquote(%#q) = %q, %v want %q, nil", tt.in, out, err, tt.out) - } - } - - // run the quote tests too, backward - for _, tt := range quotetests { - if in, err := Unquote(tt.out); in != tt.in { - t.Errorf("Unquote(%#q) = %q, %v, want %q, nil", tt.out, in, err, tt.in) - } - } - - for _, s := range misquoted { - if out, err := Unquote(s); out != "" || err != ErrSyntax { - t.Errorf("Unquote(%#q) = %q, %v want %q, %v", s, out, err, "", ErrSyntax) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/position.go b/vendor/github.com/hashicorp/hcl/hcl/token/position.go deleted file mode 100644 index 59c1bb7..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/token/position.go +++ /dev/null @@ -1,46 +0,0 @@ -package token - -import "fmt" - -// Pos describes an arbitrary source position -// including the file, line, and column location. -// A Position is valid if the line number is > 0. -type Pos struct { - Filename string // filename, if any - Offset int // offset, starting at 0 - Line int // line number, starting at 1 - Column int // column number, starting at 1 (character count) -} - -// IsValid returns true if the position is valid. -func (p *Pos) IsValid() bool { return p.Line > 0 } - -// String returns a string in one of several forms: -// -// file:line:column valid position with file name -// line:column valid position without file name -// file invalid position with file name -// - invalid position without file name -func (p Pos) String() string { - s := p.Filename - if p.IsValid() { - if s != "" { - s += ":" - } - s += fmt.Sprintf("%d:%d", p.Line, p.Column) - } - if s == "" { - s = "-" - } - return s -} - -// Before reports whether the position p is before u. -func (p Pos) Before(u Pos) bool { - return u.Offset > p.Offset || u.Line > p.Line -} - -// After reports whether the position p is after u. -func (p Pos) After(u Pos) bool { - return u.Offset < p.Offset || u.Line < p.Line -} diff --git a/vendor/github.com/hashicorp/hcl/hcl/token/token.go b/vendor/github.com/hashicorp/hcl/hcl/token/token.go deleted file mode 100644 index e37c066..0000000 --- a/vendor/github.com/hashicorp/hcl/hcl/token/token.go +++ /dev/null @@ -1,219 +0,0 @@ -// Package token defines constants representing the lexical tokens for HCL -// (HashiCorp Configuration Language) -package token - -import ( - "fmt" - "strconv" - "strings" - - hclstrconv "github.com/hashicorp/hcl/hcl/strconv" -) - -// Token defines a single HCL token which can be obtained via the Scanner -type Token struct { - Type Type - Pos Pos - Text string - JSON bool -} - -// Type is the set of lexical tokens of the HCL (HashiCorp Configuration Language) -type Type int - -const ( - // Special tokens - ILLEGAL Type = iota - EOF - COMMENT - - identifier_beg - IDENT // literals - literal_beg - NUMBER // 12345 - FLOAT // 123.45 - BOOL // true,false - STRING // "abc" - HEREDOC // < 0 { - // Pop the current item - n := len(frontier) - item := frontier[n-1] - frontier = frontier[:n-1] - - switch v := item.Val.(type) { - case *ast.ObjectType: - items, frontier = flattenObjectType(v, item, items, frontier) - case *ast.ListType: - items, frontier = flattenListType(v, item, items, frontier) - default: - items = append(items, item) - } - } - - // Reverse the list since the frontier model runs things backwards - for i := len(items)/2 - 1; i >= 0; i-- { - opp := len(items) - 1 - i - items[i], items[opp] = items[opp], items[i] - } - - // Done! Set the original items - list.Items = items - return n, true - }) -} - -func flattenListType( - ot *ast.ListType, - item *ast.ObjectItem, - items []*ast.ObjectItem, - frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) { - // If the list is empty, keep the original list - if len(ot.List) == 0 { - items = append(items, item) - return items, frontier - } - - // All the elements of this object must also be objects! - for _, subitem := range ot.List { - if _, ok := subitem.(*ast.ObjectType); !ok { - items = append(items, item) - return items, frontier - } - } - - // Great! We have a match go through all the items and flatten - for _, elem := range ot.List { - // Add it to the frontier so that we can recurse - frontier = append(frontier, &ast.ObjectItem{ - Keys: item.Keys, - Assign: item.Assign, - Val: elem, - LeadComment: item.LeadComment, - LineComment: item.LineComment, - }) - } - - return items, frontier -} - -func flattenObjectType( - ot *ast.ObjectType, - item *ast.ObjectItem, - items []*ast.ObjectItem, - frontier []*ast.ObjectItem) ([]*ast.ObjectItem, []*ast.ObjectItem) { - // If the list has no items we do not have to flatten anything - if ot.List.Items == nil { - items = append(items, item) - return items, frontier - } - - // All the elements of this object must also be objects! - for _, subitem := range ot.List.Items { - if _, ok := subitem.Val.(*ast.ObjectType); !ok { - items = append(items, item) - return items, frontier - } - } - - // Great! We have a match go through all the items and flatten - for _, subitem := range ot.List.Items { - // Copy the new key - keys := make([]*ast.ObjectKey, len(item.Keys)+len(subitem.Keys)) - copy(keys, item.Keys) - copy(keys[len(item.Keys):], subitem.Keys) - - // Add it to the frontier so that we can recurse - frontier = append(frontier, &ast.ObjectItem{ - Keys: keys, - Assign: item.Assign, - Val: subitem.Val, - LeadComment: item.LeadComment, - LineComment: item.LineComment, - }) - } - - return items, frontier -} diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser.go b/vendor/github.com/hashicorp/hcl/json/parser/parser.go deleted file mode 100644 index 125a5f0..0000000 --- a/vendor/github.com/hashicorp/hcl/json/parser/parser.go +++ /dev/null @@ -1,313 +0,0 @@ -package parser - -import ( - "errors" - "fmt" - - "github.com/hashicorp/hcl/hcl/ast" - hcltoken "github.com/hashicorp/hcl/hcl/token" - "github.com/hashicorp/hcl/json/scanner" - "github.com/hashicorp/hcl/json/token" -) - -type Parser struct { - sc *scanner.Scanner - - // Last read token - tok token.Token - commaPrev token.Token - - enableTrace bool - indent int - n int // buffer size (max = 1) -} - -func newParser(src []byte) *Parser { - return &Parser{ - sc: scanner.New(src), - } -} - -// Parse returns the fully parsed source and returns the abstract syntax tree. -func Parse(src []byte) (*ast.File, error) { - p := newParser(src) - return p.Parse() -} - -var errEofToken = errors.New("EOF token found") - -// Parse returns the fully parsed source and returns the abstract syntax tree. -func (p *Parser) Parse() (*ast.File, error) { - f := &ast.File{} - var err, scerr error - p.sc.Error = func(pos token.Pos, msg string) { - scerr = fmt.Errorf("%s: %s", pos, msg) - } - - // The root must be an object in JSON - object, err := p.object() - if scerr != nil { - return nil, scerr - } - if err != nil { - return nil, err - } - - // We make our final node an object list so it is more HCL compatible - f.Node = object.List - - // Flatten it, which finds patterns and turns them into more HCL-like - // AST trees. - flattenObjects(f.Node) - - return f, nil -} - -func (p *Parser) objectList() (*ast.ObjectList, error) { - defer un(trace(p, "ParseObjectList")) - node := &ast.ObjectList{} - - for { - n, err := p.objectItem() - if err == errEofToken { - break // we are finished - } - - // we don't return a nil node, because might want to use already - // collected items. - if err != nil { - return node, err - } - - node.Add(n) - - // Check for a followup comma. If it isn't a comma, then we're done - if tok := p.scan(); tok.Type != token.COMMA { - break - } - } - - return node, nil -} - -// objectItem parses a single object item -func (p *Parser) objectItem() (*ast.ObjectItem, error) { - defer un(trace(p, "ParseObjectItem")) - - keys, err := p.objectKey() - if err != nil { - return nil, err - } - - o := &ast.ObjectItem{ - Keys: keys, - } - - switch p.tok.Type { - case token.COLON: - pos := p.tok.Pos - o.Assign = hcltoken.Pos{ - Filename: pos.Filename, - Offset: pos.Offset, - Line: pos.Line, - Column: pos.Column, - } - - o.Val, err = p.objectValue() - if err != nil { - return nil, err - } - } - - return o, nil -} - -// objectKey parses an object key and returns a ObjectKey AST -func (p *Parser) objectKey() ([]*ast.ObjectKey, error) { - keyCount := 0 - keys := make([]*ast.ObjectKey, 0) - - for { - tok := p.scan() - switch tok.Type { - case token.EOF: - return nil, errEofToken - case token.STRING: - keyCount++ - keys = append(keys, &ast.ObjectKey{ - Token: p.tok.HCLToken(), - }) - case token.COLON: - // If we have a zero keycount it means that we never got - // an object key, i.e. `{ :`. This is a syntax error. - if keyCount == 0 { - return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type) - } - - // Done - return keys, nil - case token.ILLEGAL: - return nil, errors.New("illegal") - default: - return nil, fmt.Errorf("expected: STRING got: %s", p.tok.Type) - } - } -} - -// object parses any type of object, such as number, bool, string, object or -// list. -func (p *Parser) objectValue() (ast.Node, error) { - defer un(trace(p, "ParseObjectValue")) - tok := p.scan() - - switch tok.Type { - case token.NUMBER, token.FLOAT, token.BOOL, token.NULL, token.STRING: - return p.literalType() - case token.LBRACE: - return p.objectType() - case token.LBRACK: - return p.listType() - case token.EOF: - return nil, errEofToken - } - - return nil, fmt.Errorf("Expected object value, got unknown token: %+v", tok) -} - -// object parses any type of object, such as number, bool, string, object or -// list. -func (p *Parser) object() (*ast.ObjectType, error) { - defer un(trace(p, "ParseType")) - tok := p.scan() - - switch tok.Type { - case token.LBRACE: - return p.objectType() - case token.EOF: - return nil, errEofToken - } - - return nil, fmt.Errorf("Expected object, got unknown token: %+v", tok) -} - -// objectType parses an object type and returns a ObjectType AST -func (p *Parser) objectType() (*ast.ObjectType, error) { - defer un(trace(p, "ParseObjectType")) - - // we assume that the currently scanned token is a LBRACE - o := &ast.ObjectType{} - - l, err := p.objectList() - - // if we hit RBRACE, we are good to go (means we parsed all Items), if it's - // not a RBRACE, it's an syntax error and we just return it. - if err != nil && p.tok.Type != token.RBRACE { - return nil, err - } - - o.List = l - return o, nil -} - -// listType parses a list type and returns a ListType AST -func (p *Parser) listType() (*ast.ListType, error) { - defer un(trace(p, "ParseListType")) - - // we assume that the currently scanned token is a LBRACK - l := &ast.ListType{} - - for { - tok := p.scan() - switch tok.Type { - case token.NUMBER, token.FLOAT, token.STRING: - node, err := p.literalType() - if err != nil { - return nil, err - } - - l.Add(node) - case token.COMMA: - continue - case token.LBRACE: - node, err := p.objectType() - if err != nil { - return nil, err - } - - l.Add(node) - case token.BOOL: - // TODO(arslan) should we support? not supported by HCL yet - case token.LBRACK: - // TODO(arslan) should we support nested lists? Even though it's - // written in README of HCL, it's not a part of the grammar - // (not defined in parse.y) - case token.RBRACK: - // finished - return l, nil - default: - return nil, fmt.Errorf("unexpected token while parsing list: %s", tok.Type) - } - - } -} - -// literalType parses a literal type and returns a LiteralType AST -func (p *Parser) literalType() (*ast.LiteralType, error) { - defer un(trace(p, "ParseLiteral")) - - return &ast.LiteralType{ - Token: p.tok.HCLToken(), - }, nil -} - -// scan returns the next token from the underlying scanner. If a token has -// been unscanned then read that instead. -func (p *Parser) scan() token.Token { - // If we have a token on the buffer, then return it. - if p.n != 0 { - p.n = 0 - return p.tok - } - - p.tok = p.sc.Scan() - return p.tok -} - -// unscan pushes the previously read token back onto the buffer. -func (p *Parser) unscan() { - p.n = 1 -} - -// ---------------------------------------------------------------------------- -// Parsing support - -func (p *Parser) printTrace(a ...interface{}) { - if !p.enableTrace { - return - } - - const dots = ". . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . " - const n = len(dots) - fmt.Printf("%5d:%3d: ", p.tok.Pos.Line, p.tok.Pos.Column) - - i := 2 * p.indent - for i > n { - fmt.Print(dots) - i -= n - } - // i <= n - fmt.Print(dots[0:i]) - fmt.Println(a...) -} - -func trace(p *Parser, msg string) *Parser { - p.printTrace(msg, "(") - p.indent++ - return p -} - -// Usage pattern: defer un(trace(p, "...")) -func un(p *Parser) { - p.indent-- - p.printTrace(")") -} diff --git a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go b/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go deleted file mode 100644 index e0cebf5..0000000 --- a/vendor/github.com/hashicorp/hcl/json/parser/parser_test.go +++ /dev/null @@ -1,384 +0,0 @@ -package parser - -import ( - "fmt" - "io/ioutil" - "path/filepath" - "reflect" - "runtime" - "testing" - - "github.com/hashicorp/hcl/hcl/ast" - "github.com/hashicorp/hcl/hcl/token" -) - -func TestType(t *testing.T) { - var literals = []struct { - typ token.Type - src string - }{ - {token.STRING, `"foo": "bar"`}, - {token.NUMBER, `"foo": 123`}, - {token.FLOAT, `"foo": 123.12`}, - {token.FLOAT, `"foo": -123.12`}, - {token.BOOL, `"foo": true`}, - {token.STRING, `"foo": null`}, - } - - for _, l := range literals { - t.Logf("Testing: %s", l.src) - - p := newParser([]byte(l.src)) - item, err := p.objectItem() - if err != nil { - t.Error(err) - } - - lit, ok := item.Val.(*ast.LiteralType) - if !ok { - t.Errorf("node should be of type LiteralType, got: %T", item.Val) - } - - if lit.Token.Type != l.typ { - t.Errorf("want: %s, got: %s", l.typ, lit.Token.Type) - } - } -} - -func TestListType(t *testing.T) { - var literals = []struct { - src string - tokens []token.Type - }{ - { - `"foo": ["123", 123]`, - []token.Type{token.STRING, token.NUMBER}, - }, - { - `"foo": [123, "123",]`, - []token.Type{token.NUMBER, token.STRING}, - }, - { - `"foo": []`, - []token.Type{}, - }, - { - `"foo": ["123", 123]`, - []token.Type{token.STRING, token.NUMBER}, - }, - { - `"foo": ["123", {}]`, - []token.Type{token.STRING, token.LBRACE}, - }, - } - - for _, l := range literals { - t.Logf("Testing: %s", l.src) - - p := newParser([]byte(l.src)) - item, err := p.objectItem() - if err != nil { - t.Error(err) - } - - list, ok := item.Val.(*ast.ListType) - if !ok { - t.Errorf("node should be of type LiteralType, got: %T", item.Val) - } - - tokens := []token.Type{} - for _, li := range list.List { - switch v := li.(type) { - case *ast.LiteralType: - tokens = append(tokens, v.Token.Type) - case *ast.ObjectType: - tokens = append(tokens, token.LBRACE) - } - } - - equals(t, l.tokens, tokens) - } -} - -func TestObjectType(t *testing.T) { - var literals = []struct { - src string - nodeType []ast.Node - itemLen int - }{ - { - `"foo": {}`, - nil, - 0, - }, - { - `"foo": { - "bar": "fatih" - }`, - []ast.Node{&ast.LiteralType{}}, - 1, - }, - { - `"foo": { - "bar": "fatih", - "baz": ["arslan"] - }`, - []ast.Node{ - &ast.LiteralType{}, - &ast.ListType{}, - }, - 2, - }, - { - `"foo": { - "bar": {} - }`, - []ast.Node{ - &ast.ObjectType{}, - }, - 1, - }, - { - `"foo": { - "bar": {}, - "foo": true - }`, - []ast.Node{ - &ast.ObjectType{}, - &ast.LiteralType{}, - }, - 2, - }, - } - - for _, l := range literals { - t.Logf("Testing:\n%s\n", l.src) - - p := newParser([]byte(l.src)) - // p.enableTrace = true - item, err := p.objectItem() - if err != nil { - t.Error(err) - } - - // we know that the ObjectKey name is foo for all cases, what matters - // is the object - obj, ok := item.Val.(*ast.ObjectType) - if !ok { - t.Errorf("node should be of type LiteralType, got: %T", item.Val) - } - - // check if the total length of items are correct - equals(t, l.itemLen, len(obj.List.Items)) - - // check if the types are correct - for i, item := range obj.List.Items { - equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val)) - } - } -} - -func TestFlattenObjects(t *testing.T) { - var literals = []struct { - src string - nodeType []ast.Node - itemLen int - }{ - { - `{ - "foo": [ - { - "foo": "svh", - "bar": "fatih" - } - ] - }`, - []ast.Node{ - &ast.ObjectType{}, - &ast.LiteralType{}, - &ast.LiteralType{}, - }, - 3, - }, - { - `{ - "variable": { - "foo": {} - } - }`, - []ast.Node{ - &ast.ObjectType{}, - }, - 1, - }, - { - `{ - "empty": [] - }`, - []ast.Node{ - &ast.ListType{}, - }, - 1, - }, - { - `{ - "basic": [1, 2, 3] - }`, - []ast.Node{ - &ast.ListType{}, - }, - 1, - }, - } - - for _, l := range literals { - t.Logf("Testing:\n%s\n", l.src) - - f, err := Parse([]byte(l.src)) - if err != nil { - t.Error(err) - } - - // the first object is always an ObjectList so just assert that one - // so we can use it as such - obj, ok := f.Node.(*ast.ObjectList) - if !ok { - t.Errorf("node should be *ast.ObjectList, got: %T", f.Node) - } - - // check if the types are correct - var i int - for _, item := range obj.Items { - equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val)) - i++ - - if obj, ok := item.Val.(*ast.ObjectType); ok { - for _, item := range obj.List.Items { - equals(t, reflect.TypeOf(l.nodeType[i]), reflect.TypeOf(item.Val)) - i++ - } - } - } - - // check if the number of items is correct - equals(t, l.itemLen, i) - - } -} - -func TestObjectKey(t *testing.T) { - keys := []struct { - exp []token.Type - src string - }{ - {[]token.Type{token.STRING}, `"foo": {}`}, - } - - for _, k := range keys { - p := newParser([]byte(k.src)) - keys, err := p.objectKey() - if err != nil { - t.Fatal(err) - } - - tokens := []token.Type{} - for _, o := range keys { - tokens = append(tokens, o.Token.Type) - } - - equals(t, k.exp, tokens) - } - - errKeys := []struct { - src string - }{ - {`foo 12 {}`}, - {`foo bar = {}`}, - {`foo []`}, - {`12 {}`}, - } - - for _, k := range errKeys { - p := newParser([]byte(k.src)) - _, err := p.objectKey() - if err == nil { - t.Errorf("case '%s' should give an error", k.src) - } - } -} - -// Official HCL tests -func TestParse(t *testing.T) { - cases := []struct { - Name string - Err bool - }{ - { - "array.json", - false, - }, - { - "basic.json", - false, - }, - { - "object.json", - false, - }, - { - "types.json", - false, - }, - { - "bad_input_128.json", - true, - }, - { - "bad_input_tf_8110.json", - true, - }, - { - "good_input_tf_8110.json", - false, - }, - } - - const fixtureDir = "./test-fixtures" - - for _, tc := range cases { - d, err := ioutil.ReadFile(filepath.Join(fixtureDir, tc.Name)) - if err != nil { - t.Fatalf("err: %s", err) - } - - _, err = Parse(d) - if (err != nil) != tc.Err { - t.Fatalf("Input: %s\n\nError: %s", tc.Name, err) - } - } -} - -func TestParse_inline(t *testing.T) { - cases := []struct { - Value string - Err bool - }{ - {"{:{", true}, - } - - for _, tc := range cases { - _, err := Parse([]byte(tc.Value)) - if (err != nil) != tc.Err { - t.Fatalf("Input: %q\n\nError: %s", tc.Value, err) - } - } -} - -// equals fails the test if exp is not equal to act. -func equals(tb testing.TB, exp, act interface{}) { - if !reflect.DeepEqual(exp, act) { - _, file, line, _ := runtime.Caller(1) - fmt.Printf("\033[31m%s:%d:\n\n\texp: %s\n\n\tgot: %s\033[39m\n\n", filepath.Base(file), line, exp, act) - tb.FailNow() - } -} diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go deleted file mode 100644 index fe3f0f0..0000000 --- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner.go +++ /dev/null @@ -1,451 +0,0 @@ -package scanner - -import ( - "bytes" - "fmt" - "os" - "unicode" - "unicode/utf8" - - "github.com/hashicorp/hcl/json/token" -) - -// eof represents a marker rune for the end of the reader. -const eof = rune(0) - -// Scanner defines a lexical scanner -type Scanner struct { - buf *bytes.Buffer // Source buffer for advancing and scanning - src []byte // Source buffer for immutable access - - // Source Position - srcPos token.Pos // current position - prevPos token.Pos // previous position, used for peek() method - - lastCharLen int // length of last character in bytes - lastLineLen int // length of last line in characters (for correct column reporting) - - tokStart int // token text start position - tokEnd int // token text end position - - // Error is called for each error encountered. If no Error - // function is set, the error is reported to os.Stderr. - Error func(pos token.Pos, msg string) - - // ErrorCount is incremented by one for each error encountered. - ErrorCount int - - // tokPos is the start position of most recently scanned token; set by - // Scan. The Filename field is always left untouched by the Scanner. If - // an error is reported (via Error) and Position is invalid, the scanner is - // not inside a token. - tokPos token.Pos -} - -// New creates and initializes a new instance of Scanner using src as -// its source content. -func New(src []byte) *Scanner { - // even though we accept a src, we read from a io.Reader compatible type - // (*bytes.Buffer). So in the future we might easily change it to streaming - // read. - b := bytes.NewBuffer(src) - s := &Scanner{ - buf: b, - src: src, - } - - // srcPosition always starts with 1 - s.srcPos.Line = 1 - return s -} - -// next reads the next rune from the bufferred reader. Returns the rune(0) if -// an error occurs (or io.EOF is returned). -func (s *Scanner) next() rune { - ch, size, err := s.buf.ReadRune() - if err != nil { - // advance for error reporting - s.srcPos.Column++ - s.srcPos.Offset += size - s.lastCharLen = size - return eof - } - - if ch == utf8.RuneError && size == 1 { - s.srcPos.Column++ - s.srcPos.Offset += size - s.lastCharLen = size - s.err("illegal UTF-8 encoding") - return ch - } - - // remember last position - s.prevPos = s.srcPos - - s.srcPos.Column++ - s.lastCharLen = size - s.srcPos.Offset += size - - if ch == '\n' { - s.srcPos.Line++ - s.lastLineLen = s.srcPos.Column - s.srcPos.Column = 0 - } - - // debug - // fmt.Printf("ch: %q, offset:column: %d:%d\n", ch, s.srcPos.Offset, s.srcPos.Column) - return ch -} - -// unread unreads the previous read Rune and updates the source position -func (s *Scanner) unread() { - if err := s.buf.UnreadRune(); err != nil { - panic(err) // this is user fault, we should catch it - } - s.srcPos = s.prevPos // put back last position -} - -// peek returns the next rune without advancing the reader. -func (s *Scanner) peek() rune { - peek, _, err := s.buf.ReadRune() - if err != nil { - return eof - } - - s.buf.UnreadRune() - return peek -} - -// Scan scans the next token and returns the token. -func (s *Scanner) Scan() token.Token { - ch := s.next() - - // skip white space - for isWhitespace(ch) { - ch = s.next() - } - - var tok token.Type - - // token text markings - s.tokStart = s.srcPos.Offset - s.lastCharLen - - // token position, initial next() is moving the offset by one(size of rune - // actually), though we are interested with the starting point - s.tokPos.Offset = s.srcPos.Offset - s.lastCharLen - if s.srcPos.Column > 0 { - // common case: last character was not a '\n' - s.tokPos.Line = s.srcPos.Line - s.tokPos.Column = s.srcPos.Column - } else { - // last character was a '\n' - // (we cannot be at the beginning of the source - // since we have called next() at least once) - s.tokPos.Line = s.srcPos.Line - 1 - s.tokPos.Column = s.lastLineLen - } - - switch { - case isLetter(ch): - lit := s.scanIdentifier() - if lit == "true" || lit == "false" { - tok = token.BOOL - } else if lit == "null" { - tok = token.NULL - } else { - s.err("illegal char") - } - case isDecimal(ch): - tok = s.scanNumber(ch) - default: - switch ch { - case eof: - tok = token.EOF - case '"': - tok = token.STRING - s.scanString() - case '.': - tok = token.PERIOD - ch = s.peek() - if isDecimal(ch) { - tok = token.FLOAT - ch = s.scanMantissa(ch) - ch = s.scanExponent(ch) - } - case '[': - tok = token.LBRACK - case ']': - tok = token.RBRACK - case '{': - tok = token.LBRACE - case '}': - tok = token.RBRACE - case ',': - tok = token.COMMA - case ':': - tok = token.COLON - case '-': - if isDecimal(s.peek()) { - ch := s.next() - tok = s.scanNumber(ch) - } else { - s.err("illegal char") - } - default: - s.err("illegal char: " + string(ch)) - } - } - - // finish token ending - s.tokEnd = s.srcPos.Offset - - // create token literal - var tokenText string - if s.tokStart >= 0 { - tokenText = string(s.src[s.tokStart:s.tokEnd]) - } - s.tokStart = s.tokEnd // ensure idempotency of tokenText() call - - return token.Token{ - Type: tok, - Pos: s.tokPos, - Text: tokenText, - } -} - -// scanNumber scans a HCL number definition starting with the given rune -func (s *Scanner) scanNumber(ch rune) token.Type { - zero := ch == '0' - pos := s.srcPos - - s.scanMantissa(ch) - ch = s.next() // seek forward - if ch == 'e' || ch == 'E' { - ch = s.scanExponent(ch) - return token.FLOAT - } - - if ch == '.' { - ch = s.scanFraction(ch) - if ch == 'e' || ch == 'E' { - ch = s.next() - ch = s.scanExponent(ch) - } - return token.FLOAT - } - - if ch != eof { - s.unread() - } - - // If we have a larger number and this is zero, error - if zero && pos != s.srcPos { - s.err("numbers cannot start with 0") - } - - return token.NUMBER -} - -// scanMantissa scans the mantissa beginning from the rune. It returns the next -// non decimal rune. It's used to determine wheter it's a fraction or exponent. -func (s *Scanner) scanMantissa(ch rune) rune { - scanned := false - for isDecimal(ch) { - ch = s.next() - scanned = true - } - - if scanned && ch != eof { - s.unread() - } - return ch -} - -// scanFraction scans the fraction after the '.' rune -func (s *Scanner) scanFraction(ch rune) rune { - if ch == '.' { - ch = s.peek() // we peek just to see if we can move forward - ch = s.scanMantissa(ch) - } - return ch -} - -// scanExponent scans the remaining parts of an exponent after the 'e' or 'E' -// rune. -func (s *Scanner) scanExponent(ch rune) rune { - if ch == 'e' || ch == 'E' { - ch = s.next() - if ch == '-' || ch == '+' { - ch = s.next() - } - ch = s.scanMantissa(ch) - } - return ch -} - -// scanString scans a quoted string -func (s *Scanner) scanString() { - braces := 0 - for { - // '"' opening already consumed - // read character after quote - ch := s.next() - - if ch == '\n' || ch < 0 || ch == eof { - s.err("literal not terminated") - return - } - - if ch == '"' { - break - } - - // If we're going into a ${} then we can ignore quotes for awhile - if braces == 0 && ch == '$' && s.peek() == '{' { - braces++ - s.next() - } else if braces > 0 && ch == '{' { - braces++ - } - if braces > 0 && ch == '}' { - braces-- - } - - if ch == '\\' { - s.scanEscape() - } - } - - return -} - -// scanEscape scans an escape sequence -func (s *Scanner) scanEscape() rune { - // http://en.cppreference.com/w/cpp/language/escape - ch := s.next() // read character after '/' - switch ch { - case 'a', 'b', 'f', 'n', 'r', 't', 'v', '\\', '"': - // nothing to do - case '0', '1', '2', '3', '4', '5', '6', '7': - // octal notation - ch = s.scanDigits(ch, 8, 3) - case 'x': - // hexademical notation - ch = s.scanDigits(s.next(), 16, 2) - case 'u': - // universal character name - ch = s.scanDigits(s.next(), 16, 4) - case 'U': - // universal character name - ch = s.scanDigits(s.next(), 16, 8) - default: - s.err("illegal char escape") - } - return ch -} - -// scanDigits scans a rune with the given base for n times. For example an -// octal notation \184 would yield in scanDigits(ch, 8, 3) -func (s *Scanner) scanDigits(ch rune, base, n int) rune { - for n > 0 && digitVal(ch) < base { - ch = s.next() - n-- - } - if n > 0 { - s.err("illegal char escape") - } - - // we scanned all digits, put the last non digit char back - s.unread() - return ch -} - -// scanIdentifier scans an identifier and returns the literal string -func (s *Scanner) scanIdentifier() string { - offs := s.srcPos.Offset - s.lastCharLen - ch := s.next() - for isLetter(ch) || isDigit(ch) || ch == '-' { - ch = s.next() - } - - if ch != eof { - s.unread() // we got identifier, put back latest char - } - - return string(s.src[offs:s.srcPos.Offset]) -} - -// recentPosition returns the position of the character immediately after the -// character or token returned by the last call to Scan. -func (s *Scanner) recentPosition() (pos token.Pos) { - pos.Offset = s.srcPos.Offset - s.lastCharLen - switch { - case s.srcPos.Column > 0: - // common case: last character was not a '\n' - pos.Line = s.srcPos.Line - pos.Column = s.srcPos.Column - case s.lastLineLen > 0: - // last character was a '\n' - // (we cannot be at the beginning of the source - // since we have called next() at least once) - pos.Line = s.srcPos.Line - 1 - pos.Column = s.lastLineLen - default: - // at the beginning of the source - pos.Line = 1 - pos.Column = 1 - } - return -} - -// err prints the error of any scanning to s.Error function. If the function is -// not defined, by default it prints them to os.Stderr -func (s *Scanner) err(msg string) { - s.ErrorCount++ - pos := s.recentPosition() - - if s.Error != nil { - s.Error(pos, msg) - return - } - - fmt.Fprintf(os.Stderr, "%s: %s\n", pos, msg) -} - -// isHexadecimal returns true if the given rune is a letter -func isLetter(ch rune) bool { - return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= 0x80 && unicode.IsLetter(ch) -} - -// isHexadecimal returns true if the given rune is a decimal digit -func isDigit(ch rune) bool { - return '0' <= ch && ch <= '9' || ch >= 0x80 && unicode.IsDigit(ch) -} - -// isHexadecimal returns true if the given rune is a decimal number -func isDecimal(ch rune) bool { - return '0' <= ch && ch <= '9' -} - -// isHexadecimal returns true if the given rune is an hexadecimal number -func isHexadecimal(ch rune) bool { - return '0' <= ch && ch <= '9' || 'a' <= ch && ch <= 'f' || 'A' <= ch && ch <= 'F' -} - -// isWhitespace returns true if the rune is a space, tab, newline or carriage return -func isWhitespace(ch rune) bool { - return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' -} - -// digitVal returns the integer value of a given octal,decimal or hexadecimal rune -func digitVal(ch rune) int { - switch { - case '0' <= ch && ch <= '9': - return int(ch - '0') - case 'a' <= ch && ch <= 'f': - return int(ch - 'a' + 10) - case 'A' <= ch && ch <= 'F': - return int(ch - 'A' + 10) - } - return 16 // larger than any legal digit val -} diff --git a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go b/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go deleted file mode 100644 index 3033a57..0000000 --- a/vendor/github.com/hashicorp/hcl/json/scanner/scanner_test.go +++ /dev/null @@ -1,362 +0,0 @@ -package scanner - -import ( - "bytes" - "fmt" - "testing" - - "github.com/hashicorp/hcl/json/token" -) - -var f100 = "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" - -type tokenPair struct { - tok token.Type - text string -} - -var tokenLists = map[string][]tokenPair{ - "operator": []tokenPair{ - {token.LBRACK, "["}, - {token.LBRACE, "{"}, - {token.COMMA, ","}, - {token.PERIOD, "."}, - {token.RBRACK, "]"}, - {token.RBRACE, "}"}, - }, - "bool": []tokenPair{ - {token.BOOL, "true"}, - {token.BOOL, "false"}, - }, - "string": []tokenPair{ - {token.STRING, `" "`}, - {token.STRING, `"a"`}, - {token.STRING, `"本"`}, - {token.STRING, `"${file(\"foo\")}"`}, - {token.STRING, `"\a"`}, - {token.STRING, `"\b"`}, - {token.STRING, `"\f"`}, - {token.STRING, `"\n"`}, - {token.STRING, `"\r"`}, - {token.STRING, `"\t"`}, - {token.STRING, `"\v"`}, - {token.STRING, `"\""`}, - {token.STRING, `"\000"`}, - {token.STRING, `"\777"`}, - {token.STRING, `"\x00"`}, - {token.STRING, `"\xff"`}, - {token.STRING, `"\u0000"`}, - {token.STRING, `"\ufA16"`}, - {token.STRING, `"\U00000000"`}, - {token.STRING, `"\U0000ffAB"`}, - {token.STRING, `"` + f100 + `"`}, - }, - "number": []tokenPair{ - {token.NUMBER, "0"}, - {token.NUMBER, "1"}, - {token.NUMBER, "9"}, - {token.NUMBER, "42"}, - {token.NUMBER, "1234567890"}, - {token.NUMBER, "-0"}, - {token.NUMBER, "-1"}, - {token.NUMBER, "-9"}, - {token.NUMBER, "-42"}, - {token.NUMBER, "-1234567890"}, - }, - "float": []tokenPair{ - {token.FLOAT, "0."}, - {token.FLOAT, "1."}, - {token.FLOAT, "42."}, - {token.FLOAT, "01234567890."}, - {token.FLOAT, ".0"}, - {token.FLOAT, ".1"}, - {token.FLOAT, ".42"}, - {token.FLOAT, ".0123456789"}, - {token.FLOAT, "0.0"}, - {token.FLOAT, "1.0"}, - {token.FLOAT, "42.0"}, - {token.FLOAT, "01234567890.0"}, - {token.FLOAT, "0e0"}, - {token.FLOAT, "1e0"}, - {token.FLOAT, "42e0"}, - {token.FLOAT, "01234567890e0"}, - {token.FLOAT, "0E0"}, - {token.FLOAT, "1E0"}, - {token.FLOAT, "42E0"}, - {token.FLOAT, "01234567890E0"}, - {token.FLOAT, "0e+10"}, - {token.FLOAT, "1e-10"}, - {token.FLOAT, "42e+10"}, - {token.FLOAT, "01234567890e-10"}, - {token.FLOAT, "0E+10"}, - {token.FLOAT, "1E-10"}, - {token.FLOAT, "42E+10"}, - {token.FLOAT, "01234567890E-10"}, - {token.FLOAT, "01.8e0"}, - {token.FLOAT, "1.4e0"}, - {token.FLOAT, "42.2e0"}, - {token.FLOAT, "01234567890.12e0"}, - {token.FLOAT, "0.E0"}, - {token.FLOAT, "1.12E0"}, - {token.FLOAT, "42.123E0"}, - {token.FLOAT, "01234567890.213E0"}, - {token.FLOAT, "0.2e+10"}, - {token.FLOAT, "1.2e-10"}, - {token.FLOAT, "42.54e+10"}, - {token.FLOAT, "01234567890.98e-10"}, - {token.FLOAT, "0.1E+10"}, - {token.FLOAT, "1.1E-10"}, - {token.FLOAT, "42.1E+10"}, - {token.FLOAT, "01234567890.1E-10"}, - {token.FLOAT, "-0.0"}, - {token.FLOAT, "-1.0"}, - {token.FLOAT, "-42.0"}, - {token.FLOAT, "-01234567890.0"}, - {token.FLOAT, "-0e0"}, - {token.FLOAT, "-1e0"}, - {token.FLOAT, "-42e0"}, - {token.FLOAT, "-01234567890e0"}, - {token.FLOAT, "-0E0"}, - {token.FLOAT, "-1E0"}, - {token.FLOAT, "-42E0"}, - {token.FLOAT, "-01234567890E0"}, - {token.FLOAT, "-0e+10"}, - {token.FLOAT, "-1e-10"}, - {token.FLOAT, "-42e+10"}, - {token.FLOAT, "-01234567890e-10"}, - {token.FLOAT, "-0E+10"}, - {token.FLOAT, "-1E-10"}, - {token.FLOAT, "-42E+10"}, - {token.FLOAT, "-01234567890E-10"}, - {token.FLOAT, "-01.8e0"}, - {token.FLOAT, "-1.4e0"}, - {token.FLOAT, "-42.2e0"}, - {token.FLOAT, "-01234567890.12e0"}, - {token.FLOAT, "-0.E0"}, - {token.FLOAT, "-1.12E0"}, - {token.FLOAT, "-42.123E0"}, - {token.FLOAT, "-01234567890.213E0"}, - {token.FLOAT, "-0.2e+10"}, - {token.FLOAT, "-1.2e-10"}, - {token.FLOAT, "-42.54e+10"}, - {token.FLOAT, "-01234567890.98e-10"}, - {token.FLOAT, "-0.1E+10"}, - {token.FLOAT, "-1.1E-10"}, - {token.FLOAT, "-42.1E+10"}, - {token.FLOAT, "-01234567890.1E-10"}, - }, -} - -var orderedTokenLists = []string{ - "comment", - "operator", - "bool", - "string", - "number", - "float", -} - -func TestPosition(t *testing.T) { - // create artifical source code - buf := new(bytes.Buffer) - - for _, listName := range orderedTokenLists { - for _, ident := range tokenLists[listName] { - fmt.Fprintf(buf, "\t\t\t\t%s\n", ident.text) - } - } - - s := New(buf.Bytes()) - - pos := token.Pos{"", 4, 1, 5} - s.Scan() - for _, listName := range orderedTokenLists { - - for _, k := range tokenLists[listName] { - curPos := s.tokPos - // fmt.Printf("[%q] s = %+v:%+v\n", k.text, curPos.Offset, curPos.Column) - - if curPos.Offset != pos.Offset { - t.Fatalf("offset = %d, want %d for %q", curPos.Offset, pos.Offset, k.text) - } - if curPos.Line != pos.Line { - t.Fatalf("line = %d, want %d for %q", curPos.Line, pos.Line, k.text) - } - if curPos.Column != pos.Column { - t.Fatalf("column = %d, want %d for %q", curPos.Column, pos.Column, k.text) - } - pos.Offset += 4 + len(k.text) + 1 // 4 tabs + token bytes + newline - pos.Line += countNewlines(k.text) + 1 // each token is on a new line - - s.Error = func(pos token.Pos, msg string) { - t.Errorf("error %q for %q", msg, k.text) - } - - s.Scan() - } - } - // make sure there were no token-internal errors reported by scanner - if s.ErrorCount != 0 { - t.Errorf("%d errors", s.ErrorCount) - } -} - -func TestComment(t *testing.T) { - testTokenList(t, tokenLists["comment"]) -} - -func TestOperator(t *testing.T) { - testTokenList(t, tokenLists["operator"]) -} - -func TestBool(t *testing.T) { - testTokenList(t, tokenLists["bool"]) -} - -func TestIdent(t *testing.T) { - testTokenList(t, tokenLists["ident"]) -} - -func TestString(t *testing.T) { - testTokenList(t, tokenLists["string"]) -} - -func TestNumber(t *testing.T) { - testTokenList(t, tokenLists["number"]) -} - -func TestFloat(t *testing.T) { - testTokenList(t, tokenLists["float"]) -} - -func TestRealExample(t *testing.T) { - complexReal := ` -{ - "variable": { - "foo": { - "default": "bar", - "description": "bar", - "depends_on": ["something"] - } - } -}` - - literals := []struct { - tokenType token.Type - literal string - }{ - {token.LBRACE, `{`}, - {token.STRING, `"variable"`}, - {token.COLON, `:`}, - {token.LBRACE, `{`}, - {token.STRING, `"foo"`}, - {token.COLON, `:`}, - {token.LBRACE, `{`}, - {token.STRING, `"default"`}, - {token.COLON, `:`}, - {token.STRING, `"bar"`}, - {token.COMMA, `,`}, - {token.STRING, `"description"`}, - {token.COLON, `:`}, - {token.STRING, `"bar"`}, - {token.COMMA, `,`}, - {token.STRING, `"depends_on"`}, - {token.COLON, `:`}, - {token.LBRACK, `[`}, - {token.STRING, `"something"`}, - {token.RBRACK, `]`}, - {token.RBRACE, `}`}, - {token.RBRACE, `}`}, - {token.RBRACE, `}`}, - {token.EOF, ``}, - } - - s := New([]byte(complexReal)) - for _, l := range literals { - tok := s.Scan() - if l.tokenType != tok.Type { - t.Errorf("got: %s want %s for %s\n", tok, l.tokenType, tok.String()) - } - - if l.literal != tok.Text { - t.Errorf("got: %s want %s\n", tok, l.literal) - } - } - -} - -func TestError(t *testing.T) { - testError(t, "\x80", "1:1", "illegal UTF-8 encoding", token.ILLEGAL) - testError(t, "\xff", "1:1", "illegal UTF-8 encoding", token.ILLEGAL) - - testError(t, `"ab`+"\x80", "1:4", "illegal UTF-8 encoding", token.STRING) - testError(t, `"abc`+"\xff", "1:5", "illegal UTF-8 encoding", token.STRING) - - testError(t, `01238`, "1:7", "numbers cannot start with 0", token.NUMBER) - testError(t, `01238123`, "1:10", "numbers cannot start with 0", token.NUMBER) - testError(t, `'aa'`, "1:1", "illegal char: '", token.ILLEGAL) - - testError(t, `"`, "1:2", "literal not terminated", token.STRING) - testError(t, `"abc`, "1:5", "literal not terminated", token.STRING) - testError(t, `"abc`+"\n", "1:5", "literal not terminated", token.STRING) -} - -func testError(t *testing.T, src, pos, msg string, tok token.Type) { - s := New([]byte(src)) - - errorCalled := false - s.Error = func(p token.Pos, m string) { - if !errorCalled { - if pos != p.String() { - t.Errorf("pos = %q, want %q for %q", p, pos, src) - } - - if m != msg { - t.Errorf("msg = %q, want %q for %q", m, msg, src) - } - errorCalled = true - } - } - - tk := s.Scan() - if tk.Type != tok { - t.Errorf("tok = %s, want %s for %q", tk, tok, src) - } - if !errorCalled { - t.Errorf("error handler not called for %q", src) - } - if s.ErrorCount == 0 { - t.Errorf("count = %d, want > 0 for %q", s.ErrorCount, src) - } -} - -func testTokenList(t *testing.T, tokenList []tokenPair) { - // create artifical source code - buf := new(bytes.Buffer) - for _, ident := range tokenList { - fmt.Fprintf(buf, "%s\n", ident.text) - } - - s := New(buf.Bytes()) - for _, ident := range tokenList { - tok := s.Scan() - if tok.Type != ident.tok { - t.Errorf("tok = %q want %q for %q\n", tok, ident.tok, ident.text) - } - - if tok.Text != ident.text { - t.Errorf("text = %q want %q", tok.String(), ident.text) - } - - } -} - -func countNewlines(s string) int { - n := 0 - for _, ch := range s { - if ch == '\n' { - n++ - } - } - return n -} diff --git a/vendor/github.com/hashicorp/hcl/json/token/position.go b/vendor/github.com/hashicorp/hcl/json/token/position.go deleted file mode 100644 index 59c1bb7..0000000 --- a/vendor/github.com/hashicorp/hcl/json/token/position.go +++ /dev/null @@ -1,46 +0,0 @@ -package token - -import "fmt" - -// Pos describes an arbitrary source position -// including the file, line, and column location. -// A Position is valid if the line number is > 0. -type Pos struct { - Filename string // filename, if any - Offset int // offset, starting at 0 - Line int // line number, starting at 1 - Column int // column number, starting at 1 (character count) -} - -// IsValid returns true if the position is valid. -func (p *Pos) IsValid() bool { return p.Line > 0 } - -// String returns a string in one of several forms: -// -// file:line:column valid position with file name -// line:column valid position without file name -// file invalid position with file name -// - invalid position without file name -func (p Pos) String() string { - s := p.Filename - if p.IsValid() { - if s != "" { - s += ":" - } - s += fmt.Sprintf("%d:%d", p.Line, p.Column) - } - if s == "" { - s = "-" - } - return s -} - -// Before reports whether the position p is before u. -func (p Pos) Before(u Pos) bool { - return u.Offset > p.Offset || u.Line > p.Line -} - -// After reports whether the position p is after u. -func (p Pos) After(u Pos) bool { - return u.Offset < p.Offset || u.Line < p.Line -} diff --git a/vendor/github.com/hashicorp/hcl/json/token/token.go b/vendor/github.com/hashicorp/hcl/json/token/token.go deleted file mode 100644 index 95a0c3e..0000000 --- a/vendor/github.com/hashicorp/hcl/json/token/token.go +++ /dev/null @@ -1,118 +0,0 @@ -package token - -import ( - "fmt" - "strconv" - - hcltoken "github.com/hashicorp/hcl/hcl/token" -) - -// Token defines a single HCL token which can be obtained via the Scanner -type Token struct { - Type Type - Pos Pos - Text string -} - -// Type is the set of lexical tokens of the HCL (HashiCorp Configuration Language) -type Type int - -const ( - // Special tokens - ILLEGAL Type = iota - EOF - - identifier_beg - literal_beg - NUMBER // 12345 - FLOAT // 123.45 - BOOL // true,false - STRING // "abc" - NULL // null - literal_end - identifier_end - - operator_beg - LBRACK // [ - LBRACE // { - COMMA // , - PERIOD // . - COLON // : - - RBRACK // ] - RBRACE // } - - operator_end -) - -var tokens = [...]string{ - ILLEGAL: "ILLEGAL", - - EOF: "EOF", - - NUMBER: "NUMBER", - FLOAT: "FLOAT", - BOOL: "BOOL", - STRING: "STRING", - NULL: "NULL", - - LBRACK: "LBRACK", - LBRACE: "LBRACE", - COMMA: "COMMA", - PERIOD: "PERIOD", - COLON: "COLON", - - RBRACK: "RBRACK", - RBRACE: "RBRACE", -} - -// String returns the string corresponding to the token tok. -func (t Type) String() string { - s := "" - if 0 <= t && t < Type(len(tokens)) { - s = tokens[t] - } - if s == "" { - s = "token(" + strconv.Itoa(int(t)) + ")" - } - return s -} - -// IsIdentifier returns true for tokens corresponding to identifiers and basic -// type literals; it returns false otherwise. -func (t Type) IsIdentifier() bool { return identifier_beg < t && t < identifier_end } - -// IsLiteral returns true for tokens corresponding to basic type literals; it -// returns false otherwise. -func (t Type) IsLiteral() bool { return literal_beg < t && t < literal_end } - -// IsOperator returns true for tokens corresponding to operators and -// delimiters; it returns false otherwise. -func (t Type) IsOperator() bool { return operator_beg < t && t < operator_end } - -// String returns the token's literal text. Note that this is only -// applicable for certain token types, such as token.IDENT, -// token.STRING, etc.. -func (t Token) String() string { - return fmt.Sprintf("%s %s %s", t.Pos.String(), t.Type.String(), t.Text) -} - -// HCLToken converts this token to an HCL token. -// -// The token type must be a literal type or this will panic. -func (t Token) HCLToken() hcltoken.Token { - switch t.Type { - case BOOL: - return hcltoken.Token{Type: hcltoken.BOOL, Text: t.Text} - case FLOAT: - return hcltoken.Token{Type: hcltoken.FLOAT, Text: t.Text} - case NULL: - return hcltoken.Token{Type: hcltoken.STRING, Text: ""} - case NUMBER: - return hcltoken.Token{Type: hcltoken.NUMBER, Text: t.Text} - case STRING: - return hcltoken.Token{Type: hcltoken.STRING, Text: t.Text, JSON: true} - default: - panic(fmt.Sprintf("unimplemented HCLToken for type: %s", t.Type)) - } -} diff --git a/vendor/github.com/hashicorp/hcl/json/token/token_test.go b/vendor/github.com/hashicorp/hcl/json/token/token_test.go deleted file mode 100644 index a83fdd5..0000000 --- a/vendor/github.com/hashicorp/hcl/json/token/token_test.go +++ /dev/null @@ -1,34 +0,0 @@ -package token - -import ( - "testing" -) - -func TestTypeString(t *testing.T) { - var tokens = []struct { - tt Type - str string - }{ - {ILLEGAL, "ILLEGAL"}, - {EOF, "EOF"}, - {NUMBER, "NUMBER"}, - {FLOAT, "FLOAT"}, - {BOOL, "BOOL"}, - {STRING, "STRING"}, - {NULL, "NULL"}, - {LBRACK, "LBRACK"}, - {LBRACE, "LBRACE"}, - {COMMA, "COMMA"}, - {PERIOD, "PERIOD"}, - {RBRACK, "RBRACK"}, - {RBRACE, "RBRACE"}, - } - - for _, token := range tokens { - if token.tt.String() != token.str { - t.Errorf("want: %q got:%q\n", token.str, token.tt) - - } - } - -} diff --git a/vendor/github.com/hashicorp/hcl/lex.go b/vendor/github.com/hashicorp/hcl/lex.go deleted file mode 100644 index d9993c2..0000000 --- a/vendor/github.com/hashicorp/hcl/lex.go +++ /dev/null @@ -1,38 +0,0 @@ -package hcl - -import ( - "unicode" - "unicode/utf8" -) - -type lexModeValue byte - -const ( - lexModeUnknown lexModeValue = iota - lexModeHcl - lexModeJson -) - -// lexMode returns whether we're going to be parsing in JSON -// mode or HCL mode. -func lexMode(v []byte) lexModeValue { - var ( - r rune - w int - offset int - ) - - for { - r, w = utf8.DecodeRune(v[offset:]) - offset += w - if unicode.IsSpace(r) { - continue - } - if r == '{' { - return lexModeJson - } - break - } - - return lexModeHcl -} diff --git a/vendor/github.com/hashicorp/hcl/lex_test.go b/vendor/github.com/hashicorp/hcl/lex_test.go deleted file mode 100644 index 8062764..0000000 --- a/vendor/github.com/hashicorp/hcl/lex_test.go +++ /dev/null @@ -1,37 +0,0 @@ -package hcl - -import ( - "testing" -) - -func TestLexMode(t *testing.T) { - cases := []struct { - Input string - Mode lexModeValue - }{ - { - "", - lexModeHcl, - }, - { - "foo", - lexModeHcl, - }, - { - "{}", - lexModeJson, - }, - { - " {}", - lexModeJson, - }, - } - - for i, tc := range cases { - actual := lexMode([]byte(tc.Input)) - - if actual != tc.Mode { - t.Fatalf("%d: %#v", i, actual) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl/parse.go b/vendor/github.com/hashicorp/hcl/parse.go deleted file mode 100644 index 1fca53c..0000000 --- a/vendor/github.com/hashicorp/hcl/parse.go +++ /dev/null @@ -1,39 +0,0 @@ -package hcl - -import ( - "fmt" - - "github.com/hashicorp/hcl/hcl/ast" - hclParser "github.com/hashicorp/hcl/hcl/parser" - jsonParser "github.com/hashicorp/hcl/json/parser" -) - -// ParseBytes accepts as input byte slice and returns ast tree. -// -// Input can be either JSON or HCL -func ParseBytes(in []byte) (*ast.File, error) { - return parse(in) -} - -// ParseString accepts input as a string and returns ast tree. -func ParseString(input string) (*ast.File, error) { - return parse([]byte(input)) -} - -func parse(in []byte) (*ast.File, error) { - switch lexMode(in) { - case lexModeHcl: - return hclParser.Parse(in) - case lexModeJson: - return jsonParser.Parse(in) - } - - return nil, fmt.Errorf("unknown config format") -} - -// Parse parses the given input and returns the root object. -// -// The input format can be either HCL or JSON. -func Parse(input string) (*ast.File, error) { - return parse([]byte(input)) -} diff --git a/vendor/github.com/hashicorp/hcl2/.travis.sh b/vendor/github.com/hashicorp/hcl2/.travis.sh deleted file mode 100755 index 1770fa8..0000000 --- a/vendor/github.com/hashicorp/hcl2/.travis.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash - -set -e -echo "" > coverage.txt - -for d in $(go list ./... | grep -v vendor); do - go test -coverprofile=profile.out -covermode=atomic $d - if [ -f profile.out ]; then - cat profile.out >> coverage.txt - rm profile.out - fi -done diff --git a/vendor/github.com/hashicorp/hcl2/.travis.yml b/vendor/github.com/hashicorp/hcl2/.travis.yml deleted file mode 100644 index 5e27a68..0000000 --- a/vendor/github.com/hashicorp/hcl2/.travis.yml +++ /dev/null @@ -1,13 +0,0 @@ -language: go - -go: - - 1.9.x - -before_install: - - go get -t -v ./... - -script: - - ./.travis.sh - -after_success: - - bash <(curl -s https://codecov.io/bash) diff --git a/vendor/github.com/hashicorp/hcl2/LICENSE b/vendor/github.com/hashicorp/hcl2/LICENSE deleted file mode 100644 index 82b4de9..0000000 --- a/vendor/github.com/hashicorp/hcl2/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/hcl2/README.md b/vendor/github.com/hashicorp/hcl2/README.md deleted file mode 100644 index f18fee9..0000000 --- a/vendor/github.com/hashicorp/hcl2/README.md +++ /dev/null @@ -1,165 +0,0 @@ -# HCL - -HCL is a structured configuration language that is both human- and -machine-friendly, for use with command-line tools. Although intended to be -generally useful, it is primarily targeted towards devops tools, servers, etc. - -HCL has both a _native syntax_, intended to be pleasant to read and write for -humans, and a JSON-based variant that is easier for machines to generate -and parse. - -The HCL native syntax is inspired by [libucl](https://github.com/vstakhov/libucl), -[nginx configuration](http://nginx.org/en/docs/beginners_guide.html#conf_structure), -and others. - -It includes an expression syntax that allows basic inline computation and, -with support from the calling application, use of variables and functions -for more dynamic configuration languages. - -## Experimental HCL2 - -This repository contains the experimental version 2 of HCL. This new version -combines the initial iteration of HCL with the interpolation language HIL -to produce a single configuration language that supports arbitrary expressions. - -At this time the HCL2 syntax and the Go API are still evolving. -Backward-compatibility is not guaranteed and so any application using this -library should use vendoring. - -The new implementation has a completely new parser and Go API, with no direct -migration path. Although the syntax is similar, the implementation takes some -very different approaches to improve on some "rough edges" that existed with -the original implementation and to allow for more robust error handling. - -Once this new implementation reaches stability, its package paths will be -changed to reflect that it is the _current_ HCL implementation. At that time, -the original implementation will be archived. - -## Why? - -Newcomers to HCL often ask: why not JSON, YAML, etc? - -Whereas JSON and YAML are formats for serializing data structures, HCL is -a syntax and API specifically designed for building structured configuration -formats. - -HCL attempts to strike a compromise between generic serialization formats -such as JSON and configuration formats built around full programming languages -such as Ruby. HCL syntax is designed to be easily read and written by humans, -and allows _declarative_ logic to permit its use in more complex applications. - -HCL is intended as a base syntax for configuration formats built -around key-value pairs and heirarchical blocks whose structure is well-defined -by the calling application, and this definition of the configuration structure -allows for better error messages and more convenient definition within the -calling application. - -It can't be denied that JSON is very convenient as a _lingua franca_ -for interoperability between different pieces of software. Because of this, -HCL defines a common configuration model that can be parsed from either its -native syntax or from a well-defined equivalent JSON structure. This allows -configuration to be provided as a mixture of human-authored configuration -files in the native syntax and machine-generated files in JSON. - -## Information Model and Syntax - -HCL is built around two primary concepts: _attributes_ and _blocks_. In -native syntax, a configuration file for a hypothetical application might look -something like this: - -```hcl -io_mode = "async" - -service "http" "web_proxy" { - listen_addr = "127.0.0.1:8080" - - process "main" { - command = ["/usr/local/bin/awesome-app", "server"] - } - - process "mgmt" { - command = ["/usr/local/bin/awesome-app", "mgmt"] - } -} -``` - -The JSON equivalent of this configuration is the following: - -```json -{ - "io_mode": "async", - "service": { - "http": { - "web_proxy": { - "listen_addr": "127.0.0.1:8080", - "process": { - "main": { - "command": ["/usr/local/bin/awesome-app", "server"] - }, - "mgmt": { - "command": ["/usr/local/bin/awesome-app", "mgmt"] - }, - } - } - } - } -} -``` - -Regardless of which syntax is used, the API within the calling application -is the same. It can either work directly with the low-level attributes and -blocks, for more advanced use-cases, or it can use one of the _decoder_ -packages to declaratively extract into either Go structs or dynamic value -structures. - -Attribute values can be expressions as well as just literal values: - -```hcl -# Arithmetic with literals and application-provided variables -sum = 1 + addend - -# String interpolation and templates -message = "Hello, ${name}!" - -# Application-provided functions -shouty_message = upper(message) -``` - -Although JSON syntax doesn't permit direct use of expressions, the interpolation -syntax allows use of arbitrary expressions within JSON strings: - -```json -{ - "sum": "${1 + addend}", - "message": "Hello, ${name}!", - "shouty_message": "${upper(message)}" -} -``` - -For more information, see the detailed specifications: - -* [Syntax-agnostic Information Model](hcl/spec.md) -* [HCL Native Syntax](hcl/hclsyntax/spec.md) -* [JSON Representation](hcl/json/spec.md) - -## Acknowledgements - -HCL was heavily inspired by [libucl](https://github.com/vstakhov/libucl), -by [Vsevolod Stakhov](https://github.com/vstakhov). - -HCL and HIL originate in [HashiCorp Terraform](https://terraform.io/), -with the original parsers for each written by -[Mitchell Hashimoto](https://github.com/mitchellh). - -The original HCL parser was ported to pure Go (from yacc) by -[Fatih Arslan](https://github.com/fatih). The structure-related portions of -the new native syntax parser build on that work. - -The original HIL parser was ported to pure Go (from yacc) by -[Martin Atkins](https://github.com/apparentlymart). The expression-related -portions of the new native syntax parser build on that work. - -HCL2, which merged the original HCL and HIL languages into this single new -language, builds on design and prototyping work by -[Martin Atkins](https://github.com/apparentlymart) in -[zcl](https://github.com/zclconf/go-zcl). diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/decode.go b/vendor/github.com/hashicorp/hcl2/gohcl/decode.go deleted file mode 100644 index 3a149a8..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/decode.go +++ /dev/null @@ -1,304 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - - "github.com/zclconf/go-cty/cty" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/gocty" -) - -// DecodeBody extracts the configuration within the given body into the given -// value. This value must be a non-nil pointer to either a struct or -// a map, where in the former case the configuration will be decoded using -// struct tags and in the latter case only attributes are allowed and their -// values are decoded into the map. -// -// The given EvalContext is used to resolve any variables or functions in -// expressions encountered while decoding. This may be nil to require only -// constant values, for simple applications that do not support variables or -// functions. -// -// The returned diagnostics should be inspected with its HasErrors method to -// determine if the populated value is valid and complete. If error diagnostics -// are returned then the given value may have been partially-populated but -// may still be accessed by a careful caller for static analysis and editor -// integration use-cases. -func DecodeBody(body hcl.Body, ctx *hcl.EvalContext, val interface{}) hcl.Diagnostics { - rv := reflect.ValueOf(val) - if rv.Kind() != reflect.Ptr { - panic(fmt.Sprintf("target value must be a pointer, not %s", rv.Type().String())) - } - - return decodeBodyToValue(body, ctx, rv.Elem()) -} - -func decodeBodyToValue(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics { - et := val.Type() - switch et.Kind() { - case reflect.Struct: - return decodeBodyToStruct(body, ctx, val) - case reflect.Map: - return decodeBodyToMap(body, ctx, val) - default: - panic(fmt.Sprintf("target value must be pointer to struct or map, not %s", et.String())) - } -} - -func decodeBodyToStruct(body hcl.Body, ctx *hcl.EvalContext, val reflect.Value) hcl.Diagnostics { - schema, partial := ImpliedBodySchema(val.Interface()) - - var content *hcl.BodyContent - var leftovers hcl.Body - var diags hcl.Diagnostics - if partial { - content, leftovers, diags = body.PartialContent(schema) - } else { - content, diags = body.Content(schema) - } - if content == nil { - return diags - } - - tags := getFieldTags(val.Type()) - - if tags.Remain != nil { - fieldIdx := *tags.Remain - field := val.Type().Field(fieldIdx) - fieldV := val.Field(fieldIdx) - switch { - case bodyType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(leftovers)) - case attrsType.AssignableTo(field.Type): - attrs, attrsDiags := leftovers.JustAttributes() - if len(attrsDiags) > 0 { - diags = append(diags, attrsDiags...) - } - fieldV.Set(reflect.ValueOf(attrs)) - default: - diags = append(diags, decodeBodyToValue(leftovers, ctx, fieldV)...) - } - } - - for name, fieldIdx := range tags.Attributes { - attr := content.Attributes[name] - field := val.Type().Field(fieldIdx) - fieldV := val.Field(fieldIdx) - - if attr == nil { - if !exprType.AssignableTo(field.Type) { - continue - } - - // As a special case, if the target is of type hcl.Expression then - // we'll assign an actual expression that evalues to a cty null, - // so the caller can deal with it within the cty realm rather - // than within the Go realm. - synthExpr := hcl.StaticExpr(cty.NullVal(cty.DynamicPseudoType), body.MissingItemRange()) - fieldV.Set(reflect.ValueOf(synthExpr)) - continue - } - - switch { - case attrType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(attr)) - case exprType.AssignableTo(field.Type): - fieldV.Set(reflect.ValueOf(attr.Expr)) - default: - diags = append(diags, DecodeExpression( - attr.Expr, ctx, fieldV.Addr().Interface(), - )...) - } - } - - blocksByType := content.Blocks.ByType() - - for typeName, fieldIdx := range tags.Blocks { - blocks := blocksByType[typeName] - field := val.Type().Field(fieldIdx) - - ty := field.Type - isSlice := false - isPtr := false - if ty.Kind() == reflect.Slice { - isSlice = true - ty = ty.Elem() - } - if ty.Kind() == reflect.Ptr { - isPtr = true - ty = ty.Elem() - } - - if len(blocks) > 1 && !isSlice { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Duplicate %s block", typeName), - Detail: fmt.Sprintf( - "Only one %s block is allowed. Another was defined at %s.", - typeName, blocks[0].DefRange.String(), - ), - Subject: &blocks[1].DefRange, - }) - continue - } - - if len(blocks) == 0 { - if isSlice || isPtr { - val.Field(fieldIdx).Set(reflect.Zero(field.Type)) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Missing %s block", typeName), - Detail: fmt.Sprintf("A %s block is required.", typeName), - Subject: body.MissingItemRange().Ptr(), - }) - } - continue - } - - switch { - - case isSlice: - elemType := ty - if isPtr { - elemType = reflect.PtrTo(ty) - } - sli := reflect.MakeSlice(reflect.SliceOf(elemType), len(blocks), len(blocks)) - - for i, block := range blocks { - if isPtr { - v := reflect.New(ty) - diags = append(diags, decodeBlockToValue(block, ctx, v.Elem())...) - sli.Index(i).Set(v) - } else { - diags = append(diags, decodeBlockToValue(block, ctx, sli.Index(i))...) - } - } - - val.Field(fieldIdx).Set(sli) - - default: - block := blocks[0] - if isPtr { - v := reflect.New(ty) - diags = append(diags, decodeBlockToValue(block, ctx, v.Elem())...) - val.Field(fieldIdx).Set(v) - } else { - diags = append(diags, decodeBlockToValue(block, ctx, val.Field(fieldIdx))...) - } - - } - - } - - return diags -} - -func decodeBodyToMap(body hcl.Body, ctx *hcl.EvalContext, v reflect.Value) hcl.Diagnostics { - attrs, diags := body.JustAttributes() - if attrs == nil { - return diags - } - - mv := reflect.MakeMap(v.Type()) - - for k, attr := range attrs { - switch { - case attrType.AssignableTo(v.Type().Elem()): - mv.SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(attr)) - case exprType.AssignableTo(v.Type().Elem()): - mv.SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(attr.Expr)) - default: - ev := reflect.New(v.Type().Elem()) - diags = append(diags, DecodeExpression(attr.Expr, ctx, ev.Interface())...) - mv.SetMapIndex(reflect.ValueOf(k), ev.Elem()) - } - } - - v.Set(mv) - - return diags -} - -func decodeBlockToValue(block *hcl.Block, ctx *hcl.EvalContext, v reflect.Value) hcl.Diagnostics { - var diags hcl.Diagnostics - - ty := v.Type() - - switch { - case blockType.AssignableTo(ty): - v.Elem().Set(reflect.ValueOf(block)) - case bodyType.AssignableTo(ty): - v.Elem().Set(reflect.ValueOf(block.Body)) - case attrsType.AssignableTo(ty): - attrs, attrsDiags := block.Body.JustAttributes() - if len(attrsDiags) > 0 { - diags = append(diags, attrsDiags...) - } - v.Elem().Set(reflect.ValueOf(attrs)) - default: - diags = append(diags, decodeBodyToValue(block.Body, ctx, v)...) - - if len(block.Labels) > 0 { - blockTags := getFieldTags(ty) - for li, lv := range block.Labels { - lfieldIdx := blockTags.Labels[li].FieldIndex - v.Field(lfieldIdx).Set(reflect.ValueOf(lv)) - } - } - - } - - return diags -} - -// DecodeExpression extracts the value of the given expression into the given -// value. This value must be something that gocty is able to decode into, -// since the final decoding is delegated to that package. -// -// The given EvalContext is used to resolve any variables or functions in -// expressions encountered while decoding. This may be nil to require only -// constant values, for simple applications that do not support variables or -// functions. -// -// The returned diagnostics should be inspected with its HasErrors method to -// determine if the populated value is valid and complete. If error diagnostics -// are returned then the given value may have been partially-populated but -// may still be accessed by a careful caller for static analysis and editor -// integration use-cases. -func DecodeExpression(expr hcl.Expression, ctx *hcl.EvalContext, val interface{}) hcl.Diagnostics { - srcVal, diags := expr.Value(ctx) - - convTy, err := gocty.ImpliedType(val) - if err != nil { - panic(fmt.Sprintf("unsuitable DecodeExpression target: %s", err)) - } - - srcVal, err = convert.Convert(srcVal, convTy) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsuitable value type", - Detail: fmt.Sprintf("Unsuitable value: %s", err.Error()), - Subject: expr.StartRange().Ptr(), - Context: expr.Range().Ptr(), - }) - return diags - } - - err = gocty.FromCtyValue(srcVal, val) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsuitable value type", - Detail: fmt.Sprintf("Unsuitable value: %s", err.Error()), - Subject: expr.StartRange().Ptr(), - Context: expr.Range().Ptr(), - }) - } - - return diags -} diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/decode_test.go b/vendor/github.com/hashicorp/hcl2/gohcl/decode_test.go deleted file mode 100644 index c90df7d..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/decode_test.go +++ /dev/null @@ -1,635 +0,0 @@ -package gohcl - -import ( - "encoding/json" - "fmt" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/hcl" - zclJSON "github.com/hashicorp/hcl2/hcl/json" - "github.com/zclconf/go-cty/cty" -) - -func TestDecodeBody(t *testing.T) { - deepEquals := func(other interface{}) func(v interface{}) bool { - return func(v interface{}) bool { - return reflect.DeepEqual(v, other) - } - } - - type withNameExpression struct { - Name hcl.Expression `hcl:"name"` - } - - tests := []struct { - Body map[string]interface{} - Target interface{} - Check func(v interface{}) bool - DiagCount int - }{ - { - map[string]interface{}{}, - struct{}{}, - deepEquals(struct{}{}), - 0, - }, - { - map[string]interface{}{}, - struct { - Name string `hcl:"name"` - }{}, - deepEquals(struct { - Name string `hcl:"name"` - }{}), - 1, // name is required - }, - { - map[string]interface{}{}, - struct { - Name *string `hcl:"name"` - }{}, - deepEquals(struct { - Name *string `hcl:"name"` - }{}), - 0, - }, - { - map[string]interface{}{}, - withNameExpression{}, - func(v interface{}) bool { - if v == nil { - return false - } - - wne, valid := v.(withNameExpression) - if !valid { - return false - } - - if wne.Name == nil { - return false - } - - nameVal, _ := wne.Name.Value(nil) - if !nameVal.IsNull() { - return false - } - - return true - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - }, - withNameExpression{}, - func(v interface{}) bool { - if v == nil { - return false - } - - wne, valid := v.(withNameExpression) - if !valid { - return false - } - - if wne.Name == nil { - return false - } - - nameVal, _ := wne.Name.Value(nil) - if !nameVal.Equals(cty.StringVal("Ermintrude")).True() { - return false - } - - return true - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - }, - struct { - Name string `hcl:"name"` - }{}, - deepEquals(struct { - Name string `hcl:"name"` - }{"Ermintrude"}), - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 23, - }, - struct { - Name string `hcl:"name"` - }{}, - deepEquals(struct { - Name string `hcl:"name"` - }{"Ermintrude"}), - 1, // Extraneous "age" property - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 50, - }, - struct { - Name string `hcl:"name"` - Attrs hcl.Attributes `hcl:",remain"` - }{}, - func(gotI interface{}) bool { - got := gotI.(struct { - Name string `hcl:"name"` - Attrs hcl.Attributes `hcl:",remain"` - }) - return got.Name == "Ermintrude" && len(got.Attrs) == 1 && got.Attrs["age"] != nil - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 50, - }, - struct { - Name string `hcl:"name"` - Remain hcl.Body `hcl:",remain"` - }{}, - func(gotI interface{}) bool { - got := gotI.(struct { - Name string `hcl:"name"` - Remain hcl.Body `hcl:",remain"` - }) - - attrs, _ := got.Remain.JustAttributes() - - return got.Name == "Ermintrude" && len(attrs) == 1 && attrs["age"] != nil - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 51, - }, - struct { - Name string `hcl:"name"` - Remain map[string]cty.Value `hcl:",remain"` - }{}, - deepEquals(struct { - Name string `hcl:"name"` - Remain map[string]cty.Value `hcl:",remain"` - }{ - Name: "Ermintrude", - Remain: map[string]cty.Value{ - "age": cty.NumberIntVal(51), - }, - }), - 0, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{}, - }, - struct { - Noodle struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating no diagnostics is good enough for this one. - return true - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}}, - }, - struct { - Noodle struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating no diagnostics is good enough for this one. - return true - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}, {}}, - }, - struct { - Noodle struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating one diagnostic is good enough for this one. - return true - }, - 1, - }, - { - map[string]interface{}{}, - struct { - Noodle struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating one diagnostic is good enough for this one. - return true - }, - 1, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{}, - }, - struct { - Noodle struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating one diagnostic is good enough for this one. - return true - }, - 1, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{}, - }, - struct { - Noodle *struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - return gotI.(struct { - Noodle *struct{} `hcl:"noodle,block"` - }).Noodle != nil - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}}, - }, - struct { - Noodle *struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - return gotI.(struct { - Noodle *struct{} `hcl:"noodle,block"` - }).Noodle != nil - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{}, - }, - struct { - Noodle *struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - return gotI.(struct { - Noodle *struct{} `hcl:"noodle,block"` - }).Noodle == nil - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}, {}}, - }, - struct { - Noodle *struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating one diagnostic is good enough for this one. - return true - }, - 1, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{}, - }, - struct { - Noodle []struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodle := gotI.(struct { - Noodle []struct{} `hcl:"noodle,block"` - }).Noodle - return len(noodle) == 0 - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}}, - }, - struct { - Noodle []struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodle := gotI.(struct { - Noodle []struct{} `hcl:"noodle,block"` - }).Noodle - return len(noodle) == 1 - }, - 0, - }, - { - map[string]interface{}{ - "noodle": []map[string]interface{}{{}, {}}, - }, - struct { - Noodle []struct{} `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodle := gotI.(struct { - Noodle []struct{} `hcl:"noodle,block"` - }).Noodle - return len(noodle) == 2 - }, - 0, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{}, - }, - struct { - Noodle struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // Generating two diagnostics is good enough for this one. - // (one for the missing noodle block and the other for - // the JSON serialization detecting the missing level of - // heirarchy for the label.) - return true - }, - 2, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{ - "foo_foo": map[string]interface{}{}, - }, - }, - struct { - Noodle struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodle := gotI.(struct { - Noodle struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }).Noodle - return noodle.Name == "foo_foo" - }, - 0, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{ - "foo_foo": map[string]interface{}{}, - "bar_baz": map[string]interface{}{}, - }, - }, - struct { - Noodle struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - // One diagnostic is enough for this one. - return true - }, - 1, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{ - "foo_foo": map[string]interface{}{}, - "bar_baz": map[string]interface{}{}, - }, - }, - struct { - Noodles []struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodles := gotI.(struct { - Noodles []struct { - Name string `hcl:"name,label"` - } `hcl:"noodle,block"` - }).Noodles - return len(noodles) == 2 && (noodles[0].Name == "foo_foo" || noodles[0].Name == "bar_baz") && (noodles[1].Name == "foo_foo" || noodles[1].Name == "bar_baz") && noodles[0].Name != noodles[1].Name - }, - 0, - }, - { - map[string]interface{}{ - "noodle": map[string]interface{}{ - "foo_foo": map[string]interface{}{ - "type": "rice", - }, - }, - }, - struct { - Noodle struct { - Name string `hcl:"name,label"` - Type string `hcl:"type"` - } `hcl:"noodle,block"` - }{}, - func(gotI interface{}) bool { - noodle := gotI.(struct { - Noodle struct { - Name string `hcl:"name,label"` - Type string `hcl:"type"` - } `hcl:"noodle,block"` - }).Noodle - return noodle.Name == "foo_foo" && noodle.Type == "rice" - }, - 0, - }, - - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 34, - }, - map[string]string(nil), - deepEquals(map[string]string{ - "name": "Ermintrude", - "age": "34", - }), - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 89, - }, - map[string]*hcl.Attribute(nil), - func(gotI interface{}) bool { - got := gotI.(map[string]*hcl.Attribute) - return len(got) == 2 && got["name"] != nil && got["age"] != nil - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 13, - }, - map[string]hcl.Expression(nil), - func(gotI interface{}) bool { - got := gotI.(map[string]hcl.Expression) - return len(got) == 2 && got["name"] != nil && got["age"] != nil - }, - 0, - }, - { - map[string]interface{}{ - "name": "Ermintrude", - "age": 13, - }, - map[string]cty.Value(nil), - deepEquals(map[string]cty.Value{ - "name": cty.StringVal("Ermintrude"), - "age": cty.NumberIntVal(13), - }), - 0, - }, - } - - for i, test := range tests { - // For convenience here we're going to use the JSON parser - // to process the given body. - buf, err := json.Marshal(test.Body) - if err != nil { - t.Fatalf("error JSON-encoding body for test %d: %s", i, err) - } - - t.Run(string(buf), func(t *testing.T) { - file, diags := zclJSON.Parse(buf, "test.json") - if len(diags) != 0 { - t.Fatalf("diagnostics while parsing: %s", diags.Error()) - } - - targetVal := reflect.New(reflect.TypeOf(test.Target)) - - diags = DecodeBody(file.Body, nil, targetVal.Interface()) - if len(diags) != test.DiagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.DiagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - got := targetVal.Elem().Interface() - if !test.Check(got) { - t.Errorf("wrong result\ngot: %s", spew.Sdump(got)) - } - }) - } - -} - -func TestDecodeExpression(t *testing.T) { - tests := []struct { - Value cty.Value - Target interface{} - Want interface{} - DiagCount int - }{ - { - cty.StringVal("hello"), - "", - "hello", - 0, - }, - { - cty.StringVal("hello"), - cty.NilVal, - cty.StringVal("hello"), - 0, - }, - { - cty.NumberIntVal(2), - "", - "2", - 0, - }, - { - cty.StringVal("true"), - false, - true, - 0, - }, - { - cty.NullVal(cty.String), - "", - "", - 1, // null value is not allowed - }, - { - cty.UnknownVal(cty.String), - "", - "", - 1, // value must be known - }, - { - cty.ListVal([]cty.Value{cty.True}), - false, - false, - 1, // bool required - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { - expr := &fixedExpression{test.Value} - - targetVal := reflect.New(reflect.TypeOf(test.Target)) - - diags := DecodeExpression(expr, nil, targetVal.Interface()) - if len(diags) != test.DiagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.DiagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - got := targetVal.Elem().Interface() - if !reflect.DeepEqual(got, test.Want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.Want) - } - }) - } -} - -type fixedExpression struct { - val cty.Value -} - -func (e *fixedExpression) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.val, nil -} - -func (e *fixedExpression) Range() (r hcl.Range) { - return -} -func (e *fixedExpression) StartRange() (r hcl.Range) { - return -} - -func (e *fixedExpression) Variables() []hcl.Traversal { - return nil -} diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/doc.go b/vendor/github.com/hashicorp/hcl2/gohcl/doc.go deleted file mode 100644 index 8500214..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/doc.go +++ /dev/null @@ -1,49 +0,0 @@ -// Package gohcl allows decoding HCL configurations into Go data structures. -// -// It provides a convenient and concise way of describing the schema for -// configuration and then accessing the resulting data via native Go -// types. -// -// A struct field tag scheme is used, similar to other decoding and -// unmarshalling libraries. The tags are formatted as in the following example: -// -// ThingType string `hcl:"thing_type,attr"` -// -// Within each tag there are two comma-separated tokens. The first is the -// name of the corresponding construct in configuration, while the second -// is a keyword giving the kind of construct expected. The following -// kind keywords are supported: -// -// attr (the default) indicates that the value is to be populated from an attribute -// block indicates that the value is to populated from a block -// label indicates that the value is to populated from a block label -// remain indicates that the value is to be populated from the remaining body after populating other fields -// -// "attr" fields may either be of type *hcl.Expression, in which case the raw -// expression is assigned, or of any type accepted by gocty, in which case -// gocty will be used to assign the value to a native Go type. -// -// "block" fields may be of type *hcl.Block or hcl.Body, in which case the -// corresponding raw value is assigned, or may be a struct that recursively -// uses the same tags. Block fields may also be slices of any of these types, -// in which case multiple blocks of the corresponding type are decoded into -// the slice. -// -// "label" fields are considered only in a struct used as the type of a field -// marked as "block", and are used sequentially to capture the labels of -// the blocks being decoded. In this case, the name token is used only as -// an identifier for the label in diagnostic messages. -// -// "remain" can be placed on a single field that may be either of type -// hcl.Body or hcl.Attributes, in which case any remaining body content is -// placed into this field for delayed processing. If no "remain" field is -// present then any attributes or blocks not matched by another valid tag -// will cause an error diagnostic. -// -// Broadly-speaking this package deals with two types of error. The first is -// errors in the configuration itself, which are returned as diagnostics -// written with the configuration author as the target audience. The second -// is bugs in the calling program, such as invalid struct tags, which are -// surfaced via panics since there can be no useful runtime handling of such -// errors and they should certainly not be returned to the user as diagnostics. -package gohcl diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/schema.go b/vendor/github.com/hashicorp/hcl2/gohcl/schema.go deleted file mode 100644 index a8955dc..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/schema.go +++ /dev/null @@ -1,167 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - "sort" - "strings" - - "github.com/hashicorp/hcl2/hcl" -) - -// ImpliedBodySchema produces a hcl.BodySchema derived from the type of the -// given value, which must be a struct value or a pointer to one. If an -// inappropriate value is passed, this function will panic. -// -// The second return argument indicates whether the given struct includes -// a "remain" field, and thus the returned schema is non-exhaustive. -// -// This uses the tags on the fields of the struct to discover how each -// field's value should be expressed within configuration. If an invalid -// mapping is attempted, this function will panic. -func ImpliedBodySchema(val interface{}) (schema *hcl.BodySchema, partial bool) { - ty := reflect.TypeOf(val) - - if ty.Kind() == reflect.Ptr { - ty = ty.Elem() - } - - if ty.Kind() != reflect.Struct { - panic(fmt.Sprintf("given value must be struct, not %T", val)) - } - - var attrSchemas []hcl.AttributeSchema - var blockSchemas []hcl.BlockHeaderSchema - - tags := getFieldTags(ty) - - attrNames := make([]string, 0, len(tags.Attributes)) - for n := range tags.Attributes { - attrNames = append(attrNames, n) - } - sort.Strings(attrNames) - for _, n := range attrNames { - idx := tags.Attributes[n] - field := ty.Field(idx) - var required bool - - switch { - case field.Type.AssignableTo(exprType): - // If we're decoding to hcl.Expression then absense can be - // indicated via a null value, so we don't specify that - // the field is required during decoding. - required = false - case field.Type.Kind() != reflect.Ptr: - required = true - default: - required = false - } - - attrSchemas = append(attrSchemas, hcl.AttributeSchema{ - Name: n, - Required: required, - }) - } - - blockNames := make([]string, 0, len(tags.Blocks)) - for n := range tags.Blocks { - blockNames = append(blockNames, n) - } - sort.Strings(blockNames) - for _, n := range blockNames { - idx := tags.Blocks[n] - field := ty.Field(idx) - fty := field.Type - if fty.Kind() == reflect.Slice { - fty = fty.Elem() - } - if fty.Kind() == reflect.Ptr { - fty = fty.Elem() - } - if fty.Kind() != reflect.Struct { - panic(fmt.Sprintf( - "hcl 'block' tag kind cannot be applied to %s field %s: struct required", field.Type.String(), field.Name, - )) - } - ftags := getFieldTags(fty) - var labelNames []string - if len(ftags.Labels) > 0 { - labelNames = make([]string, len(ftags.Labels)) - for i, l := range ftags.Labels { - labelNames[i] = l.Name - } - } - - blockSchemas = append(blockSchemas, hcl.BlockHeaderSchema{ - Type: n, - LabelNames: labelNames, - }) - } - - partial = tags.Remain != nil - schema = &hcl.BodySchema{ - Attributes: attrSchemas, - Blocks: blockSchemas, - } - return schema, partial -} - -type fieldTags struct { - Attributes map[string]int - Blocks map[string]int - Labels []labelField - Remain *int -} - -type labelField struct { - FieldIndex int - Name string -} - -func getFieldTags(ty reflect.Type) *fieldTags { - ret := &fieldTags{ - Attributes: map[string]int{}, - Blocks: map[string]int{}, - } - - ct := ty.NumField() - for i := 0; i < ct; i++ { - field := ty.Field(i) - tag := field.Tag.Get("hcl") - if tag == "" { - continue - } - - comma := strings.Index(tag, ",") - var name, kind string - if comma != -1 { - name = tag[:comma] - kind = tag[comma+1:] - } else { - name = tag - kind = "attr" - } - - switch kind { - case "attr": - ret.Attributes[name] = i - case "block": - ret.Blocks[name] = i - case "label": - ret.Labels = append(ret.Labels, labelField{ - FieldIndex: i, - Name: name, - }) - case "remain": - if ret.Remain != nil { - panic("only one 'remain' tag is permitted") - } - idx := i // copy, because this loop will continue assigning to i - ret.Remain = &idx - default: - panic(fmt.Sprintf("invalid hcl field tag kind %q on %s %q", kind, field.Type.String(), field.Name)) - } - } - - return ret -} diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/schema_test.go b/vendor/github.com/hashicorp/hcl2/gohcl/schema_test.go deleted file mode 100644 index 018efdb..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/schema_test.go +++ /dev/null @@ -1,216 +0,0 @@ -package gohcl - -import ( - "fmt" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/hcl" -) - -func TestImpliedBodySchema(t *testing.T) { - tests := []struct { - val interface{} - wantSchema *hcl.BodySchema - wantPartial bool - }{ - { - struct{}{}, - &hcl.BodySchema{}, - false, - }, - { - struct { - Ignored bool - }{}, - &hcl.BodySchema{}, - false, - }, - { - struct { - Attr1 bool `hcl:"attr1"` - Attr2 bool `hcl:"attr2"` - }{}, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "attr1", - Required: true, - }, - { - Name: "attr2", - Required: true, - }, - }, - }, - false, - }, - { - struct { - Attr *bool `hcl:"attr,attr"` - }{}, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "attr", - Required: false, - }, - }, - }, - false, - }, - { - struct { - Thing struct{} `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - }, - }, - }, - false, - }, - { - struct { - Thing struct { - Type string `hcl:"type,label"` - Name string `hcl:"name,label"` - } `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - LabelNames: []string{"type", "name"}, - }, - }, - }, - false, - }, - { - struct { - Thing []struct { - Type string `hcl:"type,label"` - Name string `hcl:"name,label"` - } `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - LabelNames: []string{"type", "name"}, - }, - }, - }, - false, - }, - { - struct { - Thing *struct { - Type string `hcl:"type,label"` - Name string `hcl:"name,label"` - } `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - LabelNames: []string{"type", "name"}, - }, - }, - }, - false, - }, - { - struct { - Thing struct { - Name string `hcl:"name,label"` - Something string `hcl:"something"` - } `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - LabelNames: []string{"name"}, - }, - }, - }, - false, - }, - { - struct { - Doodad string `hcl:"doodad"` - Thing struct { - Name string `hcl:"name,label"` - } `hcl:"thing,block"` - }{}, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "doodad", - Required: true, - }, - }, - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "thing", - LabelNames: []string{"name"}, - }, - }, - }, - false, - }, - { - struct { - Doodad string `hcl:"doodad"` - Config string `hcl:",remain"` - }{}, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "doodad", - Required: true, - }, - }, - }, - true, - }, - { - struct { - Expr hcl.Expression `hcl:"expr"` - }{}, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "expr", - Required: false, - }, - }, - }, - false, - }, - } - - for _, test := range tests { - t.Run(fmt.Sprintf("%#v", test.val), func(t *testing.T) { - schema, partial := ImpliedBodySchema(test.val) - if !reflect.DeepEqual(schema, test.wantSchema) { - t.Errorf( - "wrong schema\ngot: %s\nwant: %s", - spew.Sdump(schema), spew.Sdump(test.wantSchema), - ) - } - - if partial != test.wantPartial { - t.Errorf( - "wrong partial flag\ngot: %#v\nwant: %#v", - partial, test.wantPartial, - ) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/gohcl/types.go b/vendor/github.com/hashicorp/hcl2/gohcl/types.go deleted file mode 100644 index a94f275..0000000 --- a/vendor/github.com/hashicorp/hcl2/gohcl/types.go +++ /dev/null @@ -1,16 +0,0 @@ -package gohcl - -import ( - "reflect" - - "github.com/hashicorp/hcl2/hcl" -) - -var victimExpr hcl.Expression -var victimBody hcl.Body - -var exprType = reflect.TypeOf(&victimExpr).Elem() -var bodyType = reflect.TypeOf(&victimBody).Elem() -var blockType = reflect.TypeOf((*hcl.Block)(nil)) -var attrType = reflect.TypeOf((*hcl.Attribute)(nil)) -var attrsType = reflect.TypeOf(hcl.Attributes(nil)) diff --git a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic.go b/vendor/github.com/hashicorp/hcl2/hcl/diagnostic.go deleted file mode 100644 index 6ecf744..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic.go +++ /dev/null @@ -1,103 +0,0 @@ -package hcl - -import ( - "fmt" -) - -// DiagnosticSeverity represents the severity of a diagnostic. -type DiagnosticSeverity int - -const ( - // DiagInvalid is the invalid zero value of DiagnosticSeverity - DiagInvalid DiagnosticSeverity = iota - - // DiagError indicates that the problem reported by a diagnostic prevents - // further progress in parsing and/or evaluating the subject. - DiagError - - // DiagWarning indicates that the problem reported by a diagnostic warrants - // user attention but does not prevent further progress. It is most - // commonly used for showing deprecation notices. - DiagWarning -) - -// Diagnostic represents information to be presented to a user about an -// error or anomoly in parsing or evaluating configuration. -type Diagnostic struct { - Severity DiagnosticSeverity - - // Summary and detail contain the English-language description of the - // problem. Summary is a terse description of the general problem and - // detail is a more elaborate, often-multi-sentence description of - // the probem and what might be done to solve it. - Summary string - Detail string - Subject *Range - Context *Range -} - -// Diagnostics is a list of Diagnostic instances. -type Diagnostics []*Diagnostic - -// error implementation, so that diagnostics can be returned via APIs -// that normally deal in vanilla Go errors. -// -// This presents only minimal context about the error, for compatibility -// with usual expectations about how errors will present as strings. -func (d *Diagnostic) Error() string { - return fmt.Sprintf("%s: %s; %s", d.Subject, d.Summary, d.Detail) -} - -// error implementation, so that sets of diagnostics can be returned via -// APIs that normally deal in vanilla Go errors. -func (d Diagnostics) Error() string { - count := len(d) - switch { - case count == 0: - return "no diagnostics" - case count == 1: - return d[0].Error() - default: - return fmt.Sprintf("%s, and %d other diagnostic(s)", d[0].Error(), count-1) - } -} - -// Append appends a new error to a Diagnostics and return the whole Diagnostics. -// -// This is provided as a convenience for returning from a function that -// collects and then returns a set of diagnostics: -// -// return nil, diags.Append(&hcl.Diagnostic{ ... }) -// -// Note that this modifies the array underlying the diagnostics slice, so -// must be used carefully within a single codepath. It is incorrect (and rude) -// to extend a diagnostics created by a different subsystem. -func (d Diagnostics) Append(diag *Diagnostic) Diagnostics { - return append(d, diag) -} - -// Extend concatenates the given Diagnostics with the receiver and returns -// the whole new Diagnostics. -// -// This is similar to Append but accepts multiple diagnostics to add. It has -// all the same caveats and constraints. -func (d Diagnostics) Extend(diags Diagnostics) Diagnostics { - return append(d, diags...) -} - -// HasErrors returns true if the receiver contains any diagnostics of -// severity DiagError. -func (d Diagnostics) HasErrors() bool { - for _, diag := range d { - if diag.Severity == DiagError { - return true - } - } - return false -} - -// A DiagnosticWriter emits diagnostics somehow. -type DiagnosticWriter interface { - WriteDiagnostic(*Diagnostic) error - WriteDiagnostics(Diagnostics) error -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text.go b/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text.go deleted file mode 100644 index dfa473a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text.go +++ /dev/null @@ -1,168 +0,0 @@ -package hcl - -import ( - "bufio" - "errors" - "fmt" - "io" - - wordwrap "github.com/mitchellh/go-wordwrap" -) - -type diagnosticTextWriter struct { - files map[string]*File - wr io.Writer - width uint - color bool -} - -// NewDiagnosticTextWriter creates a DiagnosticWriter that writes diagnostics -// to the given writer as formatted text. -// -// It is designed to produce text appropriate to print in a monospaced font -// in a terminal of a particular width, or optionally with no width limit. -// -// The given width may be zero to disable word-wrapping of the detail text -// and truncation of source code snippets. -// -// If color is set to true, the output will include VT100 escape sequences to -// color-code the severity indicators. It is suggested to turn this off if -// the target writer is not a terminal. -func NewDiagnosticTextWriter(wr io.Writer, files map[string]*File, width uint, color bool) DiagnosticWriter { - return &diagnosticTextWriter{ - files: files, - wr: wr, - width: width, - color: color, - } -} - -func (w *diagnosticTextWriter) WriteDiagnostic(diag *Diagnostic) error { - if diag == nil { - return errors.New("nil diagnostic") - } - - var colorCode, highlightCode, resetCode string - if w.color { - switch diag.Severity { - case DiagError: - colorCode = "\x1b[31m" - case DiagWarning: - colorCode = "\x1b[33m" - } - resetCode = "\x1b[0m" - highlightCode = "\x1b[1;4m" - } - - var severityStr string - switch diag.Severity { - case DiagError: - severityStr = "Error" - case DiagWarning: - severityStr = "Warning" - default: - // should never happen - severityStr = "???????" - } - - fmt.Fprintf(w.wr, "%s%s%s: %s\n\n", colorCode, severityStr, resetCode, diag.Summary) - - if diag.Subject != nil { - snipRange := *diag.Subject - highlightRange := snipRange - if diag.Context != nil { - // Show enough of the source code to include both the subject - // and context ranges, which overlap in all reasonable - // situations. - snipRange = RangeOver(snipRange, *diag.Context) - } - // We can't illustrate an empty range, so we'll turn such ranges into - // single-character ranges, which might not be totally valid (may point - // off the end of a line, or off the end of the file) but are good - // enough for the bounds checks we do below. - if snipRange.Empty() { - snipRange.End.Byte++ - snipRange.End.Column++ - } - if highlightRange.Empty() { - highlightRange.End.Byte++ - highlightRange.End.Column++ - } - - file := w.files[diag.Subject.Filename] - if file == nil || file.Bytes == nil { - fmt.Fprintf(w.wr, " on %s line %d:\n (source code not available)\n\n", diag.Subject.Filename, diag.Subject.Start.Line) - } else { - - var contextLine string - if diag.Subject != nil { - contextLine = contextString(file, diag.Subject.Start.Byte) - if contextLine != "" { - contextLine = ", in " + contextLine - } - } - - fmt.Fprintf(w.wr, " on %s line %d%s:\n", diag.Subject.Filename, diag.Subject.Start.Line, contextLine) - - src := file.Bytes - sc := NewRangeScanner(src, diag.Subject.Filename, bufio.ScanLines) - - for sc.Scan() { - lineRange := sc.Range() - if !lineRange.Overlaps(snipRange) { - continue - } - - beforeRange, highlightedRange, afterRange := lineRange.PartitionAround(highlightRange) - if highlightedRange.Empty() { - fmt.Fprintf(w.wr, "%4d: %s\n", lineRange.Start.Line, sc.Bytes()) - } else { - before := beforeRange.SliceBytes(src) - highlighted := highlightedRange.SliceBytes(src) - after := afterRange.SliceBytes(src) - fmt.Fprintf( - w.wr, "%4d: %s%s%s%s%s\n", - lineRange.Start.Line, - before, - highlightCode, highlighted, resetCode, - after, - ) - } - - } - - w.wr.Write([]byte{'\n'}) - } - } - - if diag.Detail != "" { - detail := diag.Detail - if w.width != 0 { - detail = wordwrap.WrapString(detail, w.width) - } - fmt.Fprintf(w.wr, "%s\n\n", detail) - } - - return nil -} - -func (w *diagnosticTextWriter) WriteDiagnostics(diags Diagnostics) error { - for _, diag := range diags { - err := w.WriteDiagnostic(diag) - if err != nil { - return err - } - } - return nil -} - -func contextString(file *File, offset int) string { - type contextStringer interface { - ContextString(offset int) string - } - - if cser, ok := file.Nav.(contextStringer); ok { - return cser.ContextString(offset) - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text_test.go b/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text_test.go deleted file mode 100644 index 67c1e64..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/diagnostic_text_test.go +++ /dev/null @@ -1,151 +0,0 @@ -package hcl - -import ( - "bytes" - "fmt" - "testing" -) - -func TestDiagnosticTextWriter(t *testing.T) { - tests := []struct { - Input *Diagnostic - Want string - }{ - { - &Diagnostic{ - Severity: DiagError, - Summary: "Splines not reticulated", - Detail: "All splines must be pre-reticulated.", - Subject: &Range{ - Start: Pos{ - Byte: 0, - Column: 1, - Line: 1, - }, - End: Pos{ - Byte: 3, - Column: 4, - Line: 1, - }, - }, - }, - `Error: Splines not reticulated - - on line 1, in hardcoded-context: - 1: foo = 1 - -All splines must be pre-reticulated. - -`, - }, - { - &Diagnostic{ - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: `"baz" is not a supported top-level attribute. Did you mean "bam"?`, - Subject: &Range{ - Start: Pos{ - Byte: 16, - Column: 1, - Line: 3, - }, - End: Pos{ - Byte: 19, - Column: 4, - Line: 3, - }, - }, - }, - `Error: Unsupported attribute - - on line 3, in hardcoded-context: - 3: baz = 3 - -"baz" is not a supported top-level -attribute. Did you mean "bam"? - -`, - }, - { - &Diagnostic{ - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: `"pizza" is not a supported attribute. Did you mean "pizzetta"?`, - Subject: &Range{ - Start: Pos{ - Byte: 42, - Column: 3, - Line: 5, - }, - End: Pos{ - Byte: 47, - Column: 8, - Line: 5, - }, - }, - // This is actually not a great example of a context, but is here to test - // whether we're able to show a multi-line context when needed. - Context: &Range{ - Start: Pos{ - Byte: 24, - Column: 1, - Line: 4, - }, - End: Pos{ - Byte: 60, - Column: 2, - Line: 6, - }, - }, - }, - `Error: Unsupported attribute - - on line 5, in hardcoded-context: - 4: block "party" { - 5: pizza = "cheese" - 6: } - -"pizza" is not a supported attribute. -Did you mean "pizzetta"? - -`, - }, - } - - files := map[string]*File{ - "": &File{ - Bytes: []byte(testDiagnosticTextWriterSource), - Nav: &diagnosticTestNav{}, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { - bwr := &bytes.Buffer{} - dwr := NewDiagnosticTextWriter(bwr, files, 40, false) - err := dwr.WriteDiagnostic(test.Input) - if err != nil { - t.Fatalf("unexpected error: %s", err) - } - got := bwr.String() - if got != test.Want { - t.Errorf("wrong result\n\ngot:\n%swant:\n%s", got, test.Want) - } - }) - } -} - -const testDiagnosticTextWriterSource = `foo = 1 -bar = 2 -baz = 3 -block "party" { - pizza = "cheese" -} -` - -type diagnosticTestNav struct { -} - -func (tn *diagnosticTestNav) ContextString(offset int) string { - return "hardcoded-context" -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/didyoumean.go b/vendor/github.com/hashicorp/hcl2/hcl/didyoumean.go deleted file mode 100644 index c128334..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/didyoumean.go +++ /dev/null @@ -1,24 +0,0 @@ -package hcl - -import ( - "github.com/agext/levenshtein" -) - -// nameSuggestion tries to find a name from the given slice of suggested names -// that is close to the given name and returns it if found. If no suggestion -// is close enough, returns the empty string. -// -// The suggestions are tried in order, so earlier suggestions take precedence -// if the given string is similar to two or more suggestions. -// -// This function is intended to be used with a relatively-small number of -// suggestions. It's not optimized for hundreds or thousands of them. -func nameSuggestion(given string, suggestions []string) string { - for _, suggestion := range suggestions { - dist := levenshtein.Distance(given, suggestion, nil) - if dist < 3 { // threshold determined experimentally - return suggestion - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/doc.go b/vendor/github.com/hashicorp/hcl2/hcl/doc.go deleted file mode 100644 index 01318c9..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/doc.go +++ /dev/null @@ -1 +0,0 @@ -package hcl diff --git a/vendor/github.com/hashicorp/hcl2/hcl/eval_context.go b/vendor/github.com/hashicorp/hcl2/hcl/eval_context.go deleted file mode 100644 index 915910a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/eval_context.go +++ /dev/null @@ -1,25 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/function" -) - -// An EvalContext provides the variables and functions that should be used -// to evaluate an expression. -type EvalContext struct { - Variables map[string]cty.Value - Functions map[string]function.Function - parent *EvalContext -} - -// NewChild returns a new EvalContext that is a child of the receiver. -func (ctx *EvalContext) NewChild() *EvalContext { - return &EvalContext{parent: ctx} -} - -// Parent returns the parent of the receiver, or nil if the receiver has -// no parent. -func (ctx *EvalContext) Parent() *EvalContext { - return ctx.parent -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/expr_list.go b/vendor/github.com/hashicorp/hcl2/hcl/expr_list.go deleted file mode 100644 index b06b197..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/expr_list.go +++ /dev/null @@ -1,30 +0,0 @@ -package hcl - -// ExprList tests if the given expression is a static list construct and, -// if so, extracts the expressions that represent the list elements. -// If the given expression is not a static list, error diagnostics are -// returned. -// -// A particular Expression implementation can support this function by -// offering a method called ExprList that takes no arguments and returns -// []Expression. This method should return nil if a static list cannot -// be extracted. -func ExprList(expr Expression) ([]Expression, Diagnostics) { - type exprList interface { - ExprList() []Expression - } - - if exL, supported := expr.(exprList); supported { - if list := exL.ExprList(); list != nil { - return list, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A static list expression is required.", - Subject: expr.StartRange().Ptr(), - }, - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean.go deleted file mode 100644 index ccc1c0a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean.go +++ /dev/null @@ -1,24 +0,0 @@ -package hclsyntax - -import ( - "github.com/agext/levenshtein" -) - -// nameSuggestion tries to find a name from the given slice of suggested names -// that is close to the given name and returns it if found. If no suggestion -// is close enough, returns the empty string. -// -// The suggestions are tried in order, so earlier suggestions take precedence -// if the given string is similar to two or more suggestions. -// -// This function is intended to be used with a relatively-small number of -// suggestions. It's not optimized for hundreds or thousands of them. -func nameSuggestion(given string, suggestions []string) string { - for _, suggestion := range suggestions { - dist := levenshtein.Distance(given, suggestion, nil) - if dist < 3 { // threshold determined experimentally - return suggestion - } - } - return "" -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean_test.go deleted file mode 100644 index 9d04b7b..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/didyoumean_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package hclsyntax - -import "testing" - -func TestNameSuggestion(t *testing.T) { - var keywords = []string{"false", "true", "null"} - - tests := []struct { - Input, Want string - }{ - {"true", "true"}, - {"false", "false"}, - {"null", "null"}, - {"bananas", ""}, - {"NaN", ""}, - {"Inf", ""}, - {"Infinity", ""}, - {"void", ""}, - {"undefined", ""}, - - {"ture", "true"}, - {"tru", "true"}, - {"tre", "true"}, - {"treu", "true"}, - {"rtue", "true"}, - - {"flase", "false"}, - {"fales", "false"}, - {"flse", "false"}, - {"fasle", "false"}, - {"fasel", "false"}, - {"flue", "false"}, - - {"nil", "null"}, - {"nul", "null"}, - {"unll", "null"}, - {"nll", "null"}, - } - - for _, test := range tests { - t.Run(test.Input, func(t *testing.T) { - got := nameSuggestion(test.Input, keywords) - if got != test.Want { - t.Errorf( - "wrong result\ninput: %q\ngot: %q\nwant: %q", - test.Input, got, test.Want, - ) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/doc.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/doc.go deleted file mode 100644 index 8db1157..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/doc.go +++ /dev/null @@ -1,7 +0,0 @@ -// Package hclsyntax contains the parser, AST, etc for zcl's native language, -// as opposed to the JSON variant. -// -// In normal use applications should rarely depend on this package directly, -// instead preferring the higher-level interface of the main hcl package and -// its companion hclparse. -package hclsyntax diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go deleted file mode 100644 index 58b6b15..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression.go +++ /dev/null @@ -1,1135 +0,0 @@ -package hclsyntax - -import ( - "fmt" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/function" -) - -// Expression is the abstract type for nodes that behave as zcl expressions. -type Expression interface { - Node - - // The hcl.Expression methods are duplicated here, rather than simply - // embedded, because both Node and hcl.Expression have a Range method - // and so they conflict. - - Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) - Variables() []hcl.Traversal - StartRange() hcl.Range -} - -// Assert that Expression implements hcl.Expression -var assertExprImplExpr hcl.Expression = Expression(nil) - -// LiteralValueExpr is an expression that just always returns a given value. -type LiteralValueExpr struct { - Val cty.Value - SrcRange hcl.Range -} - -func (e *LiteralValueExpr) walkChildNodes(w internalWalkFunc) { - // Literal values have no child nodes -} - -func (e *LiteralValueExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.Val, nil -} - -func (e *LiteralValueExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *LiteralValueExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// ScopeTraversalExpr is an Expression that retrieves a value from the scope -// using a traversal. -type ScopeTraversalExpr struct { - Traversal hcl.Traversal - SrcRange hcl.Range -} - -func (e *ScopeTraversalExpr) walkChildNodes(w internalWalkFunc) { - // Scope traversals have no child nodes -} - -func (e *ScopeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.Traversal.TraverseAbs(ctx) -} - -func (e *ScopeTraversalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ScopeTraversalExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *ScopeTraversalExpr) AsTraversal() hcl.Traversal { - return e.Traversal -} - -// RelativeTraversalExpr is an Expression that retrieves a value from another -// value using a _relative_ traversal. -type RelativeTraversalExpr struct { - Source Expression - Traversal hcl.Traversal - SrcRange hcl.Range -} - -func (e *RelativeTraversalExpr) walkChildNodes(w internalWalkFunc) { - // Scope traversals have no child nodes -} - -func (e *RelativeTraversalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - src, diags := e.Source.Value(ctx) - ret, travDiags := e.Traversal.TraverseRel(src) - diags = append(diags, travDiags...) - return ret, diags -} - -func (e *RelativeTraversalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *RelativeTraversalExpr) StartRange() hcl.Range { - return e.SrcRange -} - -// FunctionCallExpr is an Expression that calls a function from the EvalContext -// and returns its result. -type FunctionCallExpr struct { - Name string - Args []Expression - - // If true, the final argument should be a tuple, list or set which will - // expand to be one argument per element. - ExpandFinal bool - - NameRange hcl.Range - OpenParenRange hcl.Range - CloseParenRange hcl.Range -} - -func (e *FunctionCallExpr) walkChildNodes(w internalWalkFunc) { - for i, arg := range e.Args { - e.Args[i] = w(arg).(Expression) - } -} - -func (e *FunctionCallExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - var f function.Function - exists := false - hasNonNilMap := false - thisCtx := ctx - for thisCtx != nil { - if thisCtx.Functions == nil { - thisCtx = thisCtx.Parent() - continue - } - hasNonNilMap = true - f, exists = thisCtx.Functions[e.Name] - if exists { - break - } - thisCtx = thisCtx.Parent() - } - - if !exists { - if !hasNonNilMap { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Function calls not allowed", - Detail: "Functions may not be called here.", - Subject: e.Range().Ptr(), - }, - } - } - - avail := make([]string, 0, len(ctx.Functions)) - for name := range ctx.Functions { - avail = append(avail, name) - } - suggestion := nameSuggestion(e.Name, avail) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Call to unknown function", - Detail: fmt.Sprintf("There is no function named %q.%s", e.Name, suggestion), - Subject: &e.NameRange, - Context: e.Range().Ptr(), - }, - } - } - - params := f.Params() - varParam := f.VarParam() - - args := e.Args - if e.ExpandFinal { - if len(args) < 1 { - // should never happen if the parser is behaving - panic("ExpandFinal set on function call with no arguments") - } - expandExpr := args[len(args)-1] - expandVal, expandDiags := expandExpr.Value(ctx) - diags = append(diags, expandDiags...) - if expandDiags.HasErrors() { - return cty.DynamicVal, diags - } - - switch { - case expandVal.Type().IsTupleType() || expandVal.Type().IsListType() || expandVal.Type().IsSetType(): - if expandVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expanding argument value", - Detail: "The expanding argument (indicated by ...) must not be null.", - Context: expandExpr.Range().Ptr(), - Subject: e.Range().Ptr(), - }) - return cty.DynamicVal, diags - } - if !expandVal.IsKnown() { - return cty.DynamicVal, diags - } - - newArgs := make([]Expression, 0, (len(args)-1)+expandVal.LengthInt()) - newArgs = append(newArgs, args[:len(args)-1]...) - it := expandVal.ElementIterator() - for it.Next() { - _, val := it.Element() - newArgs = append(newArgs, &LiteralValueExpr{ - Val: val, - SrcRange: expandExpr.Range(), - }) - } - args = newArgs - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expanding argument value", - Detail: "The expanding argument (indicated by ...) must be of a tuple, list, or set type.", - Context: expandExpr.Range().Ptr(), - Subject: e.Range().Ptr(), - }) - return cty.DynamicVal, diags - } - } - - if len(args) < len(params) { - missing := params[len(args)] - qual := "" - if varParam != nil { - qual = " at least" - } - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Not enough function arguments", - Detail: fmt.Sprintf( - "Function %q expects%s %d argument(s). Missing value for %q.", - e.Name, qual, len(params), missing.Name, - ), - Subject: &e.CloseParenRange, - Context: e.Range().Ptr(), - }, - } - } - - if varParam == nil && len(args) > len(params) { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Too many function arguments", - Detail: fmt.Sprintf( - "Function %q expects only %d argument(s).", - e.Name, len(params), - ), - Subject: args[len(params)].StartRange().Ptr(), - Context: e.Range().Ptr(), - }, - } - } - - argVals := make([]cty.Value, len(args)) - - for i, argExpr := range args { - var param *function.Parameter - if i < len(params) { - param = ¶ms[i] - } else { - param = varParam - } - - val, argDiags := argExpr.Value(ctx) - if len(argDiags) > 0 { - diags = append(diags, argDiags...) - } - - // Try to convert our value to the parameter type - val, err := convert.Convert(val, param.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid function argument", - Detail: fmt.Sprintf( - "Invalid value for %q parameter: %s.", - param.Name, err, - ), - Subject: argExpr.StartRange().Ptr(), - Context: e.Range().Ptr(), - }) - } - - argVals[i] = val - } - - if diags.HasErrors() { - // Don't try to execute the function if we already have errors with - // the arguments, because the result will probably be a confusing - // error message. - return cty.DynamicVal, diags - } - - resultVal, err := f.Call(argVals) - if err != nil { - switch terr := err.(type) { - case function.ArgError: - i := terr.Index - var param *function.Parameter - if i < len(params) { - param = ¶ms[i] - } else { - param = varParam - } - argExpr := e.Args[i] - - // TODO: we should also unpick a PathError here and show the - // path to the deep value where the error was detected. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid function argument", - Detail: fmt.Sprintf( - "Invalid value for %q parameter: %s.", - param.Name, err, - ), - Subject: argExpr.StartRange().Ptr(), - Context: e.Range().Ptr(), - }) - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Error in function call", - Detail: fmt.Sprintf( - "Call to function %q failed: %s.", - e.Name, err, - ), - Subject: e.StartRange().Ptr(), - Context: e.Range().Ptr(), - }) - } - - return cty.DynamicVal, diags - } - - return resultVal, diags -} - -func (e *FunctionCallExpr) Range() hcl.Range { - return hcl.RangeBetween(e.NameRange, e.CloseParenRange) -} - -func (e *FunctionCallExpr) StartRange() hcl.Range { - return hcl.RangeBetween(e.NameRange, e.OpenParenRange) -} - -type ConditionalExpr struct { - Condition Expression - TrueResult Expression - FalseResult Expression - - SrcRange hcl.Range -} - -func (e *ConditionalExpr) walkChildNodes(w internalWalkFunc) { - e.Condition = w(e.Condition).(Expression) - e.TrueResult = w(e.TrueResult).(Expression) - e.FalseResult = w(e.FalseResult).(Expression) -} - -func (e *ConditionalExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - trueResult, trueDiags := e.TrueResult.Value(ctx) - falseResult, falseDiags := e.FalseResult.Value(ctx) - var diags hcl.Diagnostics - - // Try to find a type that both results can be converted to. - resultType, convs := convert.UnifyUnsafe([]cty.Type{trueResult.Type(), falseResult.Type()}) - if resultType == cty.NilType { - return cty.DynamicVal, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - // FIXME: Need a helper function for showing natural-language type diffs, - // since this will generate some useless messages in some cases, like - // "These expressions are object and object respectively" if the - // object types don't exactly match. - "The true and false result expressions must have consistent types. The given expressions are %s and %s, respectively.", - trueResult.Type(), falseResult.Type(), - ), - Subject: hcl.RangeBetween(e.TrueResult.Range(), e.FalseResult.Range()).Ptr(), - Context: &e.SrcRange, - }, - } - } - - condResult, condDiags := e.Condition.Value(ctx) - diags = append(diags, condDiags...) - if condResult.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Null condition", - Detail: "The condition value is null. Conditions must either be true or false.", - Subject: e.Condition.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.UnknownVal(resultType), diags - } - if !condResult.IsKnown() { - return cty.UnknownVal(resultType), diags - } - condResult, err := convert.Convert(condResult, cty.Bool) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect condition type", - Detail: fmt.Sprintf("The condition expression must be of type bool."), - Subject: e.Condition.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.UnknownVal(resultType), diags - } - - if condResult.True() { - diags = append(diags, trueDiags...) - if convs[0] != nil { - var err error - trueResult, err = convs[0](trueResult) - if err != nil { - // Unsafe conversion failed with the concrete result value - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - "The true result value has the wrong type: %s.", - err.Error(), - ), - Subject: e.TrueResult.Range().Ptr(), - Context: &e.SrcRange, - }) - trueResult = cty.UnknownVal(resultType) - } - } - return trueResult, diags - } else { - diags = append(diags, falseDiags...) - if convs[1] != nil { - var err error - falseResult, err = convs[1](falseResult) - if err != nil { - // Unsafe conversion failed with the concrete result value - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Inconsistent conditional result types", - Detail: fmt.Sprintf( - "The false result value has the wrong type: %s.", - err.Error(), - ), - Subject: e.TrueResult.Range().Ptr(), - Context: &e.SrcRange, - }) - falseResult = cty.UnknownVal(resultType) - } - } - return falseResult, diags - } -} - -func (e *ConditionalExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ConditionalExpr) StartRange() hcl.Range { - return e.Condition.StartRange() -} - -type IndexExpr struct { - Collection Expression - Key Expression - - SrcRange hcl.Range - OpenRange hcl.Range -} - -func (e *IndexExpr) walkChildNodes(w internalWalkFunc) { - e.Collection = w(e.Collection).(Expression) - e.Key = w(e.Key).(Expression) -} - -func (e *IndexExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - coll, collDiags := e.Collection.Value(ctx) - key, keyDiags := e.Key.Value(ctx) - diags = append(diags, collDiags...) - diags = append(diags, keyDiags...) - - return hcl.Index(coll, key, &e.SrcRange) -} - -func (e *IndexExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *IndexExpr) StartRange() hcl.Range { - return e.OpenRange -} - -type TupleConsExpr struct { - Exprs []Expression - - SrcRange hcl.Range - OpenRange hcl.Range -} - -func (e *TupleConsExpr) walkChildNodes(w internalWalkFunc) { - for i, expr := range e.Exprs { - e.Exprs[i] = w(expr).(Expression) - } -} - -func (e *TupleConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var vals []cty.Value - var diags hcl.Diagnostics - - vals = make([]cty.Value, len(e.Exprs)) - for i, expr := range e.Exprs { - val, valDiags := expr.Value(ctx) - vals[i] = val - diags = append(diags, valDiags...) - } - - return cty.TupleVal(vals), diags -} - -func (e *TupleConsExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TupleConsExpr) StartRange() hcl.Range { - return e.OpenRange -} - -// Implementation for hcl.ExprList -func (e *TupleConsExpr) ExprList() []hcl.Expression { - ret := make([]hcl.Expression, len(e.Exprs)) - for i, expr := range e.Exprs { - ret[i] = expr - } - return ret -} - -type ObjectConsExpr struct { - Items []ObjectConsItem - - SrcRange hcl.Range - OpenRange hcl.Range -} - -type ObjectConsItem struct { - KeyExpr Expression - ValueExpr Expression -} - -func (e *ObjectConsExpr) walkChildNodes(w internalWalkFunc) { - for i, item := range e.Items { - e.Items[i].KeyExpr = w(item.KeyExpr).(Expression) - e.Items[i].ValueExpr = w(item.ValueExpr).(Expression) - } -} - -func (e *ObjectConsExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var vals map[string]cty.Value - var diags hcl.Diagnostics - - // This will get set to true if we fail to produce any of our keys, - // either because they are actually unknown or if the evaluation produces - // errors. In all of these case we must return DynamicPseudoType because - // we're unable to know the full set of keys our object has, and thus - // we can't produce a complete value of the intended type. - // - // We still evaluate all of the item keys and values to make sure that we - // get as complete as possible a set of diagnostics. - known := true - - vals = make(map[string]cty.Value, len(e.Items)) - for _, item := range e.Items { - key, keyDiags := item.KeyExpr.Value(ctx) - diags = append(diags, keyDiags...) - - val, valDiags := item.ValueExpr.Value(ctx) - diags = append(diags, valDiags...) - - if keyDiags.HasErrors() { - known = false - continue - } - - if key.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Null value as key", - Detail: "Can't use a null value as a key.", - Subject: item.ValueExpr.Range().Ptr(), - }) - known = false - continue - } - - var err error - key, err = convert.Convert(key, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect key type", - Detail: fmt.Sprintf("Can't use this value as a key: %s.", err.Error()), - Subject: item.ValueExpr.Range().Ptr(), - }) - known = false - continue - } - - if !key.IsKnown() { - known = false - continue - } - - keyStr := key.AsString() - - vals[keyStr] = val - } - - if !known { - return cty.DynamicVal, diags - } - - return cty.ObjectVal(vals), diags -} - -func (e *ObjectConsExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ObjectConsExpr) StartRange() hcl.Range { - return e.OpenRange -} - -// ForExpr represents iteration constructs: -// -// tuple = [for i, v in list: upper(v) if i > 2] -// object = {for k, v in map: k => upper(v)} -// object_of_tuples = {for v in list: v.key: v...} -type ForExpr struct { - KeyVar string // empty if ignoring the key - ValVar string - - CollExpr Expression - - KeyExpr Expression // nil when producing a tuple - ValExpr Expression - CondExpr Expression // null if no "if" clause is present - - Group bool // set if the ellipsis is used on the value in an object for - - SrcRange hcl.Range - OpenRange hcl.Range - CloseRange hcl.Range -} - -func (e *ForExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - collVal, collDiags := e.CollExpr.Value(ctx) - diags = append(diags, collDiags...) - - if collVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Iteration over null value", - Detail: "A null value cannot be used as the collection in a 'for' expression.", - Subject: e.CollExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.DynamicVal, diags - } - if collVal.Type() == cty.DynamicPseudoType { - return cty.DynamicVal, diags - } - if !collVal.CanIterateElements() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Iteration over non-iterable value", - Detail: fmt.Sprintf( - "A value of type %s cannot be used as the collection in a 'for' expression.", - collVal.Type().FriendlyName(), - ), - Subject: e.CollExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.DynamicVal, diags - } - if !collVal.IsKnown() { - return cty.DynamicVal, diags - } - - childCtx := ctx.NewChild() - childCtx.Variables = map[string]cty.Value{} - - // Before we start we'll do an early check to see if any CondExpr we've - // been given is of the wrong type. This isn't 100% reliable (it may - // be DynamicVal until real values are given) but it should catch some - // straightforward cases and prevent a barrage of repeated errors. - if e.CondExpr != nil { - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = cty.DynamicVal - } - childCtx.Variables[e.ValVar] = cty.DynamicVal - - result, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if result.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Condition is null", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.DynamicVal, diags - } - _, err := convert.Convert(result, cty.Bool) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - return cty.DynamicVal, diags - } - if condDiags.HasErrors() { - return cty.DynamicVal, diags - } - } - - if e.KeyExpr != nil { - // Producing an object - var vals map[string]cty.Value - var groupVals map[string][]cty.Value - if e.Group { - groupVals = map[string][]cty.Value{} - } else { - vals = map[string]cty.Value{} - } - - it := collVal.ElementIterator() - - known := true - for it.Next() { - k, v := it.Element() - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = k - } - childCtx.Variables[e.ValVar] = v - - if e.CondExpr != nil { - includeRaw, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if includeRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Condition is null", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - include, err := convert.Convert(includeRaw, cty.Bool) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - if !include.IsKnown() { - known = false - continue - } - - if include.False() { - // Skip this element - continue - } - } - - keyRaw, keyDiags := e.KeyExpr.Value(childCtx) - diags = append(diags, keyDiags...) - if keyRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key", - Detail: "Key expression in 'for' expression must not produce a null value.", - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - if !keyRaw.IsKnown() { - known = false - continue - } - - key, err := convert.Convert(keyRaw, cty.String) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid object key", - Detail: fmt.Sprintf("The key expression produced an invalid result: %s.", err.Error()), - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - - val, valDiags := e.ValExpr.Value(childCtx) - diags = append(diags, valDiags...) - - if e.Group { - k := key.AsString() - groupVals[k] = append(groupVals[k], val) - } else { - k := key.AsString() - if _, exists := vals[k]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Duplicate object key", - Detail: fmt.Sprintf( - "Two different items produced the key %q in this for expression. If duplicates are expected, use the ellipsis (...) after the value expression to enable grouping by key.", - k, - ), - Subject: e.KeyExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } else { - vals[key.AsString()] = val - } - } - } - - if !known { - return cty.DynamicVal, diags - } - - if e.Group { - vals = map[string]cty.Value{} - for k, gvs := range groupVals { - vals[k] = cty.TupleVal(gvs) - } - } - - return cty.ObjectVal(vals), diags - - } else { - // Producing a tuple - vals := []cty.Value{} - - it := collVal.ElementIterator() - - known := true - for it.Next() { - k, v := it.Element() - if e.KeyVar != "" { - childCtx.Variables[e.KeyVar] = k - } - childCtx.Variables[e.ValVar] = v - - if e.CondExpr != nil { - includeRaw, condDiags := e.CondExpr.Value(childCtx) - diags = append(diags, condDiags...) - if includeRaw.IsNull() { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Condition is null", - Detail: "The value of the 'if' clause must not be null.", - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - if !includeRaw.IsKnown() { - // We will eventually return DynamicVal, but we'll continue - // iterating in case there are other diagnostics to gather - // for later elements. - known = false - continue - } - - include, err := convert.Convert(includeRaw, cty.Bool) - if err != nil { - if known { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' condition", - Detail: fmt.Sprintf("The 'if' clause value is invalid: %s.", err.Error()), - Subject: e.CondExpr.Range().Ptr(), - Context: &e.SrcRange, - }) - } - known = false - continue - } - - if include.False() { - // Skip this element - continue - } - } - - val, valDiags := e.ValExpr.Value(childCtx) - diags = append(diags, valDiags...) - vals = append(vals, val) - } - - if !known { - return cty.DynamicVal, diags - } - - return cty.TupleVal(vals), diags - } -} - -func (e *ForExpr) walkChildNodes(w internalWalkFunc) { - e.CollExpr = w(e.CollExpr).(Expression) - - scopeNames := map[string]struct{}{} - if e.KeyVar != "" { - scopeNames[e.KeyVar] = struct{}{} - } - if e.ValVar != "" { - scopeNames[e.ValVar] = struct{}{} - } - - if e.KeyExpr != nil { - w(ChildScope{ - LocalNames: scopeNames, - Expr: &e.KeyExpr, - }) - } - w(ChildScope{ - LocalNames: scopeNames, - Expr: &e.ValExpr, - }) - if e.CondExpr != nil { - w(ChildScope{ - LocalNames: scopeNames, - Expr: &e.CondExpr, - }) - } -} - -func (e *ForExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *ForExpr) StartRange() hcl.Range { - return e.OpenRange -} - -type SplatExpr struct { - Source Expression - Each Expression - Item *AnonSymbolExpr - - SrcRange hcl.Range - MarkerRange hcl.Range -} - -func (e *SplatExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - sourceVal, diags := e.Source.Value(ctx) - if diags.HasErrors() { - // We'll evaluate our "Each" expression here just to see if it - // produces any more diagnostics we can report. Since we're not - // assigning a value to our AnonSymbolExpr here it will return - // DynamicVal, which should short-circuit any use of it. - _, itemDiags := e.Item.Value(ctx) - diags = append(diags, itemDiags...) - return cty.DynamicVal, diags - } - - if sourceVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Splat of null value", - Detail: "Splat expressions (with the * symbol) cannot be applied to null values.", - Subject: e.Source.Range().Ptr(), - Context: hcl.RangeBetween(e.Source.Range(), e.MarkerRange).Ptr(), - }) - return cty.DynamicVal, diags - } - if !sourceVal.IsKnown() { - return cty.DynamicVal, diags - } - - // A "special power" of splat expressions is that they can be applied - // both to tuples/lists and to other values, and in the latter case - // the value will be treated as an implicit single-value list. We'll - // deal with that here first. - if !(sourceVal.Type().IsTupleType() || sourceVal.Type().IsListType()) { - sourceVal = cty.ListVal([]cty.Value{sourceVal}) - } - - vals := make([]cty.Value, 0, sourceVal.LengthInt()) - it := sourceVal.ElementIterator() - if ctx == nil { - // we need a context to use our AnonSymbolExpr, so we'll just - // make an empty one here to use as a placeholder. - ctx = ctx.NewChild() - } - isKnown := true - for it.Next() { - _, sourceItem := it.Element() - e.Item.setValue(ctx, sourceItem) - newItem, itemDiags := e.Each.Value(ctx) - diags = append(diags, itemDiags...) - if itemDiags.HasErrors() { - isKnown = false - } - vals = append(vals, newItem) - } - e.Item.clearValue(ctx) // clean up our temporary value - - if !isKnown { - return cty.DynamicVal, diags - } - - return cty.TupleVal(vals), diags -} - -func (e *SplatExpr) walkChildNodes(w internalWalkFunc) { - e.Source = w(e.Source).(Expression) - e.Each = w(e.Each).(Expression) -} - -func (e *SplatExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *SplatExpr) StartRange() hcl.Range { - return e.MarkerRange -} - -// AnonSymbolExpr is used as a placeholder for a value in an expression that -// can be applied dynamically to any value at runtime. -// -// This is a rather odd, synthetic expression. It is used as part of the -// representation of splat expressions as a placeholder for the current item -// being visited in the splat evaluation. -// -// AnonSymbolExpr cannot be evaluated in isolation. If its Value is called -// directly then cty.DynamicVal will be returned. Instead, it is evaluated -// in terms of another node (i.e. a splat expression) which temporarily -// assigns it a value. -type AnonSymbolExpr struct { - SrcRange hcl.Range - values map[*hcl.EvalContext]cty.Value -} - -func (e *AnonSymbolExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - if ctx == nil { - return cty.DynamicVal, nil - } - val, exists := e.values[ctx] - if !exists { - return cty.DynamicVal, nil - } - return val, nil -} - -// setValue sets a temporary local value for the expression when evaluated -// in the given context, which must be non-nil. -func (e *AnonSymbolExpr) setValue(ctx *hcl.EvalContext, val cty.Value) { - if e.values == nil { - e.values = make(map[*hcl.EvalContext]cty.Value) - } - if ctx == nil { - panic("can't setValue for a nil EvalContext") - } - e.values[ctx] = val -} - -func (e *AnonSymbolExpr) clearValue(ctx *hcl.EvalContext) { - if e.values == nil { - return - } - if ctx == nil { - panic("can't clearValue for a nil EvalContext") - } - delete(e.values, ctx) -} - -func (e *AnonSymbolExpr) walkChildNodes(w internalWalkFunc) { - // AnonSymbolExpr is a leaf node in the tree -} - -func (e *AnonSymbolExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *AnonSymbolExpr) StartRange() hcl.Range { - return e.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_ops.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_ops.go deleted file mode 100644 index 9a5da04..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_ops.go +++ /dev/null @@ -1,258 +0,0 @@ -package hclsyntax - -import ( - "fmt" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" - "github.com/zclconf/go-cty/cty/function" - "github.com/zclconf/go-cty/cty/function/stdlib" -) - -type Operation struct { - Impl function.Function - Type cty.Type -} - -var ( - OpLogicalOr = &Operation{ - Impl: stdlib.OrFunc, - Type: cty.Bool, - } - OpLogicalAnd = &Operation{ - Impl: stdlib.AndFunc, - Type: cty.Bool, - } - OpLogicalNot = &Operation{ - Impl: stdlib.NotFunc, - Type: cty.Bool, - } - - OpEqual = &Operation{ - Impl: stdlib.EqualFunc, - Type: cty.Bool, - } - OpNotEqual = &Operation{ - Impl: stdlib.NotEqualFunc, - Type: cty.Bool, - } - - OpGreaterThan = &Operation{ - Impl: stdlib.GreaterThanFunc, - Type: cty.Bool, - } - OpGreaterThanOrEqual = &Operation{ - Impl: stdlib.GreaterThanOrEqualToFunc, - Type: cty.Bool, - } - OpLessThan = &Operation{ - Impl: stdlib.LessThanFunc, - Type: cty.Bool, - } - OpLessThanOrEqual = &Operation{ - Impl: stdlib.LessThanOrEqualToFunc, - Type: cty.Bool, - } - - OpAdd = &Operation{ - Impl: stdlib.AddFunc, - Type: cty.Number, - } - OpSubtract = &Operation{ - Impl: stdlib.SubtractFunc, - Type: cty.Number, - } - OpMultiply = &Operation{ - Impl: stdlib.MultiplyFunc, - Type: cty.Number, - } - OpDivide = &Operation{ - Impl: stdlib.DivideFunc, - Type: cty.Number, - } - OpModulo = &Operation{ - Impl: stdlib.ModuloFunc, - Type: cty.Number, - } - OpNegate = &Operation{ - Impl: stdlib.NegateFunc, - Type: cty.Number, - } -) - -var binaryOps []map[TokenType]*Operation - -func init() { - // This operation table maps from the operator's token type - // to the AST operation type. All expressions produced from - // binary operators are BinaryOp nodes. - // - // Binary operator groups are listed in order of precedence, with - // the *lowest* precedence first. Operators within the same group - // have left-to-right associativity. - binaryOps = []map[TokenType]*Operation{ - { - TokenOr: OpLogicalOr, - }, - { - TokenAnd: OpLogicalAnd, - }, - { - TokenEqualOp: OpEqual, - TokenNotEqual: OpNotEqual, - }, - { - TokenGreaterThan: OpGreaterThan, - TokenGreaterThanEq: OpGreaterThanOrEqual, - TokenLessThan: OpLessThan, - TokenLessThanEq: OpLessThanOrEqual, - }, - { - TokenPlus: OpAdd, - TokenMinus: OpSubtract, - }, - { - TokenStar: OpMultiply, - TokenSlash: OpDivide, - TokenPercent: OpModulo, - }, - } -} - -type BinaryOpExpr struct { - LHS Expression - Op *Operation - RHS Expression - - SrcRange hcl.Range -} - -func (e *BinaryOpExpr) walkChildNodes(w internalWalkFunc) { - e.LHS = w(e.LHS).(Expression) - e.RHS = w(e.RHS).(Expression) -} - -func (e *BinaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - impl := e.Op.Impl // assumed to be a function taking exactly two arguments - params := impl.Params() - lhsParam := params[0] - rhsParam := params[1] - - var diags hcl.Diagnostics - - givenLHSVal, lhsDiags := e.LHS.Value(ctx) - givenRHSVal, rhsDiags := e.RHS.Value(ctx) - diags = append(diags, lhsDiags...) - diags = append(diags, rhsDiags...) - - lhsVal, err := convert.Convert(givenLHSVal, lhsParam.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for left operand: %s.", err), - Subject: e.LHS.Range().Ptr(), - Context: &e.SrcRange, - }) - } - rhsVal, err := convert.Convert(givenRHSVal, rhsParam.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for right operand: %s.", err), - Subject: e.RHS.Range().Ptr(), - Context: &e.SrcRange, - }) - } - - if diags.HasErrors() { - // Don't actually try the call if we have errors already, since the - // this will probably just produce a confusing duplicative diagnostic. - return cty.UnknownVal(e.Op.Type), diags - } - - args := []cty.Value{lhsVal, rhsVal} - result, err := impl.Call(args) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - // FIXME: This diagnostic is useless. - Severity: hcl.DiagError, - Summary: "Operation failed", - Detail: fmt.Sprintf("Error during operation: %s.", err), - Subject: &e.SrcRange, - }) - return cty.UnknownVal(e.Op.Type), diags - } - - return result, diags -} - -func (e *BinaryOpExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *BinaryOpExpr) StartRange() hcl.Range { - return e.LHS.StartRange() -} - -type UnaryOpExpr struct { - Op *Operation - Val Expression - - SrcRange hcl.Range - SymbolRange hcl.Range -} - -func (e *UnaryOpExpr) walkChildNodes(w internalWalkFunc) { - e.Val = w(e.Val).(Expression) -} - -func (e *UnaryOpExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - impl := e.Op.Impl // assumed to be a function taking exactly one argument - params := impl.Params() - param := params[0] - - givenVal, diags := e.Val.Value(ctx) - - val, err := convert.Convert(givenVal, param.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid operand", - Detail: fmt.Sprintf("Unsuitable value for unary operand: %s.", err), - Subject: e.Val.Range().Ptr(), - Context: &e.SrcRange, - }) - } - - if diags.HasErrors() { - // Don't actually try the call if we have errors already, since the - // this will probably just produce a confusing duplicative diagnostic. - return cty.UnknownVal(e.Op.Type), diags - } - - args := []cty.Value{val} - result, err := impl.Call(args) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - // FIXME: This diagnostic is useless. - Severity: hcl.DiagError, - Summary: "Operation failed", - Detail: fmt.Sprintf("Error during operation: %s.", err), - Subject: &e.SrcRange, - }) - return cty.UnknownVal(e.Op.Type), diags - } - - return result, diags -} - -func (e *UnaryOpExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *UnaryOpExpr) StartRange() hcl.Range { - return e.SymbolRange -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go deleted file mode 100644 index a1c4727..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template.go +++ /dev/null @@ -1,192 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -type TemplateExpr struct { - Parts []Expression - - SrcRange hcl.Range -} - -func (e *TemplateExpr) walkChildNodes(w internalWalkFunc) { - for i, part := range e.Parts { - e.Parts[i] = w(part).(Expression) - } -} - -func (e *TemplateExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - buf := &bytes.Buffer{} - var diags hcl.Diagnostics - isKnown := true - - for _, part := range e.Parts { - partVal, partDiags := part.Value(ctx) - diags = append(diags, partDiags...) - - if partVal.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "The expression result is null. Cannot include a null value in a string template.", - ), - Subject: part.Range().Ptr(), - Context: &e.SrcRange, - }) - continue - } - - if !partVal.IsKnown() { - // If any part is unknown then the result as a whole must be - // unknown too. We'll keep on processing the rest of the parts - // anyway, because we want to still emit any diagnostics resulting - // from evaluating those. - isKnown = false - continue - } - - strVal, err := convert.Convert(partVal, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "Cannot include the given value in a string template: %s.", - err.Error(), - ), - Subject: part.Range().Ptr(), - Context: &e.SrcRange, - }) - continue - } - - buf.WriteString(strVal.AsString()) - } - - if !isKnown { - return cty.UnknownVal(cty.String), diags - } - - return cty.StringVal(buf.String()), diags -} - -func (e *TemplateExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TemplateExpr) StartRange() hcl.Range { - return e.Parts[0].StartRange() -} - -// TemplateJoinExpr is used to convert tuples of strings produced by template -// constructs (i.e. for loops) into flat strings, by converting the values -// tos strings and joining them. This AST node is not used directly; it's -// produced as part of the AST of a "for" loop in a template. -type TemplateJoinExpr struct { - Tuple Expression -} - -func (e *TemplateJoinExpr) walkChildNodes(w internalWalkFunc) { - e.Tuple = w(e.Tuple).(Expression) -} - -func (e *TemplateJoinExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - tuple, diags := e.Tuple.Value(ctx) - - if tuple.IsNull() { - // This indicates a bug in the code that constructed the AST. - panic("TemplateJoinExpr got null tuple") - } - if tuple.Type() == cty.DynamicPseudoType { - return cty.UnknownVal(cty.String), diags - } - if !tuple.Type().IsTupleType() { - // This indicates a bug in the code that constructed the AST. - panic("TemplateJoinExpr got non-tuple tuple") - } - if !tuple.IsKnown() { - return cty.UnknownVal(cty.String), diags - } - - buf := &bytes.Buffer{} - it := tuple.ElementIterator() - for it.Next() { - _, val := it.Element() - - if val.IsNull() { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "An iteration result is null. Cannot include a null value in a string template.", - ), - Subject: e.Range().Ptr(), - }) - continue - } - if val.Type() == cty.DynamicPseudoType { - return cty.UnknownVal(cty.String), diags - } - strVal, err := convert.Convert(val, cty.String) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template interpolation value", - Detail: fmt.Sprintf( - "Cannot include one of the interpolation results into the string template: %s.", - err.Error(), - ), - Subject: e.Range().Ptr(), - }) - continue - } - if !val.IsKnown() { - return cty.UnknownVal(cty.String), diags - } - - buf.WriteString(strVal.AsString()) - } - - return cty.StringVal(buf.String()), diags -} - -func (e *TemplateJoinExpr) Range() hcl.Range { - return e.Tuple.Range() -} - -func (e *TemplateJoinExpr) StartRange() hcl.Range { - return e.Tuple.StartRange() -} - -// TemplateWrapExpr is used instead of a TemplateExpr when a template -// consists _only_ of a single interpolation sequence. In that case, the -// template's result is the single interpolation's result, verbatim with -// no type conversions. -type TemplateWrapExpr struct { - Wrapped Expression - - SrcRange hcl.Range -} - -func (e *TemplateWrapExpr) walkChildNodes(w internalWalkFunc) { - e.Wrapped = w(e.Wrapped).(Expression) -} - -func (e *TemplateWrapExpr) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return e.Wrapped.Value(ctx) -} - -func (e *TemplateWrapExpr) Range() hcl.Range { - return e.SrcRange -} - -func (e *TemplateWrapExpr) StartRange() hcl.Range { - return e.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template_test.go deleted file mode 100644 index e769613..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_template_test.go +++ /dev/null @@ -1,246 +0,0 @@ -package hclsyntax - -import ( - "testing" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -func TestTemplateExprParseAndValue(t *testing.T) { - // This is a combo test that exercises both the parser and the Value - // method, with the focus on the latter but indirectly testing the former. - tests := []struct { - input string - ctx *hcl.EvalContext - want cty.Value - diagCount int - }{ - { - `1`, - nil, - cty.StringVal("1"), - 0, - }, - { - `(1)`, - nil, - cty.StringVal("(1)"), - 0, - }, - { - `true`, - nil, - cty.StringVal("true"), - 0, - }, - { - ` -hello world -`, - nil, - cty.StringVal("\nhello world\n"), - 0, - }, - { - `hello ${"world"}`, - nil, - cty.StringVal("hello world"), - 0, - }, - { - `hello\nworld`, // backslash escapes not supported in bare templates - nil, - cty.StringVal("hello\\nworld"), - 0, - }, - { - `hello ${12.5}`, - nil, - cty.StringVal("hello 12.5"), - 0, - }, - { - `silly ${"${"nesting"}"}`, - nil, - cty.StringVal("silly nesting"), - 0, - }, - { - `silly ${"${true}"}`, - nil, - cty.StringVal("silly true"), - 0, - }, - { - `hello $${escaped}`, - nil, - cty.StringVal("hello ${escaped}"), - 0, - }, - { - `hello $$nonescape`, - nil, - cty.StringVal("hello $$nonescape"), - 0, - }, - { - `${true}`, - nil, - cty.True, // any single expression is unwrapped without stringification - 0, - }, - { - `trim ${~ "trim"}`, - nil, - cty.StringVal("trimtrim"), - 0, - }, - { - `${"trim" ~} trim`, - nil, - cty.StringVal("trimtrim"), - 0, - }, - { - `trim -${~"trim"~} -trim`, - nil, - cty.StringVal("trimtrimtrim"), - 0, - }, - { - ` ${~ true ~} `, - nil, - cty.StringVal("true"), // can't trim space to reduce to a single expression - 0, - }, - { - `${"hello "}${~"trim"~}${" hello"}`, - nil, - cty.StringVal("hello trim hello"), // trimming can't reach into a neighboring interpolation - 0, - }, - { - `${true}${~"trim"~}${true}`, - nil, - cty.StringVal("truetrimtrue"), // trimming is no-op of neighbors aren't literal strings - 0, - }, - - { - `%{ if true ~} hello %{~ endif }`, - nil, - cty.StringVal("hello"), - 0, - }, - { - `%{ if false ~} hello %{~ endif}`, - nil, - cty.StringVal(""), - 0, - }, - { - `%{ if true ~} hello %{~ else ~} goodbye %{~ endif }`, - nil, - cty.StringVal("hello"), - 0, - }, - { - `%{ if false ~} hello %{~ else ~} goodbye %{~ endif }`, - nil, - cty.StringVal("goodbye"), - 0, - }, - { - `%{ if true ~} %{~ if false ~} hello %{~ else ~} goodbye %{~ endif ~} %{~ endif }`, - nil, - cty.StringVal("goodbye"), - 0, - }, - { - `%{ if false ~} %{~ if false ~} hello %{~ else ~} goodbye %{~ endif ~} %{~ endif }`, - nil, - cty.StringVal(""), - 0, - }, - { - `%{ of true ~} hello %{~ endif}`, - nil, - cty.UnknownVal(cty.String), - 2, // "of" is not a valid control keyword, and "endif" is therefore also unexpected - }, - { - `%{ for v in ["a", "b", "c"] }${v}%{ endfor }`, - nil, - cty.StringVal("abc"), - 0, - }, - { - `%{ for v in ["a", "b", "c"] } ${v} %{ endfor }`, - nil, - cty.StringVal(" a b c "), - 0, - }, - { - `%{ for v in ["a", "b", "c"] ~} ${v} %{~ endfor }`, - nil, - cty.StringVal("abc"), - 0, - }, - { - `%{ for v in [] }${v}%{ endfor }`, - nil, - cty.StringVal(""), - 0, - }, - { - `%{ for i, v in ["a", "b", "c"] }${i}${v}%{ endfor }`, - nil, - cty.StringVal("0a1b2c"), - 0, - }, - { - `%{ for k, v in {"A" = "a", "B" = "b", "C" = "c"} }${k}${v}%{ endfor }`, - nil, - cty.StringVal("AaBbCc"), - 0, - }, - { - `%{ for v in ["a", "b", "c"] }${v}${nl}%{ endfor }`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "nl": cty.StringVal("\n"), - }, - }, - cty.StringVal("a\nb\nc\n"), - 0, - }, - } - - for _, test := range tests { - t.Run(test.input, func(t *testing.T) { - expr, parseDiags := ParseTemplate([]byte(test.input), "", hcl.Pos{Line: 1, Column: 1, Byte: 0}) - - got, valDiags := expr.Value(test.ctx) - - diagCount := len(parseDiags) + len(valDiags) - - if diagCount != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", diagCount, test.diagCount) - for _, diag := range parseDiags { - t.Logf(" - %s", diag.Error()) - } - for _, diag := range valDiags { - t.Logf(" - %s", diag.Error()) - } - } - - if !got.RawEquals(test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } - -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_test.go deleted file mode 100644 index 1b0030d..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_test.go +++ /dev/null @@ -1,1121 +0,0 @@ -package hclsyntax - -import ( - "testing" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/function" - "github.com/zclconf/go-cty/cty/function/stdlib" -) - -func TestExpressionParseAndValue(t *testing.T) { - // This is a combo test that exercises both the parser and the Value - // method, with the focus on the latter but indirectly testing the former. - tests := []struct { - input string - ctx *hcl.EvalContext - want cty.Value - diagCount int - }{ - { - `1`, - nil, - cty.NumberIntVal(1), - 0, - }, - { - `(1)`, - nil, - cty.NumberIntVal(1), - 0, - }, - { - `(2+3)`, - nil, - cty.NumberIntVal(5), - 0, - }, - { - `(2+unk)`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.UnknownVal(cty.Number), - }, - }, - cty.UnknownVal(cty.Number), - 0, - }, - { - `(2+unk)`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.DynamicVal, - }, - }, - cty.UnknownVal(cty.Number), - 0, - }, - { - `(unk+unk)`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.DynamicVal, - }, - }, - cty.UnknownVal(cty.Number), - 0, - }, - { - `(2+true)`, - nil, - cty.UnknownVal(cty.Number), - 1, // unsuitable type for right operand - }, - { - `(false+true)`, - nil, - cty.UnknownVal(cty.Number), - 2, // unsuitable type for each operand - }, - { - `(5 == 5)`, - nil, - cty.True, - 0, - }, - { - `(5 == 4)`, - nil, - cty.False, - 0, - }, - { - `(1 == true)`, - nil, - cty.False, - 0, - }, - { - `("true" == true)`, - nil, - cty.False, - 0, - }, - { - `(true == "true")`, - nil, - cty.False, - 0, - }, - { - `(true != "true")`, - nil, - cty.True, - 0, - }, - { - `(- 2)`, - nil, - cty.NumberIntVal(-2), - 0, - }, - { - `(! true)`, - nil, - cty.False, - 0, - }, - { - `( - 1 -)`, - nil, - cty.NumberIntVal(1), - 0, - }, - { - `(1`, - nil, - cty.NumberIntVal(1), - 1, // Unbalanced parentheses - }, - { - `true`, - nil, - cty.True, - 0, - }, - { - `false`, - nil, - cty.False, - 0, - }, - { - `null`, - nil, - cty.NullVal(cty.DynamicPseudoType), - 0, - }, - { - `true true`, - nil, - cty.True, - 1, // extra characters after expression - }, - { - `"hello"`, - nil, - cty.StringVal("hello"), - 0, - }, - { - `"hello\nworld"`, - nil, - cty.StringVal("hello\nworld"), - 0, - }, - { - `"unclosed`, - nil, - cty.StringVal("unclosed"), - 1, // Unterminated template string - }, - { - `"hello ${"world"}"`, - nil, - cty.StringVal("hello world"), - 0, - }, - { - `"hello ${12.5}"`, - nil, - cty.StringVal("hello 12.5"), - 0, - }, - { - `"silly ${"${"nesting"}"}"`, - nil, - cty.StringVal("silly nesting"), - 0, - }, - { - `"silly ${"${true}"}"`, - nil, - cty.StringVal("silly true"), - 0, - }, - { - `"hello $${escaped}"`, - nil, - cty.StringVal("hello ${escaped}"), - 0, - }, - { - `"hello $$nonescape"`, - nil, - cty.StringVal("hello $$nonescape"), - 0, - }, - { - `upper("foo")`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.StringVal("FOO"), - 0, - }, - { - ` -upper( - "foo" -) -`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.StringVal("FOO"), - 0, - }, - { - `upper(["foo"]...)`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.StringVal("FOO"), - 0, - }, - { - `upper("foo", []...)`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.StringVal("FOO"), - 0, - }, - { - `upper("foo", "bar")`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.DynamicVal, - 1, // too many function arguments - }, - { - `upper(["foo", "bar"]...)`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.DynamicVal, - 1, // too many function arguments - }, - { - `[]`, - nil, - cty.EmptyTupleVal, - 0, - }, - { - `[1]`, - nil, - cty.TupleVal([]cty.Value{cty.NumberIntVal(1)}), - 0, - }, - { - `[1,]`, - nil, - cty.TupleVal([]cty.Value{cty.NumberIntVal(1)}), - 0, - }, - { - `[1,true]`, - nil, - cty.TupleVal([]cty.Value{cty.NumberIntVal(1), cty.True}), - 0, - }, - { - `[ - 1, - true -]`, - nil, - cty.TupleVal([]cty.Value{cty.NumberIntVal(1), cty.True}), - 0, - }, - { - `{}`, - nil, - cty.EmptyObjectVal, - 0, - }, - { - `{"hello": "world"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{"hello" = "world"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{hello = "world"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{hello: "world"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{"hello" = "world", "goodbye" = "cruel world"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - "goodbye": cty.StringVal("cruel world"), - }), - 0, - }, - { - `{ - "hello" = "world" -}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{ - "hello" = "world" - "goodbye" = "cruel world" -}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - "goodbye": cty.StringVal("cruel world"), - }), - 0, - }, - { - `{ - "hello" = "world", - "goodbye" = "cruel world" -}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - "goodbye": cty.StringVal("cruel world"), - }), - 0, - }, - { - `{ - "hello" = "world", - "goodbye" = "cruel world", -}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - "goodbye": cty.StringVal("cruel world"), - }), - 0, - }, - - { - `{for k, v in {hello: "world"}: k => v if k == "hello"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 0, - }, - { - `{for k, v in {hello: "world"}: upper(k) => upper(v) if k == "hello"}`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "upper": stdlib.UpperFunc, - }, - }, - cty.ObjectVal(map[string]cty.Value{ - "HELLO": cty.StringVal("WORLD"), - }), - 0, - }, - { - `{for k, v in ["world"]: k => v if k == 0}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "0": cty.StringVal("world"), - }), - 0, - }, - { - `{for v in ["world"]: v => v}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "world": cty.StringVal("world"), - }), - 0, - }, - { - `{for k, v in {hello: "world"}: k => v if k == "foo"}`, - nil, - cty.EmptyObjectVal, - 0, - }, - { - `{for k, v in {hello: "world"}: 5 => v}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "5": cty.StringVal("world"), - }), - 0, - }, - { - `{for k, v in {hello: "world"}: [] => v}`, - nil, - cty.DynamicVal, - 1, // key expression has the wrong type - }, - { - `{for k, v in {hello: "world"}: k => k if k == "hello"}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("hello"), - }), - 0, - }, - { - `{for k, v in {hello: "world"}: k => foo}`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.StringVal("foo"), - }, - }, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("foo"), - }), - 0, - }, - { - `[for k, v in {hello: "world"}: "${k}=${v}"]`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("hello=world"), - }), - 0, - }, - { - `[for k, v in {hello: "world"}: k => v]`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "hello": cty.StringVal("world"), - }), - 1, // can't have a key expr when producing a tuple - }, - { - `{for v in {hello: "world"}: v}`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("world"), - }), - 1, // must have a key expr when producing a map - }, - { - `{for i, v in ["a", "b", "c", "b", "d"]: v => i...}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "a": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(0), - }), - "b": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(1), - cty.NumberIntVal(3), - }), - "c": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(2), - }), - "d": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(4), - }), - }), - 0, - }, - { - `{for i, v in ["a", "b", "c", "b", "d"]: v => i... if i <= 2}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "a": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(0), - }), - "b": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(1), - }), - "c": cty.TupleVal([]cty.Value{ - cty.NumberIntVal(2), - }), - }), - 0, - }, - { - `{for i, v in ["a", "b", "c", "b", "d"]: v => i}`, - nil, - cty.ObjectVal(map[string]cty.Value{ - "a": cty.NumberIntVal(0), - "b": cty.NumberIntVal(1), - "c": cty.NumberIntVal(2), - "d": cty.NumberIntVal(4), - }), - 1, // duplicate key "b" - }, - { - `[for v in {hello: "world"}: v...]`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("world"), - }), - 1, // can't use grouping when producing a tuple - }, - { - `[for v in "hello": v]`, - nil, - cty.DynamicVal, - 1, // can't iterate over a string - }, - { - `[for v in null: v]`, - nil, - cty.DynamicVal, - 1, // can't iterate over a null value - }, - { - `[for v in unk: v]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.UnknownVal(cty.List(cty.String)), - }, - }, - cty.DynamicVal, - 0, - }, - { - `[for v in unk: v]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.DynamicVal, - }, - }, - cty.DynamicVal, - 0, - }, - { - `[for v in unk: v]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.UnknownVal(cty.String), - }, - }, - cty.DynamicVal, - 1, // can't iterate over a string (even if it's unknown) - }, - { - `[for v in ["a", "b"]: v if unkbool]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unkbool": cty.UnknownVal(cty.Bool), - }, - }, - cty.DynamicVal, - 0, - }, - { - `[for v in ["a", "b"]: v if nullbool]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "nullbool": cty.NullVal(cty.Bool), - }, - }, - cty.DynamicVal, - 1, // value of if clause must not be null - }, - { - `[for v in ["a", "b"]: v if dyn]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "dyn": cty.DynamicVal, - }, - }, - cty.DynamicVal, - 0, - }, - { - `[for v in ["a", "b"]: v if unknum]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unknum": cty.UnknownVal(cty.List(cty.Number)), - }, - }, - cty.DynamicVal, - 1, // if expression must be bool - }, - { - `[for i, v in ["a", "b"]: v if i + i]`, - nil, - cty.DynamicVal, - 1, // if expression must be bool - }, - { - `[for v in ["a", "b"]: unkstr]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unkstr": cty.UnknownVal(cty.String), - }, - }, - cty.TupleVal([]cty.Value{ - cty.UnknownVal(cty.String), - cty.UnknownVal(cty.String), - }), - 0, - }, - - { - `[{name: "Steve"}, {name: "Ermintrude"}].*.name`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("Steve"), - cty.StringVal("Ermintrude"), - }), - 0, - }, - { - `{name: "Steve"}.*.name`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("Steve"), - }), - 0, - }, - { - `["hello", "goodbye"].*`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("hello"), - cty.StringVal("goodbye"), - }), - 0, - }, - { - `"hello".*`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("hello"), - }), - 0, - }, - { - `[["hello"], ["world", "unused"]].*.0`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("hello"), - cty.StringVal("world"), - }), - 0, - }, - { - `[[{name:"foo"}], [{name:"bar"}, {name:"baz"}]].*.0.name`, - nil, - cty.TupleVal([]cty.Value{ - cty.StringVal("foo"), - cty.StringVal("bar"), - }), - 0, - }, - { - // For an "attribute-only" splat, an index operator applies to - // the splat result as a whole, rather than being incorporated - // into the splat traversal itself. - `[{name: "Steve"}, {name: "Ermintrude"}].*.name[0]`, - nil, - cty.StringVal("Steve"), - 0, - }, - { - `[["hello"], ["goodbye"]].*.*`, - nil, - cty.TupleVal([]cty.Value{ - cty.TupleVal([]cty.Value{cty.StringVal("hello")}), - cty.TupleVal([]cty.Value{cty.StringVal("goodbye")}), - }), - 1, - }, - - { - `["hello"][0]`, - nil, - cty.StringVal("hello"), - 0, - }, - { - `[][0]`, - nil, - cty.DynamicVal, - 1, // invalid index - }, - { - `["hello"][negate(0)]`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "negate": stdlib.NegateFunc, - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `[][negate(0)]`, - &hcl.EvalContext{ - Functions: map[string]function.Function{ - "negate": stdlib.NegateFunc, - }, - }, - cty.DynamicVal, - 1, // invalid index - }, - { - `["hello"]["0"]`, // key gets converted to number - nil, - cty.StringVal("hello"), - 0, - }, - - { - `foo`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.StringVal("hello"), - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `bar`, - &hcl.EvalContext{}, - cty.DynamicVal, - 1, // variables not allowed here - }, - { - `foo.bar`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.StringVal("hello"), - }, - }, - cty.DynamicVal, - 1, // foo does not have attributes - }, - { - `foo.baz`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.ObjectVal(map[string]cty.Value{ - "baz": cty.StringVal("hello"), - }), - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `foo["baz"]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.ObjectVal(map[string]cty.Value{ - "baz": cty.StringVal("hello"), - }), - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `foo[true]`, // key is converted to string - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.ObjectVal(map[string]cty.Value{ - "true": cty.StringVal("hello"), - }), - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `foo[0].baz`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "foo": cty.ListVal([]cty.Value{ - cty.ObjectVal(map[string]cty.Value{ - "baz": cty.StringVal("hello"), - }), - }), - }, - }, - cty.StringVal("hello"), - 0, - }, - { - `unk["baz"]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.UnknownVal(cty.String), - }, - }, - cty.DynamicVal, - 1, // value does not have indices (because we know it's a string) - }, - { - `unk["boop"]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "unk": cty.UnknownVal(cty.Map(cty.String)), - }, - }, - cty.UnknownVal(cty.String), // we know it's a map of string - 0, - }, - { - `dyn["boop"]`, - &hcl.EvalContext{ - Variables: map[string]cty.Value{ - "dyn": cty.DynamicVal, - }, - }, - cty.DynamicVal, // don't know what it is yet - 0, - }, - } - - for _, test := range tests { - t.Run(test.input, func(t *testing.T) { - expr, parseDiags := ParseExpression([]byte(test.input), "", hcl.Pos{Line: 1, Column: 1, Byte: 0}) - - got, valDiags := expr.Value(test.ctx) - - diagCount := len(parseDiags) + len(valDiags) - - if diagCount != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", diagCount, test.diagCount) - for _, diag := range parseDiags { - t.Logf(" - %s", diag.Error()) - } - for _, diag := range valDiags { - t.Logf(" - %s", diag.Error()) - } - } - - if !got.RawEquals(test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } - -} - -func TestFunctionCallExprValue(t *testing.T) { - funcs := map[string]function.Function{ - "length": stdlib.StrlenFunc, - "jsondecode": stdlib.JSONDecodeFunc, - } - - tests := map[string]struct { - expr *FunctionCallExpr - ctx *hcl.EvalContext - want cty.Value - diagCount int - }{ - "valid call with no conversions": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello"), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.NumberIntVal(5), - 0, - }, - "valid call with arg conversion": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.BoolVal(true), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.NumberIntVal(4), // length of string "true" - 0, - }, - "valid call with unknown arg": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.UnknownVal(cty.String), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.UnknownVal(cty.Number), - 0, - }, - "valid call with unknown arg needing conversion": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.UnknownVal(cty.Bool), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.UnknownVal(cty.Number), - 0, - }, - "valid call with dynamic arg": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.DynamicVal, - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.UnknownVal(cty.Number), - 0, - }, - "invalid arg type": { - &FunctionCallExpr{ - Name: "length", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.ListVal([]cty.Value{cty.StringVal("hello")}), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.DynamicVal, - 1, - }, - "function with dynamic return type": { - &FunctionCallExpr{ - Name: "jsondecode", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal(`"hello"`), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.StringVal("hello"), - 0, - }, - "function with dynamic return type unknown arg": { - &FunctionCallExpr{ - Name: "jsondecode", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.UnknownVal(cty.String), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.DynamicVal, // type depends on arg value - 0, - }, - "error in function": { - &FunctionCallExpr{ - Name: "jsondecode", - Args: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("invalid-json"), - }, - }, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.DynamicVal, - 1, // JSON parse error - }, - "unknown function": { - &FunctionCallExpr{ - Name: "lenth", - Args: []Expression{}, - }, - &hcl.EvalContext{ - Functions: funcs, - }, - cty.DynamicVal, - 1, - }, - } - - for name, test := range tests { - t.Run(name, func(t *testing.T) { - got, diags := test.expr.Value(test.ctx) - - if len(diags) != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - - if !got.RawEquals(test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } -} - -func TestExpressionAsTraversal(t *testing.T) { - expr, _ := ParseExpression([]byte("a.b[0]"), "", hcl.Pos{}) - traversal, diags := hcl.AbsTraversalForExpr(expr) - if len(diags) != 0 { - t.Fatalf("unexpected diagnostics") - } - if len(traversal) != 3 { - t.Fatalf("wrong traversal %#v; want length 3", traversal) - } - if traversal.RootName() != "a" { - t.Fatalf("wrong root name %q; want %q", traversal.RootName(), "a") - } -} - -func TestStaticExpressionList(t *testing.T) { - expr, _ := ParseExpression([]byte("[0, a, true]"), "", hcl.Pos{}) - exprs, diags := hcl.ExprList(expr) - if len(diags) != 0 { - t.Fatalf("unexpected diagnostics") - } - if len(exprs) != 3 { - t.Fatalf("wrong result %#v; want length 3", exprs) - } - first, ok := exprs[0].(*LiteralValueExpr) - if !ok { - t.Fatalf("first expr has wrong type %T; want *zclsyntax.LiteralValueExpr", exprs[0]) - } - if !first.Val.RawEquals(cty.Zero) { - t.Fatalf("wrong first value %#v; want cty.Zero", first.Val) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars.go deleted file mode 100755 index c15d134..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars.go +++ /dev/null @@ -1,72 +0,0 @@ -package hclsyntax - -// Generated by expression_vars_get.go. DO NOT EDIT. -// Run 'go generate' on this package to update the set of functions here. - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -func (e *AnonSymbolExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *BinaryOpExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ConditionalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ForExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *FunctionCallExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *IndexExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *LiteralValueExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ObjectConsExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *RelativeTraversalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *ScopeTraversalExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *SplatExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateJoinExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TemplateWrapExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *TupleConsExpr) Variables() []hcl.Traversal { - return Variables(e) -} - -func (e *UnaryOpExpr) Variables() []hcl.Traversal { - return Variables(e) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars_gen.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars_gen.go deleted file mode 100644 index 8c72907..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/expression_vars_gen.go +++ /dev/null @@ -1,99 +0,0 @@ -// This is a 'go generate'-oriented program for producing the "Variables" -// method on every Expression implementation found within this package. -// All expressions share the same implementation for this method, which -// just wraps the package-level function "Variables" and uses an AST walk -// to do its work. - -// +build ignore - -package main - -import ( - "fmt" - "go/ast" - "go/parser" - "go/token" - "os" - "sort" -) - -func main() { - fs := token.NewFileSet() - pkgs, err := parser.ParseDir(fs, ".", nil, 0) - if err != nil { - fmt.Fprintf(os.Stderr, "error while parsing: %s\n", err) - os.Exit(1) - } - pkg := pkgs["zclsyntax"] - - // Walk all the files and collect the receivers of any "Value" methods - // that look like they are trying to implement Expression. - var recvs []string - for _, f := range pkg.Files { - for _, decl := range f.Decls { - fd, ok := decl.(*ast.FuncDecl) - if !ok { - continue - } - if fd.Name.Name != "Value" { - continue - } - results := fd.Type.Results.List - if len(results) != 2 { - continue - } - valResult := fd.Type.Results.List[0].Type.(*ast.SelectorExpr).X.(*ast.Ident) - diagsResult := fd.Type.Results.List[1].Type.(*ast.SelectorExpr).X.(*ast.Ident) - - if valResult.Name != "cty" && diagsResult.Name != "zcl" { - continue - } - - // If we have a method called Value and its returns something in - // cty followed by something in zcl then that's specific enough - // for now, even though this is not 100% exact as a correct - // implementation of Value. - - recvTy := fd.Recv.List[0].Type - - switch rtt := recvTy.(type) { - case *ast.StarExpr: - name := rtt.X.(*ast.Ident).Name - recvs = append(recvs, fmt.Sprintf("*%s", name)) - default: - fmt.Fprintf(os.Stderr, "don't know what to do with a %T receiver\n", recvTy) - } - - } - } - - sort.Strings(recvs) - - of, err := os.OpenFile("expression_vars.go", os.O_WRONLY|os.O_CREATE|os.O_TRUNC, os.ModePerm) - if err != nil { - fmt.Fprintf(os.Stderr, "failed to open output file: %s\n", err) - os.Exit(1) - } - - fmt.Fprint(of, outputPreamble) - for _, recv := range recvs { - fmt.Fprintf(of, outputMethodFmt, recv) - } - fmt.Fprint(of, "\n") - -} - -const outputPreamble = `package zclsyntax - -// Generated by expression_vars_get.go. DO NOT EDIT. -// Run 'go generate' on this package to update the set of functions here. - -import ( - "github.com/zclconf/go-zcl/zcl" -)` - -const outputMethodFmt = ` - -func (e %s) Variables() []hcl.Traversal { - return Variables(e) -}` diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/file.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/file.go deleted file mode 100644 index 490c025..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/file.go +++ /dev/null @@ -1,20 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -// File is the top-level object resulting from parsing a configuration file. -type File struct { - Body *Body - Bytes []byte -} - -func (f *File) AsHCLFile() *hcl.File { - return &hcl.File{ - Body: f.Body, - Bytes: f.Bytes, - - // TODO: The Nav object, once we have an implementation of it - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/generate.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/generate.go deleted file mode 100644 index ecc389f..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/generate.go +++ /dev/null @@ -1,7 +0,0 @@ -package hclsyntax - -//go:generate go run expression_vars_gen.go -//go:generate ruby unicode2ragel.rb --url=http://www.unicode.org/Public/9.0.0/ucd/DerivedCoreProperties.txt -m UnicodeDerived -p ID_Start,ID_Continue -o unicode_derived.rl -//go:generate ragel -Z scan_tokens.rl -//go:generate gofmt -w scan_tokens.go -//go:generate stringer -type TokenType -output token_type_string.go diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go deleted file mode 100644 index eef8b96..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/keywords.go +++ /dev/null @@ -1,21 +0,0 @@ -package hclsyntax - -import ( - "bytes" -) - -type Keyword []byte - -var forKeyword = Keyword([]byte{'f', 'o', 'r'}) -var inKeyword = Keyword([]byte{'i', 'n'}) -var ifKeyword = Keyword([]byte{'i', 'f'}) -var elseKeyword = Keyword([]byte{'e', 'l', 's', 'e'}) -var endifKeyword = Keyword([]byte{'e', 'n', 'd', 'i', 'f'}) -var endforKeyword = Keyword([]byte{'e', 'n', 'd', 'f', 'o', 'r'}) - -func (kw Keyword) TokenMatches(token Token) bool { - if token.Type != TokenIdent { - return false - } - return bytes.Equal([]byte(kw), token.Bytes) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/navigation.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/navigation.go deleted file mode 100644 index 8a04c20..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/navigation.go +++ /dev/null @@ -1,41 +0,0 @@ -package hclsyntax - -import ( - "bytes" - "fmt" -) - -type navigation struct { - root *Body -} - -// Implementation of zcled.ContextString -func (n navigation) ContextString(offset int) string { - // We will walk our top-level blocks until we find one that contains - // the given offset, and then construct a representation of the header - // of the block. - - var block *Block - for _, candidate := range n.root.Blocks { - if candidate.Range().ContainsOffset(offset) { - block = candidate - break - } - } - - if block == nil { - return "" - } - - if len(block.Labels) == 0 { - // Easy case! - return block.Type - } - - buf := &bytes.Buffer{} - buf.WriteString(block.Type) - for _, label := range block.Labels { - fmt.Fprintf(buf, " %q", label) - } - return buf.String() -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/node.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/node.go deleted file mode 100644 index fd426d4..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/node.go +++ /dev/null @@ -1,22 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -// Node is the abstract type that every AST node implements. -// -// This is a closed interface, so it cannot be implemented from outside of -// this package. -type Node interface { - // This is the mechanism by which the public-facing walk functions - // are implemented. Implementations should call the given function - // for each child node and then replace that node with its return value. - // The return value might just be the same node, for non-transforming - // walks. - walkChildNodes(w internalWalkFunc) - - Range() hcl.Range -} - -type internalWalkFunc func(Node) Node diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parse_traversal_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parse_traversal_test.go deleted file mode 100644 index 4f4962a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parse_traversal_test.go +++ /dev/null @@ -1,227 +0,0 @@ -package hclsyntax - -import ( - "testing" - - "reflect" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -func TestParseTraversalAbs(t *testing.T) { - tests := []struct { - src string - want hcl.Traversal - diagCount int - }{ - { - "", - nil, - 1, // variable name required - }, - { - "foo", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - 0, - }, - { - "foo.bar.baz", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - hcl.TraverseAttr{ - Name: "bar", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - }, - hcl.TraverseAttr{ - Name: "baz", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - }, - 0, - }, - { - "foo[1]", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - hcl.TraverseIndex{ - Key: cty.NumberIntVal(1), - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - End: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - }, - }, - }, - 0, - }, - { - "foo[1][2]", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - hcl.TraverseIndex{ - Key: cty.NumberIntVal(1), - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - End: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - }, - }, - hcl.TraverseIndex{ - Key: cty.NumberIntVal(2), - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 10, Byte: 9}, - }, - }, - }, - 0, - }, - { - "foo[1].bar", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - hcl.TraverseIndex{ - Key: cty.NumberIntVal(1), - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - End: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - }, - }, - hcl.TraverseAttr{ - Name: "bar", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 11, Byte: 10}, - }, - }, - }, - 0, - }, - { - "foo.", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - 1, // attribute name required - }, - { - "foo[", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - 1, // index required - }, - { - "foo[index]", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - 1, // index must be literal - }, - { - "foo[0", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - hcl.TraverseIndex{ - Key: cty.NumberIntVal(0), - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - }, - }, - 1, // missing close bracket - }, - { - "foo 0", - hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - 1, // extra junk after traversal - }, - } - - for _, test := range tests { - t.Run(test.src, func(t *testing.T) { - got, diags := ParseTraversalAbs([]byte(test.src), "", hcl.Pos{Line: 1, Column: 1}) - if len(diags) != test.diagCount { - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - } - - if !reflect.DeepEqual(got, test.want) { - t.Errorf("wrong result\nsrc: %s\ngot: %s\nwant: %s", test.src, spew.Sdump(got), spew.Sdump(test.want)) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go deleted file mode 100644 index 93b5664..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser.go +++ /dev/null @@ -1,1816 +0,0 @@ -package hclsyntax - -import ( - "bufio" - "bytes" - "fmt" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -type parser struct { - *peeker - - // set to true if any recovery is attempted. The parser can use this - // to attempt to reduce error noise by suppressing "bad token" errors - // in recovery mode, assuming that the recovery heuristics have failed - // in this case and left the peeker in a wrong place. - recovery bool -} - -func (p *parser) ParseBody(end TokenType) (*Body, hcl.Diagnostics) { - attrs := Attributes{} - blocks := Blocks{} - var diags hcl.Diagnostics - - startRange := p.PrevRange() - var endRange hcl.Range - -Token: - for { - next := p.Peek() - if next.Type == end { - endRange = p.NextRange() - p.Read() - break Token - } - - switch next.Type { - case TokenNewline: - p.Read() - continue - case TokenIdent: - item, itemDiags := p.ParseBodyItem() - diags = append(diags, itemDiags...) - switch titem := item.(type) { - case *Block: - blocks = append(blocks, titem) - case *Attribute: - if existing, exists := attrs[titem.Name]; exists { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute redefined", - Detail: fmt.Sprintf( - "The attribute %q was already defined at %s. Each attribute may be defined only once.", - titem.Name, existing.NameRange.String(), - ), - Subject: &titem.NameRange, - }) - } else { - attrs[titem.Name] = titem - } - default: - // This should never happen for valid input, but may if a - // syntax error was detected in ParseBodyItem that prevented - // it from even producing a partially-broken item. In that - // case, it would've left at least one error in the diagnostics - // slice we already dealt with above. - // - // We'll assume ParseBodyItem attempted recovery to leave - // us in a reasonable position to try parsing the next item. - continue - } - default: - bad := p.Read() - if !p.recovery { - if bad.Type == TokenOQuote { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid attribute name", - Detail: "Attribute names must not be quoted.", - Subject: &bad.Range, - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute or block definition required", - Detail: "An attribute or block definition is required here.", - Subject: &bad.Range, - }) - } - } - endRange = p.PrevRange() // arbitrary, but somewhere inside the body means better diagnostics - - p.recover(end) // attempt to recover to the token after the end of this body - break Token - } - } - - return &Body{ - Attributes: attrs, - Blocks: blocks, - - SrcRange: hcl.RangeBetween(startRange, endRange), - EndRange: hcl.Range{ - Filename: endRange.Filename, - Start: endRange.End, - End: endRange.End, - }, - }, diags -} - -func (p *parser) ParseBodyItem() (Node, hcl.Diagnostics) { - ident := p.Read() - if ident.Type != TokenIdent { - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Attribute or block definition required", - Detail: "An attribute or block definition is required here.", - Subject: &ident.Range, - }, - } - } - - next := p.Peek() - - switch next.Type { - case TokenEqual: - return p.finishParsingBodyAttribute(ident) - case TokenOQuote, TokenOBrace: - return p.finishParsingBodyBlock(ident) - default: - p.recoverAfterBodyItem() - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Attribute or block definition required", - Detail: "An attribute or block definition is required here. To define an attribute, use the equals sign \"=\" to introduce the attribute value.", - Subject: &ident.Range, - }, - } - } - - return nil, nil -} - -func (p *parser) finishParsingBodyAttribute(ident Token) (Node, hcl.Diagnostics) { - eqTok := p.Read() // eat equals token - if eqTok.Type != TokenEqual { - // should never happen if caller behaves - panic("finishParsingBodyAttribute called with next not equals") - } - - var endRange hcl.Range - - expr, diags := p.ParseExpression() - if p.recovery && diags.HasErrors() { - // recovery within expressions tends to be tricky, so we've probably - // landed somewhere weird. We'll try to reset to the start of a body - // item so parsing can continue. - endRange = p.PrevRange() - p.recoverAfterBodyItem() - } else { - end := p.Peek() - if end.Type != TokenNewline { - if !p.recovery { - if end.Type == TokenEOF { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing newline after attribute definition", - Detail: "A newline is required after an attribute definition at the end of a file.", - Subject: &end.Range, - Context: hcl.RangeBetween(ident.Range, end.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing newline after attribute definition", - Detail: "An attribute definition must end with a newline.", - Subject: &end.Range, - Context: hcl.RangeBetween(ident.Range, end.Range).Ptr(), - }) - } - } - endRange = p.PrevRange() - p.recoverAfterBodyItem() - } else { - endRange = p.PrevRange() - p.Read() // eat newline - } - } - - return &Attribute{ - Name: string(ident.Bytes), - Expr: expr, - - SrcRange: hcl.RangeBetween(ident.Range, endRange), - NameRange: ident.Range, - EqualsRange: eqTok.Range, - }, diags -} - -func (p *parser) finishParsingBodyBlock(ident Token) (Node, hcl.Diagnostics) { - var blockType = string(ident.Bytes) - var diags hcl.Diagnostics - var labels []string - var labelRanges []hcl.Range - - var oBrace Token - -Token: - for { - tok := p.Peek() - - switch tok.Type { - - case TokenOBrace: - oBrace = p.Read() - break Token - - case TokenOQuote: - label, labelRange, labelDiags := p.parseQuotedStringLiteral() - diags = append(diags, labelDiags...) - labels = append(labels, label) - labelRanges = append(labelRanges, labelRange) - if labelDiags.HasErrors() { - p.recoverAfterBodyItem() - return &Block{ - Type: blockType, - Labels: labels, - Body: nil, - - TypeRange: ident.Range, - LabelRanges: labelRanges, - OpenBraceRange: ident.Range, // placeholder - CloseBraceRange: ident.Range, // placeholder - }, diags - } - - default: - switch tok.Type { - case TokenEqual: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "The equals sign \"=\" indicates an attribute definition, and must not be used when defining a block.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - case TokenNewline: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "A block definition must have block content delimited by \"{\" and \"}\", starting on the same line as the block header.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - default: - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid block definition", - Detail: "Either a quoted string block label or an opening brace (\"{\") is expected here.", - Subject: &tok.Range, - Context: hcl.RangeBetween(ident.Range, tok.Range).Ptr(), - }) - } - } - - p.recoverAfterBodyItem() - - return &Block{ - Type: blockType, - Labels: labels, - Body: nil, - - TypeRange: ident.Range, - LabelRanges: labelRanges, - OpenBraceRange: ident.Range, // placeholder - CloseBraceRange: ident.Range, // placeholder - }, diags - } - } - - // Once we fall out here, the peeker is pointed just after our opening - // brace, so we can begin our nested body parsing. - body, bodyDiags := p.ParseBody(TokenCBrace) - diags = append(diags, bodyDiags...) - cBraceRange := p.PrevRange() - - eol := p.Peek() - if eol.Type == TokenNewline { - p.Read() // eat newline - } else { - if !p.recovery { - if eol.Type == TokenEOF { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing newline after block definition", - Detail: "A newline is required after a block definition at the end of a file.", - Subject: &eol.Range, - Context: hcl.RangeBetween(ident.Range, eol.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing newline after block definition", - Detail: "A block definition must end with a newline.", - Subject: &eol.Range, - Context: hcl.RangeBetween(ident.Range, eol.Range).Ptr(), - }) - } - } - p.recoverAfterBodyItem() - } - - return &Block{ - Type: blockType, - Labels: labels, - Body: body, - - TypeRange: ident.Range, - LabelRanges: labelRanges, - OpenBraceRange: oBrace.Range, - CloseBraceRange: cBraceRange, - }, diags -} - -func (p *parser) ParseExpression() (Expression, hcl.Diagnostics) { - return p.parseTernaryConditional() -} - -func (p *parser) parseTernaryConditional() (Expression, hcl.Diagnostics) { - // The ternary conditional operator (.. ? .. : ..) behaves somewhat - // like a binary operator except that the "symbol" is itself - // an expression enclosed in two punctuation characters. - // The middle expression is parsed as if the ? and : symbols - // were parentheses. The "rhs" (the "false expression") is then - // treated right-associatively so it behaves similarly to the - // middle in terms of precedence. - - startRange := p.NextRange() - var condExpr, trueExpr, falseExpr Expression - var diags hcl.Diagnostics - - condExpr, condDiags := p.parseBinaryOps(binaryOps) - diags = append(diags, condDiags...) - if p.recovery && condDiags.HasErrors() { - return condExpr, diags - } - - questionMark := p.Peek() - if questionMark.Type != TokenQuestion { - return condExpr, diags - } - - p.Read() // eat question mark - - trueExpr, trueDiags := p.ParseExpression() - diags = append(diags, trueDiags...) - if p.recovery && trueDiags.HasErrors() { - return condExpr, diags - } - - colon := p.Peek() - if colon.Type != TokenColon { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing false expression in conditional", - Detail: "The conditional operator (...?...:...) requires a false expression, delimited by a colon.", - Subject: &colon.Range, - Context: hcl.RangeBetween(startRange, colon.Range).Ptr(), - }) - return condExpr, diags - } - - p.Read() // eat colon - - falseExpr, falseDiags := p.ParseExpression() - diags = append(diags, falseDiags...) - if p.recovery && falseDiags.HasErrors() { - return condExpr, diags - } - - return &ConditionalExpr{ - Condition: condExpr, - TrueResult: trueExpr, - FalseResult: falseExpr, - - SrcRange: hcl.RangeBetween(startRange, falseExpr.Range()), - }, diags -} - -// parseBinaryOps calls itself recursively to work through all of the -// operator precedence groups, and then eventually calls parseExpressionTerm -// for each operand. -func (p *parser) parseBinaryOps(ops []map[TokenType]*Operation) (Expression, hcl.Diagnostics) { - if len(ops) == 0 { - // We've run out of operators, so now we'll just try to parse a term. - return p.parseExpressionWithTraversals() - } - - thisLevel := ops[0] - remaining := ops[1:] - - var lhs, rhs Expression - var operation *Operation - var diags hcl.Diagnostics - - // Parse a term that might be the first operand of a binary - // operation or it might just be a standalone term. - // We won't know until we've parsed it and can look ahead - // to see if there's an operator token for this level. - lhs, lhsDiags := p.parseBinaryOps(remaining) - diags = append(diags, lhsDiags...) - if p.recovery && lhsDiags.HasErrors() { - return lhs, diags - } - - // We'll keep eating up operators until we run out, so that operators - // with the same precedence will combine in a left-associative manner: - // a+b+c => (a+b)+c, not a+(b+c) - // - // Should we later want to have right-associative operators, a way - // to achieve that would be to call back up to ParseExpression here - // instead of iteratively parsing only the remaining operators. - for { - next := p.Peek() - var newOp *Operation - var ok bool - if newOp, ok = thisLevel[next.Type]; !ok { - break - } - - // Are we extending an expression started on the previous iteration? - if operation != nil { - lhs = &BinaryOpExpr{ - LHS: lhs, - Op: operation, - RHS: rhs, - - SrcRange: hcl.RangeBetween(lhs.Range(), rhs.Range()), - } - } - - operation = newOp - p.Read() // eat operator token - var rhsDiags hcl.Diagnostics - rhs, rhsDiags = p.parseBinaryOps(remaining) - diags = append(diags, rhsDiags...) - if p.recovery && rhsDiags.HasErrors() { - return lhs, diags - } - } - - if operation == nil { - return lhs, diags - } - - return &BinaryOpExpr{ - LHS: lhs, - Op: operation, - RHS: rhs, - - SrcRange: hcl.RangeBetween(lhs.Range(), rhs.Range()), - }, diags -} - -func (p *parser) parseExpressionWithTraversals() (Expression, hcl.Diagnostics) { - term, diags := p.parseExpressionTerm() - ret := term - -Traversal: - for { - next := p.Peek() - - switch next.Type { - case TokenDot: - // Attribute access or splat - dot := p.Read() - attrTok := p.Peek() - - switch attrTok.Type { - case TokenIdent: - attrTok = p.Read() // eat token - name := string(attrTok.Bytes) - rng := hcl.RangeBetween(dot.Range, attrTok.Range) - step := hcl.TraverseAttr{ - Name: name, - SrcRange: rng, - } - - ret = makeRelativeTraversal(ret, step, rng) - - case TokenStar: - // "Attribute-only" splat expression. - // (This is a kinda weird construct inherited from HIL, which - // behaves a bit like a [*] splat except that it is only able - // to do attribute traversals into each of its elements, - // whereas foo[*] can support _any_ traversal. - marker := p.Read() // eat star - trav := make(hcl.Traversal, 0, 1) - var firstRange, lastRange hcl.Range - firstRange = p.NextRange() - for p.Peek().Type == TokenDot { - dot := p.Read() - - if p.Peek().Type == TokenNumberLit { - // Continuing the "weird stuff inherited from HIL" - // theme, we also allow numbers as attribute names - // inside splats and interpret them as indexing - // into a list, for expressions like: - // foo.bar.*.baz.0.foo - numTok := p.Read() - numVal, numDiags := p.numberLitValue(numTok) - diags = append(diags, numDiags...) - trav = append(trav, hcl.TraverseIndex{ - Key: numVal, - SrcRange: hcl.RangeBetween(dot.Range, numTok.Range), - }) - lastRange = numTok.Range - continue - } - - if p.Peek().Type != TokenIdent { - if !p.recovery { - if p.Peek().Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Nested splat expression not allowed", - Detail: "A splat expression (*) cannot be used inside another attribute-only splat expression.", - Subject: p.Peek().Range.Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid attribute name", - Detail: "An attribute name is required after a dot.", - Subject: &attrTok.Range, - }) - } - } - p.setRecovery() - continue Traversal - } - - attrTok := p.Read() - trav = append(trav, hcl.TraverseAttr{ - Name: string(attrTok.Bytes), - SrcRange: hcl.RangeBetween(dot.Range, attrTok.Range), - }) - lastRange = attrTok.Range - } - - itemExpr := &AnonSymbolExpr{ - SrcRange: hcl.RangeBetween(dot.Range, marker.Range), - } - var travExpr Expression - if len(trav) == 0 { - travExpr = itemExpr - } else { - travExpr = &RelativeTraversalExpr{ - Source: itemExpr, - Traversal: trav, - SrcRange: hcl.RangeBetween(firstRange, lastRange), - } - } - - ret = &SplatExpr{ - Source: ret, - Each: travExpr, - Item: itemExpr, - - SrcRange: hcl.RangeBetween(dot.Range, lastRange), - MarkerRange: hcl.RangeBetween(dot.Range, marker.Range), - } - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid attribute name", - Detail: "An attribute name is required after a dot.", - Subject: &attrTok.Range, - }) - // This leaves the peeker in a bad place, so following items - // will probably be misparsed until we hit something that - // allows us to re-sync. - // - // We will probably need to do something better here eventually - // in order to support autocomplete triggered by typing a - // period. - p.setRecovery() - } - - case TokenOBrack: - // Indexing of a collection. - // This may or may not be a hcl.Traverser, depending on whether - // the key value is something constant. - - open := p.Read() - // TODO: If we have a TokenStar inside our brackets, parse as - // a Splat expression: foo[*].baz[0]. - var close Token - p.PushIncludeNewlines(false) // arbitrary newlines allowed in brackets - keyExpr, keyDiags := p.ParseExpression() - diags = append(diags, keyDiags...) - if p.recovery && keyDiags.HasErrors() { - close = p.recover(TokenCBrack) - } else { - close = p.Read() - if close.Type != TokenCBrack && !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing close bracket on index", - Detail: "The index operator must end with a closing bracket (\"]\").", - Subject: &close.Range, - }) - close = p.recover(TokenCBrack) - } - } - p.PushIncludeNewlines(true) - - if lit, isLit := keyExpr.(*LiteralValueExpr); isLit { - litKey, _ := lit.Value(nil) - rng := hcl.RangeBetween(open.Range, close.Range) - step := hcl.TraverseIndex{ - Key: litKey, - SrcRange: rng, - } - ret = makeRelativeTraversal(ret, step, rng) - } else { - rng := hcl.RangeBetween(open.Range, close.Range) - ret = &IndexExpr{ - Collection: ret, - Key: keyExpr, - - SrcRange: rng, - OpenRange: open.Range, - } - } - - default: - break Traversal - } - } - - return ret, diags -} - -// makeRelativeTraversal takes an expression and a traverser and returns -// a traversal expression that combines the two. If the given expression -// is already a traversal, it is extended in place (mutating it) and -// returned. If it isn't, a new RelativeTraversalExpr is created and returned. -func makeRelativeTraversal(expr Expression, next hcl.Traverser, rng hcl.Range) Expression { - switch texpr := expr.(type) { - case *ScopeTraversalExpr: - texpr.Traversal = append(texpr.Traversal, next) - texpr.SrcRange = hcl.RangeBetween(texpr.SrcRange, rng) - return texpr - case *RelativeTraversalExpr: - texpr.Traversal = append(texpr.Traversal, next) - texpr.SrcRange = hcl.RangeBetween(texpr.SrcRange, rng) - return texpr - default: - return &RelativeTraversalExpr{ - Source: expr, - Traversal: hcl.Traversal{next}, - SrcRange: rng, - } - } -} - -func (p *parser) parseExpressionTerm() (Expression, hcl.Diagnostics) { - start := p.Peek() - - switch start.Type { - case TokenOParen: - p.Read() // eat open paren - - p.PushIncludeNewlines(false) - - expr, diags := p.ParseExpression() - if diags.HasErrors() { - // attempt to place the peeker after our closing paren - // before we return, so that the next parser has some - // chance of finding a valid expression. - p.recover(TokenCParen) - p.PopIncludeNewlines() - return expr, diags - } - - close := p.Peek() - if close.Type != TokenCParen { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unbalanced parentheses", - Detail: "Expected a closing parenthesis to terminate the expression.", - Subject: &close.Range, - Context: hcl.RangeBetween(start.Range, close.Range).Ptr(), - }) - p.setRecovery() - } - - p.Read() // eat closing paren - p.PopIncludeNewlines() - - return expr, diags - - case TokenNumberLit: - tok := p.Read() // eat number token - - numVal, diags := p.numberLitValue(tok) - return &LiteralValueExpr{ - Val: numVal, - SrcRange: tok.Range, - }, diags - - case TokenIdent: - tok := p.Read() // eat identifier token - - if p.Peek().Type == TokenOParen { - return p.finishParsingFunctionCall(tok) - } - - name := string(tok.Bytes) - switch name { - case "true": - return &LiteralValueExpr{ - Val: cty.True, - SrcRange: tok.Range, - }, nil - case "false": - return &LiteralValueExpr{ - Val: cty.False, - SrcRange: tok.Range, - }, nil - case "null": - return &LiteralValueExpr{ - Val: cty.NullVal(cty.DynamicPseudoType), - SrcRange: tok.Range, - }, nil - default: - return &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: name, - SrcRange: tok.Range, - }, - }, - SrcRange: tok.Range, - }, nil - } - - case TokenOQuote, TokenOHeredoc: - open := p.Read() // eat opening marker - closer := p.oppositeBracket(open.Type) - exprs, passthru, _, diags := p.parseTemplateInner(closer) - - closeRange := p.PrevRange() - - if passthru { - if len(exprs) != 1 { - panic("passthru set with len(exprs) != 1") - } - return &TemplateWrapExpr{ - Wrapped: exprs[0], - SrcRange: hcl.RangeBetween(open.Range, closeRange), - }, diags - } - - return &TemplateExpr{ - Parts: exprs, - SrcRange: hcl.RangeBetween(open.Range, closeRange), - }, diags - - case TokenMinus: - tok := p.Read() // eat minus token - - // Important to use parseExpressionWithTraversals rather than parseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - // e.g. -46+5 should parse as (-46)+5, not -(46+5) - operand, diags := p.parseExpressionWithTraversals() - return &UnaryOpExpr{ - Op: OpNegate, - Val: operand, - - SrcRange: hcl.RangeBetween(tok.Range, operand.Range()), - SymbolRange: tok.Range, - }, diags - - case TokenBang: - tok := p.Read() // eat bang token - - // Important to use parseExpressionWithTraversals rather than parseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - operand, diags := p.parseExpressionWithTraversals() - return &UnaryOpExpr{ - Op: OpLogicalNot, - Val: operand, - - SrcRange: hcl.RangeBetween(tok.Range, operand.Range()), - SymbolRange: tok.Range, - }, diags - - case TokenOBrack: - return p.parseTupleCons() - - case TokenOBrace: - return p.parseObjectCons() - - default: - var diags hcl.Diagnostics - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid expression", - Detail: "Expected the start of an expression, but found an invalid expression token.", - Subject: &start.Range, - }) - } - p.setRecovery() - - // Return a placeholder so that the AST is still structurally sound - // even in the presence of parse errors. - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: start.Range, - }, diags - } -} - -func (p *parser) numberLitValue(tok Token) (cty.Value, hcl.Diagnostics) { - // We'll lean on the cty converter to do the conversion, to ensure that - // the behavior is the same as what would happen if converting a - // non-literal string to a number. - numStrVal := cty.StringVal(string(tok.Bytes)) - numVal, err := convert.Convert(numStrVal, cty.Number) - if err != nil { - ret := cty.UnknownVal(cty.Number) - return ret, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid number literal", - // FIXME: not a very good error message, but convert only - // gives us "a number is required", so not much help either. - Detail: "Failed to recognize the value of this number literal.", - Subject: &tok.Range, - }, - } - } - return numVal, nil -} - -// finishParsingFunctionCall parses a function call assuming that the function -// name was already read, and so the peeker should be pointing at the opening -// parenthesis after the name. -func (p *parser) finishParsingFunctionCall(name Token) (Expression, hcl.Diagnostics) { - openTok := p.Read() - if openTok.Type != TokenOParen { - // should never happen if callers behave - panic("finishParsingFunctionCall called with non-parenthesis as next token") - } - - var args []Expression - var diags hcl.Diagnostics - var expandFinal bool - var closeTok Token - - // Arbitrary newlines are allowed inside the function call parentheses. - p.PushIncludeNewlines(false) - -Token: - for { - tok := p.Peek() - - if tok.Type == TokenCParen { - closeTok = p.Read() // eat closing paren - break Token - } - - arg, argDiags := p.ParseExpression() - args = append(args, arg) - diags = append(diags, argDiags...) - if p.recovery && argDiags.HasErrors() { - // if there was a parse error in the argument then we've - // probably been left in a weird place in the token stream, - // so we'll bail out with a partial argument list. - p.recover(TokenCParen) - break Token - } - - sep := p.Read() - if sep.Type == TokenCParen { - closeTok = sep - break Token - } - - if sep.Type == TokenEllipsis { - expandFinal = true - - if p.Peek().Type != TokenCParen { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing closing parenthesis", - Detail: "An expanded function argument (with ...) must be immediately followed by closing parentheses.", - Subject: &sep.Range, - Context: hcl.RangeBetween(name.Range, sep.Range).Ptr(), - }) - } - closeTok = p.recover(TokenCParen) - } else { - closeTok = p.Read() // eat closing paren - } - break Token - } - - if sep.Type != TokenComma { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing argument separator", - Detail: "A comma is required to separate each function argument from the next.", - Subject: &sep.Range, - Context: hcl.RangeBetween(name.Range, sep.Range).Ptr(), - }) - closeTok = p.recover(TokenCParen) - break Token - } - - if p.Peek().Type == TokenCParen { - // A trailing comma after the last argument gets us in here. - closeTok = p.Read() // eat closing paren - break Token - } - - } - - p.PopIncludeNewlines() - - return &FunctionCallExpr{ - Name: string(name.Bytes), - Args: args, - - ExpandFinal: expandFinal, - - NameRange: name.Range, - OpenParenRange: openTok.Range, - CloseParenRange: closeTok.Range, - }, diags -} - -func (p *parser) parseTupleCons() (Expression, hcl.Diagnostics) { - open := p.Read() - if open.Type != TokenOBrack { - // Should never happen if callers are behaving - panic("parseTupleCons called without peeker pointing to open bracket") - } - - p.PushIncludeNewlines(false) - defer p.PopIncludeNewlines() - - if forKeyword.TokenMatches(p.Peek()) { - return p.finishParsingForExpr(open) - } - - var close Token - - var diags hcl.Diagnostics - var exprs []Expression - - for { - next := p.Peek() - if next.Type == TokenCBrack { - close = p.Read() // eat closer - break - } - - expr, exprDiags := p.ParseExpression() - exprs = append(exprs, expr) - diags = append(diags, exprDiags...) - - if p.recovery && exprDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing bracket to allow parsing to continue. - close = p.recover(TokenCBrack) - break - } - - next = p.Peek() - if next.Type == TokenCBrack { - close = p.Read() // eat closer - break - } - - if next.Type != TokenComma { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing item separator", - Detail: "Expected a comma to mark the beginning of the next item.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - close = p.recover(TokenCBrack) - break - } - - p.Read() // eat comma - - } - - return &TupleConsExpr{ - Exprs: exprs, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - }, diags -} - -func (p *parser) parseObjectCons() (Expression, hcl.Diagnostics) { - open := p.Read() - if open.Type != TokenOBrace { - // Should never happen if callers are behaving - panic("parseObjectCons called without peeker pointing to open brace") - } - - p.PushIncludeNewlines(true) - defer p.PopIncludeNewlines() - - if forKeyword.TokenMatches(p.Peek()) { - return p.finishParsingForExpr(open) - } - - var close Token - - var diags hcl.Diagnostics - var items []ObjectConsItem - - for { - next := p.Peek() - if next.Type == TokenNewline { - p.Read() // eat newline - continue - } - - if next.Type == TokenCBrace { - close = p.Read() // eat closer - break - } - - // As a special case, we allow the key to be a literal identifier. - // This means that a variable reference or function call can't appear - // directly as key expression, and must instead be wrapped in some - // disambiguation punctuation, like (var.a) = "b" or "${var.a}" = "b". - var key Expression - var keyDiags hcl.Diagnostics - if p.Peek().Type == TokenIdent { - nameTok := p.Read() - key = &LiteralValueExpr{ - Val: cty.StringVal(string(nameTok.Bytes)), - - SrcRange: nameTok.Range, - } - } else { - key, keyDiags = p.ParseExpression() - } - - diags = append(diags, keyDiags...) - - if p.recovery && keyDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing brace to allow parsing to continue. - close = p.recover(TokenCBrace) - break - } - - next = p.Peek() - if next.Type != TokenEqual && next.Type != TokenColon { - if !p.recovery { - if next.Type == TokenNewline || next.Type == TokenComma { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing item value", - Detail: "Expected an item value, introduced by an equals sign (\"=\").", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing key/value separator", - Detail: "Expected an equals sign (\"=\") to mark the beginning of the item value.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - } - close = p.recover(TokenCBrace) - break - } - - p.Read() // eat equals sign or colon - - value, valueDiags := p.ParseExpression() - diags = append(diags, valueDiags...) - - if p.recovery && valueDiags.HasErrors() { - // If expression parsing failed then we are probably in a strange - // place in the token stream, so we'll bail out and try to reset - // to after our closing brace to allow parsing to continue. - close = p.recover(TokenCBrace) - break - } - - items = append(items, ObjectConsItem{ - KeyExpr: key, - ValueExpr: value, - }) - - next = p.Peek() - if next.Type == TokenCBrace { - close = p.Read() // eat closer - break - } - - if next.Type != TokenComma && next.Type != TokenNewline { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing item separator", - Detail: "Expected a newline or comma to mark the beginning of the next item.", - Subject: &next.Range, - Context: hcl.RangeBetween(open.Range, next.Range).Ptr(), - }) - } - close = p.recover(TokenCBrace) - break - } - - p.Read() // eat comma or newline - - } - - return &ObjectConsExpr{ - Items: items, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - }, diags -} - -func (p *parser) finishParsingForExpr(open Token) (Expression, hcl.Diagnostics) { - introducer := p.Read() - if !forKeyword.TokenMatches(introducer) { - // Should never happen if callers are behaving - panic("finishParsingForExpr called without peeker pointing to 'for' identifier") - } - - var makeObj bool - var closeType TokenType - switch open.Type { - case TokenOBrace: - makeObj = true - closeType = TokenCBrace - case TokenOBrack: - makeObj = false // making a tuple - closeType = TokenCBrack - default: - // Should never happen if callers are behaving - panic("finishParsingForExpr called with invalid open token") - } - - var diags hcl.Diagnostics - var keyName, valName string - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires variable name after 'for'.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - valName = string(p.Read().Bytes) - - if p.Peek().Type == TokenComma { - // What we just read was actually the key, then. - keyName = valName - p.Read() // eat comma - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires value variable name after comma.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - valName = string(p.Read().Bytes) - } - - if !inKeyword.TokenMatches(p.Peek()) { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires 'in' keyword after names.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - p.Read() // eat 'in' keyword - - collExpr, collDiags := p.ParseExpression() - diags = append(diags, collDiags...) - if p.recovery && collDiags.HasErrors() { - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - if p.Peek().Type != TokenColon { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "For expression requires colon after collection expression.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - p.Read() // eat colon - - var keyExpr, valExpr Expression - var keyDiags, valDiags hcl.Diagnostics - valExpr, valDiags = p.ParseExpression() - if p.Peek().Type == TokenFatArrow { - // What we just parsed was actually keyExpr - p.Read() // eat the fat arrow - keyExpr, keyDiags = valExpr, valDiags - - valExpr, valDiags = p.ParseExpression() - } - diags = append(diags, keyDiags...) - diags = append(diags, valDiags...) - if p.recovery && (keyDiags.HasErrors() || valDiags.HasErrors()) { - close := p.recover(closeType) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - - group := false - var ellipsis Token - if p.Peek().Type == TokenEllipsis { - ellipsis = p.Read() - group = true - } - - var condExpr Expression - var condDiags hcl.Diagnostics - if ifKeyword.TokenMatches(p.Peek()) { - p.Read() // eat "if" - condExpr, condDiags = p.ParseExpression() - diags = append(diags, condDiags...) - if p.recovery && condDiags.HasErrors() { - close := p.recover(p.oppositeBracket(open.Type)) - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }, diags - } - } - - var close Token - if p.Peek().Type == closeType { - close = p.Read() - } else { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Extra characters after the end of the 'for' expression.", - Subject: p.Peek().Range.Ptr(), - Context: hcl.RangeBetween(open.Range, p.Peek().Range).Ptr(), - }) - } - close = p.recover(closeType) - } - - if !makeObj { - if keyExpr != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Key expression is not valid when building a tuple.", - Subject: keyExpr.Range().Ptr(), - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - if group { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Grouping ellipsis (...) cannot be used when building a tuple.", - Subject: &ellipsis.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - } else { - if keyExpr == nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' expression", - Detail: "Key expression is required when building an object.", - Subject: valExpr.Range().Ptr(), - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - } - - return &ForExpr{ - KeyVar: keyName, - ValVar: valName, - CollExpr: collExpr, - KeyExpr: keyExpr, - ValExpr: valExpr, - CondExpr: condExpr, - Group: group, - - SrcRange: hcl.RangeBetween(open.Range, close.Range), - OpenRange: open.Range, - CloseRange: close.Range, - }, diags -} - -// parseQuotedStringLiteral is a helper for parsing quoted strings that -// aren't allowed to contain any interpolations, such as block labels. -func (p *parser) parseQuotedStringLiteral() (string, hcl.Range, hcl.Diagnostics) { - oQuote := p.Read() - if oQuote.Type != TokenOQuote { - return "", oQuote.Range, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: "A quoted string is required here.", - Subject: &oQuote.Range, - }, - } - } - - var diags hcl.Diagnostics - ret := &bytes.Buffer{} - var cQuote Token - -Token: - for { - tok := p.Read() - switch tok.Type { - - case TokenCQuote: - cQuote = tok - break Token - - case TokenQuotedLit: - s, sDiags := p.decodeStringLit(tok) - diags = append(diags, sDiags...) - ret.WriteString(s) - - case TokenTemplateControl, TokenTemplateInterp: - which := "$" - if tok.Type == TokenTemplateControl { - which = "!" - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: fmt.Sprintf( - "Template sequences are not allowed in this string. To include a literal %q, double it (as \"%s%s\") to escape it.", - which, which, which, - ), - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - p.recover(TokenTemplateSeqEnd) - - case TokenEOF: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unterminated string literal", - Detail: "Unable to find the closing quote mark before the end of the file.", - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - break Token - - default: - // Should never happen, as long as the scanner is behaving itself - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid string literal", - Detail: "This item is not valid in a string literal.", - Subject: &tok.Range, - Context: hcl.RangeBetween(oQuote.Range, tok.Range).Ptr(), - }) - p.recover(TokenOQuote) - break Token - - } - - } - - return ret.String(), hcl.RangeBetween(oQuote.Range, cQuote.Range), diags -} - -// decodeStringLit processes the given token, which must be either a -// TokenQuotedLit or a TokenStringLit, returning the string resulting from -// resolving any escape sequences. -// -// If any error diagnostics are returned, the returned string may be incomplete -// or otherwise invalid. -func (p *parser) decodeStringLit(tok Token) (string, hcl.Diagnostics) { - var quoted bool - switch tok.Type { - case TokenQuotedLit: - quoted = true - case TokenStringLit: - quoted = false - default: - panic("decodeQuotedLit can only be used with TokenStringLit and TokenQuotedLit tokens") - } - var diags hcl.Diagnostics - - ret := make([]byte, 0, len(tok.Bytes)) - var esc []byte - - sc := bufio.NewScanner(bytes.NewReader(tok.Bytes)) - sc.Split(textseg.ScanGraphemeClusters) - - pos := tok.Range.Start - newPos := pos -Character: - for sc.Scan() { - pos = newPos - ch := sc.Bytes() - - // Adjust position based on our new character. - // \r\n is considered to be a single character in text segmentation, - if (len(ch) == 1 && ch[0] == '\n') || (len(ch) == 2 && ch[1] == '\n') { - newPos.Line++ - newPos.Column = 0 - } else { - newPos.Column++ - } - newPos.Byte += len(ch) - - if len(esc) > 0 { - switch esc[0] { - case '\\': - if len(ch) == 1 { - switch ch[0] { - - // TODO: numeric character escapes with \uXXXX - - case 'n': - ret = append(ret, '\n') - esc = esc[:0] - continue Character - case 'r': - ret = append(ret, '\r') - esc = esc[:0] - continue Character - case 't': - ret = append(ret, '\t') - esc = esc[:0] - continue Character - case '"': - ret = append(ret, '"') - esc = esc[:0] - continue Character - case '\\': - ret = append(ret, '\\') - esc = esc[:0] - continue Character - } - } - - var detail string - switch { - case len(ch) == 1 && (ch[0] == '$' || ch[0] == '%'): - detail = fmt.Sprintf( - "The characters \"\\%s\" do not form a recognized escape sequence. To escape a \"%s{\" template sequence, use \"%s%s{\".", - ch, ch, ch, ch, - ) - default: - detail = fmt.Sprintf("The characters \"\\%s\" do not form a recognized escape sequence.", ch) - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: detail, - Subject: &hcl.Range{ - Filename: tok.Range.Filename, - Start: hcl.Pos{ - Line: pos.Line, - Column: pos.Column - 1, // safe because we know the previous character must be a backslash - Byte: pos.Byte - 1, - }, - End: hcl.Pos{ - Line: pos.Line, - Column: pos.Column + 1, // safe because we know the previous character must be a backslash - Byte: pos.Byte + len(ch), - }, - }, - }) - ret = append(ret, ch...) - esc = esc[:0] - continue Character - - case '$', '%': - switch len(esc) { - case 1: - if len(ch) == 1 && ch[0] == esc[0] { - esc = append(esc, ch[0]) - continue Character - } - - // Any other character means this wasn't an escape sequence - // after all. - ret = append(ret, esc...) - ret = append(ret, ch...) - esc = esc[:0] - case 2: - if len(ch) == 1 && ch[0] == '{' { - // successful escape sequence - ret = append(ret, esc[0]) - } else { - // not an escape sequence, so just output literal - ret = append(ret, esc...) - } - ret = append(ret, ch...) - esc = esc[:0] - default: - // should never happen - panic("have invalid escape sequence >2 characters") - } - - } - } else { - if len(ch) == 1 { - switch ch[0] { - case '\\': - if quoted { // ignore backslashes in unquoted mode - esc = append(esc, '\\') - continue Character - } - case '$': - esc = append(esc, '$') - continue Character - case '%': - esc = append(esc, '%') - continue Character - } - } - ret = append(ret, ch...) - } - } - - // if we still have an outstanding "esc" when we fall out here then - // the literal ended with an unterminated escape sequence, which we - // must now deal with. - if len(esc) > 0 { - if esc[0] == '\\' { - // An incomplete backslash sequence is an error, since it suggests - // that e.g. the user started writing a \uXXXX sequence but didn't - // provide enough hex digits. - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid escape sequence", - Detail: fmt.Sprintf("The characters %q do not form a recognized escape sequence.", esc), - Subject: &hcl.Range{ - Filename: tok.Range.Filename, - Start: hcl.Pos{ - Line: pos.Line, - Column: pos.Column, - Byte: pos.Byte, - }, - End: hcl.Pos{ - Line: pos.Line, - Column: pos.Column + len(esc), - Byte: pos.Byte + len(esc), - }, - }, - }) - - } - // This might also be an incomplete $${ or %%{ escape sequence, but - // that's treated as a literal rather than an error since those only - // count as escape sequences when all three characters are present. - - ret = append(ret, esc...) - esc = nil - } - - return string(ret), diags -} - -// setRecovery turns on recovery mode without actually doing any recovery. -// This can be used when a parser knowingly leaves the peeker in a useless -// place and wants to suppress errors that might result from that decision. -func (p *parser) setRecovery() { - p.recovery = true -} - -// recover seeks forward in the token stream until it finds TokenType "end", -// then returns with the peeker pointed at the following token. -// -// If the given token type is a bracketer, this function will additionally -// count nested instances of the brackets to try to leave the peeker at -// the end of the _current_ instance of that bracketer, skipping over any -// nested instances. This is a best-effort operation and may have -// unpredictable results on input with bad bracketer nesting. -func (p *parser) recover(end TokenType) Token { - start := p.oppositeBracket(end) - p.recovery = true - - nest := 0 - for { - tok := p.Read() - ty := tok.Type - if end == TokenTemplateSeqEnd && ty == TokenTemplateControl { - // normalize so that our matching behavior can work, since - // TokenTemplateControl/TokenTemplateInterp are asymmetrical - // with TokenTemplateSeqEnd and thus we need to count both - // openers if that's the closer we're looking for. - ty = TokenTemplateInterp - } - - switch ty { - case start: - nest++ - case end: - if nest < 1 { - return tok - } - - nest-- - case TokenEOF: - return tok - } - } -} - -// recoverOver seeks forward in the token stream until it finds a block -// starting with TokenType "start", then finds the corresponding end token, -// leaving the peeker pointed at the token after that end token. -// -// The given token type _must_ be a bracketer. For example, if the given -// start token is TokenOBrace then the parser will be left at the _end_ of -// the next brace-delimited block encountered, or at EOF if no such block -// is found or it is unclosed. -func (p *parser) recoverOver(start TokenType) { - end := p.oppositeBracket(start) - - // find the opening bracket first -Token: - for { - tok := p.Read() - switch tok.Type { - case start, TokenEOF: - break Token - } - } - - // Now use our existing recover function to locate the _end_ of the - // container we've found. - p.recover(end) -} - -func (p *parser) recoverAfterBodyItem() { - p.recovery = true - var open []TokenType - -Token: - for { - tok := p.Read() - - switch tok.Type { - - case TokenNewline: - if len(open) == 0 { - break Token - } - - case TokenEOF: - break Token - - case TokenOBrace, TokenOBrack, TokenOParen, TokenOQuote, TokenOHeredoc, TokenTemplateInterp, TokenTemplateControl: - open = append(open, tok.Type) - - case TokenCBrace, TokenCBrack, TokenCParen, TokenCQuote, TokenCHeredoc: - opener := p.oppositeBracket(tok.Type) - for len(open) > 0 && open[len(open)-1] != opener { - open = open[:len(open)-1] - } - if len(open) > 0 { - open = open[:len(open)-1] - } - - case TokenTemplateSeqEnd: - for len(open) > 0 && open[len(open)-1] != TokenTemplateInterp && open[len(open)-1] != TokenTemplateControl { - open = open[:len(open)-1] - } - if len(open) > 0 { - open = open[:len(open)-1] - } - - } - } -} - -// oppositeBracket finds the bracket that opposes the given bracketer, or -// NilToken if the given token isn't a bracketer. -// -// "Bracketer", for the sake of this function, is one end of a matching -// open/close set of tokens that establish a bracketing context. -func (p *parser) oppositeBracket(ty TokenType) TokenType { - switch ty { - - case TokenOBrace: - return TokenCBrace - case TokenOBrack: - return TokenCBrack - case TokenOParen: - return TokenCParen - case TokenOQuote: - return TokenCQuote - case TokenOHeredoc: - return TokenCHeredoc - - case TokenCBrace: - return TokenOBrace - case TokenCBrack: - return TokenOBrack - case TokenCParen: - return TokenOParen - case TokenCQuote: - return TokenOQuote - case TokenCHeredoc: - return TokenOHeredoc - - case TokenTemplateControl: - return TokenTemplateSeqEnd - case TokenTemplateInterp: - return TokenTemplateSeqEnd - case TokenTemplateSeqEnd: - // This is ambigous, but we return Interp here because that's - // what's assumed by the "recover" method. - return TokenTemplateInterp - - default: - return TokenNil - } -} - -func errPlaceholderExpr(rng hcl.Range) Expression { - return &LiteralValueExpr{ - Val: cty.DynamicVal, - SrcRange: rng, - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_template.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_template.go deleted file mode 100644 index 3711067..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_template.go +++ /dev/null @@ -1,728 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "strings" - "unicode" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -func (p *parser) ParseTemplate() (Expression, hcl.Diagnostics) { - return p.parseTemplate(TokenEOF) -} - -func (p *parser) parseTemplate(end TokenType) (Expression, hcl.Diagnostics) { - exprs, passthru, rng, diags := p.parseTemplateInner(end) - - if passthru { - if len(exprs) != 1 { - panic("passthru set with len(exprs) != 1") - } - return &TemplateWrapExpr{ - Wrapped: exprs[0], - SrcRange: rng, - }, diags - } - - return &TemplateExpr{ - Parts: exprs, - SrcRange: rng, - }, diags -} - -func (p *parser) parseTemplateInner(end TokenType) ([]Expression, bool, hcl.Range, hcl.Diagnostics) { - parts, diags := p.parseTemplateParts(end) - tp := templateParser{ - Tokens: parts.Tokens, - SrcRange: parts.SrcRange, - } - exprs, exprsDiags := tp.parseRoot() - diags = append(diags, exprsDiags...) - - passthru := false - if len(parts.Tokens) == 2 { // one real token and one synthetic "end" token - if _, isInterp := parts.Tokens[0].(*templateInterpToken); isInterp { - passthru = true - } - } - - return exprs, passthru, parts.SrcRange, diags -} - -type templateParser struct { - Tokens []templateToken - SrcRange hcl.Range - - pos int -} - -func (p *templateParser) parseRoot() ([]Expression, hcl.Diagnostics) { - var exprs []Expression - var diags hcl.Diagnostics - - for { - next := p.Peek() - if _, isEnd := next.(*templateEndToken); isEnd { - break - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - exprs = append(exprs, expr) - } - - return exprs, diags -} - -func (p *templateParser) parseExpr() (Expression, hcl.Diagnostics) { - next := p.Peek() - switch tok := next.(type) { - - case *templateLiteralToken: - p.Read() // eat literal - return &LiteralValueExpr{ - Val: cty.StringVal(tok.Val), - SrcRange: tok.SrcRange, - }, nil - - case *templateInterpToken: - p.Read() // eat interp - return tok.Expr, nil - - case *templateIfToken: - return p.parseIf() - - case *templateForToken: - return p.parseFor() - - case *templateEndToken: - p.Read() // eat erroneous token - return errPlaceholderExpr(tok.SrcRange), hcl.Diagnostics{ - { - // This is a particularly unhelpful diagnostic, so callers - // should attempt to pre-empt it and produce a more helpful - // diagnostic that is context-aware. - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: "The control directives within this template are unbalanced.", - Subject: &tok.SrcRange, - }, - } - - case *templateEndCtrlToken: - p.Read() // eat erroneous token - return errPlaceholderExpr(tok.SrcRange), hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", tok.Name()), - Detail: "The control directives within this template are unbalanced.", - Subject: &tok.SrcRange, - }, - } - - default: - // should never happen, because above should be exhaustive - panic(fmt.Sprintf("unhandled template token type %T", next)) - } -} - -func (p *templateParser) parseIf() (Expression, hcl.Diagnostics) { - open := p.Read() - openIf, isIf := open.(*templateIfToken) - if !isIf { - // should never happen if caller is behaving - panic("parseIf called with peeker not pointing at if token") - } - - var ifExprs, elseExprs []Expression - var diags hcl.Diagnostics - var endifRange hcl.Range - - currentExprs := &ifExprs -Token: - for { - next := p.Peek() - if end, isEnd := next.(*templateEndToken); isEnd { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: fmt.Sprintf( - "The if directive at %s is missing its corresponding endif directive.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - return errPlaceholderExpr(end.SrcRange), diags - } - if end, isCtrlEnd := next.(*templateEndCtrlToken); isCtrlEnd { - p.Read() // eat end directive - - switch end.Type { - - case templateElse: - if currentExprs == &ifExprs { - currentExprs = &elseExprs - continue Token - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected else directive", - Detail: fmt.Sprintf( - "Already in the else clause for the if started at %s.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - - case templateEndIf: - endifRange = end.SrcRange - break Token - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", end.Name()), - Detail: fmt.Sprintf( - "Expecting an endif directive for the if started at %s.", - openIf.SrcRange, - ), - Subject: &end.SrcRange, - }) - } - - return errPlaceholderExpr(end.SrcRange), diags - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - *currentExprs = append(*currentExprs, expr) - } - - if len(ifExprs) == 0 { - ifExprs = append(ifExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: openIf.SrcRange.Filename, - Start: openIf.SrcRange.End, - End: openIf.SrcRange.End, - }, - }) - } - if len(elseExprs) == 0 { - elseExprs = append(elseExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: endifRange.Filename, - Start: endifRange.Start, - End: endifRange.Start, - }, - }) - } - - trueExpr := &TemplateExpr{ - Parts: ifExprs, - SrcRange: hcl.RangeBetween(ifExprs[0].Range(), ifExprs[len(ifExprs)-1].Range()), - } - falseExpr := &TemplateExpr{ - Parts: elseExprs, - SrcRange: hcl.RangeBetween(elseExprs[0].Range(), elseExprs[len(elseExprs)-1].Range()), - } - - return &ConditionalExpr{ - Condition: openIf.CondExpr, - TrueResult: trueExpr, - FalseResult: falseExpr, - - SrcRange: hcl.RangeBetween(openIf.SrcRange, endifRange), - }, diags -} - -func (p *templateParser) parseFor() (Expression, hcl.Diagnostics) { - open := p.Read() - openFor, isFor := open.(*templateForToken) - if !isFor { - // should never happen if caller is behaving - panic("parseFor called with peeker not pointing at for token") - } - - var contentExprs []Expression - var diags hcl.Diagnostics - var endforRange hcl.Range - -Token: - for { - next := p.Peek() - if end, isEnd := next.(*templateEndToken); isEnd { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected end of template", - Detail: fmt.Sprintf( - "The for directive at %s is missing its corresponding endfor directive.", - openFor.SrcRange, - ), - Subject: &end.SrcRange, - }) - return errPlaceholderExpr(end.SrcRange), diags - } - if end, isCtrlEnd := next.(*templateEndCtrlToken); isCtrlEnd { - p.Read() // eat end directive - - switch end.Type { - - case templateElse: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unexpected else directive", - Detail: "An else clause is not expected for a for directive.", - Subject: &end.SrcRange, - }) - - case templateEndFor: - endforRange = end.SrcRange - break Token - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s directive", end.Name()), - Detail: fmt.Sprintf( - "Expecting an endfor directive corresponding to the for directive at %s.", - openFor.SrcRange, - ), - Subject: &end.SrcRange, - }) - } - - return errPlaceholderExpr(end.SrcRange), diags - } - - expr, exprDiags := p.parseExpr() - diags = append(diags, exprDiags...) - contentExprs = append(contentExprs, expr) - } - - if len(contentExprs) == 0 { - contentExprs = append(contentExprs, &LiteralValueExpr{ - Val: cty.StringVal(""), - SrcRange: hcl.Range{ - Filename: openFor.SrcRange.Filename, - Start: openFor.SrcRange.End, - End: openFor.SrcRange.End, - }, - }) - } - - contentExpr := &TemplateExpr{ - Parts: contentExprs, - SrcRange: hcl.RangeBetween(contentExprs[0].Range(), contentExprs[len(contentExprs)-1].Range()), - } - - forExpr := &ForExpr{ - KeyVar: openFor.KeyVar, - ValVar: openFor.ValVar, - - CollExpr: openFor.CollExpr, - ValExpr: contentExpr, - - SrcRange: hcl.RangeBetween(openFor.SrcRange, endforRange), - OpenRange: openFor.SrcRange, - CloseRange: endforRange, - } - - return &TemplateJoinExpr{ - Tuple: forExpr, - }, diags -} - -func (p *templateParser) Peek() templateToken { - return p.Tokens[p.pos] -} - -func (p *templateParser) Read() templateToken { - ret := p.Peek() - if _, end := ret.(*templateEndToken); !end { - p.pos++ - } - return ret -} - -// parseTemplateParts produces a flat sequence of "template tokens", which are -// either literal values (with any "trimming" already applied), interpolation -// sequences, or control flow markers. -// -// A further pass is required on the result to turn it into an AST. -func (p *parser) parseTemplateParts(end TokenType) (*templateParts, hcl.Diagnostics) { - var parts []templateToken - var diags hcl.Diagnostics - - startRange := p.NextRange() - ltrimNext := false - nextCanTrimPrev := false - var endRange hcl.Range - -Token: - for { - next := p.Read() - if next.Type == end { - // all done! - endRange = next.Range - break - } - - ltrim := ltrimNext - ltrimNext = false - canTrimPrev := nextCanTrimPrev - nextCanTrimPrev = false - - switch next.Type { - case TokenStringLit, TokenQuotedLit: - str, strDiags := p.decodeStringLit(next) - diags = append(diags, strDiags...) - - if ltrim { - str = strings.TrimLeftFunc(str, unicode.IsSpace) - } - - parts = append(parts, &templateLiteralToken{ - Val: str, - SrcRange: next.Range, - }) - nextCanTrimPrev = true - - case TokenTemplateInterp: - // if the opener is ${~ then we want to eat any trailing whitespace - // in the preceding literal token, assuming it is indeed a literal - // token. - if canTrimPrev && len(next.Bytes) == 3 && next.Bytes[2] == '~' && len(parts) > 0 { - prevExpr := parts[len(parts)-1] - if lexpr, ok := prevExpr.(*templateLiteralToken); ok { - lexpr.Val = strings.TrimRightFunc(lexpr.Val, unicode.IsSpace) - } - } - - p.PushIncludeNewlines(false) - expr, exprDiags := p.ParseExpression() - diags = append(diags, exprDiags...) - close := p.Peek() - if close.Type != TokenTemplateSeqEnd { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extra characters after interpolation expression", - Detail: "Expected a closing brace to end the interpolation expression, but found extra characters.", - Subject: &close.Range, - Context: hcl.RangeBetween(startRange, close.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - } else { - p.Read() // eat closing brace - - // If the closer is ~} then we want to eat any leading - // whitespace on the next token, if it turns out to be a - // literal token. - if len(close.Bytes) == 2 && close.Bytes[0] == '~' { - ltrimNext = true - } - } - p.PopIncludeNewlines() - parts = append(parts, &templateInterpToken{ - Expr: expr, - SrcRange: hcl.RangeBetween(next.Range, close.Range), - }) - - case TokenTemplateControl: - // if the opener is %{~ then we want to eat any trailing whitespace - // in the preceding literal token, assuming it is indeed a literal - // token. - if canTrimPrev && len(next.Bytes) == 3 && next.Bytes[2] == '~' && len(parts) > 0 { - prevExpr := parts[len(parts)-1] - if lexpr, ok := prevExpr.(*templateLiteralToken); ok { - lexpr.Val = strings.TrimRightFunc(lexpr.Val, unicode.IsSpace) - } - } - p.PushIncludeNewlines(false) - - kw := p.Peek() - if kw.Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template directive", - Detail: "A template directive keyword (\"if\", \"for\", etc) is expected at the beginning of a %{ sequence.", - Subject: &kw.Range, - Context: hcl.RangeBetween(next.Range, kw.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - p.Read() // eat keyword token - - switch { - - case ifKeyword.TokenMatches(kw): - condExpr, exprDiags := p.ParseExpression() - diags = append(diags, exprDiags...) - parts = append(parts, &templateIfToken{ - CondExpr: condExpr, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case elseKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateElse, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case endifKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateEndIf, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case forKeyword.TokenMatches(kw): - var keyName, valName string - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires variable name after 'for'.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - - valName = string(p.Read().Bytes) - - if p.Peek().Type == TokenComma { - // What we just read was actually the key, then. - keyName = valName - p.Read() // eat comma - - if p.Peek().Type != TokenIdent { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires value variable name after comma.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - - valName = string(p.Read().Bytes) - } - - if !inKeyword.TokenMatches(p.Peek()) { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid 'for' directive", - Detail: "For directive requires 'in' keyword after names.", - Subject: p.Peek().Range.Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - } - p.Read() // eat 'in' keyword - - collExpr, collDiags := p.ParseExpression() - diags = append(diags, collDiags...) - parts = append(parts, &templateForToken{ - KeyVar: keyName, - ValVar: valName, - CollExpr: collExpr, - - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - case endforKeyword.TokenMatches(kw): - parts = append(parts, &templateEndCtrlToken{ - Type: templateEndFor, - SrcRange: hcl.RangeBetween(next.Range, p.NextRange()), - }) - - default: - if !p.recovery { - suggestions := []string{"if", "for", "else", "endif", "endfor"} - given := string(kw.Bytes) - suggestion := nameSuggestion(given, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid template control keyword", - Detail: fmt.Sprintf("%q is not a valid template control keyword.%s", given, suggestion), - Subject: &kw.Range, - Context: hcl.RangeBetween(next.Range, kw.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - p.PopIncludeNewlines() - continue Token - - } - - close := p.Peek() - if close.Type != TokenTemplateSeqEnd { - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extra characters in %s marker", kw.Bytes), - Detail: "Expected a closing brace to end the sequence, but found extra characters.", - Subject: &close.Range, - Context: hcl.RangeBetween(startRange, close.Range).Ptr(), - }) - } - p.recover(TokenTemplateSeqEnd) - } else { - p.Read() // eat closing brace - - // If the closer is ~} then we want to eat any leading - // whitespace on the next token, if it turns out to be a - // literal token. - if len(close.Bytes) == 2 && close.Bytes[0] == '~' { - ltrimNext = true - } - } - p.PopIncludeNewlines() - - default: - if !p.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unterminated template string", - Detail: "No closing marker was found for the string.", - Subject: &next.Range, - Context: hcl.RangeBetween(startRange, next.Range).Ptr(), - }) - } - final := p.recover(end) - endRange = final.Range - break Token - } - } - - if len(parts) == 0 { - // If a sequence has no content, we'll treat it as if it had an - // empty string in it because that's what the user probably means - // if they write "" in configuration. - parts = append(parts, &templateLiteralToken{ - Val: "", - SrcRange: hcl.Range{ - // Range is the zero-character span immediately after the - // opening quote. - Filename: startRange.Filename, - Start: startRange.End, - End: startRange.End, - }, - }) - } - - // Always end with an end token, so the parser can produce diagnostics - // about unclosed items with proper position information. - parts = append(parts, &templateEndToken{ - SrcRange: endRange, - }) - - ret := &templateParts{ - Tokens: parts, - SrcRange: hcl.RangeBetween(startRange, endRange), - } - - return ret, diags -} - -type templateParts struct { - Tokens []templateToken - SrcRange hcl.Range -} - -// templateToken is a higher-level token that represents a single atom within -// the template language. Our template parsing first raises the raw token -// stream to a sequence of templateToken, and then transforms the result into -// an expression tree. -type templateToken interface { - templateToken() templateToken -} - -type templateLiteralToken struct { - Val string - SrcRange hcl.Range - isTemplateToken -} - -type templateInterpToken struct { - Expr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateIfToken struct { - CondExpr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateForToken struct { - KeyVar string // empty if ignoring key - ValVar string - CollExpr Expression - SrcRange hcl.Range - isTemplateToken -} - -type templateEndCtrlType int - -const ( - templateEndIf templateEndCtrlType = iota - templateElse - templateEndFor -) - -type templateEndCtrlToken struct { - Type templateEndCtrlType - SrcRange hcl.Range - isTemplateToken -} - -func (t *templateEndCtrlToken) Name() string { - switch t.Type { - case templateEndIf: - return "endif" - case templateElse: - return "else" - case templateEndFor: - return "endfor" - default: - // should never happen - panic("invalid templateEndCtrlType") - } -} - -type templateEndToken struct { - SrcRange hcl.Range - isTemplateToken -} - -type isTemplateToken [0]int - -func (t isTemplateToken) templateToken() templateToken { - return t -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_test.go deleted file mode 100644 index ee16c6d..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_test.go +++ /dev/null @@ -1,1073 +0,0 @@ -package hclsyntax - -import ( - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/hcl" - "github.com/kylelemons/godebug/pretty" - "github.com/zclconf/go-cty/cty" -) - -func TestParseConfig(t *testing.T) { - tests := []struct { - input string - diagCount int - want *Body - }{ - { - ``, - 0, - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - }, - }, - }, - - { - "block {}\n", - 0, - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: nil, - Body: &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - }, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - LabelRanges: nil, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 9}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 9}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 9}, - }, - }, - }, - { - "block {}block {}\n", - 1, // missing newline after block definition - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: nil, - Body: &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - }, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - LabelRanges: nil, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - End: hcl.Pos{Line: 1, Column: 9, Byte: 8}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 17}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 17}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 17}, - }, - }, - }, - { - "block \"foo\" {}\n", - 0, - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: []string{"foo"}, - Body: &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - LabelRanges: []hcl.Range{ - { - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - End: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - }, - }, - { - ` -block "invalid" 1.2 {} -block "valid" {} -`, - 1, - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: []string{"invalid"}, - Body: nil, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 1}, - End: hcl.Pos{Line: 2, Column: 6, Byte: 6}, - }, - LabelRanges: []hcl.Range{ - { - Start: hcl.Pos{Line: 2, Column: 7, Byte: 7}, - End: hcl.Pos{Line: 2, Column: 16, Byte: 16}, - }, - }, - - // Since we failed parsing before we got to the - // braces, the type range is used as a placeholder - // for these. - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 1}, - End: hcl.Pos{Line: 2, Column: 6, Byte: 6}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 1}, - End: hcl.Pos{Line: 2, Column: 6, Byte: 6}, - }, - }, - - // Recovery behavior should allow us to still see this - // second block, even though the first was invalid. - &Block{ - Type: "block", - Labels: []string{"valid"}, - Body: &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 15, Byte: 38}, - End: hcl.Pos{Line: 3, Column: 17, Byte: 40}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 17, Byte: 40}, - End: hcl.Pos{Line: 3, Column: 17, Byte: 40}, - }, - }, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 1, Byte: 24}, - End: hcl.Pos{Line: 3, Column: 6, Byte: 29}, - }, - LabelRanges: []hcl.Range{ - { - Start: hcl.Pos{Line: 3, Column: 7, Byte: 30}, - End: hcl.Pos{Line: 3, Column: 14, Byte: 37}, - }, - }, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 15, Byte: 38}, - End: hcl.Pos{Line: 3, Column: 16, Byte: 39}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 16, Byte: 39}, - End: hcl.Pos{Line: 3, Column: 17, Byte: 40}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 4, Column: 1, Byte: 41}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 4, Column: 1, Byte: 41}, - End: hcl.Pos{Line: 4, Column: 1, Byte: 41}, - }, - }, - }, - { - `block "f\o" {} -`, - 1, // "\o" is not a valid escape sequence - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: []string{"fo"}, - Body: nil, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - LabelRanges: []hcl.Range{ - { - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - }, - }, - { - `block "f\n" {} -`, - 0, - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{ - &Block{ - Type: "block", - Labels: []string{"f\n"}, - Body: &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - - TypeRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - LabelRanges: []hcl.Range{ - { - Start: hcl.Pos{Line: 1, Column: 7, Byte: 6}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - OpenBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - End: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - }, - CloseBraceRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - }, - }, - - { - "a = 1\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &LiteralValueExpr{ - Val: cty.NumberIntVal(1), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 6}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 6}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 6}, - }, - }, - }, - { - "a = \"hello ${true}\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello "), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - &LiteralValueExpr{ - Val: cty.True, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - End: hcl.Pos{Line: 1, Column: 18, Byte: 17}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 20, Byte: 19}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 20, Byte: 19}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 20}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 20}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 20}, - }, - }, - }, - { - "a = \"hello $${true}\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello ${true}"), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 20, Byte: 19}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - }, - }, - { - "a = \"hello %%{true}\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello %{true}"), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 20, Byte: 19}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - }, - }, - { - "a = \"hello $$\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello $$"), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - }, - }, - { - "a = \"hello %%\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello %%"), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 14, Byte: 13}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 15}, - }, - }, - }, - { - "a = \"hello!\"\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &TemplateExpr{ - Parts: []Expression{ - &LiteralValueExpr{ - Val: cty.StringVal("hello!"), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 13, Byte: 12}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 13}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 13}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 13}, - }, - }, - }, - { - "a = foo.bar\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - }, - hcl.TraverseAttr{ - Name: "bar", - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 12, Byte: 11}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 12}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 12}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 12}, - }, - }, - }, - { - "a = 1 # line comment\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &LiteralValueExpr{ - Val: cty.NumberIntVal(1), - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 21}, - }, - }, - }, - - { - "a = [for k, v in foo: v if true]\n", - 0, - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &ForExpr{ - KeyVar: "k", - ValVar: "v", - - CollExpr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 18, Byte: 17}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 18, Byte: 17}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - ValExpr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "v", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 23, Byte: 22}, - End: hcl.Pos{Line: 1, Column: 24, Byte: 23}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 23, Byte: 22}, - End: hcl.Pos{Line: 1, Column: 24, Byte: 23}, - }, - }, - CondExpr: &LiteralValueExpr{ - Val: cty.True, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 28, Byte: 27}, - End: hcl.Pos{Line: 1, Column: 32, Byte: 31}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 33, Byte: 32}, - }, - OpenRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - CloseRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 32, Byte: 31}, - End: hcl.Pos{Line: 1, Column: 33, Byte: 32}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 33, Byte: 32}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 33}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 33}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 33}, - }, - }, - }, - { - "a = [for k, v in foo: k => v... if true]\n", - 2, // can't use => or ... in a tuple for - &Body{ - Attributes: Attributes{ - "a": { - Name: "a", - Expr: &ForExpr{ - KeyVar: "k", - ValVar: "v", - - CollExpr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 18, Byte: 17}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 18, Byte: 17}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - KeyExpr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "k", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 23, Byte: 22}, - End: hcl.Pos{Line: 1, Column: 24, Byte: 23}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 23, Byte: 22}, - End: hcl.Pos{Line: 1, Column: 24, Byte: 23}, - }, - }, - ValExpr: &ScopeTraversalExpr{ - Traversal: hcl.Traversal{ - hcl.TraverseRoot{ - Name: "v", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 28, Byte: 27}, - End: hcl.Pos{Line: 1, Column: 29, Byte: 28}, - }, - }, - }, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 28, Byte: 27}, - End: hcl.Pos{Line: 1, Column: 29, Byte: 28}, - }, - }, - CondExpr: &LiteralValueExpr{ - Val: cty.True, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 36, Byte: 35}, - End: hcl.Pos{Line: 1, Column: 40, Byte: 39}, - }, - }, - Group: true, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 41, Byte: 40}, - }, - OpenRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - CloseRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 40, Byte: 39}, - End: hcl.Pos{Line: 1, Column: 41, Byte: 40}, - }, - }, - - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 41, Byte: 40}, - }, - NameRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EqualsRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - End: hcl.Pos{Line: 1, Column: 4, Byte: 3}, - }, - }, - }, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 41}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 2, Column: 1, Byte: 41}, - End: hcl.Pos{Line: 2, Column: 1, Byte: 41}, - }, - }, - }, - - { - ` `, - 2, // tabs not allowed, and body item is required here - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - }, - }, - { - `\x81`, - 2, // invalid UTF-8, and body item is required here - &Body{ - Attributes: Attributes{}, - Blocks: Blocks{}, - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 1, Byte: 0}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - EndRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - End: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - }, - }, - }, - } - - prettyConfig := &pretty.Config{ - Diffable: true, - IncludeUnexported: true, - PrintStringers: true, - } - - for _, test := range tests { - t.Run(test.input, func(t *testing.T) { - file, diags := ParseConfig([]byte(test.input), "", hcl.Pos{Byte: 0, Line: 1, Column: 1}) - if len(diags) != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - - got := file.Body - - if !reflect.DeepEqual(got, test.want) { - diff := prettyConfig.Compare(test.want, got) - if diff != "" { - t.Errorf("wrong result\ninput: %s\ndiff: %s", test.input, diff) - } else { - t.Errorf("wrong result\ninput: %s\ngot: %s\nwant: %s", test.input, spew.Sdump(got), spew.Sdump(test.want)) - } - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_traversal.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_traversal.go deleted file mode 100644 index 2ff3ed6..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/parser_traversal.go +++ /dev/null @@ -1,159 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -// ParseTraversalAbs parses an absolute traversal that is assumed to consume -// all of the remaining tokens in the peeker. The usual parser recovery -// behavior is not supported here because traversals are not expected to -// be parsed as part of a larger program. -func (p *parser) ParseTraversalAbs() (hcl.Traversal, hcl.Diagnostics) { - var ret hcl.Traversal - var diags hcl.Diagnostics - - // Absolute traversal must always begin with a variable name - varTok := p.Read() - if varTok.Type != TokenIdent { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Variable name required", - Detail: "Must begin with a variable name.", - Subject: &varTok.Range, - }) - return ret, diags - } - - varName := string(varTok.Bytes) - ret = append(ret, hcl.TraverseRoot{ - Name: varName, - SrcRange: varTok.Range, - }) - - for { - next := p.Peek() - - if next.Type == TokenEOF { - return ret, diags - } - - switch next.Type { - case TokenDot: - // Attribute access - dot := p.Read() // eat dot - nameTok := p.Read() - if nameTok.Type != TokenIdent { - if nameTok.Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Splat expressions (.*) may not be used here.", - Subject: &nameTok.Range, - Context: hcl.RangeBetween(varTok.Range, nameTok.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Dot must be followed by attribute name.", - Subject: &nameTok.Range, - Context: hcl.RangeBetween(varTok.Range, nameTok.Range).Ptr(), - }) - } - return ret, diags - } - - attrName := string(nameTok.Bytes) - ret = append(ret, hcl.TraverseAttr{ - Name: attrName, - SrcRange: hcl.RangeBetween(dot.Range, nameTok.Range), - }) - case TokenOBrack: - // Index - open := p.Read() // eat open bracket - next := p.Peek() - - switch next.Type { - case TokenNumberLit: - tok := p.Read() // eat number - numVal, numDiags := p.numberLitValue(tok) - diags = append(diags, numDiags...) - - close := p.Read() - if close.Type != TokenCBrack { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed index brackets", - Detail: "Index key must be followed by a closing bracket.", - Subject: &close.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - ret = append(ret, hcl.TraverseIndex{ - Key: numVal, - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }) - - if diags.HasErrors() { - return ret, diags - } - - case TokenOQuote: - str, _, strDiags := p.parseQuotedStringLiteral() - diags = append(diags, strDiags...) - - close := p.Read() - if close.Type != TokenCBrack { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unclosed index brackets", - Detail: "Index key must be followed by a closing bracket.", - Subject: &close.Range, - Context: hcl.RangeBetween(open.Range, close.Range).Ptr(), - }) - } - - ret = append(ret, hcl.TraverseIndex{ - Key: cty.StringVal(str), - SrcRange: hcl.RangeBetween(open.Range, close.Range), - }) - - if diags.HasErrors() { - return ret, diags - } - - default: - if next.Type == TokenStar { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Attribute name required", - Detail: "Splat expressions ([*]) may not be used here.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Index value required", - Detail: "Index brackets must contain either a literal number or a literal string.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - } - return ret, diags - } - - default: - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid character", - Detail: "Expected an attribute access or an index operator.", - Subject: &next.Range, - Context: hcl.RangeBetween(varTok.Range, next.Range).Ptr(), - }) - return ret, diags - } - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker.go deleted file mode 100644 index b8171ff..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker.go +++ /dev/null @@ -1,108 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -type peeker struct { - Tokens Tokens - NextIndex int - - IncludeComments bool - IncludeNewlinesStack []bool -} - -func newPeeker(tokens Tokens, includeComments bool) *peeker { - return &peeker{ - Tokens: tokens, - IncludeComments: includeComments, - - IncludeNewlinesStack: []bool{true}, - } -} - -func (p *peeker) Peek() Token { - ret, _ := p.nextToken() - return ret -} - -func (p *peeker) Read() Token { - ret, nextIdx := p.nextToken() - p.NextIndex = nextIdx - return ret -} - -func (p *peeker) NextRange() hcl.Range { - return p.Peek().Range -} - -func (p *peeker) PrevRange() hcl.Range { - if p.NextIndex == 0 { - return p.NextRange() - } - - return p.Tokens[p.NextIndex-1].Range -} - -func (p *peeker) nextToken() (Token, int) { - for i := p.NextIndex; i < len(p.Tokens); i++ { - tok := p.Tokens[i] - switch tok.Type { - case TokenComment: - if !p.IncludeComments { - // Single-line comment tokens, starting with # or //, absorb - // the trailing newline that terminates them as part of their - // bytes. When we're filtering out comments, we must as a - // special case transform these to newline tokens in order - // to properly parse newline-terminated block items. - - if p.includingNewlines() { - if len(tok.Bytes) > 0 && tok.Bytes[len(tok.Bytes)-1] == '\n' { - fakeNewline := Token{ - Type: TokenNewline, - Bytes: tok.Bytes[len(tok.Bytes)-1 : len(tok.Bytes)], - - // We use the whole token range as the newline - // range, even though that's a little... weird, - // because otherwise we'd need to go count - // characters again in order to figure out the - // column of the newline, and that complexity - // isn't justified when ranges of newlines are - // so rarely printed anyway. - Range: tok.Range, - } - return fakeNewline, i + 1 - } - } - - continue - } - case TokenNewline: - if !p.includingNewlines() { - continue - } - } - - return tok, i + 1 - } - - // if we fall out here then we'll return the EOF token, and leave - // our index pointed off the end of the array so we'll keep - // returning EOF in future too. - return p.Tokens[len(p.Tokens)-1], len(p.Tokens) -} - -func (p *peeker) includingNewlines() bool { - return p.IncludeNewlinesStack[len(p.IncludeNewlinesStack)-1] -} - -func (p *peeker) PushIncludeNewlines(include bool) { - p.IncludeNewlinesStack = append(p.IncludeNewlinesStack, include) -} - -func (p *peeker) PopIncludeNewlines() bool { - stack := p.IncludeNewlinesStack - remain, ret := stack[:len(stack)-1], stack[len(stack)-1] - p.IncludeNewlinesStack = remain - return ret -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker_test.go deleted file mode 100644 index ab5f905..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/peeker_test.go +++ /dev/null @@ -1,158 +0,0 @@ -package hclsyntax - -import ( - "reflect" - "testing" -) - -func TestPeeker(t *testing.T) { - tokens := Tokens{ - { - Type: TokenIdent, - }, - { - Type: TokenComment, - }, - { - Type: TokenIdent, - }, - { - Type: TokenComment, - }, - { - Type: TokenIdent, - }, - { - Type: TokenNewline, - }, - { - Type: TokenIdent, - }, - { - Type: TokenNewline, - }, - { - Type: TokenIdent, - }, - { - Type: TokenNewline, - }, - { - Type: TokenEOF, - }, - } - - { - peeker := newPeeker(tokens, true) - - wantTypes := []TokenType{ - TokenIdent, - TokenComment, - TokenIdent, - TokenComment, - TokenIdent, - TokenNewline, - TokenIdent, - TokenNewline, - TokenIdent, - TokenNewline, - TokenEOF, - } - var gotTypes []TokenType - - for { - peeked := peeker.Peek() - read := peeker.Read() - if peeked.Type != read.Type { - t.Errorf("mismatched Peek %s and Read %s", peeked, read) - } - - gotTypes = append(gotTypes, read.Type) - - if read.Type == TokenEOF { - break - } - } - - if !reflect.DeepEqual(gotTypes, wantTypes) { - t.Errorf("wrong types\ngot: %#v\nwant: %#v", gotTypes, wantTypes) - } - } - - { - peeker := newPeeker(tokens, false) - - wantTypes := []TokenType{ - TokenIdent, - TokenIdent, - TokenIdent, - TokenNewline, - TokenIdent, - TokenNewline, - TokenIdent, - TokenNewline, - TokenEOF, - } - var gotTypes []TokenType - - for { - peeked := peeker.Peek() - read := peeker.Read() - if peeked.Type != read.Type { - t.Errorf("mismatched Peek %s and Read %s", peeked, read) - } - - gotTypes = append(gotTypes, read.Type) - - if read.Type == TokenEOF { - break - } - } - - if !reflect.DeepEqual(gotTypes, wantTypes) { - t.Errorf("wrong types\ngot: %#v\nwant: %#v", gotTypes, wantTypes) - } - } - - { - peeker := newPeeker(tokens, false) - - peeker.PushIncludeNewlines(false) - - wantTypes := []TokenType{ - TokenIdent, - TokenIdent, - TokenIdent, - TokenIdent, - TokenIdent, - TokenNewline, // we'll pop off the PushIncludeNewlines before we get here - TokenEOF, - } - var gotTypes []TokenType - - idx := 0 - for { - peeked := peeker.Peek() - read := peeker.Read() - if peeked.Type != read.Type { - t.Errorf("mismatched Peek %s and Read %s", peeked, read) - } - - gotTypes = append(gotTypes, read.Type) - - if read.Type == TokenEOF { - break - } - - if idx == 4 { - peeker.PopIncludeNewlines() - } - - idx++ - } - - if !reflect.DeepEqual(gotTypes, wantTypes) { - t.Errorf("wrong types\ngot: %#v\nwant: %#v", gotTypes, wantTypes) - } - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/public.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/public.go deleted file mode 100644 index 49d8ab1..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/public.go +++ /dev/null @@ -1,130 +0,0 @@ -package hclsyntax - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -// ParseConfig parses the given buffer as a whole zcl config file, returning -// a *hcl.File representing its contents. If HasErrors called on the returned -// diagnostics returns true, the returned body is likely to be incomplete -// and should therefore be used with care. -// -// The body in the returned file has dynamic type *zclsyntax.Body, so callers -// may freely type-assert this to get access to the full zclsyntax API in -// situations where detailed access is required. However, most common use-cases -// should be served using the hcl.Body interface to ensure compatibility with -// other configurationg syntaxes, such as JSON. -func ParseConfig(src []byte, filename string, start hcl.Pos) (*hcl.File, hcl.Diagnostics) { - tokens, diags := LexConfig(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - body, parseDiags := parser.ParseBody(TokenEOF) - diags = append(diags, parseDiags...) - return &hcl.File{ - Body: body, - Bytes: src, - - Nav: navigation{ - root: body, - }, - }, diags -} - -// ParseExpression parses the given buffer as a standalone zcl expression, -// returning it as an instance of Expression. -func ParseExpression(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) { - tokens, diags := LexExpression(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - - // Bare expressions are always parsed in "ignore newlines" mode, as if - // they were wrapped in parentheses. - parser.PushIncludeNewlines(false) - - expr, parseDiags := parser.ParseExpression() - diags = append(diags, parseDiags...) - - next := parser.Peek() - if next.Type != TokenEOF && !parser.recovery { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extra characters after expression", - Detail: "An expression was successfully parsed, but extra characters were found after it.", - Subject: &next.Range, - }) - } - - return expr, diags -} - -// ParseTemplate parses the given buffer as a standalone zcl template, -// returning it as an instance of Expression. -func ParseTemplate(src []byte, filename string, start hcl.Pos) (Expression, hcl.Diagnostics) { - tokens, diags := LexTemplate(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - expr, parseDiags := parser.ParseTemplate() - diags = append(diags, parseDiags...) - return expr, diags -} - -// ParseTraversalAbs parses the given buffer as a standalone absolute traversal. -// -// Parsing as a traversal is more limited than parsing as an expession since -// it allows only attribute and indexing operations on variables. Traverals -// are useful as a syntax for referring to objects without necessarily -// evaluating them. -func ParseTraversalAbs(src []byte, filename string, start hcl.Pos) (hcl.Traversal, hcl.Diagnostics) { - tokens, diags := LexExpression(src, filename, start) - peeker := newPeeker(tokens, false) - parser := &parser{peeker: peeker} - - // Bare traverals are always parsed in "ignore newlines" mode, as if - // they were wrapped in parentheses. - parser.PushIncludeNewlines(false) - - expr, parseDiags := parser.ParseTraversalAbs() - diags = append(diags, parseDiags...) - return expr, diags -} - -// LexConfig performs lexical analysis on the given buffer, treating it as a -// whole zcl config file, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexConfig(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - tokens := scanTokens(src, filename, start, scanNormal) - diags := checkInvalidTokens(tokens) - return tokens, diags -} - -// LexExpression performs lexical analysis on the given buffer, treating it as -// a standalone zcl expression, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexExpression(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - // This is actually just the same thing as LexConfig, since configs - // and expressions lex in the same way. - tokens := scanTokens(src, filename, start, scanNormal) - diags := checkInvalidTokens(tokens) - return tokens, diags -} - -// LexTemplate performs lexical analysis on the given buffer, treating it as a -// standalone zcl template, and returns the resulting tokens. -// -// Only minimal validation is done during lexical analysis, so the returned -// diagnostics may include errors about lexical issues such as bad character -// encodings or unrecognized characters, but full parsing is required to -// detect _all_ syntax errors. -func LexTemplate(src []byte, filename string, start hcl.Pos) (Tokens, hcl.Diagnostics) { - tokens := scanTokens(src, filename, start, scanTemplate) - diags := checkInvalidTokens(tokens) - return tokens, diags -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.go deleted file mode 100644 index a8ab57c..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.go +++ /dev/null @@ -1,3779 +0,0 @@ -// line 1 "scan_tokens.rl" -package hclsyntax - -import ( - "bytes" - - "github.com/hashicorp/hcl2/hcl" -) - -// This file is generated from scan_tokens.rl. DO NOT EDIT. - -// line 14 "scan_tokens.go" -var _zcltok_actions []byte = []byte{ - 0, 1, 0, 1, 2, 1, 3, 1, 4, - 1, 5, 1, 6, 1, 7, 1, 8, - 1, 9, 1, 10, 1, 11, 1, 12, - 1, 13, 1, 14, 1, 15, 1, 18, - 1, 19, 1, 20, 1, 21, 1, 22, - 1, 23, 1, 24, 1, 25, 1, 26, - 1, 27, 1, 30, 1, 31, 1, 32, - 1, 33, 1, 34, 1, 35, 1, 36, - 1, 37, 1, 38, 1, 39, 1, 45, - 1, 46, 1, 47, 1, 48, 1, 49, - 1, 50, 1, 51, 1, 52, 1, 53, - 1, 54, 1, 55, 1, 56, 1, 57, - 1, 58, 1, 59, 1, 60, 1, 61, - 1, 62, 1, 63, 1, 64, 1, 65, - 1, 66, 1, 67, 1, 68, 1, 69, - 1, 70, 1, 71, 1, 72, 1, 73, - 1, 74, 1, 75, 2, 0, 1, 2, - 3, 16, 2, 3, 17, 2, 3, 28, - 2, 3, 29, 2, 3, 40, 2, 3, - 41, 2, 3, 42, 2, 3, 43, 2, - 3, 44, -} - -var _zcltok_key_offsets []int16 = []int16{ - 0, 0, 1, 2, 3, 5, 10, 14, - 16, 57, 97, 143, 144, 148, 154, 154, - 156, 158, 167, 173, 180, 181, 184, 185, - 189, 194, 203, 207, 211, 219, 221, 223, - 225, 228, 260, 262, 264, 268, 272, 275, - 286, 299, 318, 331, 347, 359, 375, 390, - 411, 421, 433, 444, 458, 473, 483, 495, - 504, 516, 518, 522, 543, 552, 562, 568, - 574, 575, 624, 626, 630, 632, 638, 645, - 653, 660, 663, 669, 673, 677, 679, 683, - 687, 691, 697, 705, 713, 719, 721, 725, - 727, 733, 737, 741, 745, 749, 754, 761, - 767, 769, 771, 775, 777, 783, 787, 791, - 801, 806, 820, 835, 837, 845, 847, 852, - 866, 871, 873, 877, 878, 882, 888, 894, - 904, 914, 925, 933, 936, 939, 943, 947, - 949, 952, 952, 955, 957, 987, 989, 991, - 995, 1000, 1004, 1009, 1011, 1013, 1015, 1024, - 1028, 1032, 1038, 1040, 1048, 1056, 1068, 1071, - 1077, 1081, 1083, 1087, 1107, 1109, 1111, 1122, - 1128, 1130, 1132, 1134, 1138, 1144, 1150, 1152, - 1157, 1161, 1163, 1171, 1189, 1229, 1239, 1243, - 1245, 1247, 1248, 1252, 1256, 1260, 1264, 1268, - 1273, 1277, 1281, 1285, 1287, 1289, 1293, 1303, - 1307, 1309, 1313, 1317, 1321, 1334, 1336, 1338, - 1342, 1344, 1348, 1350, 1352, 1382, 1386, 1390, - 1394, 1397, 1404, 1409, 1420, 1424, 1440, 1454, - 1458, 1463, 1467, 1471, 1477, 1479, 1485, 1487, - 1491, 1493, 1499, 1504, 1509, 1519, 1521, 1523, - 1527, 1531, 1533, 1546, 1548, 1552, 1556, 1564, - 1566, 1570, 1572, 1573, 1576, 1581, 1583, 1585, - 1589, 1591, 1595, 1601, 1621, 1627, 1633, 1635, - 1636, 1646, 1647, 1655, 1662, 1664, 1667, 1669, - 1671, 1673, 1678, 1682, 1686, 1691, 1701, 1711, - 1715, 1719, 1733, 1759, 1769, 1771, 1773, 1776, - 1778, 1781, 1783, 1787, 1789, 1790, 1794, 1796, - 1799, 1806, 1814, 1816, 1818, 1822, 1824, 1830, - 1841, 1844, 1846, 1850, 1855, 1885, 1890, 1892, - 1895, 1900, 1914, 1921, 1935, 1940, 1953, 1957, - 1970, 1975, 1993, 1994, 2003, 2007, 2019, 2024, - 2031, 2038, 2045, 2047, 2051, 2073, 2078, 2079, - 2083, 2085, 2135, 2138, 2149, 2153, 2155, 2161, - 2167, 2169, 2174, 2176, 2180, 2182, 2183, 2185, - 2187, 2193, 2195, 2197, 2201, 2207, 2220, 2222, - 2228, 2232, 2240, 2251, 2259, 2262, 2292, 2298, - 2301, 2306, 2308, 2312, 2316, 2320, 2322, 2329, - 2331, 2340, 2347, 2355, 2357, 2377, 2389, 2393, - 2395, 2413, 2452, 2454, 2458, 2460, 2467, 2471, - 2499, 2501, 2503, 2505, 2507, 2510, 2512, 2516, - 2520, 2522, 2525, 2527, 2529, 2532, 2534, 2536, - 2537, 2539, 2541, 2545, 2549, 2552, 2565, 2567, - 2573, 2577, 2579, 2583, 2587, 2601, 2604, 2613, - 2615, 2619, 2625, 2625, 2627, 2629, 2638, 2644, - 2651, 2652, 2655, 2656, 2660, 2665, 2674, 2678, - 2682, 2690, 2692, 2694, 2696, 2699, 2731, 2733, - 2735, 2739, 2743, 2746, 2757, 2770, 2789, 2802, - 2818, 2830, 2846, 2861, 2882, 2892, 2904, 2915, - 2929, 2944, 2954, 2966, 2975, 2987, 2989, 2993, - 3014, 3023, 3033, 3039, 3045, 3046, 3095, 3097, - 3101, 3103, 3109, 3116, 3124, 3131, 3134, 3140, - 3144, 3148, 3150, 3154, 3158, 3162, 3168, 3176, - 3184, 3190, 3192, 3196, 3198, 3204, 3208, 3212, - 3216, 3220, 3225, 3232, 3238, 3240, 3242, 3246, - 3248, 3254, 3258, 3262, 3272, 3277, 3291, 3306, - 3308, 3316, 3318, 3323, 3337, 3342, 3344, 3348, - 3349, 3353, 3359, 3365, 3375, 3385, 3396, 3404, - 3407, 3410, 3414, 3418, 3420, 3423, 3423, 3426, - 3428, 3458, 3460, 3462, 3466, 3471, 3475, 3480, - 3482, 3484, 3486, 3495, 3499, 3503, 3509, 3511, - 3519, 3527, 3539, 3542, 3548, 3552, 3554, 3558, - 3578, 3580, 3582, 3593, 3599, 3601, 3603, 3605, - 3609, 3615, 3621, 3623, 3628, 3632, 3634, 3642, - 3660, 3700, 3710, 3714, 3716, 3718, 3719, 3723, - 3727, 3731, 3735, 3739, 3744, 3748, 3752, 3756, - 3758, 3760, 3764, 3774, 3778, 3780, 3784, 3788, - 3792, 3805, 3807, 3809, 3813, 3815, 3819, 3821, - 3823, 3853, 3857, 3861, 3865, 3868, 3875, 3880, - 3891, 3895, 3911, 3925, 3929, 3934, 3938, 3942, - 3948, 3950, 3956, 3958, 3962, 3964, 3970, 3975, - 3980, 3990, 3992, 3994, 3998, 4002, 4004, 4017, - 4019, 4023, 4027, 4035, 4037, 4041, 4043, 4044, - 4047, 4052, 4054, 4056, 4060, 4062, 4066, 4072, - 4092, 4098, 4104, 4106, 4107, 4117, 4118, 4126, - 4133, 4135, 4138, 4140, 4142, 4144, 4149, 4153, - 4157, 4162, 4172, 4182, 4186, 4190, 4204, 4230, - 4240, 4242, 4244, 4247, 4249, 4252, 4254, 4258, - 4260, 4261, 4265, 4267, 4269, 4276, 4280, 4287, - 4294, 4303, 4319, 4331, 4349, 4360, 4372, 4380, - 4398, 4406, 4436, 4439, 4449, 4459, 4471, 4482, - 4491, 4504, 4516, 4520, 4526, 4553, 4562, 4565, - 4570, 4576, 4581, 4602, 4606, 4612, 4612, 4619, - 4628, 4636, 4639, 4643, 4649, 4655, 4658, 4662, - 4669, 4675, 4684, 4693, 4697, 4701, 4705, 4709, - 4716, 4720, 4724, 4734, 4740, 4744, 4750, 4754, - 4757, 4763, 4769, 4781, 4785, 4789, 4799, 4803, - 4814, 4816, 4818, 4822, 4834, 4839, 4863, 4867, - 4873, 4895, 4904, 4908, 4911, 4912, 4920, 4928, - 4934, 4944, 4951, 4969, 4972, 4975, 4983, 4989, - 4993, 4997, 5001, 5007, 5015, 5020, 5026, 5030, - 5038, 5045, 5049, 5056, 5062, 5070, 5078, 5084, - 5090, 5101, 5105, 5117, 5126, 5143, 5160, 5163, - 5167, 5169, 5175, 5177, 5181, 5196, 5200, 5204, - 5208, 5212, 5216, 5218, 5224, 5229, 5233, 5239, - 5246, 5249, 5267, 5269, 5314, 5320, 5326, 5330, - 5334, 5340, 5344, 5350, 5356, 5363, 5365, 5371, - 5377, 5381, 5385, 5393, 5406, 5412, 5419, 5427, - 5433, 5442, 5448, 5452, 5457, 5461, 5469, 5473, - 5477, 5507, 5513, 5519, 5525, 5531, 5538, 5544, - 5551, 5556, 5566, 5570, 5577, 5583, 5587, 5594, - 5598, 5604, 5607, 5611, 5615, 5619, 5623, 5628, - 5633, 5637, 5648, 5652, 5656, 5662, 5670, 5674, - 5691, 5695, 5701, 5711, 5717, 5723, 5726, 5731, - 5740, 5744, 5748, 5754, 5758, 5764, 5772, 5790, - 5791, 5801, 5802, 5811, 5819, 5821, 5824, 5826, - 5828, 5830, 5835, 5848, 5852, 5867, 5896, 5907, - 5909, 5913, 5917, 5922, 5926, 5928, 5935, 5939, - 5947, 5951, 5952, 5954, 5956, 5958, 5960, 5962, - 5963, 5964, 5966, 5968, 5970, 5971, 5972, 5973, - 5974, 5976, 5978, 5980, 5981, 5982, 6057, 6058, - 6059, 6060, 6061, 6062, 6063, 6064, 6066, 6067, - 6072, 6074, 6076, 6077, 6121, 6122, 6123, 6125, - 6130, 6134, 6134, 6136, 6138, 6149, 6159, 6167, - 6168, 6170, 6171, 6175, 6179, 6189, 6193, 6200, - 6211, 6218, 6222, 6228, 6239, 6271, 6320, 6335, - 6350, 6355, 6357, 6362, 6394, 6402, 6404, 6426, - 6448, 6450, 6466, 6482, 6497, 6506, 6520, 6534, - 6550, 6551, 6552, 6553, 6554, 6556, 6558, 6560, - 6574, 6588, 6589, 6590, 6592, 6594, 6596, 6610, - 6624, 6625, 6626, 6628, 6630, -} - -var _zcltok_trans_keys []byte = []byte{ - 10, 46, 42, 42, 47, 46, 69, 101, - 48, 57, 43, 45, 48, 57, 48, 57, - 45, 194, 195, 198, 199, 203, 205, 206, - 207, 210, 212, 213, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 233, 234, 237, 239, 240, 65, - 90, 97, 122, 196, 202, 208, 218, 229, - 236, 194, 195, 198, 199, 203, 205, 206, - 207, 210, 212, 213, 214, 215, 216, 217, - 219, 220, 221, 222, 223, 224, 225, 226, - 227, 228, 233, 234, 237, 239, 240, 65, - 90, 97, 122, 196, 202, 208, 218, 229, - 236, 10, 13, 45, 95, 194, 195, 198, - 199, 203, 204, 205, 206, 207, 210, 212, - 213, 214, 215, 216, 217, 219, 220, 221, - 222, 223, 224, 225, 226, 227, 228, 233, - 234, 237, 239, 240, 243, 48, 57, 65, - 90, 97, 122, 196, 218, 229, 236, 10, - 170, 181, 183, 186, 128, 150, 152, 182, - 184, 255, 192, 255, 0, 127, 173, 130, - 133, 146, 159, 165, 171, 175, 255, 181, - 190, 184, 185, 192, 255, 140, 134, 138, - 142, 161, 163, 255, 182, 130, 136, 137, - 176, 151, 152, 154, 160, 190, 136, 144, - 192, 255, 135, 129, 130, 132, 133, 144, - 170, 176, 178, 144, 154, 160, 191, 128, - 169, 174, 255, 148, 169, 157, 158, 189, - 190, 192, 255, 144, 255, 139, 140, 178, - 255, 186, 128, 181, 160, 161, 162, 163, - 164, 165, 166, 167, 168, 169, 170, 171, - 172, 173, 174, 175, 176, 177, 178, 179, - 180, 181, 182, 183, 184, 185, 186, 187, - 188, 189, 190, 191, 128, 173, 128, 155, - 160, 180, 182, 189, 148, 161, 163, 255, - 176, 164, 165, 132, 169, 177, 141, 142, - 145, 146, 179, 181, 186, 187, 158, 133, - 134, 137, 138, 143, 150, 152, 155, 164, - 165, 178, 255, 188, 129, 131, 133, 138, - 143, 144, 147, 168, 170, 176, 178, 179, - 181, 182, 184, 185, 190, 255, 157, 131, - 134, 137, 138, 142, 144, 146, 152, 159, - 165, 182, 255, 129, 131, 133, 141, 143, - 145, 147, 168, 170, 176, 178, 179, 181, - 185, 188, 255, 134, 138, 142, 143, 145, - 159, 164, 165, 176, 184, 186, 255, 129, - 131, 133, 140, 143, 144, 147, 168, 170, - 176, 178, 179, 181, 185, 188, 191, 177, - 128, 132, 135, 136, 139, 141, 150, 151, - 156, 157, 159, 163, 166, 175, 156, 130, - 131, 133, 138, 142, 144, 146, 149, 153, - 154, 158, 159, 163, 164, 168, 170, 174, - 185, 190, 191, 144, 151, 128, 130, 134, - 136, 138, 141, 166, 175, 128, 131, 133, - 140, 142, 144, 146, 168, 170, 185, 189, - 255, 133, 137, 151, 142, 148, 155, 159, - 164, 165, 176, 255, 128, 131, 133, 140, - 142, 144, 146, 168, 170, 179, 181, 185, - 188, 191, 158, 128, 132, 134, 136, 138, - 141, 149, 150, 160, 163, 166, 175, 177, - 178, 129, 131, 133, 140, 142, 144, 146, - 186, 189, 255, 133, 137, 143, 147, 152, - 158, 164, 165, 176, 185, 192, 255, 189, - 130, 131, 133, 150, 154, 177, 179, 187, - 138, 150, 128, 134, 143, 148, 152, 159, - 166, 175, 178, 179, 129, 186, 128, 142, - 144, 153, 132, 138, 141, 165, 167, 129, - 130, 135, 136, 148, 151, 153, 159, 161, - 163, 170, 171, 173, 185, 187, 189, 134, - 128, 132, 136, 141, 144, 153, 156, 159, - 128, 181, 183, 185, 152, 153, 160, 169, - 190, 191, 128, 135, 137, 172, 177, 191, - 128, 132, 134, 151, 153, 188, 134, 128, - 129, 130, 131, 137, 138, 139, 140, 141, - 142, 143, 144, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 173, 175, 176, - 177, 178, 179, 181, 182, 183, 188, 189, - 190, 191, 132, 152, 172, 184, 185, 187, - 128, 191, 128, 137, 144, 255, 158, 159, - 134, 187, 136, 140, 142, 143, 137, 151, - 153, 142, 143, 158, 159, 137, 177, 142, - 143, 182, 183, 191, 255, 128, 130, 133, - 136, 150, 152, 255, 145, 150, 151, 155, - 156, 160, 168, 178, 255, 128, 143, 160, - 255, 182, 183, 190, 255, 129, 255, 173, - 174, 192, 255, 129, 154, 160, 255, 171, - 173, 185, 255, 128, 140, 142, 148, 160, - 180, 128, 147, 160, 172, 174, 176, 178, - 179, 148, 150, 152, 155, 158, 159, 170, - 255, 139, 141, 144, 153, 160, 255, 184, - 255, 128, 170, 176, 255, 182, 255, 128, - 158, 160, 171, 176, 187, 134, 173, 176, - 180, 128, 171, 176, 255, 138, 143, 155, - 255, 128, 155, 160, 255, 159, 189, 190, - 192, 255, 167, 128, 137, 144, 153, 176, - 189, 140, 143, 154, 170, 180, 255, 180, - 255, 128, 183, 128, 137, 141, 189, 128, - 136, 144, 146, 148, 182, 184, 185, 128, - 181, 187, 191, 150, 151, 158, 159, 152, - 154, 156, 158, 134, 135, 142, 143, 190, - 255, 190, 128, 180, 182, 188, 130, 132, - 134, 140, 144, 147, 150, 155, 160, 172, - 178, 180, 182, 188, 128, 129, 130, 131, - 132, 133, 134, 176, 177, 178, 179, 180, - 181, 182, 183, 191, 255, 129, 147, 149, - 176, 178, 190, 192, 255, 144, 156, 161, - 144, 156, 165, 176, 130, 135, 149, 164, - 166, 168, 138, 147, 152, 157, 170, 185, - 188, 191, 142, 133, 137, 160, 255, 137, - 255, 128, 174, 176, 255, 159, 165, 170, - 180, 255, 167, 173, 128, 165, 176, 255, - 168, 174, 176, 190, 192, 255, 128, 150, - 160, 166, 168, 174, 176, 182, 184, 190, - 128, 134, 136, 142, 144, 150, 152, 158, - 160, 191, 128, 129, 130, 131, 132, 133, - 134, 135, 144, 145, 255, 133, 135, 161, - 175, 177, 181, 184, 188, 160, 151, 152, - 187, 192, 255, 133, 173, 177, 255, 143, - 159, 187, 255, 176, 191, 182, 183, 184, - 191, 192, 255, 150, 255, 128, 146, 147, - 148, 152, 153, 154, 155, 156, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 171, 172, 173, 174, 175, - 176, 129, 255, 141, 255, 144, 189, 141, - 143, 172, 255, 191, 128, 175, 180, 189, - 151, 159, 162, 255, 175, 137, 138, 184, - 255, 183, 255, 168, 255, 128, 179, 188, - 134, 143, 154, 159, 184, 186, 190, 255, - 128, 173, 176, 255, 148, 159, 189, 255, - 129, 142, 154, 159, 191, 255, 128, 182, - 128, 141, 144, 153, 160, 182, 186, 255, - 128, 130, 155, 157, 160, 175, 178, 182, - 129, 134, 137, 142, 145, 150, 160, 166, - 168, 174, 176, 255, 155, 166, 175, 128, - 170, 172, 173, 176, 185, 158, 159, 160, - 255, 164, 175, 135, 138, 188, 255, 164, - 169, 171, 172, 173, 174, 175, 180, 181, - 182, 183, 184, 185, 187, 188, 189, 190, - 191, 165, 186, 174, 175, 154, 255, 190, - 128, 134, 147, 151, 157, 168, 170, 182, - 184, 188, 128, 129, 131, 132, 134, 255, - 147, 255, 190, 255, 144, 145, 136, 175, - 188, 255, 128, 143, 160, 175, 179, 180, - 141, 143, 176, 180, 182, 255, 189, 255, - 191, 144, 153, 161, 186, 129, 154, 166, - 255, 191, 255, 130, 135, 138, 143, 146, - 151, 154, 156, 144, 145, 146, 147, 148, - 150, 151, 152, 155, 157, 158, 160, 170, - 171, 172, 175, 161, 169, 128, 129, 130, - 131, 133, 135, 138, 139, 140, 141, 142, - 143, 144, 145, 146, 147, 148, 149, 152, - 156, 157, 160, 161, 162, 163, 164, 166, - 168, 169, 170, 171, 172, 173, 174, 176, - 177, 153, 155, 178, 179, 128, 139, 141, - 166, 168, 186, 188, 189, 191, 255, 142, - 143, 158, 255, 187, 255, 128, 180, 189, - 128, 156, 160, 255, 145, 159, 161, 255, - 128, 159, 176, 255, 139, 143, 187, 255, - 128, 157, 160, 255, 144, 132, 135, 150, - 255, 158, 159, 170, 175, 148, 151, 188, - 255, 128, 167, 176, 255, 164, 255, 183, - 255, 128, 149, 160, 167, 136, 188, 128, - 133, 138, 181, 183, 184, 191, 255, 150, - 159, 183, 255, 128, 158, 160, 178, 180, - 181, 128, 149, 160, 185, 128, 183, 190, - 191, 191, 128, 131, 133, 134, 140, 147, - 149, 151, 153, 179, 184, 186, 160, 188, - 128, 156, 128, 135, 137, 166, 128, 181, - 128, 149, 160, 178, 128, 145, 128, 178, - 129, 130, 131, 132, 133, 135, 136, 138, - 139, 140, 141, 144, 145, 146, 147, 150, - 151, 152, 153, 154, 155, 156, 162, 163, - 171, 176, 177, 178, 128, 134, 135, 165, - 176, 190, 144, 168, 176, 185, 128, 180, - 182, 191, 182, 144, 179, 155, 133, 137, - 141, 143, 157, 255, 190, 128, 145, 147, - 183, 136, 128, 134, 138, 141, 143, 157, - 159, 168, 176, 255, 171, 175, 186, 255, - 128, 131, 133, 140, 143, 144, 147, 168, - 170, 176, 178, 179, 181, 185, 188, 191, - 144, 151, 128, 132, 135, 136, 139, 141, - 157, 163, 166, 172, 176, 180, 128, 138, - 144, 153, 134, 136, 143, 154, 255, 128, - 181, 184, 255, 129, 151, 158, 255, 129, - 131, 133, 143, 154, 255, 128, 137, 128, - 153, 157, 171, 176, 185, 160, 255, 170, - 190, 192, 255, 128, 184, 128, 136, 138, - 182, 184, 191, 128, 144, 153, 178, 255, - 168, 144, 145, 183, 255, 128, 142, 145, - 149, 129, 141, 144, 146, 147, 148, 175, - 255, 132, 255, 128, 144, 129, 143, 144, - 153, 145, 152, 135, 255, 160, 168, 169, - 171, 172, 173, 174, 188, 189, 190, 191, - 161, 167, 185, 255, 128, 158, 160, 169, - 144, 173, 176, 180, 128, 131, 144, 153, - 163, 183, 189, 255, 144, 255, 133, 143, - 191, 255, 143, 159, 160, 128, 129, 255, - 159, 160, 171, 172, 255, 173, 255, 179, - 255, 128, 176, 177, 178, 128, 129, 171, - 175, 189, 255, 128, 136, 144, 153, 157, - 158, 133, 134, 137, 144, 145, 146, 147, - 148, 149, 154, 155, 156, 157, 158, 159, - 168, 169, 170, 150, 153, 165, 169, 173, - 178, 187, 255, 131, 132, 140, 169, 174, - 255, 130, 132, 149, 157, 173, 186, 188, - 160, 161, 163, 164, 167, 168, 132, 134, - 149, 157, 186, 139, 140, 191, 255, 134, - 128, 132, 138, 144, 146, 255, 166, 167, - 129, 155, 187, 149, 181, 143, 175, 137, - 169, 131, 140, 141, 192, 255, 128, 182, - 187, 255, 173, 180, 182, 255, 132, 155, - 159, 161, 175, 128, 160, 163, 164, 165, - 184, 185, 186, 161, 162, 128, 134, 136, - 152, 155, 161, 163, 164, 166, 170, 133, - 143, 151, 255, 139, 143, 154, 255, 164, - 167, 185, 187, 128, 131, 133, 159, 161, - 162, 169, 178, 180, 183, 130, 135, 137, - 139, 148, 151, 153, 155, 157, 159, 164, - 190, 141, 143, 145, 146, 161, 162, 167, - 170, 172, 178, 180, 183, 185, 188, 128, - 137, 139, 155, 161, 163, 165, 169, 171, - 187, 155, 156, 151, 255, 156, 157, 160, - 181, 255, 186, 187, 255, 162, 255, 160, - 168, 161, 167, 158, 255, 160, 132, 135, - 133, 134, 176, 255, 170, 181, 186, 191, - 176, 180, 182, 183, 186, 189, 134, 140, - 136, 138, 142, 161, 163, 255, 130, 137, - 136, 255, 144, 170, 176, 178, 160, 191, - 128, 138, 174, 175, 177, 255, 148, 150, - 164, 167, 173, 176, 185, 189, 190, 192, - 255, 144, 146, 175, 141, 255, 166, 176, - 178, 255, 186, 138, 170, 180, 181, 160, - 161, 162, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 184, 186, 187, - 188, 189, 190, 183, 185, 154, 164, 168, - 128, 149, 128, 152, 189, 132, 185, 144, - 152, 161, 177, 255, 169, 177, 129, 132, - 141, 142, 145, 146, 179, 181, 186, 188, - 190, 255, 142, 156, 157, 159, 161, 176, - 177, 133, 138, 143, 144, 147, 168, 170, - 176, 178, 179, 181, 182, 184, 185, 158, - 153, 156, 178, 180, 189, 133, 141, 143, - 145, 147, 168, 170, 176, 178, 179, 181, - 185, 144, 185, 160, 161, 189, 133, 140, - 143, 144, 147, 168, 170, 176, 178, 179, - 181, 185, 177, 156, 157, 159, 161, 131, - 156, 133, 138, 142, 144, 146, 149, 153, - 154, 158, 159, 163, 164, 168, 170, 174, - 185, 144, 189, 133, 140, 142, 144, 146, - 168, 170, 185, 152, 154, 160, 161, 128, - 189, 133, 140, 142, 144, 146, 168, 170, - 179, 181, 185, 158, 160, 161, 177, 178, - 189, 133, 140, 142, 144, 146, 186, 142, - 148, 150, 159, 161, 186, 191, 189, 133, - 150, 154, 177, 179, 187, 128, 134, 129, - 176, 178, 179, 132, 138, 141, 165, 167, - 189, 129, 130, 135, 136, 148, 151, 153, - 159, 161, 163, 170, 171, 173, 176, 178, - 179, 134, 128, 132, 156, 159, 128, 128, - 135, 137, 172, 136, 140, 128, 129, 130, - 131, 137, 138, 139, 140, 141, 142, 143, - 144, 153, 154, 155, 156, 157, 158, 159, - 160, 161, 162, 163, 164, 165, 166, 167, - 168, 169, 170, 172, 173, 174, 175, 176, - 177, 178, 179, 180, 181, 182, 184, 188, - 189, 190, 191, 132, 152, 185, 187, 191, - 128, 170, 161, 144, 149, 154, 157, 165, - 166, 174, 176, 181, 255, 130, 141, 143, - 159, 155, 255, 128, 140, 142, 145, 160, - 177, 128, 145, 160, 172, 174, 176, 151, - 156, 170, 128, 168, 176, 255, 138, 255, - 128, 150, 160, 255, 149, 255, 167, 133, - 179, 133, 139, 131, 160, 174, 175, 186, - 255, 166, 255, 128, 163, 141, 143, 154, - 189, 169, 172, 174, 177, 181, 182, 129, - 130, 132, 133, 134, 176, 177, 178, 179, - 180, 181, 182, 183, 177, 191, 165, 170, - 175, 177, 180, 255, 168, 174, 176, 255, - 128, 134, 136, 142, 144, 150, 152, 158, - 128, 129, 130, 131, 132, 133, 134, 135, - 144, 145, 255, 133, 135, 161, 169, 177, - 181, 184, 188, 160, 151, 154, 128, 146, - 147, 148, 152, 153, 154, 155, 156, 158, - 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 171, 172, 173, 174, - 175, 176, 129, 255, 141, 143, 160, 169, - 172, 255, 191, 128, 174, 130, 134, 139, - 163, 255, 130, 179, 187, 189, 178, 183, - 138, 165, 176, 255, 135, 159, 189, 255, - 132, 178, 143, 160, 164, 166, 175, 186, - 190, 128, 168, 186, 128, 130, 132, 139, - 160, 182, 190, 255, 176, 178, 180, 183, - 184, 190, 255, 128, 130, 155, 157, 160, - 170, 178, 180, 128, 162, 164, 169, 171, - 172, 173, 174, 175, 180, 181, 182, 183, - 185, 186, 187, 188, 189, 190, 191, 165, - 179, 157, 190, 128, 134, 147, 151, 159, - 168, 170, 182, 184, 188, 176, 180, 182, - 255, 161, 186, 144, 145, 146, 147, 148, - 150, 151, 152, 155, 157, 158, 160, 170, - 171, 172, 175, 161, 169, 128, 129, 130, - 131, 133, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 152, 156, - 157, 160, 161, 162, 163, 164, 166, 168, - 169, 170, 171, 172, 173, 174, 176, 177, - 153, 155, 178, 179, 145, 255, 139, 143, - 182, 255, 158, 175, 128, 144, 147, 149, - 151, 153, 179, 128, 135, 137, 164, 128, - 130, 131, 132, 133, 134, 135, 136, 138, - 139, 140, 141, 144, 145, 146, 147, 150, - 151, 152, 153, 154, 156, 162, 163, 171, - 176, 177, 178, 131, 183, 131, 175, 144, - 168, 131, 166, 182, 144, 178, 131, 178, - 154, 156, 129, 132, 128, 145, 147, 171, - 159, 255, 144, 157, 161, 135, 138, 128, - 175, 135, 132, 133, 128, 174, 152, 155, - 132, 128, 170, 128, 153, 160, 190, 192, - 255, 128, 136, 138, 174, 128, 178, 255, - 160, 168, 169, 171, 172, 173, 174, 188, - 189, 190, 191, 161, 167, 144, 173, 128, - 131, 163, 183, 189, 255, 133, 143, 145, - 255, 147, 159, 128, 176, 177, 178, 128, - 136, 144, 153, 144, 145, 146, 147, 148, - 149, 154, 155, 156, 157, 158, 159, 150, - 153, 131, 140, 255, 160, 163, 164, 165, - 184, 185, 186, 161, 162, 133, 255, 170, - 181, 183, 186, 128, 150, 152, 182, 184, - 255, 192, 255, 128, 255, 173, 130, 133, - 146, 159, 165, 171, 175, 255, 181, 190, - 184, 185, 192, 255, 140, 134, 138, 142, - 161, 163, 255, 182, 130, 136, 137, 176, - 151, 152, 154, 160, 190, 136, 144, 192, - 255, 135, 129, 130, 132, 133, 144, 170, - 176, 178, 144, 154, 160, 191, 128, 169, - 174, 255, 148, 169, 157, 158, 189, 190, - 192, 255, 144, 255, 139, 140, 178, 255, - 186, 128, 181, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 171, 172, - 173, 174, 175, 176, 177, 178, 179, 180, - 181, 182, 183, 184, 185, 186, 187, 188, - 189, 190, 191, 128, 173, 128, 155, 160, - 180, 182, 189, 148, 161, 163, 255, 176, - 164, 165, 132, 169, 177, 141, 142, 145, - 146, 179, 181, 186, 187, 158, 133, 134, - 137, 138, 143, 150, 152, 155, 164, 165, - 178, 255, 188, 129, 131, 133, 138, 143, - 144, 147, 168, 170, 176, 178, 179, 181, - 182, 184, 185, 190, 255, 157, 131, 134, - 137, 138, 142, 144, 146, 152, 159, 165, - 182, 255, 129, 131, 133, 141, 143, 145, - 147, 168, 170, 176, 178, 179, 181, 185, - 188, 255, 134, 138, 142, 143, 145, 159, - 164, 165, 176, 184, 186, 255, 129, 131, - 133, 140, 143, 144, 147, 168, 170, 176, - 178, 179, 181, 185, 188, 191, 177, 128, - 132, 135, 136, 139, 141, 150, 151, 156, - 157, 159, 163, 166, 175, 156, 130, 131, - 133, 138, 142, 144, 146, 149, 153, 154, - 158, 159, 163, 164, 168, 170, 174, 185, - 190, 191, 144, 151, 128, 130, 134, 136, - 138, 141, 166, 175, 128, 131, 133, 140, - 142, 144, 146, 168, 170, 185, 189, 255, - 133, 137, 151, 142, 148, 155, 159, 164, - 165, 176, 255, 128, 131, 133, 140, 142, - 144, 146, 168, 170, 179, 181, 185, 188, - 191, 158, 128, 132, 134, 136, 138, 141, - 149, 150, 160, 163, 166, 175, 177, 178, - 129, 131, 133, 140, 142, 144, 146, 186, - 189, 255, 133, 137, 143, 147, 152, 158, - 164, 165, 176, 185, 192, 255, 189, 130, - 131, 133, 150, 154, 177, 179, 187, 138, - 150, 128, 134, 143, 148, 152, 159, 166, - 175, 178, 179, 129, 186, 128, 142, 144, - 153, 132, 138, 141, 165, 167, 129, 130, - 135, 136, 148, 151, 153, 159, 161, 163, - 170, 171, 173, 185, 187, 189, 134, 128, - 132, 136, 141, 144, 153, 156, 159, 128, - 181, 183, 185, 152, 153, 160, 169, 190, - 191, 128, 135, 137, 172, 177, 191, 128, - 132, 134, 151, 153, 188, 134, 128, 129, - 130, 131, 137, 138, 139, 140, 141, 142, - 143, 144, 153, 154, 155, 156, 157, 158, - 159, 160, 161, 162, 163, 164, 165, 166, - 167, 168, 169, 170, 173, 175, 176, 177, - 178, 179, 181, 182, 183, 188, 189, 190, - 191, 132, 152, 172, 184, 185, 187, 128, - 191, 128, 137, 144, 255, 158, 159, 134, - 187, 136, 140, 142, 143, 137, 151, 153, - 142, 143, 158, 159, 137, 177, 142, 143, - 182, 183, 191, 255, 128, 130, 133, 136, - 150, 152, 255, 145, 150, 151, 155, 156, - 160, 168, 178, 255, 128, 143, 160, 255, - 182, 183, 190, 255, 129, 255, 173, 174, - 192, 255, 129, 154, 160, 255, 171, 173, - 185, 255, 128, 140, 142, 148, 160, 180, - 128, 147, 160, 172, 174, 176, 178, 179, - 148, 150, 152, 155, 158, 159, 170, 255, - 139, 141, 144, 153, 160, 255, 184, 255, - 128, 170, 176, 255, 182, 255, 128, 158, - 160, 171, 176, 187, 134, 173, 176, 180, - 128, 171, 176, 255, 138, 143, 155, 255, - 128, 155, 160, 255, 159, 189, 190, 192, - 255, 167, 128, 137, 144, 153, 176, 189, - 140, 143, 154, 170, 180, 255, 180, 255, - 128, 183, 128, 137, 141, 189, 128, 136, - 144, 146, 148, 182, 184, 185, 128, 181, - 187, 191, 150, 151, 158, 159, 152, 154, - 156, 158, 134, 135, 142, 143, 190, 255, - 190, 128, 180, 182, 188, 130, 132, 134, - 140, 144, 147, 150, 155, 160, 172, 178, - 180, 182, 188, 128, 129, 130, 131, 132, - 133, 134, 176, 177, 178, 179, 180, 181, - 182, 183, 191, 255, 129, 147, 149, 176, - 178, 190, 192, 255, 144, 156, 161, 144, - 156, 165, 176, 130, 135, 149, 164, 166, - 168, 138, 147, 152, 157, 170, 185, 188, - 191, 142, 133, 137, 160, 255, 137, 255, - 128, 174, 176, 255, 159, 165, 170, 180, - 255, 167, 173, 128, 165, 176, 255, 168, - 174, 176, 190, 192, 255, 128, 150, 160, - 166, 168, 174, 176, 182, 184, 190, 128, - 134, 136, 142, 144, 150, 152, 158, 160, - 191, 128, 129, 130, 131, 132, 133, 134, - 135, 144, 145, 255, 133, 135, 161, 175, - 177, 181, 184, 188, 160, 151, 152, 187, - 192, 255, 133, 173, 177, 255, 143, 159, - 187, 255, 176, 191, 182, 183, 184, 191, - 192, 255, 150, 255, 128, 146, 147, 148, - 152, 153, 154, 155, 156, 158, 159, 160, - 161, 162, 163, 164, 165, 166, 167, 168, - 169, 170, 171, 172, 173, 174, 175, 176, - 129, 255, 141, 255, 144, 189, 141, 143, - 172, 255, 191, 128, 175, 180, 189, 151, - 159, 162, 255, 175, 137, 138, 184, 255, - 183, 255, 168, 255, 128, 179, 188, 134, - 143, 154, 159, 184, 186, 190, 255, 128, - 173, 176, 255, 148, 159, 189, 255, 129, - 142, 154, 159, 191, 255, 128, 182, 128, - 141, 144, 153, 160, 182, 186, 255, 128, - 130, 155, 157, 160, 175, 178, 182, 129, - 134, 137, 142, 145, 150, 160, 166, 168, - 174, 176, 255, 155, 166, 175, 128, 170, - 172, 173, 176, 185, 158, 159, 160, 255, - 164, 175, 135, 138, 188, 255, 164, 169, - 171, 172, 173, 174, 175, 180, 181, 182, - 183, 184, 185, 187, 188, 189, 190, 191, - 165, 186, 174, 175, 154, 255, 190, 128, - 134, 147, 151, 157, 168, 170, 182, 184, - 188, 128, 129, 131, 132, 134, 255, 147, - 255, 190, 255, 144, 145, 136, 175, 188, - 255, 128, 143, 160, 175, 179, 180, 141, - 143, 176, 180, 182, 255, 189, 255, 191, - 144, 153, 161, 186, 129, 154, 166, 255, - 191, 255, 130, 135, 138, 143, 146, 151, - 154, 156, 144, 145, 146, 147, 148, 150, - 151, 152, 155, 157, 158, 160, 170, 171, - 172, 175, 161, 169, 128, 129, 130, 131, - 133, 135, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 152, 156, - 157, 160, 161, 162, 163, 164, 166, 168, - 169, 170, 171, 172, 173, 174, 176, 177, - 153, 155, 178, 179, 128, 139, 141, 166, - 168, 186, 188, 189, 191, 255, 142, 143, - 158, 255, 187, 255, 128, 180, 189, 128, - 156, 160, 255, 145, 159, 161, 255, 128, - 159, 176, 255, 139, 143, 187, 255, 128, - 157, 160, 255, 144, 132, 135, 150, 255, - 158, 159, 170, 175, 148, 151, 188, 255, - 128, 167, 176, 255, 164, 255, 183, 255, - 128, 149, 160, 167, 136, 188, 128, 133, - 138, 181, 183, 184, 191, 255, 150, 159, - 183, 255, 128, 158, 160, 178, 180, 181, - 128, 149, 160, 185, 128, 183, 190, 191, - 191, 128, 131, 133, 134, 140, 147, 149, - 151, 153, 179, 184, 186, 160, 188, 128, - 156, 128, 135, 137, 166, 128, 181, 128, - 149, 160, 178, 128, 145, 128, 178, 129, - 130, 131, 132, 133, 135, 136, 138, 139, - 140, 141, 144, 145, 146, 147, 150, 151, - 152, 153, 154, 155, 156, 162, 163, 171, - 176, 177, 178, 128, 134, 135, 165, 176, - 190, 144, 168, 176, 185, 128, 180, 182, - 191, 182, 144, 179, 155, 133, 137, 141, - 143, 157, 255, 190, 128, 145, 147, 183, - 136, 128, 134, 138, 141, 143, 157, 159, - 168, 176, 255, 171, 175, 186, 255, 128, - 131, 133, 140, 143, 144, 147, 168, 170, - 176, 178, 179, 181, 185, 188, 191, 144, - 151, 128, 132, 135, 136, 139, 141, 157, - 163, 166, 172, 176, 180, 128, 138, 144, - 153, 134, 136, 143, 154, 255, 128, 181, - 184, 255, 129, 151, 158, 255, 129, 131, - 133, 143, 154, 255, 128, 137, 128, 153, - 157, 171, 176, 185, 160, 255, 170, 190, - 192, 255, 128, 184, 128, 136, 138, 182, - 184, 191, 128, 144, 153, 178, 255, 168, - 144, 145, 183, 255, 128, 142, 145, 149, - 129, 141, 144, 146, 147, 148, 175, 255, - 132, 255, 128, 144, 129, 143, 144, 153, - 145, 152, 135, 255, 160, 168, 169, 171, - 172, 173, 174, 188, 189, 190, 191, 161, - 167, 185, 255, 128, 158, 160, 169, 144, - 173, 176, 180, 128, 131, 144, 153, 163, - 183, 189, 255, 144, 255, 133, 143, 191, - 255, 143, 159, 160, 128, 129, 255, 159, - 160, 171, 172, 255, 173, 255, 179, 255, - 128, 176, 177, 178, 128, 129, 171, 175, - 189, 255, 128, 136, 144, 153, 157, 158, - 133, 134, 137, 144, 145, 146, 147, 148, - 149, 154, 155, 156, 157, 158, 159, 168, - 169, 170, 150, 153, 165, 169, 173, 178, - 187, 255, 131, 132, 140, 169, 174, 255, - 130, 132, 149, 157, 173, 186, 188, 160, - 161, 163, 164, 167, 168, 132, 134, 149, - 157, 186, 139, 140, 191, 255, 134, 128, - 132, 138, 144, 146, 255, 166, 167, 129, - 155, 187, 149, 181, 143, 175, 137, 169, - 131, 140, 141, 192, 255, 128, 182, 187, - 255, 173, 180, 182, 255, 132, 155, 159, - 161, 175, 128, 160, 163, 164, 165, 184, - 185, 186, 161, 162, 128, 134, 136, 152, - 155, 161, 163, 164, 166, 170, 133, 143, - 151, 255, 139, 143, 154, 255, 164, 167, - 185, 187, 128, 131, 133, 159, 161, 162, - 169, 178, 180, 183, 130, 135, 137, 139, - 148, 151, 153, 155, 157, 159, 164, 190, - 141, 143, 145, 146, 161, 162, 167, 170, - 172, 178, 180, 183, 185, 188, 128, 137, - 139, 155, 161, 163, 165, 169, 171, 187, - 155, 156, 151, 255, 156, 157, 160, 181, - 255, 186, 187, 255, 162, 255, 160, 168, - 161, 167, 158, 255, 160, 132, 135, 133, - 134, 176, 255, 128, 191, 154, 164, 168, - 128, 149, 150, 191, 128, 152, 153, 191, - 181, 128, 159, 160, 189, 190, 191, 189, - 128, 131, 132, 185, 186, 191, 144, 128, - 151, 152, 161, 162, 176, 177, 255, 169, - 177, 129, 132, 141, 142, 145, 146, 179, - 181, 186, 188, 190, 191, 192, 255, 142, - 158, 128, 155, 156, 161, 162, 175, 176, - 177, 178, 191, 169, 177, 180, 183, 128, - 132, 133, 138, 139, 142, 143, 144, 145, - 146, 147, 185, 186, 191, 157, 128, 152, - 153, 158, 159, 177, 178, 180, 181, 191, - 142, 146, 169, 177, 180, 189, 128, 132, - 133, 185, 186, 191, 144, 185, 128, 159, - 160, 161, 162, 191, 169, 177, 180, 189, - 128, 132, 133, 140, 141, 142, 143, 144, - 145, 146, 147, 185, 186, 191, 158, 177, - 128, 155, 156, 161, 162, 191, 131, 145, - 155, 157, 128, 132, 133, 138, 139, 141, - 142, 149, 150, 152, 153, 159, 160, 162, - 163, 164, 165, 167, 168, 170, 171, 173, - 174, 185, 186, 191, 144, 128, 191, 141, - 145, 169, 189, 128, 132, 133, 185, 186, - 191, 128, 151, 152, 154, 155, 159, 160, - 161, 162, 191, 128, 141, 145, 169, 180, - 189, 129, 132, 133, 185, 186, 191, 158, - 128, 159, 160, 161, 162, 176, 177, 178, - 179, 191, 141, 145, 189, 128, 132, 133, - 186, 187, 191, 142, 128, 147, 148, 150, - 151, 158, 159, 161, 162, 185, 186, 191, - 178, 188, 128, 132, 133, 150, 151, 153, - 154, 189, 190, 191, 128, 134, 135, 191, - 128, 177, 129, 179, 180, 191, 128, 131, - 137, 141, 152, 160, 164, 166, 172, 177, - 189, 129, 132, 133, 134, 135, 138, 139, - 147, 148, 167, 168, 169, 170, 179, 180, - 191, 133, 128, 134, 135, 155, 156, 159, - 160, 191, 128, 129, 191, 136, 128, 172, - 173, 191, 128, 135, 136, 140, 141, 191, - 191, 128, 170, 171, 190, 161, 128, 143, - 144, 149, 150, 153, 154, 157, 158, 164, - 165, 166, 167, 173, 174, 176, 177, 180, - 181, 255, 130, 141, 143, 159, 134, 187, - 136, 140, 142, 143, 137, 151, 153, 142, - 143, 158, 159, 137, 177, 191, 142, 143, - 182, 183, 192, 255, 129, 151, 128, 133, - 134, 135, 136, 255, 145, 150, 151, 155, - 191, 192, 255, 128, 143, 144, 159, 160, - 255, 182, 183, 190, 191, 192, 255, 128, - 129, 255, 173, 174, 192, 255, 128, 129, - 154, 155, 159, 160, 255, 171, 173, 185, - 191, 192, 255, 141, 128, 145, 146, 159, - 160, 177, 178, 191, 173, 128, 145, 146, - 159, 160, 176, 177, 191, 128, 179, 180, - 191, 151, 156, 128, 191, 128, 159, 160, - 255, 184, 191, 192, 255, 169, 128, 170, - 171, 175, 176, 255, 182, 191, 192, 255, - 128, 158, 159, 191, 128, 143, 144, 173, - 174, 175, 176, 180, 181, 191, 128, 171, - 172, 175, 176, 255, 138, 191, 192, 255, - 128, 150, 151, 159, 160, 255, 149, 191, - 192, 255, 167, 128, 191, 128, 132, 133, - 179, 180, 191, 128, 132, 133, 139, 140, - 191, 128, 130, 131, 160, 161, 173, 174, - 175, 176, 185, 186, 255, 166, 191, 192, - 255, 128, 163, 164, 191, 128, 140, 141, - 143, 144, 153, 154, 189, 190, 191, 128, - 136, 137, 191, 173, 128, 168, 169, 177, - 178, 180, 181, 182, 183, 191, 0, 127, - 192, 255, 150, 151, 158, 159, 152, 154, - 156, 158, 134, 135, 142, 143, 190, 191, - 192, 255, 181, 189, 191, 128, 190, 133, - 181, 128, 129, 130, 140, 141, 143, 144, - 147, 148, 149, 150, 155, 156, 159, 160, - 172, 173, 177, 178, 188, 189, 191, 177, - 191, 128, 190, 128, 143, 144, 156, 157, - 191, 130, 135, 148, 164, 166, 168, 128, - 137, 138, 149, 150, 151, 152, 157, 158, - 169, 170, 185, 186, 187, 188, 191, 142, - 128, 132, 133, 137, 138, 159, 160, 255, - 137, 191, 192, 255, 175, 128, 255, 159, - 165, 170, 175, 177, 180, 191, 192, 255, - 166, 173, 128, 167, 168, 175, 176, 255, - 168, 174, 176, 191, 192, 255, 167, 175, - 183, 191, 128, 150, 151, 159, 160, 190, - 135, 143, 151, 128, 158, 159, 191, 128, - 132, 133, 135, 136, 160, 161, 169, 170, - 176, 177, 181, 182, 183, 184, 188, 189, - 191, 160, 151, 154, 187, 192, 255, 128, - 132, 133, 173, 174, 176, 177, 255, 143, - 159, 187, 191, 192, 255, 128, 175, 176, - 191, 150, 191, 192, 255, 141, 191, 192, - 255, 128, 143, 144, 189, 190, 191, 141, - 143, 160, 169, 172, 191, 192, 255, 191, - 128, 174, 175, 190, 128, 157, 158, 159, - 160, 255, 176, 191, 192, 255, 128, 150, - 151, 159, 160, 161, 162, 255, 175, 137, - 138, 184, 191, 192, 255, 128, 182, 183, - 255, 130, 134, 139, 163, 191, 192, 255, - 128, 129, 130, 179, 180, 191, 187, 189, - 128, 177, 178, 183, 184, 191, 128, 137, - 138, 165, 166, 175, 176, 255, 135, 159, - 189, 191, 192, 255, 128, 131, 132, 178, - 179, 191, 143, 165, 191, 128, 159, 160, - 175, 176, 185, 186, 190, 128, 168, 169, - 191, 131, 186, 128, 139, 140, 159, 160, - 182, 183, 189, 190, 255, 176, 178, 180, - 183, 184, 190, 191, 192, 255, 129, 128, - 130, 131, 154, 155, 157, 158, 159, 160, - 170, 171, 177, 178, 180, 181, 191, 128, - 167, 175, 129, 134, 135, 136, 137, 142, - 143, 144, 145, 150, 151, 159, 160, 255, - 155, 166, 175, 128, 162, 163, 191, 164, - 175, 135, 138, 188, 191, 192, 255, 174, - 175, 154, 191, 192, 255, 157, 169, 183, - 189, 191, 128, 134, 135, 146, 147, 151, - 152, 158, 159, 190, 130, 133, 128, 255, - 178, 191, 192, 255, 128, 146, 147, 255, - 190, 191, 192, 255, 128, 143, 144, 255, - 144, 145, 136, 175, 188, 191, 192, 255, - 181, 128, 175, 176, 255, 189, 191, 192, - 255, 128, 160, 161, 186, 187, 191, 128, - 129, 154, 155, 165, 166, 255, 191, 192, - 255, 128, 129, 130, 135, 136, 137, 138, - 143, 144, 145, 146, 151, 152, 153, 154, - 156, 157, 191, 128, 191, 128, 129, 130, - 131, 133, 138, 139, 140, 141, 142, 143, - 144, 145, 146, 147, 148, 149, 152, 156, - 157, 160, 161, 162, 163, 164, 166, 168, - 169, 170, 171, 172, 173, 174, 176, 177, - 132, 151, 153, 155, 158, 175, 178, 179, - 180, 191, 140, 167, 187, 190, 128, 255, - 142, 143, 158, 191, 192, 255, 187, 191, - 192, 255, 128, 180, 181, 191, 128, 156, - 157, 159, 160, 255, 145, 191, 192, 255, - 128, 159, 160, 175, 176, 255, 139, 143, - 182, 191, 192, 255, 144, 132, 135, 150, - 191, 192, 255, 158, 175, 148, 151, 188, - 191, 192, 255, 128, 167, 168, 175, 176, - 255, 164, 191, 192, 255, 183, 191, 192, - 255, 128, 149, 150, 159, 160, 167, 168, - 191, 136, 182, 188, 128, 133, 134, 137, - 138, 184, 185, 190, 191, 255, 150, 159, - 183, 191, 192, 255, 179, 128, 159, 160, - 181, 182, 191, 128, 149, 150, 159, 160, - 185, 186, 191, 128, 183, 184, 189, 190, - 191, 128, 148, 152, 129, 143, 144, 179, - 180, 191, 128, 159, 160, 188, 189, 191, - 128, 156, 157, 191, 136, 128, 164, 165, - 191, 128, 181, 182, 191, 128, 149, 150, - 159, 160, 178, 179, 191, 128, 145, 146, - 191, 128, 178, 179, 191, 128, 130, 131, - 132, 133, 134, 135, 136, 138, 139, 140, - 141, 144, 145, 146, 147, 150, 151, 152, - 153, 154, 156, 162, 163, 171, 176, 177, - 178, 129, 191, 128, 130, 131, 183, 184, - 191, 128, 130, 131, 175, 176, 191, 128, - 143, 144, 168, 169, 191, 128, 130, 131, - 166, 167, 191, 182, 128, 143, 144, 178, - 179, 191, 128, 130, 131, 178, 179, 191, - 128, 154, 156, 129, 132, 133, 191, 146, - 128, 171, 172, 191, 135, 137, 142, 158, - 128, 168, 169, 175, 176, 255, 159, 191, - 192, 255, 144, 128, 156, 157, 161, 162, - 191, 128, 134, 135, 138, 139, 191, 128, - 175, 176, 191, 134, 128, 131, 132, 135, - 136, 191, 128, 174, 175, 191, 128, 151, - 152, 155, 156, 191, 132, 128, 191, 128, - 170, 171, 191, 128, 153, 154, 191, 160, - 190, 192, 255, 128, 184, 185, 191, 137, - 128, 174, 175, 191, 128, 129, 177, 178, - 255, 144, 191, 192, 255, 128, 142, 143, - 144, 145, 146, 149, 129, 148, 150, 191, - 175, 191, 192, 255, 132, 191, 192, 255, - 128, 144, 129, 143, 145, 191, 144, 153, - 128, 143, 145, 152, 154, 191, 135, 191, - 192, 255, 160, 168, 169, 171, 172, 173, - 174, 188, 189, 190, 191, 128, 159, 161, - 167, 170, 187, 185, 191, 192, 255, 128, - 143, 144, 173, 174, 191, 128, 131, 132, - 162, 163, 183, 184, 188, 189, 255, 133, - 143, 145, 191, 192, 255, 128, 146, 147, - 159, 160, 191, 160, 128, 191, 128, 129, - 191, 192, 255, 159, 160, 171, 128, 170, - 172, 191, 192, 255, 173, 191, 192, 255, - 179, 191, 192, 255, 128, 176, 177, 178, - 129, 191, 128, 129, 130, 191, 171, 175, - 189, 191, 192, 255, 128, 136, 137, 143, - 144, 153, 154, 191, 144, 145, 146, 147, - 148, 149, 154, 155, 156, 157, 158, 159, - 128, 143, 150, 153, 160, 191, 149, 157, - 173, 186, 188, 160, 161, 163, 164, 167, - 168, 132, 134, 149, 157, 186, 191, 139, - 140, 192, 255, 133, 145, 128, 134, 135, - 137, 138, 255, 166, 167, 129, 155, 187, - 149, 181, 143, 175, 137, 169, 131, 140, - 191, 192, 255, 160, 163, 164, 165, 184, - 185, 186, 128, 159, 161, 162, 166, 191, - 133, 191, 192, 255, 132, 160, 163, 167, - 179, 184, 186, 128, 164, 165, 168, 169, - 187, 188, 191, 130, 135, 137, 139, 144, - 147, 151, 153, 155, 157, 159, 163, 171, - 179, 184, 189, 191, 128, 140, 141, 148, - 149, 160, 161, 164, 165, 166, 167, 190, - 138, 164, 170, 128, 155, 156, 160, 161, - 187, 188, 191, 128, 191, 155, 156, 128, - 191, 151, 191, 192, 255, 156, 157, 160, - 128, 191, 181, 191, 192, 255, 158, 159, - 186, 128, 185, 187, 191, 192, 255, 162, - 191, 192, 255, 160, 168, 128, 159, 161, - 167, 169, 191, 158, 191, 192, 255, 123, - 128, 191, 128, 191, 128, 191, 128, 191, - 128, 191, 10, 123, 128, 191, 128, 191, - 128, 191, 123, 123, 10, 123, 128, 191, - 128, 191, 128, 191, 123, 123, 9, 10, - 13, 32, 33, 34, 35, 38, 46, 47, - 60, 61, 62, 64, 92, 95, 123, 124, - 125, 126, 127, 194, 195, 198, 199, 203, - 204, 205, 206, 207, 210, 212, 213, 214, - 215, 216, 217, 219, 220, 221, 222, 223, - 224, 225, 226, 227, 228, 233, 234, 237, - 238, 239, 240, 0, 39, 40, 45, 48, - 57, 58, 63, 65, 90, 91, 96, 97, - 122, 192, 193, 196, 218, 229, 236, 241, - 247, 9, 10, 32, 61, 10, 38, 46, - 42, 47, 42, 46, 69, 101, 48, 57, - 60, 61, 61, 62, 61, 45, 95, 194, - 195, 198, 199, 203, 204, 205, 206, 207, - 210, 212, 213, 214, 215, 216, 217, 219, - 220, 221, 222, 223, 224, 225, 226, 227, - 228, 233, 234, 237, 239, 240, 243, 48, - 57, 65, 90, 97, 122, 196, 218, 229, - 236, 124, 125, 128, 191, 170, 181, 186, - 128, 191, 151, 183, 128, 255, 192, 255, - 0, 127, 173, 130, 133, 146, 159, 165, - 171, 175, 191, 192, 255, 181, 190, 128, - 175, 176, 183, 184, 185, 186, 191, 134, - 139, 141, 162, 128, 135, 136, 255, 182, - 130, 137, 176, 151, 152, 154, 160, 136, - 191, 192, 255, 128, 143, 144, 170, 171, - 175, 176, 178, 179, 191, 128, 159, 160, - 191, 176, 128, 138, 139, 173, 174, 255, - 148, 150, 164, 167, 173, 176, 185, 189, - 190, 192, 255, 144, 128, 145, 146, 175, - 176, 191, 128, 140, 141, 255, 166, 176, - 178, 191, 192, 255, 186, 128, 137, 138, - 170, 171, 179, 180, 181, 182, 191, 160, - 161, 162, 164, 165, 166, 167, 168, 169, - 170, 171, 172, 173, 174, 175, 176, 177, - 178, 179, 180, 181, 182, 183, 184, 185, - 186, 187, 188, 189, 190, 128, 191, 128, - 129, 130, 131, 137, 138, 139, 140, 141, - 142, 143, 144, 153, 154, 155, 156, 157, - 158, 159, 160, 161, 162, 163, 164, 165, - 166, 167, 168, 169, 170, 171, 172, 173, - 174, 175, 176, 177, 178, 179, 180, 182, - 183, 184, 188, 189, 190, 191, 132, 187, - 129, 130, 132, 133, 134, 176, 177, 178, - 179, 180, 181, 182, 183, 128, 191, 128, - 129, 130, 131, 132, 133, 134, 135, 144, - 136, 143, 145, 191, 192, 255, 182, 183, - 184, 128, 191, 128, 191, 191, 128, 190, - 192, 255, 128, 146, 147, 148, 152, 153, - 154, 155, 156, 158, 159, 160, 161, 162, - 163, 164, 165, 166, 167, 168, 169, 170, - 171, 172, 173, 174, 175, 176, 129, 191, - 192, 255, 158, 159, 128, 157, 160, 191, - 192, 255, 128, 191, 164, 169, 171, 172, - 173, 174, 175, 180, 181, 182, 183, 184, - 185, 187, 188, 189, 190, 191, 128, 163, - 165, 186, 144, 145, 146, 147, 148, 150, - 151, 152, 155, 157, 158, 160, 170, 171, - 172, 175, 128, 159, 161, 169, 173, 191, - 128, 191, 10, 13, 34, 36, 37, 92, - 128, 191, 192, 223, 224, 239, 240, 247, - 248, 255, 10, 13, 34, 92, 36, 37, - 128, 191, 192, 223, 224, 239, 240, 247, - 248, 255, 10, 13, 92, 36, 37, 128, - 191, 192, 223, 224, 239, 240, 247, 248, - 255, 92, 36, 37, 192, 223, 224, 239, - 240, 247, 10, 13, 34, 92, 36, 37, - 192, 223, 224, 239, 240, 247, 248, 255, - 10, 13, 34, 92, 36, 37, 128, 223, - 224, 239, 240, 247, 248, 255, 10, 13, - 34, 92, 36, 37, 128, 191, 192, 223, - 224, 239, 240, 247, 248, 255, 123, 126, - 123, 126, 128, 191, 128, 191, 128, 191, - 10, 13, 36, 37, 128, 191, 192, 223, - 224, 239, 240, 247, 248, 255, 10, 13, - 36, 37, 128, 191, 192, 223, 224, 239, - 240, 247, 248, 255, 126, 126, 128, 191, - 128, 191, 128, 191, 10, 13, 36, 37, - 128, 191, 192, 223, 224, 239, 240, 247, - 248, 255, 10, 13, 36, 37, 128, 191, - 192, 223, 224, 239, 240, 247, 248, 255, - 126, 126, 128, 191, 128, 191, 128, 191, -} - -var _zcltok_single_lengths []byte = []byte{ - 0, 1, 1, 1, 2, 3, 2, 0, - 31, 30, 36, 1, 4, 0, 0, 0, - 0, 1, 2, 1, 1, 1, 1, 0, - 1, 1, 0, 0, 2, 0, 0, 0, - 1, 32, 0, 0, 0, 0, 1, 3, - 1, 1, 1, 0, 2, 0, 1, 1, - 2, 0, 3, 0, 1, 0, 2, 1, - 2, 0, 0, 5, 1, 4, 0, 0, - 1, 43, 0, 0, 0, 2, 3, 2, - 1, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 4, - 1, 0, 15, 0, 0, 0, 1, 6, - 1, 0, 0, 1, 0, 2, 0, 0, - 0, 9, 0, 1, 1, 0, 0, 0, - 3, 0, 1, 0, 28, 0, 0, 0, - 1, 0, 1, 0, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 1, 0, - 2, 0, 0, 18, 0, 0, 1, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 16, 36, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 2, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 28, 0, 0, 0, - 1, 1, 1, 1, 0, 0, 2, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 4, 0, 0, 2, - 2, 0, 11, 0, 0, 0, 0, 0, - 0, 0, 1, 1, 3, 0, 0, 4, - 0, 0, 0, 18, 0, 0, 0, 1, - 4, 1, 4, 1, 0, 3, 2, 2, - 2, 1, 0, 0, 1, 8, 0, 0, - 0, 4, 12, 0, 2, 0, 3, 0, - 1, 0, 2, 0, 1, 2, 0, 3, - 1, 2, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 1, 28, 3, 0, 1, - 1, 2, 1, 0, 1, 1, 2, 1, - 1, 2, 1, 1, 0, 2, 1, 1, - 1, 1, 0, 0, 6, 1, 1, 0, - 0, 46, 1, 1, 0, 0, 0, 0, - 2, 1, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 13, 2, 0, - 0, 0, 9, 0, 1, 28, 0, 1, - 3, 0, 2, 0, 0, 0, 1, 0, - 1, 1, 2, 0, 18, 2, 0, 0, - 16, 35, 0, 0, 0, 1, 0, 28, - 0, 0, 0, 0, 1, 0, 2, 0, - 0, 1, 0, 0, 1, 0, 0, 1, - 0, 0, 0, 0, 1, 11, 0, 0, - 0, 0, 4, 0, 12, 1, 7, 0, - 4, 0, 0, 0, 0, 1, 2, 1, - 1, 1, 1, 0, 1, 1, 0, 0, - 2, 0, 0, 0, 1, 32, 0, 0, - 0, 0, 1, 3, 1, 1, 1, 0, - 2, 0, 1, 1, 2, 0, 3, 0, - 1, 0, 2, 1, 2, 0, 0, 5, - 1, 4, 0, 0, 1, 43, 0, 0, - 0, 2, 3, 2, 1, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 4, 1, 0, 15, 0, - 0, 0, 1, 6, 1, 0, 0, 1, - 0, 2, 0, 0, 0, 9, 0, 1, - 1, 0, 0, 0, 3, 0, 1, 0, - 28, 0, 0, 0, 1, 0, 1, 0, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 1, 0, 2, 0, 0, 18, - 0, 0, 1, 0, 0, 0, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 16, - 36, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 1, 0, 0, 0, 0, - 0, 0, 2, 0, 0, 0, 0, 0, - 1, 0, 0, 0, 0, 0, 0, 0, - 28, 0, 0, 0, 1, 1, 1, 1, - 0, 0, 2, 0, 1, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 1, 1, - 4, 0, 0, 2, 2, 0, 11, 0, - 0, 0, 0, 0, 0, 0, 1, 1, - 3, 0, 0, 4, 0, 0, 0, 18, - 0, 0, 0, 1, 4, 1, 4, 1, - 0, 3, 2, 2, 2, 1, 0, 0, - 1, 8, 0, 0, 0, 4, 12, 0, - 2, 0, 3, 0, 1, 0, 2, 0, - 1, 2, 0, 0, 3, 0, 1, 1, - 1, 2, 2, 4, 1, 6, 2, 4, - 2, 4, 1, 4, 0, 6, 1, 3, - 1, 2, 0, 2, 11, 1, 1, 1, - 0, 1, 1, 0, 2, 0, 3, 3, - 2, 1, 0, 0, 0, 1, 0, 1, - 0, 1, 1, 0, 2, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 4, 3, 2, 2, 0, - 6, 1, 0, 1, 1, 0, 2, 0, - 4, 3, 0, 1, 1, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 1, 0, 3, 0, 2, 0, 0, 0, - 3, 0, 2, 1, 1, 3, 1, 0, - 0, 0, 0, 0, 5, 2, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 1, - 1, 0, 0, 35, 4, 0, 0, 0, - 0, 0, 0, 0, 1, 0, 0, 0, - 0, 0, 0, 3, 0, 1, 0, 0, - 3, 0, 0, 1, 0, 0, 0, 0, - 28, 0, 0, 0, 0, 1, 0, 3, - 1, 4, 0, 1, 0, 0, 1, 0, - 0, 1, 0, 0, 0, 0, 1, 1, - 0, 7, 0, 0, 2, 2, 0, 11, - 0, 0, 0, 0, 0, 1, 1, 3, - 0, 0, 4, 0, 0, 0, 12, 1, - 4, 1, 5, 2, 0, 3, 2, 2, - 2, 1, 7, 0, 7, 17, 3, 0, - 2, 0, 3, 0, 0, 1, 0, 2, - 0, 1, 0, 0, 0, 0, 0, 1, - 1, 0, 0, 0, 1, 1, 1, 1, - 0, 0, 0, 1, 1, 53, 1, 1, - 1, 1, 1, 1, 1, 2, 1, 3, - 2, 2, 1, 34, 1, 1, 0, 3, - 2, 0, 0, 0, 1, 2, 4, 1, - 0, 1, 0, 0, 0, 0, 1, 1, - 1, 0, 0, 1, 30, 47, 13, 9, - 3, 0, 1, 28, 2, 0, 18, 16, - 0, 6, 4, 3, 1, 4, 4, 4, - 1, 1, 1, 1, 0, 0, 0, 4, - 2, 1, 1, 0, 0, 0, 4, 2, - 1, 1, 0, 0, 0, -} - -var _zcltok_range_lengths []byte = []byte{ - 0, 0, 0, 0, 0, 1, 1, 1, - 5, 5, 5, 0, 0, 3, 0, 1, - 1, 4, 2, 3, 0, 1, 0, 2, - 2, 4, 2, 2, 3, 1, 1, 1, - 1, 0, 1, 1, 2, 2, 1, 4, - 6, 9, 6, 8, 5, 8, 7, 10, - 4, 6, 4, 7, 7, 5, 5, 4, - 5, 1, 2, 8, 4, 3, 3, 3, - 0, 3, 1, 2, 1, 2, 2, 3, - 3, 1, 3, 2, 2, 1, 2, 2, - 2, 3, 4, 4, 3, 1, 2, 1, - 3, 2, 2, 2, 2, 2, 3, 3, - 1, 1, 2, 1, 3, 2, 2, 3, - 2, 7, 0, 1, 4, 1, 2, 4, - 2, 1, 2, 0, 2, 2, 3, 5, - 5, 1, 4, 1, 1, 2, 2, 1, - 0, 0, 1, 1, 1, 1, 1, 2, - 2, 2, 2, 1, 1, 1, 4, 2, - 2, 3, 1, 4, 4, 6, 1, 3, - 1, 1, 2, 1, 1, 1, 5, 3, - 1, 1, 1, 2, 3, 3, 1, 2, - 2, 1, 4, 1, 2, 5, 2, 1, - 1, 0, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 1, 1, 2, 4, 2, - 1, 2, 2, 2, 6, 1, 1, 2, - 1, 2, 1, 1, 1, 2, 2, 2, - 1, 3, 2, 5, 2, 8, 6, 2, - 2, 2, 2, 3, 1, 3, 1, 2, - 1, 3, 2, 2, 3, 1, 1, 1, - 1, 1, 1, 1, 2, 2, 4, 1, - 2, 1, 0, 1, 1, 1, 1, 0, - 1, 2, 3, 1, 3, 3, 1, 0, - 3, 0, 2, 3, 1, 0, 0, 0, - 0, 2, 2, 2, 2, 1, 5, 2, - 2, 5, 7, 5, 0, 1, 0, 1, - 1, 1, 1, 1, 0, 1, 1, 0, - 3, 3, 1, 1, 2, 1, 3, 5, - 1, 1, 2, 2, 1, 1, 1, 1, - 2, 6, 3, 7, 2, 6, 1, 6, - 2, 8, 0, 4, 2, 5, 2, 3, - 3, 3, 1, 2, 8, 2, 0, 2, - 1, 2, 1, 5, 2, 1, 3, 3, - 0, 2, 1, 2, 1, 0, 1, 1, - 3, 1, 1, 2, 3, 0, 0, 3, - 2, 4, 1, 4, 1, 1, 3, 1, - 1, 1, 1, 2, 2, 1, 3, 1, - 4, 3, 3, 1, 1, 5, 2, 1, - 1, 2, 1, 2, 1, 3, 2, 0, - 1, 1, 1, 1, 1, 1, 1, 2, - 1, 1, 1, 1, 1, 1, 1, 0, - 1, 1, 2, 2, 1, 1, 1, 3, - 2, 1, 0, 2, 1, 1, 1, 1, - 0, 3, 0, 1, 1, 4, 2, 3, - 0, 1, 0, 2, 2, 4, 2, 2, - 3, 1, 1, 1, 1, 0, 1, 1, - 2, 2, 1, 4, 6, 9, 6, 8, - 5, 8, 7, 10, 4, 6, 4, 7, - 7, 5, 5, 4, 5, 1, 2, 8, - 4, 3, 3, 3, 0, 3, 1, 2, - 1, 2, 2, 3, 3, 1, 3, 2, - 2, 1, 2, 2, 2, 3, 4, 4, - 3, 1, 2, 1, 3, 2, 2, 2, - 2, 2, 3, 3, 1, 1, 2, 1, - 3, 2, 2, 3, 2, 7, 0, 1, - 4, 1, 2, 4, 2, 1, 2, 0, - 2, 2, 3, 5, 5, 1, 4, 1, - 1, 2, 2, 1, 0, 0, 1, 1, - 1, 1, 1, 2, 2, 2, 2, 1, - 1, 1, 4, 2, 2, 3, 1, 4, - 4, 6, 1, 3, 1, 1, 2, 1, - 1, 1, 5, 3, 1, 1, 1, 2, - 3, 3, 1, 2, 2, 1, 4, 1, - 2, 5, 2, 1, 1, 0, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 1, - 1, 2, 4, 2, 1, 2, 2, 2, - 6, 1, 1, 2, 1, 2, 1, 1, - 1, 2, 2, 2, 1, 3, 2, 5, - 2, 8, 6, 2, 2, 2, 2, 3, - 1, 3, 1, 2, 1, 3, 2, 2, - 3, 1, 1, 1, 1, 1, 1, 1, - 2, 2, 4, 1, 2, 1, 0, 1, - 1, 1, 1, 0, 1, 2, 3, 1, - 3, 3, 1, 0, 3, 0, 2, 3, - 1, 0, 0, 0, 0, 2, 2, 2, - 2, 1, 5, 2, 2, 5, 7, 5, - 0, 1, 0, 1, 1, 1, 1, 1, - 0, 1, 1, 1, 2, 2, 3, 3, - 4, 7, 5, 7, 5, 3, 3, 7, - 3, 13, 1, 3, 5, 3, 5, 3, - 6, 5, 2, 2, 8, 4, 1, 2, - 3, 2, 10, 2, 2, 0, 2, 3, - 3, 1, 2, 3, 3, 1, 2, 3, - 3, 4, 4, 2, 1, 2, 2, 3, - 2, 2, 5, 3, 2, 3, 2, 1, - 3, 3, 6, 2, 2, 5, 2, 5, - 1, 1, 2, 4, 1, 11, 1, 3, - 8, 4, 2, 1, 0, 4, 3, 3, - 3, 2, 9, 1, 1, 4, 3, 2, - 2, 2, 3, 4, 2, 3, 2, 4, - 3, 2, 2, 3, 3, 4, 3, 3, - 4, 2, 5, 4, 8, 7, 1, 2, - 1, 3, 1, 2, 5, 1, 2, 2, - 2, 2, 1, 3, 2, 2, 3, 3, - 1, 9, 1, 5, 1, 3, 2, 2, - 3, 2, 3, 3, 3, 1, 3, 3, - 2, 2, 4, 5, 3, 3, 4, 3, - 3, 3, 2, 2, 2, 4, 2, 2, - 1, 3, 3, 3, 3, 3, 3, 2, - 2, 3, 2, 3, 3, 2, 3, 2, - 3, 1, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 3, 2, 3, - 2, 3, 5, 3, 3, 1, 2, 3, - 2, 2, 1, 2, 3, 4, 3, 0, - 3, 0, 2, 3, 1, 0, 0, 0, - 0, 2, 3, 2, 4, 6, 4, 1, - 1, 2, 1, 2, 1, 3, 2, 3, - 2, 0, 1, 1, 1, 1, 1, 0, - 0, 1, 1, 1, 0, 0, 0, 0, - 1, 1, 1, 0, 0, 11, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 1, - 0, 0, 0, 5, 0, 0, 1, 1, - 1, 0, 1, 1, 5, 4, 2, 0, - 1, 0, 2, 2, 5, 2, 3, 5, - 3, 2, 3, 5, 1, 1, 1, 3, - 1, 1, 2, 2, 3, 1, 2, 3, - 1, 5, 6, 6, 4, 5, 5, 6, - 0, 0, 0, 0, 1, 1, 1, 5, - 6, 0, 0, 1, 1, 1, 5, 6, - 0, 0, 1, 1, 1, -} - -var _zcltok_index_offsets []int16 = []int16{ - 0, 0, 2, 4, 6, 9, 14, 18, - 20, 57, 93, 135, 137, 142, 146, 147, - 149, 151, 157, 162, 167, 169, 172, 174, - 177, 181, 187, 190, 193, 199, 201, 203, - 205, 208, 241, 243, 245, 248, 251, 254, - 262, 270, 281, 289, 298, 306, 315, 324, - 336, 343, 350, 358, 366, 375, 381, 389, - 395, 403, 405, 408, 422, 428, 436, 440, - 444, 446, 493, 495, 498, 500, 505, 511, - 517, 522, 525, 529, 532, 535, 537, 540, - 543, 546, 550, 555, 560, 564, 566, 569, - 571, 575, 578, 581, 584, 587, 591, 596, - 600, 602, 604, 607, 609, 613, 616, 619, - 627, 631, 639, 655, 657, 662, 664, 668, - 679, 683, 685, 688, 690, 693, 698, 702, - 708, 714, 725, 730, 733, 736, 739, 742, - 744, 748, 749, 752, 754, 784, 786, 788, - 791, 795, 798, 802, 804, 806, 808, 814, - 817, 820, 824, 826, 831, 836, 843, 846, - 850, 854, 856, 859, 879, 881, 883, 890, - 894, 896, 898, 900, 903, 907, 911, 913, - 917, 920, 922, 927, 945, 984, 990, 993, - 995, 997, 999, 1002, 1005, 1008, 1011, 1014, - 1018, 1021, 1024, 1027, 1029, 1031, 1034, 1041, - 1044, 1046, 1049, 1052, 1055, 1063, 1065, 1067, - 1070, 1072, 1075, 1077, 1079, 1109, 1112, 1115, - 1118, 1121, 1126, 1130, 1137, 1140, 1149, 1158, - 1161, 1165, 1168, 1171, 1175, 1177, 1181, 1183, - 1186, 1188, 1192, 1196, 1200, 1208, 1210, 1212, - 1216, 1220, 1222, 1235, 1237, 1240, 1243, 1248, - 1250, 1253, 1255, 1257, 1260, 1265, 1267, 1269, - 1274, 1276, 1279, 1283, 1303, 1307, 1311, 1313, - 1315, 1323, 1325, 1332, 1337, 1339, 1343, 1346, - 1349, 1352, 1356, 1359, 1362, 1366, 1376, 1382, - 1385, 1388, 1398, 1418, 1424, 1427, 1429, 1433, - 1435, 1438, 1440, 1444, 1446, 1448, 1452, 1454, - 1458, 1463, 1469, 1471, 1473, 1476, 1478, 1482, - 1489, 1492, 1494, 1497, 1501, 1531, 1536, 1538, - 1541, 1545, 1554, 1559, 1567, 1571, 1579, 1583, - 1591, 1595, 1606, 1608, 1614, 1617, 1625, 1629, - 1634, 1639, 1644, 1646, 1649, 1664, 1668, 1670, - 1673, 1675, 1724, 1727, 1734, 1737, 1739, 1743, - 1747, 1750, 1754, 1756, 1759, 1761, 1763, 1765, - 1767, 1771, 1773, 1775, 1778, 1782, 1796, 1799, - 1803, 1806, 1811, 1822, 1827, 1830, 1860, 1864, - 1867, 1872, 1874, 1878, 1881, 1884, 1886, 1891, - 1893, 1899, 1904, 1910, 1912, 1932, 1940, 1943, - 1945, 1963, 2001, 2003, 2006, 2008, 2013, 2016, - 2045, 2047, 2049, 2051, 2053, 2056, 2058, 2062, - 2065, 2067, 2070, 2072, 2074, 2077, 2079, 2081, - 2083, 2085, 2087, 2090, 2093, 2096, 2109, 2111, - 2115, 2118, 2120, 2125, 2128, 2142, 2145, 2154, - 2156, 2161, 2165, 2166, 2168, 2170, 2176, 2181, - 2186, 2188, 2191, 2193, 2196, 2200, 2206, 2209, - 2212, 2218, 2220, 2222, 2224, 2227, 2260, 2262, - 2264, 2267, 2270, 2273, 2281, 2289, 2300, 2308, - 2317, 2325, 2334, 2343, 2355, 2362, 2369, 2377, - 2385, 2394, 2400, 2408, 2414, 2422, 2424, 2427, - 2441, 2447, 2455, 2459, 2463, 2465, 2512, 2514, - 2517, 2519, 2524, 2530, 2536, 2541, 2544, 2548, - 2551, 2554, 2556, 2559, 2562, 2565, 2569, 2574, - 2579, 2583, 2585, 2588, 2590, 2594, 2597, 2600, - 2603, 2606, 2610, 2615, 2619, 2621, 2623, 2626, - 2628, 2632, 2635, 2638, 2646, 2650, 2658, 2674, - 2676, 2681, 2683, 2687, 2698, 2702, 2704, 2707, - 2709, 2712, 2717, 2721, 2727, 2733, 2744, 2749, - 2752, 2755, 2758, 2761, 2763, 2767, 2768, 2771, - 2773, 2803, 2805, 2807, 2810, 2814, 2817, 2821, - 2823, 2825, 2827, 2833, 2836, 2839, 2843, 2845, - 2850, 2855, 2862, 2865, 2869, 2873, 2875, 2878, - 2898, 2900, 2902, 2909, 2913, 2915, 2917, 2919, - 2922, 2926, 2930, 2932, 2936, 2939, 2941, 2946, - 2964, 3003, 3009, 3012, 3014, 3016, 3018, 3021, - 3024, 3027, 3030, 3033, 3037, 3040, 3043, 3046, - 3048, 3050, 3053, 3060, 3063, 3065, 3068, 3071, - 3074, 3082, 3084, 3086, 3089, 3091, 3094, 3096, - 3098, 3128, 3131, 3134, 3137, 3140, 3145, 3149, - 3156, 3159, 3168, 3177, 3180, 3184, 3187, 3190, - 3194, 3196, 3200, 3202, 3205, 3207, 3211, 3215, - 3219, 3227, 3229, 3231, 3235, 3239, 3241, 3254, - 3256, 3259, 3262, 3267, 3269, 3272, 3274, 3276, - 3279, 3284, 3286, 3288, 3293, 3295, 3298, 3302, - 3322, 3326, 3330, 3332, 3334, 3342, 3344, 3351, - 3356, 3358, 3362, 3365, 3368, 3371, 3375, 3378, - 3381, 3385, 3395, 3401, 3404, 3407, 3417, 3437, - 3443, 3446, 3448, 3452, 3454, 3457, 3459, 3463, - 3465, 3467, 3471, 3473, 3475, 3481, 3484, 3489, - 3494, 3500, 3510, 3518, 3530, 3537, 3547, 3553, - 3565, 3571, 3589, 3592, 3600, 3606, 3616, 3623, - 3630, 3638, 3646, 3649, 3654, 3674, 3680, 3683, - 3687, 3691, 3695, 3707, 3710, 3715, 3716, 3722, - 3729, 3735, 3738, 3741, 3745, 3749, 3752, 3755, - 3760, 3764, 3770, 3776, 3779, 3783, 3786, 3789, - 3794, 3797, 3800, 3806, 3810, 3813, 3817, 3820, - 3823, 3827, 3831, 3838, 3841, 3844, 3850, 3853, - 3860, 3862, 3864, 3867, 3876, 3881, 3895, 3899, - 3903, 3918, 3924, 3927, 3930, 3932, 3937, 3943, - 3947, 3955, 3961, 3971, 3974, 3977, 3982, 3986, - 3989, 3992, 3995, 3999, 4004, 4008, 4012, 4015, - 4020, 4025, 4028, 4034, 4038, 4044, 4049, 4053, - 4057, 4065, 4068, 4076, 4082, 4092, 4103, 4106, - 4109, 4111, 4115, 4117, 4120, 4131, 4135, 4138, - 4141, 4144, 4147, 4149, 4153, 4157, 4160, 4164, - 4169, 4172, 4182, 4184, 4225, 4231, 4235, 4238, - 4241, 4245, 4248, 4252, 4256, 4261, 4263, 4267, - 4271, 4274, 4277, 4282, 4291, 4295, 4300, 4305, - 4309, 4316, 4320, 4323, 4327, 4330, 4335, 4338, - 4341, 4371, 4375, 4379, 4383, 4387, 4392, 4396, - 4402, 4406, 4414, 4417, 4422, 4426, 4429, 4434, - 4437, 4441, 4444, 4447, 4450, 4453, 4456, 4460, - 4464, 4467, 4477, 4480, 4483, 4488, 4494, 4497, - 4512, 4515, 4519, 4525, 4529, 4533, 4536, 4540, - 4547, 4550, 4553, 4559, 4562, 4566, 4571, 4587, - 4589, 4597, 4599, 4607, 4613, 4615, 4619, 4622, - 4625, 4628, 4632, 4643, 4646, 4658, 4682, 4690, - 4692, 4696, 4699, 4704, 4707, 4709, 4714, 4717, - 4723, 4726, 4728, 4730, 4732, 4734, 4736, 4738, - 4740, 4742, 4744, 4746, 4748, 4750, 4752, 4754, - 4756, 4758, 4760, 4762, 4764, 4766, 4831, 4833, - 4835, 4837, 4839, 4841, 4843, 4845, 4848, 4850, - 4855, 4858, 4861, 4863, 4903, 4905, 4907, 4909, - 4914, 4918, 4919, 4921, 4923, 4930, 4937, 4944, - 4946, 4948, 4950, 4953, 4956, 4962, 4965, 4970, - 4977, 4982, 4985, 4989, 4996, 5028, 5077, 5092, - 5105, 5110, 5112, 5116, 5147, 5153, 5155, 5176, - 5196, 5198, 5210, 5221, 5231, 5237, 5247, 5257, - 5268, 5270, 5272, 5274, 5276, 5278, 5280, 5282, - 5292, 5301, 5303, 5305, 5307, 5309, 5311, 5321, - 5330, 5332, 5334, 5336, 5338, -} - -var _zcltok_indicies []int16 = []int16{ - 2, 1, 4, 3, 6, 5, 6, 7, - 5, 9, 11, 11, 10, 8, 12, 12, - 10, 8, 10, 8, 13, 15, 16, 18, - 19, 20, 21, 22, 23, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 34, - 35, 36, 37, 38, 39, 40, 42, 43, - 44, 45, 46, 14, 14, 17, 17, 41, - 3, 15, 16, 18, 19, 20, 21, 22, - 23, 24, 25, 26, 27, 28, 29, 30, - 31, 32, 33, 34, 35, 36, 37, 38, - 39, 40, 42, 43, 44, 45, 46, 14, - 14, 17, 17, 41, 3, 47, 48, 14, - 14, 49, 16, 18, 19, 20, 19, 50, - 51, 23, 52, 25, 26, 53, 54, 55, - 56, 57, 58, 59, 60, 61, 62, 63, - 64, 65, 40, 42, 66, 44, 67, 68, - 69, 14, 14, 14, 17, 41, 3, 47, - 3, 14, 14, 14, 14, 3, 14, 14, - 14, 3, 14, 3, 14, 3, 14, 3, - 3, 3, 3, 3, 14, 3, 3, 3, - 3, 14, 14, 14, 14, 14, 3, 3, - 14, 3, 3, 14, 3, 14, 3, 3, - 14, 3, 3, 3, 14, 14, 14, 14, - 14, 14, 3, 14, 14, 3, 14, 14, - 3, 3, 3, 3, 3, 3, 14, 14, - 3, 3, 14, 3, 14, 14, 14, 3, - 70, 71, 72, 73, 17, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, - 3, 14, 3, 14, 3, 14, 14, 3, - 14, 14, 3, 3, 3, 14, 3, 3, - 3, 3, 3, 3, 3, 14, 3, 3, - 3, 3, 3, 3, 3, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 3, 3, 3, 3, 3, 3, 3, 3, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 3, 3, 3, 3, 3, 3, 3, - 3, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 3, 14, 14, 14, 14, 14, - 14, 14, 14, 3, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 3, - 14, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 3, 3, 3, - 3, 3, 3, 3, 3, 14, 14, 14, - 14, 14, 14, 14, 14, 3, 14, 14, - 14, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 3, 3, 3, 3, - 3, 3, 3, 3, 14, 14, 14, 14, - 14, 14, 3, 14, 14, 14, 14, 14, - 14, 14, 3, 14, 3, 14, 14, 3, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 3, 14, 14, - 14, 14, 14, 3, 14, 14, 14, 14, - 14, 14, 14, 3, 14, 14, 14, 3, - 14, 14, 14, 3, 14, 3, 101, 102, - 103, 104, 105, 106, 107, 108, 109, 110, - 111, 112, 113, 114, 115, 116, 117, 19, - 118, 119, 120, 121, 122, 123, 124, 125, - 126, 127, 128, 129, 130, 131, 132, 133, - 134, 135, 17, 18, 136, 137, 138, 139, - 140, 17, 19, 17, 3, 14, 3, 14, - 14, 3, 3, 14, 3, 3, 3, 3, - 14, 3, 3, 3, 3, 3, 14, 3, - 3, 3, 3, 3, 14, 14, 14, 14, - 14, 3, 3, 3, 14, 3, 3, 3, - 14, 14, 14, 3, 3, 3, 14, 14, - 3, 3, 3, 14, 14, 14, 3, 3, - 3, 14, 14, 14, 14, 3, 14, 14, - 14, 14, 3, 3, 3, 3, 3, 14, - 14, 14, 14, 3, 3, 14, 14, 14, - 3, 3, 14, 14, 14, 14, 3, 14, - 14, 3, 14, 14, 3, 3, 3, 14, - 14, 14, 3, 3, 3, 3, 14, 14, - 14, 14, 14, 3, 3, 3, 3, 14, - 3, 14, 14, 3, 14, 14, 3, 14, - 3, 14, 14, 14, 3, 14, 14, 3, - 3, 3, 14, 3, 3, 3, 3, 3, - 3, 3, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 14, 3, 141, - 142, 143, 144, 145, 146, 147, 148, 149, - 17, 150, 151, 152, 153, 154, 3, 14, - 3, 3, 3, 3, 3, 14, 14, 3, - 14, 14, 14, 3, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 3, 3, 14, 14, 14, 3, - 3, 14, 3, 3, 14, 14, 14, 14, - 14, 3, 3, 3, 3, 14, 14, 14, - 14, 14, 14, 3, 14, 14, 14, 14, - 14, 3, 155, 112, 156, 157, 158, 17, - 159, 160, 19, 17, 3, 14, 14, 14, - 14, 3, 3, 3, 14, 3, 3, 14, - 14, 14, 3, 3, 3, 14, 14, 3, - 122, 3, 19, 17, 17, 161, 3, 17, - 3, 14, 19, 162, 163, 19, 164, 165, - 19, 60, 166, 167, 168, 169, 170, 19, - 171, 172, 173, 19, 174, 175, 176, 18, - 177, 178, 179, 18, 180, 19, 17, 3, - 3, 14, 14, 3, 3, 3, 14, 14, - 14, 14, 3, 14, 14, 3, 3, 3, - 3, 14, 14, 3, 3, 14, 14, 3, - 3, 3, 3, 3, 3, 14, 14, 14, - 3, 3, 3, 14, 3, 3, 3, 14, - 14, 3, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 3, 14, 14, 14, 14, - 14, 14, 3, 3, 3, 14, 14, 14, - 14, 3, 181, 182, 3, 17, 3, 14, - 3, 3, 14, 19, 183, 184, 185, 186, - 60, 187, 188, 58, 189, 190, 191, 192, - 193, 194, 195, 196, 197, 17, 3, 3, - 14, 3, 14, 14, 14, 14, 14, 14, - 14, 3, 14, 14, 14, 3, 14, 3, - 3, 14, 3, 14, 3, 3, 14, 14, - 14, 14, 3, 14, 14, 14, 3, 3, - 14, 14, 14, 14, 3, 14, 14, 3, - 3, 14, 14, 14, 14, 14, 3, 198, - 199, 200, 201, 202, 203, 204, 205, 206, - 207, 208, 204, 209, 210, 211, 212, 41, - 3, 213, 214, 19, 215, 216, 217, 218, - 219, 220, 221, 222, 223, 19, 17, 224, - 225, 226, 227, 19, 228, 229, 230, 231, - 232, 233, 234, 235, 236, 237, 238, 239, - 240, 241, 242, 19, 147, 17, 243, 3, - 14, 14, 14, 14, 14, 3, 3, 3, - 14, 3, 14, 14, 3, 14, 3, 14, - 14, 3, 3, 3, 14, 14, 14, 3, - 3, 3, 14, 14, 14, 3, 3, 3, - 3, 14, 3, 3, 14, 3, 3, 14, - 14, 14, 3, 3, 14, 3, 14, 14, - 14, 3, 14, 14, 14, 14, 14, 14, - 3, 3, 3, 14, 14, 3, 14, 14, - 3, 14, 14, 3, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 14, 3, 14, - 3, 14, 3, 14, 14, 3, 14, 3, - 14, 14, 3, 14, 3, 14, 3, 244, - 215, 245, 246, 247, 248, 249, 250, 251, - 252, 253, 101, 254, 19, 255, 256, 257, - 19, 258, 132, 259, 260, 261, 262, 263, - 264, 265, 266, 19, 3, 3, 3, 14, - 14, 14, 3, 14, 14, 3, 14, 14, - 3, 3, 3, 3, 3, 14, 14, 14, - 14, 3, 14, 14, 14, 14, 14, 14, - 3, 3, 3, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 3, 14, 14, 14, - 14, 14, 14, 14, 14, 3, 14, 14, - 3, 3, 3, 3, 14, 14, 14, 3, - 3, 3, 14, 3, 3, 3, 14, 14, - 3, 14, 14, 14, 3, 14, 3, 3, - 3, 14, 14, 3, 14, 14, 14, 3, - 14, 14, 14, 3, 3, 3, 3, 14, - 19, 184, 267, 268, 17, 19, 17, 3, - 3, 14, 3, 14, 19, 267, 17, 3, - 19, 269, 17, 3, 3, 14, 19, 270, - 271, 272, 175, 273, 274, 19, 275, 276, - 277, 17, 3, 3, 14, 14, 14, 3, - 14, 14, 3, 14, 14, 14, 14, 3, - 3, 14, 3, 3, 14, 14, 3, 14, - 3, 19, 17, 3, 278, 19, 279, 3, - 17, 3, 14, 3, 14, 280, 19, 281, - 282, 3, 14, 3, 3, 3, 14, 14, - 14, 14, 3, 283, 284, 285, 19, 286, - 287, 288, 289, 290, 291, 292, 293, 294, - 295, 296, 297, 298, 299, 17, 3, 14, - 14, 14, 3, 3, 3, 3, 14, 14, - 3, 3, 14, 3, 3, 3, 3, 3, - 3, 3, 14, 3, 14, 3, 3, 3, - 3, 3, 3, 14, 14, 14, 14, 14, - 3, 3, 14, 3, 3, 3, 14, 3, - 3, 14, 3, 3, 14, 3, 3, 14, - 3, 3, 3, 14, 14, 14, 3, 3, - 3, 14, 14, 14, 14, 3, 300, 19, - 301, 19, 302, 303, 304, 305, 17, 3, - 14, 14, 14, 14, 14, 3, 3, 3, - 14, 3, 3, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 3, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 14, - 14, 3, 14, 14, 14, 14, 14, 3, - 306, 19, 17, 3, 14, 307, 19, 103, - 17, 3, 14, 308, 3, 17, 3, 14, - 19, 309, 17, 3, 3, 14, 310, 3, - 19, 311, 17, 3, 3, 14, 14, 14, - 14, 3, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 3, 3, 14, 3, - 14, 14, 14, 3, 14, 3, 14, 14, - 14, 3, 3, 3, 3, 3, 3, 3, - 14, 14, 14, 3, 14, 3, 3, 3, - 14, 14, 14, 14, 3, 312, 313, 72, - 314, 315, 316, 317, 318, 319, 320, 321, - 322, 323, 324, 325, 326, 327, 328, 329, - 330, 331, 332, 334, 335, 336, 337, 338, - 339, 333, 3, 14, 14, 14, 14, 3, - 14, 3, 14, 14, 3, 14, 14, 14, - 3, 3, 3, 3, 3, 3, 3, 3, - 3, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 3, 14, 14, 14, 14, 14, - 14, 14, 3, 14, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 14, 3, 14, - 14, 14, 3, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 3, 14, 3, - 14, 14, 14, 14, 14, 3, 14, 14, - 3, 14, 14, 14, 14, 14, 14, 14, - 3, 14, 14, 14, 3, 14, 14, 14, - 14, 3, 14, 14, 14, 14, 3, 14, - 14, 14, 14, 3, 14, 3, 14, 14, - 3, 14, 14, 14, 14, 14, 14, 14, - 14, 14, 14, 14, 14, 14, 14, 3, - 14, 14, 14, 3, 14, 3, 14, 14, - 3, 14, 3, 340, 341, 342, 104, 105, - 106, 107, 108, 343, 110, 111, 112, 113, - 114, 115, 344, 345, 170, 346, 261, 120, - 347, 122, 232, 272, 125, 348, 349, 350, - 351, 352, 353, 354, 355, 356, 357, 134, - 358, 19, 17, 18, 19, 137, 138, 139, - 140, 17, 17, 3, 14, 14, 3, 14, - 14, 14, 14, 14, 14, 3, 3, 3, - 14, 3, 14, 14, 14, 14, 3, 14, - 14, 14, 3, 14, 14, 3, 14, 14, - 14, 3, 3, 14, 14, 14, 3, 3, - 14, 14, 3, 14, 3, 14, 3, 14, - 14, 14, 3, 3, 14, 14, 3, 14, - 14, 3, 14, 14, 14, 3, 359, 143, - 145, 146, 147, 148, 149, 17, 360, 151, - 361, 153, 362, 3, 14, 14, 3, 3, - 3, 3, 14, 3, 3, 14, 14, 14, - 14, 14, 3, 363, 112, 364, 157, 158, - 17, 159, 160, 19, 17, 3, 14, 14, - 14, 14, 3, 3, 3, 14, 19, 162, - 163, 19, 365, 366, 222, 311, 166, 167, - 168, 367, 170, 368, 369, 370, 371, 372, - 373, 374, 375, 376, 377, 178, 179, 18, - 378, 19, 17, 3, 3, 3, 3, 14, - 14, 14, 3, 3, 3, 3, 3, 14, - 14, 3, 14, 14, 14, 3, 14, 14, - 3, 3, 3, 14, 14, 3, 14, 14, - 14, 14, 3, 14, 3, 14, 14, 14, - 14, 14, 3, 3, 3, 3, 3, 14, - 14, 14, 14, 14, 14, 3, 14, 3, - 19, 183, 184, 379, 186, 60, 187, 188, - 58, 189, 190, 380, 17, 193, 381, 195, - 196, 197, 17, 3, 14, 14, 14, 14, - 14, 14, 14, 3, 14, 14, 3, 14, - 3, 382, 383, 200, 201, 202, 384, 204, - 205, 385, 386, 387, 204, 209, 210, 211, - 212, 41, 3, 213, 214, 19, 215, 216, - 218, 388, 220, 389, 222, 223, 19, 17, - 390, 225, 226, 227, 19, 228, 229, 230, - 231, 232, 233, 234, 235, 391, 237, 238, - 392, 240, 241, 242, 19, 147, 17, 243, - 3, 3, 14, 3, 3, 14, 3, 14, - 14, 14, 14, 14, 3, 14, 14, 3, - 393, 394, 395, 396, 397, 398, 399, 400, - 250, 401, 322, 402, 216, 403, 404, 405, - 406, 407, 404, 408, 409, 410, 261, 411, - 263, 412, 413, 274, 3, 14, 3, 14, - 3, 14, 3, 14, 3, 14, 14, 3, - 14, 3, 14, 14, 14, 3, 14, 14, - 3, 3, 14, 14, 14, 3, 14, 3, - 14, 3, 14, 14, 3, 14, 3, 14, - 3, 14, 3, 14, 3, 14, 3, 3, - 3, 14, 14, 14, 3, 14, 14, 3, - 19, 270, 232, 414, 404, 415, 274, 19, - 416, 417, 277, 17, 3, 14, 3, 14, - 14, 14, 3, 3, 3, 14, 14, 3, - 280, 19, 281, 418, 3, 14, 14, 3, - 19, 286, 287, 288, 289, 290, 291, 292, - 293, 294, 295, 419, 17, 3, 3, 3, - 14, 19, 420, 19, 268, 303, 304, 305, - 17, 3, 3, 14, 422, 422, 422, 422, - 421, 422, 422, 422, 421, 422, 421, 422, - 422, 421, 421, 421, 421, 421, 421, 422, - 421, 421, 421, 421, 422, 422, 422, 422, - 422, 421, 421, 422, 421, 421, 422, 421, - 422, 421, 421, 422, 421, 421, 421, 422, - 422, 422, 422, 422, 422, 421, 422, 422, - 421, 422, 422, 421, 421, 421, 421, 421, - 421, 422, 422, 421, 421, 422, 421, 422, - 422, 422, 421, 423, 424, 425, 426, 427, - 428, 429, 430, 431, 432, 433, 434, 435, - 436, 437, 438, 439, 440, 441, 442, 443, - 444, 445, 446, 447, 448, 449, 450, 451, - 452, 453, 454, 421, 422, 421, 422, 421, - 422, 422, 421, 422, 422, 421, 421, 421, - 422, 421, 421, 421, 421, 421, 421, 421, - 422, 421, 421, 421, 421, 421, 421, 421, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 421, 421, 421, 421, 421, - 421, 421, 421, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 421, 421, 421, 421, - 421, 421, 421, 421, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 421, 422, 422, - 422, 422, 422, 422, 422, 422, 421, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 421, 422, 422, 422, 422, 422, - 422, 421, 422, 422, 422, 422, 422, 422, - 421, 421, 421, 421, 421, 421, 421, 421, - 422, 422, 422, 422, 422, 422, 422, 422, - 421, 422, 422, 422, 422, 422, 422, 422, - 422, 421, 422, 422, 422, 422, 422, 421, - 421, 421, 421, 421, 421, 421, 421, 422, - 422, 422, 422, 422, 422, 421, 422, 422, - 422, 422, 422, 422, 422, 421, 422, 421, - 422, 422, 421, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 421, 422, 422, 422, 422, 422, 421, 422, - 422, 422, 422, 422, 422, 422, 421, 422, - 422, 422, 421, 422, 422, 422, 421, 422, - 421, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 469, - 470, 471, 472, 473, 474, 475, 476, 477, - 478, 479, 480, 481, 482, 483, 484, 485, - 486, 487, 488, 489, 490, 427, 491, 492, - 493, 494, 495, 496, 427, 472, 427, 421, - 422, 421, 422, 422, 421, 421, 422, 421, - 421, 421, 421, 422, 421, 421, 421, 421, - 421, 422, 421, 421, 421, 421, 421, 422, - 422, 422, 422, 422, 421, 421, 421, 422, - 421, 421, 421, 422, 422, 422, 421, 421, - 421, 422, 422, 421, 421, 421, 422, 422, - 422, 421, 421, 421, 422, 422, 422, 422, - 421, 422, 422, 422, 422, 421, 421, 421, - 421, 421, 422, 422, 422, 422, 421, 421, - 422, 422, 422, 421, 421, 422, 422, 422, - 422, 421, 422, 422, 421, 422, 422, 421, - 421, 421, 422, 422, 422, 421, 421, 421, - 421, 422, 422, 422, 422, 422, 421, 421, - 421, 421, 422, 421, 422, 422, 421, 422, - 422, 421, 422, 421, 422, 422, 422, 421, - 422, 422, 421, 421, 421, 422, 421, 421, - 421, 421, 421, 421, 421, 422, 422, 422, - 422, 421, 422, 422, 422, 422, 422, 422, - 422, 421, 497, 498, 499, 500, 501, 502, - 503, 504, 505, 427, 506, 507, 508, 509, - 510, 421, 422, 421, 421, 421, 421, 421, - 422, 422, 421, 422, 422, 422, 421, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 421, 422, 422, 422, 421, 421, 422, - 422, 422, 421, 421, 422, 421, 421, 422, - 422, 422, 422, 422, 421, 421, 421, 421, - 422, 422, 422, 422, 422, 422, 421, 422, - 422, 422, 422, 422, 421, 511, 466, 512, - 513, 514, 427, 515, 516, 472, 427, 421, - 422, 422, 422, 422, 421, 421, 421, 422, - 421, 421, 422, 422, 422, 421, 421, 421, - 422, 422, 421, 477, 421, 472, 427, 427, - 517, 421, 427, 421, 422, 472, 518, 519, - 472, 520, 521, 472, 522, 523, 524, 525, - 526, 527, 472, 528, 529, 530, 472, 531, - 532, 533, 491, 534, 535, 536, 491, 537, - 472, 427, 421, 421, 422, 422, 421, 421, - 421, 422, 422, 422, 422, 421, 422, 422, - 421, 421, 421, 421, 422, 422, 421, 421, - 422, 422, 421, 421, 421, 421, 421, 421, - 422, 422, 422, 421, 421, 421, 422, 421, - 421, 421, 422, 422, 421, 422, 422, 422, - 422, 421, 422, 422, 422, 422, 421, 422, - 422, 422, 422, 422, 422, 421, 421, 421, - 422, 422, 422, 422, 421, 538, 539, 421, - 427, 421, 422, 421, 421, 422, 472, 540, - 541, 542, 543, 522, 544, 545, 546, 547, - 548, 549, 550, 551, 552, 553, 554, 555, - 427, 421, 421, 422, 421, 422, 422, 422, - 422, 422, 422, 422, 421, 422, 422, 422, - 421, 422, 421, 421, 422, 421, 422, 421, - 421, 422, 422, 422, 422, 421, 422, 422, - 422, 421, 421, 422, 422, 422, 422, 421, - 422, 422, 421, 421, 422, 422, 422, 422, - 422, 421, 556, 557, 558, 559, 560, 561, - 562, 563, 564, 565, 566, 562, 568, 569, - 570, 571, 567, 421, 572, 573, 472, 574, - 575, 576, 577, 578, 579, 580, 581, 582, - 472, 427, 583, 584, 585, 586, 472, 587, - 588, 589, 590, 591, 592, 593, 594, 595, - 596, 597, 598, 599, 600, 601, 472, 503, - 427, 602, 421, 422, 422, 422, 422, 422, - 421, 421, 421, 422, 421, 422, 422, 421, - 422, 421, 422, 422, 421, 421, 421, 422, - 422, 422, 421, 421, 421, 422, 422, 422, - 421, 421, 421, 421, 422, 421, 421, 422, - 421, 421, 422, 422, 422, 421, 421, 422, - 421, 422, 422, 422, 421, 422, 422, 422, - 422, 422, 422, 421, 421, 421, 422, 422, - 421, 422, 422, 421, 422, 422, 421, 422, - 422, 421, 422, 422, 422, 422, 422, 422, - 422, 421, 422, 421, 422, 421, 422, 422, - 421, 422, 421, 422, 422, 421, 422, 421, - 422, 421, 603, 574, 604, 605, 606, 607, - 608, 609, 610, 611, 612, 455, 613, 472, - 614, 615, 616, 472, 617, 487, 618, 619, - 620, 621, 622, 623, 624, 625, 472, 421, - 421, 421, 422, 422, 422, 421, 422, 422, - 421, 422, 422, 421, 421, 421, 421, 421, - 422, 422, 422, 422, 421, 422, 422, 422, - 422, 422, 422, 421, 421, 421, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 421, - 422, 422, 422, 422, 422, 422, 422, 422, - 421, 422, 422, 421, 421, 421, 421, 422, - 422, 422, 421, 421, 421, 422, 421, 421, - 421, 422, 422, 421, 422, 422, 422, 421, - 422, 421, 421, 421, 422, 422, 421, 422, - 422, 422, 421, 422, 422, 422, 421, 421, - 421, 421, 422, 472, 541, 626, 627, 427, - 472, 427, 421, 421, 422, 421, 422, 472, - 626, 427, 421, 472, 628, 427, 421, 421, - 422, 472, 629, 630, 631, 532, 632, 633, - 472, 634, 635, 636, 427, 421, 421, 422, - 422, 422, 421, 422, 422, 421, 422, 422, - 422, 422, 421, 421, 422, 421, 421, 422, - 422, 421, 422, 421, 472, 427, 421, 637, - 472, 638, 421, 427, 421, 422, 421, 422, - 639, 472, 640, 641, 421, 422, 421, 421, - 421, 422, 422, 422, 422, 421, 642, 643, - 644, 472, 645, 646, 647, 648, 649, 650, - 651, 652, 653, 654, 655, 656, 657, 658, - 427, 421, 422, 422, 422, 421, 421, 421, - 421, 422, 422, 421, 421, 422, 421, 421, - 421, 421, 421, 421, 421, 422, 421, 422, - 421, 421, 421, 421, 421, 421, 422, 422, - 422, 422, 422, 421, 421, 422, 421, 421, - 421, 422, 421, 421, 422, 421, 421, 422, - 421, 421, 422, 421, 421, 421, 422, 422, - 422, 421, 421, 421, 422, 422, 422, 422, - 421, 659, 472, 660, 472, 661, 662, 663, - 664, 427, 421, 422, 422, 422, 422, 422, - 421, 421, 421, 422, 421, 421, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 421, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 421, 422, 422, 422, - 422, 422, 421, 665, 472, 427, 421, 422, - 666, 472, 457, 427, 421, 422, 667, 421, - 427, 421, 422, 472, 668, 427, 421, 421, - 422, 669, 421, 472, 670, 427, 421, 421, - 422, 672, 671, 422, 422, 422, 422, 672, - 671, 422, 672, 671, 672, 672, 422, 672, - 671, 422, 672, 422, 672, 671, 422, 672, - 422, 672, 422, 671, 672, 672, 672, 672, - 672, 672, 672, 672, 671, 422, 422, 672, - 672, 422, 672, 422, 672, 671, 672, 672, - 672, 672, 672, 422, 672, 422, 672, 422, - 672, 671, 672, 672, 422, 672, 422, 672, - 671, 672, 672, 672, 672, 672, 422, 672, - 422, 672, 671, 422, 422, 672, 422, 672, - 671, 672, 672, 672, 422, 672, 422, 672, - 422, 672, 422, 672, 671, 672, 422, 672, - 422, 672, 671, 422, 672, 672, 672, 672, - 422, 672, 422, 672, 422, 672, 422, 672, - 422, 672, 422, 672, 671, 422, 672, 671, - 672, 672, 672, 422, 672, 422, 672, 671, - 672, 422, 672, 422, 672, 671, 422, 672, - 672, 672, 672, 422, 672, 422, 672, 671, - 422, 672, 422, 672, 422, 672, 671, 672, - 672, 422, 672, 422, 672, 671, 422, 672, - 422, 672, 422, 672, 422, 671, 672, 672, - 672, 422, 672, 422, 672, 671, 422, 672, - 671, 672, 672, 422, 672, 671, 672, 672, - 672, 422, 672, 672, 672, 672, 672, 672, - 422, 422, 672, 422, 672, 422, 672, 422, - 672, 671, 672, 422, 672, 422, 672, 671, - 422, 672, 671, 672, 422, 672, 671, 672, - 422, 672, 671, 422, 422, 672, 671, 422, - 672, 422, 672, 422, 672, 422, 672, 422, - 672, 422, 671, 672, 672, 422, 672, 672, - 672, 672, 422, 422, 672, 672, 672, 672, - 672, 422, 672, 672, 672, 672, 672, 671, - 422, 672, 672, 422, 672, 422, 671, 672, - 672, 422, 672, 671, 422, 422, 672, 422, - 671, 672, 672, 671, 422, 672, 422, 671, - 672, 671, 422, 672, 422, 672, 422, 671, - 672, 672, 671, 422, 672, 422, 672, 422, - 672, 671, 672, 422, 672, 422, 672, 671, - 422, 672, 671, 422, 422, 672, 671, 672, - 422, 671, 672, 671, 422, 672, 422, 672, - 422, 671, 672, 671, 422, 422, 672, 671, - 672, 422, 672, 422, 672, 671, 422, 672, - 422, 671, 672, 671, 422, 422, 672, 422, - 671, 672, 671, 422, 422, 672, 671, 672, - 422, 672, 671, 672, 422, 672, 671, 672, - 422, 672, 422, 672, 422, 671, 672, 671, - 422, 422, 672, 671, 672, 422, 672, 422, - 672, 671, 422, 672, 671, 672, 672, 422, - 672, 422, 672, 671, 671, 422, 671, 422, - 672, 672, 422, 672, 672, 672, 672, 672, - 672, 672, 671, 422, 672, 672, 672, 422, - 671, 672, 672, 672, 422, 672, 422, 672, - 422, 672, 422, 672, 422, 672, 671, 422, - 422, 672, 671, 672, 422, 672, 671, 422, - 422, 672, 422, 422, 422, 672, 422, 672, - 422, 672, 422, 672, 422, 671, 422, 672, - 422, 672, 422, 671, 672, 671, 422, 672, - 422, 671, 672, 422, 672, 672, 672, 671, - 422, 672, 422, 422, 672, 422, 671, 672, - 672, 671, 422, 672, 672, 672, 672, 422, - 672, 422, 671, 672, 672, 672, 422, 672, - 671, 672, 422, 672, 422, 672, 422, 672, - 422, 672, 671, 672, 672, 422, 672, 671, - 422, 672, 422, 672, 422, 671, 672, 672, - 671, 422, 672, 422, 671, 672, 671, 422, - 672, 671, 422, 672, 422, 672, 671, 672, - 672, 672, 671, 422, 422, 422, 672, 671, - 422, 672, 422, 671, 672, 671, 422, 672, - 422, 672, 422, 671, 672, 672, 672, 671, - 422, 672, 422, 671, 672, 672, 672, 672, - 671, 422, 672, 422, 672, 671, 422, 422, - 672, 422, 672, 671, 672, 422, 672, 422, - 671, 672, 672, 671, 422, 672, 422, 672, - 671, 422, 672, 672, 672, 422, 672, 422, - 671, 422, 672, 671, 672, 422, 422, 672, - 422, 672, 422, 671, 672, 672, 672, 672, - 671, 422, 672, 422, 672, 422, 672, 422, - 672, 422, 672, 671, 672, 672, 672, 422, - 672, 422, 672, 422, 672, 422, 671, 672, - 672, 422, 422, 672, 671, 672, 422, 672, - 672, 671, 422, 672, 422, 672, 671, 422, - 422, 672, 672, 672, 672, 422, 672, 422, - 672, 422, 671, 672, 672, 422, 671, 672, - 671, 422, 672, 422, 671, 672, 671, 422, - 672, 422, 671, 672, 422, 672, 672, 671, - 422, 672, 672, 422, 671, 672, 671, 422, - 672, 422, 672, 671, 672, 422, 672, 422, - 671, 672, 671, 422, 672, 422, 672, 422, - 672, 422, 672, 422, 672, 671, 673, 671, - 674, 675, 676, 677, 678, 679, 680, 681, - 682, 683, 684, 676, 685, 686, 687, 688, - 689, 676, 690, 691, 692, 693, 694, 695, - 696, 697, 698, 699, 700, 701, 702, 703, - 704, 676, 705, 673, 685, 673, 706, 673, - 671, 672, 672, 672, 672, 422, 671, 672, - 672, 671, 422, 672, 671, 422, 422, 672, - 671, 422, 672, 422, 671, 672, 671, 422, - 422, 672, 422, 671, 672, 672, 671, 422, - 672, 672, 672, 671, 422, 672, 422, 672, - 672, 671, 422, 422, 672, 422, 671, 672, - 671, 422, 672, 671, 422, 422, 672, 422, - 672, 671, 422, 672, 422, 422, 672, 422, - 672, 422, 671, 672, 672, 671, 422, 672, - 672, 422, 672, 671, 422, 672, 422, 672, - 671, 422, 672, 422, 671, 422, 672, 672, - 672, 422, 672, 671, 672, 422, 672, 671, - 422, 672, 671, 672, 422, 672, 671, 422, - 672, 671, 422, 672, 422, 672, 671, 422, - 672, 671, 422, 672, 671, 707, 708, 709, - 710, 711, 712, 713, 714, 715, 716, 717, - 718, 678, 719, 720, 721, 722, 723, 720, - 724, 725, 726, 727, 728, 729, 730, 731, - 732, 673, 671, 672, 422, 672, 671, 672, - 422, 672, 671, 672, 422, 672, 671, 672, - 422, 672, 671, 422, 672, 422, 672, 671, - 672, 422, 672, 671, 672, 422, 422, 422, - 672, 671, 672, 422, 672, 671, 672, 672, - 672, 672, 422, 672, 422, 671, 672, 671, - 422, 422, 672, 422, 672, 671, 672, 422, - 672, 671, 422, 672, 671, 672, 672, 422, - 672, 671, 422, 672, 671, 672, 422, 672, - 671, 422, 672, 671, 422, 672, 671, 422, - 672, 671, 672, 671, 422, 422, 672, 671, - 672, 422, 672, 671, 422, 672, 422, 671, - 672, 671, 422, 676, 733, 673, 676, 734, - 676, 735, 685, 673, 671, 672, 671, 422, - 672, 671, 422, 676, 734, 685, 673, 671, - 676, 736, 673, 685, 673, 671, 672, 671, - 422, 676, 737, 694, 738, 720, 739, 732, - 676, 740, 741, 742, 673, 685, 673, 671, - 672, 671, 422, 672, 422, 672, 671, 422, - 672, 422, 672, 422, 671, 672, 672, 671, - 422, 672, 422, 672, 671, 422, 672, 671, - 676, 685, 427, 671, 743, 676, 744, 685, - 673, 671, 427, 672, 671, 422, 672, 671, - 422, 745, 676, 746, 747, 673, 671, 422, - 672, 671, 672, 672, 671, 422, 422, 672, - 422, 672, 671, 676, 748, 749, 750, 751, - 752, 753, 754, 755, 756, 757, 758, 673, - 685, 673, 671, 672, 422, 672, 672, 672, - 672, 672, 672, 672, 422, 672, 422, 672, - 672, 672, 672, 672, 672, 671, 422, 672, - 672, 422, 672, 422, 671, 672, 422, 672, - 672, 672, 422, 672, 672, 422, 672, 672, - 422, 672, 672, 422, 672, 672, 671, 422, - 676, 759, 676, 735, 760, 761, 762, 673, - 685, 673, 671, 672, 671, 422, 672, 672, - 672, 422, 672, 672, 672, 422, 672, 422, - 672, 671, 422, 422, 422, 422, 672, 672, - 422, 422, 422, 422, 422, 672, 672, 672, - 672, 672, 672, 672, 422, 672, 422, 672, - 422, 671, 672, 672, 672, 422, 672, 422, - 672, 671, 685, 427, 763, 676, 685, 427, - 672, 671, 422, 764, 676, 765, 685, 427, - 672, 671, 422, 672, 422, 766, 685, 673, - 671, 427, 672, 671, 422, 676, 767, 673, - 685, 673, 671, 672, 671, 422, 768, 769, - 769, 768, 770, 768, 771, 768, 769, 772, - 773, 772, 775, 774, 776, 777, 777, 774, - 778, 774, 779, 776, 780, 777, 781, 777, - 783, 782, 784, 785, 785, 782, 786, 782, - 787, 784, 788, 785, 789, 785, 790, 791, - 792, 793, 794, 795, 796, 797, 799, 800, - 801, 802, 803, 672, 672, 672, 804, 805, - 806, 807, 672, 810, 811, 813, 814, 815, - 809, 816, 817, 818, 819, 820, 821, 822, - 823, 824, 825, 826, 827, 828, 829, 830, - 831, 832, 833, 834, 835, 837, 838, 839, - 840, 841, 842, 672, 798, 10, 798, 422, - 798, 422, 809, 812, 836, 843, 808, 790, - 844, 791, 845, 793, 846, 848, 847, 2, - 1, 849, 847, 850, 847, 5, 1, 847, - 6, 5, 9, 11, 11, 10, 852, 853, - 854, 847, 855, 856, 847, 857, 847, 422, - 422, 859, 860, 491, 472, 861, 472, 862, - 863, 864, 865, 866, 867, 868, 869, 870, - 871, 872, 546, 873, 522, 874, 875, 876, - 877, 878, 879, 880, 881, 882, 883, 884, - 885, 422, 422, 422, 427, 567, 858, 886, - 847, 887, 847, 672, 888, 422, 422, 422, - 672, 888, 672, 672, 422, 888, 422, 888, - 422, 888, 422, 672, 672, 672, 672, 672, - 888, 422, 672, 672, 672, 422, 672, 422, - 888, 422, 672, 672, 672, 672, 422, 888, - 672, 422, 672, 422, 672, 422, 672, 672, - 422, 672, 888, 422, 672, 422, 672, 422, - 672, 888, 672, 422, 888, 672, 422, 672, - 422, 888, 672, 672, 672, 672, 672, 888, - 422, 422, 672, 422, 672, 888, 672, 422, - 888, 672, 672, 888, 422, 422, 672, 422, - 672, 422, 672, 888, 889, 890, 891, 892, - 893, 894, 895, 896, 897, 898, 899, 717, - 900, 901, 902, 903, 904, 905, 906, 907, - 908, 909, 910, 911, 910, 912, 913, 914, - 915, 916, 673, 888, 917, 918, 919, 920, - 921, 922, 923, 924, 925, 926, 927, 928, - 929, 930, 931, 932, 933, 934, 935, 727, - 936, 937, 938, 694, 939, 940, 941, 942, - 943, 944, 673, 945, 946, 947, 948, 949, - 950, 951, 952, 676, 953, 673, 676, 954, - 955, 956, 957, 685, 888, 958, 959, 960, - 961, 705, 962, 963, 685, 964, 965, 966, - 967, 968, 673, 888, 969, 928, 970, 971, - 972, 685, 973, 974, 676, 673, 685, 427, - 888, 938, 673, 676, 685, 427, 685, 427, - 975, 685, 888, 427, 676, 976, 977, 676, - 978, 979, 683, 980, 981, 982, 983, 984, - 934, 985, 986, 987, 988, 989, 990, 991, - 992, 993, 994, 995, 996, 953, 997, 676, - 685, 427, 888, 998, 999, 685, 673, 888, - 427, 673, 888, 676, 1000, 733, 1001, 1002, - 1003, 1004, 1005, 1006, 1007, 1008, 673, 1009, - 1010, 1011, 1012, 1013, 1014, 673, 685, 888, - 1016, 1017, 1018, 1019, 1020, 1021, 1022, 1023, - 1024, 1025, 1026, 1022, 1028, 1029, 1030, 1031, - 1015, 1027, 1015, 888, 1015, 888, 1032, 1032, - 1033, 1034, 1035, 1036, 1037, 1038, 1039, 1040, - 1037, 769, 1041, 1041, 1041, 1036, 1042, 1041, - 770, 771, 1043, 1041, 769, 1041, 1041, 1036, - 1044, 1041, 770, 771, 1043, 1041, 769, 1036, - 1044, 1045, 1046, 1047, 769, 1041, 1041, 1041, - 1036, 1042, 770, 771, 1043, 1041, 769, 1041, - 1041, 1041, 1036, 1042, 770, 771, 1043, 1041, - 769, 1041, 1041, 1041, 1036, 1042, 771, 770, - 771, 1043, 1041, 769, 1049, 769, 1051, 1050, - 1052, 769, 1054, 1053, 769, 1055, 773, 1055, - 1056, 1055, 775, 1057, 1058, 1059, 1060, 1061, - 1062, 1063, 1060, 777, 775, 1057, 1065, 1064, - 778, 779, 1066, 1064, 777, 1068, 1067, 1070, - 1069, 777, 1071, 778, 1071, 779, 1071, 783, - 1072, 1073, 1074, 1075, 1076, 1077, 1078, 1075, - 785, 783, 1072, 1080, 1079, 786, 787, 1081, - 1079, 785, 1083, 1082, 1085, 1084, 785, 1086, - 786, 1086, 787, 1086, -} - -var _zcltok_trans_targs []int16 = []int16{ - 949, 1, 949, 949, 949, 3, 4, 958, - 949, 5, 959, 6, 7, 9, 10, 287, - 13, 14, 15, 16, 17, 288, 289, 20, - 290, 22, 23, 291, 292, 293, 294, 295, - 296, 297, 298, 299, 300, 329, 349, 354, - 128, 129, 130, 357, 152, 372, 376, 949, - 11, 12, 18, 19, 21, 24, 25, 26, - 27, 28, 29, 30, 31, 32, 33, 65, - 106, 121, 132, 155, 171, 284, 34, 35, - 36, 37, 38, 39, 40, 41, 42, 43, - 44, 45, 46, 47, 48, 49, 50, 51, - 52, 53, 54, 55, 56, 57, 58, 59, - 60, 61, 62, 63, 64, 66, 67, 68, - 69, 70, 71, 72, 73, 74, 75, 76, - 77, 78, 79, 80, 81, 82, 83, 84, - 85, 86, 87, 88, 89, 90, 91, 92, - 93, 94, 95, 96, 97, 98, 99, 100, - 101, 102, 103, 104, 105, 107, 108, 109, - 110, 111, 112, 113, 114, 115, 116, 117, - 118, 119, 120, 122, 123, 124, 125, 126, - 127, 131, 133, 134, 135, 136, 137, 138, - 139, 140, 141, 142, 143, 144, 145, 146, - 147, 148, 149, 150, 151, 153, 154, 156, - 157, 158, 159, 160, 161, 162, 163, 164, - 165, 166, 167, 168, 169, 170, 172, 204, - 228, 231, 232, 234, 243, 244, 247, 251, - 269, 276, 278, 280, 282, 173, 174, 175, - 176, 177, 178, 179, 180, 181, 182, 183, - 184, 185, 186, 187, 188, 189, 190, 191, - 192, 193, 194, 195, 196, 197, 198, 199, - 200, 201, 202, 203, 205, 206, 207, 208, - 209, 210, 211, 212, 213, 214, 215, 216, - 217, 218, 219, 220, 221, 222, 223, 224, - 225, 226, 227, 229, 230, 233, 235, 236, - 237, 238, 239, 240, 241, 242, 245, 246, - 248, 249, 250, 252, 253, 254, 255, 256, - 257, 258, 259, 260, 261, 262, 263, 264, - 265, 266, 267, 268, 270, 271, 272, 273, - 274, 275, 277, 279, 281, 283, 285, 286, - 301, 302, 303, 304, 305, 306, 307, 308, - 309, 310, 311, 312, 313, 314, 315, 316, - 317, 318, 319, 320, 321, 322, 323, 324, - 325, 326, 327, 328, 330, 331, 332, 333, - 334, 335, 336, 337, 338, 339, 340, 341, - 342, 343, 344, 345, 346, 347, 348, 350, - 351, 352, 353, 355, 356, 358, 359, 360, - 361, 362, 363, 364, 365, 366, 367, 368, - 369, 370, 371, 373, 374, 375, 377, 383, - 405, 410, 412, 414, 378, 379, 380, 381, - 382, 384, 385, 386, 387, 388, 389, 390, - 391, 392, 393, 394, 395, 396, 397, 398, - 399, 400, 401, 402, 403, 404, 406, 407, - 408, 409, 411, 413, 415, 949, 963, 438, - 439, 440, 441, 418, 442, 443, 444, 445, - 446, 447, 448, 449, 450, 451, 452, 453, - 454, 455, 456, 457, 458, 459, 460, 461, - 462, 463, 464, 465, 466, 467, 468, 470, - 471, 472, 473, 474, 475, 476, 477, 478, - 479, 480, 481, 482, 483, 484, 485, 486, - 420, 487, 488, 489, 490, 491, 492, 493, - 494, 495, 496, 497, 498, 499, 500, 501, - 502, 503, 504, 419, 505, 506, 507, 508, - 509, 511, 512, 513, 514, 515, 516, 517, - 518, 519, 520, 521, 522, 523, 524, 526, - 527, 528, 529, 530, 531, 535, 537, 538, - 539, 540, 435, 541, 542, 543, 544, 545, - 546, 547, 548, 549, 550, 551, 552, 553, - 554, 555, 557, 558, 560, 561, 562, 563, - 564, 565, 433, 566, 567, 568, 569, 570, - 571, 572, 573, 574, 576, 608, 632, 635, - 636, 638, 647, 648, 651, 655, 673, 533, - 680, 682, 684, 686, 577, 578, 579, 580, - 581, 582, 583, 584, 585, 586, 587, 588, - 589, 590, 591, 592, 593, 594, 595, 596, - 597, 598, 599, 600, 601, 602, 603, 604, - 605, 606, 607, 609, 610, 611, 612, 613, - 614, 615, 616, 617, 618, 619, 620, 621, - 622, 623, 624, 625, 626, 627, 628, 629, - 630, 631, 633, 634, 637, 639, 640, 641, - 642, 643, 644, 645, 646, 649, 650, 652, - 653, 654, 656, 657, 658, 659, 660, 661, - 662, 663, 664, 665, 666, 667, 668, 669, - 670, 671, 672, 674, 675, 676, 677, 678, - 679, 681, 683, 685, 687, 689, 690, 949, - 949, 691, 828, 829, 760, 830, 831, 832, - 833, 834, 835, 789, 836, 725, 837, 838, - 839, 840, 841, 842, 843, 844, 745, 845, - 846, 847, 848, 849, 850, 851, 852, 853, - 854, 770, 855, 857, 858, 859, 860, 861, - 862, 863, 864, 865, 866, 703, 867, 868, - 869, 870, 871, 872, 873, 874, 875, 741, - 876, 877, 878, 879, 880, 811, 882, 883, - 886, 888, 889, 890, 891, 892, 893, 896, - 897, 899, 900, 901, 903, 904, 905, 906, - 907, 908, 909, 910, 911, 912, 913, 915, - 916, 917, 918, 921, 923, 924, 926, 928, - 1001, 1002, 930, 931, 1001, 933, 1015, 1015, - 1015, 1016, 937, 938, 1017, 1018, 1022, 1022, - 1022, 1023, 944, 945, 1024, 1025, 950, 949, - 951, 952, 953, 949, 954, 955, 949, 956, - 957, 960, 961, 962, 949, 964, 949, 965, - 949, 966, 967, 968, 969, 970, 971, 972, - 973, 974, 975, 976, 977, 978, 979, 980, - 981, 982, 983, 984, 985, 986, 987, 988, - 989, 990, 991, 992, 993, 994, 995, 996, - 997, 998, 999, 1000, 949, 949, 949, 949, - 949, 949, 2, 949, 949, 8, 949, 949, - 949, 949, 949, 416, 417, 421, 422, 423, - 424, 425, 426, 427, 428, 429, 430, 431, - 432, 434, 436, 437, 469, 510, 525, 532, - 534, 536, 556, 559, 575, 688, 949, 949, - 949, 692, 693, 694, 695, 696, 697, 698, - 699, 700, 701, 702, 704, 705, 706, 707, - 708, 709, 710, 711, 712, 713, 714, 715, - 716, 717, 718, 719, 720, 721, 722, 723, - 724, 726, 727, 728, 729, 730, 731, 732, - 733, 734, 735, 736, 737, 738, 739, 740, - 742, 743, 744, 746, 747, 748, 749, 750, - 751, 752, 753, 754, 755, 756, 757, 758, - 759, 761, 762, 763, 764, 765, 766, 767, - 768, 769, 771, 772, 773, 774, 775, 776, - 777, 778, 779, 780, 781, 782, 783, 784, - 785, 786, 787, 788, 790, 791, 792, 793, - 794, 795, 796, 797, 798, 799, 800, 801, - 802, 803, 804, 805, 806, 807, 808, 809, - 810, 812, 813, 814, 815, 816, 817, 818, - 819, 820, 821, 822, 823, 824, 825, 826, - 827, 856, 881, 884, 885, 887, 894, 895, - 898, 902, 914, 919, 920, 922, 925, 927, - 1001, 1001, 1008, 1010, 1003, 1001, 1012, 1013, - 1014, 1001, 929, 932, 1004, 1005, 1006, 1007, - 1001, 1009, 1001, 1001, 1011, 1001, 1001, 1001, - 934, 935, 940, 941, 1015, 1019, 1020, 1021, - 1015, 936, 939, 1015, 1015, 1015, 1015, 1015, - 942, 947, 948, 1022, 1026, 1027, 1028, 1022, - 943, 946, 1022, 1022, 1022, 1022, 1022, -} - -var _zcltok_trans_actions []byte = []byte{ - 131, 0, 71, 127, 87, 0, 0, 151, - 123, 0, 5, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 101, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 125, 148, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 129, - 105, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 27, 5, 0, 0, 29, 0, 49, 35, - 47, 136, 0, 0, 0, 0, 69, 55, - 67, 142, 0, 0, 0, 0, 0, 73, - 0, 0, 0, 99, 160, 0, 91, 5, - 154, 5, 0, 0, 93, 0, 95, 0, - 103, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 5, - 5, 5, 157, 157, 157, 157, 157, 157, - 5, 5, 157, 5, 117, 121, 107, 115, - 77, 83, 0, 113, 109, 0, 81, 75, - 89, 79, 111, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 85, 97, - 119, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 13, 11, 0, 0, 5, 15, 0, 5, - 5, 21, 0, 0, 0, 5, 5, 5, - 23, 0, 17, 7, 0, 19, 9, 25, - 0, 0, 0, 0, 37, 0, 139, 139, - 43, 0, 0, 39, 31, 41, 33, 45, - 0, 0, 0, 57, 0, 145, 145, 63, - 0, 0, 59, 51, 61, 53, 65, -} - -var _zcltok_to_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 1, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 133, - 0, 0, 0, 0, 0, 0, 133, 0, - 0, 0, 0, 0, 0, -} - -var _zcltok_from_state_actions []byte = []byte{ - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 3, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, - 0, 3, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 3, - 0, 0, 0, 0, 0, 0, 3, 0, - 0, 0, 0, 0, 0, -} - -var _zcltok_eof_trans []int16 = []int16{ - 0, 1, 4, 1, 1, 9, 9, 9, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, - 422, 422, 1, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 422, 422, 422, 422, 422, - 422, 422, 422, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 672, 672, 672, 672, 672, 672, 672, - 672, 769, 769, 769, 769, 773, 773, 775, - 777, 775, 775, 777, 0, 0, 783, 785, - 783, 783, 785, 0, 0, 0, 845, 846, - 847, 848, 846, 848, 848, 848, 852, 853, - 848, 848, 848, 859, 848, 848, 889, 889, - 889, 889, 889, 889, 889, 889, 889, 889, - 889, 889, 889, 889, 889, 889, 889, 889, - 889, 889, 889, 889, 889, 889, 889, 889, - 889, 889, 889, 889, 889, 889, 889, 889, - 889, 0, 1042, 1042, 1042, 1042, 1042, 1042, - 1049, 1051, 1049, 1054, 1056, 1056, 1056, 0, - 1065, 1068, 1070, 1072, 1072, 1072, 0, 1080, - 1083, 1085, 1087, 1087, 1087, -} - -const zcltok_start int = 949 -const zcltok_first_final int = 949 -const zcltok_error int = 0 - -const zcltok_en_stringTemplate int = 1001 -const zcltok_en_heredocTemplate int = 1015 -const zcltok_en_bareTemplate int = 1022 -const zcltok_en_main int = 949 - -// line 15 "scan_tokens.rl" - -func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []Token { - f := &tokenAccum{ - Filename: filename, - Bytes: data, - Pos: start, - } - - // line 272 "scan_tokens.rl" - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - var stack []int - var top int - - var cs int // current state - switch mode { - case scanNormal: - cs = zcltok_en_main - case scanTemplate: - cs = zcltok_en_bareTemplate - default: - panic("invalid scanMode") - } - - braces := 0 - var retBraces []int // stack of brace levels that cause us to use fret - var heredocs []heredocInProgress // stack of heredocs we're currently processing - - // line 305 "scan_tokens.rl" - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - token := func(ty TokenType) { - f.emitToken(ty, ts, te) - } - selfToken := func() { - b := data[ts:te] - if len(b) != 1 { - // should never happen - panic("selfToken only works for single-character tokens") - } - f.emitToken(TokenType(b[0]), ts, te) - } - - // line 2816 "scan_tokens.go" - { - top = 0 - ts = 0 - te = 0 - act = 0 - } - - // line 2824 "scan_tokens.go" - { - var _klen int - var _trans int - var _acts int - var _nacts uint - var _keys int - if p == pe { - goto _test_eof - } - if cs == 0 { - goto _out - } - _resume: - _acts = int(_zcltok_from_state_actions[cs]) - _nacts = uint(_zcltok_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _zcltok_actions[_acts-1] { - case 2: - // line 1 "NONE" - - ts = p - - // line 2848 "scan_tokens.go" - } - } - - _keys = int(_zcltok_key_offsets[cs]) - _trans = int(_zcltok_index_offsets[cs]) - - _klen = int(_zcltok_single_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + _klen - 1) - for { - if _upper < _lower { - break - } - - _mid = _lower + ((_upper - _lower) >> 1) - switch { - case data[p] < _zcltok_trans_keys[_mid]: - _upper = _mid - 1 - case data[p] > _zcltok_trans_keys[_mid]: - _lower = _mid + 1 - default: - _trans += int(_mid - int(_keys)) - goto _match - } - } - _keys += _klen - _trans += _klen - } - - _klen = int(_zcltok_range_lengths[cs]) - if _klen > 0 { - _lower := int(_keys) - var _mid int - _upper := int(_keys + (_klen << 1) - 2) - for { - if _upper < _lower { - break - } - - _mid = _lower + (((_upper - _lower) >> 1) & ^1) - switch { - case data[p] < _zcltok_trans_keys[_mid]: - _upper = _mid - 2 - case data[p] > _zcltok_trans_keys[_mid+1]: - _lower = _mid + 2 - default: - _trans += int((_mid - int(_keys)) >> 1) - goto _match - } - } - _trans += _klen - } - - _match: - _trans = int(_zcltok_indicies[_trans]) - _eof_trans: - cs = int(_zcltok_trans_targs[_trans]) - - if _zcltok_trans_actions[_trans] == 0 { - goto _again - } - - _acts = int(_zcltok_trans_actions[_trans]) - _nacts = uint(_zcltok_actions[_acts]) - _acts++ - for ; _nacts > 0; _nacts-- { - _acts++ - switch _zcltok_actions[_acts-1] { - case 3: - // line 1 "NONE" - - te = p + 1 - - case 4: - // line 138 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 5: - // line 148 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 6: - // line 80 "scan_tokens.rl" - - te = p + 1 - { - token(TokenCQuote) - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } - case 7: - // line 222 "scan_tokens.rl" - - te = p + 1 - { - token(TokenInvalid) - } - case 8: - // line 223 "scan_tokens.rl" - - te = p + 1 - { - token(TokenBadUTF8) - } - case 9: - // line 138 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 10: - // line 148 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 11: - // line 221 "scan_tokens.rl" - - te = p - p-- - { - token(TokenQuotedLit) - } - case 12: - // line 222 "scan_tokens.rl" - - te = p - p-- - { - token(TokenInvalid) - } - case 13: - // line 223 "scan_tokens.rl" - - te = p - p-- - { - token(TokenBadUTF8) - } - case 14: - // line 221 "scan_tokens.rl" - - p = (te) - 1 - { - token(TokenQuotedLit) - } - case 15: - // line 223 "scan_tokens.rl" - - p = (te) - 1 - { - token(TokenBadUTF8) - } - case 16: - // line 126 "scan_tokens.rl" - - act = 10 - case 17: - // line 231 "scan_tokens.rl" - - act = 11 - case 18: - // line 138 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 19: - // line 148 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 20: - // line 107 "scan_tokens.rl" - - te = p + 1 - { - // This action is called specificially when a heredoc literal - // ends with a newline character. - - // This might actually be our end marker. - topdoc := &heredocs[len(heredocs)-1] - if topdoc.StartOfLine { - maybeMarker := bytes.TrimSpace(data[ts:te]) - if bytes.Equal(maybeMarker, topdoc.Marker) { - token(TokenCHeredoc) - heredocs = heredocs[:len(heredocs)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } - } - - topdoc.StartOfLine = true - token(TokenStringLit) - } - case 21: - // line 231 "scan_tokens.rl" - - te = p + 1 - { - token(TokenBadUTF8) - } - case 22: - // line 138 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 23: - // line 148 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 24: - // line 126 "scan_tokens.rl" - - te = p - p-- - { - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 25: - // line 231 "scan_tokens.rl" - - te = p - p-- - { - token(TokenBadUTF8) - } - case 26: - // line 126 "scan_tokens.rl" - - p = (te) - 1 - { - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 27: - // line 1 "NONE" - - switch act { - case 0: - { - cs = 0 - goto _again - } - case 10: - { - p = (te) - 1 - - // This action is called when a heredoc literal _doesn't_ end - // with a newline character, e.g. because we're about to enter - // an interpolation sequence. - heredocs[len(heredocs)-1].StartOfLine = false - token(TokenStringLit) - } - case 11: - { - p = (te) - 1 - token(TokenBadUTF8) - } - } - - case 28: - // line 134 "scan_tokens.rl" - - act = 14 - case 29: - // line 238 "scan_tokens.rl" - - act = 15 - case 30: - // line 138 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 31: - // line 148 "scan_tokens.rl" - - te = p + 1 - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 32: - // line 134 "scan_tokens.rl" - - te = p + 1 - { - token(TokenStringLit) - } - case 33: - // line 238 "scan_tokens.rl" - - te = p + 1 - { - token(TokenBadUTF8) - } - case 34: - // line 138 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateInterp) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 35: - // line 148 "scan_tokens.rl" - - te = p - p-- - { - token(TokenTemplateControl) - braces++ - retBraces = append(retBraces, braces) - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false - } - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 949 - goto _again - } - } - case 36: - // line 134 "scan_tokens.rl" - - te = p - p-- - { - token(TokenStringLit) - } - case 37: - // line 238 "scan_tokens.rl" - - te = p - p-- - { - token(TokenBadUTF8) - } - case 38: - // line 134 "scan_tokens.rl" - - p = (te) - 1 - { - token(TokenStringLit) - } - case 39: - // line 1 "NONE" - - switch act { - case 0: - { - cs = 0 - goto _again - } - case 14: - { - p = (te) - 1 - - token(TokenStringLit) - } - case 15: - { - p = (te) - 1 - token(TokenBadUTF8) - } - } - - case 40: - // line 244 "scan_tokens.rl" - - act = 18 - case 41: - // line 246 "scan_tokens.rl" - - act = 19 - case 42: - // line 257 "scan_tokens.rl" - - act = 29 - case 43: - // line 268 "scan_tokens.rl" - - act = 36 - case 44: - // line 269 "scan_tokens.rl" - - act = 37 - case 45: - // line 246 "scan_tokens.rl" - - te = p + 1 - { - token(TokenComment) - } - case 46: - // line 247 "scan_tokens.rl" - - te = p + 1 - { - token(TokenNewline) - } - case 47: - // line 249 "scan_tokens.rl" - - te = p + 1 - { - token(TokenEqualOp) - } - case 48: - // line 250 "scan_tokens.rl" - - te = p + 1 - { - token(TokenNotEqual) - } - case 49: - // line 251 "scan_tokens.rl" - - te = p + 1 - { - token(TokenGreaterThanEq) - } - case 50: - // line 252 "scan_tokens.rl" - - te = p + 1 - { - token(TokenLessThanEq) - } - case 51: - // line 253 "scan_tokens.rl" - - te = p + 1 - { - token(TokenAnd) - } - case 52: - // line 254 "scan_tokens.rl" - - te = p + 1 - { - token(TokenOr) - } - case 53: - // line 255 "scan_tokens.rl" - - te = p + 1 - { - token(TokenEllipsis) - } - case 54: - // line 256 "scan_tokens.rl" - - te = p + 1 - { - token(TokenFatArrow) - } - case 55: - // line 257 "scan_tokens.rl" - - te = p + 1 - { - selfToken() - } - case 56: - // line 158 "scan_tokens.rl" - - te = p + 1 - { - token(TokenOBrace) - braces++ - } - case 57: - // line 163 "scan_tokens.rl" - - te = p + 1 - { - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd) - braces-- - retBraces = retBraces[0 : len(retBraces)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } else { - token(TokenCBrace) - braces-- - } - } - case 58: - // line 175 "scan_tokens.rl" - - te = p + 1 - { - // Only consume from the retBraces stack and return if we are at - // a suitable brace nesting level, otherwise things will get - // confused. (Not entering this branch indicates a syntax error, - // which we will catch in the parser.) - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd) - braces-- - retBraces = retBraces[0 : len(retBraces)-1] - top-- - cs = stack[top] - { - stack = stack[:len(stack)-1] - } - goto _again - - } else { - // We intentionally generate a TokenTemplateSeqEnd here, - // even though the user apparently wanted a brace, because - // we want to allow the parser to catch the incorrect use - // of a ~} to balance a generic opening brace, rather than - // a template sequence. - token(TokenTemplateSeqEnd) - braces-- - } - } - case 59: - // line 75 "scan_tokens.rl" - - te = p + 1 - { - token(TokenOQuote) - { - stack = append(stack, 0) - stack[top] = cs - top++ - cs = 1001 - goto _again - } - } - case 60: - // line 85 "scan_tokens.rl" - - te = p + 1 - { - token(TokenOHeredoc) - // the token is currently the whole heredoc introducer, like - // < 0; _nacts-- { - _acts++ - switch _zcltok_actions[_acts-1] { - case 0: - // line 1 "NONE" - - ts = 0 - - case 1: - // line 1 "NONE" - - act = 0 - - // line 3612 "scan_tokens.go" - } - } - - if cs == 0 { - goto _out - } - p++ - if p != pe { - goto _resume - } - _test_eof: - { - } - if p == eof { - if _zcltok_eof_trans[cs] > 0 { - _trans = int(_zcltok_eof_trans[cs] - 1) - goto _eof_trans - } - } - - _out: - { - } - } - - // line 328 "scan_tokens.rl" - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which we'll - // deal with as an invalid. - if cs < zcltok_first_final { - f.emitToken(TokenInvalid, p, len(data)) - } - - // We always emit a synthetic EOF token at the end, since it gives the - // parser position information for an "unexpected EOF" diagnostic. - f.emitToken(TokenEOF, len(data), len(data)) - - return f.Tokens -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.rl b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.rl deleted file mode 100644 index 4a395c1..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens.rl +++ /dev/null @@ -1,342 +0,0 @@ -package zclsyntax - -import ( - "bytes" - - "github.com/zclconf/go-zcl/zcl" -) - -// This file is generated from scan_tokens.rl. DO NOT EDIT. -%%{ - # (except you are actually in scan_tokens.rl here, so edit away!) - - machine zcltok; - write data; -}%% - -func scanTokens(data []byte, filename string, start hcl.Pos, mode scanMode) []Token { - f := &tokenAccum{ - Filename: filename, - Bytes: data, - Pos: start, - } - - %%{ - include UnicodeDerived "unicode_derived.rl"; - - UTF8Cont = 0x80 .. 0xBF; - AnyUTF8 = ( - 0x00..0x7F | - 0xC0..0xDF . UTF8Cont | - 0xE0..0xEF . UTF8Cont . UTF8Cont | - 0xF0..0xF7 . UTF8Cont . UTF8Cont . UTF8Cont - ); - BrokenUTF8 = any - AnyUTF8; - - NumberLitContinue = (digit|'.'|('e'|'E') ('+'|'-')? digit); - NumberLit = digit ("" | (NumberLitContinue - '.') | (NumberLitContinue* (NumberLitContinue - '.'))); - Ident = ID_Start (ID_Continue | '-')*; - - # Symbols that just represent themselves are handled as a single rule. - SelfToken = "[" | "]" | "(" | ")" | "." | "," | "*" | "/" | "+" | "-" | "=" | "<" | ">" | "!" | "?" | ":" | "\n" | "&" | "|" | "~" | "^" | ";" | "`"; - - EqualOp = "=="; - NotEqual = "!="; - GreaterThanEqual = ">="; - LessThanEqual = "<="; - LogicalAnd = "&&"; - LogicalOr = "||"; - - Ellipsis = "..."; - FatArrow = "=>"; - - Newline = '\r' ? '\n'; - EndOfLine = Newline; - - BeginStringTmpl = '"'; - BeginHeredocTmpl = '<<' ('-')? Ident Newline; - - Comment = ( - ("#" (any - EndOfLine)* EndOfLine) | - ("//" (any - EndOfLine)* EndOfLine) | - ("/*" any* "*/") - ); - - # Tabs are not valid, but we accept them in the scanner and mark them - # as tokens so that we can produce diagnostics advising the user to - # use spaces instead. - Tabs = 0x09+; - - # Note: zclwrite assumes that only ASCII spaces appear between tokens, - # and uses this assumption to recreate the spaces between tokens by - # looking at byte offset differences. - Spaces = ' '+; - - action beginStringTemplate { - token(TokenOQuote); - fcall stringTemplate; - } - - action endStringTemplate { - token(TokenCQuote); - fret; - } - - action beginHeredocTemplate { - token(TokenOHeredoc); - // the token is currently the whole heredoc introducer, like - // < 0 { - heredocs[len(heredocs)-1].StartOfLine = false; - } - fcall main; - } - - action beginTemplateControl { - token(TokenTemplateControl); - braces++; - retBraces = append(retBraces, braces); - if len(heredocs) > 0 { - heredocs[len(heredocs)-1].StartOfLine = false; - } - fcall main; - } - - action openBrace { - token(TokenOBrace); - braces++; - } - - action closeBrace { - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd); - braces--; - retBraces = retBraces[0:len(retBraces)-1] - fret; - } else { - token(TokenCBrace); - braces--; - } - } - - action closeTemplateSeqEatWhitespace { - // Only consume from the retBraces stack and return if we are at - // a suitable brace nesting level, otherwise things will get - // confused. (Not entering this branch indicates a syntax error, - // which we will catch in the parser.) - if len(retBraces) > 0 && retBraces[len(retBraces)-1] == braces { - token(TokenTemplateSeqEnd); - braces--; - retBraces = retBraces[0:len(retBraces)-1] - fret; - } else { - // We intentionally generate a TokenTemplateSeqEnd here, - // even though the user apparently wanted a brace, because - // we want to allow the parser to catch the incorrect use - // of a ~} to balance a generic opening brace, rather than - // a template sequence. - token(TokenTemplateSeqEnd); - braces--; - } - } - - TemplateInterp = "${" ("~")?; - TemplateControl = "%{" ("~")?; - EndStringTmpl = '"'; - StringLiteralChars = (AnyUTF8 - ("\r"|"\n")); - TemplateStringLiteral = ( - ('$' ^'{') | - ('%' ^'{') | - ('\\' StringLiteralChars) | - (StringLiteralChars - ("$" | '%' | '"')) - )+; - HeredocStringLiteral = ( - ('$' ^'{') | - ('%' ^'{') | - (StringLiteralChars - ("$" | '%')) - )*; - BareStringLiteral = ( - ('$' ^'{') | - ('%' ^'{') | - (StringLiteralChars - ("$" | '%')) - )* Newline?; - - stringTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - EndStringTmpl => endStringTemplate; - TemplateStringLiteral => { token(TokenQuotedLit); }; - AnyUTF8 => { token(TokenInvalid); }; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - heredocTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - HeredocStringLiteral EndOfLine => heredocLiteralEOL; - HeredocStringLiteral => heredocLiteralMidline; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - bareTemplate := |* - TemplateInterp => beginTemplateInterp; - TemplateControl => beginTemplateControl; - BareStringLiteral => bareTemplateLiteral; - BrokenUTF8 => { token(TokenBadUTF8); }; - *|; - - main := |* - Spaces => {}; - NumberLit => { token(TokenNumberLit) }; - Ident => { token(TokenIdent) }; - - Comment => { token(TokenComment) }; - Newline => { token(TokenNewline) }; - - EqualOp => { token(TokenEqualOp); }; - NotEqual => { token(TokenNotEqual); }; - GreaterThanEqual => { token(TokenGreaterThanEq); }; - LessThanEqual => { token(TokenLessThanEq); }; - LogicalAnd => { token(TokenAnd); }; - LogicalOr => { token(TokenOr); }; - Ellipsis => { token(TokenEllipsis); }; - FatArrow => { token(TokenFatArrow); }; - SelfToken => { selfToken() }; - - "{" => openBrace; - "}" => closeBrace; - - "~}" => closeTemplateSeqEatWhitespace; - - BeginStringTmpl => beginStringTemplate; - BeginHeredocTmpl => beginHeredocTemplate; - - Tabs => { token(TokenTabs) }; - BrokenUTF8 => { token(TokenBadUTF8) }; - AnyUTF8 => { token(TokenInvalid) }; - *|; - - }%% - - // Ragel state - p := 0 // "Pointer" into data - pe := len(data) // End-of-data "pointer" - ts := 0 - te := 0 - act := 0 - eof := pe - var stack []int - var top int - - var cs int // current state - switch mode { - case scanNormal: - cs = zcltok_en_main - case scanTemplate: - cs = zcltok_en_bareTemplate - default: - panic("invalid scanMode") - } - - braces := 0 - var retBraces []int // stack of brace levels that cause us to use fret - var heredocs []heredocInProgress // stack of heredocs we're currently processing - - %%{ - prepush { - stack = append(stack, 0); - } - postpop { - stack = stack[:len(stack)-1]; - } - }%% - - // Make Go compiler happy - _ = ts - _ = te - _ = act - _ = eof - - token := func (ty TokenType) { - f.emitToken(ty, ts, te) - } - selfToken := func () { - b := data[ts:te] - if len(b) != 1 { - // should never happen - panic("selfToken only works for single-character tokens") - } - f.emitToken(TokenType(b[0]), ts, te) - } - - %%{ - write init nocs; - write exec; - }%% - - // If we fall out here without being in a final state then we've - // encountered something that the scanner can't match, which we'll - // deal with as an invalid. - if cs < zcltok_first_final { - f.emitToken(TokenInvalid, p, len(data)) - } - - // We always emit a synthetic EOF token at the end, since it gives the - // parser position information for an "unexpected EOF" diagnostic. - f.emitToken(TokenEOF, len(data), len(data)) - - return f.Tokens -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens_test.go deleted file mode 100644 index 0fd4c64..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/scan_tokens_test.go +++ /dev/null @@ -1,1506 +0,0 @@ -package hclsyntax - -import ( - "reflect" - "testing" - - "github.com/hashicorp/hcl2/hcl" - "github.com/kylelemons/godebug/pretty" -) - -func TestScanTokens_normal(t *testing.T) { - tests := []struct { - input string - want []Token - }{ - // Empty input - { - ``, - []Token{ - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - }, - }, - }, - }, - { - ` `, - []Token{ - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - }, - }, - { - "\n\n", - []Token{ - { - Type: TokenNewline, - Bytes: []byte("\n"), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 2, Column: 1}, - }, - }, - { - Type: TokenNewline, - Bytes: []byte("\n"), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 2, Column: 1}, - End: hcl.Pos{Byte: 2, Line: 3, Column: 1}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 2, Line: 3, Column: 1}, - End: hcl.Pos{Byte: 2, Line: 3, Column: 1}, - }, - }, - }, - }, - - // TokenNumberLit - { - `1`, - []Token{ - { - Type: TokenNumberLit, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - }, - }, - { - `12`, - []Token{ - { - Type: TokenNumberLit, - Bytes: []byte(`12`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - End: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - }, - }, - }, - }, - { - `12.3`, - []Token{ - { - Type: TokenNumberLit, - Bytes: []byte(`12.3`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - }, - }, - { - `1e2`, - []Token{ - { - Type: TokenNumberLit, - Bytes: []byte(`1e2`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - }, - }, - { - `1e+2`, - []Token{ - { - Type: TokenNumberLit, - Bytes: []byte(`1e+2`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - }, - }, - - // TokenIdent - { - `hello`, - []Token{ - { - Type: TokenIdent, - Bytes: []byte(`hello`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - }, - }, - { - `h3ll0`, - []Token{ - { - Type: TokenIdent, - Bytes: []byte(`h3ll0`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - }, - }, - { - `héllo`, // combining acute accent - []Token{ - { - Type: TokenIdent, - Bytes: []byte(`héllo`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 6}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 6}, - }, - }, - }, - }, - - // Literal-only Templates (string literals, effectively) - { - `""`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - End: hcl.Pos{Byte: 2, Line: 1, Column: 3}, - }, - }, - }, - }, - { - `"hello"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenQuotedLit, - Bytes: []byte(`hello`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - }, - }, - - // Templates with interpolations and control sequences - { - `"${1}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenNumberLit, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - }, - }, - { - `"%{a}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateControl, - Bytes: []byte(`%{`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenIdent, - Bytes: []byte(`a`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - }, - }, - { - `"${{}}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenOBrace, - Bytes: []byte(`{`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenCBrace, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - }, - }, - { - `"${""}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 5, Line: 1, Column: 6}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - }, - }, - { - `"${"${a}"}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenIdent, - Bytes: []byte(`a`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - End: hcl.Pos{Byte: 8, Line: 1, Column: 9}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 8, Line: 1, Column: 9}, - End: hcl.Pos{Byte: 9, Line: 1, Column: 10}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 9, Line: 1, Column: 10}, - End: hcl.Pos{Byte: 10, Line: 1, Column: 11}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 10, Line: 1, Column: 11}, - End: hcl.Pos{Byte: 11, Line: 1, Column: 12}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 11, Line: 1, Column: 12}, - End: hcl.Pos{Byte: 11, Line: 1, Column: 12}, - }, - }, - }, - }, - { - `"${"${a} foo"}"`, - []Token{ - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 0, Line: 1, Column: 1}, - End: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - }, - }, - { - Type: TokenOQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 3, Line: 1, Column: 4}, - End: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Type: TokenTemplateInterp, - Bytes: []byte(`${`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 4, Line: 1, Column: 5}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Type: TokenIdent, - Bytes: []byte(`a`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - End: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 7, Line: 1, Column: 8}, - End: hcl.Pos{Byte: 8, Line: 1, Column: 9}, - }, - }, - { - Type: TokenQuotedLit, - Bytes: []byte(` foo`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 8, Line: 1, Column: 9}, - End: hcl.Pos{Byte: 12, Line: 1, Column: 13}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 12, Line: 1, Column: 13}, - End: hcl.Pos{Byte: 13, Line: 1, Column: 14}, - }, - }, - { - Type: TokenTemplateSeqEnd, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 13, Line: 1, Column: 14}, - End: hcl.Pos{Byte: 14, Line: 1, Column: 15}, - }, - }, - { - Type: TokenCQuote, - Bytes: []byte(`"`), - Range: hcl.Range{ - Start: hcl.Pos{Byte: 14, Line: 1, Column: 15}, - End: hcl.Pos{Byte: 15, Line: 1, Column: 16}, - }, - }, - { - Type: TokenEOF, - Bytes: []byte{}, - Range: hcl.Range{ - Start: hcl.Pos{Byte: 15, Line: 1, Column: 16}, - End: hcl.Pos{Byte: 15, Line: 1, Column: 16}, - }, - }, - }, - }, - - // Heredoc Templates - { - `< ? } ] ) %{ -* ! <= = . -/ >= => , -% ... -``` - -### Numeric Literals - -A numeric literal is a decimal representation of a -real number. It has an integer part, a fractional part, -and an exponent part. - -```ebnf -NumericLit = decimal+ ("." decimal+)? (expmark decimal+)?; -decimal = '0' .. '9'; -expmark = ('e' | 'E') ("+" | "-")?; -``` - -## Structural Elements - -The structural language consists of syntax representing the following -constructs: - -* _Attributes_, which assign a value to a specified name. -* _Blocks_, which create a child body annotated by a type and optional labels. -* _Body Content_, which consists of a collection of attributes and blocks. - -These constructs correspond to the similarly-named concepts in the -language-agnostic HCL information model. - -```ebnf -ConfigFile = Body; -Body = (Attribute | Block)*; -Attribute = Identifier "=" Expression Newline; -Block = Identifier (StringLit)* "{" Newline Body "}" Newline; -``` - -### Configuration Files - -A _configuration file_ is a sequence of characters whose top-level is -interpreted as a Body. - -### Bodies - -A _body_ is a collection of associated attributes and blocks. The meaning of -this association is defined by the calling application. - -### Attribute Definitions - -An _attribute definition_ assigns a value to a particular attribute name within -a body. Each distinct attribute name may be defined no more than once within a -single body. - -The attribute value is given as an expression, which is retained literally -for later evaluation by the calling application. - -### Blocks - -A _block_ creates a child body that is annotated with a block _type_ and -zero or more optional block _labels_. Blocks create a structural heirachy -which can be interpreted by the calling application. - -## Expressions - -The expression sub-language is used within attribute definitions to specify -values. - -```ebnf -Expression = ( - ExprTerm | - Operation | - Conditional -); -``` - -### Types - -The value types used within the expression language are those defined by the -syntax-agnostic HCL information model. An expression may return any valid -type, but only a subset of the available types have first-class syntax. -A calling application may make other types available via _variables_ and -_functions_. - -### Expression Terms - -Expression _terms_ are the operands for unary and binary expressions, as well -as acting as expressions in their own right. - -```ebnf -ExprTerm = ( - LiteralValue | - CollectionValue | - TemplateExpr | - VariableExpr | - FunctionCall | - ForExpr | - ExprTerm Index | - ExprTerm GetAttr | - ExprTerm Splat | - "(" Expression ")" -); -``` - -The productions for these different term types are given in their corresponding -sections. - -Between the `(` and `)` characters denoting a sub-expression, newline -characters are ignored as whitespace. - -### Literal Values - -A _literal value_ immediately represents a particular value of a primitive -type. - -```ebnf -LiteralValue = ( - NumericLit | - "true" | - "false" | - "null" -); -``` - -* Numeric literals represent values of type _number_. -* The `true` and `false` keywords represent values of type _bool_. -* The `null` keyword represents a null value of the dynamic pseudo-type. - -String literals are not directly available in the expression sub-language, but -are available via the template sub-language, which can in turn be incorporated -via _template expressions_. - -### Collection Values - -A _collection value_ combines zero or more other expressions to produce a -collection value. - -```ebnf -CollectionValue = tuple | object; -tuple = "[" ( - (Expression ("," Expression)* ","?)? -) "]"; -object = "{" ( - (objectelem ("," objectelem)* ","?)? -) "}"; -objectelem = (Identifier | Expression) "=" Expression; -``` - -Only tuple and object values can be directly constructed via native syntax. -Tuple and object values can in turn be converted to list, set and map values -with other operations, which behaves as defined by the syntax-agnostic HCL -information model. - -When specifying an object element, an identifier is interpreted as a literal -attribute name as opposed to a variable reference. To populate an item key -from a variable, use parentheses to disambiguate: - -* `{foo = "baz"}` is interpreted as an attribute literally named `foo`. -* `{(foo) = "baz"}` is interpreted as an attribute whose name is taken - from the variable named `foo`. - -Between the open and closing delimiters of these sequences, newline sequences -are ignored as whitespace. - -There is a syntax ambiguity between _for expressions_ and collection values -whose first element is a reference to a variable named `for`. The -_for expression_ interpretation has priority, so to produce a tuple whose -first element is the value of a variable named `for`, or an object with a -key named `for`, use paretheses to disambiguate: - -* `[for, foo, baz]` is a syntax error. -* `[(for), foo, baz]` is a tuple whose first element is the value of variable - `for`. -* `{for: 1, baz: 2}` is a syntax error. -* `{(for): 1, baz: 2}` is an object with an attribute literally named `for`. -* `{baz: 2, for: 1}` is equivalent to the previous example, and resolves the - ambiguity by reordering. - -### Template Expressions - -A _template expression_ embeds a program written in the template sub-language -as an expression. Template expressions come in two forms: - -* A _quoted_ template expression is delimited by quote characters (`"`) and - defines a template as a single-line expression with escape characters. -* A _heredoc_ template expression is introduced by a `<<` sequence and - defines a template via a multi-line sequence terminated by a user-chosen - delimiter. - -In both cases the template interpolation and directive syntax is available for -use within the delimiters, and any text outside of these special sequences is -interpreted as a literal string. - -In _quoted_ template expressions any literal string sequences within the -template behave in a special way: literal newline sequences are not permitted -and instead _escape sequences_ can be included, starting with the -backslash `\`: - -``` - \n Unicode newline control character - \r Unicode carriage return control character - \t Unicode tab control character - \" Literal quote mark, used to prevent interpretation as end of string - \\ Literal backslash, used to prevent interpretation as escape sequence - \uNNNN Unicode character from Basic Multilingual Plane (NNNN is four hexadecimal digits) - \UNNNNNNNN Unicode character from supplementary planes (NNNNNNNN is eight hexadecimal digits) -``` - -The _heredoc_ template expression type is introduced by either `<<` or `<<-`, -followed by an identifier. The template expression ends when the given -identifier subsequently appears again on a line of its own. - -If a heredoc template is introduced with the `<<-` symbol, any literal string -at the start of each line is analyzed to find the minimum number of leading -spaces, and then that number of prefix spaces is removed from all line-leading -literal strings. The final closing marker may also have an arbitrary number -of spaces preceding it on its line. - -```ebnf -TemplateExpr = quotedTemplate | heredocTemplate; -quotedTemplate = (as defined in prose above); -heredocTemplate = ( - ("<<" | "<<-") Identifier Newline - (content as defined in prose above) - Identifier Newline -); -``` - -A quoted template expression containing only a single literal string serves -as a syntax for defining literal string _expressions_. In certain contexts -the template syntax is restricted in this manner: - -```ebnf -StringLit = '"' (quoted literals as defined in prose above) '"'; -``` - -The `StringLit` production permits the escape sequences discussed for quoted -template expressions as above, but does _not_ permit template interpolation -or directive sequences. - -### Variables and Variable Expressions - -A _variable_ is a value that has been assigned a symbolic name. Variables are -made available for use in expressions by the calling application, by populating -the _global scope_ used for expression evaluation. - -Variables can also be created by expressions themselves, which always creates -a _child scope_ that incorporates the variables from its parent scope but -(re-)defines zero or more names with new values. - -The value of a variable is accessed using a _variable expression_, which is -a standalone `Identifier` whose name corresponds to a defined variable: - -```ebnf -VariableExpr = Identifier; -``` - -Variables in a particular scope are immutable, but child scopes may _hide_ -a variable from an ancestor scope by defining a new variable of the same name. -When looking up variables, the most locally-defined variable of the given name -is used, and ancestor-scoped variables of the same name cannot be accessed. - -No direct syntax is provided for declaring or assigning variables, but other -expression constructs implicitly create child scopes and define variables as -part of their evaluation. - -### Functions and Function Calls - -A _function_ is an operation that has been assigned a symbolic name. Functions -are made available for use in expressions by the calling application, by -populating the _function table_ used for expression evaluation. - -The namespace of functions is distinct from the namespace of variables. A -function and a variable may share the same name with no implication that they -are in any way related. - -A function can be executed via a _function call_ expression: - -```ebnf -FunctionCall = Identifier "(" arguments ")"; -Arguments = ( - () || - (Expression ("," Expression)* ("," | "...")?) -); -``` - -The definition of functions and the semantics of calling them are defined by -the language-agnostic HCL information model. The given arguments are mapped -onto the function's _parameters_ and the result of a function call expression -is the return value of the named function when given those arguments. - -If the final argument expression is followed by the ellipsis symbol (`...`), -the final argument expression must evaluate to either a list or tuple value. -The elements of the value are each mapped to a single parameter of the -named function, beginning at the first parameter remaining after all other -argument expressions have been mapped. - -Within the parentheses that delimit the function arguments, newline sequences -are ignored as whitespace. - -### For Expressions - -A _for expression_ is a construct for constructing a collection by projecting -the items from another collection. - -```ebnf -ForExpr = forTupleExpr | forObjectExpr; -forTupleExpr = "[" forIntro Expression forCond? "]"; -forObjectExpr = "{" forIntro Expression "=>" Expression "..."? forCond? "}"; -forIntro = "for" Identifier ("," Identifier)? "in" Expression ":"; -forCond = "if" Expression; -``` - -The punctuation used to delimit a for expression decide whether it will produce -a tuple value (`[` and `]`) or an object value (`{` and `}`). - -The "introduction" is equivalent in both cases: the keyword `for` followed by -either one or two identifiers separated by a comma which define the temporary -variable names used for iteration, followed by the keyword `in` and then -an expression that must evaluate to a value that can be iterated. The -introduction is then terminated by the colon (`:`) symbol. - -If only one identifier is provided, it is the name of a variable that will -be temporarily assigned the value of each element during iteration. If both -are provided, the first is the key and the second is the value. - -Tuple, object, list, map, and set types are iterable. The type of collection -used defines how the key and value variables are populated: - -* For tuple and list types, the _key_ is the zero-based index into the - sequence for each element, and the _value_ is the element value. The - elements are visited in index order. -* For object and map types, the _key_ is the string attribute name or element - key, and the _value_ is the attribute or element value. The elements are - visited in the order defined by a lexicographic sort of the attribute names - or keys. -* For set types, the _key_ and _value_ are both the element value. The elements - are visited in an undefined but consistent order. - -The expression after the colon and (in the case of object `for`) the expression -after the `=>` are both evaluated once for each element of the source -collection, in a local scope that defines the key and value variable names -specified. - -The results of evaluating these expressions for each input element are used -to populate an element in the new collection. In the case of tuple `for`, the -single expression becomes an element, appending values to the tuple in visit -order. In the case of object `for`, the pair of expressions is used as an -attribute name and value respectively, creating an element in the resulting -object. - -In the case of object `for`, it is an error if two input elements produce -the same result from the attribute name expression, since duplicate -attributes are not possible. If the ellipsis symbol (`...`) appears -immediately after the value experssion, this activates the grouping mode in -which each value in the resulting object is a _tuple_ of all of the values -that were produced against each distinct key. - -* `[for v in ["a", "b"]: v]` returns `["a", "b"]`. -* `[for i, v in ["a", "b"]: i]` returns `[0, 1]`. -* `{for i, v in ["a", "b"]: v => i}` returns `{a = 0, b = 1}`. -* `{for i, v in ["a", "a", "b"]: k => v}` produces an error, because attribute - `a` is defined twice. -* `{for i, v in ["a", "a", "b"]: v => i...}` returns `{a = [0, 1], b = [2]}`. - -If the `if` keyword is used after the element expression(s), it applies an -additional predicate that can be used to conditionally filter elements from -the source collection from consideration. The expression following `if` is -evaluated once for each source element, in the same scope used for the -element expression(s). It must evaluate to a boolean value; if `true`, the -element will be evaluated as normal, while if `false` the element will be -skipped. - -* `[for i, v in ["a", "b", "c"]: v if i < 2]` returns `["a", "b"]`. - -If the collection value, element expression(s) or condition expression return -unknown values that are otherwise type-valid, the result is a value of the -dynamic pseudo-type. - -### Index Operator - -The _index_ operator returns the value of a single element of a collection -value. It is a postfix operator and can be applied to any value that has -a tuple, object, map, or list type. - -```ebnf -Index = "[" Expression "]"; -``` - -The expression delimited by the brackets is the _key_ by which an element -will be looked up. - -If the index operator is applied to a value of tuple or list type, the -key expression must be an non-negative integer number representing the -zero-based element index to access. If applied to a value of object or map -type, the key expression must be a string representing the attribute name -or element key. If the given key value is not of the appropriate type, a -conversion is attempted using the conversion rules from the HCL -syntax-agnostic information model. - -An error is produced if the given key expression does not correspond to -an element in the collection, either because it is of an unconvertable type, -because it is outside the range of elements for a tuple or list, or because -the given attribute or key does not exist. - -If either the collection or the key are an unknown value of an -otherwise-suitable type, the return value is an unknown value whose type -matches what type would be returned given known values, or a value of the -dynamic pseudo-type if type information alone cannot determine a suitable -return type. - -Within the brackets that delimit the index key, newline sequences are ignored -as whitespace. - -### Attribute Access Operator - -The _attribute access_ operator returns the value of a single attribute in -an object value. It is a postfix operator and can be applied to any value -that has an object type. - -```ebnf -GetAttr = "." Identifier; -``` - -The given identifier is interpreted as the name of the attribute to access. -An error is produced if the object to which the operator is applied does not -have an attribute with the given name. - -If the object is an unknown value of a type that has the attribute named, the -result is an unknown value of the attribute's type. - -### Splat Operators - -The _splat operators_ allow convenient access to attributes or elements of -elements in a tuple, list, or set value. - -There are two kinds of "splat" operator: - -* The _attribute-only_ splat operator supports only attribute lookups into - the elements from a list, but supports an arbitrary number of them. - -* The _full_ splat operator additionally supports indexing into the elements - from a list, and allows any combination of attribute access and index - operations. - -```ebnf -Splat = attrSplat | fullSplat; -attrSplat = "." "*" GetAttr*; -fullSplat = "[" "*" "]" (GetAttr | Index)*; -``` - -The splat operators can be thought of as shorthands for common operations that -could otherwise be performed using _for expressions_: - -* `tuple.*.foo.bar[0]` is approximately equivalent to - `[for v in tuple: v.foo.bar][0]`. -* `tuple[*].foo.bar[0]` is approximately equivalent to - `[for v in tuple: v.foo.bar[0]]` - -Note the difference in how the trailing index operator is interpreted in -each case. This different interpretation is the key difference between the -_attribute-only_ and _full_ splat operators. - -Splat operators have one additional behavior compared to the equivalent -_for expressions_ shown above: if a splat operator is applied to a value that -is _not_ of tuple, list, or set type, the value is coerced automatically into -a single-value list of the value type: - -* `any_object.*.id` is equivalent to `[any_object.id]`, assuming that `any_object` - is a single object. -* `any_number.*` is equivalent to `[any_number]`, assuming that `any_number` - is a single number. - -If the left operand of a splat operator is an unknown value of any type, the -result is a value of the dynamic pseudo-type. - -### Operations - -Operations apply a particular operator to either one or two expression terms. - -```ebnf -Operation = unaryOp | binaryOp; -unaryOp = ("-" | "!") ExprTerm; -binaryOp = ExprTerm binaryOperator ExprTerm; -binaryOperator = compareOperator | arithmeticOperator | logicOperator; -compareOperator = "==" | "!=" | "<" | ">" | "<=" | ">="; -arithmeticOperator = "+" | "-" | "*" | "/" | "%"; -logicOperator = "&&" | "||" | "!"; -``` - -The unary operators have the highest precedence. - -The binary operators are grouped into the following precedence levels: - -``` -Level Operators - 6 * / % - 5 + - - 4 > >= < <= - 3 == != - 2 && - 1 || -``` - -Higher values of "level" bind tighter. Operators within the same precedence -level have left-to-right associativity. For example, `x / y * z` is equivalent -to `(x / y) * z`. - -### Comparison Operators - -Comparison operators always produce boolean values, as a result of testing -the relationship between two values. - -The two equality operators apply to values of any type: - -``` -a == b equal -a != b not equal -``` - -Two values are equal if the are of identical types and their values are -equal as defined in the HCL syntax-agnostic information model. The equality -operators are commutative and opposite, such that `(a == b) == !(a != b)` -and `(a == b) == (b == a)` for all values `a` and `b`. - -The four numeric comparison operators apply only to numbers: - -``` -a < b less than -a <= b less than or equal to -a > b greater than -a >= b greater than or equal to -``` - -If either operand of a comparison operator is a correctly-typed unknown value -or a value of the dynamic pseudo-type, the result is an unknown boolean. - -### Arithmetic Operators - -Arithmetic operators apply only to number values and always produce number -values as results. - -``` -a + b sum (addition) -a - b difference (subtraction) -a * b product (multiplication) -a / b quotient (division) -a % b remainder (modulo) --a negation -``` - -Arithmetic operations are considered to be performed in an arbitrary-precision -number space. - -If either operand of an arithmetic operator is an unknown number or a value -of the dynamic pseudo-type, the result is an unknown number. - -### Logic Operators - -Logic operators apply only to boolean values and always produce boolean values -as results. - -``` -a && b logical AND -a || b logical OR -!a logical NOT -``` - -If either operand of a logic operator is an unknown bool value or a value -of the dynamic pseudo-type, the result is an unknown bool value. - -### Conditional Operator - -The conditional operator allows selecting from one of two expressions based on -the outcome of a boolean expression. - -```ebnf -Conditional = Expression "?" Expression ":" Expression; -``` - -The first expression is the _predicate_, which is evaluated and must produce -a boolean result. If the predicate value is `true`, the result of the second -expression is the result of the conditional. If the predicate value is -`false`, the result of the third expression is the result of the conditional. - -The second and third expressions must be of the same type or must be able to -unify into a common type using the type unification rules defined in the -HCL syntax-agnostic information model. This unified type is the result type -of the conditional, with both expressions converted as necessary to the -unified type. - -If the predicate is an unknown boolean value or a value of the dynamic -pseudo-type then the result is an unknown value of the unified type of the -other two expressions. - -If either the second or third expressions produce errors when evaluated, -these errors are passed through only if the erroneous expression is selected. -This allows for expressions such as -`length(some_list) > 0 ? some_list[0] : default` (given some suitable `length` -function) without producing an error when the predicate is `false`. - -## Templates - -The template sub-language is used within template expressions to concisely -combine strings and other values to produce other strings. It can also be -used in isolation as a standalone template language. - -```ebnf -Template = ( - TemplateLiteral | - TemplateInterpolation | - TemplateDirective -)* -TemplateDirective = TemplateIf | TemplateFor; -``` - -A template behaves like an expression that always returns a string value. -The different elements of the template are evaluated and combined into a -single string to return. If any of the elements produce an unknown string -or a value of the dynamic pseudo-type, the result is an unknown string. - -An important use-case for standalone templates is to enable the use of -expressions in alternative HCL syntaxes where a native expression grammar is -not available. For example, the HCL JSON profile treats the values of JSON -strings as standalone templates when attributes are evaluated in expression -mode. - -### Template Literals - -A template literal is a literal sequence of characters to include in the -resulting string. When the template sub-language is used standalone, a -template literal can contain any unicode character, with the exception -of the sequences that introduce interpolations and directives, and for the -sequences that escape those introductions. - -The interpolation and directive introductions are escaped by doubling their -leading characters. The `${` sequence is escaped as `$${` and the `%{` -sequence is escaped as `%%{`. - -When the template sub-language is embedded in the expression language via -_template expressions_, additional constraints and transforms are applied to -template literalsas described in the definition of template expressions. - -The value of a template literal can be modified by _strip markers_ in any -interpolations or directives that are adjacent to it. A strip marker is -a tilde (`~`) placed immediately after the opening `{` or before the closing -`}` of a template sequence: - -* `hello ${~ "world" }` produces `"helloworld"`. -* `%{ if true ~} hello %{~ endif }` produces `"hello"`. - -When a strip marker is present, any spaces adjacent to it in the corresponding -string literal (if any) are removed before producing the final value. Space -characters are interpreted as per Unicode's definition. - -Stripping is done at syntax level rather than value level. Values returned -by interpolations or directives are not subject to stripping: - -* `${"hello" ~}${" world"}` produces `"hello world"`, and not `"helloworld"`, - because the space is not in a template literal directly adjacent to the - strip marker. - -### Template Interpolations - -An _interpolation sequence_ evaluates an expression (written in the -expression sub-language), converts the result to a string value, and -replaces itself with the resulting string. - -```ebnf -TemplateInterpolation = ("${" | "${~") Expression ("}" | "~}"; -``` - -If the expression result cannot be converted to a string, an error is -produced. - -### Template If Directive - -The template `if` directive is the template equivalent of the -_conditional expression_, allowing selection of one of two sub-templates based -on the value of a predicate expression. - -```ebnf -TemplateIf = ( - ("%{" | "%{~") "if" Expression ("}" | "~}") - Template - ( - ("%{" | "%{~") "else" ("}" | "~}") - Template - )? - ("%{" | "%{~") "endif" ("}" | "~}") -); -``` - -The evaluation of the `if` directive is equivalent to the conditional -expression, with the following exceptions: - -* The two sub-templates always produce strings, and thus the result value is - also always a string. -* The `else` clause may be omitted, in which case the conditional's third - expression result is implied to be the empty string. - -### Template For Directive - -The template `for` directive is the template equivalent of the _for expression_, -producing zero or more copies of its sub-template based on the elements of -a collection. - -```ebnf -TemplateFor = ( - ("%{" | "%{~") "for" Identifier ("," Identifier) "in" Expression ("}" | "~}") - Template - ("%{" | "%{~") "endfor" ("}" | "~}") -); -``` - -The evaluation of the `for` directive is equivalent to the _for expression_ -when producing a tuple, with the following exceptions: - -* The sub-template always produces a string. -* There is no equivalent of the "if" clause on the for expression. -* The elements of the resulting tuple are all converted to strings and - concatenated to produce a flat string result. - -### Template Interpolation Unwrapping - -As a special case, a template that consists only of a single interpolation, -with no surrounding literals, directives or other interpolations, is -"unwrapped". In this case, the result of the interpolation expression is -returned verbatim, without conversion to string. - -This special case exists primarily to enable the native template language -to be used inside strings in alternative HCL syntaxes that lack a first-class -template or expression syntax. Unwrapping allows arbitrary expressions to be -used to populate attributes when strings in such languages are interpreted -as templates. - -* `${true}` produces the boolean value `true` -* `${"${true}"}` produces the boolean value `true`, because both the inner - and outer interpolations are subject to unwrapping. -* `hello ${true}` produces the string `"hello true"` -* `${""}${true}` produces the string `"true"` because there are two - interpolation sequences, even though one produces an empty result. -* `%{ for v in [true] }${v}%{ endif }` produces the string `true` because - the presence of the `for` directive circumvents the unwrapping even though - the final result is a single value. - -In some contexts this unwrapping behavior may be circumvented by the calling -application, by converting the final template result to string. This is -necessary, for example, if a standalone template is being used to produce -the direct contents of a file, since the result in that case must always be a -string. diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure.go deleted file mode 100644 index eb686d5..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure.go +++ /dev/null @@ -1,379 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "strings" - - "github.com/hashicorp/hcl2/hcl" -) - -// AsHCLBlock returns the block data expressed as a *hcl.Block. -func (b *Block) AsHCLBlock() *hcl.Block { - lastHeaderRange := b.TypeRange - if len(b.LabelRanges) > 0 { - lastHeaderRange = b.LabelRanges[len(b.LabelRanges)-1] - } - - return &hcl.Block{ - Type: b.Type, - Labels: b.Labels, - Body: b.Body, - - DefRange: hcl.RangeBetween(b.TypeRange, lastHeaderRange), - TypeRange: b.TypeRange, - LabelRanges: b.LabelRanges, - } -} - -// Body is the implementation of hcl.Body for the zcl native syntax. -type Body struct { - Attributes Attributes - Blocks Blocks - - // These are used with PartialContent to produce a "remaining items" - // body to return. They are nil on all bodies fresh out of the parser. - hiddenAttrs map[string]struct{} - hiddenBlocks map[string]struct{} - - SrcRange hcl.Range - EndRange hcl.Range // Final token of the body, for reporting missing items -} - -// Assert that *Body implements hcl.Body -var assertBodyImplBody hcl.Body = &Body{} - -func (b *Body) walkChildNodes(w internalWalkFunc) { - b.Attributes = w(b.Attributes).(Attributes) - b.Blocks = w(b.Blocks).(Blocks) -} - -func (b *Body) Range() hcl.Range { - return b.SrcRange -} - -func (b *Body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics) { - content, remainHCL, diags := b.PartialContent(schema) - - // No we'll see if anything actually remains, to produce errors about - // extraneous items. - remain := remainHCL.(*Body) - - for name, attr := range b.Attributes { - if _, hidden := remain.hiddenAttrs[name]; !hidden { - var suggestions []string - for _, attrS := range schema.Attributes { - if _, defined := content.Attributes[attrS.Name]; defined { - continue - } - suggestions = append(suggestions, attrS.Name) - } - suggestion := nameSuggestion(name, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } else { - // Is there a block of the same name? - for _, blockS := range schema.Blocks { - if blockS.Type == name { - suggestion = fmt.Sprintf(" Did you mean to define a block of type %q?", name) - break - } - } - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported attribute", - Detail: fmt.Sprintf("An attribute named %q is not expected here.%s", name, suggestion), - Subject: &attr.NameRange, - }) - } - } - - for _, block := range b.Blocks { - blockTy := block.Type - if _, hidden := remain.hiddenBlocks[blockTy]; !hidden { - var suggestions []string - for _, blockS := range schema.Blocks { - suggestions = append(suggestions, blockS.Type) - } - suggestion := nameSuggestion(blockTy, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } else { - // Is there an attribute of the same name? - for _, attrS := range schema.Attributes { - if attrS.Name == blockTy { - suggestion = fmt.Sprintf(" Did you mean to define attribute %q?", blockTy) - break - } - } - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported block type", - Detail: fmt.Sprintf("Blocks of type %q are not expected here.%s", blockTy, suggestion), - Subject: &block.TypeRange, - }) - } - } - - return content, diags -} - -func (b *Body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics) { - attrs := make(hcl.Attributes) - var blocks hcl.Blocks - var diags hcl.Diagnostics - hiddenAttrs := make(map[string]struct{}) - hiddenBlocks := make(map[string]struct{}) - - if b.hiddenAttrs != nil { - for k, v := range b.hiddenAttrs { - hiddenAttrs[k] = v - } - } - if b.hiddenBlocks != nil { - for k, v := range b.hiddenBlocks { - hiddenBlocks[k] = v - } - } - - for _, attrS := range schema.Attributes { - name := attrS.Name - attr, exists := b.Attributes[name] - _, hidden := hiddenAttrs[name] - if hidden || !exists { - if attrS.Required { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing required attribute", - Detail: fmt.Sprintf("The attribute %q is required, but no definition was found.", attrS.Name), - Subject: b.MissingItemRange().Ptr(), - }) - } - continue - } - - hiddenAttrs[name] = struct{}{} - attrs[name] = attr.AsHCLAttribute() - } - - blocksWanted := make(map[string]hcl.BlockHeaderSchema) - for _, blockS := range schema.Blocks { - blocksWanted[blockS.Type] = blockS - } - - for _, block := range b.Blocks { - if _, hidden := hiddenBlocks[block.Type]; hidden { - continue - } - blockS, wanted := blocksWanted[block.Type] - if !wanted { - continue - } - - if len(block.Labels) > len(blockS.LabelNames) { - name := block.Type - if len(blockS.LabelNames) == 0 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extraneous label for %s", name), - Detail: fmt.Sprintf( - "No labels are expected for %s blocks.", name, - ), - Subject: block.LabelRanges[0].Ptr(), - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - } else { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Extraneous label for %s", name), - Detail: fmt.Sprintf( - "Only %d labels (%s) are expected for %s blocks.", - len(blockS.LabelNames), strings.Join(blockS.LabelNames, ", "), name, - ), - Subject: block.LabelRanges[len(blockS.LabelNames)].Ptr(), - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - } - continue - } - - if len(block.Labels) < len(blockS.LabelNames) { - name := block.Type - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Missing %s for %s", blockS.LabelNames[len(block.Labels)], name), - Detail: fmt.Sprintf( - "All %s blocks must have %d labels (%s).", - name, len(blockS.LabelNames), strings.Join(blockS.LabelNames, ", "), - ), - Subject: &block.OpenBraceRange, - Context: hcl.RangeBetween(block.TypeRange, block.OpenBraceRange).Ptr(), - }) - continue - } - - blocks = append(blocks, block.AsHCLBlock()) - } - - // We hide blocks only after we've processed all of them, since otherwise - // we can't process more than one of the same type. - for _, blockS := range schema.Blocks { - hiddenBlocks[blockS.Type] = struct{}{} - } - - remain := &Body{ - Attributes: b.Attributes, - Blocks: b.Blocks, - - hiddenAttrs: hiddenAttrs, - hiddenBlocks: hiddenBlocks, - - SrcRange: b.SrcRange, - EndRange: b.EndRange, - } - - return &hcl.BodyContent{ - Attributes: attrs, - Blocks: blocks, - - MissingItemRange: b.MissingItemRange(), - }, remain, diags -} - -func (b *Body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) { - attrs := make(hcl.Attributes) - var diags hcl.Diagnostics - - if len(b.Blocks) > 0 { - example := b.Blocks[0] - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Unexpected %s block", example.Type), - Detail: "Blocks are not allowed here.", - Context: &example.TypeRange, - }) - // we will continue processing anyway, and return the attributes - // we are able to find so that certain analyses can still be done - // in the face of errors. - } - - if b.Attributes == nil { - return attrs, diags - } - - for name, attr := range b.Attributes { - if _, hidden := b.hiddenAttrs[name]; hidden { - continue - } - attrs[name] = attr.AsHCLAttribute() - } - - return attrs, diags -} - -func (b *Body) MissingItemRange() hcl.Range { - return b.EndRange -} - -// Attributes is the collection of attribute definitions within a body. -type Attributes map[string]*Attribute - -func (a Attributes) walkChildNodes(w internalWalkFunc) { - for k, attr := range a { - a[k] = w(attr).(*Attribute) - } -} - -// Range returns the range of some arbitrary point within the set of -// attributes, or an invalid range if there are no attributes. -// -// This is provided only to complete the Node interface, but has no practical -// use. -func (a Attributes) Range() hcl.Range { - // An attributes doesn't really have a useful range to report, since - // it's just a grouping construct. So we'll arbitrarily take the - // range of one of the attributes, or produce an invalid range if we have - // none. In practice, there's little reason to ask for the range of - // an Attributes. - for _, attr := range a { - return attr.Range() - } - return hcl.Range{ - Filename: "", - } -} - -// Attribute represents a single attribute definition within a body. -type Attribute struct { - Name string - Expr Expression - - SrcRange hcl.Range - NameRange hcl.Range - EqualsRange hcl.Range -} - -func (a *Attribute) walkChildNodes(w internalWalkFunc) { - a.Expr = w(a.Expr).(Expression) -} - -func (a *Attribute) Range() hcl.Range { - return a.SrcRange -} - -// AsHCLAttribute returns the block data expressed as a *hcl.Attribute. -func (a *Attribute) AsHCLAttribute() *hcl.Attribute { - return &hcl.Attribute{ - Name: a.Name, - Expr: a.Expr, - - Range: a.SrcRange, - NameRange: a.NameRange, - } -} - -// Blocks is the list of nested blocks within a body. -type Blocks []*Block - -func (bs Blocks) walkChildNodes(w internalWalkFunc) { - for i, block := range bs { - bs[i] = w(block).(*Block) - } -} - -// Range returns the range of some arbitrary point within the list of -// blocks, or an invalid range if there are no blocks. -// -// This is provided only to complete the Node interface, but has no practical -// use. -func (bs Blocks) Range() hcl.Range { - if len(bs) > 0 { - return bs[0].Range() - } - return hcl.Range{ - Filename: "", - } -} - -// Block represents a nested block structure -type Block struct { - Type string - Labels []string - Body *Body - - TypeRange hcl.Range - LabelRanges []hcl.Range - OpenBraceRange hcl.Range - CloseBraceRange hcl.Range -} - -func (b *Block) walkChildNodes(w internalWalkFunc) { - b.Body = w(b.Body).(*Body) -} - -func (b *Block) Range() hcl.Range { - return hcl.RangeBetween(b.TypeRange, b.CloseBraceRange) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure_test.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure_test.go deleted file mode 100644 index 551f0f1..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/structure_test.go +++ /dev/null @@ -1,533 +0,0 @@ -package hclsyntax - -import ( - "fmt" - "reflect" - "testing" - - "github.com/hashicorp/hcl2/hcl" - "github.com/kylelemons/godebug/pretty" - "github.com/zclconf/go-cty/cty" -) - -func TestBodyContent(t *testing.T) { - tests := []struct { - body *Body - schema *hcl.BodySchema - partial bool - want *hcl.BodyContent - diagCount int - }{ - { - &Body{}, - &hcl.BodySchema{}, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 0, - }, - - // Attributes - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - }, - }, - }, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{ - "foo": &hcl.Attribute{ - Name: "foo", - }, - }, - }, - 0, - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - }, - }, - }, - &hcl.BodySchema{}, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // attribute "foo" is not expected - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - }, - }, - }, - &hcl.BodySchema{}, - true, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 0, // in partial mode, so extra "foo" is acceptable - }, - { - &Body{ - Attributes: Attributes{}, - }, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 0, // "foo" not required, so no error - }, - { - &Body{ - Attributes: Attributes{}, - }, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "foo", - Required: true, - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // "foo" is required - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // attribute "foo" not expected (it's defined as a block) - }, - - // Blocks - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - Blocks: hcl.Blocks{ - { - Type: "foo", - Body: (*Body)(nil), - }, - }, - }, - 0, - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - }, - &Block{ - Type: "foo", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - Blocks: hcl.Blocks{ - { - Type: "foo", - Body: (*Body)(nil), - }, - { - Type: "foo", - Body: (*Body)(nil), - }, - }, - }, - 0, - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - }, - &Block{ - Type: "bar", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - Blocks: hcl.Blocks{ - { - Type: "foo", - Body: (*Body)(nil), - }, - }, - }, - 1, // blocks of type "bar" not expected - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - }, - &Block{ - Type: "bar", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - true, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - Blocks: hcl.Blocks{ - { - Type: "foo", - Body: (*Body)(nil), - }, - }, - }, - 0, // extra "bar" allowed because we're in partial mode - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - Labels: []string{"bar"}, - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - LabelNames: []string{"name"}, - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - Blocks: hcl.Blocks{ - { - Type: "foo", - Labels: []string{"bar"}, - Body: (*Body)(nil), - }, - }, - }, - 0, - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - LabelNames: []string{"name"}, - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // missing label "name" - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - Labels: []string{"bar"}, - - LabelRanges: []hcl.Range{{}}, - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // no labels expected - }, - { - &Body{ - Blocks: Blocks{ - &Block{ - Type: "foo", - Labels: []string{"bar", "baz"}, - - LabelRanges: []hcl.Range{{}, {}}, - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - LabelNames: []string{"name"}, - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // too many labels - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - }, - }, - }, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "foo", - }, - }, - }, - false, - &hcl.BodyContent{ - Attributes: hcl.Attributes{}, - }, - 1, // should've been a block, not an attribute - }, - } - - prettyConfig := &pretty.Config{ - Diffable: true, - IncludeUnexported: true, - PrintStringers: true, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { - var got *hcl.BodyContent - var diags hcl.Diagnostics - if test.partial { - got, _, diags = test.body.PartialContent(test.schema) - } else { - got, diags = test.body.Content(test.schema) - } - - if len(diags) != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - - if !reflect.DeepEqual(got, test.want) { - t.Errorf( - "wrong result\ndiff: %s", - prettyConfig.Compare(test.want, got), - ) - } - }) - } -} - -func TestBodyJustAttributes(t *testing.T) { - tests := []struct { - body *Body - want hcl.Attributes - diagCount int - }{ - { - &Body{}, - hcl.Attributes{}, - 0, - }, - { - &Body{ - Attributes: Attributes{}, - }, - hcl.Attributes{}, - 0, - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - Expr: &LiteralValueExpr{ - Val: cty.StringVal("bar"), - }, - }, - }, - }, - hcl.Attributes{ - "foo": &hcl.Attribute{ - Name: "foo", - Expr: &LiteralValueExpr{ - Val: cty.StringVal("bar"), - }, - }, - }, - 0, - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - Expr: &LiteralValueExpr{ - Val: cty.StringVal("bar"), - }, - }, - }, - Blocks: Blocks{ - { - Type: "foo", - }, - }, - }, - hcl.Attributes{ - "foo": &hcl.Attribute{ - Name: "foo", - Expr: &LiteralValueExpr{ - Val: cty.StringVal("bar"), - }, - }, - }, - 1, // blocks are not allowed here - }, - { - &Body{ - Attributes: Attributes{ - "foo": &Attribute{ - Name: "foo", - Expr: &LiteralValueExpr{ - Val: cty.StringVal("bar"), - }, - }, - }, - hiddenAttrs: map[string]struct{}{ - "foo": struct{}{}, - }, - }, - hcl.Attributes{}, - 0, - }, - } - - prettyConfig := &pretty.Config{ - Diffable: true, - IncludeUnexported: true, - PrintStringers: true, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { - got, diags := test.body.JustAttributes() - - if len(diags) != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - - if !reflect.DeepEqual(got, test.want) { - t.Errorf( - "wrong result\nbody: %s\ndiff: %s", - prettyConfig.Sprint(test.body), - prettyConfig.Compare(test.want, got), - ) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/token.go b/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/token.go deleted file mode 100644 index 00d6d72..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/hclsyntax/token.go +++ /dev/null @@ -1,271 +0,0 @@ -package hclsyntax - -import ( - "fmt" - - "github.com/apparentlymart/go-textseg/textseg" - "github.com/hashicorp/hcl2/hcl" -) - -// Token represents a sequence of bytes from some HCL code that has been -// tagged with a type and its range within the source file. -type Token struct { - Type TokenType - Bytes []byte - Range hcl.Range -} - -// Tokens is a slice of Token. -type Tokens []Token - -// TokenType is an enumeration used for the Type field on Token. -type TokenType rune - -const ( - // Single-character tokens are represented by their own character, for - // convenience in producing these within the scanner. However, the values - // are otherwise arbitrary and just intended to be mnemonic for humans - // who might see them in debug output. - - TokenOBrace TokenType = '{' - TokenCBrace TokenType = '}' - TokenOBrack TokenType = '[' - TokenCBrack TokenType = ']' - TokenOParen TokenType = '(' - TokenCParen TokenType = ')' - TokenOQuote TokenType = '«' - TokenCQuote TokenType = '»' - TokenOHeredoc TokenType = 'H' - TokenCHeredoc TokenType = 'h' - - TokenStar TokenType = '*' - TokenSlash TokenType = '/' - TokenPlus TokenType = '+' - TokenMinus TokenType = '-' - TokenPercent TokenType = '%' - - TokenEqual TokenType = '=' - TokenEqualOp TokenType = '≔' - TokenNotEqual TokenType = '≠' - TokenLessThan TokenType = '<' - TokenLessThanEq TokenType = '≤' - TokenGreaterThan TokenType = '>' - TokenGreaterThanEq TokenType = '≥' - - TokenAnd TokenType = '∧' - TokenOr TokenType = '∨' - TokenBang TokenType = '!' - - TokenDot TokenType = '.' - TokenComma TokenType = ',' - - TokenEllipsis TokenType = '…' - TokenFatArrow TokenType = '⇒' - - TokenQuestion TokenType = '?' - TokenColon TokenType = ':' - - TokenTemplateInterp TokenType = '∫' - TokenTemplateControl TokenType = 'λ' - TokenTemplateSeqEnd TokenType = '∎' - - TokenQuotedLit TokenType = 'Q' // might contain backslash escapes - TokenStringLit TokenType = 'S' // cannot contain backslash escapes - TokenNumberLit TokenType = 'N' - TokenIdent TokenType = 'I' - - TokenComment TokenType = 'C' - - TokenNewline TokenType = '\n' - TokenEOF TokenType = '␄' - - // The rest are not used in the language but recognized by the scanner so - // we can generate good diagnostics in the parser when users try to write - // things that might work in other languages they are familiar with, or - // simply make incorrect assumptions about the HCL language. - - TokenBitwiseAnd TokenType = '&' - TokenBitwiseOr TokenType = '|' - TokenBitwiseNot TokenType = '~' - TokenBitwiseXor TokenType = '^' - TokenStarStar TokenType = '➚' - TokenBacktick TokenType = '`' - TokenSemicolon TokenType = ';' - TokenTabs TokenType = '␉' - TokenInvalid TokenType = '�' - TokenBadUTF8 TokenType = '💩' - - // TokenNil is a placeholder for when a token is required but none is - // available, e.g. when reporting errors. The scanner will never produce - // this as part of a token stream. - TokenNil TokenType = '\x00' -) - -func (t TokenType) GoString() string { - return fmt.Sprintf("hclsyntax.%s", t.String()) -} - -type scanMode int - -const ( - scanNormal scanMode = iota - scanTemplate -) - -type tokenAccum struct { - Filename string - Bytes []byte - Pos hcl.Pos - Tokens []Token -} - -func (f *tokenAccum) emitToken(ty TokenType, startOfs, endOfs int) { - // Walk through our buffer to figure out how much we need to adjust - // the start pos to get our end pos. - - start := f.Pos - start.Column += startOfs - f.Pos.Byte // Safe because only ASCII spaces can be in the offset - start.Byte = startOfs - - end := start - end.Byte = endOfs - b := f.Bytes[startOfs:endOfs] - for len(b) > 0 { - advance, seq, _ := textseg.ScanGraphemeClusters(b, true) - if len(seq) == 1 && seq[0] == '\n' { - end.Line++ - end.Column = 1 - } else { - end.Column++ - } - b = b[advance:] - } - - f.Pos = end - - f.Tokens = append(f.Tokens, Token{ - Type: ty, - Bytes: f.Bytes[startOfs:endOfs], - Range: hcl.Range{ - Filename: f.Filename, - Start: start, - End: end, - }, - }) -} - -type heredocInProgress struct { - Marker []byte - StartOfLine bool -} - -// checkInvalidTokens does a simple pass across the given tokens and generates -// diagnostics for tokens that should _never_ appear in HCL source. This -// is intended to avoid the need for the parser to have special support -// for them all over. -// -// Returns a diagnostics with no errors if everything seems acceptable. -// Otherwise, returns zero or more error diagnostics, though tries to limit -// repetition of the same information. -func checkInvalidTokens(tokens Tokens) hcl.Diagnostics { - var diags hcl.Diagnostics - - toldBitwise := 0 - toldExponent := 0 - toldBacktick := 0 - toldSemicolon := 0 - toldTabs := 0 - toldBadUTF8 := 0 - - for _, tok := range tokens { - switch tok.Type { - case TokenBitwiseAnd, TokenBitwiseOr, TokenBitwiseXor, TokenBitwiseNot: - if toldBitwise < 4 { - var suggestion string - switch tok.Type { - case TokenBitwiseAnd: - suggestion = " Did you mean boolean AND (\"&&\")?" - case TokenBitwiseOr: - suggestion = " Did you mean boolean OR (\"&&\")?" - case TokenBitwiseNot: - suggestion = " Did you mean boolean NOT (\"!\")?" - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported operator", - Detail: fmt.Sprintf("Bitwise operators are not supported.%s", suggestion), - Subject: &tok.Range, - }) - toldBitwise++ - } - case TokenStarStar: - if toldExponent < 1 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Unsupported operator", - Detail: "\"**\" is not a supported operator. Exponentiation is not supported as an operator.", - Subject: &tok.Range, - }) - - toldExponent++ - } - case TokenBacktick: - // Only report for alternating (even) backticks, so we won't report both start and ends of the same - // backtick-quoted string. - if toldExponent < 4 && (toldExponent%2) == 0 { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Invalid character", - Detail: "The \"`\" character is not valid. To create a multi-line string, use the \"heredoc\" syntax, like \"< -# -# This script uses the unicode spec to generate a Ragel state machine -# that recognizes unicode alphanumeric characters. It generates 5 -# character classes: uupper, ulower, ualpha, udigit, and ualnum. -# Currently supported encodings are UTF-8 [default] and UCS-4. -# -# Usage: unicode2ragel.rb [options] -# -e, --encoding [ucs4 | utf8] Data encoding -# -h, --help Show this message -# -# This script was originally written as part of the Ferret search -# engine library. -# -# Author: Rakan El-Khalil - -require 'optparse' -require 'open-uri' - -ENCODINGS = [ :utf8, :ucs4 ] -ALPHTYPES = { :utf8 => "byte", :ucs4 => "rune" } -DEFAULT_CHART_URL = "http://www.unicode.org/Public/5.1.0/ucd/DerivedCoreProperties.txt" -DEFAULT_MACHINE_NAME= "WChar" - -### -# Display vars & default option - -TOTAL_WIDTH = 80 -RANGE_WIDTH = 23 -@encoding = :utf8 -@chart_url = DEFAULT_CHART_URL -machine_name = DEFAULT_MACHINE_NAME -properties = [] -@output = $stdout - -### -# Option parsing - -cli_opts = OptionParser.new do |opts| - opts.on("-e", "--encoding [ucs4 | utf8]", "Data encoding") do |o| - @encoding = o.downcase.to_sym - end - opts.on("-h", "--help", "Show this message") do - puts opts - exit - end - opts.on("-u", "--url URL", "URL to process") do |o| - @chart_url = o - end - opts.on("-m", "--machine MACHINE_NAME", "Machine name") do |o| - machine_name = o - end - opts.on("-p", "--properties x,y,z", Array, "Properties to add to machine") do |o| - properties = o - end - opts.on("-o", "--output FILE", "output file") do |o| - @output = File.new(o, "w+") - end -end - -cli_opts.parse(ARGV) -unless ENCODINGS.member? @encoding - puts "Invalid encoding: #{@encoding}" - puts cli_opts - exit -end - -## -# Downloads the document at url and yields every alpha line's hex -# range and description. - -def each_alpha( url, property ) - open( url ) do |file| - file.each_line do |line| - next if line =~ /^#/; - next if line !~ /; #{property} #/; - - range, description = line.split(/;/) - range.strip! - description.gsub!(/.*#/, '').strip! - - if range =~ /\.\./ - start, stop = range.split '..' - else start = stop = range - end - - yield start.hex .. stop.hex, description - end - end -end - -### -# Formats to hex at minimum width - -def to_hex( n ) - r = "%0X" % n - r = "0#{r}" unless (r.length % 2).zero? - r -end - -### -# UCS4 is just a straight hex conversion of the unicode codepoint. - -def to_ucs4( range ) - rangestr = "0x" + to_hex(range.begin) - rangestr << "..0x" + to_hex(range.end) if range.begin != range.end - [ rangestr ] -end - -## -# 0x00 - 0x7f -> 0zzzzzzz[7] -# 0x80 - 0x7ff -> 110yyyyy[5] 10zzzzzz[6] -# 0x800 - 0xffff -> 1110xxxx[4] 10yyyyyy[6] 10zzzzzz[6] -# 0x010000 - 0x10ffff -> 11110www[3] 10xxxxxx[6] 10yyyyyy[6] 10zzzzzz[6] - -UTF8_BOUNDARIES = [0x7f, 0x7ff, 0xffff, 0x10ffff] - -def to_utf8_enc( n ) - r = 0 - if n <= 0x7f - r = n - elsif n <= 0x7ff - y = 0xc0 | (n >> 6) - z = 0x80 | (n & 0x3f) - r = y << 8 | z - elsif n <= 0xffff - x = 0xe0 | (n >> 12) - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = x << 16 | y << 8 | z - elsif n <= 0x10ffff - w = 0xf0 | (n >> 18) - x = 0x80 | (n >> 12) & 0x3f - y = 0x80 | (n >> 6) & 0x3f - z = 0x80 | n & 0x3f - r = w << 24 | x << 16 | y << 8 | z - end - - to_hex(r) -end - -def from_utf8_enc( n ) - n = n.hex - r = 0 - if n <= 0x7f - r = n - elsif n <= 0xdfff - y = (n >> 8) & 0x1f - z = n & 0x3f - r = y << 6 | z - elsif n <= 0xefffff - x = (n >> 16) & 0x0f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = x << 10 | y << 6 | z - elsif n <= 0xf7ffffff - w = (n >> 24) & 0x07 - x = (n >> 16) & 0x3f - y = (n >> 8) & 0x3f - z = n & 0x3f - r = w << 18 | x << 12 | y << 6 | z - end - r -end - -### -# Given a range, splits it up into ranges that can be continuously -# encoded into utf8. Eg: 0x00 .. 0xff => [0x00..0x7f, 0x80..0xff] -# This is not strictly needed since the current [5.1] unicode standard -# doesn't have ranges that straddle utf8 boundaries. This is included -# for completeness as there is no telling if that will ever change. - -def utf8_ranges( range ) - ranges = [] - UTF8_BOUNDARIES.each do |max| - if range.begin <= max - if range.end <= max - ranges << range - return ranges - end - - ranges << (range.begin .. max) - range = (max + 1) .. range.end - end - end - ranges -end - -def build_range( start, stop ) - size = start.size/2 - left = size - 1 - return [""] if size < 1 - - a = start[0..1] - b = stop[0..1] - - ### - # Shared prefix - - if a == b - return build_range(start[2..-1], stop[2..-1]).map do |elt| - "0x#{a} " + elt - end - end - - ### - # Unshared prefix, end of run - - return ["0x#{a}..0x#{b} "] if left.zero? - - ### - # Unshared prefix, not end of run - # Range can be 0x123456..0x56789A - # Which is equivalent to: - # 0x123456 .. 0x12FFFF - # 0x130000 .. 0x55FFFF - # 0x560000 .. 0x56789A - - ret = [] - ret << build_range(start, a + "FF" * left) - - ### - # Only generate middle range if need be. - - if a.hex+1 != b.hex - max = to_hex(b.hex - 1) - max = "FF" if b == "FF" - ret << "0x#{to_hex(a.hex+1)}..0x#{max} " + "0x00..0xFF " * left - end - - ### - # Don't generate last range if it is covered by first range - - ret << build_range(b + "00" * left, stop) unless b == "FF" - ret.flatten! -end - -def to_utf8( range ) - utf8_ranges( range ).map do |r| - begin_enc = to_utf8_enc(r.begin) - end_enc = to_utf8_enc(r.end) - build_range begin_enc, end_enc - end.flatten! -end - -## -# Perform a 3-way comparison of the number of codepoints advertised by -# the unicode spec for the given range, the originally parsed range, -# and the resulting utf8 encoded range. - -def count_codepoints( code ) - code.split(' ').inject(1) do |acc, elt| - if elt =~ /0x(.+)\.\.0x(.+)/ - if @encoding == :utf8 - acc * (from_utf8_enc($2) - from_utf8_enc($1) + 1) - else - acc * ($2.hex - $1.hex + 1) - end - else - acc - end - end -end - -def is_valid?( range, desc, codes ) - spec_count = 1 - spec_count = $1.to_i if desc =~ /\[(\d+)\]/ - range_count = range.end - range.begin + 1 - - sum = codes.inject(0) { |acc, elt| acc + count_codepoints(elt) } - sum == spec_count and sum == range_count -end - -## -# Generate the state maching to stdout - -def generate_machine( name, property ) - pipe = " " - @output.puts " #{name} = " - each_alpha( @chart_url, property ) do |range, desc| - - codes = (@encoding == :ucs4) ? to_ucs4(range) : to_utf8(range) - - #raise "Invalid encoding of range #{range}: #{codes.inspect}" unless - # is_valid? range, desc, codes - - range_width = codes.map { |a| a.size }.max - range_width = RANGE_WIDTH if range_width < RANGE_WIDTH - - desc_width = TOTAL_WIDTH - RANGE_WIDTH - 11 - desc_width -= (range_width - RANGE_WIDTH) if range_width > RANGE_WIDTH - - if desc.size > desc_width - desc = desc[0..desc_width - 4] + "..." - end - - codes.each_with_index do |r, idx| - desc = "" unless idx.zero? - code = "%-#{range_width}s" % r - @output.puts " #{pipe} #{code} ##{desc}" - pipe = "|" - end - end - @output.puts " ;" - @output.puts "" -end - -@output.puts <= 'a' || b <= 'z' || b >= 'A' || b <= 'Z': - return true - default: - return false - } -} - -func scanKeyword(buf []byte, start pos) ([]byte, []byte, pos) { - var i int - p := start -Byte: - for i = 0; i < len(buf); i++ { - b := buf[i] - switch { - case (b >= 'a' && b <= 'z') || (b >= 'A' && b <= 'Z') || b == '_': - p.Pos.Byte++ - p.Pos.Column++ - default: - break Byte - } - } - return buf[:i], buf[i:], p -} - -func scanString(buf []byte, start pos) ([]byte, []byte, pos) { - // The scanner doesn't validate correct use of escapes, etc. It pays - // attention to escapes only for the purpose of identifying the closing - // quote character. It's the parser's responsibility to do proper - // validation. - // - // The scanner also doesn't specifically detect unterminated string - // literals, though they can be identified in the parser by checking if - // the final byte in a string token is the double-quote character. - - // Skip the opening quote symbol - i := 1 - p := start - p.Pos.Byte++ - p.Pos.Column++ - escaping := false -Byte: - for i < len(buf) { - b := buf[i] - - switch { - case b == '\\': - escaping = !escaping - p.Pos.Byte++ - p.Pos.Column++ - i++ - case b == '"': - p.Pos.Byte++ - p.Pos.Column++ - i++ - if !escaping { - break Byte - } - escaping = false - case b < 32: - break Byte - default: - // Advance by one grapheme cluster, so that we consider each - // grapheme to be a "column". - // Ignoring error because this scanner cannot produce errors. - advance, _, _ := textseg.ScanGraphemeClusters(buf[i:], true) - - p.Pos.Byte += advance - p.Pos.Column++ - i += advance - - escaping = false - } - } - return buf[:i], buf[i:], p -} - -func skipWhitespace(buf []byte, start pos) ([]byte, pos) { - var i int - p := start -Byte: - for i = 0; i < len(buf); i++ { - switch buf[i] { - case ' ': - p.Pos.Byte++ - p.Pos.Column++ - case '\n': - p.Pos.Byte++ - p.Pos.Column = 1 - p.Pos.Line++ - case '\r': - // For the purpose of line/column counting we consider a - // carriage return to take up no space, assuming that it will - // be paired up with a newline (on Windows, for example) that - // will account for both of them. - p.Pos.Byte++ - case '\t': - // We arbitrarily count a tab as if it were two spaces, because - // we need to choose _some_ number here. This means any system - // that renders code on-screen with markers must itself treat - // tabs as a pair of spaces for rendering purposes, or instead - // use the byte offset and back into its own column position. - p.Pos.Byte++ - p.Pos.Column += 2 - default: - break Byte - } - } - return buf[i:], p -} - -type pos struct { - Filename string - Pos hcl.Pos -} - -func (p *pos) Range(byteLen, charLen int) hcl.Range { - start := p.Pos - end := p.Pos - end.Byte += byteLen - end.Column += charLen - return hcl.Range{ - Filename: p.Filename, - Start: start, - End: end, - } -} - -func posRange(start, end pos) hcl.Range { - return hcl.Range{ - Filename: start.Filename, - Start: start.Pos, - End: end.Pos, - } -} - -func (t token) GoString() string { - return fmt.Sprintf("json.token{json.%s, []byte(%q), %#v}", t.Type, t.Bytes, t.Range) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/scanner_test.go b/vendor/github.com/hashicorp/hcl2/hcl/json/scanner_test.go deleted file mode 100644 index 8526847..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/scanner_test.go +++ /dev/null @@ -1,848 +0,0 @@ -package json - -import ( - "bytes" - "fmt" - "reflect" - "testing" - - "github.com/hashicorp/hcl2/hcl" -) - -func TestScan(t *testing.T) { - tests := []struct { - Input string - Want []token - }{ - { - ``, - []token{ - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - }, - }, - }, - }, - { - ` `, - []token{ - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - }, - }, - }, - }, - { - `{}`, - []token{ - { - Type: tokenBraceO, - Bytes: []byte(`{`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenBraceC, - Bytes: []byte(`}`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - }, - }, - { - `][`, - []token{ - { - Type: tokenBrackC, - Bytes: []byte(`]`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenBrackO, - Bytes: []byte(`[`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - }, - }, - { - `:,`, - []token{ - { - Type: tokenColon, - Bytes: []byte(`:`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenComma, - Bytes: []byte(`,`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - }, - }, - { - `1`, - []token{ - { - Type: tokenNumber, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - }, - }, - { - ` 1`, - []token{ - { - Type: tokenNumber, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - }, - }, - }, - }, - { - ` 12`, - []token{ - { - Type: tokenNumber, - Bytes: []byte(`12`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - End: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - }, - }, - }, - }, - { - `1 2`, - []token{ - { - Type: tokenNumber, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenNumber, - Bytes: []byte(`2`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - }, - }, - }, - }, - { - "\n1\n 2", - []token{ - { - Type: tokenNumber, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 2, - Column: 1, - }, - End: hcl.Pos{ - Byte: 2, - Line: 2, - Column: 2, - }, - }, - }, - { - Type: tokenNumber, - Bytes: []byte(`2`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 4, - Line: 3, - Column: 2, - }, - End: hcl.Pos{ - Byte: 5, - Line: 3, - Column: 3, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 5, - Line: 3, - Column: 3, - }, - End: hcl.Pos{ - Byte: 5, - Line: 3, - Column: 3, - }, - }, - }, - }, - }, - { - `-1 2.5`, - []token{ - { - Type: tokenNumber, - Bytes: []byte(`-1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - { - Type: tokenNumber, - Bytes: []byte(`2.5`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 3, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - End: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - }, - }, - }, - }, - { - `true`, - []token{ - { - Type: tokenKeyword, - Bytes: []byte(`true`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - End: hcl.Pos{ - Byte: 4, - Line: 1, - Column: 5, - }, - }, - }, - }, - }, - { - `[true]`, - []token{ - { - Type: tokenBrackO, - Bytes: []byte(`[`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - }, - }, - { - Type: tokenKeyword, - Bytes: []byte(`true`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 5, - Line: 1, - Column: 6, - }, - }, - }, - { - Type: tokenBrackC, - Bytes: []byte(`]`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 5, - Line: 1, - Column: 6, - }, - End: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - End: hcl.Pos{ - Byte: 6, - Line: 1, - Column: 7, - }, - }, - }, - }, - }, - { - `""`, - []token{ - { - Type: tokenString, - Bytes: []byte(`""`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - End: hcl.Pos{ - Byte: 2, - Line: 1, - Column: 3, - }, - }, - }, - }, - }, - { - `"hello"`, - []token{ - { - Type: tokenString, - Bytes: []byte(`"hello"`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 7, - Line: 1, - Column: 8, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 7, - Line: 1, - Column: 8, - }, - End: hcl.Pos{ - Byte: 7, - Line: 1, - Column: 8, - }, - }, - }, - }, - }, - { - `"he\"llo"`, - []token{ - { - Type: tokenString, - Bytes: []byte(`"he\"llo"`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 9, - Line: 1, - Column: 10, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 9, - Line: 1, - Column: 10, - }, - End: hcl.Pos{ - Byte: 9, - Line: 1, - Column: 10, - }, - }, - }, - }, - }, - { - `"hello\\" 1`, - []token{ - { - Type: tokenString, - Bytes: []byte(`"hello\\"`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 9, - Line: 1, - Column: 10, - }, - }, - }, - { - Type: tokenNumber, - Bytes: []byte(`1`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 10, - Line: 1, - Column: 11, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - }, - }, - }, - { - `"🇬🇧"`, - []token{ - { - Type: tokenString, - Bytes: []byte(`"🇬🇧"`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 10, - Line: 1, - Column: 4, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 10, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 10, - Line: 1, - Column: 4, - }, - }, - }, - }, - }, - { - `"á́́́́́́́"`, - []token{ - { - Type: tokenString, - Bytes: []byte(`"á́́́́́́́"`), - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - End: hcl.Pos{ - Byte: 19, - Line: 1, - Column: 4, - }, - }, - }, - { - Type: tokenEOF, - Range: hcl.Range{ - Start: hcl.Pos{ - Byte: 19, - Line: 1, - Column: 4, - }, - End: hcl.Pos{ - Byte: 19, - Line: 1, - Column: 4, - }, - }, - }, - }, - }, - } - - for _, test := range tests { - t.Run(test.Input, func(t *testing.T) { - buf := []byte(test.Input) - start := pos{ - Filename: "", - Pos: hcl.Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - } - got := scan(buf, start) - - if !reflect.DeepEqual(got, test.Want) { - errMsg := &bytes.Buffer{} - errMsg.WriteString("wrong result\ngot:\n") - if len(got) == 0 { - errMsg.WriteString(" (empty slice)\n") - } - for _, tok := range got { - fmt.Fprintf(errMsg, " - %#v\n", tok) - } - errMsg.WriteString("want:\n") - if len(test.Want) == 0 { - errMsg.WriteString(" (empty slice)\n") - } - for _, tok := range test.Want { - fmt.Fprintf(errMsg, " - %#v\n", tok) - } - t.Error(errMsg.String()) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/spec.md b/vendor/github.com/hashicorp/hcl2/hcl/json/spec.md deleted file mode 100644 index d6e8bf6..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/spec.md +++ /dev/null @@ -1,265 +0,0 @@ -# HCL JSON Syntax Specification - -This is the specification for the JSON serialization for hcl. HCL is a system -for defining configuration languages for applications. The HCL information -model is designed to support multiple concrete syntaxes for configuration, -and this JSON-based format complements [the native syntax](../zclsyntax/spec.md) -by being easy to machine-generate, whereas the native syntax is oriented -towards human authoring and maintenence. - -This syntax is defined in terms of JSON as defined in -[RFC7159](https://tools.ietf.org/html/rfc7159). As such it inherits the JSON -grammar as-is, and merely defines a specific methodology for interpreting -JSON constructs into HCL structural elements and expressions. - -This mapping is defined such that valid JSON-serialized HCL input can be -produced using standard JSON implementations in various programming languages. -_Parsing_ such JSON has some additional constraints not beyond what is normally -supported by JSON parsers, though adaptations are defined to allow processing -with an off-the-shelf JSON parser with certain caveats, described in later -sections. - -## Structural Elements - -The HCL language-agnostic information model defines a _body_ as an abstract -container for attribute definitions and child blocks. A body is represented -in JSON as a JSON _object_. - -As defined in the language-agnostic model, body processing is done in terms -of a schema which provides context for interpreting the body's content. For -JSON bodies, the schema is crucial to allow differentiation of attribute -definitions and block definitions, both of which are represented via object -properties. - -The special property name `"//"`, when used in an object representing a HCL -body, is parsed and ignored. A property with this name can be used to -include human-readable comments. (This special property name is _not_ -processed in this way for any _other_ HCL constructs that are represented as -JSON objects.) - -### Attributes - -Where the given schema describes an attribute with a given name, the object -property with the matching name — if present — serves as the attribute's -definition. - -When a body is being processed in the _dynamic attributes_ mode, each object -property serves as an attribute definition for the attribute whose name -matches the property name. - -The value of an attribute definition property is interpreted as an _expression_, -as described in a later section. - -Given a schema that calls for an attribute named "foo", a JSON object like -the following provides a definition for that attribute: - -```json -{ - "foo": "bar baz" -} -``` - -### Blocks - -Where the given schema describes a block with a given type name, the object -property with the matching name — if present — serves as a definition of -zero or more blocks of that type. - -Processing of child blocks is in terms of nested JSON objects and arrays. -If the schema defines one or more _labels_ for the block type, a nested -object is required for each labelling level, with the object keys serving as -the label values at that level. - -After any labelling levels, the next nested value is either a JSON object -representing a single block body, or a JSON array of JSON objects that each -represent a single block body. Use of an array accommodates the definition -of multiple blocks that have identical type and labels. - -Given a schema that calls for a block type named "foo" with no labels, the -following JSON objects are all valid definitions of zero or more blocks of this -type: - -```json -{ - "foo": { - "child_attr": "baz" - } -} -``` - -```json -{ - "foo": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] -} -``` -```json -{ - "foo": [] -} -``` - -The first of these defines a single child block of type "foo". The second -defines _two_ such blocks. The final example shows a degenerate definition -of zero blocks, though generators should prefer to omit the property entirely -in this scenario. - -Given a schema that calls for a block type named "foo" with _two_ labels, the -extra label levels must be represented as objects as in the following examples: - -```json -{ - "foo": { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - }, - "boz": { - "baz": { - "child_attr": "baz" - }, - } - } -} -``` -```json -{ - "foo": { - "bar": { - "baz": { - "child_attr": "baz" - }, - "boz": { - "child_attr": "baz" - } - }, - "boz": { - "baz": [ - { - "child_attr": "baz" - }, - { - "child_attr": "boz" - } - ] - } - } -} -``` - -Where multiple definitions are included for the same type and labels, the -JSON array is always the value of the property representing the final label, -and contains objects representing block bodies. It is not valid to use an array -at any other point in the block definition structure. - -## Expressions - -JSON lacks a native expression syntax, so the HCL JSON syntax instead defines -a mapping for each of the JSON value types, including a special mapping for -strings that allows optional use of arbitrary expressions. - -### Objects - -When interpreted as an expression, a JSON object represents a value of a HCL -object type. - -Each property of the JSON object represents an attribute of the HCL object type. -The object type is constructed by enumerating the JSON object properties, -creating for each an attribute whose name exactly matches the property name, -and whose type is the result of recursively applying the expression mapping -rules. - -An instance of the constructed object type is then created, whose values -are interpreted by again recursively applying the mapping rules defined in -this section. - -It is an error to define the same property name multiple times within a single -JSON object interpreted as an expression. - -### Arrays - -When interpreted as an expression, a JSON array represents a value of a HCL -tuple type. - -Each element of the JSON array represents an element of the HCL tuple type. -The tuple type is constructed by enumerationg the JSON array elements, creating -for each an element whose type is the result of recursively applying the -expression mapping rules. Correspondance is preserved between the array element -indices and the tuple element indices. - -An instance of the constructed tuple type is then created, whose values are -interpreted by again recursively applying the mapping rules defined in this -section. - -### Numbers - -When interpreted as an expression, a JSON number represents a HCL number value. - -HCL numbers are arbitrary-precision decimal values, so an ideal implementation -of this specification will translate exactly the value given to a number of -corresponding precision. - -In practice, off-the-shelf JSON parsers often do not support customizing the -processing of numbers, and instead force processing as 32-bit or 64-bit -floating point values with a potential loss of precision. It is permissable -for a HCL JSON parser to pass on such limitations _if and only if_ the -available precision and other constraints are defined in its documentation. -Calling applications each have differing precision requirements, so calling -applications are free to select an implementation with more limited precision -capabilities should high precision not be required for that application. - -### Boolean Values - -The JSON boolean values `true` and `false`, when interpreted as expressions, -represent the corresponding HCL boolean values. - -### The Null Value - -The JSON value `null`, when interpreted as an expression, represents a -HCL null value of the dynamic pseudo-type. - -### Strings - -When intepreted as an expression, a JSON string may be interpreted in one of -two ways depending on the evaluation mode. - -If evaluating in literal-only mode (as defined by the syntax-agnostic -information model) the literal string is intepreted directly as a HCL string -value, by directly using the exact sequence of unicode characters represented. -Template interpolations and directives MUST NOT be processed in this mode, -allowing any characters that appear as introduction sequences to pass through -literally: - -```json -"Hello world! Template sequences like ${ are not intepreted here." -``` - -When evaluating in full expression mode (again, as defined by the syntax- -agnostic information model) the literal string is instead interpreted as a -_standalone template_ in the HCL Native Syntax. The expression evaluation -result is then the direct result of evaluating that template with the current -variable scope and function table. - -```json -"Hello, ${name}! Template sequences are interpreted in full expression mode." -``` - -In particular the _Template Interpolation Unwrapping_ requirement from the -HCL native syntax specification must be implemented, allowing the use of -single-interpolation templates to represent expressions that would not -otherwise be representable in JSON, such as the following example where -the result must be a number, rather than a string representation of a number: - -```json -"${ a + b }" -``` diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go b/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go deleted file mode 100644 index 86716e7..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/structure.go +++ /dev/null @@ -1,404 +0,0 @@ -package json - -import ( - "fmt" - - "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/zclconf/go-cty/cty" -) - -// body is the implementation of "Body" used for files processed with the JSON -// parser. -type body struct { - obj *objectVal - - // If non-nil, the keys of this map cause the corresponding attributes to - // be treated as non-existing. This is used when Body.PartialContent is - // called, to produce the "remaining content" Body. - hiddenAttrs map[string]struct{} - - // If set, string values are turned into expressions using HIL's template - // language, rather than the native zcl language. This is intended to - // allow applications moving from HCL to zcl to continue to parse the - // JSON variant of their config that HCL handled previously. - useHIL bool -} - -// expression is the implementation of "Expression" used for files processed -// with the JSON parser. -type expression struct { - src node -} - -func (b *body) Content(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Diagnostics) { - content, newBody, diags := b.PartialContent(schema) - - hiddenAttrs := newBody.(*body).hiddenAttrs - - var nameSuggestions []string - for _, attrS := range schema.Attributes { - if _, ok := hiddenAttrs[attrS.Name]; !ok { - // Only suggest an attribute name if we didn't use it already. - nameSuggestions = append(nameSuggestions, attrS.Name) - } - } - for _, blockS := range schema.Blocks { - // Blocks can appear multiple times, so we'll suggest their type - // names regardless of whether they've already been used. - nameSuggestions = append(nameSuggestions, blockS.Type) - } - - for k, attr := range b.obj.Attrs { - if k == "//" { - // Ignore "//" keys in objects representing bodies, to allow - // their use as comments. - continue - } - - if _, ok := hiddenAttrs[k]; !ok { - var fixItHint string - suggestion := nameSuggestion(k, nameSuggestions) - if suggestion != "" { - fixItHint = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Extraneous JSON object property", - Detail: fmt.Sprintf("No attribute or block type is named %q.%s", k, fixItHint), - Subject: &attr.NameRange, - Context: attr.Range().Ptr(), - }) - } - } - - return content, diags -} - -func (b *body) PartialContent(schema *hcl.BodySchema) (*hcl.BodyContent, hcl.Body, hcl.Diagnostics) { - - obj := b.obj - jsonAttrs := obj.Attrs - usedNames := map[string]struct{}{} - if b.hiddenAttrs != nil { - for k := range b.hiddenAttrs { - usedNames[k] = struct{}{} - } - } - var diags hcl.Diagnostics - - content := &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - Blocks: nil, - - MissingItemRange: b.MissingItemRange(), - } - - for _, attrS := range schema.Attributes { - jsonAttr, exists := jsonAttrs[attrS.Name] - _, used := usedNames[attrS.Name] - if used || !exists { - if attrS.Required { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing required attribute", - Detail: fmt.Sprintf("The attribute %q is required, so a JSON object property must be present with this name.", attrS.Name), - Subject: &obj.OpenRange, - }) - } - continue - } - content.Attributes[attrS.Name] = &hcl.Attribute{ - Name: attrS.Name, - Expr: &expression{src: jsonAttr.Value}, - Range: hcl.RangeBetween(jsonAttr.NameRange, jsonAttr.Value.Range()), - NameRange: jsonAttr.NameRange, - } - usedNames[attrS.Name] = struct{}{} - } - - for _, blockS := range schema.Blocks { - jsonAttr, exists := jsonAttrs[blockS.Type] - _, used := usedNames[blockS.Type] - if used || !exists { - usedNames[blockS.Type] = struct{}{} - continue - } - v := jsonAttr.Value - diags = append(diags, b.unpackBlock(v, blockS.Type, &jsonAttr.NameRange, blockS.LabelNames, nil, nil, &content.Blocks)...) - usedNames[blockS.Type] = struct{}{} - } - - unusedBody := &body{ - obj: b.obj, - hiddenAttrs: usedNames, - useHIL: b.useHIL, - } - - return content, unusedBody, diags -} - -// JustAttributes for JSON bodies interprets all properties of the wrapped -// JSON object as attributes and returns them. -func (b *body) JustAttributes() (hcl.Attributes, hcl.Diagnostics) { - attrs := make(map[string]*hcl.Attribute) - for name, jsonAttr := range b.obj.Attrs { - if name == "//" { - // Ignore "//" keys in objects representing bodies, to allow - // their use as comments. - continue - } - - if _, hidden := b.hiddenAttrs[name]; hidden { - continue - } - attrs[name] = &hcl.Attribute{ - Name: name, - Expr: &expression{src: jsonAttr.Value}, - Range: hcl.RangeBetween(jsonAttr.NameRange, jsonAttr.Value.Range()), - NameRange: jsonAttr.NameRange, - } - } - - // No diagnostics possible here, since the parser already took care of - // finding duplicates and every JSON value can be a valid attribute value. - return attrs, nil -} - -func (b *body) MissingItemRange() hcl.Range { - return b.obj.CloseRange -} - -func (b *body) unpackBlock(v node, typeName string, typeRange *hcl.Range, labelsLeft []string, labelsUsed []string, labelRanges []hcl.Range, blocks *hcl.Blocks) (diags hcl.Diagnostics) { - if len(labelsLeft) > 0 { - labelName := labelsLeft[0] - ov, ok := v.(*objectVal) - if !ok { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("A JSON object is required, whose keys represent the %s block's %s.", typeName, labelName), - Subject: v.StartRange().Ptr(), - }) - return - } - if len(ov.Attrs) == 0 { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Missing block label", - Detail: fmt.Sprintf("At least one object property is required, whose name represents the %s block's %s.", typeName, labelName), - Subject: v.StartRange().Ptr(), - }) - return - } - labelsUsed := append(labelsUsed, "") - labelRanges := append(labelRanges, hcl.Range{}) - for pk, p := range ov.Attrs { - labelsUsed[len(labelsUsed)-1] = pk - labelRanges[len(labelRanges)-1] = p.NameRange - diags = append(diags, b.unpackBlock(p.Value, typeName, typeRange, labelsLeft[1:], labelsUsed, labelRanges, blocks)...) - } - return - } - - // By the time we get here, we've peeled off all the labels and we're ready - // to deal with the block's actual content. - - // need to copy the label slices because their underlying arrays will - // continue to be mutated after we return. - labels := make([]string, len(labelsUsed)) - copy(labels, labelsUsed) - labelR := make([]hcl.Range, len(labelRanges)) - copy(labelR, labelRanges) - - switch tv := v.(type) { - case *objectVal: - // Single instance of the block - *blocks = append(*blocks, &hcl.Block{ - Type: typeName, - Labels: labels, - Body: &body{ - obj: tv, - useHIL: b.useHIL, - }, - - DefRange: tv.OpenRange, - TypeRange: *typeRange, - LabelRanges: labelR, - }) - case *arrayVal: - // Multiple instances of the block - for _, av := range tv.Values { - ov, ok := av.(*objectVal) - if !ok { - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("A JSON object is required, representing the contents of a %q block.", typeName), - Subject: v.StartRange().Ptr(), - }) - continue - } - - *blocks = append(*blocks, &hcl.Block{ - Type: typeName, - Labels: labels, - Body: &body{ - obj: ov, - useHIL: b.useHIL, - }, - - DefRange: tv.OpenRange, - TypeRange: *typeRange, - LabelRanges: labelR, - }) - } - default: - diags = diags.Append(&hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect JSON value type", - Detail: fmt.Sprintf("Either a JSON object or a JSON array is required, representing the contents of one or more %q blocks.", typeName), - Subject: v.StartRange().Ptr(), - }) - } - return -} - -func (e *expression) Value(ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - switch v := e.src.(type) { - case *stringVal: - if ctx != nil { - // Parse string contents as a zcl native language expression. - // We only do this if we have a context, so passing a nil context - // is how the caller specifies that interpolations are not allowed - // and that the string should just be returned verbatim. - templateSrc := v.Value - expr, diags := hclsyntax.ParseTemplate( - []byte(templateSrc), - v.SrcRange.Filename, - - // This won't produce _exactly_ the right result, since - // the zclsyntax parser can't "see" any escapes we removed - // while parsing JSON, but it's better than nothing. - hcl.Pos{ - Line: v.SrcRange.Start.Line, - - // skip over the opening quote mark - Byte: v.SrcRange.Start.Byte + 1, - Column: v.SrcRange.Start.Column + 1, - }, - ) - if diags.HasErrors() { - return cty.DynamicVal, diags - } - val, evalDiags := expr.Value(ctx) - diags = append(diags, evalDiags...) - return val, diags - } - - // FIXME: Once the native zcl template language parser is implemented, - // parse string values as templates and evaluate them. - return cty.StringVal(v.Value), nil - case *numberVal: - return cty.NumberVal(v.Value), nil - case *booleanVal: - return cty.BoolVal(v.Value), nil - case *arrayVal: - vals := []cty.Value{} - for _, jsonVal := range v.Values { - val, _ := (&expression{src: jsonVal}).Value(ctx) - vals = append(vals, val) - } - return cty.TupleVal(vals), nil - case *objectVal: - attrs := map[string]cty.Value{} - for name, jsonAttr := range v.Attrs { - val, _ := (&expression{src: jsonAttr.Value}).Value(ctx) - attrs[name] = val - } - return cty.ObjectVal(attrs), nil - default: - // Default to DynamicVal so that ASTs containing invalid nodes can - // still be partially-evaluated. - return cty.DynamicVal, nil - } -} - -func (e *expression) Variables() []hcl.Traversal { - var vars []hcl.Traversal - - switch v := e.src.(type) { - case *stringVal: - templateSrc := v.Value - expr, diags := hclsyntax.ParseTemplate( - []byte(templateSrc), - v.SrcRange.Filename, - - // This won't produce _exactly_ the right result, since - // the zclsyntax parser can't "see" any escapes we removed - // while parsing JSON, but it's better than nothing. - hcl.Pos{ - Line: v.SrcRange.Start.Line, - - // skip over the opening quote mark - Byte: v.SrcRange.Start.Byte + 1, - Column: v.SrcRange.Start.Column + 1, - }, - ) - if diags.HasErrors() { - return vars - } - return expr.Variables() - - case *arrayVal: - for _, jsonVal := range v.Values { - vars = append(vars, (&expression{src: jsonVal}).Variables()...) - } - case *objectVal: - for _, jsonAttr := range v.Attrs { - vars = append(vars, (&expression{src: jsonAttr.Value}).Variables()...) - } - } - - return vars -} - -func (e *expression) Range() hcl.Range { - return e.src.Range() -} - -func (e *expression) StartRange() hcl.Range { - return e.src.StartRange() -} - -// Implementation for hcl.AbsTraversalForExpr. -func (e *expression) AsTraversal() hcl.Traversal { - // In JSON-based syntax a traversal is given as a string containing - // traversal syntax as defined by hclsyntax.ParseTraversalAbs. - - switch v := e.src.(type) { - case *stringVal: - traversal, diags := hclsyntax.ParseTraversalAbs([]byte(v.Value), v.SrcRange.Filename, v.SrcRange.Start) - if diags.HasErrors() { - return nil - } - return traversal - default: - return nil - } -} - -// Implementation for hcl.ExprList. -func (e *expression) ExprList() []hcl.Expression { - switch v := e.src.(type) { - case *arrayVal: - ret := make([]hcl.Expression, len(v.Values)) - for i, node := range v.Values { - ret[i] = &expression{src: node} - } - return ret - default: - return nil - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/structure_test.go b/vendor/github.com/hashicorp/hcl2/hcl/json/structure_test.go deleted file mode 100644 index 7600e20..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/structure_test.go +++ /dev/null @@ -1,774 +0,0 @@ -package json - -import ( - "fmt" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" - "github.com/hashicorp/hcl2/hcl" -) - -func TestBodyPartialContent(t *testing.T) { - tests := []struct { - src string - schema *hcl.BodySchema - want *hcl.BodyContent - diagCount int - }{ - { - `{}`, - &hcl.BodySchema{}, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 2, Byte: 1}, - End: hcl.Pos{Line: 1, Column: 3, Byte: 2}, - }, - }, - 0, - }, - { - `{"//": "comment that should be ignored"}`, - &hcl.BodySchema{}, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 40, Byte: 39}, - End: hcl.Pos{Line: 1, Column: 41, Byte: 40}, - }, - }, - 0, - }, - { - `{"name":"Ermintrude"}`, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "name", - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{ - "name": &hcl.Attribute{ - Name: "name", - Expr: &expression{ - src: &stringVal{ - Value: "Ermintrude", - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 8, - Line: 1, - Column: 9, - }, - End: hcl.Pos{ - Byte: 20, - Line: 1, - Column: 21, - }, - }, - }, - }, - Range: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 20, - Line: 1, - Column: 21, - }, - }, - NameRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 7, - Line: 1, - Column: 8, - }, - }, - }, - }, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - End: hcl.Pos{Line: 1, Column: 22, Byte: 21}, - }, - }, - 0, - }, - { - `{"name":"Ermintrude"}`, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "name", - Required: true, - }, - { - Name: "age", - Required: true, - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{ - "name": &hcl.Attribute{ - Name: "name", - Expr: &expression{ - src: &stringVal{ - Value: "Ermintrude", - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 8, - Line: 1, - Column: 9, - }, - End: hcl.Pos{ - Byte: 20, - Line: 1, - Column: 21, - }, - }, - }, - }, - Range: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 20, - Line: 1, - Column: 21, - }, - }, - NameRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 7, - Line: 1, - Column: 8, - }, - }, - }, - }, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - End: hcl.Pos{Line: 1, Column: 22, Byte: 21}, - }, - }, - 1, - }, - { - `{"resource":{}}`, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "resource", - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - Blocks: hcl.Blocks{ - { - Type: "resource", - Labels: []string{}, - Body: &body{ - obj: &objectVal{ - Attrs: map[string]*objectAttr{}, - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 12, - Line: 1, - Column: 13, - }, - End: hcl.Pos{ - Byte: 14, - Line: 1, - Column: 15, - }, - }, - OpenRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 12, - Line: 1, - Column: 13, - }, - End: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - }, - CloseRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - End: hcl.Pos{ - Byte: 14, - Line: 1, - Column: 15, - }, - }, - }, - }, - - DefRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 12, - Line: 1, - Column: 13, - }, - End: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - }, - TypeRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - LabelRanges: []hcl.Range{}, - }, - }, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 15, Byte: 14}, - End: hcl.Pos{Line: 1, Column: 16, Byte: 15}, - }, - }, - 0, - }, - { - `{"resource":[{},{}]}`, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "resource", - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - Blocks: hcl.Blocks{ - { - Type: "resource", - Labels: []string{}, - Body: &body{ - obj: &objectVal{ - Attrs: map[string]*objectAttr{}, - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - End: hcl.Pos{ - Byte: 15, - Line: 1, - Column: 16, - }, - }, - OpenRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - End: hcl.Pos{ - Byte: 14, - Line: 1, - Column: 15, - }, - }, - CloseRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 14, - Line: 1, - Column: 15, - }, - End: hcl.Pos{ - Byte: 15, - Line: 1, - Column: 16, - }, - }, - }, - }, - - DefRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 12, - Line: 1, - Column: 13, - }, - End: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - }, - TypeRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - LabelRanges: []hcl.Range{}, - }, - { - Type: "resource", - Labels: []string{}, - Body: &body{ - obj: &objectVal{ - Attrs: map[string]*objectAttr{}, - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 16, - Line: 1, - Column: 17, - }, - End: hcl.Pos{ - Byte: 18, - Line: 1, - Column: 19, - }, - }, - OpenRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 16, - Line: 1, - Column: 17, - }, - End: hcl.Pos{ - Byte: 17, - Line: 1, - Column: 18, - }, - }, - CloseRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 17, - Line: 1, - Column: 18, - }, - End: hcl.Pos{ - Byte: 18, - Line: 1, - Column: 19, - }, - }, - }, - }, - - DefRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 12, - Line: 1, - Column: 13, - }, - End: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - }, - TypeRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - LabelRanges: []hcl.Range{}, - }, - }, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 20, Byte: 19}, - End: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - }, - }, - 0, - }, - { - `{"resource":{"foo_instance":{"bar":{}}}}`, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "resource", - LabelNames: []string{"type", "name"}, - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - Blocks: hcl.Blocks{ - { - Type: "resource", - Labels: []string{"foo_instance", "bar"}, - Body: &body{ - obj: &objectVal{ - Attrs: map[string]*objectAttr{}, - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 35, - Line: 1, - Column: 36, - }, - End: hcl.Pos{ - Byte: 37, - Line: 1, - Column: 38, - }, - }, - OpenRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 35, - Line: 1, - Column: 36, - }, - End: hcl.Pos{ - Byte: 36, - Line: 1, - Column: 37, - }, - }, - CloseRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 36, - Line: 1, - Column: 37, - }, - End: hcl.Pos{ - Byte: 37, - Line: 1, - Column: 38, - }, - }, - }, - }, - - DefRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 35, - Line: 1, - Column: 36, - }, - End: hcl.Pos{ - Byte: 36, - Line: 1, - Column: 37, - }, - }, - TypeRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{ - Byte: 1, - Line: 1, - Column: 2, - }, - End: hcl.Pos{ - Byte: 11, - Line: 1, - Column: 12, - }, - }, - LabelRanges: []hcl.Range{ - { - Filename: "test.json", - Start: hcl.Pos{ - Byte: 13, - Line: 1, - Column: 14, - }, - End: hcl.Pos{ - Byte: 27, - Line: 1, - Column: 28, - }, - }, - { - Filename: "test.json", - Start: hcl.Pos{ - Byte: 29, - Line: 1, - Column: 30, - }, - End: hcl.Pos{ - Byte: 34, - Line: 1, - Column: 35, - }, - }, - }, - }, - }, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 40, Byte: 39}, - End: hcl.Pos{Line: 1, Column: 41, Byte: 40}, - }, - }, - 0, - }, - { - `{"name":"Ermintrude"}`, - &hcl.BodySchema{ - Blocks: []hcl.BlockHeaderSchema{ - { - Type: "name", - }, - }, - }, - &hcl.BodyContent{ - Attributes: map[string]*hcl.Attribute{}, - MissingItemRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Line: 1, Column: 21, Byte: 20}, - End: hcl.Pos{Line: 1, Column: 22, Byte: 21}, - }, - }, - 1, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.src), func(t *testing.T) { - file, diags := Parse([]byte(test.src), "test.json") - if len(diags) != 0 { - t.Fatalf("Parse produced diagnostics: %s", diags) - } - got, _, diags := file.Body.PartialContent(test.schema) - if len(diags) != test.diagCount { - t.Errorf("Wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag) - } - } - - if !reflect.DeepEqual(got, test.want) { - t.Errorf("wrong result\ngot: %s\nwant: %s", spew.Sdump(got), spew.Sdump(test.want)) - } - }) - } -} - -func TestBodyContent(t *testing.T) { - // We test most of the functionality already in TestBodyPartialContent, so - // this test focuses on the handling of extraneous attributes. - tests := []struct { - src string - schema *hcl.BodySchema - diagCount int - }{ - { - `{"unknown": true}`, - &hcl.BodySchema{}, - 1, - }, - { - `{"//": "comment that should be ignored"}`, - &hcl.BodySchema{}, - 0, - }, - { - `{"unknow": true}`, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "unknown", - }, - }, - }, - 1, - }, - { - `{"unknow": true, "unnown": true}`, - &hcl.BodySchema{ - Attributes: []hcl.AttributeSchema{ - { - Name: "unknown", - }, - }, - }, - 2, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.src), func(t *testing.T) { - file, diags := Parse([]byte(test.src), "test.json") - if len(diags) != 0 { - t.Fatalf("Parse produced diagnostics: %s", diags) - } - _, diags = file.Body.Content(test.schema) - if len(diags) != test.diagCount { - t.Errorf("Wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag) - } - } - }) - } -} - -func TestJustAttributes(t *testing.T) { - // We test most of the functionality already in TestBodyPartialContent, so - // this test focuses on the handling of extraneous attributes. - tests := []struct { - src string - want hcl.Attributes - }{ - { - `{}`, - map[string]*hcl.Attribute{}, - }, - { - `{"foo": true}`, - map[string]*hcl.Attribute{ - "foo": { - Name: "foo", - Expr: &expression{ - src: &booleanVal{ - Value: true, - SrcRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Byte: 8, Line: 1, Column: 9}, - End: hcl.Pos{Byte: 12, Line: 1, Column: 13}, - }, - }, - }, - Range: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 12, Line: 1, Column: 13}, - }, - NameRange: hcl.Range{ - Filename: "test.json", - Start: hcl.Pos{Byte: 1, Line: 1, Column: 2}, - End: hcl.Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - }, - }, - { - `{"//": "comment that should be ignored"}`, - map[string]*hcl.Attribute{}, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.src), func(t *testing.T) { - file, diags := Parse([]byte(test.src), "test.json") - if len(diags) != 0 { - t.Fatalf("Parse produced diagnostics: %s", diags) - } - got, diags := file.Body.JustAttributes() - if len(diags) != 0 { - t.Errorf("Wrong number of diagnostics %d; want %d", len(diags), 0) - for _, diag := range diags { - t.Logf(" - %s", diag) - } - } - if !reflect.DeepEqual(got, test.want) { - t.Errorf("wrong result\ngot: %s\nwant: %s", spew.Sdump(got), spew.Sdump(test.want)) - } - }) - } -} - -func TestExpressionAsTraversal(t *testing.T) { - e := &expression{ - src: &stringVal{ - Value: "foo.bar[0]", - }, - } - traversal := e.AsTraversal() - if len(traversal) != 3 { - t.Fatalf("incorrect traversal %#v; want length 3", traversal) - } -} - -func TestStaticExpressionList(t *testing.T) { - e := &expression{ - src: &arrayVal{ - Values: []node{ - &stringVal{ - Value: "hello", - }, - }, - }, - } - exprs := e.ExprList() - if len(exprs) != 1 { - t.Fatalf("incorrect exprs %#v; want length 1", exprs) - } - if exprs[0].(*expression).src != e.src.(*arrayVal).Values[0] { - t.Fatalf("wrong first expression node") - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/json/tokentype_string.go b/vendor/github.com/hashicorp/hcl2/hcl/json/tokentype_string.go deleted file mode 100644 index 8773235..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/json/tokentype_string.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by "stringer -type tokenType scanner.go"; DO NOT EDIT. - -package json - -import "fmt" - -const _tokenType_name = "tokenInvalidtokenCommatokenColontokenEqualstokenKeywordtokenNumbertokenStringtokenBrackOtokenBrackCtokenBraceOtokenBraceCtokenEOF" - -var _tokenType_map = map[tokenType]string{ - 0: _tokenType_name[0:12], - 44: _tokenType_name[12:22], - 58: _tokenType_name[22:32], - 61: _tokenType_name[32:43], - 75: _tokenType_name[43:55], - 78: _tokenType_name[55:66], - 83: _tokenType_name[66:77], - 91: _tokenType_name[77:88], - 93: _tokenType_name[88:99], - 123: _tokenType_name[99:110], - 125: _tokenType_name[110:121], - 9220: _tokenType_name[121:129], -} - -func (i tokenType) String() string { - if str, ok := _tokenType_map[i]; ok { - return str - } - return fmt.Sprintf("tokenType(%d)", i) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/merged.go b/vendor/github.com/hashicorp/hcl2/hcl/merged.go deleted file mode 100644 index ca2b728..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/merged.go +++ /dev/null @@ -1,226 +0,0 @@ -package hcl - -import ( - "fmt" -) - -// MergeFiles combines the given files to produce a single body that contains -// configuration from all of the given files. -// -// The ordering of the given files decides the order in which contained -// elements will be returned. If any top-level attributes are defined with -// the same name across multiple files, a diagnostic will be produced from -// the Content and PartialContent methods describing this error in a -// user-friendly way. -func MergeFiles(files []*File) Body { - var bodies []Body - for _, file := range files { - bodies = append(bodies, file.Body) - } - return MergeBodies(bodies) -} - -// MergeBodies is like MergeFiles except it deals directly with bodies, rather -// than with entire files. -func MergeBodies(bodies []Body) Body { - if len(bodies) == 0 { - // Swap out for our singleton empty body, to reduce the number of - // empty slices we have hanging around. - return emptyBody - } - - // If any of the given bodies are already merged bodies, we'll unpack - // to flatten to a single mergedBodies, since that's conceptually simpler. - // This also, as a side-effect, eliminates any empty bodies, since - // empties are merged bodies with no inner bodies. - var newLen int - var flatten bool - for _, body := range bodies { - if children, merged := body.(mergedBodies); merged { - newLen += len(children) - flatten = true - } else { - newLen++ - } - } - - if !flatten { // not just newLen == len, because we might have mergedBodies with single bodies inside - return mergedBodies(bodies) - } - - if newLen == 0 { - // Don't allocate a new empty when we already have one - return emptyBody - } - - new := make([]Body, 0, newLen) - for _, body := range bodies { - if children, merged := body.(mergedBodies); merged { - new = append(new, children...) - } else { - new = append(new, body) - } - } - return mergedBodies(new) -} - -var emptyBody = mergedBodies([]Body{}) - -// EmptyBody returns a body with no content. This body can be used as a -// placeholder when a body is required but no body content is available. -func EmptyBody() Body { - return emptyBody -} - -type mergedBodies []Body - -// Content returns the content produced by applying the given schema to all -// of the merged bodies and merging the result. -// -// Although required attributes _are_ supported, they should be used sparingly -// with merged bodies since in this case there is no contextual information -// with which to return good diagnostics. Applications working with merged -// bodies may wish to mark all attributes as optional and then check for -// required attributes afterwards, to produce better diagnostics. -func (mb mergedBodies) Content(schema *BodySchema) (*BodyContent, Diagnostics) { - // the returned body will always be empty in this case, because mergedContent - // will only ever call Content on the child bodies. - content, _, diags := mb.mergedContent(schema, false) - return content, diags -} - -func (mb mergedBodies) PartialContent(schema *BodySchema) (*BodyContent, Body, Diagnostics) { - return mb.mergedContent(schema, true) -} - -func (mb mergedBodies) JustAttributes() (Attributes, Diagnostics) { - attrs := make(map[string]*Attribute) - var diags Diagnostics - - for _, body := range mb { - thisAttrs, thisDiags := body.JustAttributes() - - if len(thisDiags) != 0 { - diags = append(diags, thisDiags...) - } - - if thisAttrs != nil { - for name, attr := range thisAttrs { - if existing := attrs[name]; existing != nil { - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Duplicate attribute", - Detail: fmt.Sprintf( - "Attribute %q was already assigned at %s", - name, existing.NameRange.String(), - ), - Subject: &attr.NameRange, - }) - continue - } - - attrs[name] = attr - } - } - } - - return attrs, diags -} - -func (mb mergedBodies) MissingItemRange() Range { - if len(mb) == 0 { - // Nothing useful to return here, so we'll return some garbage. - return Range{ - Filename: "", - } - } - - // arbitrarily use the first body's missing item range - return mb[0].MissingItemRange() -} - -func (mb mergedBodies) mergedContent(schema *BodySchema, partial bool) (*BodyContent, Body, Diagnostics) { - // We need to produce a new schema with none of the attributes marked as - // required, since _any one_ of our bodies can contribute an attribute value. - // We'll separately check that all required attributes are present at - // the end. - mergedSchema := &BodySchema{ - Blocks: schema.Blocks, - } - for _, attrS := range schema.Attributes { - mergedAttrS := attrS - mergedAttrS.Required = false - mergedSchema.Attributes = append(mergedSchema.Attributes, mergedAttrS) - } - - var mergedLeftovers []Body - content := &BodyContent{ - Attributes: map[string]*Attribute{}, - } - - var diags Diagnostics - for _, body := range mb { - var thisContent *BodyContent - var thisLeftovers Body - var thisDiags Diagnostics - - if partial { - thisContent, thisLeftovers, thisDiags = body.PartialContent(mergedSchema) - } else { - thisContent, thisDiags = body.Content(mergedSchema) - } - - if thisLeftovers != nil { - mergedLeftovers = append(mergedLeftovers) - } - if len(thisDiags) != 0 { - diags = append(diags, thisDiags...) - } - - if thisContent.Attributes != nil { - for name, attr := range thisContent.Attributes { - if existing := content.Attributes[name]; existing != nil { - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Duplicate attribute", - Detail: fmt.Sprintf( - "Attribute %q was already assigned at %s", - name, existing.NameRange.String(), - ), - Subject: &attr.NameRange, - }) - continue - } - content.Attributes[name] = attr - } - } - - if len(thisContent.Blocks) != 0 { - content.Blocks = append(content.Blocks, thisContent.Blocks...) - } - } - - // Finally, we check for required attributes. - for _, attrS := range schema.Attributes { - if !attrS.Required { - continue - } - - if content.Attributes[attrS.Name] == nil { - // We don't have any context here to produce a good diagnostic, - // which is why we warn in the Content docstring to minimize the - // use of required attributes on merged bodies. - diags = diags.Append(&Diagnostic{ - Severity: DiagError, - Summary: "Missing required attribute", - Detail: fmt.Sprintf( - "The attribute %q is required, but was not assigned.", - attrS.Name, - ), - }) - } - } - - leftoverBody := MergeBodies(mergedLeftovers) - return content, leftoverBody, diags -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/merged_test.go b/vendor/github.com/hashicorp/hcl2/hcl/merged_test.go deleted file mode 100644 index 43a0fec..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/merged_test.go +++ /dev/null @@ -1,446 +0,0 @@ -package hcl - -import ( - "fmt" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" -) - -func TestMergedBodiesContent(t *testing.T) { - tests := []struct { - Bodies []Body - Schema *BodySchema - Want *BodyContent - DiagCount int - }{ - { - []Body{}, - &BodySchema{}, - &BodyContent{ - Attributes: map[string]*Attribute{}, - }, - 0, - }, - { - []Body{}, - &BodySchema{ - Attributes: []AttributeSchema{ - { - Name: "name", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - }, - 0, - }, - { - []Body{}, - &BodySchema{ - Attributes: []AttributeSchema{ - { - Name: "name", - Required: true, - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - }, - 1, - }, - { - []Body{ - &testMergedBodiesVictim{ - HasAttributes: []string{"name"}, - }, - }, - &BodySchema{ - Attributes: []AttributeSchema{ - { - Name: "name", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{ - "name": &Attribute{ - Name: "name", - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - HasAttributes: []string{"name"}, - }, - &testMergedBodiesVictim{ - Name: "second", - HasAttributes: []string{"name"}, - }, - }, - &BodySchema{ - Attributes: []AttributeSchema{ - { - Name: "name", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{ - "name": &Attribute{ - Name: "name", - NameRange: Range{Filename: "first"}, - }, - }, - }, - 1, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - HasAttributes: []string{"name"}, - }, - &testMergedBodiesVictim{ - Name: "second", - HasAttributes: []string{"age"}, - }, - }, - &BodySchema{ - Attributes: []AttributeSchema{ - { - Name: "name", - }, - { - Name: "age", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{ - "name": &Attribute{ - Name: "name", - NameRange: Range{Filename: "first"}, - }, - "age": &Attribute{ - Name: "age", - NameRange: Range{Filename: "second"}, - }, - }, - }, - 0, - }, - { - []Body{}, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - HasBlocks: map[string]int{ - "pizza": 1, - }, - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - Blocks: Blocks{ - { - Type: "pizza", - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - HasBlocks: map[string]int{ - "pizza": 2, - }, - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - Blocks: Blocks{ - { - Type: "pizza", - }, - { - Type: "pizza", - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - HasBlocks: map[string]int{ - "pizza": 1, - }, - }, - &testMergedBodiesVictim{ - Name: "second", - HasBlocks: map[string]int{ - "pizza": 1, - }, - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - Blocks: Blocks{ - { - Type: "pizza", - DefRange: Range{Filename: "first"}, - }, - { - Type: "pizza", - DefRange: Range{Filename: "second"}, - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - }, - &testMergedBodiesVictim{ - Name: "second", - HasBlocks: map[string]int{ - "pizza": 2, - }, - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - Blocks: Blocks{ - { - Type: "pizza", - DefRange: Range{Filename: "second"}, - }, - { - Type: "pizza", - DefRange: Range{Filename: "second"}, - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - HasBlocks: map[string]int{ - "pizza": 2, - }, - }, - &testMergedBodiesVictim{ - Name: "second", - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - Blocks: Blocks{ - { - Type: "pizza", - DefRange: Range{Filename: "first"}, - }, - { - Type: "pizza", - DefRange: Range{Filename: "first"}, - }, - }, - }, - 0, - }, - { - []Body{ - &testMergedBodiesVictim{ - Name: "first", - }, - &testMergedBodiesVictim{ - Name: "second", - }, - }, - &BodySchema{ - Blocks: []BlockHeaderSchema{ - { - Type: "pizza", - }, - }, - }, - &BodyContent{ - Attributes: map[string]*Attribute{}, - }, - 0, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d", i), func(t *testing.T) { - merged := MergeBodies(test.Bodies) - got, diags := merged.Content(test.Schema) - - if len(diags) != test.DiagCount { - t.Errorf("Wrong number of diagnostics %d; want %d", len(diags), test.DiagCount) - for _, diag := range diags { - t.Logf(" - %s", diag) - } - } - - if !reflect.DeepEqual(got, test.Want) { - t.Errorf("wrong result\ngot: %s\nwant: %s", spew.Sdump(got), spew.Sdump(test.Want)) - } - }) - } -} - -type testMergedBodiesVictim struct { - Name string - HasAttributes []string - HasBlocks map[string]int - DiagCount int -} - -func (v *testMergedBodiesVictim) Content(schema *BodySchema) (*BodyContent, Diagnostics) { - c, _, d := v.PartialContent(schema) - return c, d -} - -func (v *testMergedBodiesVictim) PartialContent(schema *BodySchema) (*BodyContent, Body, Diagnostics) { - hasAttrs := map[string]struct{}{} - for _, n := range v.HasAttributes { - hasAttrs[n] = struct{}{} - } - - content := &BodyContent{ - Attributes: map[string]*Attribute{}, - } - - rng := Range{ - Filename: v.Name, - } - - for _, attrS := range schema.Attributes { - _, has := hasAttrs[attrS.Name] - if has { - content.Attributes[attrS.Name] = &Attribute{ - Name: attrS.Name, - NameRange: rng, - } - } - } - - if v.HasBlocks != nil { - for _, blockS := range schema.Blocks { - num := v.HasBlocks[blockS.Type] - for i := 0; i < num; i++ { - content.Blocks = append(content.Blocks, &Block{ - Type: blockS.Type, - DefRange: rng, - }) - } - } - } - - diags := make(Diagnostics, v.DiagCount) - for i := range diags { - diags[i] = &Diagnostic{ - Severity: DiagError, - Summary: fmt.Sprintf("Fake diagnostic %d", i), - Detail: "For testing only.", - Context: &rng, - } - } - - return content, emptyBody, diags -} - -func (v *testMergedBodiesVictim) JustAttributes() (Attributes, Diagnostics) { - attrs := make(map[string]*Attribute) - - rng := Range{ - Filename: v.Name, - } - - for _, name := range v.HasAttributes { - attrs[name] = &Attribute{ - Name: name, - NameRange: rng, - } - } - - diags := make(Diagnostics, v.DiagCount) - for i := range diags { - diags[i] = &Diagnostic{ - Severity: DiagError, - Summary: fmt.Sprintf("Fake diagnostic %d", i), - Detail: "For testing only.", - Context: &rng, - } - } - - return attrs, diags -} - -func (v *testMergedBodiesVictim) MissingItemRange() Range { - return Range{ - Filename: v.Name, - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/ops.go b/vendor/github.com/hashicorp/hcl2/hcl/ops.go deleted file mode 100644 index 80312b0..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/ops.go +++ /dev/null @@ -1,147 +0,0 @@ -package hcl - -import ( - "fmt" - - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -// Index is a helper function that performs the same operation as the index -// operator in the zcl expression language. That is, the result is the -// same as it would be for collection[key] in a configuration expression. -// -// This is exported so that applications can perform indexing in a manner -// consistent with how the language does it, including handling of null and -// unknown values, etc. -// -// Diagnostics are produced if the given combination of values is not valid. -// Therefore a pointer to a source range must be provided to use in diagnostics, -// though nil can be provided if the calling application is going to -// ignore the subject of the returned diagnostics anyway. -func Index(collection, key cty.Value, srcRange *Range) (cty.Value, Diagnostics) { - if collection.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Attempt to index null value", - Detail: "This value is null, so it does not have any indices.", - Subject: srcRange, - }, - } - } - if key.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "Can't use a null value as an indexing key.", - Subject: srcRange, - }, - } - } - ty := collection.Type() - kty := key.Type() - if kty == cty.DynamicPseudoType || ty == cty.DynamicPseudoType { - return cty.DynamicVal, nil - } - - switch { - - case ty.IsListType() || ty.IsTupleType() || ty.IsMapType(): - var wantType cty.Type - switch { - case ty.IsListType() || ty.IsTupleType(): - wantType = cty.Number - case ty.IsMapType(): - wantType = cty.String - default: - // should never happen - panic("don't know what key type we want") - } - - key, keyErr := convert.Convert(key, wantType) - if keyErr != nil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: fmt.Sprintf( - "The given key does not identify an element in this collection value: %s.", - keyErr.Error(), - ), - Subject: srcRange, - }, - } - } - - has := collection.HasIndex(key) - if !has.IsKnown() { - if ty.IsTupleType() { - return cty.DynamicVal, nil - } else { - return cty.UnknownVal(ty.ElementType()), nil - } - } - if has.False() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "The given key does not identify an element in this collection value.", - Subject: srcRange, - }, - } - } - - return collection.Index(key), nil - - case ty.IsObjectType(): - key, keyErr := convert.Convert(key, cty.String) - if keyErr != nil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: fmt.Sprintf( - "The given key does not identify an element in this collection value: %s.", - keyErr.Error(), - ), - Subject: srcRange, - }, - } - } - if !collection.IsKnown() { - return cty.DynamicVal, nil - } - if !key.IsKnown() { - return cty.DynamicVal, nil - } - - attrName := key.AsString() - - if !ty.HasAttribute(attrName) { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "The given key does not identify an element in this collection value.", - Subject: srcRange, - }, - } - } - - return collection.GetAttr(attrName), nil - - default: - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Invalid index", - Detail: "This value does not have any indices.", - Subject: srcRange, - }, - } - } - -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/pos.go b/vendor/github.com/hashicorp/hcl2/hcl/pos.go deleted file mode 100644 index 1a4b329..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/pos.go +++ /dev/null @@ -1,262 +0,0 @@ -package hcl - -import "fmt" - -// Pos represents a single position in a source file, by addressing the -// start byte of a unicode character encoded in UTF-8. -// -// Pos is generally used only in the context of a Range, which then defines -// which source file the position is within. -type Pos struct { - // Line is the source code line where this position points. Lines are - // counted starting at 1 and incremented for each newline character - // encountered. - Line int - - // Column is the source code column where this position points, in - // unicode characters, with counting starting at 1. - // - // Column counts characters as they appear visually, so for example a - // latin letter with a combining diacritic mark counts as one character. - // This is intended for rendering visual markers against source code in - // contexts where these diacritics would be rendered in a single character - // cell. Technically speaking, Column is counting grapheme clusters as - // used in unicode normalization. - Column int - - // Byte is the byte offset into the file where the indicated character - // begins. This is a zero-based offset to the first byte of the first - // UTF-8 codepoint sequence in the character, and thus gives a position - // that can be resolved _without_ awareness of Unicode characters. - Byte int -} - -// Range represents a span of characters between two positions in a source -// file. -// -// This struct is usually used by value in types that represent AST nodes, -// but by pointer in types that refer to the positions of other objects, -// such as in diagnostics. -type Range struct { - // Filename is the name of the file into which this range's positions - // point. - Filename string - - // Start and End represent the bounds of this range. Start is inclusive - // and End is exclusive. - Start, End Pos -} - -// RangeBetween returns a new range that spans from the beginning of the -// start range to the end of the end range. -// -// The result is meaningless if the two ranges do not belong to the same -// source file or if the end range appears before the start range. -func RangeBetween(start, end Range) Range { - return Range{ - Filename: start.Filename, - Start: start.Start, - End: end.End, - } -} - -// RangeOver returns a new range that covers both of the given ranges and -// possibly additional content between them if the two ranges do not overlap. -// -// If either range is empty then it is ignored. The result is empty if both -// given ranges are empty. -// -// The result is meaningless if the two ranges to not belong to the same -// source file. -func RangeOver(a, b Range) Range { - if a.Empty() { - return b - } - if b.Empty() { - return a - } - - var start, end Pos - if a.Start.Byte < b.Start.Byte { - start = a.Start - } else { - start = b.Start - } - if a.End.Byte > b.End.Byte { - end = a.End - } else { - end = b.End - } - return Range{ - Filename: a.Filename, - Start: start, - End: end, - } -} - -// ContainsOffset returns true if and only if the given byte offset is within -// the receiving Range. -func (r Range) ContainsOffset(offset int) bool { - return offset >= r.Start.Byte && offset < r.End.Byte -} - -// Ptr returns a pointer to a copy of the receiver. This is a convenience when -// ranges in places where pointers are required, such as in Diagnostic, but -// the range in question is returned from a method. Go would otherwise not -// allow one to take the address of a function call. -func (r Range) Ptr() *Range { - return &r -} - -// String returns a compact string representation of the receiver. -// Callers should generally prefer to present a range more visually, -// e.g. via markers directly on the relevant portion of source code. -func (r Range) String() string { - if r.Start.Line == r.End.Line { - return fmt.Sprintf( - "%s:%d,%d-%d", - r.Filename, - r.Start.Line, r.Start.Column, - r.End.Column, - ) - } else { - return fmt.Sprintf( - "%s:%d,%d-%d,%d", - r.Filename, - r.Start.Line, r.Start.Column, - r.End.Line, r.End.Column, - ) - } -} - -func (r Range) Empty() bool { - return r.Start.Byte == r.End.Byte -} - -// CanSliceBytes returns true if SliceBytes could return an accurate -// sub-slice of the given slice. -// -// This effectively tests whether the start and end offsets of the range -// are within the bounds of the slice, and thus whether SliceBytes can be -// trusted to produce an accurate start and end position within that slice. -func (r Range) CanSliceBytes(b []byte) bool { - switch { - case r.Start.Byte < 0 || r.Start.Byte > len(b): - return false - case r.End.Byte < 0 || r.End.Byte > len(b): - return false - case r.End.Byte < r.Start.Byte: - return false - default: - return true - } -} - -// SliceBytes returns a sub-slice of the given slice that is covered by the -// receiving range, assuming that the given slice is the source code of the -// file indicated by r.Filename. -// -// If the receiver refers to any byte offsets that are outside of the slice -// then the result is constrained to the overlapping portion only, to avoid -// a panic. Use CanSliceBytes to determine if the result is guaranteed to -// be an accurate span of the requested range. -func (r Range) SliceBytes(b []byte) []byte { - start := r.Start.Byte - end := r.End.Byte - if start < 0 { - start = 0 - } else if start > len(b) { - start = len(b) - } - if end < 0 { - end = 0 - } else if end > len(b) { - end = len(b) - } - if end < start { - end = start - } - return b[start:end] -} - -// Overlaps returns true if the receiver and the other given range share any -// characters in common. -func (r Range) Overlaps(other Range) bool { - switch { - case r.Filename != other.Filename: - // If the ranges are in different files then they can't possibly overlap - return false - case r.Empty() || other.Empty(): - // Empty ranges can never overlap - return false - case r.ContainsOffset(other.Start.Byte) || r.ContainsOffset(other.End.Byte): - return true - case other.ContainsOffset(r.Start.Byte) || other.ContainsOffset(r.End.Byte): - return true - default: - return false - } -} - -// Overlap finds a range that is either identical to or a sub-range of both -// the receiver and the other given range. It returns an empty range -// within the receiver if there is no overlap between the two ranges. -// -// A non-empty result is either identical to or a subset of the receiver. -func (r Range) Overlap(other Range) Range { - if !r.Overlaps(other) { - // Start == End indicates an empty range - return Range{ - Filename: r.Filename, - Start: r.Start, - End: r.Start, - } - } - - var start, end Pos - if r.Start.Byte > other.Start.Byte { - start = r.Start - } else { - start = other.Start - } - if r.End.Byte < other.End.Byte { - end = r.End - } else { - end = other.End - } - - return Range{ - Filename: r.Filename, - Start: start, - End: end, - } -} - -// PartitionAround finds the portion of the given range that overlaps with -// the reciever and returns three ranges: the portion of the reciever that -// precedes the overlap, the overlap itself, and then the portion of the -// reciever that comes after the overlap. -// -// If the two ranges do not overlap then all three returned ranges are empty. -// -// If the given range aligns with or extends beyond either extent of the -// reciever then the corresponding outer range will be empty. -func (r Range) PartitionAround(other Range) (before, overlap, after Range) { - overlap = r.Overlap(other) - if overlap.Empty() { - return overlap, overlap, overlap - } - - before = Range{ - Filename: r.Filename, - Start: r.Start, - End: overlap.Start, - } - after = Range{ - Filename: r.Filename, - Start: overlap.End, - End: r.End, - } - - return before, overlap, after -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner.go b/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner.go deleted file mode 100644 index 7c8f2df..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner.go +++ /dev/null @@ -1,148 +0,0 @@ -package hcl - -import ( - "bufio" - "bytes" - - "github.com/apparentlymart/go-textseg/textseg" -) - -// RangeScanner is a helper that will scan over a buffer using a bufio.SplitFunc -// and visit a source range for each token matched. -// -// For example, this can be used with bufio.ScanLines to find the source range -// for each line in the file, skipping over the actual newline characters, which -// may be useful when printing source code snippets as part of diagnostic -// messages. -// -// The line and column information in the returned ranges is produced by -// counting newline characters and grapheme clusters respectively, which -// mimics the behavior we expect from a parser when producing ranges. -type RangeScanner struct { - filename string - b []byte - cb bufio.SplitFunc - - pos Pos // position of next byte to process in b - cur Range // latest range - tok []byte // slice of b that is covered by cur - err error // error from last scan, if any -} - -// Create a new RangeScanner for the given buffer, producing ranges for the -// given filename. -// -// Since ranges have grapheme-cluster granularity rather than byte granularity, -// the scanner will produce incorrect results if the given SplitFunc creates -// tokens between grapheme cluster boundaries. In particular, it is incorrect -// to use RangeScanner with bufio.ScanRunes because it will produce tokens -// around individual UTF-8 sequences, which will split any multi-sequence -// grapheme clusters. -func NewRangeScanner(b []byte, filename string, cb bufio.SplitFunc) *RangeScanner { - return &RangeScanner{ - filename: filename, - b: b, - cb: cb, - pos: Pos{ - Byte: 0, - Line: 1, - Column: 1, - }, - } -} - -func (sc *RangeScanner) Scan() bool { - if sc.pos.Byte >= len(sc.b) || sc.err != nil { - // All done - return false - } - - // Since we're operating on an in-memory buffer, we always pass the whole - // remainder of the buffer to our SplitFunc and set isEOF to let it know - // that it has the whole thing. - advance, token, err := sc.cb(sc.b[sc.pos.Byte:], true) - - // Since we are setting isEOF to true this should never happen, but - // if it does we will just abort and assume the SplitFunc is misbehaving. - if advance == 0 && token == nil && err == nil { - return false - } - - if err != nil { - sc.err = err - sc.cur = Range{ - Filename: sc.filename, - Start: sc.pos, - End: sc.pos, - } - sc.tok = nil - return false - } - - sc.tok = token - start := sc.pos - end := sc.pos - new := sc.pos - - // adv is similar to token but it also includes any subsequent characters - // we're being asked to skip over by the SplitFunc. - // adv is a slice covering any additional bytes we are skipping over, based - // on what the SplitFunc told us to do with advance. - adv := sc.b[sc.pos.Byte : sc.pos.Byte+advance] - - // We now need to scan over our token to count the grapheme clusters - // so we can correctly advance Column, and count the newlines so we - // can correctly advance Line. - advR := bytes.NewReader(adv) - gsc := bufio.NewScanner(advR) - advanced := 0 - gsc.Split(textseg.ScanGraphemeClusters) - for gsc.Scan() { - gr := gsc.Bytes() - new.Byte += len(gr) - new.Column++ - - // We rely here on the fact that \r\n is considered a grapheme cluster - // and so we don't need to worry about miscounting additional lines - // on files with Windows-style line endings. - if len(gr) != 0 && (gr[0] == '\r' || gr[0] == '\n') { - new.Column = 1 - new.Line++ - } - - if advanced < len(token) { - // If we've not yet found the end of our token then we'll - // also push our "end" marker along. - // (if advance > len(token) then we'll stop moving "end" early - // so that the caller only sees the range covered by token.) - end = new - } - advanced += len(gr) - } - - sc.cur = Range{ - Filename: sc.filename, - Start: start, - End: end, - } - sc.pos = new - return true -} - -// Range returns a range that covers the latest token obtained after a call -// to Scan returns true. -func (sc *RangeScanner) Range() Range { - return sc.cur -} - -// Bytes returns the slice of the input buffer that is covered by the range -// that would be returned by Range. -func (sc *RangeScanner) Bytes() []byte { - return sc.tok -} - -// Err can be called after Scan returns false to determine if the latest read -// resulted in an error, and obtain that error if so. -func (sc *RangeScanner) Err() error { - return sc.err -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner_test.go b/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner_test.go deleted file mode 100644 index b0dc902..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/pos_scanner_test.go +++ /dev/null @@ -1,193 +0,0 @@ -package hcl - -import ( - "bufio" - "reflect" - "testing" - - "github.com/davecgh/go-spew/spew" -) - -func TestPosScanner(t *testing.T) { - tests := map[string]struct { - Input string - Want []Range - WantToks [][]byte - }{ - "empty": { - "", - []Range{}, - [][]byte{}, - }, - "single line": { - "hello", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - }, - }, - "single line with trailing UNIX newline": { - "hello\n", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - }, - }, - "single line with trailing Windows newline": { - "hello\r\n", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - }, - }, - "two lines with UNIX newline": { - "hello\nworld", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - { - Start: Pos{Byte: 6, Line: 2, Column: 1}, - End: Pos{Byte: 11, Line: 2, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - []byte("world"), - }, - }, - "two lines with Windows newline": { - "hello\r\nworld", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - { - Start: Pos{Byte: 7, Line: 2, Column: 1}, - End: Pos{Byte: 12, Line: 2, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - []byte("world"), - }, - }, - "blank line with UNIX newlines": { - "hello\n\nworld", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - { - Start: Pos{Byte: 6, Line: 2, Column: 1}, - End: Pos{Byte: 6, Line: 2, Column: 1}, - }, - { - Start: Pos{Byte: 7, Line: 3, Column: 1}, - End: Pos{Byte: 12, Line: 3, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - []byte(""), - []byte("world"), - }, - }, - "blank line with Windows newlines": { - "hello\r\n\r\nworld", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - { - Start: Pos{Byte: 7, Line: 2, Column: 1}, - End: Pos{Byte: 7, Line: 2, Column: 1}, - }, - { - Start: Pos{Byte: 9, Line: 3, Column: 1}, - End: Pos{Byte: 14, Line: 3, Column: 6}, - }, - }, - [][]byte{ - []byte("hello"), - []byte(""), - []byte("world"), - }, - }, - "two lines with combiner and UNIX newline": { - "foo \U0001f469\U0001f3ff bar\nbaz", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 16, Line: 1, Column: 10}, - }, - { - Start: Pos{Byte: 17, Line: 2, Column: 1}, - End: Pos{Byte: 20, Line: 2, Column: 4}, - }, - }, - [][]byte{ - []byte("foo \U0001f469\U0001f3ff bar"), - []byte("baz"), - }, - }, - "two lines with combiner and Windows newline": { - "foo \U0001f469\U0001f3ff bar\r\nbaz", - []Range{ - { - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 16, Line: 1, Column: 10}, - }, - { - Start: Pos{Byte: 18, Line: 2, Column: 1}, - End: Pos{Byte: 21, Line: 2, Column: 4}, - }, - }, - [][]byte{ - []byte("foo \U0001f469\U0001f3ff bar"), - []byte("baz"), - }, - }, - } - - for name, test := range tests { - t.Run(name, func(t *testing.T) { - src := []byte(test.Input) - sc := NewRangeScanner(src, "", bufio.ScanLines) - got := make([]Range, 0) - gotToks := make([][]byte, 0) - for sc.Scan() { - got = append(got, sc.Range()) - gotToks = append(gotToks, sc.Bytes()) - } - if sc.Err() != nil { - t.Fatalf("unexpected error: %s", sc.Err()) - } - if !reflect.DeepEqual(got, test.Want) { - t.Errorf("incorrect ranges\ngot: %swant: %s", spew.Sdump(got), spew.Sdump(test.Want)) - } - if !reflect.DeepEqual(gotToks, test.WantToks) { - t.Errorf("incorrect tokens\ngot: %swant: %s", spew.Sdump(gotToks), spew.Sdump(test.WantToks)) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/pos_test.go b/vendor/github.com/hashicorp/hcl2/hcl/pos_test.go deleted file mode 100644 index cfa4137..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/pos_test.go +++ /dev/null @@ -1,467 +0,0 @@ -package hcl - -import ( - "bytes" - "fmt" - "reflect" - "testing" -) - -func TestRangeOver(t *testing.T) { - tests := []struct { - A Range - B Range - Want Range - }{ - { - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ##### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ##### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // ### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // ### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // ## - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ## - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // ###### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - { - Range{ // ## - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // ## - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ###### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - }, - } - - for _, test := range tests { - t.Run(fmt.Sprintf("%s<=>%s", test.A, test.B), func(t *testing.T) { - got := RangeOver(test.A, test.B) - if !reflect.DeepEqual(got, test.Want) { - t.Errorf( - "wrong result\nA : %-10s %s\nB : %-10s %s\ngot : %-10s %s\nwant: %-10s %s", - visRangeOffsets(test.A), test.A, - visRangeOffsets(test.B), test.B, - visRangeOffsets(got), got, - visRangeOffsets(test.Want), test.Want, - ) - } - }) - } -} - -func TestPosOverlap(t *testing.T) { - tests := []struct { - A Range - B Range - Want Range - }{ - { - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // ### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // ### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // ## - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ## - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // (no overlap) - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 0, Line: 1, Column: 1}, - }, - }, - { - Range{ // ## - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 6, Line: 1, Column: 7}, - }, - Range{ // ## - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // (no overlap) - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - } - - for _, test := range tests { - t.Run(fmt.Sprintf("%s<=>%s", test.A, test.B), func(t *testing.T) { - got := test.A.Overlap(test.B) - if !reflect.DeepEqual(got, test.Want) { - t.Errorf( - "wrong result\nA : %-10s %s\nB : %-10s %s\ngot : %-10s %s\nwant: %-10s %s", - visRangeOffsets(test.A), test.A, - visRangeOffsets(test.B), test.B, - visRangeOffsets(got), got, - visRangeOffsets(test.Want), test.Want, - ) - } - }) - } -} - -func TestRangePartitionAround(t *testing.T) { - tests := []struct { - Outer Range - Inner Range - WantBefore Range - WantOverlap Range - WantAfter Range - }{ - { - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // (empty) - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // (empty) - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // # - Start: Pos{Byte: 0, Line: 1, Column: 1}, - End: Pos{Byte: 1, Line: 1, Column: 2}, - }, - Range{ // ### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // (empty) - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // (empty) - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ### - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // # - Start: Pos{Byte: 5, Line: 1, Column: 6}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - { - Range{ // #### - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // # - Start: Pos{Byte: 1, Line: 1, Column: 2}, - End: Pos{Byte: 2, Line: 1, Column: 3}, - }, - Range{ // ## - Start: Pos{Byte: 2, Line: 1, Column: 3}, - End: Pos{Byte: 4, Line: 1, Column: 5}, - }, - Range{ // # - Start: Pos{Byte: 4, Line: 1, Column: 5}, - End: Pos{Byte: 5, Line: 1, Column: 6}, - }, - }, - } - - for _, test := range tests { - t.Run(fmt.Sprintf("%s around %s", test.Outer, test.Inner), func(t *testing.T) { - gotBefore, gotOverlap, gotAfter := test.Outer.PartitionAround(test.Inner) - if !reflect.DeepEqual(gotBefore, test.WantBefore) { - t.Errorf( - "wrong before\nA : %-10s %s\nB : %-10s %s\ngot : %-10s %s\nwant: %-10s %s", - visRangeOffsets(test.Outer), test.Outer, - visRangeOffsets(test.Inner), test.Inner, - visRangeOffsets(gotBefore), gotBefore, - visRangeOffsets(test.WantBefore), test.WantBefore, - ) - } - if !reflect.DeepEqual(gotOverlap, test.WantOverlap) { - t.Errorf( - "wrong overlap\nA : %-10s %s\nB : %-10s %s\ngot : %-10s %s\nwant: %-10s %s", - visRangeOffsets(test.Outer), test.Outer, - visRangeOffsets(test.Inner), test.Inner, - visRangeOffsets(gotOverlap), gotOverlap, - visRangeOffsets(test.WantOverlap), test.WantOverlap, - ) - } - if !reflect.DeepEqual(gotAfter, test.WantAfter) { - t.Errorf( - "wrong after\nA : %-10s %s\nB : %-10s %s\ngot : %-10s %s\nwant: %-10s %s", - visRangeOffsets(test.Outer), test.Outer, - visRangeOffsets(test.Inner), test.Inner, - visRangeOffsets(gotAfter), gotAfter, - visRangeOffsets(test.WantAfter), test.WantAfter, - ) - } - }) - } -} - -// visRangeOffsets is a helper that produces a visual representation of the -// start and end byte offsets of the given range, which can then be stacked -// with the same for other ranges to more easily see how the ranges relate -// to one another. -func visRangeOffsets(rng Range) string { - var buf bytes.Buffer - if rng.End.Byte < rng.Start.Byte { - // Should never happen, but we'll visualize it anyway so we can - // more easily debug failing tests. - for i := 0; i < rng.End.Byte; i++ { - buf.WriteByte(' ') - } - for i := rng.End.Byte; i < rng.Start.Byte; i++ { - buf.WriteByte('!') - } - return buf.String() - } - - for i := 0; i < rng.Start.Byte; i++ { - buf.WriteByte(' ') - } - for i := rng.Start.Byte; i < rng.End.Byte; i++ { - buf.WriteByte('#') - } - return buf.String() -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/schema.go b/vendor/github.com/hashicorp/hcl2/hcl/schema.go deleted file mode 100644 index 891257a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/schema.go +++ /dev/null @@ -1,21 +0,0 @@ -package hcl - -// BlockHeaderSchema represents the shape of a block header, and is -// used for matching blocks within bodies. -type BlockHeaderSchema struct { - Type string - LabelNames []string -} - -// AttributeSchema represents the requirements for an attribute, and is used -// for matching attributes within bodies. -type AttributeSchema struct { - Name string - Required bool -} - -// BodySchema represents the desired shallow structure of a body. -type BodySchema struct { - Attributes []AttributeSchema - Blocks []BlockHeaderSchema -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/spec.md b/vendor/github.com/hashicorp/hcl2/hcl/spec.md deleted file mode 100644 index db4e9ef..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/spec.md +++ /dev/null @@ -1,646 +0,0 @@ -# HCL Syntax-Agnostic Information Model - -This is the specification for the general information model (abstract types and -semantics) for hcl. HCL is a system for defining configuration languages for -applications. The HCL information model is designed to support multiple -concrete syntaxes for configuration, each with a mapping to the model defined -in this specification. - -The two primary syntaxes intended for use in conjunction with this model are -[the HCL native syntax](./zclsyntax/spec.md) and [the JSON syntax](./json/spec.md). -In principle other syntaxes are possible as long as either their language model -is sufficiently rich to express the concepts described in this specification -or the language targets a well-defined subset of the specification. - -## Structural Elements - -The primary structural element is the _body_, which is a container representing -a set of zero or more _attributes_ and a set of zero or more _blocks_. - -A _configuration file_ is the top-level object, and will usually be produced -by reading a file from disk and parsing it as a particular syntax. A -configuration file has its own _body_, representing the top-level attributes -and blocks. - -An _attribute_ is a name and value pair associated with a body. Attribute names -are unique within a given body. Attribute values are provided as _expressions_, -which are discussed in detail in a later section. - -A _block_ is a nested structure that has a _type name_, zero or more string -_labels_ (e.g. identifiers), and a nested body. - -Together the structural elements create a heirarchical data structure, with -attributes intended to represent the direct properties of a particular object -in the calling application, and blocks intended to represent child objects -of a particular object. - -## Body Content - -To support the expression of the HCL concepts in languages whose information -model is a subset of HCL's, such as JSON, a _body_ is an opaque container -whose content can only be accessed by providing information on the expected -structure of the content. - -The specification for each syntax must describe how its physical constructs -are mapped on to body content given a schema. For syntaxes that have -first-class syntax distinguishing attributes and bodies this can be relatively -straightforward, while more detailed mapping rules may be required in syntaxes -where the representation of attributes vs. blocks is ambiguous. - -### Schema-driven Processing - -Schema-driven processing is the primary way to access body content. -A _body schema_ is a description of what is expected within a particular body, -which can then be used to extract the _body content_, which then provides -access to the specific attributes and blocks requested. - -A _body schema_ consists of a list of _attribute schemata_ and -_block header schemata_: - -* An _attribute schema_ provides the name of an attribute and whether its - presence is required. - -* A _block header schema_ provides a block type name and the semantic names - assigned to each of the labels of that block type, if any. - -Within a schema, it is an error to request the same attribute name twice or -to request a block type whose name is also an attribute name. While this can -in principle be supported in some syntaxes, in other syntaxes the attribute -and block namespaces are combined and so an an attribute cannot coexist with -a block whose type name is identical to the attribute name. - -The result of applying a body schema to a body is _body content_, which -consists of an _attribute map_ and a _block sequence_: - -* The _attribute map_ is a map data structure whose keys are attribute names - and whose values are _expressions_ that represent the corresponding attribute - values. - -* The _block sequence_ is an ordered sequence of blocks, with each specifying - a block _type name_, the sequence of _labels_ specified for the block, - and the body object (not body _content_) representing the block's own body. - -After obtaining _body content_, the calling application may continue processing -by evaluating attribute expressions and/or recursively applying further -schema-driven processing to the child block bodies. - -**Note:** The _body schema_ is intentionally minimal, to reduce the set of -mapping rules that must be defined for each syntax. Higher-level utility -libraries may be provided to assist in the construction of a schema and -perform additional processing, such as automatically evaluating attribute -expressions and assigning their result values into a data structure, or -recursively applying a schema to child blocks. Such utilities are not part of -this core specification and will vary depending on the capabilities and idiom -of the implementation language. - -### _Dynamic Attributes_ Processing - -The _schema-driven_ processing model is useful when the expected structure -of a body is known a priori by the calling application. Some blocks are -instead more free-form, such as a user-provided set of arbitrary key/value -pairs. - -The alternative _dynamic attributes_ processing mode allows for this more -ad-hoc approach. Processing in this mode behaves as if a schema had been -constructed without any _block header schemata_ and with an attribute -schema for each distinct key provided within the physical representation -of the body. - -The means by which _distinct keys_ are identified is dependent on the -physical syntax; this processing mode assumes that the syntax has a way -to enumerate keys provided by the author and identify expressions that -correspond with those keys, but does not define the means by which this is -done. - -The result of _dynamic attributes_ processing is an _attribute map_ as -defined in the previous section. No _block sequence_ is produced in this -processing mode. - -### Partial Processing of Body Content - -Under _schema-driven processing_, by default the given schema is assumed -to be exhaustive, such that any attribute or block not matched by schema -elements is considered an error. This allows feedback about unsupported -attributes and blocks (such as typos) to be provided. - -An alternative is _partial processing_, where any additional elements within -the body are not considered an error. - -Under partial processing, the result is both body content as described -above _and_ a new body that represents any body elements that remain after -the schema has been processed. - -Specifically: - -* Any attribute whose name is specified in the schema is returned in body - content and elided from the new body. - -* Any block whose type is specified in the schema is returned in body content - and elided from the new body. - -* Any attribute or block _not_ meeting the above conditions is placed into - the new body, unmodified. - -The new body can then be recursively processed using any of the body -processing models. This facility allows different subsets of body content -to be processed by different parts of the calling application. - -Processing a body in two steps — first partial processing of a source body, -then exhaustive processing of the returned body — is equivalent to single-step -processing with a schema that is the union of the schemata used -across the two steps. - -## Expressions - -Attribute values are represented by _expressions_. Depending on the concrete -syntax in use, an expression may just be a literal value or it may describe -a computation in terms of literal values, variables, and functions. - -Each syntax defines its own representation of expressions. For syntaxes based -in languages that do not have any non-literal expression syntax, it is -recommended to embed the template language from -[the native syntax](./zclsyntax/spec.md) e.g. as a post-processing step on -string literals. - -### Expression Evaluation - -In order to obtain a concrete value, each expression must be _evaluated_. -Evaluation is performed in terms of an evaluation context, which -consists of the following: - -* An _evaluation mode_, which is defined below. -* A _variable scope_, which provides a set of named variables for use in - expressions. -* A _function table_, which provides a set of named functions for use in - expressions. - -The _evaluation mode_ allows for two different interpretations of an -expression: - -* In _literal-only mode_, variables and functions are not available and it - is assumed that the calling application's intent is to treat the attribute - value as a literal. - -* In _full expression mode_, variables and functions are defined and it is - assumed that the calling application wishes to provide a full expression - language for definition of the attribute value. - -The actual behavior of these two modes depends on the syntax in use. For -languages with first-class expression syntax, these two modes may be considered -equivalent, with _literal-only mode_ simply not defining any variables or -functions. For languages that embed arbitrary expressions via string templates, -_literal-only mode_ may disable such processing, allowing literal strings to -pass through without interpretation as templates. - -Since literal-only mode does not support variables and functions, it is an -error for the calling application to enable this mode and yet provide a -variable scope and/or function table. - -## Values and Value Types - -The result of expression evaluation is a _value_. Each value has a _type_, -which is dynamically determined during evaluation. The _variable scope_ in -the evaluation context is a map from variable name to value, using the same -definition of value. - -The type system for HCL values is intended to be of a level abstraction -suitable for configuration of various applications. A well-defined, -implementation-language-agnostic type system is defined to allow for -consistent processing of configuration across many implementation languages. -Concrete implementations may provide additional functionality to lower -HCL values and types to corresponding native language types, which may then -impose additional constraints on the values outside of the scope of this -specification. - -Two values are _equal_ if and only if they have identical types and their -values are equal according to the rules of their shared type. - -### Primitive Types - -The primitive types are _string_, _bool_, and _number_. - -A _string_ is a sequence of unicode characters. Two strings are equal if -NFC normalization ([UAX#15](http://unicode.org/reports/tr15/) -of each string produces two identical sequences of characters. -NFC normalization ensures that, for example, a precomposed combination of a -latin letter and a diacritic compares equal with the letter followed by -a combining diacritic. - -The _bool_ type has only two non-null values: _true_ and _false_. Two bool -values are equal if and only if they are either both true or both false. - -A _number_ is an arbitrary-precision floating point value. An implementation -_must_ make the full-precision values available to the calling application -for interpretation into any suitable number representation. An implementation -may in practice implement numbers with limited precision so long as the -following constraints are met: - -* Integers are represented with at least 256 bits. -* Non-integer numbers are represented as floating point values with a - mantissa of at least 256 bits and a signed binary exponent of at least - 16 bits. -* An error is produced if an integer value given in source cannot be - represented precisely. -* An error is produced if a non-integer value cannot be represented due to - overflow. -* A non-integer number is rounded to the nearest possible value when a - value is of too high a precision to be represented. - -The _number_ type also requires representation of both positive and negative -infinity. A "not a number" (NaN) value is _not_ provided nor used. - -Two number values are equal if they are numerically equal to the precision -associated with the number. Positive infinity and negative infinity are -equal to themselves but not to each other. Positive infinity is greater than -any other number value, and negative infinity is less than any other number -value. - -Some syntaxes may be unable to represent numeric literals of arbitrary -precision. This must be defined in the syntax specification as part of its -description of mapping numeric literals to HCL values. - -### Structural Types - -_Structural types_ are types that are constructed by combining other types. -Each distinct combination of other types is itself a distinct type. There -are two structural type _kinds_: - -* _Object types_ are constructed of a set of named attributes, each of which - has a type. Attribute names are always strings. (_Object_ attributes are a - distinct idea from _body_ attributes, though calling applications - may choose to blur the distinction by use of common naming schemes.) -* _Tuple tupes_ are constructed of a sequence of elements, each of which - has a type. - -Values of structural types are compared for equality in terms of their -attributes or elements. A structural type value is equal to another if and -only if all of the corresponding attributes or elements are equal. - -Two structural types are identical if they are of the same kind and -have attributes or elements with identical types. - -### Collection Types - -_Collection types_ are types that combine together an arbitrary number of -values of some other single type. There are three collection type _kinds_: - -* _List types_ represent ordered sequences of values of their element type. -* _Map types_ represent values of their element type accessed via string keys. -* _Set types_ represent unordered sets of distinct values of their element type. - -For each of these kinds and each distinct element type there is a distinct -collection type. For example, "list of string" is a distinct type from -"set of string", and "list of number" is a distinct type from "list of string". - -Values of collection types are compared for equality in terms of their -elements. A collection type value is equal to another if and only if both -have the same number of elements and their corresponding elements are equal. - -Two collection types are identical if they are of the same kind and have -the same element type. - -### Null values - -Each type has a null value. The null value of a type represents the absense -of a value, but with type information retained to allow for type checking. - -Null values are used primarily to represent the conditional absense of a -body attribute. In a syntax with a conditional operator, one of the result -values of that conditional may be null to indicate that the attribute should be -considered not present in that case. - -Calling applications _should_ consider an attribute with a null value as -equivalent to the value not being present at all. - -A null value of a particular type is equal to itself. - -### Unknown Values and the Dynamic Pseudo-type - -An _unknown value_ is a placeholder for a value that is not yet known. -Operations on unknown values themselves return unknown values that have a -type appropriate to the operation. For example, adding together two unknown -numbers yields an unknown number, while comparing two unknown values of any -type for equality yields an unknown bool. - -Each type has a distinct unknown value. For example, an unknown _number_ is -a distinct value from an unknown _string_. - -_The dynamic pseudo-type_ is a placeholder for a type that is not yet known. -The only values of this type are its null value and its unknown value. It is -referred to as a _pseudo-type_ because it should not be considered a type in -its own right, but rather as a placeholder for a type yet to be established. -The unknown value of the dynamic pseudo-type is referred to as _the dynamic -value_. - -Operations on values of the dynamic pseudo-type behave as if it is a value -of the expected type, optimistically assuming that once the value and type -are known they will be valid for the operation. For example, adding together -a number and the dynamic value produces an unknown number. - -Unknown values and the dynamic pseudo-type can be used as a mechanism for -partial type checking and semantic checking: by evaluating an expression with -all variables set to an unknown value, the expression can be evaluated to -produce an unknown value of a given type, or produce an error if any operation -is provably invalid with only type information. - -Unknown values and the dynamic pseudo-type must never be returned from -operations unless at least one operand is unknown or dynamic. Calling -applications are guaranteed that unless the global scope includes unknown -values, or the function table includes functions that return unknown values, -no expression will evaluate to an unknown value. The calling application is -thus in total control over the use and meaning of unknown values. - -The dynamic pseudo-type is identical only to itself. - -### Capsule Types - -A _capsule type_ is a custom type defined by the calling application. A value -of a capsule type is considered opaque to HCL, but may be accepted -by functions provided by the calling application. - -A particular capsule type is identical only to itself. The equality of two -values of the same capsule type is defined by the calling application. No -other operations are supported for values of capsule types. - -Support for capsule types in a HCL implementation is optional. Capsule types -are intended to allow calling applications to pass through values that are -not part of the standard type system. For example, an application that -deals with raw binary data may define a capsule type representing a byte -array, and provide functions that produce or operate on byte arrays. - -### Type Specifications - -In certain situations it is necessary to define expectations about the expected -type of a value. Whereas two _types_ have a commutative _identity_ relationship, -a type has a non-commutative _matches_ relationship with a _type specification_. -A type specification is, in practice, just a different interpretation of a -type such that: - -* Any type _matches_ any type that it is identical to. - -* Any type _matches_ the dynamic pseudo-type. - -For example, given a type specification "list of dynamic pseudo-type", the -concrete types "list of string" and "list of map" match, but the -type "set of string" does not. - -## Functions and Function Calls - -The evaluation context used to evaluate an expression includes a function -table, which represents an application-defined set of named functions -available for use in expressions. - -Each syntax defines whether function calls are supported and how they are -physically represented in source code, but the semantics of function calls are -defined here to ensure consistent results across syntaxes and to allow -applications to provide functions that are interoperable with all syntaxes. - -A _function_ is defined from the following elements: - -* Zero or more _positional parameters_, each with a name used for documentation, - a type specification for expected argument values, and a flag for whether - each of null values, unknown values, and values of the dynamic pseudo-type - are accepted. - -* Zero or one _variadic parameters_, with the same structure as the _positional_ - parameters, which if present collects any additional arguments provided at - the function call site. - -* A _result type definition_, which specifies the value type returned for each - valid sequence of argument values. - -* A _result value definition_, which specifies the value returned for each - valid sequence of argument values. - -A _function call_, regardless of source syntax, consists of a sequence of -argument values. The argument values are each mapped to a corresponding -parameter as follows: - -* For each of the function's positional parameters in sequence, take the next - argument. If there are no more arguments, the call is erroneous. - -* If the function has a variadic parameter, take all remaining arguments that - where not yet assigned to a positional parameter and collect them into - a sequence of variadic arguments that each correspond to the variadic - parameter. - -* If the function has _no_ variadic parameter, it is an error if any arguments - remain after taking one argument for each positional parameter. - -After mapping each argument to a parameter, semantic checking proceeds -for each argument: - -* If the argument value corresponding to a parameter does not match the - parameter's type specification, the call is erroneous. - -* If the argument value corresponding to a parameter is null and the parameter - is not specified as accepting nulls, the call is erroneous. - -* If the argument value corresponding to a parameter is the dynamic value - and the parameter is not specified as accepting values of the dynamic - pseudo-type, the call is valid but its _result type_ is forced to be the - dynamic pseudo type. - -* If neither of the above conditions holds for any argument, the call is - valid and the function's value type definition is used to determine the - call's _result type_. A function _may_ vary its result type depending on - the argument _values_ as well as the argument _types_; for example, a - function that decodes a JSON value will return a different result type - depending on the data structure described by the given JSON source code. - -If semantic checking succeeds without error, the call is _executed_: - -* For each argument, if its value is unknown and its corresponding parameter - is not specified as accepting unknowns, the _result value_ is forced to be an - unknown value of the result type. - -* If the previous condition does not apply, the function's result value - definition is used to determine the call's _result value_. - -The result of a function call expression is either an error, if one of the -erroenous conditions above applies, or the _result value_. - -## Type Conversions and Unification - -Values given in configuration may not always match the expectations of the -operations applied to them or to the calling application. In such situations, -automatic type conversion is attempted as a convenience to the user. - -Along with conversions to a _specified_ type, it is sometimes necessary to -ensure that a selection of values are all of the _same_ type, without any -constraint on which type that is. This is the process of _type unification_, -which attempts to find the most general type that all of the given types can -be converted to. - -Both type conversions and unification are defined in the syntax-agnostic -model to ensure consistency of behavior between syntaxes. - -Type conversions are broadly characterized into two categories: _safe_ and -_unsafe_. A conversion is "safe" if any distinct value of the source type -has a corresponding distinct value in the target type. A conversion is -"unsafe" if either the target type values are _not_ distinct (information -may be lost in conversion) or if some values of the source type do not have -any corresponding value in the target type. An unsafe conversion may result -in an error. - -A given type can always be converted to itself, which is a no-op. - -### Conversion of Null Values - -All null values are safely convertable to a null value of any other type, -regardless of other type-specific rules specified in the sections below. - -### Conversion to and from the Dynamic Pseudo-type - -Conversion _from_ the dynamic pseudo-type _to_ any other type always succeeds, -producing an unknown value of the target type. - -Conversion of any value _to_ the dynamic pseudo-type is a no-op. The result -is the input value, verbatim. This is the only situation where the conversion -result value is not of the the given target type. - -### Primitive Type Conversions - -Bidirectional conversions are available between the string and number types, -and between the string and boolean types. - -The bool value true corresponds to the string containing the characters "true", -while the bool value false corresponds to teh string containing the characters -"false". Conversion from bool to string is safe, while the converse is -unsafe. The strings "1" and "0" are alternative string representations -of true and false respectively. It is an error to convert a string other than -the four in this paragraph to type bool. - -A number value is converted to string by translating its integer portion -into a sequence of decimal digits (`0` through `9`), and then if it has a -non-zero fractional part, a period `.` followed by a sequence of decimal -digits representing its fractional part. No exponent portion is included. -The number is converted at its full precision. Conversion from number to -string is safe. - -A string is converted to a number value by reversing the above mapping. -No exponent portion is allowed. Conversion from string to number is unsafe. -It is an error to convert a string that does not comply with the expected -syntax to type number. - -No direct conversion is available between the bool and number types. - -### Collection and Structural Type Conversions - -Conversion from set types to list types is _safe_, as long as their -element types are safely convertable. If the element types are _unsafely_ -convertable, then the collection conversion is also unsafe. Each set element -becomes a corresponding list element, in an undefined order. Although no -particular ordering is required, implementations _should_ produce list -elements in a consistent order for a given input set, as a convenience -to calling applications. - -Conversion from list types to set types is _unsafe_, as long as their element -types are convertable. Each distinct list item becomes a distinct set item. -If two list items are equal, one of the two is lost in the conversion. - -Conversion from tuple types to list types permitted if all of the -tuple element types are convertable to the target list element type. -The safety of the conversion depends on the safety of each of the element -conversions. Each element in turn is converted to the list element type, -producing a list of identical length. - -Conversion from tuple types to set types is permitted, behaving as if the -tuple type was first converted to a list of the same element type and then -that list converted to the target set type. - -Conversion from object types to map types is permitted if all of the object -attribute types are convertable to the target map element type. The safety -of the conversion depends on the safety of each of the attribute conversions. -Each attribute in turn is converted to the map element type, and map element -keys are set to the name of each corresponding object attribute. - -Conversion from list and set types to tuple types is permitted, following -the opposite steps as the converse conversions. Such conversions are _unsafe_. -It is an error to convert a list or set to a tuple type whose number of -elements does not match the list or set length. - -Conversion from map types to object types is permitted if each map key -corresponds to an attribute in the target object type. It is an error to -convert from a map value whose set of keys does not exactly match the target -type's attributes. The conversion takes the opposite steps of the converse -conversion. - -Conversion from one object type to another is permitted as long as the -common attribute names have convertable types. Any attribute present in the -target type but not in the source type is populated with a null value of -the appropriate type. - -Conversion from one tuple type to another is permitted as long as the -tuples have the same length and the elements have convertable types. - -### Type Unification - -Type unification is an operation that takes a list of types and attempts -to find a single type to which they can all be converted. Since some -type pairs have bidirectional conversions, preference is given to _safe_ -conversions. In technical terms, all possible types are arranged into -a lattice, from which a most general supertype is selected where possible. - -The type resulting from type unification may be one of the input types, or -it may be an entirely new type produced by combination of two or more -input types. - -The following rules do not guarantee a valid result. In addition to these -rules, unification fails if any of the given types are not convertable -(per the above rules) to the selected result type. - -The following unification rules apply transitively. That is, if a rule is -defined from A to B, and one from B to C, then A can unify to C. - -Number and bool types both unify with string by preferring string. - -Two collection types of the same kind unify according to the unification -of their element types. - -List and set types unify by preferring the list type. - -Map and object types unify by preferring the object type. - -List, set and tuple types unify by preferring the tuple type. - -The dynamic pseudo-type unifies with any other type by selecting that other -type. The dynamic pseudo-type is the result type only if _all_ input types -are the dynamic pseudo-type. - -Two object types unify by constructing a new type whose attributes are -the union of those of the two input types. Any common attributes themselves -have their types unified. - -Two tuple types of the same length unify constructing a new type of the -same length whose elements are the unification of the corresponding elements -in the two input types. - -## Implementation Considerations - -Implementations of this specification are free to adopt any strategy that -produces behavior consistent with the specification. This non-normative -section describes some possible implementation strategies that are consistent -with the goals of this specification. - -### Language-agnosticism - -The language-agnosticism of this specification assumes that certain behaviors -are implemented separately for each syntax: - -* Matching of a body schema with the physical elements of a body in the - source language, to determine correspondance between physical constructs - and schema elements. - -* Implementing the _dynamic attributes_ body processing mode by either - interpreting all physical constructs as attributes or producing an error - if non-attribute constructs are present. - -* Providing an evaluation function for all possible expressions that produces - a value given an evaluation context. - -The suggested implementation strategy is to use an implementation language's -closest concept to an _abstract type_, _virtual type_ or _interface type_ -to represent both Body and Expression. Each language-specific implementation -can then provide an implementation of each of these types wrapping AST nodes -or other physical constructs from the language parser. diff --git a/vendor/github.com/hashicorp/hcl2/hcl/static_expr.go b/vendor/github.com/hashicorp/hcl2/hcl/static_expr.go deleted file mode 100644 index 98ada87..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/static_expr.go +++ /dev/null @@ -1,40 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" -) - -type staticExpr struct { - val cty.Value - rng Range -} - -// StaticExpr returns an Expression that always evaluates to the given value. -// -// This is useful to substitute default values for expressions that are -// not explicitly given in configuration and thus would otherwise have no -// Expression to return. -// -// Since expressions are expected to have a source range, the caller must -// provide one. Ideally this should be a real source range, but it can -// be a synthetic one (with an empty-string filename) if no suitable range -// is available. -func StaticExpr(val cty.Value, rng Range) Expression { - return staticExpr{val, rng} -} - -func (e staticExpr) Value(ctx *EvalContext) (cty.Value, Diagnostics) { - return e.val, nil -} - -func (e staticExpr) Variables() []Traversal { - return nil -} - -func (e staticExpr) Range() Range { - return e.rng -} - -func (e staticExpr) StartRange() Range { - return e.rng -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/structure.go b/vendor/github.com/hashicorp/hcl2/hcl/structure.go deleted file mode 100644 index b336f30..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/structure.go +++ /dev/null @@ -1,151 +0,0 @@ -package hcl - -import ( - "github.com/zclconf/go-cty/cty" -) - -// File is the top-level node that results from parsing a HCL file. -type File struct { - Body Body - Bytes []byte - - // Nav is used to integrate with the "hcled" editor integration package, - // and with diagnostic information formatters. It is not for direct use - // by a calling application. - Nav interface{} -} - -// Block represents a nested block within a Body. -type Block struct { - Type string - Labels []string - Body Body - - DefRange Range // Range that can be considered the "definition" for seeking in an editor - TypeRange Range // Range for the block type declaration specifically. - LabelRanges []Range // Ranges for the label values specifically. -} - -// Blocks is a sequence of Block. -type Blocks []*Block - -// Attributes is a set of attributes keyed by their names. -type Attributes map[string]*Attribute - -// Body is a container for attributes and blocks. It serves as the primary -// unit of heirarchical structure within configuration. -// -// The content of a body cannot be meaningfully intepreted without a schema, -// so Body represents the raw body content and has methods that allow the -// content to be extracted in terms of a given schema. -type Body interface { - // Content verifies that the entire body content conforms to the given - // schema and then returns it, and/or returns diagnostics. The returned - // body content is valid if non-nil, regardless of whether Diagnostics - // are provided, but diagnostics should still be eventually shown to - // the user. - Content(schema *BodySchema) (*BodyContent, Diagnostics) - - // PartialContent is like Content except that it permits the configuration - // to contain additional blocks or attributes not specified in the - // schema. If any are present, the returned Body is non-nil and contains - // the remaining items from the body that were not selected by the schema. - PartialContent(schema *BodySchema) (*BodyContent, Body, Diagnostics) - - // JustAttributes attempts to interpret all of the contents of the body - // as attributes, allowing for the contents to be accessed without a priori - // knowledge of the structure. - // - // The behavior of this method depends on the body's source language. - // Some languages, like JSON, can't distinguish between attributes and - // blocks without schema hints, but for languages that _can_ error - // diagnostics will be generated if any blocks are present in the body. - // - // Diagnostics may be produced for other reasons too, such as duplicate - // declarations of the same attribute. - JustAttributes() (Attributes, Diagnostics) - - // MissingItemRange returns a range that represents where a missing item - // might hypothetically be inserted. This is used when producing - // diagnostics about missing required attributes or blocks. Not all bodies - // will have an obvious single insertion point, so the result here may - // be rather arbitrary. - MissingItemRange() Range -} - -// BodyContent is the result of applying a BodySchema to a Body. -type BodyContent struct { - Attributes Attributes - Blocks Blocks - - MissingItemRange Range -} - -// Attribute represents an attribute from within a body. -type Attribute struct { - Name string - Expr Expression - - Range Range - NameRange Range -} - -// Expression is a literal value or an expression provided in the -// configuration, which can be evaluated within a scope to produce a value. -type Expression interface { - // Value returns the value resulting from evaluating the expression - // in the given evaluation context. - // - // The context may be nil, in which case the expression may contain - // only constants and diagnostics will be produced for any non-constant - // sub-expressions. (The exact definition of this depends on the source - // language.) - // - // The context may instead be set but have either its Variables or - // Functions maps set to nil, in which case only use of these features - // will return diagnostics. - // - // Different diagnostics are provided depending on whether the given - // context maps are nil or empty. In the former case, the message - // tells the user that variables/functions are not permitted at all, - // while in the latter case usage will produce a "not found" error for - // the specific symbol in question. - Value(ctx *EvalContext) (cty.Value, Diagnostics) - - // Variables returns a list of variables referenced in the receiving - // expression. These are expressed as absolute Traversals, so may include - // additional information about how the variable is used, such as - // attribute lookups, which the calling application can potentially use - // to only selectively populate the scope. - Variables() []Traversal - - Range() Range - StartRange() Range -} - -// OfType filters the receiving block sequence by block type name, -// returning a new block sequence including only the blocks of the -// requested type. -func (els Blocks) OfType(typeName string) Blocks { - ret := make(Blocks, 0) - for _, el := range els { - if el.Type == typeName { - ret = append(ret, el) - } - } - return ret -} - -// ByType transforms the receiving block sequence into a map from type -// name to block sequences of only that type. -func (els Blocks) ByType() map[string]Blocks { - ret := make(map[string]Blocks) - for _, el := range els { - ty := el.Type - if ret[ty] == nil { - ret[ty] = make(Blocks, 0, 1) - } - ret[ty] = append(ret[ty], el) - } - return ret -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/traversal.go b/vendor/github.com/hashicorp/hcl2/hcl/traversal.go deleted file mode 100644 index 24f4c91..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/traversal.go +++ /dev/null @@ -1,352 +0,0 @@ -package hcl - -import ( - "fmt" - - "github.com/zclconf/go-cty/cty" -) - -// A Traversal is a description of traversing through a value through a -// series of operations such as attribute lookup, index lookup, etc. -// -// It is used to look up values in scopes, for example. -// -// The traversal operations are implementations of interface Traverser. -// This is a closed set of implementations, so the interface cannot be -// implemented from outside this package. -// -// A traversal can be absolute (its first value is a symbol name) or relative -// (starts from an existing value). -type Traversal []Traverser - -// TraversalJoin appends a relative traversal to an absolute traversal to -// produce a new absolute traversal. -func TraversalJoin(abs Traversal, rel Traversal) Traversal { - if abs.IsRelative() { - panic("first argument to TraversalJoin must be absolute") - } - if !rel.IsRelative() { - panic("second argument to TraversalJoin must be relative") - } - - ret := make(Traversal, len(abs)+len(rel)) - copy(ret, abs) - copy(ret[len(abs):], rel) - return ret -} - -// TraverseRel applies the receiving traversal to the given value, returning -// the resulting value. This is supported only for relative traversals, -// and will panic if applied to an absolute traversal. -func (t Traversal) TraverseRel(val cty.Value) (cty.Value, Diagnostics) { - if !t.IsRelative() { - panic("can't use TraverseRel on an absolute traversal") - } - - current := val - var diags Diagnostics - for _, tr := range t { - var newDiags Diagnostics - current, newDiags = tr.TraversalStep(current) - diags = append(diags, newDiags...) - if newDiags.HasErrors() { - return cty.DynamicVal, diags - } - } - return current, diags -} - -// TraverseAbs applies the receiving traversal to the given eval context, -// returning the resulting value. This is supported only for absolute -// traversals, and will panic if applied to a relative traversal. -func (t Traversal) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) { - if t.IsRelative() { - panic("can't use TraverseAbs on a relative traversal") - } - - split := t.SimpleSplit() - root := split.Abs[0].(TraverseRoot) - name := root.Name - - thisCtx := ctx - hasNonNil := false - for thisCtx != nil { - if thisCtx.Variables == nil { - thisCtx = thisCtx.parent - continue - } - hasNonNil = true - val, exists := thisCtx.Variables[name] - if exists { - return split.Rel.TraverseRel(val) - } - thisCtx = thisCtx.parent - } - - if !hasNonNil { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Variables not allowed", - Detail: "Variables may not be used here.", - Subject: &root.SrcRange, - }, - } - } - - suggestions := make([]string, 0, len(ctx.Variables)) - thisCtx = ctx - for thisCtx != nil { - for k := range thisCtx.Variables { - suggestions = append(suggestions, k) - } - thisCtx = thisCtx.parent - } - suggestion := nameSuggestion(name, suggestions) - if suggestion != "" { - suggestion = fmt.Sprintf(" Did you mean %q?", suggestion) - } - - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unknown variable", - Detail: fmt.Sprintf("There is no variable named %q.%s", name, suggestion), - Subject: &root.SrcRange, - }, - } -} - -// IsRelative returns true if the receiver is a relative traversal, or false -// otherwise. -func (t Traversal) IsRelative() bool { - if len(t) == 0 { - return true - } - if _, firstIsRoot := t[0].(TraverseRoot); firstIsRoot { - return false - } - return true -} - -// SimpleSplit returns a TraversalSplit where the name lookup is the absolute -// part and the remainder is the relative part. Supported only for -// absolute traversals, and will panic if applied to a relative traversal. -// -// This can be used by applications that have a relatively-simple variable -// namespace where only the top-level is directly populated in the scope, with -// everything else handled by relative lookups from those initial values. -func (t Traversal) SimpleSplit() TraversalSplit { - if t.IsRelative() { - panic("can't use SimpleSplit on a relative traversal") - } - return TraversalSplit{ - Abs: t[0:1], - Rel: t[1:], - } -} - -// RootName returns the root name for a absolute traversal. Will panic if -// called on a relative traversal. -func (t Traversal) RootName() string { - if t.IsRelative() { - panic("can't use RootName on a relative traversal") - - } - return t[0].(TraverseRoot).Name -} - -// SourceRange returns the source range for the traversal. -func (t Traversal) SourceRange() Range { - if len(t) == 0 { - // Nothing useful to return here, but we'll return something - // that's correctly-typed at least. - return Range{} - } - - return RangeBetween(t[0].SourceRange(), t[len(t)-1].SourceRange()) -} - -// TraversalSplit represents a pair of traversals, the first of which is -// an absolute traversal and the second of which is relative to the first. -// -// This is used by calling applications that only populate prefixes of the -// traversals in the scope, with Abs representing the part coming from the -// scope and Rel representing the remaining steps once that part is -// retrieved. -type TraversalSplit struct { - Abs Traversal - Rel Traversal -} - -// TraverseAbs traverses from a scope to the value resulting from the -// absolute traversal. -func (t TraversalSplit) TraverseAbs(ctx *EvalContext) (cty.Value, Diagnostics) { - return t.Abs.TraverseAbs(ctx) -} - -// TraverseRel traverses from a given value, assumed to be the result of -// TraverseAbs on some scope, to a final result for the entire split traversal. -func (t TraversalSplit) TraverseRel(val cty.Value) (cty.Value, Diagnostics) { - return t.Rel.TraverseRel(val) -} - -// Traverse is a convenience function to apply TraverseAbs followed by -// TraverseRel. -func (t TraversalSplit) Traverse(ctx *EvalContext) (cty.Value, Diagnostics) { - v1, diags := t.TraverseAbs(ctx) - if diags.HasErrors() { - return cty.DynamicVal, diags - } - v2, newDiags := t.TraverseRel(v1) - diags = append(diags, newDiags...) - return v2, diags -} - -// Join concatenates together the Abs and Rel parts to produce a single -// absolute traversal. -func (t TraversalSplit) Join() Traversal { - return TraversalJoin(t.Abs, t.Rel) -} - -// RootName returns the root name for the absolute part of the split. -func (t TraversalSplit) RootName() string { - return t.Abs.RootName() -} - -// A Traverser is a step within a Traversal. -type Traverser interface { - TraversalStep(cty.Value) (cty.Value, Diagnostics) - SourceRange() Range - isTraverserSigil() isTraverser -} - -// Embed this in a struct to declare it as a Traverser -type isTraverser struct { -} - -func (tr isTraverser) isTraverserSigil() isTraverser { - return isTraverser{} -} - -// TraverseRoot looks up a root name in a scope. It is used as the first step -// of an absolute Traversal, and cannot itself be traversed directly. -type TraverseRoot struct { - isTraverser - Name string - SrcRange Range -} - -// TraversalStep on a TraverseName immediately panics, because absolute -// traversals cannot be directly traversed. -func (tn TraverseRoot) TraversalStep(cty.Value) (cty.Value, Diagnostics) { - panic("Cannot traverse an absolute traversal") -} - -func (tn TraverseRoot) SourceRange() Range { - return tn.SrcRange -} - -// TraverseAttr looks up an attribute in its initial value. -type TraverseAttr struct { - isTraverser - Name string - SrcRange Range -} - -func (tn TraverseAttr) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - if val.IsNull() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Attempt to get attribute from null value", - Detail: "This value is null, so it does not have any attributes.", - Subject: &tn.SrcRange, - }, - } - } - - ty := val.Type() - switch { - case ty.IsObjectType(): - if !ty.HasAttribute(tn.Name) { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: fmt.Sprintf("This object does not have an attribute named %q.", tn.Name), - Subject: &tn.SrcRange, - }, - } - } - - if !val.IsKnown() { - return cty.UnknownVal(ty.AttributeType(tn.Name)), nil - } - - return val.GetAttr(tn.Name), nil - case ty.IsMapType(): - if !val.IsKnown() { - return cty.UnknownVal(ty.ElementType()), nil - } - - idx := cty.StringVal(tn.Name) - if val.HasIndex(idx).False() { - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Missing map element", - Detail: fmt.Sprintf("This map does not have an element with the key %q.", tn.Name), - Subject: &tn.SrcRange, - }, - } - } - - return val.Index(idx), nil - case ty == cty.DynamicPseudoType: - return cty.DynamicVal, nil - default: - return cty.DynamicVal, Diagnostics{ - { - Severity: DiagError, - Summary: "Unsupported attribute", - Detail: "This value does not have any attributes.", - Subject: &tn.SrcRange, - }, - } - } -} - -func (tn TraverseAttr) SourceRange() Range { - return tn.SrcRange -} - -// TraverseIndex applies the index operation to its initial value. -type TraverseIndex struct { - isTraverser - Key cty.Value - SrcRange Range -} - -func (tn TraverseIndex) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - return Index(val, tn.Key, &tn.SrcRange) -} - -func (tn TraverseIndex) SourceRange() Range { - return tn.SrcRange -} - -// TraverseSplat applies the splat operation to its initial value. -type TraverseSplat struct { - isTraverser - Each Traversal - SrcRange Range -} - -func (tn TraverseSplat) TraversalStep(val cty.Value) (cty.Value, Diagnostics) { - panic("TraverseSplat not yet implemented") -} - -func (tn TraverseSplat) SourceRange() Range { - return tn.SrcRange -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go b/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go deleted file mode 100644 index 4d2bd47..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr.go +++ /dev/null @@ -1,55 +0,0 @@ -package hcl - -// AbsTraversalForExpr attempts to interpret the given expression as -// an absolute traversal, or returns error diagnostic(s) if that is -// not possible for the given expression. -// -// A particular Expression implementation can support this function by -// offering a method called AsTraversal that takes no arguments and -// returns either a valid absolute traversal or nil to indicate that -// no traversal is possible. -// -// In most cases the calling application is interested in the value -// that results from an expression, but in rarer cases the application -// needs to see the the name of the variable and subsequent -// attributes/indexes itself, for example to allow users to give references -// to the variables themselves rather than to their values. An implementer -// of this function should at least support attribute and index steps. -func AbsTraversalForExpr(expr Expression) (Traversal, Diagnostics) { - type asTraversal interface { - AsTraversal() Traversal - } - - if asT, supported := expr.(asTraversal); supported { - if traversal := asT.AsTraversal(); traversal != nil { - return traversal, nil - } - } - return nil, Diagnostics{ - &Diagnostic{ - Severity: DiagError, - Summary: "Invalid expression", - Detail: "A static variable reference is required.", - Subject: expr.Range().Ptr(), - }, - } -} - -// RelTraversalForExpr is similar to AbsTraversalForExpr but it returns -// a relative traversal instead. Due to the nature of ZCL expressions, the -// first element of the returned traversal is always a TraverseAttr, and -// then it will be followed by zero or more other expressions. -// -// Any expression accepted by AbsTraversalForExpr is also accepted by -// RelTraversalForExpr. -func RelTraversalForExpr(expr Expression) (Traversal, Diagnostics) { - traversal, diags := AbsTraversalForExpr(expr) - if len(traversal) > 0 { - root := traversal[0].(TraverseRoot) - traversal[0] = TraverseAttr{ - Name: root.Name, - SrcRange: root.SrcRange, - } - } - return traversal, diags -} diff --git a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr_test.go b/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr_test.go deleted file mode 100644 index c6ba29a..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcl/traversal_for_expr_test.go +++ /dev/null @@ -1,128 +0,0 @@ -package hcl - -import ( - "testing" -) - -type asTraversalSupported struct { - staticExpr - RootName string -} - -type asTraversalNotSupported struct { - staticExpr -} - -type asTraversalDeclined struct { - staticExpr -} - -func (e asTraversalSupported) AsTraversal() Traversal { - return Traversal{ - TraverseRoot{ - Name: e.RootName, - }, - } -} - -func (e asTraversalDeclined) AsTraversal() Traversal { - return nil -} - -func TestAbsTraversalForExpr(t *testing.T) { - tests := []struct { - Expr Expression - WantRootName string - }{ - { - asTraversalSupported{RootName: "foo"}, - "foo", - }, - { - asTraversalNotSupported{}, - "", - }, - { - asTraversalDeclined{}, - "", - }, - } - - for _, test := range tests { - t.Run("", func(t *testing.T) { - got, diags := AbsTraversalForExpr(test.Expr) - switch { - case got != nil: - if test.WantRootName == "" { - t.Fatalf("traversal was returned; want error") - } - if len(got) != 1 { - t.Fatalf("wrong traversal length %d; want 1", len(got)) - } - gotRoot, ok := got[0].(TraverseRoot) - if !ok { - t.Fatalf("first traversal step is %T; want hcl.TraverseRoot", got[0]) - } - if gotRoot.Name != test.WantRootName { - t.Errorf("wrong root name %q; want %q", gotRoot.Name, test.WantRootName) - } - default: - if !diags.HasErrors() { - t.Errorf("returned nil traversal without error diagnostics") - } - if test.WantRootName != "" { - t.Errorf("traversal was not returned; want TraverseRoot(%q)", test.WantRootName) - } - } - }) - } -} - -func TestRelTraversalForExpr(t *testing.T) { - tests := []struct { - Expr Expression - WantFirstName string - }{ - { - asTraversalSupported{RootName: "foo"}, - "foo", - }, - { - asTraversalNotSupported{}, - "", - }, - { - asTraversalDeclined{}, - "", - }, - } - - for _, test := range tests { - t.Run("", func(t *testing.T) { - got, diags := RelTraversalForExpr(test.Expr) - switch { - case got != nil: - if test.WantFirstName == "" { - t.Fatalf("traversal was returned; want error") - } - if len(got) != 1 { - t.Fatalf("wrong traversal length %d; want 1", len(got)) - } - gotRoot, ok := got[0].(TraverseAttr) - if !ok { - t.Fatalf("first traversal step is %T; want hcl.TraverseAttr", got[0]) - } - if gotRoot.Name != test.WantFirstName { - t.Errorf("wrong root name %q; want %q", gotRoot.Name, test.WantFirstName) - } - default: - if !diags.HasErrors() { - t.Errorf("returned nil traversal without error diagnostics") - } - if test.WantFirstName != "" { - t.Errorf("traversal was not returned; want TraverseAttr(%q)", test.WantFirstName) - } - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go b/vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go deleted file mode 100644 index 7e652e9..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/block_labels.go +++ /dev/null @@ -1,21 +0,0 @@ -package hcldec - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -type blockLabel struct { - Value string - Range hcl.Range -} - -func labelsForBlock(block *hcl.Block) []blockLabel { - ret := make([]blockLabel, len(block.Labels)) - for i := range block.Labels { - ret[i] = blockLabel{ - Value: block.Labels[i], - Range: block.LabelRanges[i], - } - } - return ret -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/decode.go b/vendor/github.com/hashicorp/hcl2/hcldec/decode.go deleted file mode 100644 index 6cf93fe..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/decode.go +++ /dev/null @@ -1,36 +0,0 @@ -package hcldec - -import ( - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -func decode(body hcl.Body, blockLabels []blockLabel, ctx *hcl.EvalContext, spec Spec, partial bool) (cty.Value, hcl.Body, hcl.Diagnostics) { - schema := ImpliedSchema(spec) - - var content *hcl.BodyContent - var diags hcl.Diagnostics - var leftovers hcl.Body - - if partial { - content, leftovers, diags = body.PartialContent(schema) - } else { - content, diags = body.Content(schema) - } - - val, valDiags := spec.decode(content, blockLabels, ctx) - diags = append(diags, valDiags...) - - return val, leftovers, diags -} - -func impliedType(spec Spec) cty.Type { - return spec.impliedType() -} - -func sourceRange(body hcl.Body, blockLabels []blockLabel, spec Spec) hcl.Range { - schema := ImpliedSchema(spec) - content, _, _ := body.PartialContent(schema) - - return spec.sourceRange(content, blockLabels) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/doc.go b/vendor/github.com/hashicorp/hcl2/hcldec/doc.go deleted file mode 100644 index 23bfe54..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/doc.go +++ /dev/null @@ -1,12 +0,0 @@ -// Package hcldec provides a higher-level API for unpacking the content of -// HCL bodies, implemented in terms of the low-level "Content" API exposed -// by the bodies themselves. -// -// It allows decoding an entire nested configuration in a single operation -// by providing a description of the intended structure. -// -// For some applications it may be more convenient to use the "gohcl" -// package, which has a similar purpose but decodes directly into native -// Go data types. hcldec instead targets the cty type system, and thus allows -// a cty-driven application to remain within that type system. -package hcldec diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/gob.go b/vendor/github.com/hashicorp/hcl2/hcldec/gob.go deleted file mode 100644 index e2027cf..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/gob.go +++ /dev/null @@ -1,23 +0,0 @@ -package hcldec - -import ( - "encoding/gob" -) - -func init() { - // Every Spec implementation should be registered with gob, so that - // specs can be sent over gob channels, such as using - // github.com/hashicorp/go-plugin with plugins that need to describe - // what shape of configuration they are expecting. - gob.Register(ObjectSpec(nil)) - gob.Register(TupleSpec(nil)) - gob.Register((*AttrSpec)(nil)) - gob.Register((*LiteralSpec)(nil)) - gob.Register((*ExprSpec)(nil)) - gob.Register((*BlockSpec)(nil)) - gob.Register((*BlockListSpec)(nil)) - gob.Register((*BlockSetSpec)(nil)) - gob.Register((*BlockMapSpec)(nil)) - gob.Register((*BlockLabelSpec)(nil)) - gob.Register((*DefaultSpec)(nil)) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/public.go b/vendor/github.com/hashicorp/hcl2/hcldec/public.go deleted file mode 100644 index 3e58f7b..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/public.go +++ /dev/null @@ -1,53 +0,0 @@ -package hcldec - -import ( - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" -) - -// Decode interprets the given body using the given specification and returns -// the resulting value. If the given body is not valid per the spec, error -// diagnostics are returned and the returned value is likely to be incomplete. -// -// The ctx argument may be nil, in which case any references to variables or -// functions will produce error diagnostics. -func Decode(body hcl.Body, spec Spec, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - val, _, diags := decode(body, nil, ctx, spec, false) - return val, diags -} - -// PartialDecode is like Decode except that it permits "leftover" items in -// the top-level body, which are returned as a new body to allow for -// further processing. -// -// Any descendent block bodies are _not_ decoded partially and thus must -// be fully described by the given specification. -func PartialDecode(body hcl.Body, spec Spec, ctx *hcl.EvalContext) (cty.Value, hcl.Body, hcl.Diagnostics) { - return decode(body, nil, ctx, spec, true) -} - -// ImpliedType returns the value type that should result from decoding the -// given spec. -func ImpliedType(spec Spec) cty.Type { - return impliedType(spec) -} - -// SourceRange interprets the given body using the given specification and -// then returns the source range of the value that would be used to -// fulfill the spec. -// -// This can be used if application-level validation detects value errors, to -// obtain a reasonable SourceRange to use for generated diagnostics. It works -// best when applied to specific body items (e.g. using AttrSpec, BlockSpec, ...) -// as opposed to entire bodies using ObjectSpec, TupleSpec. The result will -// be less useful the broader the specification, so e.g. a spec that returns -// the entirety of all of the blocks of a given type is likely to be -// _particularly_ arbitrary and useless. -// -// If the given body is not valid per the given spec, the result is best-effort -// and may not actually be something ideal. It's expected that an application -// will already have used Decode or PartialDecode earlier and thus had an -// opportunity to detect and report spec violations. -func SourceRange(body hcl.Body, spec Spec) hcl.Range { - return sourceRange(body, nil, spec) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/public_test.go b/vendor/github.com/hashicorp/hcl2/hcldec/public_test.go deleted file mode 100644 index 23406dc..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/public_test.go +++ /dev/null @@ -1,618 +0,0 @@ -package hcldec - -import ( - "fmt" - "reflect" - "testing" - - "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/zclconf/go-cty/cty" -) - -func TestDecode(t *testing.T) { - tests := []struct { - config string - spec Spec - ctx *hcl.EvalContext - want cty.Value - diagCount int - }{ - { - ``, - &ObjectSpec{}, - nil, - cty.EmptyObjectVal, - 0, - }, - { - "a = 1\n", - &ObjectSpec{}, - nil, - cty.EmptyObjectVal, - 1, // attribute named "a" is not expected here - }, - { - "a = 1\n", - &ObjectSpec{ - "a": &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - }, - nil, - cty.ObjectVal(map[string]cty.Value{ - "a": cty.NumberIntVal(1), - }), - 0, - }, - { - "a = 1\n", - &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - nil, - cty.NumberIntVal(1), - 0, - }, - { - "a = 1\n", - &DefaultSpec{ - Primary: &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - Default: &LiteralSpec{ - Value: cty.NumberIntVal(10), - }, - }, - nil, - cty.NumberIntVal(1), - 0, - }, - { - "", - &DefaultSpec{ - Primary: &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - Default: &LiteralSpec{ - Value: cty.NumberIntVal(10), - }, - }, - nil, - cty.NumberIntVal(10), - 0, - }, - { - "a = 1\n", - ObjectSpec{ - "foo": &DefaultSpec{ - Primary: &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - Default: &LiteralSpec{ - Value: cty.NumberIntVal(10), - }, - }, - }, - nil, - cty.ObjectVal(map[string]cty.Value{"foo": cty.NumberIntVal(1)}), - 0, - }, - { - "a = \"1\"\n", - &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - nil, - cty.NumberIntVal(1), - 0, - }, - { - "a = true\n", - &AttrSpec{ - Name: "a", - Type: cty.Number, - }, - nil, - cty.UnknownVal(cty.Number), - 1, // incorrect type - number required. - }, - { - ``, - &AttrSpec{ - Name: "a", - Type: cty.Number, - Required: true, - }, - nil, - cty.NullVal(cty.Number), - 1, // attribute "a" is required - }, - - { - ` -b { -} -`, - &BlockSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - }, - nil, - cty.EmptyObjectVal, - 0, - }, - { - ` -b "baz" { -} -`, - &BlockSpec{ - TypeName: "b", - Nested: &BlockLabelSpec{ - Index: 0, - Name: "name", - }, - }, - nil, - cty.StringVal("baz"), - 0, - }, - { - ` -b "baz" {} -b "foo" {} -`, - &BlockSpec{ - TypeName: "b", - Nested: &BlockLabelSpec{ - Index: 0, - Name: "name", - }, - }, - nil, - cty.StringVal("baz"), - 1, // duplicate "b" block - }, - { - ` -b { -} -`, - &BlockSpec{ - TypeName: "b", - Nested: &BlockLabelSpec{ - Index: 0, - Name: "name", - }, - }, - nil, - cty.NullVal(cty.String), - 1, // missing name label - }, - { - ``, - &BlockSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - }, - nil, - cty.NullVal(cty.EmptyObject), - 0, - }, - { - "a {}\n", - &BlockSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - }, - nil, - cty.NullVal(cty.EmptyObject), - 1, // blocks of type "a" are not supported - }, - { - ``, - &BlockSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - Required: true, - }, - nil, - cty.NullVal(cty.EmptyObject), - 1, // a block of type "b" is required - }, - { - ` -b {} -b {} -`, - &BlockSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - Required: true, - }, - nil, - cty.EmptyObjectVal, - 1, // only one "b" block is allowed - }, - { - ` -b {} -b {} -`, - &BlockListSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - }, - nil, - cty.ListVal([]cty.Value{cty.EmptyObjectVal, cty.EmptyObjectVal}), - 0, - }, - { - ``, - &BlockListSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - }, - nil, - cty.ListValEmpty(cty.EmptyObject), - 0, - }, - { - ` -b "foo" {} -b "bar" {} -`, - &BlockListSpec{ - TypeName: "b", - Nested: &BlockLabelSpec{ - Name: "name", - Index: 0, - }, - }, - nil, - cty.ListVal([]cty.Value{cty.StringVal("foo"), cty.StringVal("bar")}), - 0, - }, - { - ` -b {} -b {} -b {} -`, - &BlockListSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - MaxItems: 2, - }, - nil, - cty.ListVal([]cty.Value{cty.EmptyObjectVal, cty.EmptyObjectVal, cty.EmptyObjectVal}), - 1, // too many b blocks - }, - { - ` -b {} -b {} -`, - &BlockListSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - MinItems: 10, - }, - nil, - cty.ListVal([]cty.Value{cty.EmptyObjectVal, cty.EmptyObjectVal}), - 1, // insufficient b blocks - }, - { - ` -b {} -b {} -`, - &BlockSetSpec{ - TypeName: "b", - Nested: ObjectSpec{}, - MaxItems: 2, - }, - nil, - cty.SetVal([]cty.Value{cty.EmptyObjectVal, cty.EmptyObjectVal}), - 0, - }, - { - ` -b "foo" "bar" {} -b "bar" "baz" {} -`, - &BlockSetSpec{ - TypeName: "b", - Nested: TupleSpec{ - &BlockLabelSpec{ - Name: "name", - Index: 1, - }, - &BlockLabelSpec{ - Name: "type", - Index: 0, - }, - }, - }, - nil, - cty.SetVal([]cty.Value{ - cty.TupleVal([]cty.Value{cty.StringVal("bar"), cty.StringVal("foo")}), - cty.TupleVal([]cty.Value{cty.StringVal("baz"), cty.StringVal("bar")}), - }), - 0, - }, - { - ` -b "foo" {} -b "bar" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{"foo": cty.EmptyObjectVal, "bar": cty.EmptyObjectVal}), - 0, - }, - { - ` -b "foo" "bar" {} -b "bar" "baz" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key1", "key2"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{ - "foo": cty.MapVal(map[string]cty.Value{ - "bar": cty.EmptyObjectVal, - }), - "bar": cty.MapVal(map[string]cty.Value{ - "baz": cty.EmptyObjectVal, - }), - }), - 0, - }, - { - ` -b "foo" "bar" {} -b "bar" "bar" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key1", "key2"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{ - "foo": cty.MapVal(map[string]cty.Value{ - "bar": cty.EmptyObjectVal, - }), - "bar": cty.MapVal(map[string]cty.Value{ - "bar": cty.EmptyObjectVal, - }), - }), - 0, - }, - { - ` -b "foo" "bar" {} -b "foo" "baz" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key1", "key2"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{ - "foo": cty.MapVal(map[string]cty.Value{ - "bar": cty.EmptyObjectVal, - "baz": cty.EmptyObjectVal, - }), - }), - 0, - }, - { - ` -b "foo" "bar" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapValEmpty(cty.EmptyObject), - 1, // too many labels - }, - { - ` -b "bar" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key1", "key2"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapValEmpty(cty.EmptyObject), - 1, // not enough labels - }, - { - ` -b "foo" {} -b "foo" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{"foo": cty.EmptyObjectVal}), - 1, // duplicate b block - }, - { - ` -b "foo" "bar" {} -b "foo" "bar" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"key1", "key2"}, - Nested: ObjectSpec{}, - }, - nil, - cty.MapVal(map[string]cty.Value{"foo": cty.MapVal(map[string]cty.Value{"bar": cty.EmptyObjectVal})}), - 1, // duplicate b block - }, - { - ` -b "foo" "bar" {} -b "bar" "baz" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"type"}, - Nested: &BlockLabelSpec{ - Name: "name", - Index: 0, - }, - }, - nil, - cty.MapVal(map[string]cty.Value{ - "foo": cty.StringVal("bar"), - "bar": cty.StringVal("baz"), - }), - 0, - }, - { - ` -b "foo" {} -`, - &BlockMapSpec{ - TypeName: "b", - LabelNames: []string{"type"}, - Nested: &BlockLabelSpec{ - Name: "name", - Index: 0, - }, - }, - nil, - cty.MapValEmpty(cty.String), - 1, // missing name - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.config), func(t *testing.T) { - file, parseDiags := hclsyntax.ParseConfig([]byte(test.config), "", hcl.Pos{Line: 1, Column: 1, Byte: 0}) - body := file.Body - got, valDiags := Decode(body, test.spec, test.ctx) - - var diags hcl.Diagnostics - diags = append(diags, parseDiags...) - diags = append(diags, valDiags...) - - if len(diags) != test.diagCount { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), test.diagCount) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - - if !got.RawEquals(test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } -} - -func TestSourceRange(t *testing.T) { - tests := []struct { - config string - spec Spec - want hcl.Range - }{ - { - "a = 1\n", - &AttrSpec{ - Name: "a", - }, - hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 6, Byte: 5}, - }, - }, - { - ` -b { - a = 1 -} -`, - &BlockSpec{ - TypeName: "b", - Nested: &AttrSpec{ - Name: "a", - }, - }, - hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 7, Byte: 11}, - End: hcl.Pos{Line: 3, Column: 8, Byte: 12}, - }, - }, - { - ` -b { - c { - a = 1 - } -} -`, - &BlockSpec{ - TypeName: "b", - Nested: &BlockSpec{ - TypeName: "c", - Nested: &AttrSpec{ - Name: "a", - }, - }, - }, - hcl.Range{ - Start: hcl.Pos{Line: 4, Column: 9, Byte: 19}, - End: hcl.Pos{Line: 4, Column: 10, Byte: 20}, - }, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.config), func(t *testing.T) { - file, diags := hclsyntax.ParseConfig([]byte(test.config), "", hcl.Pos{Line: 1, Column: 1, Byte: 0}) - if len(diags) != 0 { - t.Errorf("wrong number of diagnostics %d; want %d", len(diags), 0) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - body := file.Body - - got := SourceRange(body, test.spec) - - if !reflect.DeepEqual(got, test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } - -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/schema.go b/vendor/github.com/hashicorp/hcl2/hcldec/schema.go deleted file mode 100644 index b57bd96..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/schema.go +++ /dev/null @@ -1,36 +0,0 @@ -package hcldec - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -// ImpliedSchema returns the *hcl.BodySchema implied by the given specification. -// This is the schema that the Decode function will use internally to -// access the content of a given body. -func ImpliedSchema(spec Spec) *hcl.BodySchema { - var attrs []hcl.AttributeSchema - var blocks []hcl.BlockHeaderSchema - - // visitSameBodyChildren walks through the spec structure, calling - // the given callback for each descendent spec encountered. We are - // interested in the specs that reference attributes and blocks. - var visit visitFunc - visit = func(s Spec) { - if as, ok := s.(attrSpec); ok { - attrs = append(attrs, as.attrSchemata()...) - } - - if bs, ok := s.(blockSpec); ok { - blocks = append(blocks, bs.blockHeaderSchemata()...) - } - - s.visitSameBodyChildren(visit) - } - - visit(spec) - - return &hcl.BodySchema{ - Attributes: attrs, - Blocks: blocks, - } -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/spec.go b/vendor/github.com/hashicorp/hcl2/hcldec/spec.go deleted file mode 100644 index f0e6842..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/spec.go +++ /dev/null @@ -1,859 +0,0 @@ -package hcldec - -import ( - "bytes" - "fmt" - - "github.com/hashicorp/hcl2/hcl" - "github.com/zclconf/go-cty/cty" - "github.com/zclconf/go-cty/cty/convert" -) - -// A Spec is a description of how to decode a hcl.Body to a cty.Value. -// -// The various other types in this package whose names end in "Spec" are -// the spec implementations. The most common top-level spec is ObjectSpec, -// which decodes body content into a cty.Value of an object type. -type Spec interface { - // Perform the decode operation on the given body, in the context of - // the given block (which might be null), using the given eval context. - // - // "block" is provided only by the nested calls performed by the spec - // types that work on block bodies. - decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) - - // Return the cty.Type that should be returned when decoding a body with - // this spec. - impliedType() cty.Type - - // Call the given callback once for each of the nested specs that would - // get decoded with the same body and block as the receiver. This should - // not descend into the nested specs used when decoding blocks. - visitSameBodyChildren(cb visitFunc) - - // Determine the source range of the value that would be returned for the - // spec in the given content, in the context of the given block - // (which might be null). If the corresponding item is missing, return - // a place where it might be inserted. - sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range -} - -type visitFunc func(spec Spec) - -// An ObjectSpec is a Spec that produces a cty.Value of an object type whose -// attributes correspond to the keys of the spec map. -type ObjectSpec map[string]Spec - -// attrSpec is implemented by specs that require attributes from the body. -type attrSpec interface { - attrSchemata() []hcl.AttributeSchema -} - -// blockSpec is implemented by specs that require blocks from the body. -type blockSpec interface { - blockHeaderSchemata() []hcl.BlockHeaderSchema -} - -// specNeedingVariables is implemented by specs that can use variables -// from the EvalContext, to declare which variables they need. -type specNeedingVariables interface { - variablesNeeded(content *hcl.BodyContent) []hcl.Traversal -} - -func (s ObjectSpec) visitSameBodyChildren(cb visitFunc) { - for _, c := range s { - cb(c) - } -} - -func (s ObjectSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - vals := make(map[string]cty.Value, len(s)) - var diags hcl.Diagnostics - - for k, spec := range s { - var kd hcl.Diagnostics - vals[k], kd = spec.decode(content, blockLabels, ctx) - diags = append(diags, kd...) - } - - return cty.ObjectVal(vals), diags -} - -func (s ObjectSpec) impliedType() cty.Type { - if len(s) == 0 { - return cty.EmptyObject - } - - attrTypes := make(map[string]cty.Type) - for k, childSpec := range s { - attrTypes[k] = childSpec.impliedType() - } - return cty.Object(attrTypes) -} - -func (s ObjectSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // This is not great, but the best we can do. In practice, it's rather - // strange to ask for the source range of an entire top-level body, since - // that's already readily available to the caller. - return content.MissingItemRange -} - -// A TupleSpec is a Spec that produces a cty.Value of a tuple type whose -// elements correspond to the elements of the spec slice. -type TupleSpec []Spec - -func (s TupleSpec) visitSameBodyChildren(cb visitFunc) { - for _, c := range s { - cb(c) - } -} - -func (s TupleSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - vals := make([]cty.Value, len(s)) - var diags hcl.Diagnostics - - for i, spec := range s { - var ed hcl.Diagnostics - vals[i], ed = spec.decode(content, blockLabels, ctx) - diags = append(diags, ed...) - } - - return cty.TupleVal(vals), diags -} - -func (s TupleSpec) impliedType() cty.Type { - if len(s) == 0 { - return cty.EmptyTuple - } - - attrTypes := make([]cty.Type, len(s)) - for i, childSpec := range s { - attrTypes[i] = childSpec.impliedType() - } - return cty.Tuple(attrTypes) -} - -func (s TupleSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // This is not great, but the best we can do. In practice, it's rather - // strange to ask for the source range of an entire top-level body, since - // that's already readily available to the caller. - return content.MissingItemRange -} - -// An AttrSpec is a Spec that evaluates a particular attribute expression in -// the body and returns its resulting value converted to the requested type, -// or produces a diagnostic if the type is incorrect. -type AttrSpec struct { - Name string - Type cty.Type - Required bool -} - -func (s *AttrSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node -} - -// specNeedingVariables implementation -func (s *AttrSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - attr, exists := content.Attributes[s.Name] - if !exists { - return nil - } - - return attr.Expr.Variables() -} - -// attrSpec implementation -func (s *AttrSpec) attrSchemata() []hcl.AttributeSchema { - return []hcl.AttributeSchema{ - { - Name: s.Name, - Required: s.Required, - }, - } -} - -func (s *AttrSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - attr, exists := content.Attributes[s.Name] - if !exists { - return content.MissingItemRange - } - - return attr.Expr.Range() -} - -func (s *AttrSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - attr, exists := content.Attributes[s.Name] - if !exists { - // We don't need to check required and emit a diagnostic here, because - // that would already have happened when building "content". - return cty.NullVal(s.Type), nil - } - - val, diags := attr.Expr.Value(ctx) - - convVal, err := convert.Convert(val, s.Type) - if err != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: "Incorrect attribute value type", - Detail: fmt.Sprintf( - "Inappropriate value for attribute %q: %s.", - s.Name, err.Error(), - ), - Subject: attr.Expr.StartRange().Ptr(), - Context: hcl.RangeBetween(attr.NameRange, attr.Expr.StartRange()).Ptr(), - }) - // We'll return an unknown value of the _correct_ type so that the - // incomplete result can still be used for some analysis use-cases. - val = cty.UnknownVal(s.Type) - } else { - val = convVal - } - - return val, diags -} - -func (s *AttrSpec) impliedType() cty.Type { - return s.Type -} - -// A LiteralSpec is a Spec that produces the given literal value, ignoring -// the given body. -type LiteralSpec struct { - Value cty.Value -} - -func (s *LiteralSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node -} - -func (s *LiteralSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return s.Value, nil -} - -func (s *LiteralSpec) impliedType() cty.Type { - return s.Value.Type() -} - -func (s *LiteralSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // No sensible range to return for a literal, so the caller had better - // ensure it doesn't cause any diagnostics. - return hcl.Range{ - Filename: "", - } -} - -// An ExprSpec is a Spec that evaluates the given expression, ignoring the -// given body. -type ExprSpec struct { - Expr hcl.Expression -} - -func (s *ExprSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node -} - -// specNeedingVariables implementation -func (s *ExprSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - return s.Expr.Variables() -} - -func (s *ExprSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - return s.Expr.Value(ctx) -} - -func (s *ExprSpec) impliedType() cty.Type { - // We can't know the type of our expression until we evaluate it - return cty.DynamicPseudoType -} - -func (s *ExprSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - return s.Expr.Range() -} - -// A BlockSpec is a Spec that produces a cty.Value by decoding the contents -// of a single nested block of a given type, using a nested spec. -// -// If the Required flag is not set, the nested block may be omitted, in which -// case a null value is produced. If it _is_ set, an error diagnostic is -// produced if there are no nested blocks of the given type. -type BlockSpec struct { - TypeName string - Nested Spec - Required bool -} - -func (s *BlockSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node ("Nested" does not use the same body) -} - -// blockSpec implementation -func (s *BlockSpec) blockHeaderSchemata() []hcl.BlockHeaderSchema { - return []hcl.BlockHeaderSchema{ - { - Type: s.TypeName, - LabelNames: findLabelSpecs(s.Nested), - }, - } -} - -// specNeedingVariables implementation -func (s *BlockSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - childBlock = candidate - break - } - - if childBlock == nil { - return nil - } - - return Variables(childBlock.Body, s.Nested) -} - -func (s *BlockSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - if childBlock != nil { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Duplicate %s block", s.TypeName), - Detail: fmt.Sprintf( - "Only one block of type %q is allowed. Previous definition was at %s.", - s.TypeName, childBlock.DefRange.String(), - ), - Subject: &candidate.DefRange, - }) - break - } - - childBlock = candidate - } - - if childBlock == nil { - if s.Required { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Missing %s block", s.TypeName), - Detail: fmt.Sprintf( - "A block of type %q is required here.", s.TypeName, - ), - Subject: &content.MissingItemRange, - }) - } - return cty.NullVal(s.Nested.impliedType()), diags - } - - if s.Nested == nil { - panic("BlockSpec with no Nested Spec") - } - val, _, childDiags := decode(childBlock.Body, labelsForBlock(childBlock), ctx, s.Nested, false) - diags = append(diags, childDiags...) - return val, diags -} - -func (s *BlockSpec) impliedType() cty.Type { - return s.Nested.impliedType() -} - -func (s *BlockSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - childBlock = candidate - break - } - - if childBlock == nil { - return content.MissingItemRange - } - - return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested) -} - -// A BlockListSpec is a Spec that produces a cty list of the results of -// decoding all of the nested blocks of a given type, using a nested spec. -type BlockListSpec struct { - TypeName string - Nested Spec - MinItems int - MaxItems int -} - -func (s *BlockListSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node ("Nested" does not use the same body) -} - -// blockSpec implementation -func (s *BlockListSpec) blockHeaderSchemata() []hcl.BlockHeaderSchema { - return []hcl.BlockHeaderSchema{ - { - Type: s.TypeName, - LabelNames: findLabelSpecs(s.Nested), - }, - } -} - -// specNeedingVariables implementation -func (s *BlockListSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - var ret []hcl.Traversal - - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - ret = append(ret, Variables(childBlock.Body, s.Nested)...) - } - - return ret -} - -func (s *BlockListSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - if s.Nested == nil { - panic("BlockListSpec with no Nested Spec") - } - - var elems []cty.Value - var sourceRanges []hcl.Range - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - val, _, childDiags := decode(childBlock.Body, labelsForBlock(childBlock), ctx, s.Nested, false) - diags = append(diags, childDiags...) - elems = append(elems, val) - sourceRanges = append(sourceRanges, sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested)) - } - - if len(elems) < s.MinItems { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Insufficient %s blocks", s.TypeName), - Detail: fmt.Sprintf("At least %d %q blocks are required.", s.MinItems, s.TypeName), - Subject: &content.MissingItemRange, - }) - } else if s.MaxItems > 0 && len(elems) > s.MaxItems { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Too many %s blocks", s.TypeName), - Detail: fmt.Sprintf("No more than %d %q blocks are allowed", s.MaxItems, s.TypeName), - Subject: &sourceRanges[s.MaxItems], - }) - } - - var ret cty.Value - - if len(elems) == 0 { - ret = cty.ListValEmpty(s.Nested.impliedType()) - } else { - ret = cty.ListVal(elems) - } - - return ret, diags -} - -func (s *BlockListSpec) impliedType() cty.Type { - return cty.List(s.Nested.impliedType()) -} - -func (s *BlockListSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // We return the source range of the _first_ block of the given type, - // since they are not guaranteed to form a contiguous range. - - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - childBlock = candidate - break - } - - if childBlock == nil { - return content.MissingItemRange - } - - return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested) -} - -// A BlockSetSpec is a Spec that produces a cty set of the results of -// decoding all of the nested blocks of a given type, using a nested spec. -type BlockSetSpec struct { - TypeName string - Nested Spec - MinItems int - MaxItems int -} - -func (s *BlockSetSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node ("Nested" does not use the same body) -} - -// blockSpec implementation -func (s *BlockSetSpec) blockHeaderSchemata() []hcl.BlockHeaderSchema { - return []hcl.BlockHeaderSchema{ - { - Type: s.TypeName, - LabelNames: findLabelSpecs(s.Nested), - }, - } -} - -// specNeedingVariables implementation -func (s *BlockSetSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - var ret []hcl.Traversal - - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - ret = append(ret, Variables(childBlock.Body, s.Nested)...) - } - - return ret -} - -func (s *BlockSetSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - if s.Nested == nil { - panic("BlockSetSpec with no Nested Spec") - } - - var elems []cty.Value - var sourceRanges []hcl.Range - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - val, _, childDiags := decode(childBlock.Body, labelsForBlock(childBlock), ctx, s.Nested, false) - diags = append(diags, childDiags...) - elems = append(elems, val) - sourceRanges = append(sourceRanges, sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested)) - } - - if len(elems) < s.MinItems { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Insufficient %s blocks", s.TypeName), - Detail: fmt.Sprintf("At least %d %q blocks are required.", s.MinItems, s.TypeName), - Subject: &content.MissingItemRange, - }) - } else if s.MaxItems > 0 && len(elems) > s.MaxItems { - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Too many %s blocks", s.TypeName), - Detail: fmt.Sprintf("No more than %d %q blocks are allowed", s.MaxItems, s.TypeName), - Subject: &sourceRanges[s.MaxItems], - }) - } - - var ret cty.Value - - if len(elems) == 0 { - ret = cty.SetValEmpty(s.Nested.impliedType()) - } else { - ret = cty.SetVal(elems) - } - - return ret, diags -} - -func (s *BlockSetSpec) impliedType() cty.Type { - return cty.Set(s.Nested.impliedType()) -} - -func (s *BlockSetSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // We return the source range of the _first_ block of the given type, - // since they are not guaranteed to form a contiguous range. - - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - childBlock = candidate - break - } - - if childBlock == nil { - return content.MissingItemRange - } - - return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested) -} - -// A BlockMapSpec is a Spec that produces a cty map of the results of -// decoding all of the nested blocks of a given type, using a nested spec. -// -// One level of map structure is created for each of the given label names. -// There must be at least one given label name. -type BlockMapSpec struct { - TypeName string - LabelNames []string - Nested Spec -} - -func (s *BlockMapSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node ("Nested" does not use the same body) -} - -// blockSpec implementation -func (s *BlockMapSpec) blockHeaderSchemata() []hcl.BlockHeaderSchema { - return []hcl.BlockHeaderSchema{ - { - Type: s.TypeName, - LabelNames: append(s.LabelNames, findLabelSpecs(s.Nested)...), - }, - } -} - -// specNeedingVariables implementation -func (s *BlockMapSpec) variablesNeeded(content *hcl.BodyContent) []hcl.Traversal { - var ret []hcl.Traversal - - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - ret = append(ret, Variables(childBlock.Body, s.Nested)...) - } - - return ret -} - -func (s *BlockMapSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - var diags hcl.Diagnostics - - if s.Nested == nil { - panic("BlockSetSpec with no Nested Spec") - } - - elems := map[string]interface{}{} - for _, childBlock := range content.Blocks { - if childBlock.Type != s.TypeName { - continue - } - - childLabels := labelsForBlock(childBlock) - val, _, childDiags := decode(childBlock.Body, childLabels[len(s.LabelNames):], ctx, s.Nested, false) - targetMap := elems - for _, key := range childBlock.Labels[:len(s.LabelNames)-1] { - if _, exists := targetMap[key]; !exists { - targetMap[key] = make(map[string]interface{}) - } - targetMap = targetMap[key].(map[string]interface{}) - } - - diags = append(diags, childDiags...) - - key := childBlock.Labels[len(s.LabelNames)-1] - if _, exists := targetMap[key]; exists { - labelsBuf := bytes.Buffer{} - for _, label := range childBlock.Labels { - fmt.Fprintf(&labelsBuf, " %q", label) - } - diags = append(diags, &hcl.Diagnostic{ - Severity: hcl.DiagError, - Summary: fmt.Sprintf("Duplicate %s block", s.TypeName), - Detail: fmt.Sprintf( - "A block for %s%s was already defined. The %s labels must be unique.", - s.TypeName, labelsBuf.String(), s.TypeName, - ), - Subject: &childBlock.DefRange, - }) - continue - } - - targetMap[key] = val - } - - if len(elems) == 0 { - return cty.MapValEmpty(s.Nested.impliedType()), diags - } - - var ctyMap func(map[string]interface{}, int) cty.Value - ctyMap = func(raw map[string]interface{}, depth int) cty.Value { - vals := make(map[string]cty.Value, len(raw)) - if depth == 1 { - for k, v := range raw { - vals[k] = v.(cty.Value) - } - } else { - for k, v := range raw { - vals[k] = ctyMap(v.(map[string]interface{}), depth-1) - } - } - return cty.MapVal(vals) - } - - return ctyMap(elems, len(s.LabelNames)), diags -} - -func (s *BlockMapSpec) impliedType() cty.Type { - ret := s.Nested.impliedType() - for _ = range s.LabelNames { - ret = cty.Map(ret) - } - return ret -} - -func (s *BlockMapSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // We return the source range of the _first_ block of the given type, - // since they are not guaranteed to form a contiguous range. - - var childBlock *hcl.Block - for _, candidate := range content.Blocks { - if candidate.Type != s.TypeName { - continue - } - - childBlock = candidate - break - } - - if childBlock == nil { - return content.MissingItemRange - } - - return sourceRange(childBlock.Body, labelsForBlock(childBlock), s.Nested) -} - -// A BlockLabelSpec is a Spec that returns a cty.String representing the -// label of the block its given body belongs to, if indeed its given body -// belongs to a block. It is a programming error to use this in a non-block -// context, so this spec will panic in that case. -// -// This spec only works in the nested spec within a BlockSpec, BlockListSpec, -// BlockSetSpec or BlockMapSpec. -// -// The full set of label specs used against a particular block must have a -// consecutive set of indices starting at zero. The maximum index found -// defines how many labels the corresponding blocks must have in cty source. -type BlockLabelSpec struct { - Index int - Name string -} - -func (s *BlockLabelSpec) visitSameBodyChildren(cb visitFunc) { - // leaf node -} - -func (s *BlockLabelSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - if s.Index >= len(blockLabels) { - panic("BlockListSpec used in non-block context") - } - - return cty.StringVal(blockLabels[s.Index].Value), nil -} - -func (s *BlockLabelSpec) impliedType() cty.Type { - return cty.String // labels are always strings -} - -func (s *BlockLabelSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - if s.Index >= len(blockLabels) { - panic("BlockListSpec used in non-block context") - } - - return blockLabels[s.Index].Range -} - -func findLabelSpecs(spec Spec) []string { - maxIdx := -1 - var names map[int]string - - var visit visitFunc - visit = func(s Spec) { - if ls, ok := s.(*BlockLabelSpec); ok { - if maxIdx < ls.Index { - maxIdx = ls.Index - } - if names == nil { - names = make(map[int]string) - } - names[ls.Index] = ls.Name - } - s.visitSameBodyChildren(visit) - } - - visit(spec) - - if maxIdx < 0 { - return nil // no labels at all - } - - ret := make([]string, maxIdx+1) - for i := range ret { - name := names[i] - if name == "" { - // Should never happen if the spec is conformant, since we require - // consecutive indices starting at zero. - name = fmt.Sprintf("missing%02d", i) - } - ret[i] = name - } - - return ret -} - -// DefaultSpec is a spec that wraps two specs, evaluating the primary first -// and then evaluating the default if the primary returns a null value. -// -// The two specifications must have the same implied result type for correct -// operation. If not, the result is undefined. -type DefaultSpec struct { - Primary Spec - Default Spec -} - -func (s *DefaultSpec) visitSameBodyChildren(cb visitFunc) { - cb(s.Primary) - cb(s.Default) -} - -func (s *DefaultSpec) decode(content *hcl.BodyContent, blockLabels []blockLabel, ctx *hcl.EvalContext) (cty.Value, hcl.Diagnostics) { - val, diags := s.Primary.decode(content, blockLabels, ctx) - if val.IsNull() { - var moreDiags hcl.Diagnostics - val, moreDiags = s.Default.decode(content, blockLabels, ctx) - diags = append(diags, moreDiags...) - } - return val, diags -} - -func (s *DefaultSpec) impliedType() cty.Type { - return s.Primary.impliedType() -} - -func (s *DefaultSpec) sourceRange(content *hcl.BodyContent, blockLabels []blockLabel) hcl.Range { - // We can't tell from here which of the two specs will ultimately be used - // in our result, so we'll just assume the first. This is usually the right - // choice because the default is often a literal spec that doesn't have a - // reasonable source range to return anyway. - return s.Primary.sourceRange(content, blockLabels) -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/spec_test.go b/vendor/github.com/hashicorp/hcl2/hcldec/spec_test.go deleted file mode 100644 index 7086f9f..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/spec_test.go +++ /dev/null @@ -1,14 +0,0 @@ -package hcldec - -// Verify that all of our spec types implement the necessary interfaces -var objectSpecAsSpec Spec = ObjectSpec(nil) -var tupleSpecAsSpec Spec = TupleSpec(nil) -var attrSpecAsSpec Spec = (*AttrSpec)(nil) -var literalSpecAsSpec Spec = (*LiteralSpec)(nil) -var exprSpecAsSpec Spec = (*ExprSpec)(nil) -var blockSpecAsSpec Spec = (*BlockSpec)(nil) -var blockListSpecAsSpec Spec = (*BlockListSpec)(nil) -var blockSetSpecAsSpec Spec = (*BlockSetSpec)(nil) -var blockMapSpecAsSpec Spec = (*BlockMapSpec)(nil) -var blockLabelSpecAsSpec Spec = (*BlockLabelSpec)(nil) -var defaultSpecAsSpec Spec = (*DefaultSpec)(nil) diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/variables.go b/vendor/github.com/hashicorp/hcl2/hcldec/variables.go deleted file mode 100644 index 427b0d0..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/variables.go +++ /dev/null @@ -1,34 +0,0 @@ -package hcldec - -import ( - "github.com/hashicorp/hcl2/hcl" -) - -// Variables processes the given body with the given spec and returns a -// list of the variable traversals that would be required to decode -// the same pairing of body and spec. -// -// This can be used to conditionally populate the variables in the EvalContext -// passed to Decode, for applications where a static scope is insufficient. -// -// If the given body is not compliant with the given schema, the result may -// be incomplete, but that's assumed to be okay because the eventual call -// to Decode will produce error diagnostics anyway. -func Variables(body hcl.Body, spec Spec) []hcl.Traversal { - schema := ImpliedSchema(spec) - - content, _, _ := body.PartialContent(schema) - - var vars []hcl.Traversal - - if vs, ok := spec.(specNeedingVariables); ok { - vars = append(vars, vs.variablesNeeded(content)...) - } - spec.visitSameBodyChildren(func(s Spec) { - if vs, ok := s.(specNeedingVariables); ok { - vars = append(vars, vs.variablesNeeded(content)...) - } - }) - - return vars -} diff --git a/vendor/github.com/hashicorp/hcl2/hcldec/variables_test.go b/vendor/github.com/hashicorp/hcl2/hcldec/variables_test.go deleted file mode 100644 index ee1eb18..0000000 --- a/vendor/github.com/hashicorp/hcl2/hcldec/variables_test.go +++ /dev/null @@ -1,148 +0,0 @@ -package hcldec - -import ( - "fmt" - "reflect" - "testing" - - "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/hcl2/hcl" -) - -func TestVariables(t *testing.T) { - tests := []struct { - config string - spec Spec - want []hcl.Traversal - }{ - { - ``, - &ObjectSpec{}, - nil, - }, - { - "a = foo\n", - &ObjectSpec{}, - nil, // "a" is not actually used, so "foo" is not required - }, - { - "a = foo\n", - &AttrSpec{ - Name: "a", - }, - []hcl.Traversal{ - { - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - }, - }, - }, - }, - { - "a = foo\n", - &ObjectSpec{ - "a": &AttrSpec{ - Name: "a", - }, - }, - []hcl.Traversal{ - { - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 1, Column: 5, Byte: 4}, - End: hcl.Pos{Line: 1, Column: 8, Byte: 7}, - }, - }, - }, - }, - }, - { - ` -b { - a = foo -} -`, - &BlockSpec{ - TypeName: "b", - Nested: &AttrSpec{ - Name: "a", - }, - }, - []hcl.Traversal{ - { - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 7, Byte: 11}, - End: hcl.Pos{Line: 3, Column: 10, Byte: 14}, - }, - }, - }, - }, - }, - { - ` -b { - a = foo -} -b { - a = bar -} -c { - a = baz -} -`, - &BlockListSpec{ - TypeName: "b", - Nested: &AttrSpec{ - Name: "a", - }, - }, - []hcl.Traversal{ - { - hcl.TraverseRoot{ - Name: "foo", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 3, Column: 7, Byte: 11}, - End: hcl.Pos{Line: 3, Column: 10, Byte: 14}, - }, - }, - }, - { - hcl.TraverseRoot{ - Name: "bar", - SrcRange: hcl.Range{ - Start: hcl.Pos{Line: 6, Column: 7, Byte: 27}, - End: hcl.Pos{Line: 6, Column: 10, Byte: 30}, - }, - }, - }, - }, - }, - } - - for i, test := range tests { - t.Run(fmt.Sprintf("%02d-%s", i, test.config), func(t *testing.T) { - file, diags := hclsyntax.ParseConfig([]byte(test.config), "", hcl.Pos{Line: 1, Column: 1, Byte: 0}) - if len(diags) != 0 { - t.Errorf("wrong number of diagnostics from ParseConfig %d; want %d", len(diags), 0) - for _, diag := range diags { - t.Logf(" - %s", diag.Error()) - } - } - body := file.Body - - got := Variables(body, test.spec) - - if !reflect.DeepEqual(got, test.want) { - t.Errorf("wrong result\ngot: %#v\nwant: %#v", got, test.want) - } - }) - } - -} diff --git a/vendor/github.com/hashicorp/hcl2/hclparse/parser.go b/vendor/github.com/hashicorp/hcl2/hclparse/parser.go deleted file mode 100644 index 6d47f12..0000000 --- a/vendor/github.com/hashicorp/hcl2/hclparse/parser.go +++ /dev/null @@ -1,123 +0,0 @@ -package hclparse - -import ( - "fmt" - "io/ioutil" - - "github.com/hashicorp/hcl2/hcl" - "github.com/hashicorp/hcl2/hcl/hclsyntax" - "github.com/hashicorp/hcl2/hcl/json" -) - -// NOTE: This is the public interface for parsing. The actual parsers are -// in other packages alongside this one, with this package just wrapping them -// to provide a unified interface for the caller across all supported formats. - -// Parser is the main interface for parsing configuration files. As well as -// parsing files, a parser also retains a registry of all of the files it -// has parsed so that multiple attempts to parse the same file will return -// the same object and so the collected files can be used when printing -// diagnostics. -// -// Any diagnostics for parsing a file are only returned once on the first -// call to parse that file. Callers are expected to collect up diagnostics -// and present them together, so returning diagnostics for the same file -// multiple times would create a confusing result. -type Parser struct { - files map[string]*hcl.File -} - -// NewParser creates a new parser, ready to parse configuration files. -func NewParser() *Parser { - return &Parser{ - files: map[string]*hcl.File{}, - } -} - -// ParseHCL parses the given buffer (which is assumed to have been loaded from -// the given filename) as a native-syntax configuration file and returns the -// hcl.File object representing it. -func (p *Parser) ParseHCL(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := hclsyntax.ParseConfig(src, filename, hcl.Pos{Byte: 0, Line: 1, Column: 1}) - p.files[filename] = file - return file, diags -} - -// ParseHCLFile reads the given filename and parses it as a native-syntax HCL -// configuration file. An error diagnostic is returned if the given file -// cannot be read. -func (p *Parser) ParseHCLFile(filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - src, err := ioutil.ReadFile(filename) - if err != nil { - return nil, hcl.Diagnostics{ - { - Severity: hcl.DiagError, - Summary: "Failed to read file", - Detail: fmt.Sprintf("The configuration file %q could not be read.", filename), - }, - } - } - - return p.ParseHCL(src, filename) -} - -// ParseJSON parses the given JSON buffer (which is assumed to have been loaded -// from the given filename) and returns the hcl.File object representing it. -func (p *Parser) ParseJSON(src []byte, filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := json.Parse(src, filename) - p.files[filename] = file - return file, diags -} - -// ParseJSONFile reads the given filename and parses it as JSON, similarly to -// ParseJSON. An error diagnostic is returned if the given file cannot be read. -func (p *Parser) ParseJSONFile(filename string) (*hcl.File, hcl.Diagnostics) { - if existing := p.files[filename]; existing != nil { - return existing, nil - } - - file, diags := json.ParseFile(filename) - p.files[filename] = file - return file, diags -} - -// AddFile allows a caller to record in a parser a file that was parsed some -// other way, thus allowing it to be included in the registry of sources. -func (p *Parser) AddFile(filename string, file *hcl.File) { - p.files[filename] = file -} - -// Sources returns a map from filenames to the raw source code that was -// read from them. This is intended to be used, for example, to print -// diagnostics with contextual information. -// -// The arrays underlying the returned slices should not be modified. -func (p *Parser) Sources() map[string][]byte { - ret := make(map[string][]byte) - for fn, f := range p.files { - ret[fn] = f.Bytes - } - return ret -} - -// Files returns a map from filenames to the File objects produced from them. -// This is intended to be used, for example, to print diagnostics with -// contextual information. -// -// The returned map and all of the objects it refers to directly or indirectly -// must not be modified. -func (p *Parser) Files() map[string]*hcl.File { - return p.files -} diff --git a/vendor/github.com/hashicorp/hil/.gitignore b/vendor/github.com/hashicorp/hil/.gitignore deleted file mode 100644 index 9d6e5df..0000000 --- a/vendor/github.com/hashicorp/hil/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -.DS_Store -.idea -*.iml diff --git a/vendor/github.com/hashicorp/hil/.travis.yml b/vendor/github.com/hashicorp/hil/.travis.yml deleted file mode 100644 index a785444..0000000 --- a/vendor/github.com/hashicorp/hil/.travis.yml +++ /dev/null @@ -1,3 +0,0 @@ -sudo: false -language: go -go: 1.7 diff --git a/vendor/github.com/hashicorp/hil/LICENSE b/vendor/github.com/hashicorp/hil/LICENSE deleted file mode 100644 index 82b4de9..0000000 --- a/vendor/github.com/hashicorp/hil/LICENSE +++ /dev/null @@ -1,353 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. diff --git a/vendor/github.com/hashicorp/hil/README.md b/vendor/github.com/hashicorp/hil/README.md deleted file mode 100644 index 186ed25..0000000 --- a/vendor/github.com/hashicorp/hil/README.md +++ /dev/null @@ -1,102 +0,0 @@ -# HIL - -[![GoDoc](https://godoc.org/github.com/hashicorp/hil?status.png)](https://godoc.org/github.com/hashicorp/hil) [![Build Status](https://travis-ci.org/hashicorp/hil.svg?branch=master)](https://travis-ci.org/hashicorp/hil) - -HIL (HashiCorp Interpolation Language) is a lightweight embedded language used -primarily for configuration interpolation. The goal of HIL is to make a simple -language for interpolations in the various configurations of HashiCorp tools. - -HIL is built to interpolate any string, but is in use by HashiCorp primarily -with [HCL](https://github.com/hashicorp/hcl). HCL is _not required_ in any -way for use with HIL. - -HIL isn't meant to be a general purpose language. It was built for basic -configuration interpolations. Therefore, you can't currently write functions, -have conditionals, set intermediary variables, etc. within HIL itself. It is -possible some of these may be added later but the right use case must exist. - -## Why? - -Many of our tools have support for something similar to templates, but -within the configuration itself. The most prominent requirement was in -[Terraform](https://github.com/hashicorp/terraform) where we wanted the -configuration to be able to reference values from elsewhere in the -configuration. Example: - - foo = "hi ${var.world}" - -We originally used a full templating language for this, but found it -was too heavy weight. Additionally, many full languages required bindings -to C (and thus the usage of cgo) which we try to avoid to make cross-compilation -easier. We then moved to very basic regular expression based -string replacement, but found the need for basic arithmetic and function -calls resulting in overly complex regular expressions. - -Ultimately, we wrote our own mini-language within Terraform itself. As -we built other projects such as [Nomad](https://nomadproject.io) and -[Otto](https://ottoproject.io), the need for basic interpolations arose -again. - -Thus HIL was born. It is extracted from Terraform, cleaned up, and -better tested for general purpose use. - -## Syntax - -For a complete grammar, please see the parser itself. A high-level overview -of the syntax and grammer is listed here. - -Code begins within `${` and `}`. Outside of this, text is treated -literally. For example, `foo` is a valid HIL program that is just the -string "foo", but `foo ${bar}` is an HIL program that is the string "foo " -concatened with the value of `bar`. For the remainder of the syntax -docs, we'll assume you're within `${}`. - - * Identifiers are any text in the format of `[a-zA-Z0-9-.]`. Example - identifiers: `foo`, `var.foo`, `foo-bar`. - - * Strings are double quoted and can contain any UTF-8 characters. - Example: `"Hello, World"` - - * Numbers are assumed to be base 10. If you prefix a number with 0x, - it is treated as a hexadecimal. If it is prefixed with 0, it is - treated as an octal. Numbers can be in scientific notation: "1e10". - - * Unary `-` can be used for negative numbers. Example: `-10` or `-0.2` - - * Boolean values: `true`, `false` - - * The following arithmetic operations are allowed: +, -, *, /, %. - - * Function calls are in the form of `name(arg1, arg2, ...)`. Example: - `add(1, 5)`. Arguments can be any valid HIL expression, example: - `add(1, var.foo)` or even nested function calls: - `add(1, get("some value"))`. - - * Within strings, further interpolations can be opened with `${}`. - Example: `"Hello ${nested}"`. A full example including the - original `${}` (remember this list assumes were inside of one - already) could be: `foo ${func("hello ${var.foo}")}`. - -## Language Changes - -We've used this mini-language in Terraform for years. For backwards compatibility -reasons, we're unlikely to make an incompatible change to the language but -we're not currently making that promise, either. - -The internal API of this project may very well change as we evolve it -to work with more of our projects. We recommend using some sort of dependency -management solution with this package. - -## Future Changes - -The following changes are already planned to be made at some point: - - * Richer types: lists, maps, etc. - - * Convert to a more standard Go parser structure similar to HCL. This - will improve our error messaging as well as allow us to have automatic - formatting. - - * Allow interpolations to result in more types than just a string. While - within the interpolation basic types are honored, the result is always - a string. diff --git a/vendor/github.com/hashicorp/hil/appveyor.yml b/vendor/github.com/hashicorp/hil/appveyor.yml deleted file mode 100644 index feaf7a3..0000000 --- a/vendor/github.com/hashicorp/hil/appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -version: "build-{branch}-{build}" -image: Visual Studio 2015 -clone_folder: c:\gopath\src\github.com\hashicorp\hil -environment: - GOPATH: c:\gopath -init: - - git config --global core.autocrlf true -install: -- cmd: >- - echo %Path% - - go version - - go env - - go get -d -v -t ./... -build_script: -- cmd: go test -v ./... diff --git a/vendor/github.com/hashicorp/hil/ast/arithmetic.go b/vendor/github.com/hashicorp/hil/ast/arithmetic.go deleted file mode 100644 index 94dc24f..0000000 --- a/vendor/github.com/hashicorp/hil/ast/arithmetic.go +++ /dev/null @@ -1,43 +0,0 @@ -package ast - -import ( - "bytes" - "fmt" -) - -// Arithmetic represents a node where the result is arithmetic of -// two or more operands in the order given. -type Arithmetic struct { - Op ArithmeticOp - Exprs []Node - Posx Pos -} - -func (n *Arithmetic) Accept(v Visitor) Node { - for i, expr := range n.Exprs { - n.Exprs[i] = expr.Accept(v) - } - - return v(n) -} - -func (n *Arithmetic) Pos() Pos { - return n.Posx -} - -func (n *Arithmetic) GoString() string { - return fmt.Sprintf("*%#v", *n) -} - -func (n *Arithmetic) String() string { - var b bytes.Buffer - for _, expr := range n.Exprs { - b.WriteString(fmt.Sprintf("%s", expr)) - } - - return b.String() -} - -func (n *Arithmetic) Type(Scope) (Type, error) { - return TypeInt, nil -} diff --git a/vendor/github.com/hashicorp/hil/ast/arithmetic_op.go b/vendor/github.com/hashicorp/hil/ast/arithmetic_op.go deleted file mode 100644 index 18880c6..0000000 --- a/vendor/github.com/hashicorp/hil/ast/arithmetic_op.go +++ /dev/null @@ -1,24 +0,0 @@ -package ast - -// ArithmeticOp is the operation to use for the math. -type ArithmeticOp int - -const ( - ArithmeticOpInvalid ArithmeticOp = 0 - - ArithmeticOpAdd ArithmeticOp = iota - ArithmeticOpSub - ArithmeticOpMul - ArithmeticOpDiv - ArithmeticOpMod - - ArithmeticOpLogicalAnd - ArithmeticOpLogicalOr - - ArithmeticOpEqual - ArithmeticOpNotEqual - ArithmeticOpLessThan - ArithmeticOpLessThanOrEqual - ArithmeticOpGreaterThan - ArithmeticOpGreaterThanOrEqual -) diff --git a/vendor/github.com/hashicorp/hil/ast/ast.go b/vendor/github.com/hashicorp/hil/ast/ast.go deleted file mode 100644 index c6350f8..0000000 --- a/vendor/github.com/hashicorp/hil/ast/ast.go +++ /dev/null @@ -1,99 +0,0 @@ -package ast - -import ( - "fmt" -) - -// Node is the interface that all AST nodes must implement. -type Node interface { - // Accept is called to dispatch to the visitors. It must return the - // resulting Node (which might be different in an AST transform). - Accept(Visitor) Node - - // Pos returns the position of this node in some source. - Pos() Pos - - // Type returns the type of this node for the given context. - Type(Scope) (Type, error) -} - -// Pos is the starting position of an AST node -type Pos struct { - Column, Line int // Column/Line number, starting at 1 - Filename string // Optional source filename, if known -} - -func (p Pos) String() string { - if p.Filename == "" { - return fmt.Sprintf("%d:%d", p.Line, p.Column) - } else { - return fmt.Sprintf("%s:%d:%d", p.Filename, p.Line, p.Column) - } -} - -// InitPos is an initiaial position value. This should be used as -// the starting position (presets the column and line to 1). -var InitPos = Pos{Column: 1, Line: 1} - -// Visitors are just implementations of this function. -// -// The function must return the Node to replace this node with. "nil" is -// _not_ a valid return value. If there is no replacement, the original node -// should be returned. We build this replacement directly into the visitor -// pattern since AST transformations are a common and useful tool and -// building it into the AST itself makes it required for future Node -// implementations and very easy to do. -// -// Note that this isn't a true implementation of the visitor pattern, which -// generally requires proper type dispatch on the function. However, -// implementing this basic visitor pattern style is still very useful even -// if you have to type switch. -type Visitor func(Node) Node - -//go:generate stringer -type=Type - -// Type is the type of any value. -type Type uint32 - -const ( - TypeInvalid Type = 0 - TypeAny Type = 1 << iota - TypeBool - TypeString - TypeInt - TypeFloat - TypeList - TypeMap - - // This is a special type used by Terraform to mark "unknown" values. - // It is impossible for this type to be introduced into your HIL programs - // unless you explicitly set a variable to this value. In that case, - // any operation including the variable will return "TypeUnknown" as the - // type. - TypeUnknown -) - -func (t Type) Printable() string { - switch t { - case TypeInvalid: - return "invalid type" - case TypeAny: - return "any type" - case TypeBool: - return "type bool" - case TypeString: - return "type string" - case TypeInt: - return "type int" - case TypeFloat: - return "type float" - case TypeList: - return "type list" - case TypeMap: - return "type map" - case TypeUnknown: - return "type unknown" - default: - return "unknown type" - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/ast_test.go b/vendor/github.com/hashicorp/hil/ast/ast_test.go deleted file mode 100644 index f292cb4..0000000 --- a/vendor/github.com/hashicorp/hil/ast/ast_test.go +++ /dev/null @@ -1,35 +0,0 @@ -package ast - -import ( - "strconv" - "testing" -) - -func TestPosString(t *testing.T) { - cases := []struct { - Input Pos - String string - }{ - { - Pos{Line: 1, Column: 1}, - "1:1", - }, - { - Pos{Line: 2, Column: 3}, - "2:3", - }, - { - Pos{Line: 3, Column: 2, Filename: "template.hil"}, - "template.hil:3:2", - }, - } - - for i, tc := range cases { - t.Run(strconv.Itoa(i), func(t *testing.T) { - got := tc.Input.String() - if want, got := tc.String, got; want != got { - t.Errorf("%#v produced %q; want %q", tc.Input, got, want) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/call.go b/vendor/github.com/hashicorp/hil/ast/call.go deleted file mode 100644 index 0557011..0000000 --- a/vendor/github.com/hashicorp/hil/ast/call.go +++ /dev/null @@ -1,47 +0,0 @@ -package ast - -import ( - "fmt" - "strings" -) - -// Call represents a function call. -type Call struct { - Func string - Args []Node - Posx Pos -} - -func (n *Call) Accept(v Visitor) Node { - for i, a := range n.Args { - n.Args[i] = a.Accept(v) - } - - return v(n) -} - -func (n *Call) Pos() Pos { - return n.Posx -} - -func (n *Call) String() string { - args := make([]string, len(n.Args)) - for i, arg := range n.Args { - args[i] = fmt.Sprintf("%s", arg) - } - - return fmt.Sprintf("Call(%s, %s)", n.Func, strings.Join(args, ", ")) -} - -func (n *Call) Type(s Scope) (Type, error) { - f, ok := s.LookupFunc(n.Func) - if !ok { - return TypeInvalid, fmt.Errorf("unknown function: %s", n.Func) - } - - return f.ReturnType, nil -} - -func (n *Call) GoString() string { - return fmt.Sprintf("*%#v", *n) -} diff --git a/vendor/github.com/hashicorp/hil/ast/call_test.go b/vendor/github.com/hashicorp/hil/ast/call_test.go deleted file mode 100644 index ef63888..0000000 --- a/vendor/github.com/hashicorp/hil/ast/call_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package ast - -import ( - "testing" -) - -func TestCallType(t *testing.T) { - c := &Call{Func: "foo"} - scope := &BasicScope{ - FuncMap: map[string]Function{ - "foo": Function{ReturnType: TypeString}, - }, - } - - actual, err := c.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeString { - t.Fatalf("bad: %s", actual) - } -} - -func TestCallType_invalid(t *testing.T) { - c := &Call{Func: "bar"} - scope := &BasicScope{ - FuncMap: map[string]Function{ - "foo": Function{ReturnType: TypeString}, - }, - } - - _, err := c.Type(scope) - if err == nil { - t.Fatal("should error") - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/conditional.go b/vendor/github.com/hashicorp/hil/ast/conditional.go deleted file mode 100644 index be48f89..0000000 --- a/vendor/github.com/hashicorp/hil/ast/conditional.go +++ /dev/null @@ -1,36 +0,0 @@ -package ast - -import ( - "fmt" -) - -type Conditional struct { - CondExpr Node - TrueExpr Node - FalseExpr Node - Posx Pos -} - -// Accept passes the given visitor to the child nodes in this order: -// CondExpr, TrueExpr, FalseExpr. It then finally passes itself to the visitor. -func (n *Conditional) Accept(v Visitor) Node { - n.CondExpr = n.CondExpr.Accept(v) - n.TrueExpr = n.TrueExpr.Accept(v) - n.FalseExpr = n.FalseExpr.Accept(v) - - return v(n) -} - -func (n *Conditional) Pos() Pos { - return n.Posx -} - -func (n *Conditional) Type(Scope) (Type, error) { - // This is not actually a useful value; the type checker ignores - // this function when analyzing conditionals, just as with Arithmetic. - return TypeInt, nil -} - -func (n *Conditional) GoString() string { - return fmt.Sprintf("*%#v", *n) -} diff --git a/vendor/github.com/hashicorp/hil/ast/index.go b/vendor/github.com/hashicorp/hil/ast/index.go deleted file mode 100644 index 860c25f..0000000 --- a/vendor/github.com/hashicorp/hil/ast/index.go +++ /dev/null @@ -1,76 +0,0 @@ -package ast - -import ( - "fmt" - "strings" -) - -// Index represents an indexing operation into another data structure -type Index struct { - Target Node - Key Node - Posx Pos -} - -func (n *Index) Accept(v Visitor) Node { - n.Target = n.Target.Accept(v) - n.Key = n.Key.Accept(v) - return v(n) -} - -func (n *Index) Pos() Pos { - return n.Posx -} - -func (n *Index) String() string { - return fmt.Sprintf("Index(%s, %s)", n.Target, n.Key) -} - -func (n *Index) Type(s Scope) (Type, error) { - variableAccess, ok := n.Target.(*VariableAccess) - if !ok { - return TypeInvalid, fmt.Errorf("target is not a variable") - } - - variable, ok := s.LookupVar(variableAccess.Name) - if !ok { - return TypeInvalid, fmt.Errorf("unknown variable accessed: %s", variableAccess.Name) - } - - switch variable.Type { - case TypeList: - return n.typeList(variable, variableAccess.Name) - case TypeMap: - return n.typeMap(variable, variableAccess.Name) - default: - return TypeInvalid, fmt.Errorf("invalid index operation into non-indexable type: %s", variable.Type) - } -} - -func (n *Index) typeList(variable Variable, variableName string) (Type, error) { - // We assume type checking has already determined that this is a list - list := variable.Value.([]Variable) - - return VariableListElementTypesAreHomogenous(variableName, list) -} - -func (n *Index) typeMap(variable Variable, variableName string) (Type, error) { - // We assume type checking has already determined that this is a map - vmap := variable.Value.(map[string]Variable) - - return VariableMapValueTypesAreHomogenous(variableName, vmap) -} - -func reportTypes(typesFound map[Type]struct{}) string { - stringTypes := make([]string, len(typesFound)) - i := 0 - for k, _ := range typesFound { - stringTypes[0] = k.String() - i++ - } - return strings.Join(stringTypes, ", ") -} - -func (n *Index) GoString() string { - return fmt.Sprintf("*%#v", *n) -} diff --git a/vendor/github.com/hashicorp/hil/ast/index_test.go b/vendor/github.com/hashicorp/hil/ast/index_test.go deleted file mode 100644 index bcafd85..0000000 --- a/vendor/github.com/hashicorp/hil/ast/index_test.go +++ /dev/null @@ -1,270 +0,0 @@ -package ast - -import ( - "strings" - "testing" -) - -func TestIndexTypeMap_empty(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeString, - Value: "bar", - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeMap, - Value: map[string]Variable{}, - }, - }, - } - - actual, err := i.Type(scope) - if err == nil || !strings.Contains(err.Error(), "does not have any elements") { - t.Fatalf("bad err: %s", err) - } - if actual != TypeInvalid { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeMap_string(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeString, - Value: "bar", - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeMap, - Value: map[string]Variable{ - "baz": Variable{ - Type: TypeString, - Value: "Hello", - }, - "bar": Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - } - - actual, err := i.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeString { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeMap_int(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeString, - Value: "bar", - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeMap, - Value: map[string]Variable{ - "baz": Variable{ - Type: TypeInt, - Value: 1, - }, - "bar": Variable{ - Type: TypeInt, - Value: 2, - }, - }, - }, - }, - } - - actual, err := i.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeInt { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeMap_nonHomogenous(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeString, - Value: "bar", - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeMap, - Value: map[string]Variable{ - "bar": Variable{ - Type: TypeString, - Value: "Hello", - }, - "baz": Variable{ - Type: TypeInt, - Value: 43, - }, - }, - }, - }, - } - - _, err := i.Type(scope) - if err == nil || !strings.Contains(err.Error(), "homogenous") { - t.Fatalf("expected error") - } -} - -func TestIndexTypeList_empty(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeInt, - Value: 1, - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeList, - Value: []Variable{}, - }, - }, - } - - actual, err := i.Type(scope) - if err == nil || !strings.Contains(err.Error(), "does not have any elements") { - t.Fatalf("bad err: %s", err) - } - if actual != TypeInvalid { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeList_string(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeInt, - Value: 1, - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeList, - Value: []Variable{ - Variable{ - Type: TypeString, - Value: "Hello", - }, - Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - } - - actual, err := i.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeString { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeList_int(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeInt, - Value: 1, - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeList, - Value: []Variable{ - Variable{ - Type: TypeInt, - Value: 34, - }, - Variable{ - Type: TypeInt, - Value: 54, - }, - }, - }, - }, - } - - actual, err := i.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeInt { - t.Fatalf("bad: %s", actual) - } -} - -func TestIndexTypeList_nonHomogenous(t *testing.T) { - i := &Index{ - Target: &VariableAccess{Name: "foo"}, - Key: &LiteralNode{ - Typex: TypeInt, - Value: 1, - }, - } - - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{ - Type: TypeList, - Value: []Variable{ - Variable{ - Type: TypeString, - Value: "Hello", - }, - Variable{ - Type: TypeInt, - Value: 43, - }, - }, - }, - }, - } - - _, err := i.Type(scope) - if err == nil || !strings.Contains(err.Error(), "homogenous") { - t.Fatalf("expected error") - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/literal.go b/vendor/github.com/hashicorp/hil/ast/literal.go deleted file mode 100644 index da6014f..0000000 --- a/vendor/github.com/hashicorp/hil/ast/literal.go +++ /dev/null @@ -1,88 +0,0 @@ -package ast - -import ( - "fmt" - "reflect" -) - -// LiteralNode represents a single literal value, such as "foo" or -// 42 or 3.14159. Based on the Type, the Value can be safely cast. -type LiteralNode struct { - Value interface{} - Typex Type - Posx Pos -} - -// NewLiteralNode returns a new literal node representing the given -// literal Go value, which must correspond to one of the primitive types -// supported by HIL. Lists and maps cannot currently be constructed via -// this function. -// -// If an inappropriately-typed value is provided, this function will -// return an error. The main intended use of this function is to produce -// "synthetic" literals from constants in code, where the value type is -// well known at compile time. To easily store these in global variables, -// see also MustNewLiteralNode. -func NewLiteralNode(value interface{}, pos Pos) (*LiteralNode, error) { - goType := reflect.TypeOf(value) - var hilType Type - - switch goType.Kind() { - case reflect.Bool: - hilType = TypeBool - case reflect.Int: - hilType = TypeInt - case reflect.Float64: - hilType = TypeFloat - case reflect.String: - hilType = TypeString - default: - return nil, fmt.Errorf("unsupported literal node type: %T", value) - } - - return &LiteralNode{ - Value: value, - Typex: hilType, - Posx: pos, - }, nil -} - -// MustNewLiteralNode wraps NewLiteralNode and panics if an error is -// returned, thus allowing valid literal nodes to be easily assigned to -// global variables. -func MustNewLiteralNode(value interface{}, pos Pos) *LiteralNode { - node, err := NewLiteralNode(value, pos) - if err != nil { - panic(err) - } - return node -} - -func (n *LiteralNode) Accept(v Visitor) Node { - return v(n) -} - -func (n *LiteralNode) Pos() Pos { - return n.Posx -} - -func (n *LiteralNode) GoString() string { - return fmt.Sprintf("*%#v", *n) -} - -func (n *LiteralNode) String() string { - return fmt.Sprintf("Literal(%s, %v)", n.Typex, n.Value) -} - -func (n *LiteralNode) Type(Scope) (Type, error) { - return n.Typex, nil -} - -// IsUnknown returns true either if the node's value is itself unknown -// of if it is a collection containing any unknown elements, deeply. -func (n *LiteralNode) IsUnknown() bool { - return IsUnknown(Variable{ - Type: n.Typex, - Value: n.Value, - }) -} diff --git a/vendor/github.com/hashicorp/hil/ast/literal_test.go b/vendor/github.com/hashicorp/hil/ast/literal_test.go deleted file mode 100644 index 37856c2..0000000 --- a/vendor/github.com/hashicorp/hil/ast/literal_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package ast - -import ( - "fmt" - "reflect" - "testing" -) - -func TestLiteralNodeType(t *testing.T) { - c := &LiteralNode{Typex: TypeString} - actual, err := c.Type(nil) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeString { - t.Fatalf("bad: %s", actual) - } -} - -func TestNewLiteralNode(t *testing.T) { - tests := []struct { - Value interface{} - Expected *LiteralNode - }{ - { - 1, - &LiteralNode{ - Value: 1, - Typex: TypeInt, - }, - }, - { - 1.0, - &LiteralNode{ - Value: 1.0, - Typex: TypeFloat, - }, - }, - { - true, - &LiteralNode{ - Value: true, - Typex: TypeBool, - }, - }, - { - "hi", - &LiteralNode{ - Value: "hi", - Typex: TypeString, - }, - }, - } - - for _, test := range tests { - t.Run(fmt.Sprintf("%T", test.Value), func(t *testing.T) { - inPos := Pos{ - Column: 2, - Line: 3, - Filename: "foo", - } - node, err := NewLiteralNode(test.Value, inPos) - - if err != nil { - t.Fatalf("error: %s", err) - } - - if got, want := node.Typex, test.Expected.Typex; want != got { - t.Errorf("got type %s; want %s", got, want) - } - if got, want := node.Value, test.Expected.Value; want != got { - t.Errorf("got value %#v; want %#v", got, want) - } - if got, want := node.Posx, inPos; !reflect.DeepEqual(got, want) { - t.Errorf("got position %#v; want %#v", got, want) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/output.go b/vendor/github.com/hashicorp/hil/ast/output.go deleted file mode 100644 index 1e27f97..0000000 --- a/vendor/github.com/hashicorp/hil/ast/output.go +++ /dev/null @@ -1,78 +0,0 @@ -package ast - -import ( - "bytes" - "fmt" -) - -// Output represents the root node of all interpolation evaluations. If the -// output only has one expression which is either a TypeList or TypeMap, the -// Output can be type-asserted to []interface{} or map[string]interface{} -// respectively. Otherwise the Output evaluates as a string, and concatenates -// the evaluation of each expression. -type Output struct { - Exprs []Node - Posx Pos -} - -func (n *Output) Accept(v Visitor) Node { - for i, expr := range n.Exprs { - n.Exprs[i] = expr.Accept(v) - } - - return v(n) -} - -func (n *Output) Pos() Pos { - return n.Posx -} - -func (n *Output) GoString() string { - return fmt.Sprintf("*%#v", *n) -} - -func (n *Output) String() string { - var b bytes.Buffer - for _, expr := range n.Exprs { - b.WriteString(fmt.Sprintf("%s", expr)) - } - - return b.String() -} - -func (n *Output) Type(s Scope) (Type, error) { - // Special case no expressions for backward compatibility - if len(n.Exprs) == 0 { - return TypeString, nil - } - - // Special case a single expression of types list or map - if len(n.Exprs) == 1 { - exprType, err := n.Exprs[0].Type(s) - if err != nil { - return TypeInvalid, err - } - switch exprType { - case TypeList: - return TypeList, nil - case TypeMap: - return TypeMap, nil - } - } - - // Otherwise ensure all our expressions are strings - for index, expr := range n.Exprs { - exprType, err := expr.Type(s) - if err != nil { - return TypeInvalid, err - } - // We only look for things we know we can't coerce with an implicit conversion func - if exprType == TypeList || exprType == TypeMap { - return TypeInvalid, fmt.Errorf( - "multi-expression HIL outputs may only have string inputs: %d is type %s", - index, exprType) - } - } - - return TypeString, nil -} diff --git a/vendor/github.com/hashicorp/hil/ast/output_test.go b/vendor/github.com/hashicorp/hil/ast/output_test.go deleted file mode 100644 index 135c78c..0000000 --- a/vendor/github.com/hashicorp/hil/ast/output_test.go +++ /dev/null @@ -1,213 +0,0 @@ -package ast - -import ( - "testing" -) - -func TestOutput_type(t *testing.T) { - testCases := []struct { - Name string - Output *Output - Scope Scope - ReturnType Type - ShouldError bool - }{ - { - Name: "No expressions, for backward compatibility", - Output: &Output{}, - Scope: nil, - ReturnType: TypeString, - }, - { - Name: "Single string expression", - Output: &Output{ - Exprs: []Node{ - &LiteralNode{ - Value: "Whatever", - Typex: TypeString, - }, - }, - }, - Scope: nil, - ReturnType: TypeString, - }, - { - Name: "Single list expression of strings", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeList, - Value: []Variable{ - Variable{ - Type: TypeString, - Value: "Hello", - }, - Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - }, - ReturnType: TypeList, - }, - { - Name: "Single map expression", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeMap, - Value: map[string]Variable{ - "key1": Variable{ - Type: TypeString, - Value: "Hello", - }, - "key2": Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - }, - ReturnType: TypeMap, - }, - { - Name: "Multiple map expressions", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - &VariableAccess{ - Name: "testvar", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeMap, - Value: map[string]Variable{ - "key1": Variable{ - Type: TypeString, - Value: "Hello", - }, - "key2": Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - }, - ShouldError: true, - ReturnType: TypeInvalid, - }, - { - Name: "Multiple list expressions", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - &VariableAccess{ - Name: "testvar", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeList, - Value: []Variable{ - Variable{ - Type: TypeString, - Value: "Hello", - }, - Variable{ - Type: TypeString, - Value: "World", - }, - }, - }, - }, - }, - ShouldError: true, - ReturnType: TypeInvalid, - }, - { - Name: "Multiple string expressions", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - &VariableAccess{ - Name: "testvar", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeString, - Value: "Hello", - }, - }, - }, - ReturnType: TypeString, - }, - { - Name: "Multiple string expressions with coercion", - Output: &Output{ - Exprs: []Node{ - &VariableAccess{ - Name: "testvar", - }, - &VariableAccess{ - Name: "testint", - }, - }, - }, - Scope: &BasicScope{ - VarMap: map[string]Variable{ - "testvar": Variable{ - Type: TypeString, - Value: "Hello", - }, - "testint": Variable{ - Type: TypeInt, - Value: 2, - }, - }, - }, - ReturnType: TypeString, - }, - } - - for _, v := range testCases { - actual, err := v.Output.Type(v.Scope) - if err != nil && !v.ShouldError { - t.Fatalf("case: %s\nerr: %s", v.Name, err) - } - if actual != v.ReturnType { - t.Fatalf("case: %s\n bad: %s\nexpected: %s\n", v.Name, actual, v.ReturnType) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/scope.go b/vendor/github.com/hashicorp/hil/ast/scope.go deleted file mode 100644 index 7a975d9..0000000 --- a/vendor/github.com/hashicorp/hil/ast/scope.go +++ /dev/null @@ -1,90 +0,0 @@ -package ast - -import ( - "fmt" - "reflect" -) - -// Scope is the interface used to look up variables and functions while -// evaluating. How these functions/variables are defined are up to the caller. -type Scope interface { - LookupFunc(string) (Function, bool) - LookupVar(string) (Variable, bool) -} - -// Variable is a variable value for execution given as input to the engine. -// It records the value of a variables along with their type. -type Variable struct { - Value interface{} - Type Type -} - -// NewVariable creates a new Variable for the given value. This will -// attempt to infer the correct type. If it can't, an error will be returned. -func NewVariable(v interface{}) (result Variable, err error) { - switch v := reflect.ValueOf(v); v.Kind() { - case reflect.String: - result.Type = TypeString - default: - err = fmt.Errorf("Unknown type: %s", v.Kind()) - } - - result.Value = v - return -} - -// String implements Stringer on Variable, displaying the type and value -// of the Variable. -func (v Variable) String() string { - return fmt.Sprintf("{Variable (%s): %+v}", v.Type, v.Value) -} - -// Function defines a function that can be executed by the engine. -// The type checker will validate that the proper types will be called -// to the callback. -type Function struct { - // ArgTypes is the list of types in argument order. These are the - // required arguments. - // - // ReturnType is the type of the returned value. The Callback MUST - // return this type. - ArgTypes []Type - ReturnType Type - - // Variadic, if true, says that this function is variadic, meaning - // it takes a variable number of arguments. In this case, the - // VariadicType must be set. - Variadic bool - VariadicType Type - - // Callback is the function called for a function. The argument - // types are guaranteed to match the spec above by the type checker. - // The length of the args is strictly == len(ArgTypes) unless Varidiac - // is true, in which case its >= len(ArgTypes). - Callback func([]interface{}) (interface{}, error) -} - -// BasicScope is a simple scope that looks up variables and functions -// using a map. -type BasicScope struct { - FuncMap map[string]Function - VarMap map[string]Variable -} - -func (s *BasicScope) LookupFunc(n string) (Function, bool) { - if s == nil { - return Function{}, false - } - - v, ok := s.FuncMap[n] - return v, ok -} - -func (s *BasicScope) LookupVar(n string) (Variable, bool) { - if s == nil { - return Variable{}, false - } - - v, ok := s.VarMap[n] - return v, ok -} diff --git a/vendor/github.com/hashicorp/hil/ast/scope_test.go b/vendor/github.com/hashicorp/hil/ast/scope_test.go deleted file mode 100644 index b5e3525..0000000 --- a/vendor/github.com/hashicorp/hil/ast/scope_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package ast - -import ( - "testing" -) - -func TestBasicScope_impl(t *testing.T) { - var _ Scope = new(BasicScope) -} - -func TestBasicScopeLookupFunc(t *testing.T) { - scope := &BasicScope{ - FuncMap: map[string]Function{ - "foo": Function{}, - }, - } - - if _, ok := scope.LookupFunc("bar"); ok { - t.Fatal("should not find bar") - } - if _, ok := scope.LookupFunc("foo"); !ok { - t.Fatal("should find foo") - } -} - -func TestBasicScopeLookupVar(t *testing.T) { - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{}, - }, - } - - if _, ok := scope.LookupVar("bar"); ok { - t.Fatal("should not find bar") - } - if _, ok := scope.LookupVar("foo"); !ok { - t.Fatal("should find foo") - } -} - -func TestVariableStringer(t *testing.T) { - expected := "{Variable (TypeInt): 42}" - variable := &Variable{ - Type: TypeInt, - Value: 42, - } - - actual := variable.String() - - if actual != expected { - t.Fatalf("variable string formatting:\nExpected: %s\n Got: %s\n", - expected, actual) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/stack.go b/vendor/github.com/hashicorp/hil/ast/stack.go deleted file mode 100644 index bd2bc15..0000000 --- a/vendor/github.com/hashicorp/hil/ast/stack.go +++ /dev/null @@ -1,25 +0,0 @@ -package ast - -// Stack is a stack of Node. -type Stack struct { - stack []Node -} - -func (s *Stack) Len() int { - return len(s.stack) -} - -func (s *Stack) Push(n Node) { - s.stack = append(s.stack, n) -} - -func (s *Stack) Pop() Node { - x := s.stack[len(s.stack)-1] - s.stack[len(s.stack)-1] = nil - s.stack = s.stack[:len(s.stack)-1] - return x -} - -func (s *Stack) Reset() { - s.stack = nil -} diff --git a/vendor/github.com/hashicorp/hil/ast/stack_test.go b/vendor/github.com/hashicorp/hil/ast/stack_test.go deleted file mode 100644 index 95a9d92..0000000 --- a/vendor/github.com/hashicorp/hil/ast/stack_test.go +++ /dev/null @@ -1,46 +0,0 @@ -package ast - -import ( - "reflect" - "testing" -) - -func TestStack(t *testing.T) { - var s Stack - if s.Len() != 0 { - t.Fatalf("bad: %d", s.Len()) - } - - n := &LiteralNode{Value: 42} - s.Push(n) - - if s.Len() != 1 { - t.Fatalf("bad: %d", s.Len()) - } - - actual := s.Pop() - if !reflect.DeepEqual(actual, n) { - t.Fatalf("bad: %#v", actual) - } - - if s.Len() != 0 { - t.Fatalf("bad: %d", s.Len()) - } -} - -func TestStack_reset(t *testing.T) { - var s Stack - - n := &LiteralNode{Value: 42} - s.Push(n) - - if s.Len() != 1 { - t.Fatalf("bad: %d", s.Len()) - } - - s.Reset() - - if s.Len() != 0 { - t.Fatalf("bad: %d", s.Len()) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/type_string.go b/vendor/github.com/hashicorp/hil/ast/type_string.go deleted file mode 100644 index 1f51a98..0000000 --- a/vendor/github.com/hashicorp/hil/ast/type_string.go +++ /dev/null @@ -1,54 +0,0 @@ -// Code generated by "stringer -type=Type"; DO NOT EDIT - -package ast - -import "fmt" - -const ( - _Type_name_0 = "TypeInvalid" - _Type_name_1 = "TypeAny" - _Type_name_2 = "TypeBool" - _Type_name_3 = "TypeString" - _Type_name_4 = "TypeInt" - _Type_name_5 = "TypeFloat" - _Type_name_6 = "TypeList" - _Type_name_7 = "TypeMap" - _Type_name_8 = "TypeUnknown" -) - -var ( - _Type_index_0 = [...]uint8{0, 11} - _Type_index_1 = [...]uint8{0, 7} - _Type_index_2 = [...]uint8{0, 8} - _Type_index_3 = [...]uint8{0, 10} - _Type_index_4 = [...]uint8{0, 7} - _Type_index_5 = [...]uint8{0, 9} - _Type_index_6 = [...]uint8{0, 8} - _Type_index_7 = [...]uint8{0, 7} - _Type_index_8 = [...]uint8{0, 11} -) - -func (i Type) String() string { - switch { - case i == 0: - return _Type_name_0 - case i == 2: - return _Type_name_1 - case i == 4: - return _Type_name_2 - case i == 8: - return _Type_name_3 - case i == 16: - return _Type_name_4 - case i == 32: - return _Type_name_5 - case i == 64: - return _Type_name_6 - case i == 128: - return _Type_name_7 - case i == 256: - return _Type_name_8 - default: - return fmt.Sprintf("Type(%d)", i) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/unknown.go b/vendor/github.com/hashicorp/hil/ast/unknown.go deleted file mode 100644 index d6ddaec..0000000 --- a/vendor/github.com/hashicorp/hil/ast/unknown.go +++ /dev/null @@ -1,30 +0,0 @@ -package ast - -// IsUnknown reports whether a variable is unknown or contains any value -// that is unknown. This will recurse into lists and maps and so on. -func IsUnknown(v Variable) bool { - // If it is unknown itself, return true - if v.Type == TypeUnknown { - return true - } - - // If it is a container type, check the values - switch v.Type { - case TypeList: - for _, el := range v.Value.([]Variable) { - if IsUnknown(el) { - return true - } - } - case TypeMap: - for _, el := range v.Value.(map[string]Variable) { - if IsUnknown(el) { - return true - } - } - default: - } - - // Not a container type or survive the above checks - return false -} diff --git a/vendor/github.com/hashicorp/hil/ast/variable_access.go b/vendor/github.com/hashicorp/hil/ast/variable_access.go deleted file mode 100644 index 4c1362d..0000000 --- a/vendor/github.com/hashicorp/hil/ast/variable_access.go +++ /dev/null @@ -1,36 +0,0 @@ -package ast - -import ( - "fmt" -) - -// VariableAccess represents a variable access. -type VariableAccess struct { - Name string - Posx Pos -} - -func (n *VariableAccess) Accept(v Visitor) Node { - return v(n) -} - -func (n *VariableAccess) Pos() Pos { - return n.Posx -} - -func (n *VariableAccess) GoString() string { - return fmt.Sprintf("*%#v", *n) -} - -func (n *VariableAccess) String() string { - return fmt.Sprintf("Variable(%s)", n.Name) -} - -func (n *VariableAccess) Type(s Scope) (Type, error) { - v, ok := s.LookupVar(n.Name) - if !ok { - return TypeInvalid, fmt.Errorf("unknown variable: %s", n.Name) - } - - return v.Type, nil -} diff --git a/vendor/github.com/hashicorp/hil/ast/variable_access_test.go b/vendor/github.com/hashicorp/hil/ast/variable_access_test.go deleted file mode 100644 index d97981a..0000000 --- a/vendor/github.com/hashicorp/hil/ast/variable_access_test.go +++ /dev/null @@ -1,53 +0,0 @@ -package ast - -import ( - "testing" -) - -func TestVariableAccessType(t *testing.T) { - c := &VariableAccess{Name: "foo"} - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{Type: TypeString}, - }, - } - - actual, err := c.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeString { - t.Fatalf("bad: %s", actual) - } -} - -func TestVariableAccessType_invalid(t *testing.T) { - c := &VariableAccess{Name: "bar"} - scope := &BasicScope{ - VarMap: map[string]Variable{ - "foo": Variable{Type: TypeString}, - }, - } - - _, err := c.Type(scope) - if err == nil { - t.Fatal("should error") - } -} - -func TestVariableAccessType_list(t *testing.T) { - c := &VariableAccess{Name: "baz"} - scope := &BasicScope{ - VarMap: map[string]Variable{ - "baz": Variable{Type: TypeList}, - }, - } - - actual, err := c.Type(scope) - if err != nil { - t.Fatalf("err: %s", err) - } - if actual != TypeList { - t.Fatalf("bad: %s", actual) - } -} diff --git a/vendor/github.com/hashicorp/hil/ast/variables_helper.go b/vendor/github.com/hashicorp/hil/ast/variables_helper.go deleted file mode 100644 index 06bd18d..0000000 --- a/vendor/github.com/hashicorp/hil/ast/variables_helper.go +++ /dev/null @@ -1,63 +0,0 @@ -package ast - -import "fmt" - -func VariableListElementTypesAreHomogenous(variableName string, list []Variable) (Type, error) { - if len(list) == 0 { - return TypeInvalid, fmt.Errorf("list %q does not have any elements so cannot determine type.", variableName) - } - - elemType := TypeUnknown - for _, v := range list { - if v.Type == TypeUnknown { - continue - } - - if elemType == TypeUnknown { - elemType = v.Type - continue - } - - if v.Type != elemType { - return TypeInvalid, fmt.Errorf( - "list %q does not have homogenous types. found %s and then %s", - variableName, - elemType, v.Type, - ) - } - - elemType = v.Type - } - - return elemType, nil -} - -func VariableMapValueTypesAreHomogenous(variableName string, vmap map[string]Variable) (Type, error) { - if len(vmap) == 0 { - return TypeInvalid, fmt.Errorf("map %q does not have any elements so cannot determine type.", variableName) - } - - elemType := TypeUnknown - for _, v := range vmap { - if v.Type == TypeUnknown { - continue - } - - if elemType == TypeUnknown { - elemType = v.Type - continue - } - - if v.Type != elemType { - return TypeInvalid, fmt.Errorf( - "map %q does not have homogenous types. found %s and then %s", - variableName, - elemType, v.Type, - ) - } - - elemType = v.Type - } - - return elemType, nil -} diff --git a/vendor/github.com/hashicorp/hil/builtins.go b/vendor/github.com/hashicorp/hil/builtins.go deleted file mode 100644 index 909c788..0000000 --- a/vendor/github.com/hashicorp/hil/builtins.go +++ /dev/null @@ -1,331 +0,0 @@ -package hil - -import ( - "errors" - "strconv" - - "github.com/hashicorp/hil/ast" -) - -// NOTE: All builtins are tested in engine_test.go - -func registerBuiltins(scope *ast.BasicScope) *ast.BasicScope { - if scope == nil { - scope = new(ast.BasicScope) - } - if scope.FuncMap == nil { - scope.FuncMap = make(map[string]ast.Function) - } - - // Implicit conversions - scope.FuncMap["__builtin_BoolToString"] = builtinBoolToString() - scope.FuncMap["__builtin_FloatToInt"] = builtinFloatToInt() - scope.FuncMap["__builtin_FloatToString"] = builtinFloatToString() - scope.FuncMap["__builtin_IntToFloat"] = builtinIntToFloat() - scope.FuncMap["__builtin_IntToString"] = builtinIntToString() - scope.FuncMap["__builtin_StringToInt"] = builtinStringToInt() - scope.FuncMap["__builtin_StringToFloat"] = builtinStringToFloat() - scope.FuncMap["__builtin_StringToBool"] = builtinStringToBool() - - // Math operations - scope.FuncMap["__builtin_IntMath"] = builtinIntMath() - scope.FuncMap["__builtin_FloatMath"] = builtinFloatMath() - scope.FuncMap["__builtin_BoolCompare"] = builtinBoolCompare() - scope.FuncMap["__builtin_FloatCompare"] = builtinFloatCompare() - scope.FuncMap["__builtin_IntCompare"] = builtinIntCompare() - scope.FuncMap["__builtin_StringCompare"] = builtinStringCompare() - scope.FuncMap["__builtin_Logical"] = builtinLogical() - return scope -} - -func builtinFloatMath() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeFloat, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(float64) - for _, raw := range args[2:] { - arg := raw.(float64) - switch op { - case ast.ArithmeticOpAdd: - result += arg - case ast.ArithmeticOpSub: - result -= arg - case ast.ArithmeticOpMul: - result *= arg - case ast.ArithmeticOpDiv: - result /= arg - } - } - - return result, nil - }, - } -} - -func builtinIntMath() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeInt, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(int) - for _, raw := range args[2:] { - arg := raw.(int) - switch op { - case ast.ArithmeticOpAdd: - result += arg - case ast.ArithmeticOpSub: - result -= arg - case ast.ArithmeticOpMul: - result *= arg - case ast.ArithmeticOpDiv: - if arg == 0 { - return nil, errors.New("divide by zero") - } - - result /= arg - case ast.ArithmeticOpMod: - if arg == 0 { - return nil, errors.New("divide by zero") - } - - result = result % arg - } - } - - return result, nil - }, - } -} - -func builtinBoolCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeBool, ast.TypeBool}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(bool) - rhs := args[2].(bool) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinFloatCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeFloat, ast.TypeFloat}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(float64) - rhs := args[2].(float64) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - case ast.ArithmeticOpLessThan: - return lhs < rhs, nil - case ast.ArithmeticOpLessThanOrEqual: - return lhs <= rhs, nil - case ast.ArithmeticOpGreaterThan: - return lhs > rhs, nil - case ast.ArithmeticOpGreaterThanOrEqual: - return lhs >= rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinIntCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeInt, ast.TypeInt}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(int) - rhs := args[2].(int) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - case ast.ArithmeticOpLessThan: - return lhs < rhs, nil - case ast.ArithmeticOpLessThanOrEqual: - return lhs <= rhs, nil - case ast.ArithmeticOpGreaterThan: - return lhs > rhs, nil - case ast.ArithmeticOpGreaterThanOrEqual: - return lhs >= rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinStringCompare() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt, ast.TypeString, ast.TypeString}, - Variadic: false, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - lhs := args[1].(string) - rhs := args[2].(string) - - switch op { - case ast.ArithmeticOpEqual: - return lhs == rhs, nil - case ast.ArithmeticOpNotEqual: - return lhs != rhs, nil - default: - return nil, errors.New("invalid comparison operation") - } - }, - } -} - -func builtinLogical() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - Variadic: true, - VariadicType: ast.TypeBool, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - op := args[0].(ast.ArithmeticOp) - result := args[1].(bool) - for _, raw := range args[2:] { - arg := raw.(bool) - switch op { - case ast.ArithmeticOpLogicalOr: - result = result || arg - case ast.ArithmeticOpLogicalAnd: - result = result && arg - default: - return nil, errors.New("invalid logical operator") - } - } - - return result, nil - }, - } -} - -func builtinFloatToInt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeInt, - Callback: func(args []interface{}) (interface{}, error) { - return int(args[0].(float64)), nil - }, - } -} - -func builtinFloatToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeFloat}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatFloat( - args[0].(float64), 'g', -1, 64), nil - }, - } -} - -func builtinIntToFloat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - return float64(args[0].(int)), nil - }, - } -} - -func builtinIntToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatInt(int64(args[0].(int)), 10), nil - }, - } -} - -func builtinStringToInt() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseInt(args[0].(string), 0, 0) - if err != nil { - return nil, err - } - - return int(v), nil - }, - } -} - -func builtinStringToFloat() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeFloat, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseFloat(args[0].(string), 64) - if err != nil { - return nil, err - } - - return v, nil - }, - } -} - -func builtinBoolToString() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeBool}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatBool(args[0].(bool)), nil - }, - } -} - -func builtinStringToBool() ast.Function { - return ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeBool, - Callback: func(args []interface{}) (interface{}, error) { - v, err := strconv.ParseBool(args[0].(string)) - if err != nil { - return nil, err - } - - return v, nil - }, - } -} diff --git a/vendor/github.com/hashicorp/hil/check_identifier.go b/vendor/github.com/hashicorp/hil/check_identifier.go deleted file mode 100644 index 474f505..0000000 --- a/vendor/github.com/hashicorp/hil/check_identifier.go +++ /dev/null @@ -1,88 +0,0 @@ -package hil - -import ( - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// IdentifierCheck is a SemanticCheck that checks that all identifiers -// resolve properly and that the right number of arguments are passed -// to functions. -type IdentifierCheck struct { - Scope ast.Scope - - err error - lock sync.Mutex -} - -func (c *IdentifierCheck) Visit(root ast.Node) error { - c.lock.Lock() - defer c.lock.Unlock() - defer c.reset() - root.Accept(c.visit) - return c.err -} - -func (c *IdentifierCheck) visit(raw ast.Node) ast.Node { - if c.err != nil { - return raw - } - - switch n := raw.(type) { - case *ast.Call: - c.visitCall(n) - case *ast.VariableAccess: - c.visitVariableAccess(n) - case *ast.Output: - // Ignore - case *ast.LiteralNode: - // Ignore - default: - // Ignore - } - - // We never do replacement with this visitor - return raw -} - -func (c *IdentifierCheck) visitCall(n *ast.Call) { - // Look up the function in the map - function, ok := c.Scope.LookupFunc(n.Func) - if !ok { - c.createErr(n, fmt.Sprintf("unknown function called: %s", n.Func)) - return - } - - // Break up the args into what is variadic and what is required - args := n.Args - if function.Variadic && len(args) > len(function.ArgTypes) { - args = n.Args[:len(function.ArgTypes)] - } - - // Verify the number of arguments - if len(args) != len(function.ArgTypes) { - c.createErr(n, fmt.Sprintf( - "%s: expected %d arguments, got %d", - n.Func, len(function.ArgTypes), len(n.Args))) - return - } -} - -func (c *IdentifierCheck) visitVariableAccess(n *ast.VariableAccess) { - // Look up the variable in the map - if _, ok := c.Scope.LookupVar(n.Name); !ok { - c.createErr(n, fmt.Sprintf( - "unknown variable accessed: %s", n.Name)) - return - } -} - -func (c *IdentifierCheck) createErr(n ast.Node, str string) { - c.err = fmt.Errorf("%s: %s", n.Pos(), str) -} - -func (c *IdentifierCheck) reset() { - c.err = nil -} diff --git a/vendor/github.com/hashicorp/hil/check_identifier_test.go b/vendor/github.com/hashicorp/hil/check_identifier_test.go deleted file mode 100644 index ab71c1c..0000000 --- a/vendor/github.com/hashicorp/hil/check_identifier_test.go +++ /dev/null @@ -1,141 +0,0 @@ -package hil - -import ( - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestIdentifierCheck(t *testing.T) { - cases := []struct { - Input string - Scope ast.Scope - Error bool - }{ - { - "foo", - &ast.BasicScope{}, - false, - }, - - { - "foo ${bar} success", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: "baz", - Type: ast.TypeString, - }, - }, - }, - false, - }, - - { - "foo ${bar}", - &ast.BasicScope{}, - true, - }, - - { - "foo ${rand()} success", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - "foo ${rand()}", - &ast.BasicScope{}, - true, - }, - - { - "foo ${rand(42)} ", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - true, - }, - - { - "foo ${rand()} ", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeInt, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - "foo ${rand(42)} ", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeInt, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - "foo ${rand(\"foo\", 42)} ", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeInt, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - } - - for _, tc := range cases { - node, err := Parse(tc.Input) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - - visitor := &IdentifierCheck{Scope: tc.Scope} - err = visitor.Visit(node) - if err != nil != tc.Error { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/check_types.go b/vendor/github.com/hashicorp/hil/check_types.go deleted file mode 100644 index f16da39..0000000 --- a/vendor/github.com/hashicorp/hil/check_types.go +++ /dev/null @@ -1,668 +0,0 @@ -package hil - -import ( - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// TypeCheck implements ast.Visitor for type checking an AST tree. -// It requires some configuration to look up the type of nodes. -// -// It also optionally will not type error and will insert an implicit -// type conversions for specific types if specified by the Implicit -// field. Note that this is kind of organizationally weird to put into -// this structure but we'd rather do that than duplicate the type checking -// logic multiple times. -type TypeCheck struct { - Scope ast.Scope - - // Implicit is a map of implicit type conversions that we can do, - // and that shouldn't error. The key of the first map is the from type, - // the key of the second map is the to type, and the final string - // value is the function to call (which must be registered in the Scope). - Implicit map[ast.Type]map[ast.Type]string - - // Stack of types. This shouldn't be used directly except by implementations - // of TypeCheckNode. - Stack []ast.Type - - err error - lock sync.Mutex -} - -// TypeCheckNode is the interface that must be implemented by any -// ast.Node that wants to support type-checking. If the type checker -// encounters a node that doesn't implement this, it will error. -type TypeCheckNode interface { - TypeCheck(*TypeCheck) (ast.Node, error) -} - -func (v *TypeCheck) Visit(root ast.Node) error { - v.lock.Lock() - defer v.lock.Unlock() - defer v.reset() - root.Accept(v.visit) - - // If the resulting type is unknown, then just let the whole thing go. - if v.err == errExitUnknown { - v.err = nil - } - - return v.err -} - -func (v *TypeCheck) visit(raw ast.Node) ast.Node { - if v.err != nil { - return raw - } - - var result ast.Node - var err error - switch n := raw.(type) { - case *ast.Arithmetic: - tc := &typeCheckArithmetic{n} - result, err = tc.TypeCheck(v) - case *ast.Call: - tc := &typeCheckCall{n} - result, err = tc.TypeCheck(v) - case *ast.Conditional: - tc := &typeCheckConditional{n} - result, err = tc.TypeCheck(v) - case *ast.Index: - tc := &typeCheckIndex{n} - result, err = tc.TypeCheck(v) - case *ast.Output: - tc := &typeCheckOutput{n} - result, err = tc.TypeCheck(v) - case *ast.LiteralNode: - tc := &typeCheckLiteral{n} - result, err = tc.TypeCheck(v) - case *ast.VariableAccess: - tc := &typeCheckVariableAccess{n} - result, err = tc.TypeCheck(v) - default: - tc, ok := raw.(TypeCheckNode) - if !ok { - err = fmt.Errorf("unknown node for type check: %#v", raw) - break - } - - result, err = tc.TypeCheck(v) - } - - if err != nil { - pos := raw.Pos() - v.err = fmt.Errorf("At column %d, line %d: %s", - pos.Column, pos.Line, err) - } - - return result -} - -type typeCheckArithmetic struct { - n *ast.Arithmetic -} - -func (tc *typeCheckArithmetic) TypeCheck(v *TypeCheck) (ast.Node, error) { - // The arguments are on the stack in reverse order, so pop them off. - exprs := make([]ast.Type, len(tc.n.Exprs)) - for i, _ := range tc.n.Exprs { - exprs[len(tc.n.Exprs)-1-i] = v.StackPop() - } - - // If any operand is unknown then our result is automatically unknown - for _, ty := range exprs { - if ty == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - } - - switch tc.n.Op { - case ast.ArithmeticOpLogicalAnd, ast.ArithmeticOpLogicalOr: - return tc.checkLogical(v, exprs) - case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual, - ast.ArithmeticOpLessThan, ast.ArithmeticOpGreaterThan, - ast.ArithmeticOpGreaterThanOrEqual, ast.ArithmeticOpLessThanOrEqual: - return tc.checkComparison(v, exprs) - default: - return tc.checkNumeric(v, exprs) - } - -} - -func (tc *typeCheckArithmetic) checkNumeric(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - // Determine the resulting type we want. We do this by going over - // every expression until we find one with a type we recognize. - // We do this because the first expr might be a string ("var.foo") - // and we need to know what to implicit to. - mathFunc := "__builtin_IntMath" - mathType := ast.TypeInt - for _, v := range exprs { - // We assume int math but if we find ANY float, the entire - // expression turns into floating point math. - if v == ast.TypeFloat { - mathFunc = "__builtin_FloatMath" - mathType = v - break - } - } - - // Verify the args - for i, arg := range exprs { - if arg != mathType { - cn := v.ImplicitConversion(exprs[i], mathType, tc.n.Exprs[i]) - if cn != nil { - tc.n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "operand %d should be %s, got %s", - i+1, mathType, arg) - } - } - - // Modulo doesn't work for floats - if mathType == ast.TypeFloat && tc.n.Op == ast.ArithmeticOpMod { - return nil, fmt.Errorf("modulo cannot be used with floats") - } - - // Return type - v.StackPush(mathType) - - // Replace our node with a call to the proper function. This isn't - // type checked but we already verified types. - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: mathFunc, - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -func (tc *typeCheckArithmetic) checkComparison(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - if len(exprs) != 2 { - // This should never happen, because the parser never produces - // nodes that violate this. - return nil, fmt.Errorf( - "comparison operators must have exactly two operands", - ) - } - - // The first operand always dictates the type for a comparison. - compareFunc := "" - compareType := exprs[0] - switch compareType { - case ast.TypeBool: - compareFunc = "__builtin_BoolCompare" - case ast.TypeFloat: - compareFunc = "__builtin_FloatCompare" - case ast.TypeInt: - compareFunc = "__builtin_IntCompare" - case ast.TypeString: - compareFunc = "__builtin_StringCompare" - default: - return nil, fmt.Errorf( - "comparison operators apply only to bool, float, int, and string", - ) - } - - // For non-equality comparisons, we will do implicit conversions to - // integer types if possible. In this case, we need to go through and - // determine the type of comparison we're doing to enable the implicit - // conversion. - if tc.n.Op != ast.ArithmeticOpEqual && tc.n.Op != ast.ArithmeticOpNotEqual { - compareFunc = "__builtin_IntCompare" - compareType = ast.TypeInt - for _, expr := range exprs { - if expr == ast.TypeFloat { - compareFunc = "__builtin_FloatCompare" - compareType = ast.TypeFloat - break - } - } - } - - // Verify (and possibly, convert) the args - for i, arg := range exprs { - if arg != compareType { - cn := v.ImplicitConversion(exprs[i], compareType, tc.n.Exprs[i]) - if cn != nil { - tc.n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "operand %d should be %s, got %s", - i+1, compareType, arg, - ) - } - } - - // Only ints and floats can have the <, >, <= and >= operators applied - switch tc.n.Op { - case ast.ArithmeticOpEqual, ast.ArithmeticOpNotEqual: - // anything goes - default: - switch compareType { - case ast.TypeFloat, ast.TypeInt: - // fine - default: - return nil, fmt.Errorf( - "<, >, <= and >= may apply only to int and float values", - ) - } - } - - // Comparison operators always return bool - v.StackPush(ast.TypeBool) - - // Replace our node with a call to the proper function. This isn't - // type checked but we already verified types. - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: compareFunc, - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -func (tc *typeCheckArithmetic) checkLogical(v *TypeCheck, exprs []ast.Type) (ast.Node, error) { - for i, t := range exprs { - if t != ast.TypeBool { - cn := v.ImplicitConversion(t, ast.TypeBool, tc.n.Exprs[i]) - if cn == nil { - return nil, fmt.Errorf( - "logical operators require boolean operands, not %s", - t, - ) - } - tc.n.Exprs[i] = cn - } - } - - // Return type is always boolean - v.StackPush(ast.TypeBool) - - // Arithmetic nodes are replaced with a call to a built-in function - args := make([]ast.Node, len(tc.n.Exprs)+1) - args[0] = &ast.LiteralNode{ - Value: tc.n.Op, - Typex: ast.TypeInt, - Posx: tc.n.Pos(), - } - copy(args[1:], tc.n.Exprs) - return &ast.Call{ - Func: "__builtin_Logical", - Args: args, - Posx: tc.n.Pos(), - }, nil -} - -type typeCheckCall struct { - n *ast.Call -} - -func (tc *typeCheckCall) TypeCheck(v *TypeCheck) (ast.Node, error) { - // Look up the function in the map - function, ok := v.Scope.LookupFunc(tc.n.Func) - if !ok { - return nil, fmt.Errorf("unknown function called: %s", tc.n.Func) - } - - // The arguments are on the stack in reverse order, so pop them off. - args := make([]ast.Type, len(tc.n.Args)) - for i, _ := range tc.n.Args { - args[len(tc.n.Args)-1-i] = v.StackPop() - } - - // Verify the args - for i, expected := range function.ArgTypes { - if expected == ast.TypeAny { - continue - } - - if args[i] == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if args[i] != expected { - cn := v.ImplicitConversion(args[i], expected, tc.n.Args[i]) - if cn != nil { - tc.n.Args[i] = cn - continue - } - - return nil, fmt.Errorf( - "%s: argument %d should be %s, got %s", - tc.n.Func, i+1, expected.Printable(), args[i].Printable()) - } - } - - // If we're variadic, then verify the types there - if function.Variadic && function.VariadicType != ast.TypeAny { - args = args[len(function.ArgTypes):] - for i, t := range args { - if t == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if t != function.VariadicType { - realI := i + len(function.ArgTypes) - cn := v.ImplicitConversion( - t, function.VariadicType, tc.n.Args[realI]) - if cn != nil { - tc.n.Args[realI] = cn - continue - } - - return nil, fmt.Errorf( - "%s: argument %d should be %s, got %s", - tc.n.Func, realI, - function.VariadicType.Printable(), t.Printable()) - } - } - } - - // Return type - v.StackPush(function.ReturnType) - - return tc.n, nil -} - -type typeCheckConditional struct { - n *ast.Conditional -} - -func (tc *typeCheckConditional) TypeCheck(v *TypeCheck) (ast.Node, error) { - // On the stack we have the types of the condition, true and false - // expressions, but they are in reverse order. - falseType := v.StackPop() - trueType := v.StackPop() - condType := v.StackPop() - - if condType == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - if condType != ast.TypeBool { - cn := v.ImplicitConversion(condType, ast.TypeBool, tc.n.CondExpr) - if cn == nil { - return nil, fmt.Errorf( - "condition must be type bool, not %s", condType.Printable(), - ) - } - tc.n.CondExpr = cn - } - - // The types of the true and false expression must match - if trueType != falseType && trueType != ast.TypeUnknown && falseType != ast.TypeUnknown { - - // Since passing around stringified versions of other types is - // common, we pragmatically allow the false expression to dictate - // the result type when the true expression is a string. - if trueType == ast.TypeString { - cn := v.ImplicitConversion(trueType, falseType, tc.n.TrueExpr) - if cn == nil { - return nil, fmt.Errorf( - "true and false expression types must match; have %s and %s", - trueType.Printable(), falseType.Printable(), - ) - } - tc.n.TrueExpr = cn - trueType = falseType - } else { - cn := v.ImplicitConversion(falseType, trueType, tc.n.FalseExpr) - if cn == nil { - return nil, fmt.Errorf( - "true and false expression types must match; have %s and %s", - trueType.Printable(), falseType.Printable(), - ) - } - tc.n.FalseExpr = cn - falseType = trueType - } - } - - // Currently list and map types cannot be used, because we cannot - // generally assert that their element types are consistent. - // Such support might be added later, either by improving the type - // system or restricting usage to only variable and literal expressions, - // but for now this is simply prohibited because it doesn't seem to - // be a common enough case to be worth the complexity. - switch trueType { - case ast.TypeList: - return nil, fmt.Errorf( - "conditional operator cannot be used with list values", - ) - case ast.TypeMap: - return nil, fmt.Errorf( - "conditional operator cannot be used with map values", - ) - } - - // Result type (guaranteed to also match falseType due to the above) - if trueType == ast.TypeUnknown { - // falseType may also be unknown, but that's okay because two - // unknowns means our result is unknown anyway. - v.StackPush(falseType) - } else { - v.StackPush(trueType) - } - - return tc.n, nil -} - -type typeCheckOutput struct { - n *ast.Output -} - -func (tc *typeCheckOutput) TypeCheck(v *TypeCheck) (ast.Node, error) { - n := tc.n - types := make([]ast.Type, len(n.Exprs)) - for i, _ := range n.Exprs { - types[len(n.Exprs)-1-i] = v.StackPop() - } - - for _, ty := range types { - if ty == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - } - - // If there is only one argument and it is a list, we evaluate to a list - if len(types) == 1 { - switch t := types[0]; t { - case ast.TypeList: - fallthrough - case ast.TypeMap: - v.StackPush(t) - return n, nil - } - } - - // Otherwise, all concat args must be strings, so validate that - resultType := ast.TypeString - for i, t := range types { - - if t == ast.TypeUnknown { - resultType = ast.TypeUnknown - continue - } - - if t != ast.TypeString { - cn := v.ImplicitConversion(t, ast.TypeString, n.Exprs[i]) - if cn != nil { - n.Exprs[i] = cn - continue - } - - return nil, fmt.Errorf( - "output of an HIL expression must be a string, or a single list (argument %d is %s)", i+1, t) - } - } - - // This always results in type string, unless there are unknowns - v.StackPush(resultType) - - return n, nil -} - -type typeCheckLiteral struct { - n *ast.LiteralNode -} - -func (tc *typeCheckLiteral) TypeCheck(v *TypeCheck) (ast.Node, error) { - v.StackPush(tc.n.Typex) - return tc.n, nil -} - -type typeCheckVariableAccess struct { - n *ast.VariableAccess -} - -func (tc *typeCheckVariableAccess) TypeCheck(v *TypeCheck) (ast.Node, error) { - // Look up the variable in the map - variable, ok := v.Scope.LookupVar(tc.n.Name) - if !ok { - return nil, fmt.Errorf( - "unknown variable accessed: %s", tc.n.Name) - } - - // Add the type to the stack - v.StackPush(variable.Type) - - return tc.n, nil -} - -type typeCheckIndex struct { - n *ast.Index -} - -func (tc *typeCheckIndex) TypeCheck(v *TypeCheck) (ast.Node, error) { - keyType := v.StackPop() - targetType := v.StackPop() - - if keyType == ast.TypeUnknown || targetType == ast.TypeUnknown { - v.StackPush(ast.TypeUnknown) - return tc.n, nil - } - - // Ensure we have a VariableAccess as the target - varAccessNode, ok := tc.n.Target.(*ast.VariableAccess) - if !ok { - return nil, fmt.Errorf( - "target of an index must be a VariableAccess node, was %T", tc.n.Target) - } - - // Get the variable - variable, ok := v.Scope.LookupVar(varAccessNode.Name) - if !ok { - return nil, fmt.Errorf( - "unknown variable accessed: %s", varAccessNode.Name) - } - - switch targetType { - case ast.TypeList: - if keyType != ast.TypeInt { - tc.n.Key = v.ImplicitConversion(keyType, ast.TypeInt, tc.n.Key) - if tc.n.Key == nil { - return nil, fmt.Errorf( - "key of an index must be an int, was %s", keyType) - } - } - - valType, err := ast.VariableListElementTypesAreHomogenous( - varAccessNode.Name, variable.Value.([]ast.Variable)) - if err != nil { - return tc.n, err - } - - v.StackPush(valType) - return tc.n, nil - case ast.TypeMap: - if keyType != ast.TypeString { - tc.n.Key = v.ImplicitConversion(keyType, ast.TypeString, tc.n.Key) - if tc.n.Key == nil { - return nil, fmt.Errorf( - "key of an index must be a string, was %s", keyType) - } - } - - valType, err := ast.VariableMapValueTypesAreHomogenous( - varAccessNode.Name, variable.Value.(map[string]ast.Variable)) - if err != nil { - return tc.n, err - } - - v.StackPush(valType) - return tc.n, nil - default: - return nil, fmt.Errorf("invalid index operation into non-indexable type: %s", variable.Type) - } -} - -func (v *TypeCheck) ImplicitConversion( - actual ast.Type, expected ast.Type, n ast.Node) ast.Node { - if v.Implicit == nil { - return nil - } - - fromMap, ok := v.Implicit[actual] - if !ok { - return nil - } - - toFunc, ok := fromMap[expected] - if !ok { - return nil - } - - return &ast.Call{ - Func: toFunc, - Args: []ast.Node{n}, - Posx: n.Pos(), - } -} - -func (v *TypeCheck) reset() { - v.Stack = nil - v.err = nil -} - -func (v *TypeCheck) StackPush(t ast.Type) { - v.Stack = append(v.Stack, t) -} - -func (v *TypeCheck) StackPop() ast.Type { - var x ast.Type - x, v.Stack = v.Stack[len(v.Stack)-1], v.Stack[:len(v.Stack)-1] - return x -} - -func (v *TypeCheck) StackPeek() ast.Type { - if len(v.Stack) == 0 { - return ast.TypeInvalid - } - - return v.Stack[len(v.Stack)-1] -} diff --git a/vendor/github.com/hashicorp/hil/check_types_test.go b/vendor/github.com/hashicorp/hil/check_types_test.go deleted file mode 100644 index d56f701..0000000 --- a/vendor/github.com/hashicorp/hil/check_types_test.go +++ /dev/null @@ -1,546 +0,0 @@ -package hil - -import ( - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestTypeCheck(t *testing.T) { - cases := []struct { - Input string - Scope ast.Scope - Error bool - }{ - { - "foo", - &ast.BasicScope{}, - false, - }, - - { - "foo ${bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: "baz", - Type: ast.TypeString, - }, - }, - }, - false, - }, - - { - "foo ${rand()}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - `foo ${rand("42")}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - `foo ${rand(42)}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - true, - }, - - { - `foo ${rand()}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: nil, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - `foo ${rand("42")}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: nil, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - }, - - { - `foo ${rand("42", 42)}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ArgTypes: nil, - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - true, - }, - - { - "${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - }, - - { - "${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 3, - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - true, - }, - - { - "${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "Hello World", - }, - }, - }, - true, - }, - - { - "foo ${bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 42, - Type: ast.TypeInt, - }, - }, - }, - true, - }, - - { - "foo ${rand()}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeInt, - Callback: func([]interface{}) (interface{}, error) { - return 42, nil - }, - }, - }, - }, - true, - }, - - { - `foo ${true ? "foo" : "bar"}`, - &ast.BasicScope{}, - false, - }, - - { - // can't use different types for true and false expressions - `foo ${true ? 1 : "baz"}`, - &ast.BasicScope{}, - true, - }, - - { - // condition must be boolean - `foo ${"foo" ? 1 : 5}`, - &ast.BasicScope{}, - true, - }, - - { - // conditional with unknown value is permitted - `foo ${true ? known : unknown}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "known": ast.Variable{ - Type: ast.TypeString, - Value: "bar", - }, - "unknown": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - }, - - { - // conditional with unknown value the other way permitted too - `foo ${true ? unknown : known}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "known": ast.Variable{ - Type: ast.TypeString, - Value: "bar", - }, - "unknown": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - }, - - { - // conditional with two unknowns is allowed - `foo ${true ? unknown : unknown}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - }, - - { - // conditional with unknown condition is allowed - `foo ${unknown ? 1 : 2}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - }, - - { - // currently lists are not allowed at all - `foo ${true ? arr1 : arr2}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "arr1": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 3, - }, - }, - }, - "arr2": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 4, - }, - }, - }, - }, - }, - true, - }, - - { - // mismatching element types are invalid - `foo ${true ? arr1 : arr2}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "arr1": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 3, - }, - }, - }, - "arr2": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "foo", - }, - }, - }, - }, - }, - true, - }, - } - - for _, tc := range cases { - node, err := Parse(tc.Input) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - - visitor := &TypeCheck{Scope: tc.Scope} - err = visitor.Visit(node) - if err != nil != tc.Error { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - } -} - -func TestTypeCheck_implicit(t *testing.T) { - implicitMap := map[ast.Type]map[ast.Type]string{ - ast.TypeInt: { - ast.TypeString: "intToString", - }, - } - - cases := []struct { - Input string - Scope *ast.BasicScope - Error bool - }{ - { - "foo ${bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 42, - Type: ast.TypeInt, - }, - }, - }, - false, - }, - - { - "foo ${foo(42)}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "foo": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - }, - }, - }, - false, - }, - - { - `foo ${foo("42", 42)}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "foo": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - Variadic: true, - VariadicType: ast.TypeString, - ReturnType: ast.TypeString, - }, - }, - }, - false, - }, - - { - "${foo[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 23, - }, - }, - }, - }, - }, - false, - }, - - { - "${foo[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - }, - - { - `${foo[bar[var.keyint]]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "i dont exist", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "bar", - }, - }, - }, - "var.keyint": ast.Variable{ - Type: ast.TypeInt, - Value: 1, - }, - }, - }, - false, - }, - } - - for _, tc := range cases { - t.Run(tc.Input, func(t *testing.T) { - node, err := Parse(tc.Input) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - - // Modify the scope to add our conversion functions. - if tc.Scope.FuncMap == nil { - tc.Scope.FuncMap = make(map[string]ast.Function) - } - tc.Scope.FuncMap["intToString"] = ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - } - - // Do the first pass... - visitor := &TypeCheck{Scope: tc.Scope, Implicit: implicitMap} - err = visitor.Visit(node) - if err != nil != tc.Error { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - if err != nil { - return - } - - // If we didn't error, then the next type check should not fail - // WITHOUT implicits. - visitor = &TypeCheck{Scope: tc.Scope} - err = visitor.Visit(node) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hil/convert.go b/vendor/github.com/hashicorp/hil/convert.go deleted file mode 100644 index f2024d0..0000000 --- a/vendor/github.com/hashicorp/hil/convert.go +++ /dev/null @@ -1,159 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/mapstructure" -) - -// UnknownValue is a sentinel value that can be used to denote -// that a value of a variable (or map element, list element, etc.) -// is unknown. This will always have the type ast.TypeUnknown. -const UnknownValue = "74D93920-ED26-11E3-AC10-0800200C9A66" - -var hilMapstructureDecodeHookSlice []interface{} -var hilMapstructureDecodeHookStringSlice []string -var hilMapstructureDecodeHookMap map[string]interface{} - -// hilMapstructureWeakDecode behaves in the same way as mapstructure.WeakDecode -// but has a DecodeHook which defeats the backward compatibility mode of mapstructure -// which WeakDecodes []interface{}{} into an empty map[string]interface{}. This -// allows us to use WeakDecode (desirable), but not fail on empty lists. -func hilMapstructureWeakDecode(m interface{}, rawVal interface{}) error { - config := &mapstructure.DecoderConfig{ - DecodeHook: func(source reflect.Type, target reflect.Type, val interface{}) (interface{}, error) { - sliceType := reflect.TypeOf(hilMapstructureDecodeHookSlice) - stringSliceType := reflect.TypeOf(hilMapstructureDecodeHookStringSlice) - mapType := reflect.TypeOf(hilMapstructureDecodeHookMap) - - if (source == sliceType || source == stringSliceType) && target == mapType { - return nil, fmt.Errorf("Cannot convert %s into a %s", source, target) - } - - return val, nil - }, - WeaklyTypedInput: true, - Result: rawVal, - } - - decoder, err := mapstructure.NewDecoder(config) - if err != nil { - return err - } - - return decoder.Decode(m) -} - -func InterfaceToVariable(input interface{}) (ast.Variable, error) { - if inputVariable, ok := input.(ast.Variable); ok { - return inputVariable, nil - } - - var stringVal string - if err := hilMapstructureWeakDecode(input, &stringVal); err == nil { - // Special case the unknown value to turn into "unknown" - if stringVal == UnknownValue { - return ast.Variable{Value: UnknownValue, Type: ast.TypeUnknown}, nil - } - - // Otherwise return the string value - return ast.Variable{ - Type: ast.TypeString, - Value: stringVal, - }, nil - } - - var mapVal map[string]interface{} - if err := hilMapstructureWeakDecode(input, &mapVal); err == nil { - elements := make(map[string]ast.Variable) - for i, element := range mapVal { - varElement, err := InterfaceToVariable(element) - if err != nil { - return ast.Variable{}, err - } - elements[i] = varElement - } - - return ast.Variable{ - Type: ast.TypeMap, - Value: elements, - }, nil - } - - var sliceVal []interface{} - if err := hilMapstructureWeakDecode(input, &sliceVal); err == nil { - elements := make([]ast.Variable, len(sliceVal)) - for i, element := range sliceVal { - varElement, err := InterfaceToVariable(element) - if err != nil { - return ast.Variable{}, err - } - elements[i] = varElement - } - - return ast.Variable{ - Type: ast.TypeList, - Value: elements, - }, nil - } - - return ast.Variable{}, fmt.Errorf("value for conversion must be a string, interface{} or map[string]interface: got %T", input) -} - -func VariableToInterface(input ast.Variable) (interface{}, error) { - if input.Type == ast.TypeString { - if inputStr, ok := input.Value.(string); ok { - return inputStr, nil - } else { - return nil, fmt.Errorf("ast.Variable with type string has value which is not a string") - } - } - - if input.Type == ast.TypeList { - inputList, ok := input.Value.([]ast.Variable) - if !ok { - return nil, fmt.Errorf("ast.Variable with type list has value which is not a []ast.Variable") - } - - result := make([]interface{}, 0) - if len(inputList) == 0 { - return result, nil - } - - for _, element := range inputList { - if convertedElement, err := VariableToInterface(element); err == nil { - result = append(result, convertedElement) - } else { - return nil, err - } - } - - return result, nil - } - - if input.Type == ast.TypeMap { - inputMap, ok := input.Value.(map[string]ast.Variable) - if !ok { - return nil, fmt.Errorf("ast.Variable with type map has value which is not a map[string]ast.Variable") - } - - result := make(map[string]interface{}, 0) - if len(inputMap) == 0 { - return result, nil - } - - for key, value := range inputMap { - if convertedValue, err := VariableToInterface(value); err == nil { - result[key] = convertedValue - } else { - return nil, err - } - } - - return result, nil - } - - return nil, fmt.Errorf("unknown input type: %s", input.Type) -} diff --git a/vendor/github.com/hashicorp/hil/convert_test.go b/vendor/github.com/hashicorp/hil/convert_test.go deleted file mode 100644 index a6a93a9..0000000 --- a/vendor/github.com/hashicorp/hil/convert_test.go +++ /dev/null @@ -1,413 +0,0 @@ -package hil - -import ( - "reflect" - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestInterfaceToVariable_variableInput(t *testing.T) { - _, err := InterfaceToVariable(ast.Variable{ - Type: ast.TypeString, - Value: "Hello world", - }) - - if err != nil { - t.Fatalf("Bad: %s", err) - } -} - -func TestInterfaceToVariable(t *testing.T) { - testCases := []struct { - name string - input interface{} - expected ast.Variable - }{ - { - name: "string", - input: "Hello world", - expected: ast.Variable{ - Type: ast.TypeString, - Value: "Hello world", - }, - }, - { - name: "empty list", - input: []interface{}{}, - expected: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{}, - }, - }, - { - name: "empty list of strings", - input: []string{}, - expected: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{}, - }, - }, - { - name: "int", - input: 1, - expected: ast.Variable{ - Type: ast.TypeString, - Value: "1", - }, - }, - { - name: "list of strings", - input: []string{"Hello", "World"}, - expected: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - { - name: "list of lists of strings", - input: [][]interface{}{[]interface{}{"Hello", "World"}, []interface{}{"Goodbye", "World"}}, - expected: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Goodbye", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - }, - { - name: "list with unknown", - input: []string{"Hello", UnknownValue}, - expected: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - }, - { - name: "map of string->string", - input: map[string]string{"Hello": "World", "Foo": "Bar"}, - expected: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "Hello": { - Type: ast.TypeString, - Value: "World", - }, - "Foo": { - Type: ast.TypeString, - Value: "Bar", - }, - }, - }, - }, - { - name: "map of lists of strings", - input: map[string][]string{ - "Hello": []string{"Hello", "World"}, - "Goodbye": []string{"Goodbye", "World"}, - }, - expected: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "Hello": { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - "Goodbye": { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Goodbye", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - }, - { - name: "empty map", - input: map[string]string{}, - expected: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{}, - }, - }, - { - name: "three-element map", - input: map[string]string{ - "us-west-1": "ami-123456", - "us-west-2": "ami-456789", - "eu-west-1": "ami-012345", - }, - expected: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "us-west-1": { - Type: ast.TypeString, - Value: "ami-123456", - }, - "us-west-2": { - Type: ast.TypeString, - Value: "ami-456789", - }, - "eu-west-1": { - Type: ast.TypeString, - Value: "ami-012345", - }, - }, - }, - }, - } - - for _, tc := range testCases { - output, err := InterfaceToVariable(tc.input) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(output, tc.expected) { - t.Fatalf("%s:\nExpected: %s\n Got: %s\n", tc.name, tc.expected, output) - } - } -} - -func TestVariableToInterface(t *testing.T) { - testCases := []struct { - name string - expected interface{} - input ast.Variable - }{ - { - name: "string", - expected: "Hello world", - input: ast.Variable{ - Type: ast.TypeString, - Value: "Hello world", - }, - }, - { - name: "empty list", - expected: []interface{}{}, - input: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{}, - }, - }, - { - name: "int", - expected: "1", - input: ast.Variable{ - Type: ast.TypeString, - Value: "1", - }, - }, - { - name: "list of strings", - expected: []interface{}{"Hello", "World"}, - input: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - { - name: "list of lists of strings", - expected: []interface{}{[]interface{}{"Hello", "World"}, []interface{}{"Goodbye", "World"}}, - input: ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Goodbye", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - }, - { - name: "map of string->string", - expected: map[string]interface{}{"Hello": "World", "Foo": "Bar"}, - input: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "Hello": { - Type: ast.TypeString, - Value: "World", - }, - "Foo": { - Type: ast.TypeString, - Value: "Bar", - }, - }, - }, - }, - { - name: "map of lists of strings", - expected: map[string]interface{}{ - "Hello": []interface{}{"Hello", "World"}, - "Goodbye": []interface{}{"Goodbye", "World"}, - }, - input: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "Hello": { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Hello", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - "Goodbye": { - Type: ast.TypeList, - Value: []ast.Variable{ - { - Type: ast.TypeString, - Value: "Goodbye", - }, - { - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - }, - { - name: "empty map", - expected: map[string]interface{}{}, - input: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{}, - }, - }, - { - name: "three-element map", - expected: map[string]interface{}{ - "us-west-1": "ami-123456", - "us-west-2": "ami-456789", - "eu-west-1": "ami-012345", - }, - input: ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "us-west-1": { - Type: ast.TypeString, - Value: "ami-123456", - }, - "us-west-2": { - Type: ast.TypeString, - Value: "ami-456789", - }, - "eu-west-1": { - Type: ast.TypeString, - Value: "ami-012345", - }, - }, - }, - }, - } - - for _, tc := range testCases { - output, err := VariableToInterface(tc.input) - if err != nil { - t.Fatal(err) - } - - if !reflect.DeepEqual(output, tc.expected) { - t.Fatalf("%s:\nExpected: %s\n Got: %s\n", tc.name, - tc.expected, output) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/eval.go b/vendor/github.com/hashicorp/hil/eval.go deleted file mode 100644 index 2782076..0000000 --- a/vendor/github.com/hashicorp/hil/eval.go +++ /dev/null @@ -1,472 +0,0 @@ -package hil - -import ( - "bytes" - "errors" - "fmt" - "sync" - - "github.com/hashicorp/hil/ast" -) - -// EvalConfig is the configuration for evaluating. -type EvalConfig struct { - // GlobalScope is the global scope of execution for evaluation. - GlobalScope *ast.BasicScope - - // SemanticChecks is a list of additional semantic checks that will be run - // on the tree prior to evaluating it. The type checker, identifier checker, - // etc. will be run before these automatically. - SemanticChecks []SemanticChecker -} - -// SemanticChecker is the type that must be implemented to do a -// semantic check on an AST tree. This will be called with the root node. -type SemanticChecker func(ast.Node) error - -// EvaluationResult is a struct returned from the hil.Eval function, -// representing the result of an interpolation. Results are returned in their -// "natural" Go structure rather than in terms of the HIL AST. For the types -// currently implemented, this means that the Value field can be interpreted as -// the following Go types: -// TypeInvalid: undefined -// TypeString: string -// TypeList: []interface{} -// TypeMap: map[string]interface{} -// TypBool: bool -type EvaluationResult struct { - Type EvalType - Value interface{} -} - -// InvalidResult is a structure representing the result of a HIL interpolation -// which has invalid syntax, missing variables, or some other type of error. -// The error is described out of band in the accompanying error return value. -var InvalidResult = EvaluationResult{Type: TypeInvalid, Value: nil} - -// errExitUnknown is an internal error that when returned means the result -// is an unknown value. We use this for early exit. -var errExitUnknown = errors.New("unknown value") - -func Eval(root ast.Node, config *EvalConfig) (EvaluationResult, error) { - output, outputType, err := internalEval(root, config) - if err != nil { - return InvalidResult, err - } - - // If the result contains any nested unknowns then the result as a whole - // is unknown, so that callers only have to deal with "entirely known" - // or "entirely unknown" as outcomes. - if ast.IsUnknown(ast.Variable{Type: outputType, Value: output}) { - outputType = ast.TypeUnknown - output = UnknownValue - } - - switch outputType { - case ast.TypeList: - val, err := VariableToInterface(ast.Variable{ - Type: ast.TypeList, - Value: output, - }) - return EvaluationResult{ - Type: TypeList, - Value: val, - }, err - case ast.TypeMap: - val, err := VariableToInterface(ast.Variable{ - Type: ast.TypeMap, - Value: output, - }) - return EvaluationResult{ - Type: TypeMap, - Value: val, - }, err - case ast.TypeString: - return EvaluationResult{ - Type: TypeString, - Value: output, - }, nil - case ast.TypeBool: - return EvaluationResult{ - Type: TypeBool, - Value: output, - }, nil - case ast.TypeUnknown: - return EvaluationResult{ - Type: TypeUnknown, - Value: UnknownValue, - }, nil - default: - return InvalidResult, fmt.Errorf("unknown type %s as interpolation output", outputType) - } -} - -// Eval evaluates the given AST tree and returns its output value, the type -// of the output, and any error that occurred. -func internalEval(root ast.Node, config *EvalConfig) (interface{}, ast.Type, error) { - // Copy the scope so we can add our builtins - if config == nil { - config = new(EvalConfig) - } - scope := registerBuiltins(config.GlobalScope) - implicitMap := map[ast.Type]map[ast.Type]string{ - ast.TypeFloat: { - ast.TypeInt: "__builtin_FloatToInt", - ast.TypeString: "__builtin_FloatToString", - }, - ast.TypeInt: { - ast.TypeFloat: "__builtin_IntToFloat", - ast.TypeString: "__builtin_IntToString", - }, - ast.TypeString: { - ast.TypeInt: "__builtin_StringToInt", - ast.TypeFloat: "__builtin_StringToFloat", - ast.TypeBool: "__builtin_StringToBool", - }, - ast.TypeBool: { - ast.TypeString: "__builtin_BoolToString", - }, - } - - // Build our own semantic checks that we always run - tv := &TypeCheck{Scope: scope, Implicit: implicitMap} - ic := &IdentifierCheck{Scope: scope} - - // Build up the semantic checks for execution - checks := make( - []SemanticChecker, - len(config.SemanticChecks), - len(config.SemanticChecks)+2) - copy(checks, config.SemanticChecks) - checks = append(checks, ic.Visit) - checks = append(checks, tv.Visit) - - // Run the semantic checks - for _, check := range checks { - if err := check(root); err != nil { - return nil, ast.TypeInvalid, err - } - } - - // Execute - v := &evalVisitor{Scope: scope} - return v.Visit(root) -} - -// EvalNode is the interface that must be implemented by any ast.Node -// to support evaluation. This will be called in visitor pattern order. -// The result of each call to Eval is automatically pushed onto the -// stack as a LiteralNode. Pop elements off the stack to get child -// values. -type EvalNode interface { - Eval(ast.Scope, *ast.Stack) (interface{}, ast.Type, error) -} - -type evalVisitor struct { - Scope ast.Scope - Stack ast.Stack - - err error - lock sync.Mutex -} - -func (v *evalVisitor) Visit(root ast.Node) (interface{}, ast.Type, error) { - // Run the actual visitor pattern - root.Accept(v.visit) - - // Get our result and clear out everything else - var result *ast.LiteralNode - if v.Stack.Len() > 0 { - result = v.Stack.Pop().(*ast.LiteralNode) - } else { - result = new(ast.LiteralNode) - } - resultErr := v.err - if resultErr == errExitUnknown { - // This means the return value is unknown and we used the error - // as an early exit mechanism. Reset since the value on the stack - // should be the unknown value. - resultErr = nil - } - - // Clear everything else so we aren't just dangling - v.Stack.Reset() - v.err = nil - - t, err := result.Type(v.Scope) - if err != nil { - return nil, ast.TypeInvalid, err - } - - return result.Value, t, resultErr -} - -func (v *evalVisitor) visit(raw ast.Node) ast.Node { - if v.err != nil { - return raw - } - - en, err := evalNode(raw) - if err != nil { - v.err = err - return raw - } - - out, outType, err := en.Eval(v.Scope, &v.Stack) - if err != nil { - v.err = err - return raw - } - - v.Stack.Push(&ast.LiteralNode{ - Value: out, - Typex: outType, - }) - - if outType == ast.TypeUnknown { - // Halt immediately - v.err = errExitUnknown - return raw - } - - return raw -} - -// evalNode is a private function that returns an EvalNode for built-in -// types as well as any other EvalNode implementations. -func evalNode(raw ast.Node) (EvalNode, error) { - switch n := raw.(type) { - case *ast.Index: - return &evalIndex{n}, nil - case *ast.Call: - return &evalCall{n}, nil - case *ast.Conditional: - return &evalConditional{n}, nil - case *ast.Output: - return &evalOutput{n}, nil - case *ast.LiteralNode: - return &evalLiteralNode{n}, nil - case *ast.VariableAccess: - return &evalVariableAccess{n}, nil - default: - en, ok := n.(EvalNode) - if !ok { - return nil, fmt.Errorf("node doesn't support evaluation: %#v", raw) - } - - return en, nil - } -} - -type evalCall struct{ *ast.Call } - -func (v *evalCall) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // Look up the function in the map - function, ok := s.LookupFunc(v.Func) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "unknown function called: %s", v.Func) - } - - // The arguments are on the stack in reverse order, so pop them off. - args := make([]interface{}, len(v.Args)) - for i, _ := range v.Args { - node := stack.Pop().(*ast.LiteralNode) - if node.IsUnknown() { - // If any arguments are unknown then the result is automatically unknown - return UnknownValue, ast.TypeUnknown, nil - } - args[len(v.Args)-1-i] = node.Value - } - - // Call the function - result, err := function.Callback(args) - if err != nil { - return nil, ast.TypeInvalid, fmt.Errorf("%s: %s", v.Func, err) - } - - return result, function.ReturnType, nil -} - -type evalConditional struct{ *ast.Conditional } - -func (v *evalConditional) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // On the stack we have literal nodes representing the resulting values - // of the condition, true and false expressions, but they are in reverse - // order. - falseLit := stack.Pop().(*ast.LiteralNode) - trueLit := stack.Pop().(*ast.LiteralNode) - condLit := stack.Pop().(*ast.LiteralNode) - - if condLit.IsUnknown() { - // If our conditional is unknown then our result is also unknown - return UnknownValue, ast.TypeUnknown, nil - } - - if condLit.Value.(bool) { - return trueLit.Value, trueLit.Typex, nil - } else { - return falseLit.Value, trueLit.Typex, nil - } -} - -type evalIndex struct{ *ast.Index } - -func (v *evalIndex) Eval(scope ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - key := stack.Pop().(*ast.LiteralNode) - target := stack.Pop().(*ast.LiteralNode) - - variableName := v.Index.Target.(*ast.VariableAccess).Name - - if key.IsUnknown() { - // If our key is unknown then our result is also unknown - return UnknownValue, ast.TypeUnknown, nil - } - - // For target, we'll accept collections containing unknown values but - // we still need to catch when the collection itself is unknown, shallowly. - if target.Typex == ast.TypeUnknown { - return UnknownValue, ast.TypeUnknown, nil - } - - switch target.Typex { - case ast.TypeList: - return v.evalListIndex(variableName, target.Value, key.Value) - case ast.TypeMap: - return v.evalMapIndex(variableName, target.Value, key.Value) - default: - return nil, ast.TypeInvalid, fmt.Errorf( - "target %q for indexing must be ast.TypeList or ast.TypeMap, is %s", - variableName, target.Typex) - } -} - -func (v *evalIndex) evalListIndex(variableName string, target interface{}, key interface{}) (interface{}, ast.Type, error) { - // We assume type checking was already done and we can assume that target - // is a list and key is an int - list, ok := target.([]ast.Variable) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast target to []Variable, is: %T", target) - } - - keyInt, ok := key.(int) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast key to int, is: %T", key) - } - - if len(list) == 0 { - return nil, ast.TypeInvalid, fmt.Errorf("list is empty") - } - - if keyInt < 0 || len(list) < keyInt+1 { - return nil, ast.TypeInvalid, fmt.Errorf( - "index %d out of range for list %s (max %d)", - keyInt, variableName, len(list)) - } - - returnVal := list[keyInt].Value - returnType := list[keyInt].Type - return returnVal, returnType, nil -} - -func (v *evalIndex) evalMapIndex(variableName string, target interface{}, key interface{}) (interface{}, ast.Type, error) { - // We assume type checking was already done and we can assume that target - // is a map and key is a string - vmap, ok := target.(map[string]ast.Variable) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast target to map[string]Variable, is: %T", target) - } - - keyString, ok := key.(string) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "cannot cast key to string, is: %T", key) - } - - if len(vmap) == 0 { - return nil, ast.TypeInvalid, fmt.Errorf("map is empty") - } - - value, ok := vmap[keyString] - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "key %q does not exist in map %s", keyString, variableName) - } - - return value.Value, value.Type, nil -} - -type evalOutput struct{ *ast.Output } - -func (v *evalOutput) Eval(s ast.Scope, stack *ast.Stack) (interface{}, ast.Type, error) { - // The expressions should all be on the stack in reverse - // order. So pop them off, reverse their order, and concatenate. - nodes := make([]*ast.LiteralNode, 0, len(v.Exprs)) - haveUnknown := false - for range v.Exprs { - n := stack.Pop().(*ast.LiteralNode) - nodes = append(nodes, n) - - // If we have any unknowns then the whole result is unknown - // (we must deal with this first, because the type checker can - // skip type conversions in the presence of unknowns, and thus - // any of our other nodes may be incorrectly typed.) - if n.IsUnknown() { - haveUnknown = true - } - } - - if haveUnknown { - return UnknownValue, ast.TypeUnknown, nil - } - - // Special case the single list and map - if len(nodes) == 1 { - switch t := nodes[0].Typex; t { - case ast.TypeList: - fallthrough - case ast.TypeMap: - fallthrough - case ast.TypeUnknown: - return nodes[0].Value, t, nil - } - } - - // Otherwise concatenate the strings - var buf bytes.Buffer - for i := len(nodes) - 1; i >= 0; i-- { - if nodes[i].Typex != ast.TypeString { - return nil, ast.TypeInvalid, fmt.Errorf( - "invalid output with %s value at index %d: %#v", - nodes[i].Typex, - i, - nodes[i].Value, - ) - } - buf.WriteString(nodes[i].Value.(string)) - } - - return buf.String(), ast.TypeString, nil -} - -type evalLiteralNode struct{ *ast.LiteralNode } - -func (v *evalLiteralNode) Eval(ast.Scope, *ast.Stack) (interface{}, ast.Type, error) { - return v.Value, v.Typex, nil -} - -type evalVariableAccess struct{ *ast.VariableAccess } - -func (v *evalVariableAccess) Eval(scope ast.Scope, _ *ast.Stack) (interface{}, ast.Type, error) { - // Look up the variable in the map - variable, ok := scope.LookupVar(v.Name) - if !ok { - return nil, ast.TypeInvalid, fmt.Errorf( - "unknown variable accessed: %s", v.Name) - } - - return variable.Value, variable.Type, nil -} diff --git a/vendor/github.com/hashicorp/hil/eval_test.go b/vendor/github.com/hashicorp/hil/eval_test.go deleted file mode 100644 index f7df434..0000000 --- a/vendor/github.com/hashicorp/hil/eval_test.go +++ /dev/null @@ -1,2055 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - "strconv" - "strings" - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestEval(t *testing.T) { - cases := []struct { - Input string - Scope *ast.BasicScope - Error bool - Result interface{} - ResultType EvalType - }{ - { - Input: "Hello World", - Scope: nil, - Result: "Hello World", - ResultType: TypeString, - }, - { - Input: `${"foo\\bar"}`, - Scope: nil, - Result: `foo\bar`, - ResultType: TypeString, - }, - { - Input: `${"foo\\\\bar"}`, - Scope: nil, - Result: `foo\\bar`, - ResultType: TypeString, - }, - { - "${var.alist}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - []interface{}{"Hello", "World"}, - TypeList, - }, - { - "${var.alist[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "World", - TypeString, - }, - { - `${var.alist["1"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "World", - TypeString, - }, - { - "${var.alist[1]} ${var.alist[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "World Hello", - TypeString, - }, - { - "${var.alist[2-1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "World", - TypeString, - }, - { - "${var.alist[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - "${var.alist[var.index]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - }, - }, - "var.index": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - "${var.alist} ${var.alist}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - true, - nil, - TypeInvalid, - }, - { - "${var.alist[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "World", - TypeString, - }, - { - `${foo}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - map[string]interface{}{ - "foo": "hello", - "bar": "world", - }, - TypeMap, - }, - { - `${foo["bar"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "world", - TypeString, - }, - { - `${foo["foo"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - "hello", - TypeString, - }, - { - `${foo["bar"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - `${foo["foo"]} foo`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - "hello foo", - TypeString, - }, - { - `${foo["bar"]} foo`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - - { - `${foo[3]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "3": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "world", - TypeString, - }, - { - `${foo["bar"]} ${foo["foo"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "world hello", - TypeString, - }, - { - `${foo} ${foo}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - true, - nil, - TypeInvalid, - }, - { - `${foo} ${bar}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - false, - "Hello World", - TypeString, - }, - { - `${foo} ${bar}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - "bar": ast.Variable{ - Type: ast.TypeInt, - Value: 4, - }, - }, - }, - false, - "Hello 4", - TypeString, - }, - { - `${foo} ${bar}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - `${foo}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - map[string]interface{}{ - "foo": "hello", - "bar": "world", - }, - TypeMap, - }, - { - "${var.alist}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - []interface{}{ - "Hello", - "World", - }, - TypeList, - }, - { - "${var.alist[0] + var.alist[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 2, - }, - }, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - // Unknowns can short-circuit bits of our type checking - // AST transform, such as the promotion of arithmetic to - // functions. This test ensures that the evaluator and the - // type checker co-operate to ensure that this doesn't cause - // raw arithmetic nodes to be evaluated (which is not supported). - "${var.alist[0 + var.unknown]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 2, - }, - }, - }, - "var.unknown": ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - "${join(var.alist)}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "join": ast.Function{ - ArgTypes: []ast.Type{ast.TypeList}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return nil, fmt.Errorf("should never actually be called") - }, - }, - }, - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - "${upper(var.alist[1])}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "upper": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strings.ToUpper(args[0].(string)), nil - }, - }, - }, - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeUnknown, - Value: UnknownValue, - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - "WORLD", - TypeString, - }, - { - `${foo[upper(bar)]}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "upper": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strings.ToUpper(args[0].(string)), nil - }, - }, - }, - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "KEY": ast.Variable{ - Type: ast.TypeString, - Value: "value", - }, - }, - }, - "bar": ast.Variable{ - Value: "key", - Type: ast.TypeString, - }, - }, - }, - false, - "value", - TypeString, - }, - { - `${foo[upper(bar)]}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "upper": ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strings.ToUpper(args[0].(string)), nil - }, - }, - }, - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "KEY": ast.Variable{ - Type: ast.TypeString, - Value: "value", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - `${upper(foo)}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "upper": ast.Function{ - ArgTypes: []ast.Type{ast.TypeMap}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return "foo", nil - }, - }, - }, - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "KEY": ast.Variable{ - Type: ast.TypeUnknown, - }, - }, - }, - }, - }, - false, - UnknownValue, - TypeUnknown, - }, - { - Input: `${"foo\\"}`, - Scope: nil, - Result: `foo\`, - ResultType: TypeString, - }, - { - Input: `${"foo\\\\"}`, - Scope: nil, - Result: `foo\\`, - ResultType: TypeString, - }, - { - `${second("foo", "\\", "/", "bar")}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "second": { - ArgTypes: []ast.Type{ast.TypeString, ast.TypeString, ast.TypeString, ast.TypeString}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return args[1].(string), nil - }, - }, - }, - }, - false, - `\`, - TypeString, - }, - } - - for i, tc := range cases { - t.Run(fmt.Sprintf("%d-%s", i, tc.Input), func(t *testing.T) { - node, err := Parse(tc.Input) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - - result, err := Eval(node, &EvalConfig{GlobalScope: tc.Scope}) - if err != nil != tc.Error { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - if tc.ResultType != TypeInvalid && result.Type != tc.ResultType { - t.Fatalf("Bad: %s\n\nInput: %s", result.Type, tc.Input) - } - if !reflect.DeepEqual(result.Value, tc.Result) { - t.Fatalf("\n Got: %#v\nExpected: %#v\n\n Input: %s\n", result.Value, tc.Result, tc.Input) - } - }) - } -} - -func TestEvalInternal(t *testing.T) { - cases := []struct { - Input string - Scope *ast.BasicScope - Error bool - Result interface{} - ResultType ast.Type - }{ - { - "foo", - nil, - false, - "foo", - ast.TypeString, - }, - - { - "foo ${bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: "baz", - Type: ast.TypeString, - }, - }, - }, - false, - "foo baz", - ast.TypeString, - }, - - { - "${var.alist}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.alist": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - }, - }, - }, - false, - []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "Hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "World", - }, - }, - ast.TypeList, - }, - - { - "foo ${-29}", - nil, - false, - "foo -29", - ast.TypeString, - }, - - { - "foo ${42+1}", - nil, - false, - "foo 43", - ast.TypeString, - }, - - { - "foo ${42-1}", - nil, - false, - "foo 41", - ast.TypeString, - }, - - { - "foo ${42*2}", - nil, - false, - "foo 84", - ast.TypeString, - }, - - { - "foo ${42/2}", - nil, - false, - "foo 21", - ast.TypeString, - }, - - { - "foo ${42/0}", - nil, - true, - "foo ", - ast.TypeInvalid, - }, - - { - "foo ${42%4}", - nil, - false, - "foo 2", - ast.TypeString, - }, - - { - "foo ${42%0}", - nil, - true, - "foo ", - ast.TypeInvalid, - }, - - { - "foo ${42.0+1.0}", - nil, - false, - "foo 43", - ast.TypeString, - }, - - { - "foo ${42.0+1}", - nil, - false, - "foo 43", - ast.TypeString, - }, - - { - "foo ${42+1.0}", - nil, - false, - "foo 43", - ast.TypeString, - }, - - { - "foo ${0.5 * 75}", - nil, - false, - "foo 37.5", - ast.TypeString, - }, - - { - "foo ${75 * 0.5}", - nil, - false, - "foo 37.5", - ast.TypeString, - }, - - { - "foo ${42+2*2}", - nil, - false, - "foo 46", - ast.TypeString, - }, - - { - "foo ${42+(2*2)}", - nil, - false, - "foo 46", - ast.TypeString, - }, - - { - "foo ${true && false}", - nil, - false, - "foo false", - ast.TypeString, - }, - - { - "foo ${false || true}", - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"true" || true}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${true || "true"}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"true" || "true"}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - "foo ${1 == 2}", - nil, - false, - "foo false", - ast.TypeString, - }, - - { - "foo ${1 == 1}", - nil, - false, - "foo true", - ast.TypeString, - }, - - { - "foo ${1 > 2}", - nil, - false, - "foo false", - ast.TypeString, - }, - - { - "foo ${2 > 1}", - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"hello" == "hello"}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"hello" == "goodbye"}`, - nil, - false, - "foo false", - ast.TypeString, - }, - - { - `foo ${1 == "2"}`, - nil, - false, - "foo false", - ast.TypeString, - }, - - { - `foo ${1 == "1"}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"1" == 1}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${1.2 == 1}`, - nil, - false, - "foo false", - ast.TypeString, - }, - - { - // implicit conversion of float to int makes this equal - `foo ${1 == 1.2}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${true == false}`, - nil, - false, - "foo false", - ast.TypeString, - }, - - { - `foo ${false == false}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${"true" == true}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${true == "true"}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - `foo ${! true}`, - nil, - false, - "foo false", - ast.TypeString, - }, - - { - `foo ${! false}`, - nil, - false, - "foo true", - ast.TypeString, - }, - - { - "foo ${true ? 5 : 7}", - nil, - false, - "foo 5", - ast.TypeString, - }, - - { - "foo ${false ? 5 : 7}", - nil, - false, - "foo 7", - ast.TypeString, - }, - - { - `foo ${"true" ? 5 : 7}`, - nil, - false, - "foo 5", - ast.TypeString, - }, - - { - // false expression is type-converted to match true expression - `foo ${false ? 5 : 6.5}`, - nil, - false, - "foo 6", - ast.TypeString, - }, - - { - // true expression is type-converted to match false expression - // if the true expression is string - `foo ${false ? "12" : 16}`, - nil, - false, - "foo 16", - ast.TypeString, - }, - - { - "foo ${3 > 2 ? 5 : 7}", - nil, - false, - "foo 5", - ast.TypeString, - }, - - { - "${var.do_it ? 5 : 7}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.do_it": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // false expression can be unknown, and is returned - `foo ${false ? "12" : unknown}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // false expression can be unknown, and result is unknown even - // if it's not selected. - // (Ideally this would not be true, but we're accepting this - // for now since this assumption is built in to the core evaluator) - `foo ${true ? "12" : unknown}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // true expression can be unknown, and is returned - `foo ${false ? unknown : "bar"}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // true expression can be unknown, and result is unknown even - // if it's not selected. - // (Ideally this would not be true, but we're accepting this - // for now since this assumption is built in to the core evaluator) - `foo ${false ? unknown : "bar"}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // both values can be unknown - `foo ${false ? unknown : unknown}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - // condition can be unknown, and result is unknown - `foo ${unknown ? "baz" : "bar"}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "unknown": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - "foo ${-bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 41, - Type: ast.TypeInt, - }, - }, - }, - false, - "foo -41", - ast.TypeString, - }, - - { - "foo ${bar+1}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 41, - Type: ast.TypeInt, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - { - "foo ${bar+1}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: "41", - Type: ast.TypeString, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - { - "foo ${bar+baz}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: "41", - Type: ast.TypeString, - }, - "baz": ast.Variable{ - Value: "1", - Type: ast.TypeString, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - { - "foo ${bar+baz}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 0.001, - Type: ast.TypeFloat, - }, - "baz": ast.Variable{ - Value: "0.002", - Type: ast.TypeString, - }, - }, - }, - false, - "foo 0.003", - ast.TypeString, - }, - - { - "foo ${bar+baz}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: UnknownValue, - Type: ast.TypeUnknown, - }, - "baz": ast.Variable{ - Value: 1, - Type: ast.TypeInt, - }, - }, - }, - false, - UnknownValue, - ast.TypeUnknown, - }, - - { - "foo ${rand()}", - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Callback: func([]interface{}) (interface{}, error) { - return "42", nil - }, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - { - `foo ${rand("foo", "bar")}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "rand": ast.Function{ - ReturnType: ast.TypeString, - Variadic: true, - VariadicType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - var result string - for _, a := range args { - result += a.(string) - } - return result, nil - }, - }, - }, - }, - false, - "foo foobar", - ast.TypeString, - }, - - { - `${foo["bar"]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "world", - ast.TypeString, - }, - - { - `${foo[var.key]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "var.key": ast.Variable{ - Type: ast.TypeString, - Value: "bar", - }, - }, - }, - false, - "world", - ast.TypeString, - }, - - { - `${foo[bar[var.keyint]]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "i dont exist", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "bar", - }, - }, - }, - "var.keyint": ast.Variable{ - Type: ast.TypeInt, - Value: 1, - }, - }, - }, - false, - "world", - ast.TypeString, - }, - - { - `${foo["bar"]} ${bar[1]}`, - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeMap, - Value: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - "bar": ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 10, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 20, - }, - }, - }, - }, - }, - false, - "world 20", - ast.TypeString, - }, - - { - "${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "hello", - ast.TypeString, - }, - - { - "${foo[bar]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeInt, - Value: 1, - }, - }, - }, - false, - "world", - ast.TypeString, - }, - - { - "${foo[bar[1]]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - "bar": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 1, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 0, - }, - }, - }, - }, - }, - false, - "hello", - ast.TypeString, - }, - - { - "aaa ${foo} aaa", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - }, - }, - false, - "aaa 42 aaa", - ast.TypeString, - }, - - { - "aaa ${foo[1]} aaa", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 24, - }, - }, - }, - }, - }, - false, - "aaa 24 aaa", - ast.TypeString, - }, - - { - "aaa ${foo[1]} - ${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 24, - }, - }, - }, - }, - }, - false, - "aaa 24 - 42", - ast.TypeString, - }, - - { - "${var.foo} ${var.foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - true, - nil, - ast.TypeInvalid, - }, - - { - "${var.foo[0]} ${var.foo[1]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeString, - Value: "hello", - }, - ast.Variable{ - Type: ast.TypeString, - Value: "world", - }, - }, - }, - }, - }, - false, - "hello world", - ast.TypeString, - }, - - { - "${foo[1]} ${foo[0]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 24, - }, - }, - }, - }, - }, - false, - "24 42", - ast.TypeString, - }, - - { - "${foo[1-3]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 24, - }, - }, - }, - }, - }, - true, - nil, - ast.TypeInvalid, - }, - - { - "${foo[2]}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "foo": ast.Variable{ - Type: ast.TypeList, - Value: []ast.Variable{ - ast.Variable{ - Type: ast.TypeInt, - Value: 42, - }, - ast.Variable{ - Type: ast.TypeInt, - Value: 24, - }, - }, - }, - }, - }, - true, - nil, - ast.TypeInvalid, - }, - - // Testing implicit type conversions - - { - "foo ${bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 42, - Type: ast.TypeInt, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - { - `foo ${foo("42")}`, - &ast.BasicScope{ - FuncMap: map[string]ast.Function{ - "foo": ast.Function{ - ArgTypes: []ast.Type{ast.TypeInt}, - ReturnType: ast.TypeString, - Callback: func(args []interface{}) (interface{}, error) { - return strconv.FormatInt(int64(args[0].(int)), 10), nil - }, - }, - }, - }, - false, - "foo 42", - ast.TypeString, - }, - - // Multiline - { - "foo ${42+\n1.0}", - nil, - false, - "foo 43", - ast.TypeString, - }, - - // String vars should be able to implictly convert to floats - { - "${1.5 * var.foo}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Value: "42", - Type: ast.TypeString, - }, - }, - }, - false, - "63", - ast.TypeString, - }, - - // Unary - { - "foo ${-46}", - nil, - false, - "foo -46", - ast.TypeString, - }, - - { - "foo ${-46 + 5}", - nil, - false, - "foo -41", - ast.TypeString, - }, - - { - "foo ${46 + -5}", - nil, - false, - "foo 41", - ast.TypeString, - }, - - { - "foo ${-bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 41, - Type: ast.TypeInt, - }, - }, - }, - false, - "foo -41", - ast.TypeString, - }, - - { - "foo ${5 + -bar}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "bar": ast.Variable{ - Value: 41, - Type: ast.TypeInt, - }, - }, - }, - false, - "foo -36", - ast.TypeString, - }, - - { - "${var.foo > 1 ? 5 : 0}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Type: ast.TypeString, - Value: "3", - }, - }, - }, - false, - "5", - ast.TypeString, - }, - - { - "${var.foo > 1.5 ? 5 : 0}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Type: ast.TypeString, - Value: "3", - }, - }, - }, - false, - "5", - ast.TypeString, - }, - - { - "${var.foo > 1.5 ? 5 : 0}", - &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.foo": ast.Variable{ - Type: ast.TypeString, - Value: "1.2", - }, - }, - }, - false, - "0", - ast.TypeString, - }, - } - - for i, tc := range cases { - t.Run(fmt.Sprintf("%d-%s", i, tc.Input), func(t *testing.T) { - node, err := Parse(tc.Input) - if err != nil { - t.Fatalf("Error: %s\n\nInput: %s", err, tc.Input) - } - - out, outType, err := internalEval(node, &EvalConfig{GlobalScope: tc.Scope}) - if err != nil != tc.Error { - t.Fatalf("Error: %s\nInput: %s", err, tc.Input) - } - if tc.ResultType != ast.TypeInvalid && outType != tc.ResultType { - t.Fatalf("Wrong result type\nInput: %s\nGot: %#s\nWant: %s", tc.Input, outType, tc.ResultType) - } - if !reflect.DeepEqual(out, tc.Result) { - t.Fatalf("Wrong result value\nInput: %s\nGot: %#s\nWant: %s", tc.Input, out, tc.Result) - } - }) - } -} diff --git a/vendor/github.com/hashicorp/hil/eval_type.go b/vendor/github.com/hashicorp/hil/eval_type.go deleted file mode 100644 index 6946ecd..0000000 --- a/vendor/github.com/hashicorp/hil/eval_type.go +++ /dev/null @@ -1,16 +0,0 @@ -package hil - -//go:generate stringer -type=EvalType eval_type.go - -// EvalType represents the type of the output returned from a HIL -// evaluation. -type EvalType uint32 - -const ( - TypeInvalid EvalType = 0 - TypeString EvalType = 1 << iota - TypeBool - TypeList - TypeMap - TypeUnknown -) diff --git a/vendor/github.com/hashicorp/hil/evaltype_string.go b/vendor/github.com/hashicorp/hil/evaltype_string.go deleted file mode 100644 index b107ddd..0000000 --- a/vendor/github.com/hashicorp/hil/evaltype_string.go +++ /dev/null @@ -1,42 +0,0 @@ -// Code generated by "stringer -type=EvalType eval_type.go"; DO NOT EDIT - -package hil - -import "fmt" - -const ( - _EvalType_name_0 = "TypeInvalid" - _EvalType_name_1 = "TypeString" - _EvalType_name_2 = "TypeBool" - _EvalType_name_3 = "TypeList" - _EvalType_name_4 = "TypeMap" - _EvalType_name_5 = "TypeUnknown" -) - -var ( - _EvalType_index_0 = [...]uint8{0, 11} - _EvalType_index_1 = [...]uint8{0, 10} - _EvalType_index_2 = [...]uint8{0, 8} - _EvalType_index_3 = [...]uint8{0, 8} - _EvalType_index_4 = [...]uint8{0, 7} - _EvalType_index_5 = [...]uint8{0, 11} -) - -func (i EvalType) String() string { - switch { - case i == 0: - return _EvalType_name_0 - case i == 2: - return _EvalType_name_1 - case i == 4: - return _EvalType_name_2 - case i == 8: - return _EvalType_name_3 - case i == 16: - return _EvalType_name_4 - case i == 32: - return _EvalType_name_5 - default: - return fmt.Sprintf("EvalType(%d)", i) - } -} diff --git a/vendor/github.com/hashicorp/hil/example_func_test.go b/vendor/github.com/hashicorp/hil/example_func_test.go deleted file mode 100644 index ebe52a2..0000000 --- a/vendor/github.com/hashicorp/hil/example_func_test.go +++ /dev/null @@ -1,54 +0,0 @@ -package hil_test - -import ( - "fmt" - "log" - "strings" - - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" -) - -func Example_functions() { - input := "${lower(var.test)} - ${6 + 2}" - - tree, err := hil.Parse(input) - if err != nil { - log.Fatal(err) - } - - lowerCase := ast.Function{ - ArgTypes: []ast.Type{ast.TypeString}, - ReturnType: ast.TypeString, - Variadic: false, - Callback: func(inputs []interface{}) (interface{}, error) { - input := inputs[0].(string) - return strings.ToLower(input), nil - }, - } - - config := &hil.EvalConfig{ - GlobalScope: &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.test": ast.Variable{ - Type: ast.TypeString, - Value: "TEST STRING", - }, - }, - FuncMap: map[string]ast.Function{ - "lower": lowerCase, - }, - }, - } - - result, err := hil.Eval(tree, config) - if err != nil { - log.Fatal(err) - } - - fmt.Printf("Type: %s\n", result.Type) - fmt.Printf("Value: %s\n", result.Value) - // Output: - // Type: TypeString - // Value: test string - 8 -} diff --git a/vendor/github.com/hashicorp/hil/example_test.go b/vendor/github.com/hashicorp/hil/example_test.go deleted file mode 100644 index b65b11e..0000000 --- a/vendor/github.com/hashicorp/hil/example_test.go +++ /dev/null @@ -1,28 +0,0 @@ -package hil_test - -import ( - "fmt" - "log" - - "github.com/hashicorp/hil" -) - -func Example_basic() { - input := "${6 + 2}" - - tree, err := hil.Parse(input) - if err != nil { - log.Fatal(err) - } - - result, err := hil.Eval(tree, &hil.EvalConfig{}) - if err != nil { - log.Fatal(err) - } - - fmt.Printf("Type: %s\n", result.Type) - fmt.Printf("Value: %s\n", result.Value) - // Output: - // Type: TypeString - // Value: 8 -} diff --git a/vendor/github.com/hashicorp/hil/example_var_test.go b/vendor/github.com/hashicorp/hil/example_var_test.go deleted file mode 100644 index f6ead1b..0000000 --- a/vendor/github.com/hashicorp/hil/example_var_test.go +++ /dev/null @@ -1,40 +0,0 @@ -package hil_test - -import ( - "fmt" - "log" - - "github.com/hashicorp/hil" - "github.com/hashicorp/hil/ast" -) - -func Example_variables() { - input := "${var.test} - ${6 + 2}" - - tree, err := hil.Parse(input) - if err != nil { - log.Fatal(err) - } - - config := &hil.EvalConfig{ - GlobalScope: &ast.BasicScope{ - VarMap: map[string]ast.Variable{ - "var.test": ast.Variable{ - Type: ast.TypeString, - Value: "TEST STRING", - }, - }, - }, - } - - result, err := hil.Eval(tree, config) - if err != nil { - log.Fatal(err) - } - - fmt.Printf("Type: %s\n", result.Type) - fmt.Printf("Value: %s\n", result.Value) - // Output: - // Type: TypeString - // Value: TEST STRING - 8 -} diff --git a/vendor/github.com/hashicorp/hil/parse.go b/vendor/github.com/hashicorp/hil/parse.go deleted file mode 100644 index ecbe1fd..0000000 --- a/vendor/github.com/hashicorp/hil/parse.go +++ /dev/null @@ -1,29 +0,0 @@ -package hil - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/parser" - "github.com/hashicorp/hil/scanner" -) - -// Parse parses the given program and returns an executable AST tree. -// -// Syntax errors are returned with error having the dynamic type -// *parser.ParseError, which gives the caller access to the source position -// where the error was found, which allows (for example) combining it with -// a known source filename to add context to the error message. -func Parse(v string) (ast.Node, error) { - return ParseWithPosition(v, ast.Pos{Line: 1, Column: 1}) -} - -// ParseWithPosition is like Parse except that it overrides the source -// row and column position of the first character in the string, which should -// be 1-based. -// -// This can be used when HIL is embedded in another language and the outer -// parser knows the row and column where the HIL expression started within -// the overall source file. -func ParseWithPosition(v string, pos ast.Pos) (ast.Node, error) { - ch := scanner.Scan(v, pos) - return parser.Parse(ch) -} diff --git a/vendor/github.com/hashicorp/hil/parser/binary_op.go b/vendor/github.com/hashicorp/hil/parser/binary_op.go deleted file mode 100644 index 2e013e0..0000000 --- a/vendor/github.com/hashicorp/hil/parser/binary_op.go +++ /dev/null @@ -1,45 +0,0 @@ -package parser - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -var binaryOps []map[scanner.TokenType]ast.ArithmeticOp - -func init() { - // This operation table maps from the operator's scanner token type - // to the AST arithmetic operation. All expressions produced from - // binary operators are *ast.Arithmetic nodes. - // - // Binary operator groups are listed in order of precedence, with - // the *lowest* precedence first. Operators within the same group - // have left-to-right associativity. - binaryOps = []map[scanner.TokenType]ast.ArithmeticOp{ - { - scanner.OR: ast.ArithmeticOpLogicalOr, - }, - { - scanner.AND: ast.ArithmeticOpLogicalAnd, - }, - { - scanner.EQUAL: ast.ArithmeticOpEqual, - scanner.NOTEQUAL: ast.ArithmeticOpNotEqual, - }, - { - scanner.GT: ast.ArithmeticOpGreaterThan, - scanner.GTE: ast.ArithmeticOpGreaterThanOrEqual, - scanner.LT: ast.ArithmeticOpLessThan, - scanner.LTE: ast.ArithmeticOpLessThanOrEqual, - }, - { - scanner.PLUS: ast.ArithmeticOpAdd, - scanner.MINUS: ast.ArithmeticOpSub, - }, - { - scanner.STAR: ast.ArithmeticOpMul, - scanner.SLASH: ast.ArithmeticOpDiv, - scanner.PERCENT: ast.ArithmeticOpMod, - }, - } -} diff --git a/vendor/github.com/hashicorp/hil/parser/error.go b/vendor/github.com/hashicorp/hil/parser/error.go deleted file mode 100644 index bacd696..0000000 --- a/vendor/github.com/hashicorp/hil/parser/error.go +++ /dev/null @@ -1,38 +0,0 @@ -package parser - -import ( - "fmt" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -type ParseError struct { - Message string - Pos ast.Pos -} - -func Errorf(pos ast.Pos, format string, args ...interface{}) error { - return &ParseError{ - Message: fmt.Sprintf(format, args...), - Pos: pos, - } -} - -// TokenErrorf is a convenient wrapper around Errorf that uses the -// position of the given token. -func TokenErrorf(token *scanner.Token, format string, args ...interface{}) error { - return Errorf(token.Pos, format, args...) -} - -func ExpectationError(wanted string, got *scanner.Token) error { - return TokenErrorf(got, "expected %s but found %s", wanted, got) -} - -func (e *ParseError) Error() string { - return fmt.Sprintf("parse error at %s: %s", e.Pos, e.Message) -} - -func (e *ParseError) String() string { - return e.Error() -} diff --git a/vendor/github.com/hashicorp/hil/parser/fuzz.go b/vendor/github.com/hashicorp/hil/parser/fuzz.go deleted file mode 100644 index de954f3..0000000 --- a/vendor/github.com/hashicorp/hil/parser/fuzz.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build gofuzz - -package parser - -import ( - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -// This is a fuzz testing function designed to be used with go-fuzz: -// https://github.com/dvyukov/go-fuzz -// -// It's not included in a normal build due to the gofuzz build tag above. -// -// There are some input files that you can use as a seed corpus for go-fuzz -// in the directory ./fuzz-corpus . - -func Fuzz(data []byte) int { - str := string(data) - - ch := scanner.Scan(str, ast.Pos{Line: 1, Column: 1}) - _, err := Parse(ch) - if err != nil { - return 0 - } - - return 1 -} diff --git a/vendor/github.com/hashicorp/hil/parser/parser.go b/vendor/github.com/hashicorp/hil/parser/parser.go deleted file mode 100644 index 376f1c4..0000000 --- a/vendor/github.com/hashicorp/hil/parser/parser.go +++ /dev/null @@ -1,522 +0,0 @@ -package parser - -import ( - "strconv" - "unicode/utf8" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -func Parse(ch <-chan *scanner.Token) (ast.Node, error) { - peeker := scanner.NewPeeker(ch) - parser := &parser{peeker} - output, err := parser.ParseTopLevel() - peeker.Close() - return output, err -} - -type parser struct { - peeker *scanner.Peeker -} - -func (p *parser) ParseTopLevel() (ast.Node, error) { - return p.parseInterpolationSeq(false) -} - -func (p *parser) ParseQuoted() (ast.Node, error) { - return p.parseInterpolationSeq(true) -} - -// parseInterpolationSeq parses either the top-level sequence of literals -// and interpolation expressions or a similar sequence within a quoted -// string inside an interpolation expression. The latter case is requested -// by setting 'quoted' to true. -func (p *parser) parseInterpolationSeq(quoted bool) (ast.Node, error) { - literalType := scanner.LITERAL - endType := scanner.EOF - if quoted { - // exceptions for quoted sequences - literalType = scanner.STRING - endType = scanner.CQUOTE - } - - startPos := p.peeker.Peek().Pos - - if quoted { - tok := p.peeker.Read() - if tok.Type != scanner.OQUOTE { - return nil, ExpectationError("open quote", tok) - } - } - - var exprs []ast.Node - for { - tok := p.peeker.Read() - - if tok.Type == endType { - break - } - - switch tok.Type { - case literalType: - val, err := p.parseStringToken(tok) - if err != nil { - return nil, err - } - exprs = append(exprs, &ast.LiteralNode{ - Value: val, - Typex: ast.TypeString, - Posx: tok.Pos, - }) - case scanner.BEGIN: - expr, err := p.ParseInterpolation() - if err != nil { - return nil, err - } - exprs = append(exprs, expr) - default: - return nil, ExpectationError(`"${"`, tok) - } - } - - if len(exprs) == 0 { - // If we have no parts at all then the input must've - // been an empty string. - exprs = append(exprs, &ast.LiteralNode{ - Value: "", - Typex: ast.TypeString, - Posx: startPos, - }) - } - - // As a special case, if our "Output" contains only one expression - // and it's a literal string then we'll hoist it up to be our - // direct return value, so callers can easily recognize a string - // that has no interpolations at all. - if len(exprs) == 1 { - if lit, ok := exprs[0].(*ast.LiteralNode); ok { - if lit.Typex == ast.TypeString { - return lit, nil - } - } - } - - return &ast.Output{ - Exprs: exprs, - Posx: startPos, - }, nil -} - -// parseStringToken takes a token of either LITERAL or STRING type and -// returns the interpreted string, after processing any relevant -// escape sequences. -func (p *parser) parseStringToken(tok *scanner.Token) (string, error) { - var backslashes bool - switch tok.Type { - case scanner.LITERAL: - backslashes = false - case scanner.STRING: - backslashes = true - default: - panic("unsupported string token type") - } - - raw := []byte(tok.Content) - buf := make([]byte, 0, len(raw)) - - for i := 0; i < len(raw); i++ { - b := raw[i] - more := len(raw) > (i + 1) - - if b == '$' { - if more && raw[i+1] == '$' { - // skip over the second dollar sign - i++ - } - } else if backslashes && b == '\\' { - if !more { - return "", Errorf( - ast.Pos{ - Column: tok.Pos.Column + utf8.RuneCount(raw[:i]), - Line: tok.Pos.Line, - }, - `unfinished backslash escape sequence`, - ) - } - escapeType := raw[i+1] - switch escapeType { - case '\\': - // skip over the second slash - i++ - case 'n': - b = '\n' - i++ - case '"': - b = '"' - i++ - default: - return "", Errorf( - ast.Pos{ - Column: tok.Pos.Column + utf8.RuneCount(raw[:i]), - Line: tok.Pos.Line, - }, - `invalid backslash escape sequence`, - ) - } - } - - buf = append(buf, b) - } - - return string(buf), nil -} - -func (p *parser) ParseInterpolation() (ast.Node, error) { - // By the time we're called, we're already "inside" the ${ sequence - // because the caller consumed the ${ token. - - expr, err := p.ParseExpression() - if err != nil { - return nil, err - } - - err = p.requireTokenType(scanner.END, `"}"`) - if err != nil { - return nil, err - } - - return expr, nil -} - -func (p *parser) ParseExpression() (ast.Node, error) { - return p.parseTernaryCond() -} - -func (p *parser) parseTernaryCond() (ast.Node, error) { - // The ternary condition operator (.. ? .. : ..) behaves somewhat - // like a binary operator except that the "operator" is itself - // an expression enclosed in two punctuation characters. - // The middle expression is parsed as if the ? and : symbols - // were parentheses. The "rhs" (the "false expression") is then - // treated right-associatively so it behaves similarly to the - // middle in terms of precedence. - - startPos := p.peeker.Peek().Pos - - var cond, trueExpr, falseExpr ast.Node - var err error - - cond, err = p.parseBinaryOps(binaryOps) - if err != nil { - return nil, err - } - - next := p.peeker.Peek() - if next.Type != scanner.QUESTION { - return cond, nil - } - - p.peeker.Read() // eat question mark - - trueExpr, err = p.ParseExpression() - if err != nil { - return nil, err - } - - colon := p.peeker.Read() - if colon.Type != scanner.COLON { - return nil, ExpectationError(":", colon) - } - - falseExpr, err = p.ParseExpression() - if err != nil { - return nil, err - } - - return &ast.Conditional{ - CondExpr: cond, - TrueExpr: trueExpr, - FalseExpr: falseExpr, - Posx: startPos, - }, nil -} - -// parseBinaryOps calls itself recursively to work through all of the -// operator precedence groups, and then eventually calls ParseExpressionTerm -// for each operand. -func (p *parser) parseBinaryOps(ops []map[scanner.TokenType]ast.ArithmeticOp) (ast.Node, error) { - if len(ops) == 0 { - // We've run out of operators, so now we'll just try to parse a term. - return p.ParseExpressionTerm() - } - - thisLevel := ops[0] - remaining := ops[1:] - - startPos := p.peeker.Peek().Pos - - var lhs, rhs ast.Node - operator := ast.ArithmeticOpInvalid - var err error - - // parse a term that might be the first operand of a binary - // expression or it might just be a standalone term, but - // we won't know until we've parsed it and can look ahead - // to see if there's an operator token. - lhs, err = p.parseBinaryOps(remaining) - if err != nil { - return nil, err - } - - // We'll keep eating up arithmetic operators until we run - // out, so that operators with the same precedence will combine in a - // left-associative manner: - // a+b+c => (a+b)+c, not a+(b+c) - // - // Should we later want to have right-associative operators, a way - // to achieve that would be to call back up to ParseExpression here - // instead of iteratively parsing only the remaining operators. - for { - next := p.peeker.Peek() - var newOperator ast.ArithmeticOp - var ok bool - if newOperator, ok = thisLevel[next.Type]; !ok { - break - } - - // Are we extending an expression started on - // the previous iteration? - if operator != ast.ArithmeticOpInvalid { - lhs = &ast.Arithmetic{ - Op: operator, - Exprs: []ast.Node{lhs, rhs}, - Posx: startPos, - } - } - - operator = newOperator - p.peeker.Read() // eat operator token - rhs, err = p.parseBinaryOps(remaining) - if err != nil { - return nil, err - } - } - - if operator != ast.ArithmeticOpInvalid { - return &ast.Arithmetic{ - Op: operator, - Exprs: []ast.Node{lhs, rhs}, - Posx: startPos, - }, nil - } else { - return lhs, nil - } -} - -func (p *parser) ParseExpressionTerm() (ast.Node, error) { - - next := p.peeker.Peek() - - switch next.Type { - - case scanner.OPAREN: - p.peeker.Read() - expr, err := p.ParseExpression() - if err != nil { - return nil, err - } - err = p.requireTokenType(scanner.CPAREN, `")"`) - return expr, err - - case scanner.OQUOTE: - return p.ParseQuoted() - - case scanner.INTEGER: - tok := p.peeker.Read() - val, err := strconv.Atoi(tok.Content) - if err != nil { - return nil, TokenErrorf(tok, "invalid integer: %s", err) - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeInt, - Posx: tok.Pos, - }, nil - - case scanner.FLOAT: - tok := p.peeker.Read() - val, err := strconv.ParseFloat(tok.Content, 64) - if err != nil { - return nil, TokenErrorf(tok, "invalid float: %s", err) - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeFloat, - Posx: tok.Pos, - }, nil - - case scanner.BOOL: - tok := p.peeker.Read() - // the scanner guarantees that tok.Content is either "true" or "false" - var val bool - if tok.Content[0] == 't' { - val = true - } else { - val = false - } - return &ast.LiteralNode{ - Value: val, - Typex: ast.TypeBool, - Posx: tok.Pos, - }, nil - - case scanner.MINUS: - opTok := p.peeker.Read() - // important to use ParseExpressionTerm rather than ParseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - // e.g. -46+5 should parse as (0-46)+5, not 0-(46+5) - operand, err := p.ParseExpressionTerm() - if err != nil { - return nil, err - } - // The AST currently represents negative numbers as - // a binary subtraction of the number from zero. - return &ast.Arithmetic{ - Op: ast.ArithmeticOpSub, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: 0, - Typex: ast.TypeInt, - Posx: opTok.Pos, - }, - operand, - }, - Posx: opTok.Pos, - }, nil - - case scanner.BANG: - opTok := p.peeker.Read() - // important to use ParseExpressionTerm rather than ParseExpression - // here, otherwise we can capture a following binary expression into - // our negation. - operand, err := p.ParseExpressionTerm() - if err != nil { - return nil, err - } - // The AST currently represents binary negation as an equality - // test with "false". - return &ast.Arithmetic{ - Op: ast.ArithmeticOpEqual, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: false, - Typex: ast.TypeBool, - Posx: opTok.Pos, - }, - operand, - }, - Posx: opTok.Pos, - }, nil - - case scanner.IDENTIFIER: - return p.ParseScopeInteraction() - - default: - return nil, ExpectationError("expression", next) - } -} - -// ParseScopeInteraction parses the expression types that interact -// with the evaluation scope: variable access, function calls, and -// indexing. -// -// Indexing should actually be a distinct operator in its own right, -// so that e.g. it can be applied to the result of a function call, -// but for now we're preserving the behavior of the older yacc-based -// parser. -func (p *parser) ParseScopeInteraction() (ast.Node, error) { - first := p.peeker.Read() - startPos := first.Pos - if first.Type != scanner.IDENTIFIER { - return nil, ExpectationError("identifier", first) - } - - next := p.peeker.Peek() - if next.Type == scanner.OPAREN { - // function call - funcName := first.Content - p.peeker.Read() // eat paren - var args []ast.Node - - for { - if p.peeker.Peek().Type == scanner.CPAREN { - break - } - - arg, err := p.ParseExpression() - if err != nil { - return nil, err - } - - args = append(args, arg) - - if p.peeker.Peek().Type == scanner.COMMA { - p.peeker.Read() // eat comma - continue - } else { - break - } - } - - err := p.requireTokenType(scanner.CPAREN, `")"`) - if err != nil { - return nil, err - } - - return &ast.Call{ - Func: funcName, - Args: args, - Posx: startPos, - }, nil - } - - varNode := &ast.VariableAccess{ - Name: first.Content, - Posx: startPos, - } - - if p.peeker.Peek().Type == scanner.OBRACKET { - // index operator - startPos := p.peeker.Read().Pos // eat bracket - indexExpr, err := p.ParseExpression() - if err != nil { - return nil, err - } - err = p.requireTokenType(scanner.CBRACKET, `"]"`) - if err != nil { - return nil, err - } - return &ast.Index{ - Target: varNode, - Key: indexExpr, - Posx: startPos, - }, nil - } - - return varNode, nil -} - -// requireTokenType consumes the next token an returns an error if its -// type does not match the given type. nil is returned if the type matches. -// -// This is a helper around peeker.Read() for situations where the parser just -// wants to assert that a particular token type must be present. -func (p *parser) requireTokenType(wantType scanner.TokenType, wantName string) error { - token := p.peeker.Read() - if token.Type != wantType { - return ExpectationError(wantName, token) - } - return nil -} diff --git a/vendor/github.com/hashicorp/hil/parser/parser_test.go b/vendor/github.com/hashicorp/hil/parser/parser_test.go deleted file mode 100644 index bf06379..0000000 --- a/vendor/github.com/hashicorp/hil/parser/parser_test.go +++ /dev/null @@ -1,1220 +0,0 @@ -package parser - -import ( - "reflect" - "testing" - - "github.com/hashicorp/hil/ast" - "github.com/hashicorp/hil/scanner" -) - -func TestParser(t *testing.T) { - cases := []struct { - Input string - Error bool - Result ast.Node - }{ - { - "", - false, - &ast.LiteralNode{ - Value: "", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - }, - - { - "$", - false, - &ast.LiteralNode{ - Value: "$", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - }, - - { - "foo", - false, - &ast.LiteralNode{ - Value: "foo", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - }, - - { - "$${var.foo}", - false, - &ast.LiteralNode{ - Value: "${var.foo}", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - }, - - // Identifier starting with a number - { - `foo ${123abcd}`, - true, - nil, - }, - - // Identifier starting with a * - { - `foo ${*abcd}`, - true, - nil, - }, - - { - "foo ${var.bar}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.VariableAccess{ - Name: "var.bar", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${var.bar.*.baz}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.VariableAccess{ - Name: "var.bar.*.baz", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${var.bar} baz", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.VariableAccess{ - Name: "var.bar", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.LiteralNode{ - Value: " baz", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 15, Line: 1}, - }, - }, - }, - }, - - { - "foo ${var.bar.0}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.VariableAccess{ - Name: "var.bar.0", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${foo.foo-bar.baz.0.attr}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.VariableAccess{ - Name: "foo.foo-bar.baz.0.attr", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - `foo ${"bar"}`, - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: "bar", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - }, - }, - - { - `foo ${"bar\nbaz"}`, - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: "bar\nbaz", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - }, - }, - - { - `foo ${"bar \"baz\""}`, - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: `bar "baz"`, - Typex: ast.TypeString, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - }, - }, - - { - `foo ${func('baz')}`, - true, - nil, - }, - - { - "foo ${42}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: 42, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${3.14159}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: 3.14159, - Typex: ast.TypeFloat, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "föo ${true}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "föo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.LiteralNode{ - Value: true, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${42+1}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: 42, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.LiteralNode{ - Value: 1, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 10, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${-1}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpSub, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: 0, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.LiteralNode{ - Value: 1, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - - { - "foo ${var.bar*1} baz", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpMul, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "var.bar", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.LiteralNode{ - Value: 1, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 15, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.LiteralNode{ - Value: " baz", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 17, Line: 1}, - }, - }, - }, - }, - - { - "${!a}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - // !a parses as (false == a) - &ast.Arithmetic{ - Op: ast.ArithmeticOpEqual, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: false, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 4, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a==b}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpEqual, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 6, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a!=b}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpNotEqual, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 6, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a < 5 ? a + 5 : a + 10}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Conditional{ - CondExpr: &ast.Arithmetic{ - Op: ast.ArithmeticOpLessThan, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.LiteralNode{ - Value: 5, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - TrueExpr: &ast.Arithmetic{ - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 11, Line: 1}, - }, - &ast.LiteralNode{ - Value: 5, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 15, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 11, Line: 1}, - }, - FalseExpr: &ast.Arithmetic{ - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 19, Line: 1}, - }, - &ast.LiteralNode{ - Value: 10, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 23, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 19, Line: 1}, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${true&&false}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalAnd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: true, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.LiteralNode{ - Value: false, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 9, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${true||false}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalOr, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: true, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.LiteralNode{ - Value: false, - Typex: ast.TypeBool, - Posx: ast.Pos{Column: 9, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a||b&&c}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalOr, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalAnd, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 6, Line: 1}, - }, - &ast.VariableAccess{ - Name: "c", - Posx: ast.Pos{Column: 9, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 6, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a&&b||c}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalOr, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalAnd, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 6, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.VariableAccess{ - Name: "c", - Posx: ast.Pos{Column: 9, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a<5||b>2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalOr, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLessThan, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.LiteralNode{ - Value: 5, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 5, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpGreaterThan, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 8, Line: 1}, - }, - &ast.LiteralNode{ - Value: 2, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 10, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${a<5&&b>2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLogicalAnd, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Op: ast.ArithmeticOpLessThan, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "a", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.LiteralNode{ - Value: 5, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 5, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - &ast.Arithmetic{ - Op: ast.ArithmeticOpGreaterThan, - Exprs: []ast.Node{ - &ast.VariableAccess{ - Name: "b", - Posx: ast.Pos{Column: 8, Line: 1}, - }, - &ast.LiteralNode{ - Value: 2, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 10, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - }, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${föo()}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Call{ - Func: "föo", - Args: nil, - Posx: ast.Pos{Column: 3, Line: 1}, - }, - }, - }, - }, - - { - "${foo(bar)}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Call{ - Func: "foo", - Posx: ast.Pos{Column: 3, Line: 1}, - Args: []ast.Node{ - &ast.VariableAccess{ - Name: "bar", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - }, - }, - - { - "${foo(bar, baz)}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Call{ - Func: "foo", - Posx: ast.Pos{Column: 3, Line: 1}, - Args: []ast.Node{ - &ast.VariableAccess{ - Name: "bar", - Posx: ast.Pos{Column: 7, Line: 1}, - }, - &ast.VariableAccess{ - Name: "baz", - Posx: ast.Pos{Column: 12, Line: 1}, - }, - }, - }, - }, - }, - }, - - { - "${foo(bar(baz))}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Call{ - Func: "foo", - Posx: ast.Pos{Column: 3, Line: 1}, - Args: []ast.Node{ - &ast.Call{ - Func: "bar", - Posx: ast.Pos{Column: 7, Line: 1}, - Args: []ast.Node{ - &ast.VariableAccess{ - Name: "baz", - Posx: ast.Pos{Column: 11, Line: 1}, - }, - }, - }, - }, - }, - }, - }, - }, - - { - `foo ${"bar ${baz}"}`, - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "foo ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 1, Line: 1}, - }, - &ast.Output{ - Posx: ast.Pos{Column: 7, Line: 1}, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Value: "bar ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 8, Line: 1}, - }, - &ast.VariableAccess{ - Name: "baz", - Posx: ast.Pos{Column: 14, Line: 1}, - }, - }, - }, - }, - }, - }, - - { - "${foo[1]}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Index{ - Posx: ast.Pos{Column: 6, Line: 1}, - Target: &ast.VariableAccess{ - Name: "foo", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - Key: &ast.LiteralNode{ - Value: 1, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - }, - }, - }, - - { - "${foo[1]} - ${bar[0]}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Index{ - Posx: ast.Pos{Column: 6, Line: 1}, - Target: &ast.VariableAccess{ - Name: "foo", - Posx: ast.Pos{Column: 3, Line: 1}, - }, - Key: &ast.LiteralNode{ - Value: 1, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 7, Line: 1}, - }, - }, - &ast.LiteralNode{ - Value: " - ", - Typex: ast.TypeString, - Posx: ast.Pos{Column: 10, Line: 1}, - }, - &ast.Index{ - Posx: ast.Pos{Column: 18, Line: 1}, - Target: &ast.VariableAccess{ - Name: "bar", - Posx: ast.Pos{Column: 15, Line: 1}, - }, - Key: &ast.LiteralNode{ - Value: 0, - Typex: ast.TypeInt, - Posx: ast.Pos{Column: 19, Line: 1}, - }, - }, - }, - }, - }, - - { - // * has higher precedence than + - "${42+2*2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 3, Line: 1}, - Value: 42, - Typex: ast.TypeInt, - }, - &ast.Arithmetic{ - Posx: ast.Pos{Column: 6, Line: 1}, - Op: ast.ArithmeticOpMul, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 6, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 8, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - }, - }, - }, - - { - // parentheses override precedence rules - "${(42+2)*2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpMul, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 4, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 4, Line: 1}, - Value: 42, - Typex: ast.TypeInt, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 7, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 10, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - }, - - { - // Left-associative parsing of operators with equal precedence - "${42+2+2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 3, Line: 1}, - Value: 42, - Typex: ast.TypeInt, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 6, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 8, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - }, - - { - // Unary - has higher precedence than addition - "${42+-2+2}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 3, Line: 1}, - Value: 42, - Typex: ast.TypeInt, - }, - &ast.Arithmetic{ - Posx: ast.Pos{Column: 6, Line: 1}, - Op: ast.ArithmeticOpSub, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 6, Line: 1}, - Value: 0, - Typex: ast.TypeInt, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 7, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 9, Line: 1}, - Value: 2, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - }, - - { - "${-46+5}", - false, - &ast.Output{ - Posx: ast.Pos{Column: 1, Line: 1}, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpAdd, - Exprs: []ast.Node{ - &ast.Arithmetic{ - Posx: ast.Pos{Column: 3, Line: 1}, - Op: ast.ArithmeticOpSub, - Exprs: []ast.Node{ - &ast.LiteralNode{ - Posx: ast.Pos{Column: 3, Line: 1}, - Value: 0, - Typex: ast.TypeInt, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 4, Line: 1}, - Value: 46, - Typex: ast.TypeInt, - }, - }, - }, - &ast.LiteralNode{ - Posx: ast.Pos{Column: 7, Line: 1}, - Value: 5, - Typex: ast.TypeInt, - }, - }, - }, - }, - }, - }, - - { - "${foo=baz}", - true, - nil, - }, - - { - "${foo&baz}", - true, - nil, - }, - - { - "${foo|baz}", - true, - nil, - }, - - { - "${foo[1][2]}", - true, - nil, - }, - - { - `foo ${bar ${baz}}`, - true, - nil, - }, - - { - `foo ${${baz}}`, - true, - nil, - }, - - { - "${var", - true, - nil, - }, - - { - `${"unclosed`, - true, - nil, - }, - - { - `${"bar\nbaz}`, - true, - nil, - }, - - { - `${ö(o("")`, - true, - nil, - }, - - { - `${"${"${"`, - true, - nil, - }, - - { - `${("$"`, - true, - nil, - }, - - { - `${("${("${"${"$"`, - true, - nil, - }, - - { - `${(p["$"`, - true, - nil, - }, - - { - `${e(e,e,`, - true, - nil, - }, - - { - "${file(/tmp/somefile)}", - true, - nil, - }, - } - - for _, tc := range cases { - ch := scanner.Scan(tc.Input, ast.Pos{Line: 1, Column: 1}) - actual, err := Parse(ch) - if err != nil != tc.Error { - t.Errorf("\nError: %s\n\nInput: %s\n", err, tc.Input) - } - if !reflect.DeepEqual(actual, tc.Result) { - t.Errorf("\nGot: %#v\nWant: %#v\n\nInput: %s\n", actual, tc.Result, tc.Input) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/peeker.go b/vendor/github.com/hashicorp/hil/scanner/peeker.go deleted file mode 100644 index 4de3728..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/peeker.go +++ /dev/null @@ -1,55 +0,0 @@ -package scanner - -// Peeker is a utility that wraps a token channel returned by Scan and -// provides an interface that allows a caller (e.g. the parser) to -// work with the token stream in a mode that allows one token of lookahead, -// and provides utilities for more convenient processing of the stream. -type Peeker struct { - ch <-chan *Token - peeked *Token -} - -func NewPeeker(ch <-chan *Token) *Peeker { - return &Peeker{ - ch: ch, - } -} - -// Peek returns the next token in the stream without consuming it. A -// subsequent call to Read will return the same token. -func (p *Peeker) Peek() *Token { - if p.peeked == nil { - p.peeked = <-p.ch - } - return p.peeked -} - -// Read consumes the next token in the stream and returns it. -func (p *Peeker) Read() *Token { - token := p.Peek() - - // As a special case, we will produce the EOF token forever once - // it is reached. - if token.Type != EOF { - p.peeked = nil - } - - return token -} - -// Close ensures that the token stream has been exhausted, to prevent -// the goroutine in the underlying scanner from leaking. -// -// It's not necessary to call this if the caller reads the token stream -// to EOF, since that implicitly closes the scanner. -func (p *Peeker) Close() { - for _ = range p.ch { - // discard - } - // Install a synthetic EOF token in 'peeked' in case someone - // erroneously calls Peek() or Read() after we've closed. - p.peeked = &Token{ - Type: EOF, - Content: "", - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/peeker_test.go b/vendor/github.com/hashicorp/hil/scanner/peeker_test.go deleted file mode 100644 index d063a4a..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/peeker_test.go +++ /dev/null @@ -1,61 +0,0 @@ -package scanner - -import ( - "testing" -) - -func TestPeeker(t *testing.T) { - ch := make(chan *Token) - - go func() { - ch <- &Token{ - Type: IDENTIFIER, - Content: "foo", - } - ch <- &Token{ - Type: INTEGER, - Content: "1", - } - ch <- &Token{ - Type: EOF, - Content: "", - } - close(ch) - }() - - peeker := NewPeeker(ch) - - if got, want := peeker.Peek().Type, IDENTIFIER; got != want { - t.Fatalf("first peek returned %s; want %s", got, want) - } - if got, want := peeker.Read().Type, IDENTIFIER; got != want { - t.Fatalf("first read returned %s; want %s", got, want) - } - if got, want := peeker.Peek().Type, INTEGER; got != want { - t.Fatalf("second peek returned %s; want %s", got, want) - } - if got, want := peeker.Peek().Type, INTEGER; got != want { - t.Fatalf("third peek returned %s; want %s", got, want) - } - if got, want := peeker.Read().Type, INTEGER; got != want { - t.Fatalf("second read returned %s; want %s", got, want) - } - if got, want := peeker.Read().Type, EOF; got != want { - t.Fatalf("third read returned %s; want %s", got, want) - } - // reading again after EOF just returns EOF again - if got, want := peeker.Read().Type, EOF; got != want { - t.Fatalf("final read returned %s; want %s", got, want) - } - if got, want := peeker.Peek().Type, EOF; got != want { - t.Fatalf("final peek returned %s; want %s", got, want) - } - - peeker.Close() - if got, want := peeker.Peek().Type, EOF; got != want { - t.Fatalf("peek after close returned %s; want %s", got, want) - } - if got, want := peeker.Read().Type, EOF; got != want { - t.Fatalf("read after close returned %s; want %s", got, want) - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/scanner.go b/vendor/github.com/hashicorp/hil/scanner/scanner.go deleted file mode 100644 index 86085de..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/scanner.go +++ /dev/null @@ -1,556 +0,0 @@ -package scanner - -import ( - "unicode" - "unicode/utf8" - - "github.com/hashicorp/hil/ast" -) - -// Scan returns a channel that recieves Tokens from the given input string. -// -// The scanner's job is just to partition the string into meaningful parts. -// It doesn't do any transformation of the raw input string, so the caller -// must deal with any further interpretation required, such as parsing INTEGER -// tokens into real ints, or dealing with escape sequences in LITERAL or -// STRING tokens. -// -// Strings in the returned tokens are slices from the original string. -// -// startPos should be set to ast.InitPos unless the caller knows that -// this interpolation string is part of a larger file and knows the position -// of the first character in that larger file. -func Scan(s string, startPos ast.Pos) <-chan *Token { - ch := make(chan *Token) - go scan(s, ch, startPos) - return ch -} - -func scan(s string, ch chan<- *Token, pos ast.Pos) { - // 'remain' starts off as the whole string but we gradually - // slice of the front of it as we work our way through. - remain := s - - // nesting keeps track of how many ${ .. } sequences we are - // inside, so we can recognize the minor differences in syntax - // between outer string literals (LITERAL tokens) and quoted - // string literals (STRING tokens). - nesting := 0 - - // We're going to flip back and forth between parsing literals/strings - // and parsing interpolation sequences ${ .. } until we reach EOF or - // some INVALID token. -All: - for { - startPos := pos - // Literal string processing first, since the beginning of - // a string is always outside of an interpolation sequence. - literalVal, terminator := scanLiteral(remain, pos, nesting > 0) - - if len(literalVal) > 0 { - litType := LITERAL - if nesting > 0 { - litType = STRING - } - ch <- &Token{ - Type: litType, - Content: literalVal, - Pos: startPos, - } - remain = remain[len(literalVal):] - } - - ch <- terminator - remain = remain[len(terminator.Content):] - pos = terminator.Pos - // Safe to use len() here because none of the terminator tokens - // can contain UTF-8 sequences. - pos.Column = pos.Column + len(terminator.Content) - - switch terminator.Type { - case INVALID: - // Synthetic EOF after invalid token, since further scanning - // is likely to just produce more garbage. - ch <- &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break All - case EOF: - // All done! - break All - case BEGIN: - nesting++ - case CQUOTE: - // nothing special to do - default: - // Should never happen - panic("invalid string/literal terminator") - } - - // Now we do the processing of the insides of ${ .. } sequences. - // This loop terminates when we encounter either a closing } or - // an opening ", which will cause us to return to literal processing. - Interpolation: - for { - - token, size, newPos := scanInterpolationToken(remain, pos) - ch <- token - remain = remain[size:] - pos = newPos - - switch token.Type { - case INVALID: - // Synthetic EOF after invalid token, since further scanning - // is likely to just produce more garbage. - ch <- &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break All - case EOF: - // All done - // (though a syntax error that we'll catch in the parser) - break All - case END: - nesting-- - if nesting < 0 { - // Can happen if there are unbalanced ${ and } sequences - // in the input, which we'll catch in the parser. - nesting = 0 - } - break Interpolation - case OQUOTE: - // Beginning of nested quoted string - break Interpolation - } - } - } - - close(ch) -} - -// Returns the token found at the start of the given string, followed by -// the number of bytes that were consumed from the string and the adjusted -// source position. -// -// Note that the number of bytes consumed can be more than the length of -// the returned token contents if the string begins with whitespace, since -// it will be silently consumed before reading the token. -func scanInterpolationToken(s string, startPos ast.Pos) (*Token, int, ast.Pos) { - pos := startPos - size := 0 - - // Consume whitespace, if any - for len(s) > 0 && byteIsSpace(s[0]) { - if s[0] == '\n' { - pos.Column = 1 - pos.Line++ - } else { - pos.Column++ - } - size++ - s = s[1:] - } - - // Unexpected EOF during sequence - if len(s) == 0 { - return &Token{ - Type: EOF, - Content: "", - Pos: pos, - }, size, pos - } - - next := s[0] - var token *Token - - switch next { - case '(', ')', '[', ']', ',', '.', '+', '-', '*', '/', '%', '?', ':': - // Easy punctuation symbols that don't have any special meaning - // during scanning, and that stand for themselves in the - // TokenType enumeration. - token = &Token{ - Type: TokenType(next), - Content: s[:1], - Pos: pos, - } - case '}': - token = &Token{ - Type: END, - Content: s[:1], - Pos: pos, - } - case '"': - token = &Token{ - Type: OQUOTE, - Content: s[:1], - Pos: pos, - } - case '!': - if len(s) >= 2 && s[:2] == "!=" { - token = &Token{ - Type: NOTEQUAL, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: BANG, - Content: s[:1], - Pos: pos, - } - } - case '<': - if len(s) >= 2 && s[:2] == "<=" { - token = &Token{ - Type: LTE, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: LT, - Content: s[:1], - Pos: pos, - } - } - case '>': - if len(s) >= 2 && s[:2] == ">=" { - token = &Token{ - Type: GTE, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: GT, - Content: s[:1], - Pos: pos, - } - } - case '=': - if len(s) >= 2 && s[:2] == "==" { - token = &Token{ - Type: EQUAL, - Content: s[:2], - Pos: pos, - } - } else { - // A single equals is not a valid operator - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - case '&': - if len(s) >= 2 && s[:2] == "&&" { - token = &Token{ - Type: AND, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - case '|': - if len(s) >= 2 && s[:2] == "||" { - token = &Token{ - Type: OR, - Content: s[:2], - Pos: pos, - } - } else { - token = &Token{ - Type: INVALID, - Content: s[:1], - Pos: pos, - } - } - default: - if next >= '0' && next <= '9' { - num, numType := scanNumber(s) - token = &Token{ - Type: numType, - Content: num, - Pos: pos, - } - } else if stringStartsWithIdentifier(s) { - ident, runeLen := scanIdentifier(s) - tokenType := IDENTIFIER - if ident == "true" || ident == "false" { - tokenType = BOOL - } - token = &Token{ - Type: tokenType, - Content: ident, - Pos: pos, - } - // Skip usual token handling because it doesn't - // know how to deal with UTF-8 sequences. - pos.Column = pos.Column + runeLen - return token, size + len(ident), pos - } else { - _, byteLen := utf8.DecodeRuneInString(s) - token = &Token{ - Type: INVALID, - Content: s[:byteLen], - Pos: pos, - } - // Skip usual token handling because it doesn't - // know how to deal with UTF-8 sequences. - pos.Column = pos.Column + 1 - return token, size + byteLen, pos - } - } - - // Here we assume that the token content contains no UTF-8 sequences, - // because we dealt with UTF-8 characters as a special case where - // necessary above. - size = size + len(token.Content) - pos.Column = pos.Column + len(token.Content) - - return token, size, pos -} - -// Returns the (possibly-empty) prefix of the given string that represents -// a literal, followed by the token that marks the end of the literal. -func scanLiteral(s string, startPos ast.Pos, nested bool) (string, *Token) { - litLen := 0 - pos := startPos - var terminator *Token - for { - - if litLen >= len(s) { - if nested { - // We've ended in the middle of a quoted string, - // which means this token is actually invalid. - return "", &Token{ - Type: INVALID, - Content: s, - Pos: startPos, - } - } - terminator = &Token{ - Type: EOF, - Content: "", - Pos: pos, - } - break - } - - next := s[litLen] - - if next == '$' && len(s) > litLen+1 { - follow := s[litLen+1] - - if follow == '{' { - terminator = &Token{ - Type: BEGIN, - Content: s[litLen : litLen+2], - Pos: pos, - } - pos.Column = pos.Column + 2 - break - } else if follow == '$' { - // Double-$ escapes the special processing of $, - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } - } - - // special handling that applies only to quoted strings - if nested { - if next == '"' { - terminator = &Token{ - Type: CQUOTE, - Content: s[litLen : litLen+1], - Pos: pos, - } - pos.Column = pos.Column + 1 - break - } - - // Escaped quote marks do not terminate the string. - // - // All we do here in the scanner is avoid terminating a string - // due to an escaped quote. The parser is responsible for the - // full handling of escape sequences, since it's able to produce - // better error messages than we can produce in here. - if next == '\\' && len(s) > litLen+1 { - follow := s[litLen+1] - - if follow == '"' { - // \" escapes the special processing of ", - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } else if follow == '\\' { - // \\ escapes \ - // so we will consume both characters here. - pos.Column = pos.Column + 2 - litLen = litLen + 2 - continue - } - } - } - - if next == '\n' { - pos.Column = 1 - pos.Line++ - litLen++ - } else { - pos.Column++ - - // "Column" measures runes, so we need to actually consume - // a valid UTF-8 character here. - _, size := utf8.DecodeRuneInString(s[litLen:]) - litLen = litLen + size - } - - } - - return s[:litLen], terminator -} - -// scanNumber returns the extent of the prefix of the string that represents -// a valid number, along with what type of number it represents: INT or FLOAT. -// -// scanNumber does only basic character analysis: numbers consist of digits -// and periods, with at least one period signalling a FLOAT. It's the parser's -// responsibility to validate the form and range of the number, such as ensuring -// that a FLOAT actually contains only one period, etc. -func scanNumber(s string) (string, TokenType) { - period := -1 - byteLen := 0 - numType := INTEGER - for { - if byteLen >= len(s) { - break - } - - next := s[byteLen] - if next != '.' && (next < '0' || next > '9') { - // If our last value was a period, then we're not a float, - // we're just an integer that ends in a period. - if period == byteLen-1 { - byteLen-- - numType = INTEGER - } - - break - } - - if next == '.' { - // If we've already seen a period, break out - if period >= 0 { - break - } - - period = byteLen - numType = FLOAT - } - - byteLen++ - } - - return s[:byteLen], numType -} - -// scanIdentifier returns the extent of the prefix of the string that -// represents a valid identifier, along with the length of that prefix -// in runes. -// -// Identifiers may contain utf8-encoded non-Latin letters, which will -// cause the returned "rune length" to be shorter than the byte length -// of the returned string. -func scanIdentifier(s string) (string, int) { - byteLen := 0 - runeLen := 0 - for { - if byteLen >= len(s) { - break - } - - nextRune, size := utf8.DecodeRuneInString(s[byteLen:]) - if !(nextRune == '_' || - nextRune == '-' || - nextRune == '.' || - nextRune == '*' || - unicode.IsNumber(nextRune) || - unicode.IsLetter(nextRune) || - unicode.IsMark(nextRune)) { - break - } - - // If we reach a star, it must be between periods to be part - // of the same identifier. - if nextRune == '*' && s[byteLen-1] != '.' { - break - } - - // If our previous character was a star, then the current must - // be period. Otherwise, undo that and exit. - if byteLen > 0 && s[byteLen-1] == '*' && nextRune != '.' { - byteLen-- - if s[byteLen-1] == '.' { - byteLen-- - } - - break - } - - byteLen = byteLen + size - runeLen = runeLen + 1 - } - - return s[:byteLen], runeLen -} - -// byteIsSpace implements a restrictive interpretation of spaces that includes -// only what's valid inside interpolation sequences: spaces, tabs, newlines. -func byteIsSpace(b byte) bool { - switch b { - case ' ', '\t', '\r', '\n': - return true - default: - return false - } -} - -// stringStartsWithIdentifier returns true if the given string begins with -// a character that is a legal start of an identifier: an underscore or -// any character that Unicode considers to be a letter. -func stringStartsWithIdentifier(s string) bool { - if len(s) == 0 { - return false - } - - first := s[0] - - // Easy ASCII cases first - if (first >= 'a' && first <= 'z') || (first >= 'A' && first <= 'Z') || first == '_' { - return true - } - - // If our first byte begins a UTF-8 sequence then the sequence might - // be a unicode letter. - if utf8.RuneStart(first) { - firstRune, _ := utf8.DecodeRuneInString(s) - if unicode.IsLetter(firstRune) { - return true - } - } - - return false -} diff --git a/vendor/github.com/hashicorp/hil/scanner/scanner_test.go b/vendor/github.com/hashicorp/hil/scanner/scanner_test.go deleted file mode 100644 index a8b9644..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/scanner_test.go +++ /dev/null @@ -1,513 +0,0 @@ -package scanner - -import ( - "reflect" - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestScanner(t *testing.T) { - cases := []struct { - Input string - Output []TokenType - }{ - { - "", - []TokenType{EOF}, - }, - - { - "$", - []TokenType{LITERAL, EOF}, - }, - - { - `${"\`, - []TokenType{BEGIN, OQUOTE, INVALID, EOF}, - }, - - { - "foo", - []TokenType{LITERAL, EOF}, - }, - - { - "foo$bar", - []TokenType{LITERAL, EOF}, - }, - - { - "foo ${0}", - []TokenType{LITERAL, BEGIN, INTEGER, END, EOF}, - }, - - { - "foo ${0.}", - []TokenType{LITERAL, BEGIN, INTEGER, PERIOD, END, EOF}, - }, - - { - "foo ${0.0}", - []TokenType{LITERAL, BEGIN, FLOAT, END, EOF}, - }, - - { - "foo ${0.0.0}", - []TokenType{LITERAL, BEGIN, FLOAT, PERIOD, INTEGER, END, EOF}, - }, - - { - "föo ${bar}", - []TokenType{LITERAL, BEGIN, IDENTIFIER, END, EOF}, - }, - - { - "foo ${bar.0.baz}", - []TokenType{LITERAL, BEGIN, IDENTIFIER, END, EOF}, - }, - - { - "foo ${bar.foo-bar.baz}", - []TokenType{LITERAL, BEGIN, IDENTIFIER, END, EOF}, - }, - - { - "foo $${bar}", - []TokenType{LITERAL, EOF}, - }, - - { - "foo $$$${bar}", - []TokenType{LITERAL, EOF}, - }, - - { - `foo ${"bár"}`, - []TokenType{LITERAL, BEGIN, OQUOTE, STRING, CQUOTE, END, EOF}, - }, - - { - "${bar(baz)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, IDENTIFIER, CPAREN, - END, EOF, - }, - }, - - { - "${bar(baz4, foo_ooo)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, - IDENTIFIER, COMMA, IDENTIFIER, - CPAREN, - END, EOF, - }, - }, - - { - "${bár(42)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, INTEGER, CPAREN, - END, EOF, - }, - }, - - { - "${bar(-42)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, MINUS, INTEGER, CPAREN, - END, EOF, - }, - }, - - { - "${bar(42+1)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, - INTEGER, PLUS, INTEGER, - CPAREN, - END, EOF, - }, - }, - - { - "${true && false}", - []TokenType{ - BEGIN, - BOOL, AND, BOOL, - END, EOF, - }, - }, - - { - "${true || false}", - []TokenType{ - BEGIN, - BOOL, OR, BOOL, - END, EOF, - }, - }, - - { - "${1 == 5}", - []TokenType{ - BEGIN, - INTEGER, EQUAL, INTEGER, - END, EOF, - }, - }, - - { - "${1 != 5}", - []TokenType{ - BEGIN, - INTEGER, NOTEQUAL, INTEGER, - END, EOF, - }, - }, - - { - "${1 > 5}", - []TokenType{ - BEGIN, - INTEGER, GT, INTEGER, - END, EOF, - }, - }, - - { - "${1 < 5}", - []TokenType{ - BEGIN, - INTEGER, LT, INTEGER, - END, EOF, - }, - }, - - { - "${1 <= 5}", - []TokenType{ - BEGIN, - INTEGER, LTE, INTEGER, - END, EOF, - }, - }, - - { - "${1 >= 5}", - []TokenType{ - BEGIN, - INTEGER, GTE, INTEGER, - END, EOF, - }, - }, - - { - "${true ? 1 : 5}", - []TokenType{ - BEGIN, - BOOL, QUESTION, INTEGER, COLON, INTEGER, - END, EOF, - }, - }, - - { - "${bar(3.14159)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, FLOAT, CPAREN, - END, EOF, - }, - }, - - { - "${bar(true)}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, BOOL, CPAREN, - END, EOF, - }, - }, - - { - "${bar(inner(_baz))}", - []TokenType{ - BEGIN, - IDENTIFIER, OPAREN, - IDENTIFIER, OPAREN, - IDENTIFIER, - CPAREN, CPAREN, - END, EOF, - }, - }, - - { - "foo ${foo.bar.baz}", - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, - END, EOF, - }, - }, - - { - "foo ${foo.bar.*.baz}", - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, - END, EOF, - }, - }, - - { - "foo ${foo.bar.*}", - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, - END, EOF, - }, - }, - - { - "foo ${foo.bar.*baz}", - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, PERIOD, STAR, IDENTIFIER, - END, EOF, - }, - }, - - { - "foo ${foo*}", - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, STAR, - END, EOF, - }, - }, - - { - `foo ${foo("baz")}`, - []TokenType{ - LITERAL, - BEGIN, - IDENTIFIER, OPAREN, OQUOTE, STRING, CQUOTE, CPAREN, - END, EOF, - }, - }, - - { - `foo ${"${var.foo}"}`, - []TokenType{ - LITERAL, - BEGIN, - OQUOTE, - BEGIN, - IDENTIFIER, - END, - CQUOTE, - END, - EOF, - }, - }, - - { - "${1 = 5}", - []TokenType{ - BEGIN, - INTEGER, - INVALID, - EOF, - }, - }, - - { - "${1 & 5}", - []TokenType{ - BEGIN, - INTEGER, - INVALID, - EOF, - }, - }, - - { - "${1 | 5}", - []TokenType{ - BEGIN, - INTEGER, - INVALID, - EOF, - }, - }, - - { - `${unclosed`, - []TokenType{BEGIN, IDENTIFIER, EOF}, - }, - - { - `${"unclosed`, - []TokenType{BEGIN, OQUOTE, INVALID, EOF}, - }, - } - - for _, tc := range cases { - ch := Scan(tc.Input, ast.InitPos) - var actual []TokenType - for token := range ch { - actual = append(actual, token.Type) - } - - if !reflect.DeepEqual(actual, tc.Output) { - t.Errorf( - "\nInput: %s\nBad: %#v\nWant: %#v", - tc.Input, tokenTypeNames(actual), tokenTypeNames(tc.Output), - ) - } - } -} - -func TestScannerPos(t *testing.T) { - cases := []struct { - Input string - Positions []ast.Pos - }{ - { - `foo`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 4}, - }, - }, - { - `föo`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 4}, - }, - }, - { - // Ideally combining diacritic marks would actually get - // counted as only one character, but this test asserts - // our current compromise the "Column" counts runes - // rather than graphemes. - `fĉo`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 5}, - }, - }, - { - // Spaces in literals are counted as part of the literal. - ` foo `, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 6}, - }, - }, - { - `${foo}`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 3}, - {Line: 1, Column: 6}, - {Line: 1, Column: 7}, - }, - }, - { - // Spaces inside interpolation sequences are skipped - `${ foo }`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 4}, - {Line: 1, Column: 8}, - {Line: 1, Column: 9}, - }, - }, - { - `${föo}`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 3}, - {Line: 1, Column: 6}, - {Line: 1, Column: 7}, - }, - }, - { - `${fĉo}`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 3}, - {Line: 1, Column: 7}, - {Line: 1, Column: 8}, - }, - }, - { - `foo ${ foo } foo`, - []ast.Pos{ - {Line: 1, Column: 1}, - {Line: 1, Column: 5}, - {Line: 1, Column: 8}, - {Line: 1, Column: 12}, - {Line: 1, Column: 13}, - {Line: 1, Column: 17}, - }, - }, - { - `foo ${ " foo " } foo`, - []ast.Pos{ - {Line: 1, Column: 1}, // LITERAL - {Line: 1, Column: 5}, // BEGIN - {Line: 1, Column: 8}, // OQUOTE - {Line: 1, Column: 9}, // STRING - {Line: 1, Column: 14}, // CQUOTE - {Line: 1, Column: 16}, // END - {Line: 1, Column: 17}, // LITERAL - {Line: 1, Column: 21}, // EOF - }, - }, - } - - for _, tc := range cases { - ch := Scan(tc.Input, ast.Pos{Line: 1, Column: 1}) - var actual []ast.Pos - for token := range ch { - actual = append(actual, token.Pos) - } - - if !reflect.DeepEqual(actual, tc.Positions) { - t.Errorf( - "\nInput: %s\nBad: %#v\nWant: %#v", - tc.Input, posStrings(actual), posStrings(tc.Positions), - ) - } - } -} - -func tokenTypeNames(types []TokenType) []string { - ret := make([]string, len(types)) - for i, t := range types { - ret[i] = t.String() - } - return ret -} - -func posStrings(positions []ast.Pos) []string { - ret := make([]string, len(positions)) - for i, pos := range positions { - ret[i] = pos.String() - } - return ret -} diff --git a/vendor/github.com/hashicorp/hil/scanner/token.go b/vendor/github.com/hashicorp/hil/scanner/token.go deleted file mode 100644 index b6c82ae..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/token.go +++ /dev/null @@ -1,105 +0,0 @@ -package scanner - -import ( - "fmt" - - "github.com/hashicorp/hil/ast" -) - -type Token struct { - Type TokenType - Content string - Pos ast.Pos -} - -//go:generate stringer -type=TokenType -type TokenType rune - -const ( - // Raw string data outside of ${ .. } sequences - LITERAL TokenType = 'o' - - // STRING is like a LITERAL but it's inside a quoted string - // within a ${ ... } sequence, and so it can contain backslash - // escaping. - STRING TokenType = 'S' - - // Other Literals - INTEGER TokenType = 'I' - FLOAT TokenType = 'F' - BOOL TokenType = 'B' - - BEGIN TokenType = '$' // actually "${" - END TokenType = '}' - OQUOTE TokenType = '“' // Opening quote of a nested quoted sequence - CQUOTE TokenType = '”' // Closing quote of a nested quoted sequence - OPAREN TokenType = '(' - CPAREN TokenType = ')' - OBRACKET TokenType = '[' - CBRACKET TokenType = ']' - COMMA TokenType = ',' - - IDENTIFIER TokenType = 'i' - - PERIOD TokenType = '.' - PLUS TokenType = '+' - MINUS TokenType = '-' - STAR TokenType = '*' - SLASH TokenType = '/' - PERCENT TokenType = '%' - - AND TokenType = '∧' - OR TokenType = '∨' - BANG TokenType = '!' - - EQUAL TokenType = '=' - NOTEQUAL TokenType = '≠' - GT TokenType = '>' - LT TokenType = '<' - GTE TokenType = '≥' - LTE TokenType = '≤' - - QUESTION TokenType = '?' - COLON TokenType = ':' - - EOF TokenType = '␄' - - // Produced for sequences that cannot be understood as valid tokens - // e.g. due to use of unrecognized punctuation. - INVALID TokenType = '�' -) - -func (t *Token) String() string { - switch t.Type { - case EOF: - return "end of string" - case INVALID: - return fmt.Sprintf("invalid sequence %q", t.Content) - case INTEGER: - return fmt.Sprintf("integer %s", t.Content) - case FLOAT: - return fmt.Sprintf("float %s", t.Content) - case STRING: - return fmt.Sprintf("string %q", t.Content) - case LITERAL: - return fmt.Sprintf("literal %q", t.Content) - case OQUOTE: - return fmt.Sprintf("opening quote") - case CQUOTE: - return fmt.Sprintf("closing quote") - case AND: - return "&&" - case OR: - return "||" - case NOTEQUAL: - return "!=" - case GTE: - return ">=" - case LTE: - return "<=" - default: - // The remaining token types have content that - // speaks for itself. - return fmt.Sprintf("%q", t.Content) - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/token_test.go b/vendor/github.com/hashicorp/hil/scanner/token_test.go deleted file mode 100644 index b3db547..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/token_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package scanner - -import ( - "testing" -) - -func TestTokenString(t *testing.T) { - cases := []struct { - Token *Token - String string - }{ - { - &Token{ - Type: EOF, - Content: "", - }, - "end of string", - }, - - { - &Token{ - Type: INVALID, - Content: "baz", - }, - `invalid sequence "baz"`, - }, - - { - &Token{ - Type: INTEGER, - Content: "1", - }, - `integer 1`, - }, - - { - &Token{ - Type: FLOAT, - Content: "1.2", - }, - `float 1.2`, - }, - - { - &Token{ - Type: STRING, - Content: "foo", - }, - `string "foo"`, - }, - - { - &Token{ - Type: LITERAL, - Content: "foo", - }, - `literal "foo"`, - }, - - { - &Token{ - Type: BOOL, - Content: "true", - }, - `"true"`, - }, - - { - &Token{ - Type: BEGIN, - Content: "${", - }, - `"${"`, - }, - } - - for _, tc := range cases { - str := tc.Token.String() - if got, want := str, tc.String; got != want { - t.Errorf( - "%s %q returned %q; want %q", - tc.Token.Type, tc.Token.Content, - got, want, - ) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go b/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go deleted file mode 100644 index a602f5f..0000000 --- a/vendor/github.com/hashicorp/hil/scanner/tokentype_string.go +++ /dev/null @@ -1,51 +0,0 @@ -// Code generated by "stringer -type=TokenType"; DO NOT EDIT - -package scanner - -import "fmt" - -const _TokenType_name = "BANGBEGINPERCENTOPARENCPARENSTARPLUSCOMMAMINUSPERIODSLASHCOLONLTEQUALGTQUESTIONBOOLFLOATINTEGERSTRINGOBRACKETCBRACKETIDENTIFIERLITERALENDOQUOTECQUOTEANDORNOTEQUALLTEGTEEOFINVALID" - -var _TokenType_map = map[TokenType]string{ - 33: _TokenType_name[0:4], - 36: _TokenType_name[4:9], - 37: _TokenType_name[9:16], - 40: _TokenType_name[16:22], - 41: _TokenType_name[22:28], - 42: _TokenType_name[28:32], - 43: _TokenType_name[32:36], - 44: _TokenType_name[36:41], - 45: _TokenType_name[41:46], - 46: _TokenType_name[46:52], - 47: _TokenType_name[52:57], - 58: _TokenType_name[57:62], - 60: _TokenType_name[62:64], - 61: _TokenType_name[64:69], - 62: _TokenType_name[69:71], - 63: _TokenType_name[71:79], - 66: _TokenType_name[79:83], - 70: _TokenType_name[83:88], - 73: _TokenType_name[88:95], - 83: _TokenType_name[95:101], - 91: _TokenType_name[101:109], - 93: _TokenType_name[109:117], - 105: _TokenType_name[117:127], - 111: _TokenType_name[127:134], - 125: _TokenType_name[134:137], - 8220: _TokenType_name[137:143], - 8221: _TokenType_name[143:149], - 8743: _TokenType_name[149:152], - 8744: _TokenType_name[152:154], - 8800: _TokenType_name[154:162], - 8804: _TokenType_name[162:165], - 8805: _TokenType_name[165:168], - 9220: _TokenType_name[168:171], - 65533: _TokenType_name[171:178], -} - -func (i TokenType) String() string { - if str, ok := _TokenType_map[i]; ok { - return str - } - return fmt.Sprintf("TokenType(%d)", i) -} diff --git a/vendor/github.com/hashicorp/hil/transform_fixed.go b/vendor/github.com/hashicorp/hil/transform_fixed.go deleted file mode 100644 index e69df29..0000000 --- a/vendor/github.com/hashicorp/hil/transform_fixed.go +++ /dev/null @@ -1,29 +0,0 @@ -package hil - -import ( - "github.com/hashicorp/hil/ast" -) - -// FixedValueTransform transforms an AST to return a fixed value for -// all interpolations. i.e. you can make "hi ${anything}" always -// turn into "hi foo". -// -// The primary use case for this is for config validations where you can -// verify that interpolations result in a certain type of string. -func FixedValueTransform(root ast.Node, Value *ast.LiteralNode) ast.Node { - // We visit the nodes in top-down order - result := root - switch n := result.(type) { - case *ast.Output: - for i, v := range n.Exprs { - n.Exprs[i] = FixedValueTransform(v, Value) - } - case *ast.LiteralNode: - // We keep it as-is - default: - // Anything else we replace - result = Value - } - - return result -} diff --git a/vendor/github.com/hashicorp/hil/transform_fixed_test.go b/vendor/github.com/hashicorp/hil/transform_fixed_test.go deleted file mode 100644 index 102f45f..0000000 --- a/vendor/github.com/hashicorp/hil/transform_fixed_test.go +++ /dev/null @@ -1,48 +0,0 @@ -package hil - -import ( - "reflect" - "testing" - - "github.com/hashicorp/hil/ast" -) - -func TestFixedValueTransform(t *testing.T) { - cases := []struct { - Input ast.Node - Output ast.Node - }{ - { - &ast.LiteralNode{Value: 42}, - &ast.LiteralNode{Value: 42}, - }, - - { - &ast.VariableAccess{Name: "bar"}, - &ast.LiteralNode{Value: "foo"}, - }, - - { - &ast.Output{ - Exprs: []ast.Node{ - &ast.VariableAccess{Name: "bar"}, - &ast.LiteralNode{Value: 42}, - }, - }, - &ast.Output{ - Exprs: []ast.Node{ - &ast.LiteralNode{Value: "foo"}, - &ast.LiteralNode{Value: 42}, - }, - }, - }, - } - - value := &ast.LiteralNode{Value: "foo"} - for _, tc := range cases { - actual := FixedValueTransform(tc.Input, value) - if !reflect.DeepEqual(actual, tc.Output) { - t.Fatalf("bad: %#v\n\nInput: %#v", actual, tc.Input) - } - } -} diff --git a/vendor/github.com/hashicorp/hil/walk.go b/vendor/github.com/hashicorp/hil/walk.go deleted file mode 100644 index 0ace830..0000000 --- a/vendor/github.com/hashicorp/hil/walk.go +++ /dev/null @@ -1,266 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - "strings" - - "github.com/hashicorp/hil/ast" - "github.com/mitchellh/reflectwalk" -) - -// WalkFn is the type of function to pass to Walk. Modify fields within -// WalkData to control whether replacement happens. -type WalkFn func(*WalkData) error - -// WalkData is the structure passed to the callback of the Walk function. -// -// This structure contains data passed in as well as fields that are expected -// to be written by the caller as a result. Please see the documentation for -// each field for more information. -type WalkData struct { - // Root is the parsed root of this HIL program - Root ast.Node - - // Location is the location within the structure where this - // value was found. This can be used to modify behavior within - // slices and so on. - Location reflectwalk.Location - - // The below two values must be set by the callback to have any effect. - // - // Replace, if true, will replace the value in the structure with - // ReplaceValue. It is up to the caller to make sure this is a string. - Replace bool - ReplaceValue string -} - -// Walk will walk an arbitrary Go structure and parse any string as an -// HIL program and call the callback cb to determine what to replace it -// with. -// -// This function is very useful for arbitrary HIL program interpolation -// across a complex configuration structure. Due to the heavy use of -// reflection in this function, it is recommend to write many unit tests -// with your typical configuration structures to hilp mitigate the risk -// of panics. -func Walk(v interface{}, cb WalkFn) error { - walker := &interpolationWalker{F: cb} - return reflectwalk.Walk(v, walker) -} - -// interpolationWalker implements interfaces for the reflectwalk package -// (github.com/mitchellh/reflectwalk) that can be used to automatically -// execute a callback for an interpolation. -type interpolationWalker struct { - F WalkFn - - key []string - lastValue reflect.Value - loc reflectwalk.Location - cs []reflect.Value - csKey []reflect.Value - csData interface{} - sliceIndex int - unknownKeys []string -} - -func (w *interpolationWalker) Enter(loc reflectwalk.Location) error { - w.loc = loc - return nil -} - -func (w *interpolationWalker) Exit(loc reflectwalk.Location) error { - w.loc = reflectwalk.None - - switch loc { - case reflectwalk.Map: - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.MapValue: - w.key = w.key[:len(w.key)-1] - w.csKey = w.csKey[:len(w.csKey)-1] - case reflectwalk.Slice: - // Split any values that need to be split - w.splitSlice() - w.cs = w.cs[:len(w.cs)-1] - case reflectwalk.SliceElem: - w.csKey = w.csKey[:len(w.csKey)-1] - } - - return nil -} - -func (w *interpolationWalker) Map(m reflect.Value) error { - w.cs = append(w.cs, m) - return nil -} - -func (w *interpolationWalker) MapElem(m, k, v reflect.Value) error { - w.csData = k - w.csKey = append(w.csKey, k) - w.key = append(w.key, k.String()) - w.lastValue = v - return nil -} - -func (w *interpolationWalker) Slice(s reflect.Value) error { - w.cs = append(w.cs, s) - return nil -} - -func (w *interpolationWalker) SliceElem(i int, elem reflect.Value) error { - w.csKey = append(w.csKey, reflect.ValueOf(i)) - w.sliceIndex = i - return nil -} - -func (w *interpolationWalker) Primitive(v reflect.Value) error { - setV := v - - // We only care about strings - if v.Kind() == reflect.Interface { - setV = v - v = v.Elem() - } - if v.Kind() != reflect.String { - return nil - } - - astRoot, err := Parse(v.String()) - if err != nil { - return err - } - - // If the AST we got is just a literal string value with the same - // value then we ignore it. We have to check if its the same value - // because it is possible to input a string, get out a string, and - // have it be different. For example: "foo-$${bar}" turns into - // "foo-${bar}" - if n, ok := astRoot.(*ast.LiteralNode); ok { - if s, ok := n.Value.(string); ok && s == v.String() { - return nil - } - } - - if w.F == nil { - return nil - } - - data := WalkData{Root: astRoot, Location: w.loc} - if err := w.F(&data); err != nil { - return fmt.Errorf( - "%s in:\n\n%s", - err, v.String()) - } - - if data.Replace { - /* - if remove { - w.removeCurrent() - return nil - } - */ - - resultVal := reflect.ValueOf(data.ReplaceValue) - switch w.loc { - case reflectwalk.MapKey: - m := w.cs[len(w.cs)-1] - - // Delete the old value - var zero reflect.Value - m.SetMapIndex(w.csData.(reflect.Value), zero) - - // Set the new key with the existing value - m.SetMapIndex(resultVal, w.lastValue) - - // Set the key to be the new key - w.csData = resultVal - case reflectwalk.MapValue: - // If we're in a map, then the only way to set a map value is - // to set it directly. - m := w.cs[len(w.cs)-1] - mk := w.csData.(reflect.Value) - m.SetMapIndex(mk, resultVal) - default: - // Otherwise, we should be addressable - setV.Set(resultVal) - } - } - - return nil -} - -func (w *interpolationWalker) removeCurrent() { - // Append the key to the unknown keys - w.unknownKeys = append(w.unknownKeys, strings.Join(w.key, ".")) - - for i := 1; i <= len(w.cs); i++ { - c := w.cs[len(w.cs)-i] - switch c.Kind() { - case reflect.Map: - // Zero value so that we delete the map key - var val reflect.Value - - // Get the key and delete it - k := w.csData.(reflect.Value) - c.SetMapIndex(k, val) - return - } - } - - panic("No container found for removeCurrent") -} - -func (w *interpolationWalker) replaceCurrent(v reflect.Value) { - c := w.cs[len(w.cs)-2] - switch c.Kind() { - case reflect.Map: - // Get the key and delete it - k := w.csKey[len(w.csKey)-1] - c.SetMapIndex(k, v) - } -} - -func (w *interpolationWalker) splitSlice() { - // Get the []interface{} slice so we can do some operations on - // it without dealing with reflection. We'll document each step - // here to be clear. - var s []interface{} - raw := w.cs[len(w.cs)-1] - switch v := raw.Interface().(type) { - case []interface{}: - s = v - case []map[string]interface{}: - return - default: - panic("Unknown kind: " + raw.Kind().String()) - } - - // Check if we have any elements that we need to split. If not, then - // just return since we're done. - split := false - if !split { - return - } - - // Make a new result slice that is twice the capacity to fit our growth. - result := make([]interface{}, 0, len(s)*2) - - // Go over each element of the original slice and start building up - // the resulting slice by splitting where we have to. - for _, v := range s { - sv, ok := v.(string) - if !ok { - // Not a string, so just set it - result = append(result, v) - continue - } - - // Not a string list, so just set it - result = append(result, sv) - } - - // Our slice is now done, we have to replace the slice now - // with this new one that we have. - w.replaceCurrent(reflect.ValueOf(result)) -} diff --git a/vendor/github.com/hashicorp/hil/walk_test.go b/vendor/github.com/hashicorp/hil/walk_test.go deleted file mode 100644 index 214416f..0000000 --- a/vendor/github.com/hashicorp/hil/walk_test.go +++ /dev/null @@ -1,192 +0,0 @@ -package hil - -import ( - "fmt" - "reflect" - "testing" -) - -func TestInterpolationWalker_detect(t *testing.T) { - cases := []struct { - Input interface{} - Result []string - }{ - { - Input: map[string]interface{}{ - "foo": "$${var.foo}", - }, - Result: []string{ - "Literal(TypeString, ${var.foo})", - }, - }, - - { - Input: map[string]interface{}{ - "foo": "${var.foo}", - }, - Result: []string{ - "Variable(var.foo)", - }, - }, - - { - Input: map[string]interface{}{ - "foo": "${aws_instance.foo.*.num}", - }, - Result: []string{ - "Variable(aws_instance.foo.*.num)", - }, - }, - - { - Input: map[string]interface{}{ - "foo": "${lookup(var.foo)}", - }, - Result: []string{ - "Call(lookup, Variable(var.foo))", - }, - }, - - { - Input: map[string]interface{}{ - "foo": `${file("test.txt")}`, - }, - Result: []string{ - "Call(file, Literal(TypeString, test.txt))", - }, - }, - - { - Input: map[string]interface{}{ - "foo": `${file("foo/bar.txt")}`, - }, - Result: []string{ - "Call(file, Literal(TypeString, foo/bar.txt))", - }, - }, - - { - Input: map[string]interface{}{ - "foo": `${join(",", foo.bar.*.id)}`, - }, - Result: []string{ - "Call(join, Literal(TypeString, ,), Variable(foo.bar.*.id))", - }, - }, - - { - Input: map[string]interface{}{ - "foo": `${concat("localhost", ":8080")}`, - }, - Result: []string{ - "Call(concat, Literal(TypeString, localhost), Literal(TypeString, :8080))", - }, - }, - } - - for i, tc := range cases { - t.Run(fmt.Sprintf("#%d", i), func(t *testing.T) { - var actual []string - detectFn := func(data *WalkData) error { - actual = append(actual, fmt.Sprintf("%s", data.Root)) - return nil - } - - if err := Walk(tc.Input, detectFn); err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(actual, tc.Result) { - t.Fatalf("%d: bad:\n\n%#v", i, actual) - } - }) - } -} - -func TestInterpolationWalker_replace(t *testing.T) { - cases := []struct { - Input interface{} - Output interface{} - Value string - }{ - { - Input: map[string]interface{}{ - "foo": "$${var.foo}", - }, - Output: map[string]interface{}{ - "foo": "bar", - }, - Value: "bar", - }, - - { - Input: map[string]interface{}{ - "foo": "hi, ${var.foo}", - }, - Output: map[string]interface{}{ - "foo": "bar", - }, - Value: "bar", - }, - - { - Input: map[string]interface{}{ - "foo": map[string]interface{}{ - "${var.foo}": "bar", - }, - }, - Output: map[string]interface{}{ - "foo": map[string]interface{}{ - "bar": "bar", - }, - }, - Value: "bar", - }, - - /* - { - Input: map[string]interface{}{ - "foo": []interface{}{ - "${var.foo}", - "bing", - }, - }, - Output: map[string]interface{}{ - "foo": []interface{}{ - "bar", - "baz", - "bing", - }, - }, - Value: NewStringList([]string{"bar", "baz"}).String(), - }, - - { - Input: map[string]interface{}{ - "foo": []interface{}{ - "${var.foo}", - "bing", - }, - }, - Output: map[string]interface{}{}, - Value: NewStringList([]string{UnknownVariableValue, "baz"}).String(), - }, - */ - } - - for i, tc := range cases { - fn := func(data *WalkData) error { - data.Replace = true - data.ReplaceValue = tc.Value - return nil - } - - if err := Walk(tc.Input, fn); err != nil { - t.Fatalf("err: %s", err) - } - - if !reflect.DeepEqual(tc.Input, tc.Output) { - t.Fatalf("%d: bad:\n\nexpected:%#v\ngot:%#v", i, tc.Output, tc.Input) - } - } -} diff --git a/vendor/github.com/hashicorp/terraform/.gitignore b/vendor/github.com/hashicorp/terraform/.gitignore deleted file mode 100644 index 5982d2c..0000000 --- a/vendor/github.com/hashicorp/terraform/.gitignore +++ /dev/null @@ -1,31 +0,0 @@ -*.dll -*.exe -.DS_Store -example.tf -terraform.tfplan -terraform.tfstate -bin/ -modules-dev/ -/pkg/ -website/.vagrant -website/.bundle -website/build -website/node_modules -.vagrant/ -*.backup -./*.tfstate -.terraform/ -*.log -*.bak -*~ -.*.swp -.idea -*.iml -*.test -*.iml - -website/vendor - -# Test exclusions -!command/test-fixtures/**/*.tfstate -!command/test-fixtures/**/.terraform/ diff --git a/vendor/github.com/hashicorp/terraform/.travis.yml b/vendor/github.com/hashicorp/terraform/.travis.yml deleted file mode 100644 index a7a2876..0000000 --- a/vendor/github.com/hashicorp/terraform/.travis.yml +++ /dev/null @@ -1,51 +0,0 @@ -dist: trusty -sudo: false -language: go -go: -- 1.9.1 - -# add TF_CONSUL_TEST=1 to run consul tests -# they were causing timouts in travis -# add TF_ETCDV3_TEST=1 to run etcdv3 tests -# if added, TF_ETCDV3_ENDPOINTS must be set to a comma-separated list of (insecure) etcd endpoints against which to test -env: - - CONSUL_VERSION=0.7.5 GOMAXPROCS=4 - -# Fetch consul for the backend and provider tests -before_install: - - curl -sLo consul.zip https://releases.hashicorp.com/consul/${CONSUL_VERSION}/consul_${CONSUL_VERSION}_linux_amd64.zip - - unzip consul.zip - - mkdir -p ~/bin - - mv consul ~/bin - - export PATH="~/bin:$PATH" - -install: -# This script is used by the Travis build to install a cookie for -# go.googlesource.com so rate limits are higher when using `go get` to fetch -# packages that live there. -# See: https://github.com/golang/go/issues/12933 -- bash scripts/gogetcookie.sh -- go get github.com/kardianos/govendor - -before_script: -- git config --global url.https://github.com/.insteadOf ssh://git@github.com/ - -script: -- make vendor-status -- make test -- make e2etest -- make vet -- GOOS=windows go build -branches: - only: - - master -notifications: - irc: - channels: - - irc.freenode.org#terraform-tool - skip_join: true - use_notice: true -matrix: - fast_finish: true - allow_failures: - - go: tip diff --git a/vendor/github.com/hashicorp/terraform/BUILDING.md b/vendor/github.com/hashicorp/terraform/BUILDING.md deleted file mode 100644 index fae3a9e..0000000 --- a/vendor/github.com/hashicorp/terraform/BUILDING.md +++ /dev/null @@ -1,56 +0,0 @@ -# Building Terraform - -This document contains details about the process for building binaries for -Terraform. - -## Versioning - -As a pre-1.0 project, we use the MINOR and PATCH versions as follows: - - * a `MINOR` version increment indicates a release that may contain backwards - incompatible changes - * a `PATCH` version increment indicates a release that may contain bugfixes as - well as additive (backwards compatible) features and enhancements - -## Process - -If only need to build binaries for the platform you're running (Windows, Linux, -Mac OS X etc..), you can follow the instructions in the README for [Developing -Terraform][1]. - -The guide below outlines the steps HashiCorp takes to build the official release -binaries for Terraform. This process will generate a set of binaries for each supported -platform, using the [gox](https://github.com/mitchellh/gox) tool. - -A Vagrant virtual machine is used to provide a consistent environment with -the pre-requisite tools in place. The specifics of this VM are defined in the -[Vagrantfile](Vagrantfile). - - -```sh -# clone the repository if needed -git clone https://github.com/hashicorp/terraform.git -cd terraform - -# Spin up a fresh build VM -vagrant destroy -f -vagrant up -vagrant ssh - -# The Vagrantfile installs Go and configures the $GOPATH at /opt/gopath -# The current "terraform" directory is then sync'd into the gopath -cd /opt/gopath/src/github.com/hashicorp/terraform/ - -# Verify unit tests pass -make test - -# Build the release -# This generates binaries for each platform and places them in the pkg folder -make bin -``` - -After running these commands, you should have binaries for all supported -platforms in the `pkg` folder. - - -[1]: https://github.com/hashicorp/terraform#developing-terraform diff --git a/vendor/github.com/hashicorp/terraform/CHANGELOG.md b/vendor/github.com/hashicorp/terraform/CHANGELOG.md deleted file mode 100644 index dc68029..0000000 --- a/vendor/github.com/hashicorp/terraform/CHANGELOG.md +++ /dev/null @@ -1,4606 +0,0 @@ -## 0.11.2 (January 9, 2018) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* backend/gcs: The gcs remote state backend was erroneously creating the state bucket if it didn't exist. This is not the intended behavior of backends, as Terraform cannot track or manage that resource. The target bucket must now be created separately, before using it with Terraform. ([#16865](https://github.com/hashicorp/terraform/issues/16865)) - -NEW FEATURES: - -* **[Habitat](https://www.habitat.sh/) Provisioner** allowing automatic installation of the Habitat agent ([#16280](https://github.com/hashicorp/terraform/issues/16280)) - -IMPROVEMENTS: - -* core: removed duplicate prompts and clarified working when migration backend configurations ([#16939](https://github.com/hashicorp/terraform/issues/16939)) -* config: new `rsadecrypt` interpolation function allows decrypting a base64-encoded ciphertext using a given private key. This is particularly useful for decrypting the password for a Windows instance on AWS EC2, but is generic and may find other uses too. ([#16647](https://github.com/hashicorp/terraform/issues/16647)) -* config: new `timeadd` interpolation function allows calculating a new timestamp relative to an existing known timestamp. ([#16644](https://github.com/hashicorp/terraform/issues/16644)) -* cli: Passing an empty string to `-plugin-dir` during init will remove previously saved paths ([#16969](https://github.com/hashicorp/terraform/issues/16969)) -* cli: Module and provider installation (and some other Terraform features) now implement [RFC6555](https://tools.ietf.org/html/rfc6555) when making outgoing HTTP requests, which should improve installation reliability for dual-stack (both IPv4 and IPv6) hosts running on networks that have non-performant or broken IPv6 Internet connectivity by trying both IPv4 and IPv6 connections. ([#16805](https://github.com/hashicorp/terraform/issues/16805)) -* backend/s3: it is now possible to disable the region check, for improved compatibility with third-party services that attempt to mimic the S3 API. ([#16757](https://github.com/hashicorp/terraform/issues/16757)) -* backend/s3: it is now possible to for the path-based S3 API form, for improved compatibility with third-party services that attempt to mimic the S3 API. ([#17001](https://github.com/hashicorp/terraform/issues/17001)) -* backend/s3: it is now possible to use named credentials from the `~/.aws/credentials` file, similarly to the AWS plugin ([#16661](https://github.com/hashicorp/terraform/issues/16661)) -* backend/manta: support for Triton RBAC ([#17003](https://github.com/hashicorp/terraform/issues/17003)) -* backend/gcs: support for customer-supplied encryption keys for remote state buckets ([#16936](https://github.com/hashicorp/terraform/issues/16936)) -* provider/terraform: in `terraform_remote_state`, the argument `environment` is now deprecated in favor of `workspace`. The `environment` argument will be removed in a later Terraform release. ([#16558](https://github.com/hashicorp/terraform/issues/16558)) - -BUG FIXES: - -* config: fixed crash in `substr` interpolation function with invalid offset ([#17043](https://github.com/hashicorp/terraform/issues/17043)) -* config: Referencing a count attribute in an output no longer generates a warning ([#16866](https://github.com/hashicorp/terraform/issues/16866)) -* cli: Terraform will no longer crash when `terraform plan`, `terraform apply`, and some other commands encounter an invalid provider version constraint in configuration, generating a proper error message instead. ([#16867](https://github.com/hashicorp/terraform/issues/16867)) -* backend/gcs: The usage of the GOOGLE_CREDENTIALS environment variable now matches that of the google provider ([#16865](https://github.com/hashicorp/terraform/issues/16865)) -* backend/gcs: fixed the locking methodology to avoid "double-locking" issues when used with the `terraform_remote_state` data source ([#16852](https://github.com/hashicorp/terraform/issues/16852)) -* backend/s3: the `workspace_key_prefix` can now be an empty string or contain slashes ([#16932](https://github.com/hashicorp/terraform/issues/16932)) -* provisioner/salt-masterless: now waits for all of the remote operations to complete before returning ([#16704](https://github.com/hashicorp/terraform/issues/16704)) - -## 0.11.1 (November 30, 2017) - -IMPROVEMENTS: - -* modules: Modules can now receive a specific provider configuration in the `providers` map, even if it's only implicitly used ([#16619](https://github.com/hashicorp/terraform/issues/16619)) -* config: Terraform will now detect and warn about outputs containing potentially-problematic references to resources with `count` set where the references does not use the "splat" syntax. This identifies situations where an output may [reference a resource with `count = 0`](https://www.terraform.io/upgrade-guides/0-11.html#referencing-attributes-from-resources-with-count-0) even if the `count` expression does not _currently_ evaluate to `0`, allowing the bug to be detected and fixed _before_ the value is later changed to `0` and would thus become an error. **This usage will become a fatal error in Terraform 0.12**. ([#16735](https://github.com/hashicorp/terraform/issues/16735)) -* core: A new environment variable `TF_WARN_OUTPUT_ERRORS=1` is supported to opt out of the behavior introduced in 0.11.0 where errors in output expressions halt execution. This restores the previous behavior where such errors are ignored, allowing users to apply problematic configurations without fixing all of the errors. This opt-out will be removed in Terraform 0.12, so it is strongly recommended to use the new warning described in the previous item to detect and fix these problematic expressions. ([#16782](https://github.com/hashicorp/terraform/issues/16782)) - -BUG FIXES: - -* cli: fix crash when subcommands with sub-subcommands are accidentally provided as a single argument, such as `terraform "workspace list"` ([#16789](https://github.com/hashicorp/terraform/issues/16789)) - -## 0.11.0 (November 16, 2017) - -The following list combines the changes from 0.11.0-beta1 and 0.11.0-rc1 to give the full set of changes since 0.10.8. For details on each of the individual pre-releases, please see [the 0.11.0-rc1 CHANGELOG](https://github.com/hashicorp/terraform/blob/v0.11.0-rc1/CHANGELOG.md). - -BACKWARDS INCOMPATIBILITIES / NOTES: - -The following items give an overview of the incompatibilities and other noteworthy changes in this release. For more details on some of these changes, along with information on how to upgrade existing configurations where needed, see [the v0.11 upgrade guide](https://www.terraform.io/upgrade-guides/0-11.html). - -* Output interpolation errors are now fatal. Module configs with unused outputs which contained errors will no longer be valid. -* Module configuration blocks have 2 new reserved attribute names, "providers" and "version". Modules using these as input variables will need to be updated. -* The module provider inheritance rules have changed. Inherited provider configurations will no longer be merged with local configurations, and additional (aliased) provider configurations must be explicitly passed between modules when shared. See [the upgrade guide](https://www.terraform.io/upgrade-guides/0-11.html) for more details. -* The command `terraform apply` with no explicit plan argument is now interactive by default. Specifically, it will show the generated plan and wait for confirmation before applying it, similar to the existing behavior of `terraform destroy`. The behavior is unchanged when a plan file argument is provided, and the previous behavior can be obtained _without_ a plan file by using the `-auto-approve` option. -* The `terraform` provider (that is, the provider that contains the `terraform_remote_state` data source) has been re-incorporated as a built-in provider in the Terraform Core executable. In 0.10 it was split into a separate plugin along with all of the other providers, but this provider uses several internal Terraform Core APIs and so in practice it's been confusing to version that separately from Terraform Core. As a consequence, this provider no longer supports version constraints, and so `version` attributes for this provider in configuration must be removed. -* When remote state is enabled, Terraform will no longer generate a local `terraform.tfstate.backup` file before updating remote state. Previously this file could potentially be used to recover a previous state to help recover after a mistake, but it also caused a potentially-sensitive state file to be generated in an unexpected location that may be inadvertently copied or checked in to version control. With this local backup now removed, we recommend instead relying on versioning or backup mechanisms provided by the backend, such as Amazon S3 versioning or Terraform Enterprise's built-in state history mechanism. (Terraform will still create the local file `errored.tfstate` in the unlikely event that there is an error when writing to the remote backend.) - -NEW FEATURES: - -* modules: Module configuration blocks now have a "version" attribute, to set a version constraint for modules sourced from a registry. ([#16466](https://github.com/hashicorp/terraform/issues/16466)) -* modules: Module configuration blocks now have a "providers" attribute, to map a provider configuration from the current module into a submodule ([#16379](https://github.com/hashicorp/terraform/issues/16379)) -* backend/gcs: The gcs remote state backend now supports workspaces and locking. -* backend/manta: The Manta backend now supports workspaces and locking ([#16296](https://github.com/hashicorp/terraform/issues/16296)) - -IMPROVEMENTS: - -* cli: The `terraform apply` command now waits for interactive approval of the generated plan before applying it, unless an explicit plan file is provided. ([#16502](https://github.com/hashicorp/terraform/issues/16502)) -* cli: The `terraform version` command now prints out the version numbers of initialized plugins as well as the version of Terraform core, so that they can be more easily shared when opening GitHub Issues, etc. ([#16439](https://github.com/hashicorp/terraform/issues/16439)) -* cli: A new `TF_DATA_DIR` environment variable can be used to override the location where Terraform stores the files normally placed in the `.terraform` directory. ([#16207](https://github.com/hashicorp/terraform/issues/16207)) -* provider/terraform: now built in to Terraform Core so that it will always have the same backend functionality as the Terraform release it corresponds to. ([#16543](https://github.com/hashicorp/terraform/issues/16543)) - -BUG FIXES: - -* config: Provider config in submodules will no longer be overridden by parent providers with the same name. ([#16379](https://github.com/hashicorp/terraform/issues/16379)) -* cli: When remote state is enabled, Terraform will no longer generate a local `terraform.tfstate.backup` file before updating remote state. ([#16464](https://github.com/hashicorp/terraform/issues/16464)) -* core: state now includes a reference to the provider configuration most recently used to create or update a resource, so that the same configuration can be used to destroy that resource if its configuration (including the explicit pointer to a provider configuration) is removed ([#16586](https://github.com/hashicorp/terraform/issues/16586)) -* core: Module outputs can now produce errors, preventing them from silently propagating through the config. ([#16204](https://github.com/hashicorp/terraform/issues/16204)) -* backend/gcs: will now automatically add a slash to the given prefix if not present, since without it the workspace enumeration does not function correctly ([#16585](https://github.com/hashicorp/terraform/issues/16585)) - -PROVIDER FRAMEWORK CHANGES (not user-facing): - -* helper/schema: Loosen validation for 'id' field ([#16456](https://github.com/hashicorp/terraform/issues/16456)) - -## 0.10.8 (October 25, 2017) - -NEW FEATURES: - -* **New `etcdv3` backend**, for use with the newer etcd api ([#15680](https://github.com/hashicorp/terraform/issues/15680)) -* **New interpolation function `chunklist`**, for spliting a list into a list of lists with specified sublist chunk sizes. ([#15112](https://github.com/hashicorp/terraform/issues/15112)) - -IMPROVEMENTS: - -* backend/s3: Add options to skip AWS validation which allows non-AWS S3 backends ([#15553](https://github.com/hashicorp/terraform/issues/15553)) - -BUG FIXES: - -* command/validate: Respect `-plugin-dir` overridden plugin paths in the `terraform validate` command. ([#15985](https://github.com/hashicorp/terraform/issues/15985)) -* provisioner/chef: Clean clients from `chef-vault` when `recreate_client` enabled ([#16357](https://github.com/hashicorp/terraform/issues/16357)) -* communicator/winrm: Support the `cacert` option for custom certificate authorities when provisioning over WinRM ([#14783](https://github.com/hashicorp/terraform/issues/14783)) - -## 0.10.7 (October 2, 2017) - -NEW FEATURES: - -* Provider plugins can now optionally be cached in a shared directory to avoid re-downloading them for each configuration working directory. For more information, see [the documentation](https://github.com/hashicorp/terraform/blob/34956cd12449cb77db3f55e3286cd369e8332eeb/website/docs/configuration/providers.html.md#provider-plugin-cache). ([#16000](https://github.com/hashicorp/terraform/issues/16000)) - -IMPROVEMENTS: - -* config: New `abs` interpolation function, returning the absolute value of a number ([#16168](https://github.com/hashicorp/terraform/issues/16168)) -* config: New `transpose` interpolation function, which swaps the keys and values in a map of lists of strings. ([#16192](https://github.com/hashicorp/terraform/issues/16192)) -* cli: The Terraform CLI now supports tab-completion for commands and certain arguments for `bash` and `zsh` users. See [the tab-completion docs](https://github.com/hashicorp/terraform/blob/2c782e60fad78e6fc976d850162322608f074e57/website/docs/commands/index.html.markdown#shell-tab-completion) for information on how to enable it. ([#16176](https://github.com/hashicorp/terraform/issues/16176)) -* cli: `terraform state rm` now includes in its output the count of resources that were removed from the state. ([#16137](https://github.com/hashicorp/terraform/issues/16137)) - -BUG FIXES: - -* modules: Update go-getter to fix crash when fetching invalid source subdir ([#16161](https://github.com/hashicorp/terraform/issues/16161)) -* modules: Fix regression in the handling of modules sourcing other modules with relative paths ([#16160](https://github.com/hashicorp/terraform/issues/16160)) -* core: Skip local value interpolation during destroy ([#16213](https://github.com/hashicorp/terraform/issues/16213)) - -## 0.10.6 (September 19, 2017) - -UPGRADE NOTES: - -* The internal storage of modules has changed in this release, so after - upgrading `terraform init` must be run to re-install modules in the new - on-disk format. The existing installed versions of modules will be ignored, - so the latest version of each module will be installed. - -IMPROVEMENTS: - -* Modules can now be installed from [the Terraform Registry](https://registry.terraform.io/) -* cli: `terraform import` now accepts an option `-allow-missing-config` that overrides the default requirement that a configuration block must already be present for the resource being imported. ([#15876](https://github.com/hashicorp/terraform/issues/15876)) - -## 0.10.5 (September 14, 2017) - -NEW FEATURES: - -* config: `indent` interpolation function appends spaces to all but the first line of a multi-line string ([#15311](https://github.com/hashicorp/terraform/issues/15311)) - -IMPROVEMENTS: - -* cli: `terraform fmt` has a new option `-check` which makes it return a non-zero exit status if any formatting changes are required ([#15387](https://github.com/hashicorp/terraform/issues/15387)) -* cli: When [running Terraform in automation](https://www.terraform.io/guides/running-terraform-in-automation.html), a new environment variable `TF_IN_AUTOMATION` can be used to disable or adjust certain prompts that would normally include specific CLI commands to run. This assumes that the wrapping automation tool is providing its own UI for guiding the user through the workflow, and thus the standard advice would be redundant and/or confusing. ([#16059](https://github.com/hashicorp/terraform/issues/16059)) - -BUG FIXES: - -* cli: restore the "(forces new resource)" annotations on attributes that were inadvertently disabled in 0.10.4. ([#16067](https://github.com/hashicorp/terraform/issues/16067)) -* cli: fix regression with installing modules from git when the `GIT_SSH_COMMAND` environment variable is set ([#16099](https://github.com/hashicorp/terraform/issues/16099)) - -## 0.10.4 (September 6, 2017) - -IMPROVEMENTS: -* `terraform apply` now uses the standard resource address syntax to refer to resources in its log ([#15884](https://github.com/hashicorp/terraform/issues/15884)) -* `terraform plan` output has some minor adjustments to improve readability and accessibility for those who can't see its colors ([#15884](https://github.com/hashicorp/terraform/issues/15884)) - -BUG FIXES: - -* backend/consul: fix crash during consul backend initialization ([#15976](https://github.com/hashicorp/terraform/issues/15976)) -* backend/azurerm: ensure that blob storage metadata is preserved when updating state blobs, to avoid losing track of lock metadata ([#16015](https://github.com/hashicorp/terraform/issues/16015)) -* config: local values now work properly in resource `count` and in modules with more than one `.tf` file ([#15995](https://github.com/hashicorp/terraform/issues/15995)] [[#15982](https://github.com/hashicorp/terraform/issues/15982)) -* cli: removed some inconsistencies in how data sources are counted and tallied in plan vs. apply and apply vs. destroy. In particular, data sources are no longer incorrectly counted as destroyed in `terraform destroy` ([#15884](https://github.com/hashicorp/terraform/issues/15884)) - -## 0.10.3 (August 30, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* LGPL Dependencies Removed ([#15862](https://github.com/hashicorp/terraform/issues/15862)) - -NEW FEATURES: - -* **Local Values**: this new configuration language feature allows assigning a symbolic local name to an expression so it can be used multiple times in configuration without repetition. See [the documentation](https://github.com/hashicorp/terraform/blob/master/website/docs/configuration/locals.html.md) for how to define and use local values. ([#15449](https://github.com/hashicorp/terraform/issues/15449)) -* **`base64gzip` interpolation function**: compresses a string with gzip and then base64-encodes the result ([#3858](https://github.com/hashicorp/terraform/issues/3858)) -* **`flatten` interpolation function**: turns a list of lists, or list of lists of lists, etc into a flat list of primitive values ([#15278](https://github.com/hashicorp/terraform/issues/15278)) -* **`urlencode` interpolation function**: applies standard URL encoding to a string so that it can be embedded in a URL without making it invalid and without any of the characters being interpreted as part of the URL structure ([#15871](https://github.com/hashicorp/terraform/issues/15871)) -* **`salt-masterless` provisioner**: runs Salt in masterless mode on a target server ([#14720](https://github.com/hashicorp/terraform/issues/14720)) - -IMPROVEMENTS: - -* config: The `jsonencode` interpolation function now accepts nested list and map structures, where before it would accept only strings, lists of strings, and maps of strings. ([#14884](https://github.com/hashicorp/terraform/issues/14884)) -* cli: The "creation complete" (and similar) messages from `terraform apply` now include a total elapsed time for each operation. ([#15548](https://github.com/hashicorp/terraform/issues/15548)) -* cli: Module installation (with either `terraform init` or `terraform get`) now detects and recursively initializes submodules when the source is a git repository. ([#15891](https://github.com/hashicorp/terraform/issues/15891)) -* cli: Modules can now be installed from `.tar.xz` archives, in addition to the existing `.tar.gz`, `.tar.bz2` and `.zip`. ([#15891](https://github.com/hashicorp/terraform/issues/15891)) -* provisioner/local-exec: now possible to specify a custom "interpreter", overriding the default of either `bash -c` (on Unix) or `cmd.exe /C` (on Windows) ([#15166](https://github.com/hashicorp/terraform/issues/15166)) -* backend/consul: can now set the path to a specific CA certificate file, client certificate file, and client key file that will be used when configuring the underlying Consul client. ([#15405](https://github.com/hashicorp/terraform/issues/15405)) -* backend/http: now has optional support for locking, with special support from the target server. Additionally, the update operation can now optionally be implemented via `PUT` rather than `POST`. ([#15793](https://github.com/hashicorp/terraform/issues/15793)) -* helper/resource: Add `TestStep.SkipFunc` ([#15957](https://github.com/hashicorp/terraform/issues/15957)) - -BUG FIXES: - -* cli: `terraform init` now verifies the required Terraform version from the root module config. Previously this was verified only on subsequent commands, after initialization. ([#15935](https://github.com/hashicorp/terraform/issues/15935)) -* cli: `terraform validate` now consults `terraform.tfvars`, if present, to set variable values. This is now consistent with the behavior of other commands. ([#15938](https://github.com/hashicorp/terraform/issues/15938)) - -## 0.10.2 (August 16, 2017) - -BUG FIXES: - -* tools/terraform-bundle: Add missing Ui to ProviderInstaller (fix crash) ([#15826](https://github.com/hashicorp/terraform/issues/15826)) -* go-plugin: don't crash when server emits non-key-value JSON ([go-plugin#43](https://github.com/hashicorp/go-plugin/pull/43)) - -## 0.10.1 (August 15, 2017) - -BUG FIXES: - -* Fix `terraform state rm` and `mv` commands to work correctly with remote state backends ([#15652](https://github.com/hashicorp/terraform/issues/15652)) -* Fix errors when interpolations fail during input ([#15780](https://github.com/hashicorp/terraform/issues/15780)) -* Backoff retries in remote-execution provisioner ([#15772](https://github.com/hashicorp/terraform/issues/15772)) -* Load plugins from `~/.terraform.d/plugins/OS_ARCH/` and `.terraformrc` ([#15769](https://github.com/hashicorp/terraform/issues/15769)) -* The `import` command was ignoring the remote state configuration ([#15768](https://github.com/hashicorp/terraform/issues/15768)) -* Don't allow leading slashes in s3 bucket names for remote state ([#15738](https://github.com/hashicorp/terraform/issues/15738)) - -IMPROVEMENTS: - -* helper/schema: Add `GetOkExists` schema function ([#15723](https://github.com/hashicorp/terraform/issues/15723)) -* helper/schema: Make 'id' a reserved field name ([#15695](https://github.com/hashicorp/terraform/issues/15695)) -* command/init: Display version + source when initializing plugins ([#15804](https://github.com/hashicorp/terraform/issues/15804)) - -INTERNAL CHANGES: - -* DiffFieldReader.ReadField caches results to optimize deeply nested schemas ([#15663](https://github.com/hashicorp/terraform/issues/15663)) - - -## 0.10.0 (August 2, 2017) - -**This is the complete 0.9.11 to 0.10.0 CHANGELOG** - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* A new flag `-auto-approve` has been added to `terraform apply`. This flag controls whether an interactive approval is applied before - making the changes in the plan. For now this flag defaults to `true` to preserve previous behavior, but this will become the new default - in a future version. We suggest that anyone running `terraform apply` in wrapper scripts or automation refer to the upgrade guide to learn - how to prepare such wrapper scripts for the later breaking change. -* The `validate` command now checks that all variables are specified by default. The validation will fail by default if that's not the - case. ([#13872](https://github.com/hashicorp/terraform/issues/13872)) -* `terraform state rm` now requires at least one argument. Previously, calling it with no arguments would remove all resources from state, - which is consistent with the other `terraform state` commands but unlikely enough that we considered it better to be inconsistent here to - reduce the risk of accidentally destroying the state. -* Terraform providers are no longer distributed as part of the main Terraform distribution. Instead, they are installed automatically as - part of running `terraform init`. It is therefore now mandatory to run `terraform init` before any other operations that use provider - plugins, to ensure that the required plugins are installed and properly initialized. -* The `terraform env` family of commands have been renamed to `terraform workspace`, in response to feedback that the previous naming was - confusing due to collisions with other concepts of the same name. The commands still work the same as they did before, and the `env` - subcommand is still supported as an alias for backward compatibility. The `env` subcommand will be removed altogether in a future release, - so it's recommended to update any automation or wrapper scripts that use these commands. -* The `terraform init` subcommand no longer takes a SOURCE argument to copy to the current directory. The behavior has been changed to match - that of `plan` and `apply`, so that a configuration can be provided as an argument on the commandline while initializing the current - directory. If a module needs to be copied into the current directory before initialization, it will have to be done manually. -* The `-target` option available on several Terraform subcommands has changed behavior and **now matches potentially more resources**. In - particular, given an option `-target=module.foo`, resources in any descendent modules of `foo` will also be targeted, where before this - was not true. After upgrading, be sure to look carefully at the set of changes proposed by `terraform plan` when using `-target` to ensure - that the target is being interpreted as expected. Note that the `-target` argument is offered for exceptional circumstances only and is - not intended for routine use. -* The `import` command requires that imported resources be specified in the configuration file. Previously, users were encouraged to import - a resource and _then_ write the configuration block for it. This creates the risk that users could import a resource and subsequently - create no configuration for it, which results in Terraform deleting the resource. If the imported resource is not present in the - configuration file, the `import` command will fail. - -FEATURES: - -* **Separate Provider Releases:** Providers are now released independently from Terraform. -* **Automatic Provider Installation:** The required providers will be automatically installed during `terraform init`. -* **Provider Constraints:** Provider are now versioned, and version constraints may be declared in the configuration. - -PROVIDERS: - -* Providers now maintain their own CHANGELOGs in their respective repositories: [terraform-providers](https://github.com/terraform-providers) - -IMPROVEMENTS: - -* cli: Add a `-from-module` flag to `terraform init` to re-introduce the legacy `terraform init` behavior of fetching a module. ([#15666](https://github.com/hashicorp/terraform/issues/15666)) -* backend/s3: Add `workspace_key_prefix` to allow a user-configurable prefix for workspaces in the S3 Backend. ([#15370](https://github.com/hashicorp/terraform/issues/15370)) -* cli: `terraform apply` now has an option `-auto-approve=false` that produces an interactive prompt to approve the generated plan. This will become the default workflow in a future Terraform version. ([#7251](https://github.com/hashicorp/terraform/issues/7251)) -* cli: `terraform workspace show` command prints the current workspace name in a way that's more convenient for processing in wrapper scripts. ([#15157](https://github.com/hashicorp/terraform/issues/15157)) -* cli: `terraform state rm` will now generate an error if no arguments are passed, whereas before it treated it as an open resource address selecting _all_ resources ([#15283](https://github.com/hashicorp/terraform/issues/15283)) -* cli: Files in the config directory ending in `.auto.tfvars` are now loaded automatically (in lexicographical order) in addition to the single `terraform.tfvars` file that auto-loaded previously. ([#13306](https://github.com/hashicorp/terraform/issues/13306)) -* Providers no longer in the main Terraform distribution; installed automatically by init instead ([#15208](https://github.com/hashicorp/terraform/issues/15208)) -* cli: `terraform env` command renamed to `terraform workspace` ([#14952](https://github.com/hashicorp/terraform/issues/14952)) -* cli: `terraform init` command now has `-upgrade` option to download the latest versions (within specified constraints) of modules and provider plugins. -* cli: The `-target` option to various Terraform operation can now target resources in descendent modules. ([#15314](https://github.com/hashicorp/terraform/issues/15314)) -* cli: Minor updates to `terraform plan` output: use standard resource address syntax, more visually-distinct `-/+` actions, and more ([#15362](https://github.com/hashicorp/terraform/issues/15362)) -* config: New interpolation function `contains`, to find if a given string exists in a list of strings. ([#15322](https://github.com/hashicorp/terraform/issues/15322)) - -BUG FIXES: - -* provisioner/chef: fix panic ([#15617](https://github.com/hashicorp/terraform/issues/15617)) -* Don't show a message about the path to the state file if the state is remote ([#15435](https://github.com/hashicorp/terraform/issues/15435)) -* Fix crash when `terraform graph` is run with no configuration ([#15588](https://github.com/hashicorp/terraform/issues/15588)) -* Handle correctly the `.exe` suffix on locally-compiled provider plugins on Windows systems. ([#15587](https://github.com/hashicorp/terraform/issues/15587)) -* config: Fixed a parsing issue in the interpolation language HIL that was causing misinterpretation of literal strings ending with escaped backslashes ([#15415](https://github.com/hashicorp/terraform/issues/15415)) -* core: the S3 Backend was failing to remove the state file checksums from DynamoDB when deleting a workspace ([#15383](https://github.com/hashicorp/terraform/issues/15383)) -* core: Improved reslience against crashes for a certain kind of inconsistency in the representation of list values in state. ([#15390](https://github.com/hashicorp/terraform/issues/15390)) -* core: Display correct to and from backends in copy message when migrating to new remote state ([#15318](https://github.com/hashicorp/terraform/issues/15318)) -* core: Fix a regression from 0.9.6 that was causing the tally of resources to create to be double-counted sometimes in the plan output ([#15344](https://github.com/hashicorp/terraform/issues/15344)) -* cli: the state `rm` and `mv` commands were always loading a state from a Backend, and ignoring the `-state` flag ([#15388](https://github.com/hashicorp/terraform/issues/15388)) -* cli: certain prompts in `terraform init` were respecting `-input=false` but not the `TF_INPUT` environment variable ([#15391](https://github.com/hashicorp/terraform/issues/15391)) -* state: Further work, building on [#15423](https://github.com/hashicorp/terraform/issues/15423), to improve the internal design of the state managers to make this code more maintainable and reduce the risk of regressions; this may lead to slight changes to the number of times Terraform writes to remote state and how the serial is implemented with respect to those writes, which does not affect outward functionality but is worth noting if you log or inspect state updates for debugging purposes. -* config: Interpolation function `cidrhost` was not correctly calcluating host addresses under IPv6 CIDR prefixes ([#15321](https://github.com/hashicorp/terraform/issues/15321)) -* provisioner/chef: Prevent a panic while trying to read the connection info ([#15271](https://github.com/hashicorp/terraform/issues/15271)) -* provisioner/file: Refactor the provisioner validation function to prevent false positives ([#15273](https://github.com/hashicorp/terraform/issues/15273)) - -INTERNAL CHANGES: - -* helper/schema: Actively disallow reserved field names in schema ([#15522](https://github.com/hashicorp/terraform/issues/15522)) -* helper/schema: Force field names to be alphanum lowercase + underscores ([#15562](https://github.com/hashicorp/terraform/issues/15562)) - - -## 0.10.0-rc1 to 0.10.0 (August 2, 2017) - -BUG FIXES: - -* provisioner/chef: fix panic ([#15617](https://github.com/hashicorp/terraform/issues/15617)) - -IMPROVEMENTS: - -* cli: Add a `-from-module` flag to `terraform init` to re-introduce the legacy `terraform init` behavior of fetching a module. ([#15666](https://github.com/hashicorp/terraform/issues/15666)) - - -## 0.10.0-rc1 (July 19, 2017) - -BUG FIXES: - -* Don't show a message about the path to the state file if the state is remote ([#15435](https://github.com/hashicorp/terraform/issues/15435)) -* Fix crash when `terraform graph` is run with no configuration ([#15588](https://github.com/hashicorp/terraform/issues/15588)) -* Handle correctly the `.exe` suffix on locally-compiled provider plugins on Windows systems. ([#15587](https://github.com/hashicorp/terraform/issues/15587)) - -INTERNAL CHANGES: - -* helper/schema: Actively disallow reserved field names in schema ([#15522](https://github.com/hashicorp/terraform/issues/15522)) -* helper/schema: Force field names to be alphanum lowercase + underscores ([#15562](https://github.com/hashicorp/terraform/issues/15562)) - -## 0.10.0-beta2 (July 6, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* A new flag `-auto-approve` has been added to `terraform apply`. This flag controls whether an interactive approval is applied before making the changes in the plan. For now this flag defaults to `true` to preserve previous behavior, but this will become the new default in a future version. We suggest that anyone running `terraform apply` in wrapper scripts or automation refer to the upgrade guide to learn how to prepare such wrapper scripts for the later breaking change. -* The `validate` command now checks that all variables are specified by default. - The validation will fail by default if that's not the case. ([#13872](https://github.com/hashicorp/terraform/issues/13872)) -* `terraform state rm` now requires at least one argument. Previously, calling it with no arguments would remove all resources from state, which is consistent with the other `terraform state` commands but unlikely enough that we considered it better to be inconsistent here to reduce the risk of accidentally destroying the state. - -IMPROVEMENTS: - -* backend/s3: Add `workspace_key_prefix` to allow a user-configurable prefix for workspaces in the S3 Backend. ([#15370](https://github.com/hashicorp/terraform/issues/15370)) -* cli: `terraform apply` now has an option `-auto-approve=false` that produces an interactive prompt to approve the generated plan. This will become the default workflow in a future Terraform version. ([#7251](https://github.com/hashicorp/terraform/issues/7251)) -* cli: `terraform workspace show` command prints the current workspace name in a way that's more convenient for processing in wrapper scripts. ([#15157](https://github.com/hashicorp/terraform/issues/15157)) -* cli: `terraform state rm` will now generate an error if no arguments are passed, whereas before it treated it as an open resource address selecting _all_ resources ([#15283](https://github.com/hashicorp/terraform/issues/15283)) -* cli: Files in the config directory ending in `.auto.tfvars` are now loaded automatically (in lexicographical order) in addition to the single `terraform.tfvars` file that auto-loaded previously. ([#13306](https://github.com/hashicorp/terraform/issues/13306)) - -BUG FIXES: - -* config: Fixed a parsing issue in the interpolation language HIL that was causing misinterpretation of literal strings ending with escaped backslashes ([#15415](https://github.com/hashicorp/terraform/issues/15415)) -* core: the S3 Backend was failing to remove the state file checksums from DynamoDB when deleting a workspace ([#15383](https://github.com/hashicorp/terraform/issues/15383)) -* core: Improved reslience against crashes for a certain kind of inconsistency in the representation of list values in state. ([#15390](https://github.com/hashicorp/terraform/issues/15390)) -* core: Display correct to and from backends in copy message when migrating to new remote state ([#15318](https://github.com/hashicorp/terraform/issues/15318)) -* core: Fix a regression from 0.9.6 that was causing the tally of resources to create to be double-counted sometimes in the plan output ([#15344](https://github.com/hashicorp/terraform/issues/15344)) -* cli: the state `rm` and `mv` commands were always loading a state from a Backend, and ignoring the `-state` flag ([#15388](https://github.com/hashicorp/terraform/issues/15388)) -* cli: certain prompts in `terraform init` were respecting `-input=false` but not the `TF_INPUT` environment variable ([#15391](https://github.com/hashicorp/terraform/issues/15391)) -* state: Further work, building on [#15423](https://github.com/hashicorp/terraform/issues/15423), to improve the internal design of the state managers to make this code more maintainable and reduce the risk of regressions; this may lead to slight changes to the number of times Terraform writes to remote state and how the serial is implemented with respect to those writes, which does not affect outward functionality but is worth noting if you log or inspect state updates for debugging purposes. - -## 0.10.0-beta1 (June 22, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* Terraform providers are no longer distributed as part of the main Terraform distribution. Instead, they are installed automatically - as part of running `terraform init`. It is therefore now mandatory to run `terraform init` before any other operations that use - provider plugins, to ensure that the required plugins are installed and properly initialized. -* The `terraform env` family of commands have been renamed to `terraform workspace`, in response to feedback that the previous naming - was confusing due to collisions with other concepts of the same name. The commands still work the same as they did before, and - the `env` subcommand is still supported as an alias for backward compatibility. The `env` subcommand will be removed altogether in - a future release, so it's recommended to update any automation or wrapper scripts that use these commands. -* The `terraform init` subcommand no longer takes a SOURCE argument to copy to the current directory. The behavior has - been changed to match that of `plan` and `apply`, so that a configuration can be provided as an argument on the - commandline while initializing the current directory. If a module needs to be copied into the current directory before - initialization, it will have to be done manually. -* The `-target` option available on several Terraform subcommands has changed behavior and **now matches potentially more resources**. - In particular, given an option `-target=module.foo`, resources in any descendent modules of `foo` will also be targeted, where before - this was not true. After upgrading, be sure to look carefully at the set of changes proposed by `terraform plan` when using `-target` - to ensure that the target is being interpreted as expected. Note that the `-target` argument is offered for exceptional circumstances - only and is not intended for routine use. -* The `import` command requires that imported resources be specified in the configuration file. Previously, users were encouraged to - import a resource and _then_ write the configuration block for it. This creates the risk that users could import a resource and - subsequently create no configuration for it, which results in Terraform deleting the resource. If the imported resource is not - present in the configuration file, the `import` command will fail. - -IMPROVEMENTS: - -* Providers no longer in the main Terraform distribution; installed automatically by init instead ([#15208](https://github.com/hashicorp/terraform/issues/15208)) -* cli: `terraform env` command renamed to `terraform workspace` ([#14952](https://github.com/hashicorp/terraform/issues/14952)) -* cli: `terraform init` command now has `-upgrade` option to download the latest versions (within specified constraints) of modules and provider plugins. -* cli: The `-target` option to various Terraform operation can now target resources in descendent modules. ([#15314](https://github.com/hashicorp/terraform/issues/15314)) -* cli: Minor updates to `terraform plan` output: use standard resource address syntax, more visually-distinct `-/+` actions, and more ([#15362](https://github.com/hashicorp/terraform/issues/15362)) -* config: New interpolation function `contains`, to find if a given string exists in a list of strings. ([#15322](https://github.com/hashicorp/terraform/issues/15322)) - -BUG FIXES: - -* config: Interpolation function `cidrhost` was not correctly calcluating host addresses under IPv6 CIDR prefixes ([#15321](https://github.com/hashicorp/terraform/issues/15321)) -* provisioner/chef: Prevent a panic while trying to read the connection info ([#15271](https://github.com/hashicorp/terraform/issues/15271)) -* provisioner/file: Refactor the provisioner validation function to prevent false positives ([#15273](https://github.com/hashicorp/terraform/issues/15273)) - -## 0.9.11 (Jul 3, 2017) - -BUG FIXES: - -* core: Hotfix for issue where a state from a plan was reported as not equal to the same state stored to a backend. This arose from the fix for the previous issue where the incorrect copy of the state was being used when applying with a plan. ([#15460](https://github.com/hashicorp/terraform/issues/15460)) - - -## 0.9.10 (June 29, 2017) - -BUG FIXES: - -* core: Hotfix for issue where state index wasn't getting properly incremented when applying a change containing only data source updates and/or resource drift. (That is, state changes made during refresh.) - This issue is significant only for the "atlas" backend, since that backend verifies on the server that state serial numbers are being used consistently. ([#15423](https://github.com/hashicorp/terraform/issues/15423)) - -## 0.9.9 (June 26, 2017) - -BUG FIXES: - - * provisioner/file: Refactor the provisioner validation function to prevent false positives ([#15273](https://github.com/hashicorp/terraform/issues/15273))) - * provisioner/chef: Prevent a panic while trying to read the connection info ([#15271](https://github.com/hashicorp/terraform/issues/15271))) - -## 0.9.8 (June 7, 2017) - -NOTE: - -* The 0.9.7 release had a bug with its new feature of periodically persisting state to the backend during an apply, as part of [[#14834](https://github.com/hashicorp/terraform/issues/14834)]. This change has been reverted in this release and will be re-introduced at a later time once it has been made to work properly. - -IMPROVEMENTS: - -* provider/google: `network` argument in `google_compute_instance_group` is now optional ([#13493](https://github.com/hashicorp/terraform/issues/13493)) -* provider/google: Add support for `draining_timeout_sec` to `google_compute_backend_service`. ([#14559](https://github.com/hashicorp/terraform/issues/14559)) - -BUG FIXES: - -* provider/aws: fixed reading network configurations for `spot_fleet_request` ([#13748](https://github.com/hashicorp/terraform/issues/13748)) - -## 0.9.7 (June 7, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* The `lock_table` attribute in the S3 backend configuration has been deprecated in favor of `dynamodb_table`, which better reflects that the table is no longer only used for locks. ([#14949](https://github.com/hashicorp/terraform/issues/14949)) - -FEATURES: - - * **New Data Source:** `aws_elastic_beanstalk_solution_stack` ([#14944](https://github.com/hashicorp/terraform/issues/14944)) - * **New Data Source:** `aws_elasticache_cluster` ([#14895](https://github.com/hashicorp/terraform/issues/14895)) - * **New Data Source:** `aws_ssm_parameter` ([#15035](https://github.com/hashicorp/terraform/issues/15035)) - * **New Data Source:** `azurerm_public_ip` ([#15110](https://github.com/hashicorp/terraform/issues/15110)) - * **New Resource:** `aws_ssm_parameter` ([#15035](https://github.com/hashicorp/terraform/issues/15035)) - * **New Resource:** `aws_ssm_patch_baseline` ([#14954](https://github.com/hashicorp/terraform/issues/14954)) - * **New Resource:** `aws_ssm_patch_group` ([#14954](https://github.com/hashicorp/terraform/issues/14954)) - * **New Resource:** `librato_metric` ([#14562](https://github.com/hashicorp/terraform/issues/14562)) - * **New Resource:** `digitalocean_certificate` ([#14578](https://github.com/hashicorp/terraform/issues/14578)) - * **New Resource:** `vcd_edgegateway_vpn` ([#13123](https://github.com/hashicorp/terraform/issues/13123)) - * **New Resource:** `vault_mount` ([#14456](https://github.com/hashicorp/terraform/issues/14456)) - * **New Interpolation Function:** `bcrypt` ([#14725](https://github.com/hashicorp/terraform/issues/14725)) - -IMPROVEMENTS: - -* backend/consul: Storing state to Consul now uses Check-And-Set (CAS) by default to avoid inconsistent state, and will automatically attempt to re-acquire a lock if it is lost during Terraform execution. ([#14930](https://github.com/hashicorp/terraform/issues/14930)) -* core: Remote state is now persisted more frequently to minimize data loss in the event of a crash. ([#14834](https://github.com/hashicorp/terraform/issues/14834)) -* provider/alicloud: Add the function of replacing ecs instance's system disk ([#15048](https://github.com/hashicorp/terraform/issues/15048)) -* provider/aws: Expose RDS instance and cluster resource id ([#14882](https://github.com/hashicorp/terraform/issues/14882)) -* provider/aws: Export internal tunnel addresses + document ([#14835](https://github.com/hashicorp/terraform/issues/14835)) -* provider/aws: Fix misleading error in aws_route validation ([#14972](https://github.com/hashicorp/terraform/issues/14972)) -* provider/aws: Support import of aws_lambda_event_source_mapping ([#14898](https://github.com/hashicorp/terraform/issues/14898)) -* provider/aws: Add support for a configurable timeout in db_option_group ([#15023](https://github.com/hashicorp/terraform/issues/15023)) -* provider/aws: Add task_parameters parameter to aws_ssm_maintenance_window_task resource ([#15104](https://github.com/hashicorp/terraform/issues/15104)) -* provider/aws: Expose reason of EMR cluster termination ([#15117](https://github.com/hashicorp/terraform/issues/15117)) -* provider/aws: `data.aws_acm_certificate` can now filter by `type` ([#15063](https://github.com/hashicorp/terraform/issues/15063)) -* provider/azurerm: Ignore case sensivity in Azurerm resource enums ([#14861](https://github.com/hashicorp/terraform/issues/14861)) -* provider/digitalocean: Add support for changing TTL on DigitalOcean domain records. ([#14805](https://github.com/hashicorp/terraform/issues/14805)) -* provider/google: Add ability to import Google Compute persistent disks ([#14573](https://github.com/hashicorp/terraform/issues/14573)) -* provider/google: `google_container_cluster.master_auth` should be optional ([#14630](https://github.com/hashicorp/terraform/issues/14630)) -* provider/google: Add CORS support for `google_storage_bucket` ([#14695](https://github.com/hashicorp/terraform/issues/14695)) -* provider/google: Allow resizing of Google Cloud persistent disks ([#15077](https://github.com/hashicorp/terraform/issues/15077)) -* provider/google: Add private_ip_google_access update support to google_compute_subnetwork ([#15125](https://github.com/hashicorp/terraform/issues/15125)) -* provider/heroku: can now import Heroku Spaces ([#14973](https://github.com/hashicorp/terraform/issues/14973)) -* provider/kubernetes: Upgrade K8S from 1.5.3 to 1.6.1 ([#14923](https://github.com/hashicorp/terraform/issues/14923)) -* provider/kubernetes: Provide more details about why PVC failed to bind ([#15019](https://github.com/hashicorp/terraform/issues/15019)) -* provider/kubernetes: Allow sourcing config_path from `KUBECONFIG` env var ([#14889](https://github.com/hashicorp/terraform/issues/14889)) -* provider/openstack: Add support provider networks ([#10265](https://github.com/hashicorp/terraform/issues/10265)) -* provider/openstack: Allow numerical protocols in security group rules ([#14917](https://github.com/hashicorp/terraform/issues/14917)) -* provider/openstack: Sort request/response headers in debug output ([#14956](https://github.com/hashicorp/terraform/issues/14956)) -* provider/openstack: Add support for FWaaS routerinsertion extension ([#12589](https://github.com/hashicorp/terraform/issues/12589)) -* provider/openstack: Add Terraform version to UserAgent string ([#14955](https://github.com/hashicorp/terraform/issues/14955)) -* provider/openstack: Optimize the printing of debug output ([#15086](https://github.com/hashicorp/terraform/issues/15086)) -* provisioner/chef: Use `helpers.shema.Provisoner` in Chef provisioner V2 ([#14681](https://github.com/hashicorp/terraform/issues/14681)) - -BUG FIXES: - -* provider/alicloud: set `alicloud_nat_gateway` zone to be Computed to avoid perpetual diffs ([#15050](https://github.com/hashicorp/terraform/issues/15050)) -* provider/alicloud: set provider to read env vars for access key and secrey key if empty strings ([#15050](https://github.com/hashicorp/terraform/issues/15050)) -* provider/alicloud: Fix vpc and vswitch bugs while creating vpc and vswitch ([#15082](https://github.com/hashicorp/terraform/issues/15082)) -* provider/alicloud: Fix allocating public ip bug ([#15049](https://github.com/hashicorp/terraform/issues/15049)) -* provider/alicloud: Fix security group rules nic_type bug ([#15114](https://github.com/hashicorp/terraform/issues/15114)) -* provider/aws: ForceNew aws_launch_config on ebs_block_device change ([#14899](https://github.com/hashicorp/terraform/issues/14899)) -* provider/aws: Avoid crash when EgressOnly IGW disappears ([#14929](https://github.com/hashicorp/terraform/issues/14929)) -* provider/aws: Allow IPv6/IPv4 addresses to coexist ([#13702](https://github.com/hashicorp/terraform/issues/13702)) -* provider/aws: Expect exception on deletion of APIG Usage Plan Key ([#14958](https://github.com/hashicorp/terraform/issues/14958)) -* provider/aws: Fix panic on nil dead_letter_config ([#14964](https://github.com/hashicorp/terraform/issues/14964)) -* provider/aws: Work around IAM eventual consistency in CW Log Subs ([#14959](https://github.com/hashicorp/terraform/issues/14959)) -* provider/aws: Fix ModifyInstanceAttribute on new instances ([#14992](https://github.com/hashicorp/terraform/issues/14992)) -* provider/aws: Fix issue with removing tags in aws_cloudwatch_log_group ([#14886](https://github.com/hashicorp/terraform/issues/14886)) -* provider/aws: Raise timeout for VPC DHCP options creation to 5 mins ([#15084](https://github.com/hashicorp/terraform/issues/15084)) -* provider/aws: Retry Redshift cluster deletion on InvalidClusterState ([#15068](https://github.com/hashicorp/terraform/issues/15068)) -* provider/aws: Retry Lambda func creation on IAM error ([#15067](https://github.com/hashicorp/terraform/issues/15067)) -* provider/aws: Retry ECS service creation on ClusterNotFoundException ([#15066](https://github.com/hashicorp/terraform/issues/15066)) -* provider/aws: Retry ECS service update on ServiceNotFoundException ([#15073](https://github.com/hashicorp/terraform/issues/15073)) -* provider/aws: Retry DB parameter group delete on InvalidDBParameterGroupState ([#15071](https://github.com/hashicorp/terraform/issues/15071)) -* provider/aws: Guard against panic when no aws_default_vpc found ([#15070](https://github.com/hashicorp/terraform/issues/15070)) -* provider/aws: Guard against panic if no NodeGroupMembers returned in `elasticache_replication_group` ([#13488](https://github.com/hashicorp/terraform/issues/13488)) -* provider/aws: Revoke default ipv6 egress rule for aws_security_group ([#15075](https://github.com/hashicorp/terraform/issues/15075)) -* provider/aws: Lambda ENI deletion fails on destroy ([#11849](https://github.com/hashicorp/terraform/issues/11849)) -* provider/aws: Add gov and cn hosted zone Ids to aws_elb_hosted_zone data source ([#15149](https://github.com/hashicorp/terraform/issues/15149)) -* provider/azurerm: VM - making `os_profile` optional ([#14176](https://github.com/hashicorp/terraform/issues/14176)) -* provider/azurerm: Preserve the Subnet properties on Update ([#13877](https://github.com/hashicorp/terraform/issues/13877)) -* provider/datadog: make datadog_user verified a computed attribute ([#15034](https://github.com/hashicorp/terraform/issues/15034)) -* provider/datadog: use correct evaluation_delay parameter ([#14878](https://github.com/hashicorp/terraform/issues/14878)) -* provider/digitalocean: Refresh DO loadbalancer from state if 404 ([#14897](https://github.com/hashicorp/terraform/issues/14897)) -* provider/github: Do not set incorrect values in github_team data source ([#14859](https://github.com/hashicorp/terraform/issues/14859)) -* provider/google: use a mutex to prevent concurrent sql instance operations ([#14424](https://github.com/hashicorp/terraform/issues/14424)) -* provider/google: Set instances to computed in compute_instance_group ([#15025](https://github.com/hashicorp/terraform/issues/15025)) -* provider/google: Make google_compute_autoscaler use Update instead of Patch. ([#15101](https://github.com/hashicorp/terraform/issues/15101)) -* provider/kubernetes: Ignore internal k8s labels in `kubernetes_persistent_volume` ([#13716](https://github.com/hashicorp/terraform/issues/13716)) -* provider/librato: Add retry to librato_alert ([#15118](https://github.com/hashicorp/terraform/issues/15118)) -* provider/postgresql: Fix for leaking credentials in the provider ([#14817](https://github.com/hashicorp/terraform/issues/14817)) -* provider/postgresql: Drop the optional WITH token from CREATE ROLE. ([#14864](https://github.com/hashicorp/terraform/issues/14864)) -* provider/rancher: refresh rancher_host from state on nil or removed host ([#15015](https://github.com/hashicorp/terraform/issues/15015)) - -## 0.9.6 (May 25, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* When assigning a "splat variable" to a resource attribute, like `foo = "${some_resource.foo.*.baz}"`, it is no longer required (nor recommended) to wrap the string in list brackets. The extra brackets continue to be allowed for resource attributes for compatibility, but this will cease to be allowed in a future version. ([#14737](https://github.com/hashicorp/terraform/issues/14737)) -* provider/aws: Allow lightsail resources to work in other regions. Previously Terraform would automatically configure lightsail resources to run solely in `us-east-1`. This means that if a provider was initialized with a different region than `us-east-1`, users will need to create a provider alias to maintain their lightsail resources in us-east-1 [[#14685](https://github.com/hashicorp/terraform/issues/14685)]. -* provider/aws: Users of `aws_cloudfront_distribution` `default_cache_behavior` will notice that cookies is now a required value - even if that value is none ([#12628](https://github.com/hashicorp/terraform/issues/12628)) -* provider/google: Users of `google_compute_health_check` who were not setting a value for the `host` property of `http_health_check` or `https_health_check` previously had a faulty default value. This has been fixed and will show as a change in terraform plan/apply. ([#14441](https://github.com/hashicorp/terraform/issues/14441)) - -FEATURES: - -* **New Provider:** `ovh` ([#12669](https://github.com/hashicorp/terraform/issues/12669)) -* **New Resource:** `aws_default_subnet` ([#14476](https://github.com/hashicorp/terraform/issues/14476)) -* **New Resource:** `aws_default_vpc` ([#11710](https://github.com/hashicorp/terraform/issues/11710)) -* **New Resource:** `aws_default_vpc_dhcp_options` ([#14475](https://github.com/hashicorp/terraform/issues/14475)) -* **New Resource:** `aws_devicefarm_project` ([#14288](https://github.com/hashicorp/terraform/issues/14288)) -* **New Resource:** `aws_wafregional_ipset` ([#13705](https://github.com/hashicorp/terraform/issues/13705)) -* **New Resource:** `aws_wafregional_byte_match_set` ([#13705](https://github.com/hashicorp/terraform/issues/13705)) -* **New Resource:** `azurerm_express_route_circuit` ([#14265](https://github.com/hashicorp/terraform/issues/14265)) -* **New Resource:** `gitlab_deploy_key` ([#14734](https://github.com/hashicorp/terraform/issues/14734)) -* **New Resource:** `gitlab_group` ([#14490](https://github.com/hashicorp/terraform/issues/14490)) -* **New Resource:** `google_compute_router` ([#12411](https://github.com/hashicorp/terraform/issues/12411)) -* **New Resource:** `google_compute_router_interface` ([#12411](https://github.com/hashicorp/terraform/issues/12411)) -* **New Resource:** `google_compute_router_peer` ([#12411](https://github.com/hashicorp/terraform/issues/12411)) -* **New Resource:** `kubernetes_horizontal_pod_autoscaler` ([#14763](https://github.com/hashicorp/terraform/issues/14763)) -* **New Resource:** `kubernetes_service` ([#14554](https://github.com/hashicorp/terraform/issues/14554)) -* **New Resource:** `openstack_dns_zone_v2` ([#14721](https://github.com/hashicorp/terraform/issues/14721)) -* **New Resource:** `openstack_dns_recordset_v2` ([#14813](https://github.com/hashicorp/terraform/issues/14813)) -* **New Data Source:** `aws_db_snapshot` ([#10291](https://github.com/hashicorp/terraform/issues/10291)) -* **New Data Source:** `aws_kms_ciphertext` ([#14691](https://github.com/hashicorp/terraform/issues/14691)) -* **New Data Source:** `github_user` ([#14570](https://github.com/hashicorp/terraform/issues/14570)) -* **New Data Source:** `github_team` ([#14614](https://github.com/hashicorp/terraform/issues/14614)) -* **New Data Source:** `google_storage_object_signed_url` ([#14643](https://github.com/hashicorp/terraform/issues/14643)) -* **New Interpolation Function:** `pow` ([#14598](https://github.com/hashicorp/terraform/issues/14598)) - -IMPROVEMENTS: - -* core: After `apply`, if the state cannot be persisted to remote for some reason then write out a local state file for recovery ([#14423](https://github.com/hashicorp/terraform/issues/14423)) -* core: It's no longer required to surround an attribute value that is just a "splat" variable with a redundant set of array brackets. ([#14737](https://github.com/hashicorp/terraform/issues/14737)) -* core/provider-split: Split out the Oracle OPC provider to new structure ([#14362](https://github.com/hashicorp/terraform/issues/14362)) -* provider/aws: Show state reason when EC2 instance fails to launch ([#14479](https://github.com/hashicorp/terraform/issues/14479)) -* provider/aws: Show last scaling activity when ASG creation/update fails ([#14480](https://github.com/hashicorp/terraform/issues/14480)) -* provider/aws: Add `tags` (list of maps) for `aws_autoscaling_group` ([#13574](https://github.com/hashicorp/terraform/issues/13574)) -* provider/aws: Support filtering in ASG data source ([#14501](https://github.com/hashicorp/terraform/issues/14501)) -* provider/aws: Add ability to 'terraform import' aws_kms_alias resources ([#14679](https://github.com/hashicorp/terraform/issues/14679)) -* provider/aws: Allow lightsail resources to work in other regions ([#14685](https://github.com/hashicorp/terraform/issues/14685)) -* provider/aws: Configurable timeouts for EC2 instance + spot instance ([#14711](https://github.com/hashicorp/terraform/issues/14711)) -* provider/aws: Add ability to define timeouts for DMS replication instance ([#14729](https://github.com/hashicorp/terraform/issues/14729)) -* provider/aws: Add support for X-Ray tracing to aws_lambda_function ([#14728](https://github.com/hashicorp/terraform/issues/14728)) -* provider/azurerm: Virtual Machine Scale Sets with managed disk support ([#13717](https://github.com/hashicorp/terraform/issues/13717)) -* provider/azurerm: Virtual Machine Scale Sets with single placement option support ([#14510](https://github.com/hashicorp/terraform/issues/14510)) -* provider/azurerm: Adding support for VMSS Data Disks using Managed Disk feature ([#14608](https://github.com/hashicorp/terraform/issues/14608)) -* provider/azurerm: Adding support for 4TB disks ([#14688](https://github.com/hashicorp/terraform/issues/14688)) -* provider/cloudstack: Load the provider configuration from a CloudMonkey config file ([#13926](https://github.com/hashicorp/terraform/issues/13926)) -* provider/datadog: Add last aggregator to datadog_timeboard resource ([#14391](https://github.com/hashicorp/terraform/issues/14391)) -* provider/datadog: Added new evaluation_delay parameter ([#14433](https://github.com/hashicorp/terraform/issues/14433)) -* provider/docker: Allow Windows Docker containers to map volumes ([#13584](https://github.com/hashicorp/terraform/issues/13584)) -* provider/docker: Add `network_alias` to `docker_container` resource ([#14710](https://github.com/hashicorp/terraform/issues/14710)) -* provider/fastly: Mark the `s3_access_key`, `s3_secret_key`, & `secret_key` fields as sensitive ([#14634](https://github.com/hashicorp/terraform/issues/14634)) -* provider/gitlab: Add namespcace ID attribute to `gitlab_project` ([#14483](https://github.com/hashicorp/terraform/issues/14483)) -* provider/google: Add a `url` attribute to `google_storage_bucket` ([#14393](https://github.com/hashicorp/terraform/issues/14393)) -* provider/google: Make google resource storage bucket importable ([#14455](https://github.com/hashicorp/terraform/issues/14455)) -* provider/google: Add support for privateIpGoogleAccess on subnetworks ([#14234](https://github.com/hashicorp/terraform/issues/14234)) -* provider/google: Add import support to `google_sql_user` ([#14457](https://github.com/hashicorp/terraform/issues/14457)) -* provider/google: add failover parameter to `google_sql_database_instance` ([#14336](https://github.com/hashicorp/terraform/issues/14336)) -* provider/google: resource_compute_disks can now reference snapshots using the snapshot URL ([#14774](https://github.com/hashicorp/terraform/issues/14774)) -* provider/heroku: Add import support for `heroku_pipeline` resource ([#14486](https://github.com/hashicorp/terraform/issues/14486)) -* provider/heroku: Add import support for `heroku_pipeline_coupling` resource ([#14495](https://github.com/hashicorp/terraform/issues/14495)) -* provider/heroku: Add import support for `heroku_addon` resource ([#14508](https://github.com/hashicorp/terraform/issues/14508)) -* provider/openstack: Add support for all protocols in Security Group Rules ([#14307](https://github.com/hashicorp/terraform/issues/14307)) -* provider/openstack: Add support for updating Subnet Allocation Pools ([#14782](https://github.com/hashicorp/terraform/issues/14782)) -* provider/openstack: Enable Security Group Updates ([#14815](https://github.com/hashicorp/terraform/issues/14815)) -* provider/rancher: Add member support to `rancher_environment` ([#14563](https://github.com/hashicorp/terraform/issues/14563)) -* provider/rundeck: adds `description` to `command` schema in `rundeck_job` resource ([#14352](https://github.com/hashicorp/terraform/issues/14352)) -* provider/scaleway: allow public_ip to be set on server resource ([#14515](https://github.com/hashicorp/terraform/issues/14515)) -* provider/vsphere: Exposing moid value from vm resource ([#14793](https://github.com/hashicorp/terraform/issues/14793)) - -BUG FIXES: - -* core: Store and verify checksums for S3 remote state to prevent fetching a stale state ([#14746](https://github.com/hashicorp/terraform/issues/14746)) -* core: Allow -force-unlock of an S3 named state ([#14680](https://github.com/hashicorp/terraform/issues/14680)) -* core: Fix incorrect errors when validatin nested objects ([#14784](https://github.com/hashicorp/terraform/issues/14784)] [[#14801](https://github.com/hashicorp/terraform/issues/14801)) -* core: When using `-target`, any outputs that include attributes of the targeted resources are now updated ([#14186](https://github.com/hashicorp/terraform/issues/14186)) -* core: Fixed 0.9.5 regression with the conditional operator `.. ? .. : ..` failing to type check with unknown/computed values ([#14454](https://github.com/hashicorp/terraform/issues/14454)) -* core: Fixed 0.9 regression causing issues during refresh when adding new data resource instances using `count` ([#14098](https://github.com/hashicorp/terraform/issues/14098)) -* core: Fixed crasher when populating a "splat variable" from an empty (nil) module state. ([#14526](https://github.com/hashicorp/terraform/issues/14526)) -* core: fix bad Sprintf in backend migration message ([#14601](https://github.com/hashicorp/terraform/issues/14601)) -* core: Addressed 0.9.5 issue with passing partially-unknown splat results through module variables, by removing the requirement to pass a redundant list level. ([#14737](https://github.com/hashicorp/terraform/issues/14737)) -* provider/aws: Allow updating constraints in WAF SizeConstraintSet + no constraints ([#14661](https://github.com/hashicorp/terraform/issues/14661)) -* provider/aws: Allow updating tuples in WAF ByteMatchSet + no tuples ([#14071](https://github.com/hashicorp/terraform/issues/14071)) -* provider/aws: Allow updating tuples in WAF SQLInjectionMatchSet + no tuples ([#14667](https://github.com/hashicorp/terraform/issues/14667)) -* provider/aws: Allow updating tuples in WAF XssMatchSet + no tuples ([#14671](https://github.com/hashicorp/terraform/issues/14671)) -* provider/aws: Increase EIP update timeout ([#14381](https://github.com/hashicorp/terraform/issues/14381)) -* provider/aws: Increase timeout for creating security group ([#14380](https://github.com/hashicorp/terraform/issues/14380)] [[#14724](https://github.com/hashicorp/terraform/issues/14724)) -* provider/aws: Increase timeout for (dis)associating IPv6 addr to/from subnet ([#14401](https://github.com/hashicorp/terraform/issues/14401)) -* provider/aws: Increase timeout for retrying creation of IAM server cert ([#14609](https://github.com/hashicorp/terraform/issues/14609)) -* provider/aws: Increase timeout for deleting IGW ([#14705](https://github.com/hashicorp/terraform/issues/14705)) -* provider/aws: Increase timeout for retrying creation of CW log subs ([#14722](https://github.com/hashicorp/terraform/issues/14722)) -* provider/aws: Using the new time schema helper for RDS Instance lifecycle mgmt ([#14369](https://github.com/hashicorp/terraform/issues/14369)) -* provider/aws: Using the timeout schema helper to make alb timeout cofigurable ([#14375](https://github.com/hashicorp/terraform/issues/14375)) -* provider/aws: Refresh from state when CodePipeline Not Found ([#14431](https://github.com/hashicorp/terraform/issues/14431)) -* provider/aws: Override spot_instance_requests volume_tags schema ([#14481](https://github.com/hashicorp/terraform/issues/14481)) -* provider/aws: Allow Internet Gateway IPv6 routes ([#14484](https://github.com/hashicorp/terraform/issues/14484)) -* provider/aws: ForceNew aws_launch_config when root_block_device changes ([#14507](https://github.com/hashicorp/terraform/issues/14507)) -* provider/aws: Pass IAM Roles to codepipeline actions ([#14263](https://github.com/hashicorp/terraform/issues/14263)) -* provider/aws: Create rule(s) for prefix-list-only AWS security group permissions on 'terraform import' ([#14528](https://github.com/hashicorp/terraform/issues/14528)) -* provider/aws: Set aws_subnet ipv6_cidr_block to computed ([#14542](https://github.com/hashicorp/terraform/issues/14542)) -* provider/aws: Change of aws_subnet ipv6 causing update failure ([#14545](https://github.com/hashicorp/terraform/issues/14545)) -* provider/aws: Nothing to update in cloudformation should not result in errors ([#14463](https://github.com/hashicorp/terraform/issues/14463)) -* provider/aws: Handling data migration in RDS snapshot restoring ([#14622](https://github.com/hashicorp/terraform/issues/14622)) -* provider/aws: Mark cookies in `default_cache_behaviour` of cloudfront_distribution as required ([#12628](https://github.com/hashicorp/terraform/issues/12628)) -* provider/aws: Fall back to old tagging mechanism for AWS gov and aws China ([#14627](https://github.com/hashicorp/terraform/issues/14627)) -* provider/aws: Change AWS ssm_maintenance_window Read func ([#14665](https://github.com/hashicorp/terraform/issues/14665)) -* provider/aws: Increase timeout for creation of route_table ([#14701](https://github.com/hashicorp/terraform/issues/14701)) -* provider/aws: Retry ElastiCache cluster deletion when it's snapshotting ([#14700](https://github.com/hashicorp/terraform/issues/14700)) -* provider/aws: Retry ECS service update on InvalidParameterException ([#14708](https://github.com/hashicorp/terraform/issues/14708)) -* provider/aws: Retry IAM Role deletion on DeleteConflict ([#14707](https://github.com/hashicorp/terraform/issues/14707)) -* provider/aws: Do not dereference source_Dest_check in aws_instance ([#14723](https://github.com/hashicorp/terraform/issues/14723)) -* provider/aws: Add validation function for IAM Policies ([#14669](https://github.com/hashicorp/terraform/issues/14669)) -* provider/aws: Fix panic on instance shutdown ([#14727](https://github.com/hashicorp/terraform/issues/14727)) -* provider/aws: Handle migration when restoring db cluster from snapshot ([#14766](https://github.com/hashicorp/terraform/issues/14766)) -* provider/aws: Provider ability to enable snapshotting on ElastiCache RG ([#14757](https://github.com/hashicorp/terraform/issues/14757)) -* provider/cloudstack: `cloudstack_firewall` panicked when used with older (< v4.6) CloudStack versions ([#14044](https://github.com/hashicorp/terraform/issues/14044)) -* provider/datadog: Allowed method on aggregator is `avg` ! `average` ([#14414](https://github.com/hashicorp/terraform/issues/14414)) -* provider/digitalocean: Fix parsing of digitalocean dns records ([#14215](https://github.com/hashicorp/terraform/issues/14215)) -* provider/github: Log HTTP requests and responses in DEBUG mode ([#14363](https://github.com/hashicorp/terraform/issues/14363)) -* provider/github Check for potentially nil response from GitHub API client ([#14683](https://github.com/hashicorp/terraform/issues/14683)) -* provider/google: Fix health check http/https defaults ([#14441](https://github.com/hashicorp/terraform/issues/14441)) -* provider/google: Fix issue with GCP Cloud SQL Instance `disk_autoresize` ([#14582](https://github.com/hashicorp/terraform/issues/14582)) -* provider/google: Fix crash creating Google Cloud SQL 2nd Generation replication instance ([#14373](https://github.com/hashicorp/terraform/issues/14373)) -* provider/google: Disks now detach before getting deleted ([#14651](https://github.com/hashicorp/terraform/issues/14651)) -* provider/google: Update `google_compute_target_pool`'s session_affinity default ([#14807](https://github.com/hashicorp/terraform/issues/14807)) -* provider/heroku: Fix issue with setting correct CName in heroku_domain ([#14443](https://github.com/hashicorp/terraform/issues/14443)) -* provider/opc: Correctly export `ip_address` in IP Addr Reservation ([#14543](https://github.com/hashicorp/terraform/issues/14543)) -* provider/openstack: Handle Deleted Resources in Floating IP Association ([#14533](https://github.com/hashicorp/terraform/issues/14533)) -* provider/openstack: Catch error during instance network parsing ([#14704](https://github.com/hashicorp/terraform/issues/14704)) -* provider/vault: Prevent panic when no secret found ([#14435](https://github.com/hashicorp/terraform/issues/14435)) - -## 0.9.5 (May 11, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - -* provider/aws: Users of aws_cloudfront_distributions with custom_origins have been broken due to changes in the AWS API requiring `OriginReadTimeout` being set for updates. This has been fixed and will show as a change in terraform plan / apply. ([#13367](https://github.com/hashicorp/terraform/issues/13367)) -* provider/aws: Users of China and Gov clouds, cannot use the new tagging of volumes created as part of aws_instances ([#14055](https://github.com/hashicorp/terraform/issues/14055)) -* provider/aws: Skip tag operations on cloudwatch logs in govcloud partition. Currently not supported by Amazon. ([#12414](https://github.com/hashicorp/terraform/issues/12414)) -* provider/aws: More consistent (un)quoting of long TXT/SPF `aws_route53_record`s. - Previously we were trimming first 2 quotes and now we're (correctly) trimming first and last one. - Depending on the use of quotes in your TXT/SPF records this may result in extra diff in plan/apply ([#14170](https://github.com/hashicorp/terraform/issues/14170)) - -FEATURES: - -* **New Provider:** `gitlab` ([#13898](https://github.com/hashicorp/terraform/issues/13898)) -* **New Resource:** `aws_emr_security_configuration` ([#14080](https://github.com/hashicorp/terraform/issues/14080)) -* **New Resource:** `aws_ssm_maintenance_window` ([#14087](https://github.com/hashicorp/terraform/issues/14087)) -* **New Resource:** `aws_ssm_maintenance_window_target` ([#14087](https://github.com/hashicorp/terraform/issues/14087)) -* **New Resource:** `aws_ssm_maintenance_window_task` ([#14087](https://github.com/hashicorp/terraform/issues/14087)) -* **New Resource:** `azurerm_sql_elasticpool` ([#14099](https://github.com/hashicorp/terraform/issues/14099)) -* **New Resource:** `google_bigquery_table` ([#13743](https://github.com/hashicorp/terraform/issues/13743)) -* **New Resource:** `google_compute_backend_bucket` ([#14015](https://github.com/hashicorp/terraform/issues/14015)) -* **New Resource:** `google_compute_snapshot` ([#12482](https://github.com/hashicorp/terraform/issues/12482)) -* **New Resource:** `heroku_app_feature` ([#14035](https://github.com/hashicorp/terraform/issues/14035)) -* **New Resource:** `heroku_pipeline` ([#14078](https://github.com/hashicorp/terraform/issues/14078)) -* **New Resource:** `heroku_pipeline_coupling` ([#14078](https://github.com/hashicorp/terraform/issues/14078)) -* **New Resource:** `kubernetes_limit_range` ([#14285](https://github.com/hashicorp/terraform/issues/14285)) -* **New Resource:** `kubernetes_resource_quota` ([#13914](https://github.com/hashicorp/terraform/issues/13914)) -* **New Resource:** `vault_auth_backend` ([#10988](https://github.com/hashicorp/terraform/issues/10988)) -* **New Data Source:** `aws_efs_file_system` ([#14041](https://github.com/hashicorp/terraform/issues/14041)) -* **New Data Source:** `http`, for retrieving text data from generic HTTP servers ([#14270](https://github.com/hashicorp/terraform/issues/14270)) -* **New Data Source:** `google_container_engine_versions`, for retrieving valid versions for clusters ([#14280](https://github.com/hashicorp/terraform/issues/14280)) -* **New Interpolation Function:** `log`, for computing logarithms ([#12872](https://github.com/hashicorp/terraform/issues/12872)) - -IMPROVEMENTS: - -* core: `sha512` and `base64sha512` interpolation functions, similar to their `sha256` equivalents. ([#14100](https://github.com/hashicorp/terraform/issues/14100)) -* core: It's now possible to use the index operator `[ ]` to select a known value out of a partially-known list, such as using "splat syntax" and increasing the `count`. ([#14135](https://github.com/hashicorp/terraform/issues/14135)) -* provider/aws: Add support for CustomOrigin timeouts to aws_cloudfront_distribution ([#13367](https://github.com/hashicorp/terraform/issues/13367)) -* provider/aws: Add support for IAMDatabaseAuthenticationEnabled ([#14092](https://github.com/hashicorp/terraform/issues/14092)) -* provider/aws: aws_dynamodb_table Add support for TimeToLive ([#14104](https://github.com/hashicorp/terraform/issues/14104)) -* provider/aws: Add `security_configuration` support to `aws_emr_cluster` ([#14133](https://github.com/hashicorp/terraform/issues/14133)) -* provider/aws: Add support for the tenancy placement option in `aws_spot_fleet_request` ([#14163](https://github.com/hashicorp/terraform/issues/14163)) -* provider/aws: `aws_db_option_group` normalizes name to lowercase ([#14192](https://github.com/hashicorp/terraform/issues/14192), [#14366](https://github.com/hashicorp/terraform/issues/14366)) -* provider/aws: Add support description to aws_iam_role ([#14208](https://github.com/hashicorp/terraform/issues/14208)) -* provider/aws: Add support for SSM Documents to aws_cloudwatch_event_target ([#14067](https://github.com/hashicorp/terraform/issues/14067)) -* provider/aws: add additional custom service endpoint options for CloudFormation, KMS, RDS, SNS & SQS ([#14097](https://github.com/hashicorp/terraform/issues/14097)) -* provider/aws: Add ARN to security group data source ([#14245](https://github.com/hashicorp/terraform/issues/14245)) -* provider/aws: Improve the wording of DynamoDB Validation error message ([#14256](https://github.com/hashicorp/terraform/issues/14256)) -* provider/aws: Add support for importing Kinesis Streams ([#14278](https://github.com/hashicorp/terraform/issues/14278)) -* provider/aws: Add `arn` attribute to `aws_ses_domain_identity` resource ([#14306](https://github.com/hashicorp/terraform/issues/14306)) -* provider/aws: Add support for targets to aws_ssm_association ([#14246](https://github.com/hashicorp/terraform/issues/14246)) -* provider/aws: native redis clustering support for elasticache ([#14317](https://github.com/hashicorp/terraform/issues/14317)) -* provider/aws: Support updating `aws_waf_rule` predicates ([#14089](https://github.com/hashicorp/terraform/issues/14089)) -* provider/azurerm: `azurerm_template_deployment` now supports String/Int/Boolean outputs ([#13670](https://github.com/hashicorp/terraform/issues/13670)) -* provider/azurerm: Expose the Private IP Address for a Load Balancer, if available ([#13965](https://github.com/hashicorp/terraform/issues/13965)) -* provider/dns: Fix data dns txt record set ([#14271](https://github.com/hashicorp/terraform/issues/14271)) -* provider/dnsimple: Add support for import for dnsimple_records ([#9130](https://github.com/hashicorp/terraform/issues/9130)) -* provider/dyn: Add verbose Dyn provider logs ([#14076](https://github.com/hashicorp/terraform/issues/14076)) -* provider/google: Add support for networkIP in compute instance templates ([#13515](https://github.com/hashicorp/terraform/issues/13515)) -* provider/google: google_dns_managed_zone is now importable ([#13824](https://github.com/hashicorp/terraform/issues/13824)) -* provider/google: Add support for `compute_route` ([#14065](https://github.com/hashicorp/terraform/issues/14065)) -* provider/google: Add `path` to `google_pubsub_subscription` ([#14238](https://github.com/hashicorp/terraform/issues/14238)) -* provider/google: Improve Service Account by offering to recreate if missing ([#14282](https://github.com/hashicorp/terraform/issues/14282)) -* provider/google: Log HTTP requests and responses in DEBUG mode ([#14281](https://github.com/hashicorp/terraform/issues/14281)) -* provider/google: Add additional properties for google resource storage bucket object ([#14259](https://github.com/hashicorp/terraform/issues/14259)) -* provider/google: Handle all 404 checks in read functions via the new function ([#14335](https://github.com/hashicorp/terraform/issues/14335)) -* provider/heroku: import heroku_app resource ([#14248](https://github.com/hashicorp/terraform/issues/14248)) -* provider/nomad: Add TLS options ([#13956](https://github.com/hashicorp/terraform/issues/13956)) -* provider/triton: Add support for reading provider configuration from `TRITON_*` environment variables in addition to `SDC_*`([#14000](https://github.com/hashicorp/terraform/issues/14000)) -* provider/triton: Add `cloud_config` argument to `triton_machine` resources for Linux containers ([#12840](https://github.com/hashicorp/terraform/issues/12840)) -* provider/triton: Add `insecure_skip_tls_verify` ([#14077](https://github.com/hashicorp/terraform/issues/14077)) - -BUG FIXES: - -* core: `module` blocks without names are now caught in validation, along with various other block types ([#14162](https://github.com/hashicorp/terraform/issues/14162)) -* core: no longer will errors and normal log output get garbled together on Windows ([#14194](https://github.com/hashicorp/terraform/issues/14194)) -* core: Avoid crash on empty TypeSet blocks ([#14305](https://github.com/hashicorp/terraform/issues/14305)) -* provider/aws: Update aws_ebs_volume when attached ([#14005](https://github.com/hashicorp/terraform/issues/14005)) -* provider/aws: Set aws_instance volume_tags to be Computed ([#14007](https://github.com/hashicorp/terraform/issues/14007)) -* provider/aws: Fix issue getting partition for federated users ([#13992](https://github.com/hashicorp/terraform/issues/13992)) -* provider/aws: aws_spot_instance_request not forcenew on volume_tags ([#14046](https://github.com/hashicorp/terraform/issues/14046)) -* provider/aws: Exclude aws_instance volume tagging for China and Gov Clouds ([#14055](https://github.com/hashicorp/terraform/issues/14055)) -* provider/aws: Fix source_dest_check with network_interface ([#14079](https://github.com/hashicorp/terraform/issues/14079)) -* provider/aws: Fixes the bug where SNS delivery policy get always recreated ([#14064](https://github.com/hashicorp/terraform/issues/14064)) -* provider/aws: Increase timeouts for Route Table retries ([#14345](https://github.com/hashicorp/terraform/issues/14345)) -* provider/aws: Prevent Crash when importing aws_route53_record ([#14218](https://github.com/hashicorp/terraform/issues/14218)) -* provider/aws: More consistent (un)quoting of long TXT/SPF `aws_route53_record`s ([#14170](https://github.com/hashicorp/terraform/issues/14170)) -* provider/aws: Retry deletion of AWSConfig Rule on ResourceInUseException ([#14269](https://github.com/hashicorp/terraform/issues/14269)) -* provider/aws: Refresh ssm document from state on 404 ([#14279](https://github.com/hashicorp/terraform/issues/14279)) -* provider/aws: Allow zero-value ELB and ALB names ([#14304](https://github.com/hashicorp/terraform/issues/14304)) -* provider/aws: Update the ignoring of AWS specific tags ([#14321](https://github.com/hashicorp/terraform/issues/14321)) -* provider/aws: Adding IPv6 address to instance causes perpetual diff ([#14355](https://github.com/hashicorp/terraform/issues/14355)) -* provider/aws: Fix SG update on instance with multiple network interfaces ([#14299](https://github.com/hashicorp/terraform/issues/14299)) -* provider/azurerm: Fixing a bug in `azurerm_network_interface` ([#14365](https://github.com/hashicorp/terraform/issues/14365)) -* provider/digitalocean: Prevent diffs when using IDs of images instead of slugs ([#13879](https://github.com/hashicorp/terraform/issues/13879)) -* provider/fastly: Changes setting conditionals to optional ([#14103](https://github.com/hashicorp/terraform/issues/14103)) -* provider/google: Ignore certain project services that can't be enabled directly via the api ([#13730](https://github.com/hashicorp/terraform/issues/13730)) -* provider/google: Ability to add more than 25 project services ([#13758](https://github.com/hashicorp/terraform/issues/13758)) -* provider/google: Fix compute instance panic with bad disk config ([#14169](https://github.com/hashicorp/terraform/issues/14169)) -* provider/google: Handle `google_storage_bucket_object` not being found ([#14203](https://github.com/hashicorp/terraform/issues/14203)) -* provider/google: Handle `google_compute_instance_group_manager` not being found ([#14190](https://github.com/hashicorp/terraform/issues/14190)) -* provider/google: better visibility for compute_region_backend_service ([#14301](https://github.com/hashicorp/terraform/issues/14301)) -* provider/heroku: Configure buildpacks correctly for both Org Apps and non-org Apps ([#13990](https://github.com/hashicorp/terraform/issues/13990)) -* provider/heroku: Fix `heroku_cert` update of ssl cert ([#14240](https://github.com/hashicorp/terraform/issues/14240)) -* provider/openstack: Handle disassociating deleted FloatingIP's from a server ([#14210](https://github.com/hashicorp/terraform/issues/14210)) -* provider/postgres grant role when creating database ([#11452](https://github.com/hashicorp/terraform/issues/11452)) -* provider/triton: Make triton machine deletes synchronous. ([#14368](https://github.com/hashicorp/terraform/issues/14368)) -* provisioner/remote-exec: Fix panic from remote_exec provisioner ([#14134](https://github.com/hashicorp/terraform/issues/14134)) - -## 0.9.4 (26th April 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/template: Fix invalid MIME formatting in `template_cloudinit_config`. - While the change itself is not breaking the data source it may be referenced - e.g. in `aws_launch_configuration` and similar resources which are immutable - and the formatting change will therefore trigger recreation ([#13752](https://github.com/hashicorp/terraform/issues/13752)) - -FEATURES: - -* **New Provider:** `opc` - Oracle Public Cloud ([#13468](https://github.com/hashicorp/terraform/issues/13468)) -* **New Provider:** `oneandone` ([#13633](https://github.com/hashicorp/terraform/issues/13633)) -* **New Data Source:** `aws_ami_ids` ([#13844](https://github.com/hashicorp/terraform/issues/13844)] [[#13866](https://github.com/hashicorp/terraform/issues/13866)) -* **New Data Source:** `aws_ebs_snapshot_ids` ([#13844](https://github.com/hashicorp/terraform/issues/13844)] [[#13866](https://github.com/hashicorp/terraform/issues/13866)) -* **New Data Source:** `aws_kms_alias` ([#13669](https://github.com/hashicorp/terraform/issues/13669)) -* **New Data Source:** `aws_kinesis_stream` ([#13562](https://github.com/hashicorp/terraform/issues/13562)) -* **New Data Source:** `digitalocean_image` ([#13787](https://github.com/hashicorp/terraform/issues/13787)) -* **New Data Source:** `google_compute_network` ([#12442](https://github.com/hashicorp/terraform/issues/12442)) -* **New Data Source:** `google_compute_subnetwork` ([#12442](https://github.com/hashicorp/terraform/issues/12442)) -* **New Resource:** `local_file` for creating local files (please see the docs for caveats) ([#12757](https://github.com/hashicorp/terraform/issues/12757)) -* **New Resource:** `alicloud_ess_scalinggroup` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `alicloud_ess_scalingconfiguration` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `alicloud_ess_scalingrule` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `alicloud_ess_schedule` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `alicloud_snat_entry` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `alicloud_forward_entry` ([#13731](https://github.com/hashicorp/terraform/issues/13731)) -* **New Resource:** `aws_cognito_identity_pool` ([#13783](https://github.com/hashicorp/terraform/issues/13783)) -* **New Resource:**  `aws_network_interface_attachment` ([#13861](https://github.com/hashicorp/terraform/issues/13861)) -* **New Resource:** `github_branch_protection` ([#10476](https://github.com/hashicorp/terraform/issues/10476)) -* **New Resource:** `google_bigquery_dataset` ([#13436](https://github.com/hashicorp/terraform/issues/13436)) -* **New Resource:** `heroku_space` ([#13921](https://github.com/hashicorp/terraform/issues/13921)) -* **New Resource:** `template_dir` for producing a directory from templates ([#13652](https://github.com/hashicorp/terraform/issues/13652)) -* **New Interpolation Function:** `coalescelist()` ([#12537](https://github.com/hashicorp/terraform/issues/12537)) - - -IMPROVEMENTS: - - * core: Add a `-reconfigure` flag to the `init` command, to configure a backend while ignoring any saved configuration ([#13825](https://github.com/hashicorp/terraform/issues/13825)) - * helper/schema: Disallow validation+diff suppression on computed fields ([#13878](https://github.com/hashicorp/terraform/issues/13878)) - * config: The interpolation function `cidrhost` now accepts a negative host number to count backwards from the end of the range ([#13765](https://github.com/hashicorp/terraform/issues/13765)) - * config: New interpolation function `matchkeys` for using values from one list to filter corresponding values from another list using a matching set. ([#13847](https://github.com/hashicorp/terraform/issues/13847)) - * state/remote/swift: Support Openstack request logging ([#13583](https://github.com/hashicorp/terraform/issues/13583)) - * provider/aws: Add an option to skip getting the supported EC2 platforms ([#13672](https://github.com/hashicorp/terraform/issues/13672)) - * provider/aws: Add `name_prefix` support to `aws_cloudwatch_log_group` ([#13273](https://github.com/hashicorp/terraform/issues/13273)) - * provider/aws: Add `bucket_prefix` to `aws_s3_bucket` ([#13274](https://github.com/hashicorp/terraform/issues/13274)) - * provider/aws: Add replica_source_db to the aws_db_instance datasource ([#13842](https://github.com/hashicorp/terraform/issues/13842)) - * provider/aws: Add IPv6 outputs to aws_subnet datasource ([#13841](https://github.com/hashicorp/terraform/issues/13841)) - * provider/aws: Exercise SecondaryPrivateIpAddressCount for network interface ([#10590](https://github.com/hashicorp/terraform/issues/10590)) - * provider/aws: Expose execution ARN + invoke URL for APIG deployment ([#13889](https://github.com/hashicorp/terraform/issues/13889)) - * provider/aws: Expose invoke ARN from Lambda function (for API Gateway) ([#13890](https://github.com/hashicorp/terraform/issues/13890)) - * provider/aws: Add tagging support to the 'aws_lambda_function' resource ([#13873](https://github.com/hashicorp/terraform/issues/13873)) - * provider/aws: Validate WAF metric names ([#13885](https://github.com/hashicorp/terraform/issues/13885)) - * provider/aws: Allow AWS Subnet to change IPv6 CIDR Block without ForceNew ([#13909](https://github.com/hashicorp/terraform/issues/13909)) - * provider/aws: Allow filtering of aws_subnet_ids by tags ([#13937](https://github.com/hashicorp/terraform/issues/13937)) - * provider/aws: Support aws_instance and volume tagging on creation ([#13945](https://github.com/hashicorp/terraform/issues/13945)) - * provider/aws: Add network_interface to aws_instance ([#12933](https://github.com/hashicorp/terraform/issues/12933)) - * provider/azurerm: VM Scale Sets - import support ([#13464](https://github.com/hashicorp/terraform/issues/13464)) - * provider/azurerm: Allow Azure China region support ([#13767](https://github.com/hashicorp/terraform/issues/13767)) - * provider/digitalocean: Export droplet prices ([#13720](https://github.com/hashicorp/terraform/issues/13720)) - * provider/fastly: Add support for GCS logging ([#13553](https://github.com/hashicorp/terraform/issues/13553)) - * provider/google: `google_compute_address` and `google_compute_global_address` are now importable ([#13270](https://github.com/hashicorp/terraform/issues/13270)) - * provider/google: `google_compute_network` is now importable ([#13834](https://github.com/hashicorp/terraform/issues/13834)) - * provider/google: add attached_disk field to google_compute_instance ([#13443](https://github.com/hashicorp/terraform/issues/13443)) - * provider/heroku: Set App buildpacks from config ([#13910](https://github.com/hashicorp/terraform/issues/13910)) - * provider/heroku: Create Heroku app in a private space ([#13862](https://github.com/hashicorp/terraform/issues/13862)) - * provider/vault: `vault_generic_secret` resource can now optionally detect drift if it has appropriate access ([#11776](https://github.com/hashicorp/terraform/issues/11776)) - -BUG FIXES: - - * core: Prevent resource.Retry from adding untracked resources after the timeout: ([#13778](https://github.com/hashicorp/terraform/issues/13778)) - * core: Allow a schema.TypeList to be ForceNew and computed ([#13863](https://github.com/hashicorp/terraform/issues/13863)) - * core: Fix crash when refresh or apply build an invalid graph ([#13665](https://github.com/hashicorp/terraform/issues/13665)) - * core: Add the close provider/provisioner transformers back ([#13102](https://github.com/hashicorp/terraform/issues/13102)) - * core: Fix a crash condition by improving the flatmap.Expand() logic ([#13541](https://github.com/hashicorp/terraform/issues/13541)) - * provider/alicloud: Fix create PrePaid instance ([#13662](https://github.com/hashicorp/terraform/issues/13662)) - * provider/alicloud: Fix allocate public ip error ([#13268](https://github.com/hashicorp/terraform/issues/13268)) - * provider/alicloud: alicloud_security_group_rule: check ptr before use it [[#13731](https://github.com/hashicorp/terraform/issues/13731)) - * provider/alicloud: alicloud_instance: fix ecs internet_max_bandwidth_out cannot set zero bug ([#13731](https://github.com/hashicorp/terraform/issues/13731)) - * provider/aws: Allow force-destroying `aws_route53_zone` which has trailing dot ([#12421](https://github.com/hashicorp/terraform/issues/12421)) - * provider/aws: Allow GovCloud KMS ARNs to pass validation in `kms_key_id` attributes ([#13699](https://github.com/hashicorp/terraform/issues/13699)) - * provider/aws: Changing aws_opsworks_instance should ForceNew ([#13839](https://github.com/hashicorp/terraform/issues/13839)) - * provider/aws: Fix DB Parameter Group Name ([#13279](https://github.com/hashicorp/terraform/issues/13279)) - * provider/aws: Fix issue importing some Security Groups and Rules based on rule structure ([#13630](https://github.com/hashicorp/terraform/issues/13630)) - * provider/aws: Fix issue for cross account IAM role with `aws_lambda_permission` ([#13865](https://github.com/hashicorp/terraform/issues/13865)) - * provider/aws: Fix WAF IPSet descriptors removal on update ([#13766](https://github.com/hashicorp/terraform/issues/13766)) - * provider/aws: Increase default number of retries from 11 to 25 ([#13673](https://github.com/hashicorp/terraform/issues/13673)) - * provider/aws: Remove aws_vpc_dhcp_options if not found ([#13610](https://github.com/hashicorp/terraform/issues/13610)) - * provider/aws: Remove aws_network_acl_rule if not found ([#13608](https://github.com/hashicorp/terraform/issues/13608)) - * provider/aws: Use mutex & retry for WAF change operations ([#13656](https://github.com/hashicorp/terraform/issues/13656)) - * provider/aws: Adding support for ipv6 to aws_subnets needs migration ([#13876](https://github.com/hashicorp/terraform/issues/13876)) - * provider/aws: Fix validation of the `name_prefix` parameter of the `aws_alb` resource ([#13441](https://github.com/hashicorp/terraform/issues/13441)) - * provider/azurerm: azurerm_redis_cache resource missing hostname ([#13650](https://github.com/hashicorp/terraform/issues/13650)) - * provider/azurerm: Locking around Network Security Group / Subnets ([#13637](https://github.com/hashicorp/terraform/issues/13637)) - * provider/azurerm: Locking route table on subnet create/delete ([#13791](https://github.com/hashicorp/terraform/issues/13791)) - * provider/azurerm: VM's - fixes a bug where ssh_keys could contain a null entry ([#13755](https://github.com/hashicorp/terraform/issues/13755)) - * provider/azurerm: VM's - ignoring the case on the `create_option` field during Diff's ([#13933](https://github.com/hashicorp/terraform/issues/13933)) - * provider/azurerm: fixing a bug refreshing the `azurerm_redis_cache` ([#13899](https://github.com/hashicorp/terraform/issues/13899)) - * provider/fastly: Fix issue with using 0 for `default_ttl` ([#13648](https://github.com/hashicorp/terraform/issues/13648)) - * provider/google: Fix panic in GKE provisioning with addons ([#13954](https://github.com/hashicorp/terraform/issues/13954)) - * provider/fastly: Add ability to associate a healthcheck to a backend ([#13539](https://github.com/hashicorp/terraform/issues/13539)) - * provider/google: Stop setting the id when project creation fails ([#13644](https://github.com/hashicorp/terraform/issues/13644)) - * provider/google: Make ports in resource_compute_forwarding_rule ForceNew ([#13833](https://github.com/hashicorp/terraform/issues/13833)) - * provider/google: Validation fixes for forwarding rules ([#13952](https://github.com/hashicorp/terraform/issues/13952)) - * provider/ignition: Internal cache moved to global, instead per provider instance ([#13919](https://github.com/hashicorp/terraform/issues/13919)) - * provider/logentries: Refresh from state when resources not found ([#13810](https://github.com/hashicorp/terraform/issues/13810)) - * provider/newrelic: newrelic_alert_condition - `condition_scope` must be `application` or `instance` ([#12972](https://github.com/hashicorp/terraform/issues/12972)) - * provider/opc: fixed issue with unqualifying nats ([#13826](https://github.com/hashicorp/terraform/issues/13826)) - * provider/opc: Fix instance label if unset ([#13846](https://github.com/hashicorp/terraform/issues/13846)) - * provider/openstack: Fix updating Ports ([#13604](https://github.com/hashicorp/terraform/issues/13604)) - * provider/rabbitmq: Allow users without tags ([#13798](https://github.com/hashicorp/terraform/issues/13798)) - -## 0.9.3 (April 12, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * provider/aws: Fix a critical bug in `aws_emr_cluster` in order to preserve the ordering - of any arguments in `bootstrap_action`. Terraform will now enforce the ordering - from the configuration. As a result, `aws_emr_cluster` resources may need to be - recreated, as there is no API to update them in-place ([#13580](https://github.com/hashicorp/terraform/issues/13580)) - -FEATURES: - - * **New Resource:** `aws_api_gateway_method_settings` ([#13542](https://github.com/hashicorp/terraform/issues/13542)) - * **New Resource:** `aws_api_gateway_stage` ([#13540](https://github.com/hashicorp/terraform/issues/13540)) - * **New Resource:** `aws_iam_openid_connect_provider` ([#13456](https://github.com/hashicorp/terraform/issues/13456)) - * **New Resource:** `aws_lightsail_static_ip` ([#13175](https://github.com/hashicorp/terraform/issues/13175)) - * **New Resource:** `aws_lightsail_static_ip_attachment` ([#13207](https://github.com/hashicorp/terraform/issues/13207)) - * **New Resource:** `aws_ses_domain_identity` ([#13098](https://github.com/hashicorp/terraform/issues/13098)) - * **New Resource:** `azurerm_managed_disk` ([#12455](https://github.com/hashicorp/terraform/issues/12455)) - * **New Resource:** `kubernetes_persistent_volume` ([#13277](https://github.com/hashicorp/terraform/issues/13277)) - * **New Resource:** `kubernetes_persistent_volume_claim` ([#13527](https://github.com/hashicorp/terraform/issues/13527)) - * **New Resource:** `kubernetes_secret` ([#12960](https://github.com/hashicorp/terraform/issues/12960)) - * **New Data Source:** `aws_iam_role` ([#13213](https://github.com/hashicorp/terraform/issues/13213)) - -IMPROVEMENTS: - - * core: add `-lock-timeout` option, which will block and retry locks for the given duration ([#13262](https://github.com/hashicorp/terraform/issues/13262)) - * core: new `chomp` interpolation function which returns the given string with any trailing newline characters removed ([#13419](https://github.com/hashicorp/terraform/issues/13419)) - * backend/remote-state: Add support for assume role extensions to s3 backend ([#13236](https://github.com/hashicorp/terraform/issues/13236)) - * backend/remote-state: Filter extra entries from s3 environment listings ([#13596](https://github.com/hashicorp/terraform/issues/13596)) - * config: New interpolation functions `basename` and `dirname`, for file path manipulation ([#13080](https://github.com/hashicorp/terraform/issues/13080)) - * helper/resource: Allow unknown "pending" states ([#13099](https://github.com/hashicorp/terraform/issues/13099)) - * command/hook_ui: Increase max length of state IDs from 20 to 80 ([#13317](https://github.com/hashicorp/terraform/issues/13317)) - * provider/aws: Add support to set iam_role_arn on cloudformation Stack ([#12547](https://github.com/hashicorp/terraform/issues/12547)) - * provider/aws: Support priority and listener_arn update of alb_listener_rule ([#13125](https://github.com/hashicorp/terraform/issues/13125)) - * provider/aws: Deprecate roles in favour of role in iam_instance_profile ([#13130](https://github.com/hashicorp/terraform/issues/13130)) - * provider/aws: Make alb_target_group_attachment port optional ([#13139](https://github.com/hashicorp/terraform/issues/13139)) - * provider/aws: `aws_api_gateway_domain_name` `certificate_private_key` field marked as sensitive ([#13147](https://github.com/hashicorp/terraform/issues/13147)) - * provider/aws: `aws_directory_service_directory` `password` field marked as sensitive ([#13147](https://github.com/hashicorp/terraform/issues/13147)) - * provider/aws: `aws_kinesis_firehose_delivery_stream` `password` field marked as sensitive ([#13147](https://github.com/hashicorp/terraform/issues/13147)) - * provider/aws: `aws_opsworks_application` `app_source.0.password` & `ssl_configuration.0.private_key` fields marked as sensitive ([#13147](https://github.com/hashicorp/terraform/issues/13147)) - * provider/aws: `aws_opsworks_stack` `custom_cookbooks_source.0.password` field marked as sensitive ([#13147](https://github.com/hashicorp/terraform/issues/13147)) - * provider/aws: Support the ability to enable / disable ipv6 support in VPC ([#12527](https://github.com/hashicorp/terraform/issues/12527)) - * provider/aws: Added API Gateway integration update ([#13249](https://github.com/hashicorp/terraform/issues/13249)) - * provider/aws: Add `identifier` | `name_prefix` to RDS resources ([#13232](https://github.com/hashicorp/terraform/issues/13232)) - * provider/aws: Validate `aws_ecs_task_definition.container_definitions` ([#12161](https://github.com/hashicorp/terraform/issues/12161)) - * provider/aws: Update caller_identity data source ([#13092](https://github.com/hashicorp/terraform/issues/13092)) - * provider/aws: `aws_subnet_ids` data source for getting a list of subnet ids matching certain criteria ([#13188](https://github.com/hashicorp/terraform/issues/13188)) - * provider/aws: Support ip_address_type for aws_alb ([#13227](https://github.com/hashicorp/terraform/issues/13227)) - * provider/aws: Migrate `aws_dms_*` resources away from AWS waiters ([#13291](https://github.com/hashicorp/terraform/issues/13291)) - * provider/aws: Add support for treat_missing_data to cloudwatch_metric_alarm ([#13358](https://github.com/hashicorp/terraform/issues/13358)) - * provider/aws: Add support for evaluate_low_sample_count_percentiles to cloudwatch_metric_alarm ([#13371](https://github.com/hashicorp/terraform/issues/13371)) - * provider/aws: Add `name_prefix` to `aws_alb_target_group` ([#13442](https://github.com/hashicorp/terraform/issues/13442)) - * provider/aws: Add support for EMR clusters to aws_appautoscaling_target ([#13368](https://github.com/hashicorp/terraform/issues/13368)) - * provider/aws: Add import capabilities to codecommit_repository ([#13577](https://github.com/hashicorp/terraform/issues/13577)) - * provider/bitbucket: Improved error handling ([#13390](https://github.com/hashicorp/terraform/issues/13390)) - * provider/cloudstack: Do not force a new resource when updating `cloudstack_loadbalancer_rule` members ([#11786](https://github.com/hashicorp/terraform/issues/11786)) - * provider/fastly: Add support for Sumologic logging ([#12541](https://github.com/hashicorp/terraform/issues/12541)) - * provider/github: Handle the case when issue labels already exist ([#13182](https://github.com/hashicorp/terraform/issues/13182)) - * provider/google: Mark `google_container_cluster`'s `client_key` & `password` inside `master_auth` as sensitive ([#13148](https://github.com/hashicorp/terraform/issues/13148)) - * provider/google: Add node_pool field in resource_container_cluster ([#13402](https://github.com/hashicorp/terraform/issues/13402)) - * provider/kubernetes: Allow defining custom config context ([#12958](https://github.com/hashicorp/terraform/issues/12958)) - * provider/openstack: Add support for 'value_specs' options to `openstack_compute_servergroup_v2` ([#13380](https://github.com/hashicorp/terraform/issues/13380)) - * provider/statuscake: Add support for StatusCake TriggerRate field ([#13340](https://github.com/hashicorp/terraform/issues/13340)) - * provider/triton: Move to joyent/triton-go ([#13225](https://github.com/hashicorp/terraform/issues/13225)) - * provisioner/chef: Make sure we add new Chef-Vault clients as clients ([#13525](https://github.com/hashicorp/terraform/issues/13525)) - -BUG FIXES: - - * core: Escaped interpolation-like sequences (like `$${foo}`) now permitted in variable defaults ([#13137](https://github.com/hashicorp/terraform/issues/13137)) - * core: Fix strange issues with computed values in provider configuration that were worked around with `-input=false` ([#11264](https://github.com/hashicorp/terraform/issues/11264)], [[#13264](https://github.com/hashicorp/terraform/issues/13264)) - * core: Fix crash when providing nested maps as variable values in a `module` block ([#13343](https://github.com/hashicorp/terraform/issues/13343)) - * core: `connection` block attributes are now subject to basic validation of attribute names during validate walk ([#13400](https://github.com/hashicorp/terraform/issues/13400)) - * provider/aws: Add Support for maintenance_window and back_window to rds_cluster_instance ([#13134](https://github.com/hashicorp/terraform/issues/13134)) - * provider/aws: Increase timeout for AMI registration ([#13159](https://github.com/hashicorp/terraform/issues/13159)) - * provider/aws: Increase timeouts for ELB ([#13161](https://github.com/hashicorp/terraform/issues/13161)) - * provider/aws: `volume_type` of `aws_elasticsearch_domain.0.ebs_options` marked as `Computed` which prevents spurious diffs ([#13160](https://github.com/hashicorp/terraform/issues/13160)) - * provider/aws: Don't set DBName on `aws_db_instance` from snapshot ([#13140](https://github.com/hashicorp/terraform/issues/13140)) - * provider/aws: Add DiffSuppression to aws_ecs_service placement_strategies ([#13220](https://github.com/hashicorp/terraform/issues/13220)) - * provider/aws: Refresh aws_alb_target_group stickiness on manual updates ([#13199](https://github.com/hashicorp/terraform/issues/13199)) - * provider/aws: Preserve default retain_on_delete in cloudfront import ([#13209](https://github.com/hashicorp/terraform/issues/13209)) - * provider/aws: Refresh aws_alb_target_group tags ([#13200](https://github.com/hashicorp/terraform/issues/13200)) - * provider/aws: Set aws_vpn_connection to recreate when in deleted state ([#13204](https://github.com/hashicorp/terraform/issues/13204)) - * provider/aws: Wait for aws_opsworks_instance to be running when it's specified ([#13218](https://github.com/hashicorp/terraform/issues/13218)) - * provider/aws: Handle `aws_lambda_function` missing s3 key error ([#10960](https://github.com/hashicorp/terraform/issues/10960)) - * provider/aws: Set stickiness to computed in alb_target_group ([#13278](https://github.com/hashicorp/terraform/issues/13278)) - * provider/aws: Increase timeout for deploying `cloudfront_distribution` from 40 to 70 mins ([#13319](https://github.com/hashicorp/terraform/issues/13319)) - * provider/aws: Increase AMI retry timeouts ([#13324](https://github.com/hashicorp/terraform/issues/13324)) - * provider/aws: Increase subnet deletion timeout ([#13356](https://github.com/hashicorp/terraform/issues/13356)) - * provider/aws: Increase launch_configuration creation timeout ([#13357](https://github.com/hashicorp/terraform/issues/13357)) - * provider/aws: Increase Beanstalk env 'ready' timeout ([#13359](https://github.com/hashicorp/terraform/issues/13359)) - * provider/aws: Raise timeout for deleting APIG REST API ([#13414](https://github.com/hashicorp/terraform/issues/13414)) - * provider/aws: Raise timeout for attaching/detaching VPN Gateway ([#13457](https://github.com/hashicorp/terraform/issues/13457)) - * provider/aws: Recreate opsworks_stack on change of service_role_arn ([#13325](https://github.com/hashicorp/terraform/issues/13325)) - * provider/aws: Fix KMS Key reading with Exists method ([#13348](https://github.com/hashicorp/terraform/issues/13348)) - * provider/aws: Fix DynamoDB issues about GSIs indexes ([#13256](https://github.com/hashicorp/terraform/issues/13256)) - * provider/aws: Fix `aws_s3_bucket` drift detection of logging options ([#13281](https://github.com/hashicorp/terraform/issues/13281)) - * provider/aws: Update ElasticTranscoderPreset to have default for MaxFrameRate ([#13422](https://github.com/hashicorp/terraform/issues/13422)) - * provider/aws: Fix aws_ami_launch_permission refresh when AMI disappears ([#13469](https://github.com/hashicorp/terraform/issues/13469)) - * provider/aws: Add support for updating SSM documents ([#13491](https://github.com/hashicorp/terraform/issues/13491)) - * provider/aws: Fix panic on nil route configs ([#13548](https://github.com/hashicorp/terraform/issues/13548)) - * provider/azurerm: Network Security Group - ignoring protocol casing at Import time ([#13153](https://github.com/hashicorp/terraform/issues/13153)) - * provider/azurerm: Fix crash when importing Local Network Gateways ([#13261](https://github.com/hashicorp/terraform/issues/13261)) - * provider/azurerm: Defaulting the value of `duplicate_detection_history_time_window` for `azurerm_servicebus_topic` ([#13223](https://github.com/hashicorp/terraform/issues/13223)) - * provider/azurerm: Event Hubs making the Location field idempotent ([#13570](https://github.com/hashicorp/terraform/issues/13570)) - * provider/bitbucket: Fixed issue where provider would fail with an "EOF" error on some operations ([#13390](https://github.com/hashicorp/terraform/issues/13390)) - * provider/dnsimple: Handle 404 on DNSimple records ([#13131](https://github.com/hashicorp/terraform/issues/13131)) - * provider/kubernetes: Use PATCH to update namespace ([#13114](https://github.com/hashicorp/terraform/issues/13114)) - * provider/ns1: No splitting answer on SPF records. ([#13260](https://github.com/hashicorp/terraform/issues/13260)) - * provider/openstack: Refresh volume_attachment from state if NotFound ([#13342](https://github.com/hashicorp/terraform/issues/13342)) - * provider/openstack: Add SOFT_DELETED to delete status ([#13444](https://github.com/hashicorp/terraform/issues/13444)) - * provider/profitbricks: Changed output type of ips variable of ip_block ProfitBricks resource ([#13290](https://github.com/hashicorp/terraform/issues/13290)) - * provider/template: Fix panic in cloudinit config ([#13581](https://github.com/hashicorp/terraform/issues/13581)) - -## 0.9.2 (March 28, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/openstack: Port Fixed IPs are able to be read again using the original numerical notation. However, Fixed IP configurations which are obtaining addresses via DHCP must now use the `all_fixed_ips` attribute to reference the returned IP address. - * Environment names must be safe to use as a URL path segment without escaping, and is enforced by the CLI. - -FEATURES: - - * **New Resource:** `alicloud_db_instance` ([#12913](https://github.com/hashicorp/terraform/issues/12913)) - * **New Resource:** `aws_api_gateway_usage_plan` ([#12542](https://github.com/hashicorp/terraform/issues/12542)) - * **New Resource:** `aws_api_gateway_usage_plan_key` ([#12851](https://github.com/hashicorp/terraform/issues/12851)) - * **New Resource:** `github_repository_webhook` ([#12924](https://github.com/hashicorp/terraform/issues/12924)) - * **New Resource:** `random_pet` ([#12903](https://github.com/hashicorp/terraform/issues/12903)) - * **New Interpolation:** `substr` ([#12870](https://github.com/hashicorp/terraform/issues/12870)) - * **S3 Environments:** The S3 remote state backend now supports named environments - -IMPROVEMENTS: - - * core: fix interpolation error when referencing computed values from an `aws_instance` `cidr_block` ([#13046](https://github.com/hashicorp/terraform/issues/13046)) - * core: fix `ignore_changes` causing fields to be removed during apply ([#12897](https://github.com/hashicorp/terraform/issues/12897)) - * core: add `-force-copy` option to `terraform init` to supress prompts for copying state ([#12939](https://github.com/hashicorp/terraform/issues/12939)) - * helper/acctest: Add NewSSHKeyPair function ([#12894](https://github.com/hashicorp/terraform/issues/12894)) - * provider/alicloud: simplify validators ([#12982](https://github.com/hashicorp/terraform/issues/12982)) - * provider/aws: Added support for EMR AutoScalingRole ([#12823](https://github.com/hashicorp/terraform/issues/12823)) - * provider/aws: Add `name_prefix` to `aws_autoscaling_group` and `aws_elb` resources ([#12629](https://github.com/hashicorp/terraform/issues/12629)) - * provider/aws: Updated default configuration manager version in `aws_opsworks_stack` ([#12979](https://github.com/hashicorp/terraform/issues/12979)) - * provider/aws: Added aws_api_gateway_api_key value attribute ([#9462](https://github.com/hashicorp/terraform/issues/9462)) - * provider/aws: Allow aws_alb subnets to change ([#12850](https://github.com/hashicorp/terraform/issues/12850)) - * provider/aws: Support Attachment of ALB Target Groups to Autoscaling Groups ([#12855](https://github.com/hashicorp/terraform/issues/12855)) - * provider/aws: Support Import of iam_server_certificate ([#13065](https://github.com/hashicorp/terraform/issues/13065)) - * provider/azurerm: Add support for setting the primary network interface ([#11290](https://github.com/hashicorp/terraform/issues/11290)) - * provider/cloudstack: Add `zone_id` to `cloudstack_ipaddress` resource ([#11306](https://github.com/hashicorp/terraform/issues/11306)) - * provider/consul: Add support for basic auth to the provider ([#12679](https://github.com/hashicorp/terraform/issues/12679)) - * provider/digitalocean: Support disk only resize ([#13059](https://github.com/hashicorp/terraform/issues/13059)) - * provider/dnsimple: Allow dnsimple_record.priority attribute to be set ([#12843](https://github.com/hashicorp/terraform/issues/12843)) - * provider/google: Add support for service_account, metadata, and image_type fields in GKE cluster config ([#12743](https://github.com/hashicorp/terraform/issues/12743)) - * provider/google: Add local ssd count support for container clusters ([#12281](https://github.com/hashicorp/terraform/issues/12281)) - * provider/ignition: ignition_filesystem, explicit option to create the filesystem ([#12980](https://github.com/hashicorp/terraform/issues/12980)) - * provider/kubernetes: Internal K8S annotations are ignored in `config_map` ([#12945](https://github.com/hashicorp/terraform/issues/12945)) - * provider/ns1: Ensure provider checks for credentials ([#12920](https://github.com/hashicorp/terraform/issues/12920)) - * provider/openstack: Adding Timeouts to Blockstorage Resources ([#12862](https://github.com/hashicorp/terraform/issues/12862)) - * provider/openstack: Adding Timeouts to FWaaS v1 Resources ([#12863](https://github.com/hashicorp/terraform/issues/12863)) - * provider/openstack: Adding Timeouts to Image v2 and LBaaS v2 Resources ([#12865](https://github.com/hashicorp/terraform/issues/12865)) - * provider/openstack: Adding Timeouts to Network Resources ([#12866](https://github.com/hashicorp/terraform/issues/12866)) - * provider/openstack: Adding Timeouts to LBaaS v1 Resources ([#12867](https://github.com/hashicorp/terraform/issues/12867)) - * provider/openstack: Deprecating Instance Volume attribute ([#13062](https://github.com/hashicorp/terraform/issues/13062)) - * provider/openstack: Decprecating Instance Floating IP attribute ([#13063](https://github.com/hashicorp/terraform/issues/13063)) - * provider/openstack: Don't log the catalog ([#13075](https://github.com/hashicorp/terraform/issues/13075)) - * provider/openstack: Handle 409/500 Response on Pool Create ([#13074](https://github.com/hashicorp/terraform/issues/13074)) - * provider/pagerduty: Validate credentials ([#12854](https://github.com/hashicorp/terraform/issues/12854)) - * provider/openstack: Adding all_metadata attribute ([#13061](https://github.com/hashicorp/terraform/issues/13061)) - * provider/profitbricks: Handling missing resources ([#13053](https://github.com/hashicorp/terraform/issues/13053)) - -BUG FIXES: - - * core: Remove legacy remote state configuration on state migration. This fixes errors when saving plans. ([#12888](https://github.com/hashicorp/terraform/issues/12888)) - * provider/arukas: Default timeout for launching container increased to 15mins (was 10mins) ([#12849](https://github.com/hashicorp/terraform/issues/12849)) - * provider/aws: Fix flattened cloudfront lambda function associations to be a set not a slice ([#11984](https://github.com/hashicorp/terraform/issues/11984)) - * provider/aws: Consider ACTIVE as pending state during ECS svc deletion ([#12986](https://github.com/hashicorp/terraform/issues/12986)) - * provider/aws: Deprecate the usage of Api Gateway Key Stages in favor of Usage Plans ([#12883](https://github.com/hashicorp/terraform/issues/12883)) - * provider/aws: prevent panic in resourceAwsSsmDocumentRead ([#12891](https://github.com/hashicorp/terraform/issues/12891)) - * provider/aws: Prevent panic when setting AWS CodeBuild Source to state ([#12915](https://github.com/hashicorp/terraform/issues/12915)) - * provider/aws: Only call replace Iam Instance Profile on existing machines ([#12922](https://github.com/hashicorp/terraform/issues/12922)) - * provider/aws: Increase AWS AMI Destroy timeout ([#12943](https://github.com/hashicorp/terraform/issues/12943)) - * provider/aws: Set aws_vpc ipv6 for associated only ([#12899](https://github.com/hashicorp/terraform/issues/12899)) - * provider/aws: Fix AWS ECS placement strategy spread fields ([#12998](https://github.com/hashicorp/terraform/issues/12998)) - * provider/aws: Specify that aws_network_acl_rule requires a cidr block ([#13013](https://github.com/hashicorp/terraform/issues/13013)) - * provider/aws: aws_network_acl_rule treat all and -1 for protocol the same ([#13049](https://github.com/hashicorp/terraform/issues/13049)) - * provider/aws: Only allow 1 value in alb_listener_rule condition ([#13051](https://github.com/hashicorp/terraform/issues/13051)) - * provider/aws: Correct handling of network ACL default IPv6 ingress/egress rules ([#12835](https://github.com/hashicorp/terraform/issues/12835)) - * provider/aws: aws_ses_receipt_rule: fix off-by-one errors ([#12961](https://github.com/hashicorp/terraform/issues/12961)) - * provider/aws: Fix issue upgrading to Terraform v0.9+ with AWS OpsWorks Stacks ([#13024](https://github.com/hashicorp/terraform/issues/13024)) - * provider/fastly: Fix issue importing Fastly Services with Backends ([#12538](https://github.com/hashicorp/terraform/issues/12538)) - * provider/google: turn compute_instance_group.instances into a set ([#12790](https://github.com/hashicorp/terraform/issues/12790)) - * provider/mysql: recreate user/grant if user/grant got deleted manually ([#12791](https://github.com/hashicorp/terraform/issues/12791)) - * provider/openstack: Fix monitor_id typo in LBaaS v1 Pool ([#13069](https://github.com/hashicorp/terraform/issues/13069)) - * provider/openstack: Resolve issues with Port Fixed IPs ([#13056](https://github.com/hashicorp/terraform/issues/13056)) - * provider/rancher: error when no api_url is provided ([#13086](https://github.com/hashicorp/terraform/issues/13086)) - * provider/scaleway: work around parallel request limitation ([#13045](https://github.com/hashicorp/terraform/issues/13045)) - -## 0.9.1 (March 17, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/pagerduty: the deprecated `name_regex` field has been removed from vendor data source ([#12396](https://github.com/hashicorp/terraform/issues/12396)) - -FEATURES: - - * **New Provider:** `kubernetes` ([#12372](https://github.com/hashicorp/terraform/issues/12372)) - * **New Resource:** `kubernetes_namespace` ([#12372](https://github.com/hashicorp/terraform/issues/12372)) - * **New Resource:** `kubernetes_config_map` ([#12753](https://github.com/hashicorp/terraform/issues/12753)) - * **New Data Source:** `dns_a_record_set` ([#12744](https://github.com/hashicorp/terraform/issues/12744)) - * **New Data Source:** `dns_cname_record_set` ([#12744](https://github.com/hashicorp/terraform/issues/12744)) - * **New Data Source:** `dns_txt_record_set` ([#12744](https://github.com/hashicorp/terraform/issues/12744)) - -IMPROVEMENTS: - - * command/init: `-backend-config` accepts `key=value` pairs - * provider/aws: Improved error when failing to get S3 tags ([#12759](https://github.com/hashicorp/terraform/issues/12759)) - * provider/aws: Validate CIDR Blocks in SG and SG rule resources ([#12765](https://github.com/hashicorp/terraform/issues/12765)) - * provider/aws: Add KMS key tag support ([#12243](https://github.com/hashicorp/terraform/issues/12243)) - * provider/aws: Allow `name_prefix` to be used with various IAM resources ([#12658](https://github.com/hashicorp/terraform/issues/12658)) - * provider/openstack: Add timeout support for Compute resources ([#12794](https://github.com/hashicorp/terraform/issues/12794)) - * provider/scaleway: expose public IPv6 information on scaleway_server ([#12748](https://github.com/hashicorp/terraform/issues/12748)) - -BUG FIXES: - - * core: Fix panic when an undefined module is reference ([#12793](https://github.com/hashicorp/terraform/issues/12793)) - * core: Fix regression from 0.8.x when using a data source in a module ([#12837](https://github.com/hashicorp/terraform/issues/12837)) - * command/apply: Applies from plans with backends set will reuse the backend rather than local ([#12785](https://github.com/hashicorp/terraform/issues/12785)) - * command/init: Changing only `-backend-config` detects changes and reconfigures ([#12776](https://github.com/hashicorp/terraform/issues/12776)) - * command/init: Fix legacy backend init error that could occur when upgrading ([#12818](https://github.com/hashicorp/terraform/issues/12818)) - * command/push: Detect local state and error properly ([#12773](https://github.com/hashicorp/terraform/issues/12773)) - * command/refresh: Allow empty and non-existent state ([#12777](https://github.com/hashicorp/terraform/issues/12777)) - * provider/aws: Get the aws_lambda_function attributes when there are great than 50 versions of a function ([#11745](https://github.com/hashicorp/terraform/issues/11745)) - * provider/aws: Correctly check for nil cidr_block in aws_network_acl ([#12735](https://github.com/hashicorp/terraform/issues/12735)) - * provider/aws: Stop setting weight property on route53_record read ([#12756](https://github.com/hashicorp/terraform/issues/12756)) - * provider/google: Fix the Google provider asking for account_file input on every run ([#12729](https://github.com/hashicorp/terraform/issues/12729)) - * provider/profitbricks: Prevent panic on profitbricks volume ([#12819](https://github.com/hashicorp/terraform/issues/12819)) - - -## 0.9.0 (March 15, 2017) - -**This is the complete 0.8.8 to 0.9 CHANGELOG. Below this section we also have a 0.9.0-beta2 to 0.9.0 final CHANGELOG.** - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `aws_codebuild_project` renamed `timeout` to `build_timeout` ([#12503](https://github.com/hashicorp/terraform/issues/12503)) - * provider/azurem: `azurerm_virtual_machine` and `azurerm_virtual_machine_scale_set` now store has of custom_data not all custom_data ([#12214](https://github.com/hashicorp/terraform/issues/12214)) - * provider/azurerm: scale_sets `os_profile_master_password` now marked as sensitive - * provider/azurerm: sql_server `administrator_login_password` now marked as sensitive - * provider/dnsimple: Provider has been upgraded to APIv2 therefore, you will need to use the APIv2 auth token - * provider/google: storage buckets have been updated with the new storage classes. The old classes will continue working as before, but should be migrated as soon as possible, as there's no guarantee they'll continue working forever. ([#12044](https://github.com/hashicorp/terraform/issues/12044)) - * provider/google: compute_instance, compute_instance_template, and compute_disk all have a subtly changed logic when specifying an image family as the image; in 0.8.x they would pin to the latest image in the family when the resource is created; in 0.9.x they pass the family to the API and use its behaviour. New input formats are also supported. ([#12223](https://github.com/hashicorp/terraform/issues/12223)) - * provider/google: removed the unused and deprecated region field from google_compute_backend_service ([#12663](https://github.com/hashicorp/terraform/issues/12663)) - * provider/google: removed the deprecated account_file field for the Google Cloud provider ([#12668](https://github.com/hashicorp/terraform/issues/12668)) - * provider/google: removed the deprecated fields from google_project ([#12659](https://github.com/hashicorp/terraform/issues/12659)) - -FEATURES: - - * **Remote Backends:** This is a successor to "remote state" and includes - file-based configuration, an improved setup process (just run `terraform init`), - no more local caching of remote state, and more. ([#11286](https://github.com/hashicorp/terraform/issues/11286)) - * **Destroy Provisioners:** Provisioners can now be configured to run - on resource destruction. ([#11329](https://github.com/hashicorp/terraform/issues/11329)) - * **State Locking:** State will be automatically locked when supported by the backend. - Backends supporting locking in this release are Local, S3 (via DynamoDB), and Consul. ([#11187](https://github.com/hashicorp/terraform/issues/11187)) - * **State Environments:** You can now create named "environments" for states. This allows you to manage distinct infrastructure resources from the same configuration. - * **New Provider:** `Circonus` ([#12578](https://github.com/hashicorp/terraform/issues/12578)) - * **New Data Source:** `openstack_networking_network_v2` ([#12304](https://github.com/hashicorp/terraform/issues/12304)) - * **New Resource:** `aws_iam_account_alias` ([#12648](https://github.com/hashicorp/terraform/issues/12648)) - * **New Resource:** `datadog_downtime` ([#10994](https://github.com/hashicorp/terraform/issues/10994)) - * **New Resource:** `ns1_notifylist` ([#12373](https://github.com/hashicorp/terraform/issues/12373)) - * **New Resource:** `google_container_node_pool` ([#11802](https://github.com/hashicorp/terraform/issues/11802)) - * **New Resource:** `rancher_certificate` ([#12717](https://github.com/hashicorp/terraform/issues/12717)) - * **New Resource:** `rancher_host` ([#11545](https://github.com/hashicorp/terraform/issues/11545)) - * helper/schema: Added Timeouts to allow Provider/Resource developers to expose configurable timeouts for actions ([#12311](https://github.com/hashicorp/terraform/issues/12311)) - -IMPROVEMENTS: - - * core: Data source values can now be used as part of a `count` calculation. ([#11482](https://github.com/hashicorp/terraform/issues/11482)) - * core: "terraformrc" can contain env var references with $FOO ([#11929](https://github.com/hashicorp/terraform/issues/11929)) - * core: report all errors encountered during config validation ([#12383](https://github.com/hashicorp/terraform/issues/12383)) - * command: CLI args can be specified via env vars. Specify `TF_CLI_ARGS` or `TF_CLI_ARGS_name` (where name is the name of a command) to specify additional CLI args ([#11922](https://github.com/hashicorp/terraform/issues/11922)) - * command/init: previous behavior is retained, but init now also configures - the new remote backends as well as downloads modules. It is the single - command to initialize a new or existing Terraform configuration. - * command: Display resource state ID in refresh/plan/destroy output ([#12261](https://github.com/hashicorp/terraform/issues/12261)) - * provider/aws: AWS Lambda DeadLetterConfig support ([#12188](https://github.com/hashicorp/terraform/issues/12188)) - * provider/aws: Return errors from Elastic Beanstalk ([#12425](https://github.com/hashicorp/terraform/issues/12425)) - * provider/aws: Set aws_db_cluster to snapshot by default ([#11668](https://github.com/hashicorp/terraform/issues/11668)) - * provider/aws: Enable final snapshots for aws_rds_cluster by default ([#11694](https://github.com/hashicorp/terraform/issues/11694)) - * provider/aws: Enable snapshotting by default on aws_redshift_cluster ([#11695](https://github.com/hashicorp/terraform/issues/11695)) - * provider/aws: Add support for ACM certificates to `api_gateway_domain_name` ([#12592](https://github.com/hashicorp/terraform/issues/12592)) - * provider/aws: Add support for IPv6 to aws\_security\_group\_rule ([#12645](https://github.com/hashicorp/terraform/issues/12645)) - * provider/aws: Add IPv6 Support to aws\_route\_table ([#12640](https://github.com/hashicorp/terraform/issues/12640)) - * provider/aws: Add support for IPv6 to aws\_network\_acl\_rule ([#12644](https://github.com/hashicorp/terraform/issues/12644)) - * provider/aws: Add support for IPv6 to aws\_default\_route\_table ([#12642](https://github.com/hashicorp/terraform/issues/12642)) - * provider/aws: Add support for IPv6 to aws\_network\_acl ([#12641](https://github.com/hashicorp/terraform/issues/12641)) - * provider/aws: Add support for IPv6 in aws\_route ([#12639](https://github.com/hashicorp/terraform/issues/12639)) - * provider/aws: Add support for IPv6 to aws\_security\_group ([#12655](https://github.com/hashicorp/terraform/issues/12655)) - * provider/aws: Add replace\_unhealthy\_instances to spot\_fleet\_request ([#12681](https://github.com/hashicorp/terraform/issues/12681)) - * provider/aws: Remove restriction on running aws\_opsworks\_* on us-east-1 ([#12688](https://github.com/hashicorp/terraform/issues/12688)) - * provider/aws: Improve error message on S3 Bucket Object deletion ([#12712](https://github.com/hashicorp/terraform/issues/12712)) - * provider/aws: Add log message about if changes are being applied now or later ([#12691](https://github.com/hashicorp/terraform/issues/12691)) - * provider/azurerm: Mark the azurerm_scale_set machine password as sensitive ([#11982](https://github.com/hashicorp/terraform/issues/11982)) - * provider/azurerm: Mark the azurerm_sql_server admin password as sensitive ([#12004](https://github.com/hashicorp/terraform/issues/12004)) - * provider/azurerm: Add support for managed availability sets. ([#12532](https://github.com/hashicorp/terraform/issues/12532)) - * provider/azurerm: Add support for extensions on virtual machine scale sets ([#12124](https://github.com/hashicorp/terraform/issues/12124)) - * provider/dnsimple: Upgrade DNSimple provider to API v2 ([#10760](https://github.com/hashicorp/terraform/issues/10760)) - * provider/docker: added support for linux capabilities ([#12045](https://github.com/hashicorp/terraform/issues/12045)) - * provider/fastly: Add Fastly SSL validation fields ([#12578](https://github.com/hashicorp/terraform/issues/12578)) - * provider/ignition: Migrate all of the igition resources to data sources ([#11851](https://github.com/hashicorp/terraform/issues/11851)) - * provider/openstack: Set Availability Zone in Instances ([#12610](https://github.com/hashicorp/terraform/issues/12610)) - * provider/openstack: Force Deletion of Instances ([#12689](https://github.com/hashicorp/terraform/issues/12689)) - * provider/rancher: Better comparison of compose files ([#12561](https://github.com/hashicorp/terraform/issues/12561)) - * provider/azurerm: store only hash of `azurerm_virtual_machine` and `azurerm_virtual_machine_scale_set` custom_data - reduces size of state ([#12214](https://github.com/hashicorp/terraform/issues/12214)) - * provider/vault: read vault token from `~/.vault-token` as a fallback for the - `VAULT_TOKEN` environment variable. ([#11529](https://github.com/hashicorp/terraform/issues/11529)) - * provisioners: All provisioners now respond very quickly to interrupts for - fast cancellation. ([#10934](https://github.com/hashicorp/terraform/issues/10934)) - -BUG FIXES: - - * core: targeting will remove untargeted providers ([#12050](https://github.com/hashicorp/terraform/issues/12050)) - * core: doing a map lookup in a resource config with a computed set no longer crashes ([#12210](https://github.com/hashicorp/terraform/issues/12210)) - * provider/aws: Fixes issue for aws_lb_ssl_negotiation_policy of already deleted ELB ([#12360](https://github.com/hashicorp/terraform/issues/12360)) - * provider/aws: Populate the iam_instance_profile uniqueId ([#12449](https://github.com/hashicorp/terraform/issues/12449)) - * provider/aws: Only send iops when creating io1 devices ([#12392](https://github.com/hashicorp/terraform/issues/12392)) - * provider/aws: Fix spurious aws_spot_fleet_request diffs ([#12437](https://github.com/hashicorp/terraform/issues/12437)) - * provider/aws: Changing volumes in ECS task definition should force new revision ([#11403](https://github.com/hashicorp/terraform/issues/11403)) - * provider/aws: Ignore whitespace in json diff for aws_dms_replication_task options ([#12380](https://github.com/hashicorp/terraform/issues/12380)) - * provider/aws: Check spot instance is running before trying to attach volumes ([#12459](https://github.com/hashicorp/terraform/issues/12459)) - * provider/aws: Add the IPV6 cidr block to the vpc datasource ([#12529](https://github.com/hashicorp/terraform/issues/12529)) - * provider/aws: Error on trying to recreate an existing customer gateway ([#12501](https://github.com/hashicorp/terraform/issues/12501)) - * provider/aws: Prevent aws_dms_replication_task panic ([#12539](https://github.com/hashicorp/terraform/issues/12539)) - * provider/aws: output the task definition name when errors occur during refresh ([#12609](https://github.com/hashicorp/terraform/issues/12609)) - * provider/aws: Refresh iam saml provider from state on 404 ([#12602](https://github.com/hashicorp/terraform/issues/12602)) - * provider/aws: Add address, port, hosted_zone_id and endpoint for aws_db_instance datasource ([#12623](https://github.com/hashicorp/terraform/issues/12623)) - * provider/aws: Allow recreation of `aws_opsworks_user_profile` when the `user_arn` is changed ([#12595](https://github.com/hashicorp/terraform/issues/12595)) - * provider/aws: Guard clause to prevent panic on ELB connectionSettings ([#12685](https://github.com/hashicorp/terraform/issues/12685)) - * provider/azurerm: bug fix to prevent crashes during azurerm_container_service provisioning ([#12516](https://github.com/hashicorp/terraform/issues/12516)) - * provider/cobbler: Fix Profile Repos ([#12452](https://github.com/hashicorp/terraform/issues/12452)) - * provider/datadog: Update to datadog_monitor to use default values ([#12497](https://github.com/hashicorp/terraform/issues/12497)) - * provider/datadog: Default notify_no_data on datadog_monitor to false ([#11903](https://github.com/hashicorp/terraform/issues/11903)) - * provider/google: Correct the incorrect instance group manager URL returned from GKE ([#4336](https://github.com/hashicorp/terraform/issues/4336)) - * provider/google: Fix a plan/apply cycle in IAM policies ([#12387](https://github.com/hashicorp/terraform/issues/12387)) - * provider/google: Fix a plan/apply cycle in forwarding rules when only a single port is specified ([#12662](https://github.com/hashicorp/terraform/issues/12662)) - * provider/google: Minor correction : "Deleting disk" message in Delete method ([#12521](https://github.com/hashicorp/terraform/issues/12521)) - * provider/mysql: Avoid crash on un-interpolated provider cfg ([#12391](https://github.com/hashicorp/terraform/issues/12391)) - * provider/ns1: Fix incorrect schema (causing crash) for 'ns1_user.notify' ([#12721](https://github.com/hashicorp/terraform/issues/12721)) - * provider/openstack: Handle cases where volumes are disabled ([#12374](https://github.com/hashicorp/terraform/issues/12374)) - * provider/openstack: Toggle Creation of Default Security Group Rules ([#12119](https://github.com/hashicorp/terraform/issues/12119)) - * provider/openstack: Change Port fixed_ip to a Set ([#12613](https://github.com/hashicorp/terraform/issues/12613)) - * provider/openstack: Add network_id to Network data source ([#12615](https://github.com/hashicorp/terraform/issues/12615)) - * provider/openstack: Check for ErrDefault500 when creating/deleting pool member ([#12664](https://github.com/hashicorp/terraform/issues/12664)) - * provider/rancher: Apply the set value for finish_upgrade to set to prevent recurring plans ([#12545](https://github.com/hashicorp/terraform/issues/12545)) - * provider/scaleway: work around API concurrency issue ([#12707](https://github.com/hashicorp/terraform/issues/12707)) - * provider/statuscake: use default status code list when updating test ([#12375](https://github.com/hashicorp/terraform/issues/12375)) - -## 0.9.0 from 0.9.0-beta2 (March 15, 2017) - -**This only includes changes from 0.9.0-beta2 to 0.9.0 final. The section above has the complete 0.8.x to 0.9.0 CHANGELOG.** - -FEATURES: - - * **New Provider:** `Circonus` ([#12578](https://github.com/hashicorp/terraform/issues/12578)) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `aws_codebuild_project` renamed `timeout` to `build_timeout` ([#12503](https://github.com/hashicorp/terraform/issues/12503)) - * provider/azurem: `azurerm_virtual_machine` and `azurerm_virtual_machine_scale_set` now store has of custom_data not all custom_data ([#12214](https://github.com/hashicorp/terraform/issues/12214)) - * provider/google: compute_instance, compute_instance_template, and compute_disk all have a subtly changed logic when specifying an image family as the image; in 0.8.x they would pin to the latest image in the family when the resource is created; in 0.9.x they pass the family to the API and use its behaviour. New input formats are also supported. ([#12223](https://github.com/hashicorp/terraform/issues/12223)) - * provider/google: removed the unused and deprecated region field from google_compute_backend_service ([#12663](https://github.com/hashicorp/terraform/issues/12663)) - * provider/google: removed the deprecated account_file field for the Google Cloud provider ([#12668](https://github.com/hashicorp/terraform/issues/12668)) - * provider/google: removed the deprecated fields from google_project ([#12659](https://github.com/hashicorp/terraform/issues/12659)) - -IMPROVEMENTS: - - * provider/azurerm: store only hash of `azurerm_virtual_machine` and `azurerm_virtual_machine_scale_set` custom_data - reduces size of state ([#12214](https://github.com/hashicorp/terraform/issues/12214)) - * report all errors encountered during config validation ([#12383](https://github.com/hashicorp/terraform/issues/12383)) - -BUG FIXES: - - * provider/google: Correct the incorrect instance group manager URL returned from GKE ([#4336](https://github.com/hashicorp/terraform/issues/4336)) - * provider/google: Fix a plan/apply cycle in IAM policies ([#12387](https://github.com/hashicorp/terraform/issues/12387)) - * provider/google: Fix a plan/apply cycle in forwarding rules when only a single port is specified ([#12662](https://github.com/hashicorp/terraform/issues/12662)) - -## 0.9.0-beta2 (March 2, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/azurerm: scale_sets `os_profile_master_password` now marked as sensitive - * provider/azurerm: sql_server `administrator_login_password` now marked as sensitive - * provider/google: storage buckets have been updated with the new storage classes. The old classes will continue working as before, but should be migrated as soon as possible, as there's no guarantee they'll continue working forever. ([#12044](https://github.com/hashicorp/terraform/issues/12044)) - * provider/dnsimple: Provider has been upgraded to APIv2 therefore, you will need to use the APIv2 auth token - -FEATURES: - - * **State Environments:** You can now create named "environments" for states. This allows you to manage distinct infrastructure resources from the same configuration. - * helper/schema: Added Timeouts to allow Provider/Resource developers to expose configurable timeouts for actions ([#12311](https://github.com/hashicorp/terraform/issues/12311)) - -IMPROVEMENTS: - - * core: "terraformrc" can contain env var references with $FOO ([#11929](https://github.com/hashicorp/terraform/issues/11929)) - * command: Display resource state ID in refresh/plan/destroy output ([#12261](https://github.com/hashicorp/terraform/issues/12261)) - * provider/aws: AWS Lambda DeadLetterConfig support ([#12188](https://github.com/hashicorp/terraform/issues/12188)) - * provider/azurerm: Mark the azurerm_scale_set machine password as sensitive ([#11982](https://github.com/hashicorp/terraform/issues/11982)) - * provider/azurerm: Mark the azurerm_sql_server admin password as sensitive ([#12004](https://github.com/hashicorp/terraform/issues/12004)) - * provider/dnsimple: Upgrade DNSimple provider to API v2 ([#10760](https://github.com/hashicorp/terraform/issues/10760)) - -BUG FIXES: - - * core: targeting will remove untargeted providers ([#12050](https://github.com/hashicorp/terraform/issues/12050)) - * core: doing a map lookup in a resource config with a computed set no longer crashes ([#12210](https://github.com/hashicorp/terraform/issues/12210)) - -0.9.0-beta1 FIXES: - - * core: backends are validated to not contain interpolations ([#12067](https://github.com/hashicorp/terraform/issues/12067)) - * core: fix local state locking on Windows ([#12059](https://github.com/hashicorp/terraform/issues/12059)) - * core: destroy provisioners dependent on module variables work ([#12063](https://github.com/hashicorp/terraform/issues/12063)) - * core: resource destruction happens after dependent resources' destroy provisioners ([#12063](https://github.com/hashicorp/terraform/issues/12063)) - * core: invalid resource attribute interpolation in a destroy provisioner errors ([#12063](https://github.com/hashicorp/terraform/issues/12063)) - * core: legacy backend loading of Consul now works properly ([#12320](https://github.com/hashicorp/terraform/issues/12320)) - * command/init: allow unsetting a backend properly ([#11988](https://github.com/hashicorp/terraform/issues/11988)) - * command/apply: fix crash that could happen with an empty directory ([#11989](https://github.com/hashicorp/terraform/issues/11989)) - * command/refresh: fix crash when no configs were in the pwd ([#12178](https://github.com/hashicorp/terraform/issues/12178)) - * command/{state,taint}: work properly with backend state ([#12155](https://github.com/hashicorp/terraform/issues/12155)) - * providers/terraform: remote state data source works with new backends ([#12173](https://github.com/hashicorp/terraform/issues/12173)) - -## 0.9.0-beta1 (February 15, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * Once an environment is updated to use the new "remote backend" feature - (from a prior remote state), it cannot be used with prior Terraform versions. - Remote backends themselves are fully backwards compatible with prior - Terraform versions. - * provider/aws: `aws_db_instance` now defaults to making a final snapshot on delete - * provider/aws: `aws_rds_cluster` now defaults to making a final snapshot on delete - * provider/aws: `aws_redshift_cluster` now defaults to making a final snapshot on delete - * provider/aws: Deprecated fields `kinesis_endpoint` & `dynamodb_endpoint` were removed. Use `kinesis` & `dynamodb` inside the `endpoints` block instead. ([#11778](https://github.com/hashicorp/terraform/issues/11778)) - * provider/datadog: `datadog_monitor` now defaults `notify_no_data` to `false` as per the datadog API - -FEATURES: - - * **Remote Backends:** This is a successor to "remote state" and includes - file-based configuration, an improved setup process (just run `terraform init`), - no more local caching of remote state, and more. ([#11286](https://github.com/hashicorp/terraform/issues/11286)) - * **Destroy Provisioners:** Provisioners can now be configured to run - on resource destruction. ([#11329](https://github.com/hashicorp/terraform/issues/11329)) - * **State Locking:** State will be automatically locked when supported by the backend. - Backends supporting locking in this release are Local, S3 (via DynamoDB), and Consul. ([#11187](https://github.com/hashicorp/terraform/issues/11187)) - -IMPROVEMENTS: - - * core: Data source values can now be used as part of a `count` calculation. ([#11482](https://github.com/hashicorp/terraform/issues/11482)) - * command: CLI args can be specified via env vars. Specify `TF_CLI_ARGS` or `TF_CLI_ARGS_name` (where name is the name of a command) to specify additional CLI args ([#11922](https://github.com/hashicorp/terraform/issues/11922)) - * command/init: previous behavior is retained, but init now also configures - the new remote backends as well as downloads modules. It is the single - command to initialize a new or existing Terraform configuration. - * provisioners: All provisioners now respond very quickly to interrupts for - fast cancellation. ([#10934](https://github.com/hashicorp/terraform/issues/10934)) - * provider/aws: Set aws_db_cluster to snapshot by default ([#11668](https://github.com/hashicorp/terraform/issues/11668)) - * provider/aws: Enable final snapshots for aws_rds_cluster by default ([#11694](https://github.com/hashicorp/terraform/issues/11694)) - * provider/aws: Enable snapshotting by default on aws_redshift_cluster ([#11695](https://github.com/hashicorp/terraform/issues/11695)) - * provider/vault: read vault token from `~/.vault-token` as a fallback for the - `VAULT_TOKEN` environment variable. ([#11529](https://github.com/hashicorp/terraform/issues/11529)) - -BUG FIXES: - - * provider/datadog: Default notify_no_data on datadog_monitor to false ([#11903](https://github.com/hashicorp/terraform/issues/11903)) - -## 0.8.8 (March 2, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * provider/aws: Potential breaking change for `root_block_device` ([#12379](https://github.com/hashicorp/terraform/issues/12379)) - -FEATURES: - - * **New Provider:** `spotinst` ([#5001](https://github.com/hashicorp/terraform/issues/5001)) - * **New Interpolation:** `slice` ([#9729](https://github.com/hashicorp/terraform/issues/9729)) - * **New Data Source:** `aws_sns_topic` ([#11752](https://github.com/hashicorp/terraform/issues/11752)) - * **New Data Source:** `openstack_images_image_v2` ([#12097](https://github.com/hashicorp/terraform/issues/12097)) - * **New Resource:** `aws_elastic_beanstalk_application_version` ([#5770](https://github.com/hashicorp/terraform/issues/5770)) - * **New Resource:** `aws_cloudwatch_log_destination` ([#11940](https://github.com/hashicorp/terraform/issues/11940)) - * **New Resource:** `aws_cloudwatch_log_destination_policy` ([#11940](https://github.com/hashicorp/terraform/issues/11940)) - * **New Resource:** `aws_codepipeline` ([#11814](https://github.com/hashicorp/terraform/issues/11814)) - * **New Resource:** `aws_egress_only_internet_gateway` ([#10538](https://github.com/hashicorp/terraform/issues/10538)) - * **New Resource:** `datadog_user` ([#12268](https://github.com/hashicorp/terraform/issues/12268)) - * **New Resource:** `digitalocean_loadbalancer` ([#12077](https://github.com/hashicorp/terraform/issues/12077)) - * **New Resource:** `openstack_images_image_v2` ([#11942](https://github.com/hashicorp/terraform/issues/11942)) - * **New Resource:** `openstack_compute_floatingip_associate_v2` ([#12190](https://github.com/hashicorp/terraform/issues/12190)) - -IMPROVEMENTS: - - * provider/aws: Add support for AWS EBS Elastic Volumes ([#11981](https://github.com/hashicorp/terraform/issues/11981)) - * provider/aws: Allow aws_instances to be resized rather than forcing a new instance ([#11998](https://github.com/hashicorp/terraform/issues/11998)) - * provider/aws: Report bucket name in S3 Error message ([#12122](https://github.com/hashicorp/terraform/issues/12122)) - * provider/aws: Implement IPV6 Support for ec2 / VPC ([#10538](https://github.com/hashicorp/terraform/issues/10538)) - * provider/aws: Add support for import of aws_elasticsearch_domain ([#12330](https://github.com/hashicorp/terraform/issues/12330)) - * provider/aws: improve redshift cluster validation ([#12313](https://github.com/hashicorp/terraform/issues/12313)) - * provider/aws: Support IAM role attachment and replacement for existing EC2 instance ([#11852](https://github.com/hashicorp/terraform/issues/11852)) - * provider/azurerm: Auto base64encode virtual_machine custom data ([#12164](https://github.com/hashicorp/terraform/issues/12164)) - * provider/datadog: add support for new host delay to the datadog_monitor resource ([#11975](https://github.com/hashicorp/terraform/issues/11975)) - * provider/datadog: Upgrade to Datadog API v2 ([#12098](https://github.com/hashicorp/terraform/issues/12098)) - * provider/fastly: Make Backends optional if used in VCL ([#12025](https://github.com/hashicorp/terraform/issues/12025)) - * provider/fastly: Add support for custom `response_object` ([#12032](https://github.com/hashicorp/terraform/issues/12032)) - * provider/google: Add support for maintenance window in `sql_database_instance` ([#12042](https://github.com/hashicorp/terraform/issues/12042)) - * provider/google: google_project supports billing account ([#11653](https://github.com/hashicorp/terraform/issues/11653)) - * provider/openstack: Don't allow floating IP and port ([#12099](https://github.com/hashicorp/terraform/issues/12099)) - * provider/openstack: Enable HTTP Logging ([#12089](https://github.com/hashicorp/terraform/issues/12089)) - * provider/openstack: Add Additional Targets for LBaaS v1 Member ([#12266](https://github.com/hashicorp/terraform/issues/12266)) - * provider/openstack: Redesign openstack_blockstorage_volume_attach_v2 ([#12071](https://github.com/hashicorp/terraform/issues/12071)) - * provider/pagerduty: Import support for service integrations ([#12141](https://github.com/hashicorp/terraform/issues/12141)) - * provider/pagerduty: Updated implementation of pagerduty_vendor & pagerduty_service_integration ([#12357](https://github.com/hashicorp/terraform/issues/12357)) - * provider/random_id: Add prefix attribute ([#12016](https://github.com/hashicorp/terraform/issues/12016)) - * provider/statuscake: Add support for Port in statuscake_test ([#11966](https://github.com/hashicorp/terraform/issues/11966)) - -BUG FIXES: - - * core: Fix a hang that could occur at the end of a Terraform command with custom plugins used ([#12048](https://github.com/hashicorp/terraform/issues/12048)) - * command/fmt: Fix incorrect formatting with single line object following complex object ([#12049](https://github.com/hashicorp/terraform/issues/12049)) - * command/state: `-backup` flags work with `mv` and `rm` ([#12156](https://github.com/hashicorp/terraform/issues/12156)) - * provider/aws: add bucket name to delete error notification ([#11952](https://github.com/hashicorp/terraform/issues/11952)) - * provider/aws: Use proper Set for source.Auth in resource_aws_codebuild_project ([#11741](https://github.com/hashicorp/terraform/issues/11741)) - * provider/aws: aws_ecs_service should output service name along with err ([#12072](https://github.com/hashicorp/terraform/issues/12072)) - * provider/aws: Add VRRP to allowed protocols in network ACL rules ([#12107](https://github.com/hashicorp/terraform/issues/12107)) - * provider/aws: Add owner_account option to aws_redshift_cluster ([#12062](https://github.com/hashicorp/terraform/issues/12062)) - * provider/aws: Update of inspector_assessment_target should use ARN not Name ([#12115](https://github.com/hashicorp/terraform/issues/12115)) - * provider/aws: Fix the panic in ssm_association with parameters ([#12215](https://github.com/hashicorp/terraform/issues/12215)) - * provider/aws: Fix update of environment_variable in codebuild_project ([#12169](https://github.com/hashicorp/terraform/issues/12169)) - * provider/aws: Refresh aws_autoscaling_schedule from state when autoscaling_group not found ([#12312](https://github.com/hashicorp/terraform/issues/12312)) - * provider/aws: No longer ForceNew resource on lambda_function runtime update ([#12329](https://github.com/hashicorp/terraform/issues/12329)) - * provider/aws: reading multiple pages of aws_efs_file_system tags ([#12328](https://github.com/hashicorp/terraform/issues/12328)) - * provider/aws: Refresh cloudwatch log subscription filter on 404 ([#12333](https://github.com/hashicorp/terraform/issues/12333)) - * provider/aws: more details on which s3 bucket had an error ([#12314](https://github.com/hashicorp/terraform/issues/12314)) - * provider/azurerm: Ignore case on protocol and allocation types ([#12176](https://github.com/hashicorp/terraform/issues/12176)) - * provider/cloudflare: add validation for proxied record types ([#11993](https://github.com/hashicorp/terraform/issues/11993)) - * provider/datadog: Adding default values to datadog_monitor ([#12168](https://github.com/hashicorp/terraform/issues/12168)) - * provider/google: make local_traffic_selector computed ([#11631](https://github.com/hashicorp/terraform/issues/11631)) - * provider/google: Write the raw disk encryption key in the state file to avoid diffs on plan ([#12068](https://github.com/hashicorp/terraform/issues/12068)) - * provider/google: fix url map test and update logic ([#12317](https://github.com/hashicorp/terraform/issues/12317)) - * provider/openstack: Rename provider to loadbalancer_provider ([#12239](https://github.com/hashicorp/terraform/issues/12239)) - * provider/pagerduty: Setting incident_urgency_rule as optional ([#12211](https://github.com/hashicorp/terraform/issues/12211)) - * provider/profitbricks: Fixing how primary_nic is added to profitbricks server ([#12197](https://github.com/hashicorp/terraform/issues/12197)) - * state/azure: add environment option for non-public cloud usage ([#12364](https://github.com/hashicorp/terraform/issues/12364)) - -## 0.8.7 (February 15, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `kinesis_endpoint` & `dynamodb_endpoint` fields in the provider schema were deprecated in favour of `kinesis` & `dynamodb` inside the `endpoints` block. Deprecated fields will be removed in 0.9 ([#11768](https://github.com/hashicorp/terraform/issues/11768)) - -FEATURES: - - * **New Interpolation:** `slice` ([#9729](https://github.com/hashicorp/terraform/issues/9729)) - * **New Provider:** `arukas` ([#11171](https://github.com/hashicorp/terraform/issues/11171)) - * **New Data Source:** `aws_db_instance` ([#11717](https://github.com/hashicorp/terraform/issues/11717)) - * **New Data Source:** `aws_vpn_gateway` ([#11886](https://github.com/hashicorp/terraform/issues/11886)) - * **New Data Source:** `consul_agent_self`, `consul_catalog_service`, `consul_catalog_services`, `consul_catalog_nodes` ([#11729](https://github.com/hashicorp/terraform/pull/11729)) - * **New Data Source:** `google_compute_zones` ([#11954](https://github.com/hashicorp/terraform/issues/11954)) - * **New Resource:** `aws_elasticsearch_domain_policy` ([#8648](https://github.com/hashicorp/terraform/issues/8648)) - * **New Resource:** `aws_vpc_peering_connection_accepter` ([#11505](https://github.com/hashicorp/terraform/issues/11505)) - * **New Resource:** `aws_config_config_rule` ([#5850](https://github.com/hashicorp/terraform/issues/5850)) - * **New Resource:** `aws_config_configuration_recorder` ([#5850](https://github.com/hashicorp/terraform/issues/5850)) - * **New Resource:** `aws_config_configuration_recorder_status` ([#5850](https://github.com/hashicorp/terraform/issues/5850)) - * **New Resource:** `aws_config_delivery_channel` ([#5850](https://github.com/hashicorp/terraform/issues/5850)) - * **New Resource:** `azurerm_container_service` ([#10820](https://github.com/hashicorp/terraform/issues/10820)) - * **New Resource:** `vault_policy` ([#10980](https://github.com/hashicorp/terraform/issues/10980)) - -IMPROVEMENTS: - - * provider/aws: Update aws_ssm_document to include `document_type`, `latest_version` and `default_version` ([#11671](https://github.com/hashicorp/terraform/issues/11671)) - * provider/aws: Support import of aws_opsworks_instance ([#11783](https://github.com/hashicorp/terraform/issues/11783)) - * provider/aws Add S3 bucket object tag support ([#11344](https://github.com/hashicorp/terraform/issues/11344)) - * provider/aws: Add validation for aws_iam_role ([#11915](https://github.com/hashicorp/terraform/issues/11915)) - * provider/fastly Allows for conditional settings across fastly ([#11843](https://github.com/hashicorp/terraform/issues/11843)) - * provider/openstack: Allow OpenStack SSL certs + keys to take path or content ([#10271](https://github.com/hashicorp/terraform/issues/10271)) - * provider/pagerduty: Add support for `incident_urgency_rule`, `support_hours` and `scheduled_actions` to `pagerduty_service` ([#11856](https://github.com/hashicorp/terraform/issues/11856)) - * provider/rancher: parse Rancher client cli.json config file ([#11658](https://github.com/hashicorp/terraform/issues/11658)) - * provider/vault: Use Vault api.DefaultConfig() ([#11523](https://github.com/hashicorp/terraform/issues/11523)) - -Bug FIXES: - - * core: resources that depend on create-before-destroy resources don't create cycles ([#11753](https://github.com/hashicorp/terraform/issues/11753)) - * core: create-before-destroy resources with a count > 1 create proper edges ([#11753](https://github.com/hashicorp/terraform/issues/11753)) - * core: fix "diffs didn't match issue" for removing or empty collections that force new ([#11732](https://github.com/hashicorp/terraform/issues/11732)) - * core: module sources ended in archive extensions without a "." won't be treated as archives ([#11438](https://github.com/hashicorp/terraform/issues/11438)) - * core: destroy ordering of resources within modules is correct ([#11765](https://github.com/hashicorp/terraform/issues/11765)) - * core: Fix crash if count interpolates into a non-int ([#11864](https://github.com/hashicorp/terraform/issues/11864)) - * core: Targeting a module will properly exclude untargeted module outputs ([#11921](https://github.com/hashicorp/terraform/issues/11921)) - * state/remote/s3: Fix Bug with Assume Role for Federated IAM Account ([#10067](https://github.com/hashicorp/terraform/issues/10067)) - * provider/aws: Fix security_group_rule resource timeout errors ([#11809](https://github.com/hashicorp/terraform/issues/11809)) - * provider/aws: Fix diff suppress function for aws_db_instance ([#11909](https://github.com/hashicorp/terraform/issues/11909)) - * provider/aws: Fix default values for AMI volume size ([#11842](https://github.com/hashicorp/terraform/issues/11842)) - * provider/aws: Fix aws_db_event_subscription import ([#11744](https://github.com/hashicorp/terraform/issues/11744)) - * provider/aws: Respect 400 returned from AWS API on RDS Cluster termination ([#11795](https://github.com/hashicorp/terraform/issues/11795)) - * provider/aws: Raise the codebuild_project create timeout ([#11777](https://github.com/hashicorp/terraform/issues/11777)) - * provider/aws: Make aws_dms_endpoint database_name optional ([#11792](https://github.com/hashicorp/terraform/issues/11792)) - * provider/aws: Bump Create and Delete timeouts to 60 mins on directory_service ([#11793](https://github.com/hashicorp/terraform/issues/11793)) - * provider/aws: aws_codecommit_trigger fix typo that causes serialization to fail when events is non-empty ([#11839](https://github.com/hashicorp/terraform/issues/11839)) - * provider/aws: Fix bug to allow update of maintenance_window in elasticache_replication_group ([#11850](https://github.com/hashicorp/terraform/issues/11850)) - * provider/azurerm: Don't push an empty set of ssh keys to virtual machine or they cannot be ammended ([#11804](https://github.com/hashicorp/terraform/issues/11804)) - * provider/azurerm: Refresh from state when VM Extension Resource not found ([#11894](https://github.com/hashicorp/terraform/issues/11894)) - * provider/cloudstack: Ensure consistent hashes of `cloudstack_port_forward` forward items. ([#11546](https://github.com/hashicorp/terraform/issues/11546)) - * provider/google: set additional_zones to computed and disallow the original zone from appearing in the list ([#11650](https://github.com/hashicorp/terraform/issues/11650)) - * provider/google: set subnetwork_project to computed ([#11646](https://github.com/hashicorp/terraform/issues/11646)) - * provider/openstack BlockStorage v1 availability_zone Fix ([#11949](https://github.com/hashicorp/terraform/issues/11949)) - -## 0.8.6 (07 February 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `aws_appautoscaling_policy` no longer has default values for `scalable_dimension` and `service_namespace` - - -FEATURES: - - * **New Data Source:** `aws_kms_secret` ([#11460](https://github.com/hashicorp/terraform/issues/11460)) - * **New Data Source:** `aws_ecs_task_definition` ([#8509](https://github.com/hashicorp/terraform/issues/8509)) - * **New Data Source:** `aws_ecs_cluster` ([#11558](https://github.com/hashicorp/terraform/issues/11558)) - * **New Data Source:** `aws_partition` ([#11675](https://github.com/hashicorp/terraform/issues/11675)) - * **New Data Source:** `pagerduty_escalation_policy` ([#11616](https://github.com/hashicorp/terraform/issues/11616)) - * **New Data Source:** `pagerduty_schedule` ([#11614](https://github.com/hashicorp/terraform/issues/11614)) - * **New Data Source:** `profitbricks_datacenter` ([#11520](https://github.com/hashicorp/terraform/issues/11520)) - * **New Data Source:** `profitbricks_location` ([#11520](https://github.com/hashicorp/terraform/issues/11520)) - * **New Data Source:** `profitbricks_image` ([#11520](https://github.com/hashicorp/terraform/issues/11520)) - * **New Resource:** `aws_sfn_activity` ([#11420](https://github.com/hashicorp/terraform/issues/11420)) - * **New Resource:** `aws_sfn_state_machine` ([#11420](https://github.com/hashicorp/terraform/issues/11420)) - * **New Resource:** `aws_codebuild_project` ([#11560](https://github.com/hashicorp/terraform/issues/11560)) - * **New Resource:** `aws_dms_certificate` ([#11122](https://github.com/hashicorp/terraform/issues/11122)) - * **New Resource:** `aws_dms_endpoint` ([#11122](https://github.com/hashicorp/terraform/issues/11122)) - * **New Resource:** `aws_dms_replication_instance` ([#11122](https://github.com/hashicorp/terraform/issues/11122)) - * **New Resource:** `aws_dms_replication_subnet_group` ([#11122](https://github.com/hashicorp/terraform/issues/11122)) - * **New Resource:** `aws_dms_replication_subnet_group` ([#11122](https://github.com/hashicorp/terraform/issues/11122)) - * **New Resource:** `pagerduty_addon` ([#11620](https://github.com/hashicorp/terraform/issues/11620)) - - -IMPROVEMENTS: - - * core: Interaction with Atlas now supports the `ATLAS_TLS_NOVERIFY` environment variable ([#11576](https://github.com/hashicorp/terraform/issues/11576)) - * provider/aws: Add EBS Volume support for EMR Instance Groups ([#11411](https://github.com/hashicorp/terraform/issues/11411)) - * provider/aws: Add support for policy to AWS provider assume_role ([#11501](https://github.com/hashicorp/terraform/issues/11501)) - * provider/aws: Add support for more sns_topic_subscription parameters on import command ([#10408](https://github.com/hashicorp/terraform/issues/10408)) - * provider/aws: Add support for Sever Side Encryption with default S3 KMS key to `aws_s3_bucket_object` ([#11261](https://github.com/hashicorp/terraform/issues/11261)) - * provider/aws: Add support for Cross Region RDS Cluster Replica ([#11428](https://github.com/hashicorp/terraform/issues/11428)) - * provider/aws: Add sensitive attribute in master_password ([#11584](https://github.com/hashicorp/terraform/issues/11584)) - * provider/aws: Application Auto Scaling now supports scaling an Amazon EC2 Spot fleet ([#8697](https://github.com/hashicorp/terraform/issues/8697)) - * provider/aws: Add tag support to DynamoDb tables ([#11617](https://github.com/hashicorp/terraform/issues/11617)) - * provider/aws: Provide the certificate ID in the aws data source ([#11693](https://github.com/hashicorp/terraform/issues/11693)) - * provider/aws: Wait for instance_profile creation to complete ([#11678](https://github.com/hashicorp/terraform/issues/11678)) - * provider/azurerm: Add support for scale sets overprovision ([#11516](https://github.com/hashicorp/terraform/issues/11516)) - * provider/azurerm: support import for load balancer and sub resources ([#11610](https://github.com/hashicorp/terraform/issues/11610)) - * provider/fastly: Adds papertrail logging ([#11491](https://github.com/hashicorp/terraform/issues/11491)) - * provider/fastly: Adds format_version for s3logging ([#11725](https://github.com/hashicorp/terraform/issues/11725)) - * provider/fastly: Adds healthcheck service ([#11709](https://github.com/hashicorp/terraform/issues/11709)) - * provider/google: allow instance group managers in region other than project ([#11294](https://github.com/hashicorp/terraform/issues/11294)) - * provider/google: Add second generation disk specification options ([#11571](https://github.com/hashicorp/terraform/issues/11571)) - * provider/google: remote_traffic_selector for google_compute_vpn_tunnel ([#11020](https://github.com/hashicorp/terraform/issues/11020)) - * provider/nomad: Update jobspec dependency to allow parsing parameterized nomad jobfiles ([#11691](https://github.com/hashicorp/terraform/issues/11691)) - * provider/google: No default root user for SQL ([#11590](https://github.com/hashicorp/terraform/issues/11590)) - * provider/opsgenie: Descriptions for Teams ([#11391](https://github.com/hashicorp/terraform/issues/11391)) - * provider/rancher: rancher_registration_token add image parameter ([#11551](https://github.com/hashicorp/terraform/issues/11551)) - * provider/rancher: allow for importing resources using environment ID to target ([#11688](https://github.com/hashicorp/terraform/issues/11688)) - -BUG FIXES: - - * core: Remove missed subfields when parent list is removed ([#11498](https://github.com/hashicorp/terraform/issues/11498)) - * command/fmt: Trailing blocks of comments at the end of files are formatted properly ([#11585](https://github.com/hashicorp/terraform/issues/11585)) - * provider/aws: Fix issue with `path` not updated when modifying AWS API Gateway Resource ([#11443](https://github.com/hashicorp/terraform/issues/11443)) - * provider/aws: Fix AWS Lambda Qualifier Regexp for `aws_lambda_permission` ([#11383](https://github.com/hashicorp/terraform/issues/11383)) - * provider/aws: allow destroy of LB stickiness policy with missing LB ([#11462](https://github.com/hashicorp/terraform/issues/11462)) - * provider/aws: ECS Placement constraints fix ([#11475](https://github.com/hashicorp/terraform/issues/11475)) - * provider/aws: retry kms_key CreateKey if arn in policy not yet seen ([#11509](https://github.com/hashicorp/terraform/issues/11509)) - * provider/aws: Fix ALB Listener Rule Import ([#1174](https://github.com/hashicorp/terraform/issues/1174)) - * provider/aws: Fix issue with ECS Placement Strat. and type casing ([#11565](https://github.com/hashicorp/terraform/issues/11565)) - * provider/aws: aws_route53_record import error processing ([#11603](https://github.com/hashicorp/terraform/issues/11603)) - * provider/aws: Fix panic in aws_rds_cluster missing parameter error message ([#11600](https://github.com/hashicorp/terraform/issues/11600)) - * provider/aws: Succeed creating aws_volume_attachment if identical attachment exists ([#11060](https://github.com/hashicorp/terraform/issues/11060)) - * provider/aws: Guard against panic in aws_vpc_endpoint_association ([#11613](https://github.com/hashicorp/terraform/issues/11613)) - * provider/aws: Allow root volume size changes in aws_instance ([#11619](https://github.com/hashicorp/terraform/issues/11619)) - * provider/aws: Fix spot instance request block device configs ([#11649](https://github.com/hashicorp/terraform/issues/11649)) - * provider/aws: Fix validation issues for onceAWeek and onceADay validation functions ([#11679](https://github.com/hashicorp/terraform/issues/11679)) - * provider/aws: Return route_table_id from aws_route_table data source ([#11703](https://github.com/hashicorp/terraform/issues/11703)) - * provider/aws: validate aws_alb_target_group name is less than 32 characters ([#11699](https://github.com/hashicorp/terraform/issues/11699)) - * provider/azurerm: Scale Sets Load balancer pools should not be computed ([#11516](https://github.com/hashicorp/terraform/issues/11516)) - * provider/azurerm: Scale Sets ip configuration handling and update support for load balancer backend pools. ([#11516](https://github.com/hashicorp/terraform/issues/11516)) - * provider/azurerm: check if lb sub resources exist when reading ([#11553](https://github.com/hashicorp/terraform/issues/11553)) - * provider/google: Fix master_instance_name to prevent slave rebuilds ([#11477](https://github.com/hashicorp/terraform/issues/11477)) - * provider/google: Refresh google_compute_instance machine_type on read ([#11645](https://github.com/hashicorp/terraform/issues/11645)) - * provider/google: Added forceNew on accessConfig in google_compute_instance_template ([#11548](https://github.com/hashicorp/terraform/issues/11548)) - * provider/ignition: Allow to add authorized keys without user creation ([#11406](https://github.com/hashicorp/terraform/issues/11406)) - * provider/ignition: mount and path are mutually exclusive ([#11409](https://github.com/hashicorp/terraform/issues/11409)) - * provider/ns1: Fix "use_client_subnet" in ns1_record ([#11368](https://github.com/hashicorp/terraform/issues/11368)) - * provider/openstack: Remove Default Security Group Rules on Create ([#11466](https://github.com/hashicorp/terraform/issues/11466)) - * provider/pagerduty: Allow timeouts to be disabled (pagerduty_service) ([#11483](https://github.com/hashicorp/terraform/issues/11483)) - * provider/rancher: Use environment specific client for accessing resources ([#11503](https://github.com/hashicorp/terraform/issues/11503)) - * provider/rancher: Refresh rancher stack from state on delete ([#11539](https://github.com/hashicorp/terraform/issues/11539)) - * provider/rancher: Refresh rancher token and registry from state on not found ([#11543](https://github.com/hashicorp/terraform/issues/11543)) - * provider/rancher: return error when Rancher template not found ([#11544](https://github.com/hashicorp/terraform/issues/11544)) - * provider/rancher: rancher_stack set docker_compose and rancher_compose ([#11550](https://github.com/hashicorp/terraform/issues/11550)) - * provider/rancher: Handle deleted/purged resources from Rancher ([#11607](https://github.com/hashicorp/terraform/issues/11607)) - * provider/statuscake: Remove computed from statuscake_test timeout parameter ([#11541](https://github.com/hashicorp/terraform/issues/11541)) - * provider/vsphere: vSphere virtual machine don't ignore VM power on errors ([#11604](https://github.com/hashicorp/terraform/issues/11604)) - * provisioner/remote-exec: Revert change in 0.8.5 that treated each line as a script since that doesn't work for stateful scripts. ([#11692](https://github.com/hashicorp/terraform/issues/11692)) - * provisioner/chef: Attributes JSON coming from computed source validates ([#11502](https://github.com/hashicorp/terraform/issues/11502)) - -## 0.8.5 (26 January 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: We no longer prefix an ECR repository address with `https://` - * provider/google: `google_project` has undergone significant changes. Existing configs and state should continue to work as they always have, but new configs and state will exhibit some new behaviour, including actually creating and deleting projects, instead of just referencing them. See https://www.terraform.io/docs/providers/google/r/google_project.html for more details. - -FEATURES: - - * **New Data Source:** `aws_autoscaling_groups` ([#11303](https://github.com/hashicorp/terraform/issues/11303)) - * **New Data Source:** `aws_elb_hosted_zone_id ` ([#11027](https://github.com/hashicorp/terraform/issues/11027)) - * **New Data Source:** `aws_instance` ([#11272](https://github.com/hashicorp/terraform/issues/11272)) - * **New Data Source:** `aws_canonical_user_id` ([#11332](https://github.com/hashicorp/terraform/issues/11332)) - * **New Data Source:** `aws_vpc_endpoint` ([#11323](https://github.com/hashicorp/terraform/issues/11323)) - * **New Provider:** `profitbricks` ([#7943](https://github.com/hashicorp/terraform/issues/7943)) - * **New Provider:** `alicloud` ([#11235](https://github.com/hashicorp/terraform/issues/11235)) - * **New Provider:** `ns1` ([#10782](https://github.com/hashicorp/terraform/issues/10782)) - * **New Resource:** `aws_inspector_assessment_target` ([#11217](https://github.com/hashicorp/terraform/issues/11217)) - * **New Resource:** `aws_inspector_assessment_template` ([#11217](https://github.com/hashicorp/terraform/issues/11217)) - * **New Resource:** `aws_inspector_resource_group` ([#11217](https://github.com/hashicorp/terraform/issues/11217)) - * **New Resource:** `google_project_iam_policy` ([#10425](https://github.com/hashicorp/terraform/issues/10425)) - * **New Resource:** `google_project_services` ([#10425](https://github.com/hashicorp/terraform/issues/10425)) - * **New Interpolation Function:** `pathexpand()` ([#11277](https://github.com/hashicorp/terraform/issues/11277)) - -IMPROVEMENTS: - - * command/fmt: Single line objects (such as `variable "foo" {}`) aren't separated by newlines - * provider/aws: Add 'route_table_id' to route_table data source ([#11157](https://github.com/hashicorp/terraform/pull/11157)) - * provider/aws: Add Support for aws_cloudwatch_metric_alarm extended statistic ([#11193](https://github.com/hashicorp/terraform/issues/11193)) - * provider/aws: Make the type of a route53_record modifiable without recreating the resource ([#11164](https://github.com/hashicorp/terraform/issues/11164)) - * provider/aws: Add Placement Strategy to aws_ecs_service resource ([#11201](https://github.com/hashicorp/terraform/issues/11201)) - * provider/aws: Add support for placement_constraint to aws_ecs_service ([#11242](https://github.com/hashicorp/terraform/issues/11242)) - * provider/aws: allow ALB target group stickiness to be enabled/disabled ([#11251](https://github.com/hashicorp/terraform/issues/11251)) - * provider/aws: ALBs now wait for provisioning to complete before proceeding ([#11333](https://github.com/hashicorp/terraform/issues/11333)) - * provider/aws: Add support for setting MSSQL Timezone in aws_db_instance ([#11247](https://github.com/hashicorp/terraform/issues/11247)) - * provider/aws: CloudFormation YAML template support ([#11121](https://github.com/hashicorp/terraform/issues/11121)) - * provider/aws: Remove hardcoded https from the ecr repository ([#11307](https://github.com/hashicorp/terraform/issues/11307)) - * provider/aws: Implement CloudFront Lambda Function Associations ([#11291](https://github.com/hashicorp/terraform/issues/11291)) - * provider/aws: Remove MaxFrameRate default on ElasticTranscoderPreset ([#11340](https://github.com/hashicorp/terraform/issues/11340)) - * provider/aws: Allow ARN Identifier to be set for different partitions ([#11359](https://github.com/hashicorp/terraform/issues/11359)) - * provider/aws: Allow bypassing region validation ([#11358](https://github.com/hashicorp/terraform/issues/11358)) - * provider/aws: Added a s3_bucket domain name attribute ([#10088](https://github.com/hashicorp/terraform/issues/10088)) - * provider/aws: Add DiffSupressFunction to aws_db_instance's engine_version ([#11369](https://github.com/hashicorp/terraform/issues/11369)) - * provider/archive: Adding support for multiple source contents ([#11271](https://github.com/hashicorp/terraform/issues/11271)) - * provider/azurerm: add caching support for virtual_machine data_disks ([#11142](https://github.com/hashicorp/terraform/issues/11142)) - * provider/azurerm: make lb sub resources idempotent ([#11128](https://github.com/hashicorp/terraform/issues/11128)) - * provider/cloudflare: Add verification for record types and content ([#11197](https://github.com/hashicorp/terraform/issues/11197)) - * provider/datadog: Add aggregator method to timeboard graph resource ([#11206](https://github.com/hashicorp/terraform/issues/11206)) - * provider/fastly Add request_condition to backend definition ([#11238](https://github.com/hashicorp/terraform/issues/11238)) - * provider/google: Add subnetwork_project field to enable cross-project networking in instance templates ([#11110](https://github.com/hashicorp/terraform/issues/11110)) - * provider/google: Add support for encrypting a disk ([#11167](https://github.com/hashicorp/terraform/issues/11167)) - * provider/google: Add support for session_affinity to google_compute_region_backend_service ([#11228](https://github.com/hashicorp/terraform/issues/11228)) - * provider/google: Allow additional zones to be configured in GKE ([#11018](https://github.com/hashicorp/terraform/issues/11018)) - * provider/ignition: Allow empty dropin and content for systemd_units ([#11327](https://github.com/hashicorp/terraform/issues/11327)) - * provider/openstack: LoadBalancer Security Groups ([#11074](https://github.com/hashicorp/terraform/issues/11074)) - * provider/openstack: Volume Attachment Updates ([#11285](https://github.com/hashicorp/terraform/issues/11285)) - * provider/scaleway improve bootscript data source ([#11183](https://github.com/hashicorp/terraform/issues/11183)) - * provider/statuscake: Add support for StatusCake confirmation servers ([#11179](https://github.com/hashicorp/terraform/issues/11179)) - * provider/statuscake: Add support for Updating StatusCake contact_ids ([#7115](https://github.com/hashicorp/terraform/issues/7115)) - * provisioner/chef: Add support for named run-lists when using policyfiles ([#11215](https://github.com/hashicorp/terraform/issues/11215)) - * core: Add basic HTTP Auth for remote state backend ([#11301](https://github.com/hashicorp/terraform/issues/11301)) - -BUG FIXES: - - * command/fmt: Multiple `#` comments won't be separated by newlines. ([#11209](https://github.com/hashicorp/terraform/issues/11209)) - * command/fmt: Lists with a heredoc element that starts on the same line as the opening brace is formatted properly. ([#11208](https://github.com/hashicorp/terraform/issues/11208)) - * command/import: Provider configuration inheritance into modules works properly ([#11393](https://github.com/hashicorp/terraform/issues/11393)) - * command/import: Update help text to note that `-var` and `-var-file` work - * provider/aws: Fix panic when querying VPC's main route table via data source ([#11134](https://github.com/hashicorp/terraform/issues/11134)) - * provider/aws: Allow creating aws_codecommit repository outside of us-east-1 ([#11177](https://github.com/hashicorp/terraform/issues/11177)) - * provider/aws: Fix issue destroying or updating CloudFront due to missing Lambda Function Associations parameters ([#11291](https://github.com/hashicorp/terraform/issues/11291)) - * provider/aws: Correct error messages are now returned if an `aws_autoscaling_lifecycle_hook` fails during creation ([#11360](https://github.com/hashicorp/terraform/issues/11360)) - * provider/aws: Fix issue updating/destroying Spot Fleet requests when using `terminate_instances_with_expiration` ([#10953](https://github.com/hashicorp/terraform/issues/10953)) - * provider/azurerm: use configured environment for storage clients ([#11159](https://github.com/hashicorp/terraform/issues/11159)) - * provider/google: removes region param from google_compute_backend_service ([#10903](https://github.com/hashicorp/terraform/issues/10903)) - * provider/ignition: allowing empty systemd.content when a dropin is provided ([#11216](https://github.com/hashicorp/terraform/issues/11216)) - * provider/openstack: Increase deletion timeout for router interfaces ([#11250](https://github.com/hashicorp/terraform/issues/11250)) - * provider/openstack: Fix Instance Metadata Deletion ([#11252](https://github.com/hashicorp/terraform/issues/11252)) - * provider/scaleway: Rename Scaleway provider parameters to match more closely to the API ([#10874](https://github.com/hashicorp/terraform/issues/10874)) - * provider/vault: Remove user input for optional vault provider fields ([#11082](https://github.com/hashicorp/terraform/issues/11082)) - * provider/vsphere: Set deviceID to 0 if one 1 network interface in vsphere_virtual_machine ([#8276](https://github.com/hashicorp/terraform/issues/8276)) - * provisioner/remote-exec: fail on first inline script with bad exit code ([#11155](https://github.com/hashicorp/terraform/issues/11155)) - -## 0.8.4 (January 11, 2017) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * We have removed the `Arukas` provider that was added in v0.8.3 for this release. Unfortunately we found the - new provider included a dependency that would not compile and run on Windows operating systems. For now the - provider has been removed and we hope to work to reintroduce it for all platforms in the near future. Going forward we will also be taking additional steps in our build testing to ensure Terraform builds on all platforms before release. - -## 0.8.3 (January 10, 2017) - -FEATURES: - - * **New Provider:** `Arukas` ([#10862](https://github.com/hashicorp/terraform/issues/10862)) - * **New Provider:** `Ignition` ([#6189](https://github.com/hashicorp/terraform/issues/6189)) - * **New Provider:** `OpsGenie` ([#11012](https://github.com/hashicorp/terraform/issues/11012)) - * **New Data Source:** `aws_vpc_peering_connection` ([#10913](https://github.com/hashicorp/terraform/issues/10913)) - * **New Resource:** `aws_codedeploy_deployment_config` ([#11062](https://github.com/hashicorp/terraform/issues/11062)) - * **New Resource:** `azurerm_container_registry` ([#10973](https://github.com/hashicorp/terraform/issues/10973)) - * **New Resource:** `azurerm_eventhub_authorization_rule` ([#10971](https://github.com/hashicorp/terraform/issues/10971)) - * **New Resource:** `azurerm_eventhub_consumer_group` ([#9902](https://github.com/hashicorp/terraform/issues/9902)) - -IMPROVEMENTS: - - * command/fmt: Show filename on parse error ([#10923](https://github.com/hashicorp/terraform/issues/10923)) - * provider/archive: `archive_file` now exports `output_md5` attribute in addition to existing SHA1 and Base64 SHA256 hashes. ([#10851](https://github.com/hashicorp/terraform/issues/10851)) - * provider/aws: Add `most_recent` to the `ebs_snapshot` data source ([#10986](https://github.com/hashicorp/terraform/issues/10986)) - * provider/aws: Add support for instance tenancy in `aws_opsworks_instance` ([#10885](https://github.com/hashicorp/terraform/issues/10885)) - * provider/aws: Added a validation for security group rule types ([#10864](https://github.com/hashicorp/terraform/issues/10864)) - * provider:aws: Add support for updating aws_emr_cluster parameters ([#11008](https://github.com/hashicorp/terraform/issues/11008)) - * provider/aws: Add Placement Constraints to `aws_ecs_task_definition` ([#11030](https://github.com/hashicorp/terraform/issues/11030)) - * provider/aws: Increasing timeout for redshift cluster creation to 75 minutes ([#11041](https://github.com/hashicorp/terraform/issues/11041)) - * provider/aws: Add support for content_handling to aws_api_gateway_integration_response ([#11002](https://github.com/hashicorp/terraform/issues/11002)) - * provider/aws: Add S3 bucket name validation ([#11116](https://github.com/hashicorp/terraform/issues/11116)) - * provider/aws: Add Route53 Record type validation ([#11119](https://github.com/hashicorp/terraform/issues/11119)) - * provider/azurerm: support non public clouds ([#11026](https://github.com/hashicorp/terraform/issues/11026)) - * provider/azurerm: Azure resource providers which are already registered are no longer re-registered. ([#10991](https://github.com/hashicorp/terraform/issues/10991)) - * provider/docker: Add network create --internal flag support ([#10932](https://github.com/hashicorp/terraform/issues/10932)) - * provider/docker: Add support for a list of pull_triggers within the docker_image resource. ([#10845](https://github.com/hashicorp/terraform/issues/10845)) - * provider/pagerduty Add delete support to `pagerduty_service_integration` ([#10891](https://github.com/hashicorp/terraform/issues/10891)) - * provider/postgresql Add permissions support to `postgresql_schema` as nested `policy` attributes ([#10808](https://github.com/hashicorp/terraform/issues/10808)) - -BUG FIXES: - - * core: Properly expand sets as lists from a flatmap ([#11042](https://github.com/hashicorp/terraform/issues/11042)) - * core: Disallow root modules named "root" as a temporary workaround ([#11099](https://github.com/hashicorp/terraform/issues/11099)) - * command/fmt: Lists of heredocs format properly ([#10947](https://github.com/hashicorp/terraform/issues/10947)) - * command/graph: Fix crash when `-type=legacy` ([#11095](https://github.com/hashicorp/terraform/issues/11095)) - * provider/aws: Guard against nil change output in `route53_zone` that causes panic ([#10798](https://github.com/hashicorp/terraform/issues/10798)) - * provider/aws: Reworked validateArn function to handle empty values ([#10833](https://github.com/hashicorp/terraform/issues/10833)) - * provider/aws: Set `aws_autoscaling_policy` `metric_aggregation_type` to be Computed ([#10904](https://github.com/hashicorp/terraform/issues/10904)) - * provider/aws: `storage_class` is now correctly treated as optional when configuring replication for `aws_s3_bucket` resources. ([#10921](https://github.com/hashicorp/terraform/issues/10921)) - * provider/aws: `user_data` on `aws_launch_configuration` resources is only base 64 encoded if the value provided is not already base 64 encoded. ([#10871](https://github.com/hashicorp/terraform/issues/10871)) - * provider/aws: Add snapshotting to the list of pending state for elasticache ([#10965](https://github.com/hashicorp/terraform/issues/10965)) - * provider/aws: Add support for updating tags in aws_emr_cluster ([#11003](https://github.com/hashicorp/terraform/issues/11003)) - * provider/aws: Fix the normalization of AWS policy statements ([#11009](https://github.com/hashicorp/terraform/issues/11009)) - * provider/aws: data_source_aws_iam_server_certificate latest should be bool not string causes panic ([#11016](https://github.com/hashicorp/terraform/issues/11016)) - * provider/aws: Fix typo in aws_redshift_cluster causing security groups to not allow update ([#11025](https://github.com/hashicorp/terraform/issues/11025)) - * provider/aws: Set `key_name` in `aws_key_pair` if omited in configuration ([#10987](https://github.com/hashicorp/terraform/issues/10987)) - * provider/aws: Updating the aws_efs_mount_target dns_name ([#11023](https://github.com/hashicorp/terraform/issues/11023)) - * provider/aws: Validate window time format for snapshot times and backup windows on RDS and ElastiCache resources ([#11089](https://github.com/hashicorp/terraform/issues/11089)) - * provider/aws: aws_db_instance restored from snapshot had problem with subnet_group ([#11050](https://github.com/hashicorp/terraform/issues/11050)) - * provider/aws: Allow disabled access_log in ELB ([#11120](https://github.com/hashicorp/terraform/issues/11120)) - * provider/azurerm: fix update protocol for lb_probe ([#11125](https://github.com/hashicorp/terraform/issues/11125)) - * provider/google: Fix backwards incompatibility around create_timeout in instances ([#10858](https://github.com/hashicorp/terraform/issues/10858)) - * provider/google: google_compute_instance_group_manager update_strategy not properly read ([#10174](https://github.com/hashicorp/terraform/issues/10174)) - * provider/openstack: Handle `PENDING_UPDATE` status with LBaaS v2 members ([#10875](https://github.com/hashicorp/terraform/issues/10875)) - * provider/rancher: Add 'finishing-upgrade' state to rancher stack ([#11019](https://github.com/hashicorp/terraform/issues/11019)) - - -## 0.8.2 (December 21, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * `aws_lambda_function` Please note that `runtime` is now a required field as AWS have deprecated the use of nodejs 0.10 in lambda functions ([#9724](https://github.com/hashicorp/terraform/issues/9724)) - -FEATURES: - - * **New Provider:** `New Relic` ([#10317](https://github.com/hashicorp/terraform/issues/10317)) - * **New Resource:** `aws_ses_configuration_set` ([#10735](https://github.com/hashicorp/terraform/issues/10735)) - * **New Resource:** `aws_ses_event_destination` ([#10735](https://github.com/hashicorp/terraform/issues/10735)) - * **New Resource:** `azurerm_redis_cache` ([#10184](https://github.com/hashicorp/terraform/issues/10184)) - * **New Resource:** `ultradns_dirpool` ([#9788](https://github.com/hashicorp/terraform/issues/9788)) - * **New Resource:** `ultradns_probe_http` ([#9788](https://github.com/hashicorp/terraform/issues/9788)) - * **New Resource:** `ultradns_probe_ping` ([#9788](https://github.com/hashicorp/terraform/issues/9788)) - * **New Resource:** `ultradns_record` ([#9788](https://github.com/hashicorp/terraform/issues/9788)) - * **New Resource:** `ultradns_tcpool` ([#9788](https://github.com/hashicorp/terraform/issues/9788)) - * **New Data Source:** `aws_iam_account_alias` ([#10804](https://github.com/hashicorp/terraform/issues/10804)) - -IMPROVEMENTS: - - * provider/aws: Add support for BinaryMediaTypes and ContentHandling to AWS API Gateway ([#10776](https://github.com/hashicorp/terraform/issues/10776)) - * provider/aws: Deprecated aws_lambda_function nodejs runtime in favor of nodejs4.3 ([#9724](https://github.com/hashicorp/terraform/issues/9724)) - * provider/aws: Support updating of aws_db_instance db_subnet_group_name ([#10818](https://github.com/hashicorp/terraform/issues/10818)) - * provider/aws: Allow update to RDS password when restoring from snapshot ([#8622](https://github.com/hashicorp/terraform/issues/8622)) - * provider/azurerm: add support for tags to dns_zone ([#10750](https://github.com/hashicorp/terraform/issues/10750)) - * provider/pagerduty pagerduty_schedule - support for start_day_of_week (schedule restriction) ([#10069](https://github.com/hashicorp/terraform/issues/10069)) - * state/remote/swift: add support for token authentication ([#10866](https://github.com/hashicorp/terraform/issues/10866)) - -BUG FIXES: - - * core: Improve validation for provider aliases to allow inheritance in moduels. ([#10807](https://github.com/hashicorp/terraform/issues/10807)) - * core: Math operations always prefer floating point if an argument is floating point. ([#10886](https://github.com/hashicorp/terraform/issues/10886)) - * core: Strings are implicitly converted to integers/floats for comparison. ([#10886](https://github.com/hashicorp/terraform/issues/10886)) - * provider/aws: Fixed crash in `data_source_ami` with empty `owner` value ([#10763](https://github.com/hashicorp/terraform/issues/10763)) - * provider/aws: Require `master_username` and `master_password` if no snapshot given in Redshift Cluster ([#9837](https://github.com/hashicorp/terraform/issues/9837)) - * provider/azurerm: fix network_interface.ip_configuration hash for load balancers ([#10834](https://github.com/hashicorp/terraform/issues/10834)) - * provider/docker: Fix regression, 'cert_path' stop working ([#10801](https://github.com/hashicorp/terraform/issues/10801)) - * provider/google: Use node_version during google_container_cluster creation ([#10817](https://github.com/hashicorp/terraform/issues/10817)) - * provider/openstack: Handle Volume Creation Errors ([#10821](https://github.com/hashicorp/terraform/issues/10821)) - -## 0.8.1 (December 14, 2016) - -IMPROVEMENTS: - - * provider/aws: Support eu-west-2 ([#10470](https://github.com/hashicorp/terraform/issues/10470)) - * provider/aws: Improved the SNS topic subscription protocols validation ([#10704](https://github.com/hashicorp/terraform/issues/10704)) - * providers/google: Add subnetwork_project field to enable cross-project networking ([#9662](https://github.com/hashicorp/terraform/issues/9662)) - * provider/pagerduty: Allow 'team_responder' role for pagerduty_user resource ([#10728](https://github.com/hashicorp/terraform/issues/10728)) - -BUG FIXES: - - * core: Handle whitespace around the key in the `-var` flag. ([#10717](https://github.com/hashicorp/terraform/issues/10717)) - * core: `terraform` block works in the presence of `_override` files ([#10715](https://github.com/hashicorp/terraform/issues/10715)) - * core: Fix error when a provider in a module only referenced a variable ([#10719](https://github.com/hashicorp/terraform/issues/10719)) - * core: Destroy ordering for resources that depend on each other across modules is correct ([#745](https://github.com/hashicorp/terraform/issues/745)) - -DEPRECATION REMOVALS: - - * provider/aws: Removed deprecated `parameter_group` from `aws_rds_cluster` ([#10733](https://github.com/hashicorp/terraform/issues/10733)) - -## 0.8.0 (December 13, 2016) - -**This is the complete 0.7.13 to 0.8 CHANGELOG. Below this section we -also have a 0.8.0-rc3 to 0.8.0 final CHANGELOG.** - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * `template_file` _inline_ templates must escape their variable usage. What - was previously `${foo}` must now be `$${foo}`. Note that this is only - for _inline_ templates. Templates read from files are unchanged. ([#9698](https://github.com/hashicorp/terraform/issues/9698)) - * Escape sequences used to require double-escaping when used within interpolations. - You now must only escape once (which is the expected/typical behavior). - For example: `${replace(var.foo, "\\", "\\\\")}` is correct. Before, - that would cause very strange behavior. However, this may break existing - configurations which found a level of escape sequences to work. Check - `terraform plan` for incorrect output. - * Math operators now follow the standard order of operations: *, /, % followed - by +, -. See the updated interpolation docs for more information. You can - continue to force ordering with parentheses. - * Strings in configuration can no longer contain unescaped newlines. For - unescaped newlines, heredocs must be used - - * provider/aws: Anywhere where we can specify kms_key_id must now be a valid KMS Key ID ARN to stop continual diffs - * provider/chef: The chef provider now accepts `key_material` as an alternative to - `private_key_pem`. The `private_key_pem` attribute will be deprecated in a - future release - * provider/postgres: `ssl_mode` has been renamed `sslmode` to match common usage ([#10682](https://github.com/hashicorp/terraform/issues/10682)) - -DEPRECATION REMOVALS: - - * The `template_file` resource no longer accepts a direct file path for the - `template` attribute. You may either specify a path wrapped in a `file` - function or specify a file path with the `filepath` attribute. This was - deprecated during 0.7.x. - -FEATURES: - - * **New command:** `terraform console`, an interactive console for experimenting - with and using interpolations. ([#10093](https://github.com/hashicorp/terraform/issues/10093)) - * **Terraform version requirement in configuration.** You can now specify - a Terraform version requirement in configuration and modules. ([#10080](https://github.com/hashicorp/terraform/issues/10080)) - * **Conditional values:** You can now use conditionals to determine the values - of attributes. For example: `count = "${var.env == "prod" ? 1 : 0}"`. - * **`depends_on` can reference modules.** This allows a resource or output - to depend on everything within a module. ([#10076](https://github.com/hashicorp/terraform/issues/10076)) - * **`output` supports `depends_on`.** This is useful when the output depends - on a certain ordering to happen that can't be represented with interpolations. - ([#10072](https://github.com/hashicorp/terraform/issues/10072)) - * Providers and resources are now notified by Terraform core to "stop" when - an interrupt is received, allowing resources to gracefully exit much, much - faster. ([#9607](https://github.com/hashicorp/terraform/issues/9607)) - * The `import` command can now specify a provider alias to use. ([#10310](https://github.com/hashicorp/terraform/issues/10310)) - * The `import` command will now read provider configuration from Terraform - configuration files (including loading tfvars files and so on). - ([#9809](https://github.com/hashicorp/terraform/issues/9809)) - - * **New Provider:** `external` ([#8768](https://github.com/hashicorp/terraform/issues/8768)) - * **New Provider:** `nomad` ([#9538](https://github.com/hashicorp/terraform/issues/9538)) - * **New Provider:** `rancher` ([#9173](https://github.com/hashicorp/terraform/issues/9173)) - * **New Provider:** `vault` ([#9158](https://github.com/hashicorp/terraform/issues/9158)) - * **New Provider:** `Icinga2` ([#8306](https://github.com/hashicorp/terraform/issues/8306)) - * **New Resource:** `aws_ebs_snapshot` ([#10017](https://github.com/hashicorp/terraform/issues/10017)) - * **New Resource:** `aws_lightsail_domain` ([#10637](https://github.com/hashicorp/terraform/issues/10637)) - * **New Resource:** `aws_lightsail_key_pair` ([#10583](https://github.com/hashicorp/terraform/issues/10583)) - * **New Resource:** `aws_lightsail_instance` ([#10473](https://github.com/hashicorp/terraform/issues/10473)) - * **New Resource:** `aws_opsworks_rds_db_instance` ([#10294](https://github.com/hashicorp/terraform/issues/10294)) - * **New Resource:** `aws_snapshot_create_volume_permission` ([#9891](https://github.com/hashicorp/terraform/issues/9891)) - * **New Resource:** `aws_vpc_endpoint_route_table_association` ([#10137](https://github.com/hashicorp/terraform/issues/10137)) - * **New Resource:** `google_compute_health_check` ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * **New Resource:** `google_compute_region_backend_service` ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * **New Resource:** `openstack_blockstorage_volume_attach_v2` ([#10259](https://github.com/hashicorp/terraform/issues/10259)) - * **New Resource:** `openstack_compute_volume_attach_v2` ([#10260](https://github.com/hashicorp/terraform/issues/10260)) - * **New Data Source:** `aws_ebs_snapshot` ([#10017](https://github.com/hashicorp/terraform/issues/10017)) - * **New Data Source:** `aws_eip` ([#9833](https://github.com/hashicorp/terraform/issues/9833)) - * **New Data Source:** `aws_iam_server_certificate` ([#10558](https://github.com/hashicorp/terraform/issues/10558)) - * **New Data Source:** `aws_route_table` ([#10301](https://github.com/hashicorp/terraform/issues/10301)) - * **New Data Source:** `aws_route53_zone` ([#9766](https://github.com/hashicorp/terraform/issues/9766)) - * **New Data Source:** `aws_vpc_endpoint_services` ([#10261](https://github.com/hashicorp/terraform/issues/10261)) - * **New Data Source:** `pagerduty_user` ([#10541](https://github.com/hashicorp/terraform/issues/10541)) - * **New Interpolation Function:** `timestamp` ([#10475](https://github.com/hashicorp/terraform/issues/10475)) - * core: allow outputs to have descriptions ([#9722](https://github.com/hashicorp/terraform/issues/9722)) - * state/azure: support passing of lease ID when writing storage blob ([#10115](https://github.com/hashicorp/terraform/issues/10115)) - -IMPROVEMENTS: - - * core: Human-friendly error when a computed count is used. ([#10060](https://github.com/hashicorp/terraform/issues/10060)) - * core: Maps across multiple input sources (files, CLI, env vars) are merged. ([#10654](https://github.com/hashicorp/terraform/issues/10654)) - * core: SIGTERM also triggers graceful shutdown in addition to SIGINT ([#10534](https://github.com/hashicorp/terraform/issues/10534)) - * core: Plan will show deposed-only destroys for create-before-destroy resources. ([#10404](https://github.com/hashicorp/terraform/issues/10404)) - * command/plan: Show warning when a plan file is given as input to make behavior clear. ([#10639](https://github.com/hashicorp/terraform/issues/10639)) - * helper/schema: only map, list, and set elements that are actually causing - a resource to destroy/create are marked as "requires new". ([#9613](https://github.com/hashicorp/terraform/issues/9613)) - * provider/aws: Add support for AWS CA Central 1 Region ([#10618](https://github.com/hashicorp/terraform/issues/10618)) - * provider/aws: Allow importing of aws_iam_role, aws_iam_role_policy and aws_iam_policy ([#9398](https://github.com/hashicorp/terraform/issues/9398)) - * provider/aws: Added s3 bucket region attribute management ([#10482](https://github.com/hashicorp/terraform/issues/10482)) - * provider/aws: Added SQS FIFO queues ([#10614](https://github.com/hashicorp/terraform/issues/10614)) - * provider/aws: Addition of suspended_processes to aws_autoscaling_group ([#10096](https://github.com/hashicorp/terraform/issues/10096)) - * provider/aws: added auto_minor_version_upgrade on aws_rds_cluster_insstance ([#10284](https://github.com/hashicorp/terraform/issues/10284)) - * provider/aws: Add JSON validation to the aws_iam_policy resource ([#10239](https://github.com/hashicorp/terraform/issues/10239)) - * provider/aws: Support MFA delete for s3 bucket versioning ([#10020](https://github.com/hashicorp/terraform/issues/10020)) - * provider/aws: Enable DeleteOnTermination in ENI when created by spot fleet ([#9922](https://github.com/hashicorp/terraform/issues/9922)) - * provider/aws: Enforced kms_key_* attributes to be ARNs ([#10356](https://github.com/hashicorp/terraform/issues/10356)) - * provider/aws: IPv6 Support To Cloudfront ([#10332](https://github.com/hashicorp/terraform/issues/10332)) - * provider/aws: Support import of aws_iam_instance_profile ([#10436](https://github.com/hashicorp/terraform/issues/10436)) - * provider/aws: Increase `aws_emr_cluster` timeout ([#10444](https://github.com/hashicorp/terraform/issues/10444)) - * provider/aws: Support Automatic Rollback of CodeDeploy deployments and CloudWatch Alarms for a Deployment Group ([#9039](https://github.com/hashicorp/terraform/issues/9039)) - * provider/aws: Add support for termination protection and autotermination to EMR ([#10252](https://github.com/hashicorp/terraform/issues/10252)) - * provider/aws: Add "no_device" support to ephemeral block devices ([#10547](https://github.com/hashicorp/terraform/issues/10547)) - * provider/aws: Added S3 Bucket replication ([#10552](https://github.com/hashicorp/terraform/issues/10552)) - * provider/aws: Add `pgp_key` to `aws_iam_access_key` to protect key. ([#10615](https://github.com/hashicorp/terraform/issues/10615)) - * provider/azurerm: make DiskSizeGB optional for azurerm_virtual_machine data_disks ([#10232](https://github.com/hashicorp/terraform/issues/10232)) - * provider/azurerm support `license_type` virtual_machine property ([#10539](https://github.com/hashicorp/terraform/issues/10539)) - * provider/azurerm: support import of routes, fix route_table ([#10389](https://github.com/hashicorp/terraform/issues/10389)) - * provider/azurerm: enable import of more resources ([#10195](https://github.com/hashicorp/terraform/issues/10195)) - * provider/azurerm: create common schema for location field, add diff suppress ([#10409](https://github.com/hashicorp/terraform/issues/10409)) - * provider/chef: Migrate Chef to use KEY_MATERIAL rather than using a Pem file ([#10105](https://github.com/hashicorp/terraform/issues/10105)) - * provider/cloudstack: Add option to set a custom `network_domain` for `cloudstack_network` ([#10638](https://github.com/hashicorp/terraform/issues/10638)) - * provider/cloudstack: Support using secondary IP addresses with the `cloudstack_static_nat` resource ([#10420](https://github.com/hashicorp/terraform/issues/10420)) - * provider/cloudstack: Support using secondary IP addresses with the `cloudstack_port_forward` resource ([#10638](https://github.com/hashicorp/terraform/issues/10638)) - * provider/datadog: Make monitor thresholds optional. ([#10526](https://github.com/hashicorp/terraform/issues/10526)) - * provider/datadog: Improve datadog timeboard support ([#10027](https://github.com/hashicorp/terraform/issues/10027)) - * provider/docker: Upload files into container before first start ([#9520](https://github.com/hashicorp/terraform/issues/9520)) - * provider/docker: authentication via values instead of files ([#10151](https://github.com/hashicorp/terraform/issues/10151)) - * provider/fastly add origin shielding ([#10677](https://github.com/hashicorp/terraform/issues/10677)) - * provider/fastly: add ssl_hostname option ([#9629](https://github.com/hashicorp/terraform/issues/9629)) - * provider/github: supports importing resources ([#10382](https://github.com/hashicorp/terraform/issues/10382)) - * provider/google: Add support for Internal Load Balancing ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * provider/google: Add Service Accounts resource ([#9946](https://github.com/hashicorp/terraform/issues/9946)) - * provider/google: Instances and templates now both support `metadata_startup_script` and `metadata.startup-script`. ([#10537](https://github.com/hashicorp/terraform/issues/10537)) - * provider/google: Added support for session affinity to compute_backend_service ([#10387](https://github.com/hashicorp/terraform/issues/10387)) - * provider/google: Projects are now importable ([#10469](https://github.com/hashicorp/terraform/issues/10469)) - * provider/google: SSL certificates can now specify prefix instead of a full name ([#10684](https://github.com/hashicorp/terraform/issues/10684)) - * provider/openstack: Add Swauth/Swift Authentication ([#9943](https://github.com/hashicorp/terraform/issues/9943)) - * provider/openstack: Detect Region for Importing Resources ([#10509](https://github.com/hashicorp/terraform/issues/10509)) - * provider/postgresql: Improved support for many PostgreSQL resources ([#10682](https://github.com/hashicorp/terraform/issues/10682)) - * provider/postgresql: Added 'connect_timeout' argument to provider 'postgresql' ([#10380](https://github.com/hashicorp/terraform/issues/10380)) - * provider/rundeck: enable validation for multiple values in an array ([#8913](https://github.com/hashicorp/terraform/issues/8913)) - * provider/rundeck: Add support for scheduler to rundeck_job ([#9449](https://github.com/hashicorp/terraform/issues/9449)) - * state/remote/swift: Add support for versioning state file in swift and expiring versioned state ([#10055](https://github.com/hashicorp/terraform/issues/10055)) - -BUG FIXES: - - * core: Escape sequences in interpolations work in every case. ([#8709](https://github.com/hashicorp/terraform/issues/8709)) - * core: Maps in outputs with computed values are no longer removed. ([#9549](https://github.com/hashicorp/terraform/issues/9549)) - * core: Direct indexing into a computed list no longer errors. ([#10657](https://github.com/hashicorp/terraform/issues/10657)) - * core: Validate fails on invalid keys in `variable` blocks. ([#10658](https://github.com/hashicorp/terraform/issues/10658)) - * core: Validate that only a single `lifecycle` block exists per rource. ([#10656](https://github.com/hashicorp/terraform/issues/10656)) - * core: When destroying, the resources of a provider that depends on another resource are destroyed first. ([#10659](https://github.com/hashicorp/terraform/issues/10659)) - * core: Catch parse errors for null characters mid-file ([#9134](https://github.com/hashicorp/terraform/issues/9134)) - * core: Remove extra dot from state command backup files ([#10300](https://github.com/hashicorp/terraform/issues/10300)) - * core: Validate data sources do not have provisioners ([#10318](https://github.com/hashicorp/terraform/issues/10318)) - * core: Disable checkpoint settings take effect ([#10206](https://github.com/hashicorp/terraform/issues/10206)) - * core: Changed attribute console output shows up on Windows. ([#10417](https://github.com/hashicorp/terraform/issues/10417)) - * core: Destroying deposed resources in create before destroy waits until the creation step of its specific index. (0.8 regression) ([#10416](https://github.com/hashicorp/terraform/issues/10416)) - * core: Certain invalid configurations will no longer print "illegal". ([#10448](https://github.com/hashicorp/terraform/issues/10448)) - * core: Fix a crash that could occur when multiple deposed instances exist. ([#10504](https://github.com/hashicorp/terraform/issues/10504)) - * core: Fix a diff mismatch error that could happen when a resource depends on a count resource being decreased. ([#10522](https://github.com/hashicorp/terraform/issues/10522)) - * core: On Unix machines if `getent` is not available, fall back to shell to find home dir. ([#10515](https://github.com/hashicorp/terraform/issues/10515)) - * command/fmt: Multiline comments aren't indented every fmt. ([#6524](https://github.com/hashicorp/terraform/issues/6524)) - * communicator/ssh: Avoid race that could cause parallel remote execs on the same host to overwrite each other ([#10549](https://github.com/hashicorp/terraform/issues/10549)) - * provider/aws: Added Lambda function guard when needed attributes are not set ([#10663](https://github.com/hashicorp/terraform/issues/10663)) - * provider/aws: Allow import of aws_security_groups with more than one source_security_group_id rule ([#9477](https://github.com/hashicorp/terraform/issues/9477)) - * provider/aws: Allow setting the DB Instance name when restoring from a snapshot ([#10664](https://github.com/hashicorp/terraform/issues/10664)) - * provider/aws: Fix issue importing `aws_vpc_peering_connection` ([#10635](https://github.com/hashicorp/terraform/issues/10635)) - * provider/aws: Fixed deletion of aws_api_gateway_base_path_mapping with empty path ([#10177](https://github.com/hashicorp/terraform/issues/10177)) - * provider/aws: Fix issue removing Lambda environment variables ([#10492](https://github.com/hashicorp/terraform/issues/10492)) - * provider/aws: Skip VPC endpoint routes when removing default route table's routes ([#10303](https://github.com/hashicorp/terraform/issues/10303)) - * provider/aws: Do not return a root device for instance store backed AMIs. ([#9483](https://github.com/hashicorp/terraform/issues/9483)) - * provider/aws: resource_aws_opsworks_application does not accept document_root parameter ([#10477](https://github.com/hashicorp/terraform/issues/10477)) - * provider/aws: bug fix when specifying level on aws_opsworks_permission ([#10394](https://github.com/hashicorp/terraform/issues/10394)) - * provider/aws: cloudfront distribution 404 should mark as gone ([#10281](https://github.com/hashicorp/terraform/issues/10281)) - * provider/aws: Assign correct number of core instances (n-1) to aws-emr-cluster on update ([#10529](https://github.com/hashicorp/terraform/issues/10529)) - * provider/aws: Allow update of Service role on a CodeDeploy deployment group ([#9866](https://github.com/hashicorp/terraform/issues/9866)) - * provider/aws: fixed the api_gw_domain_name replace operation ([#10179](https://github.com/hashicorp/terraform/issues/10179)) - * provider/aws: Forces the API GW domain name certificates to recreate the resource ([#10588](https://github.com/hashicorp/terraform/issues/10588)) - * provider/aws: Validate `effect` in aws_iam_policy_document data source ([#10021](https://github.com/hashicorp/terraform/issues/10021)) - * provider/azurerm: fix virtual_machine reading plan as the wrong type ([#10626](https://github.com/hashicorp/terraform/issues/10626)) - * provider/azurerm: Prevent null reference when reading boot_diagnostics settings in azurerm_virtual_machine ([#10283](https://github.com/hashicorp/terraform/issues/10283)) - * provider/azurerm: azurerm_availability_set not is ForceNew for UpdateDomain and FaultDomain ([#10545](https://github.com/hashicorp/terraform/issues/10545)) - * provider/azurerm: fix servicebus_topic max_size_in_megabytes for premium namespaces ([#10611](https://github.com/hashicorp/terraform/issues/10611)) - * provider/azurerm: set ForceNew for storage image and OS disk of virtual_machine ([#10340](https://github.com/hashicorp/terraform/issues/10340)) - * provider/datadog: Refactor monitor tags to a list instead of a map. ([#10570](https://github.com/hashicorp/terraform/issues/10570)) - * provider/datadog 9869: Validate credentials when initialising client. ([#10567](https://github.com/hashicorp/terraform/issues/10567)) - * provider/openstack: More Import and Region Fixes ([#10662](https://github.com/hashicorp/terraform/issues/10662)) - * provider/openstack: Fix Ordering of Port Allowed Address Pairs ([#10250](https://github.com/hashicorp/terraform/issues/10250)) - * provider/template: No file path error when setting template to `/` ([#10297](https://github.com/hashicorp/terraform/issues/10297)) - -## 0.8.0 from 0.8.0-rc3 (December 13, 2016) - -**This only includes changes from 0.8.0-rc3 to 0.8.0 final. The section above -has the complete 0.7.x to 0.8.0 CHANGELOG.** - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/postgres: `ssl_mode` has been renamed `sslmode` to match common usage ([#10682](https://github.com/hashicorp/terraform/issues/10682)) - -FEATURES: - - * **New Provider:** `Icinga2` ([#8306](https://github.com/hashicorp/terraform/issues/8306)) - * **New Resource:** `aws_lightsail_domain` ([#10637](https://github.com/hashicorp/terraform/issues/10637)) - * **New Resource:** `aws_lightsail_key_pair` ([#10583](https://github.com/hashicorp/terraform/issues/10583)) - * **New Resource:** `aws_snapshot_create_volume_permission` ([#9891](https://github.com/hashicorp/terraform/issues/9891)) - * **New Resource:** `google_compute_health_check` ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * **New Resource:** `google_compute_region_backend_service` ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * **New Data Source:** `aws_eip` ([#9833](https://github.com/hashicorp/terraform/issues/9833)) - * **New Data Source:** `aws_route53_zone` ([#9766](https://github.com/hashicorp/terraform/issues/9766)) - * **New Data Source:** `aws_vpc_endpoint_services` ([#10261](https://github.com/hashicorp/terraform/issues/10261)) - -IMPROVEMENTS: - - * command/plan: Show warning when a plan file is given as input to make behavior clear. ([#10639](https://github.com/hashicorp/terraform/issues/10639)) - * core: Maps across multiple input sources (files, CLI, env vars) are merged. ([#10654](https://github.com/hashicorp/terraform/issues/10654)) - * provider/aws: Add support for AWS CA Central 1 Region ([#10618](https://github.com/hashicorp/terraform/issues/10618)) - * provider/aws: Added SQS FIFO queues ([#10614](https://github.com/hashicorp/terraform/issues/10614)) - * provider/aws: Support MFA delete for s3 bucket versioning ([#10020](https://github.com/hashicorp/terraform/issues/10020)) - * provider/aws: Enable DeleteOnTermination in ENI when created by spot fleet ([#9922](https://github.com/hashicorp/terraform/issues/9922)) - * provider/cloudstack: Add option to set a custom `network_domain` for `cloudstack_network` ([#10638](https://github.com/hashicorp/terraform/issues/10638)) - * provider/cloudstack: Support using secondary IP addresses with the `cloudstack_port_forward` resource ([#10638](https://github.com/hashicorp/terraform/issues/10638)) - * provider/fastly add origin shielding ([#10677](https://github.com/hashicorp/terraform/issues/10677)) - * provider/google: Add support for Internal Load Balancing ([#10453](https://github.com/hashicorp/terraform/issues/10453)) - * provider/google: SSL certificates can now specify prefix instead of a full name ([#10684](https://github.com/hashicorp/terraform/issues/10684)) - * provider/postgresql: Improved support for many PostgreSQL resources ([#10682](https://github.com/hashicorp/terraform/issues/10682)) - * provider/rundeck: enable validation for multiple values in an array ([#8913](https://github.com/hashicorp/terraform/issues/8913)) - * provider/rundeck: Add support for scheduler to rundeck_job ([#9449](https://github.com/hashicorp/terraform/issues/9449)) - -BUG FIXES: - - * core: Direct indexing into a computed list no longer errors. ([#10657](https://github.com/hashicorp/terraform/issues/10657)) - * core: Validate fails on invalid keys in `variable` blocks. ([#10658](https://github.com/hashicorp/terraform/issues/10658)) - * core: Validate that only a single `lifecycle` block exists per rource. ([#10656](https://github.com/hashicorp/terraform/issues/10656)) - * core: When destroying, the resources of a provider that depends on another resource are destroyed first. ([#10659](https://github.com/hashicorp/terraform/issues/10659)) - * provider/aws: Added Lambda function guard when needed attributes are not set ([#10663](https://github.com/hashicorp/terraform/issues/10663)) - * provider/aws: Allow import of aws_security_groups with more than one source_security_group_id rule ([#9477](https://github.com/hashicorp/terraform/issues/9477)) - * provider/aws: Allow setting the DB Instance name when restoring from a snapshot ([#10664](https://github.com/hashicorp/terraform/issues/10664)) - * provider/aws: Fix issue importing `aws_vpc_peering_connection` ([#10635](https://github.com/hashicorp/terraform/issues/10635)) - * provider/aws: Fixed deletion of aws_api_gateway_base_path_mapping with empty path ([#10177](https://github.com/hashicorp/terraform/issues/10177)) - * provider/aws: Fix issue removing Lambda environment variables ([#10492](https://github.com/hashicorp/terraform/issues/10492)) - * provider/azurerm: fix virtual_machine reading plan as the wrong type ([#10626](https://github.com/hashicorp/terraform/issues/10626)) - * provider/azurerm: set ForceNew for storage image and OS disk of virtual_machine ([#10340](https://github.com/hashicorp/terraform/issues/10340)) - * provider/openstack: More Import and Region Fixes ([#10662](https://github.com/hashicorp/terraform/issues/10662)) - -## 0.8.0-rc3 (December 8, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * Variable, resource, provider, and module names may no longer start with - a number or hyphen. Please see the upgrade guide for more information. - -FEATURES: - - * **New Provider:** `external` ([#8768](https://github.com/hashicorp/terraform/issues/8768)) - * **New Provider:** `Rancher` ([#9173](https://github.com/hashicorp/terraform/issues/9173)) - * **New Data Source:** `aws_iam_server_certificate` ([#10558](https://github.com/hashicorp/terraform/issues/10558)) - * **New Data Source:** `pagerduty_user` ([#10541](https://github.com/hashicorp/terraform/issues/10541)) - * **New Resource:** `aws_opsworks_rds_db_instance` ([#10294](https://github.com/hashicorp/terraform/issues/10294)) - * **New Resource:** `aws_vpc_endpoint_route_table_association` ([#10137](https://github.com/hashicorp/terraform/issues/10137)) -  * **New Resource:**  `aws_lightsail_instance` ([#10473](https://github.com/hashicorp/terraform/issues/10473)) -IMPROVEMENTS: - - * core: SIGTERM also triggers graceful shutdown in addition to SIGINT ([#10534](https://github.com/hashicorp/terraform/issues/10534)) - * provider/aws: Add support for termination protection and autotermination to EMR ([#10252](https://github.com/hashicorp/terraform/issues/10252)) - * provider/aws: Add "no_device" support to ephemeral block devices ([#10547](https://github.com/hashicorp/terraform/issues/10547)) - * provider/aws: Added S3 Bucket replication ([#10552](https://github.com/hashicorp/terraform/issues/10552)) - * provider/aws: Add `pgp_key` to `aws_iam_access_key` to protect key. ([#10615](https://github.com/hashicorp/terraform/issues/10615)) - * provider/azurerm: make DiskSizeGB optional for azurerm_virtual_machine data_disks ([#10232](https://github.com/hashicorp/terraform/issues/10232)) - * provider/azurerm support `license_type` virtual_machine property ([#10539](https://github.com/hashicorp/terraform/issues/10539)) - * provider/datadog: Make monitor thresholds optional. ([#10526](https://github.com/hashicorp/terraform/issues/10526)) - * provider/datadog: Improve datadog timeboard support ([#10027](https://github.com/hashicorp/terraform/issues/10027)) - * provider/docker: Upload files into container before first start ([#9520](https://github.com/hashicorp/terraform/issues/9520)) - * provider/fastly: add ssl_hostname option ([#9629](https://github.com/hashicorp/terraform/issues/9629)) - * provider/openstack: Detect Region for Importing Resources ([#10509](https://github.com/hashicorp/terraform/issues/10509)) - * provider/google: Instances and templates now both support `metadata_startup_script` and `metadata.startup-script`. ([#10537](https://github.com/hashicorp/terraform/issues/10537)) - -BUG FIXES: - - * core: Fix a diff mismatch error that could happen when a resource depends on a count resource being decreased. ([#10522](https://github.com/hashicorp/terraform/issues/10522)) - * core: On Unix machines if `getent` is not available, fall back to shell to find home dir. ([#10515](https://github.com/hashicorp/terraform/issues/10515)) - * communicator/ssh: Avoid race that could cause parallel remote execs on the same host to overwrite each other ([#10549](https://github.com/hashicorp/terraform/issues/10549)) - * provider/aws: cloudfront distribution 404 should mark as gone ([#10281](https://github.com/hashicorp/terraform/issues/10281)) - * provider/aws: Assign correct number of core instances (n-1) to aws-emr-cluster on update ([#10529](https://github.com/hashicorp/terraform/issues/10529)) - * provider/aws: Allow update of Service role on a CodeDeploy deployment group ([#9866](https://github.com/hashicorp/terraform/issues/9866)) - * provider/aws: fixed the api_gw_domain_name replace operation ([#10179](https://github.com/hashicorp/terraform/issues/10179)) - * provider/aws: Forces the API GW domain name certificates to recreate the resource ([#10588](https://github.com/hashicorp/terraform/issues/10588)) - * provider/aws: Validate `effect` in aws_iam_policy_document data source ([#10021](https://github.com/hashicorp/terraform/issues/10021)) - * provider/azurem: azurerm_availability_set not is ForceNew for UpdateDomain and FaultDomain ([#10545](https://github.com/hashicorp/terraform/issues/10545)) - * provider/azurerm: fix servicebus_topic max_size_in_megabytes for premium namespaces ([#10611](https://github.com/hashicorp/terraform/issues/10611)) - * provider/datadog: Refactor monitor tags to a list instead of a map. ([#10570](https://github.com/hashicorp/terraform/issues/10570)) - * provider/datadog 9869: Validate credentials when initialising client. ([#10567](https://github.com/hashicorp/terraform/issues/10567)) - * provider/openstack: Fix Ordering of Port Allowed Address Pairs ([#10250](https://github.com/hashicorp/terraform/issues/10250)) - -## 0.8.0-rc2 (December 2, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * Strings in configuration can no longer contain unescaped newlines. For unescaped newlines, heredocs must be used - * provider/aws: Anywhere where we can specify kms_key_id must now be a valid KMS Key ID ARN to stop continual diffs - -FEATURES: - - * **New DataSource:** `aws_route_table` ([#10301](https://github.com/hashicorp/terraform/issues/10301)) - * **New Interpolation Function:** `timestamp` ([#10475](https://github.com/hashicorp/terraform/issues/10475)) - -IMPROVEMENTS: - - * core: Plan will show deposed-only destroys for create-before-destroy resources. ([#10404](https://github.com/hashicorp/terraform/issues/10404)) - * provider/aws: Enforced kms_key_* attributes to be ARNs ([#10356](https://github.com/hashicorp/terraform/issues/10356)) - * provider/aws: IPv6 Support To Cloudfront ([#10332](https://github.com/hashicorp/terraform/issues/10332)) - * provider/aws: Support import of aws_iam_instance_profile ([#10436](https://github.com/hashicorp/terraform/issues/10436)) - * provider/aws: Increase `aws_emr_cluster` timeout ([#10444](https://github.com/hashicorp/terraform/issues/10444)) - * provider/aws: Support Automatic Rollback of CodeDeploy deployments and CloudWatch Alarms for a Deployment Group ([#9039](https://github.com/hashicorp/terraform/issues/9039)) - * provider/aws: Allow importing of aws_iam_role, aws_iam_role_policy and aws_iam_policy ([#9398](https://github.com/hashicorp/terraform/issues/9398)) - * provider/aws: Added s3 bucket region attribute management ([#10482](https://github.com/hashicorp/terraform/issues/10482)) - * provider/azurerm: support import of routes, fix route_table ([#10389](https://github.com/hashicorp/terraform/issues/10389)) - * provider/azurerm: create common schema for location field, add diff suppress ([#10409](https://github.com/hashicorp/terraform/issues/10409)) - * provider/github: supports importing resources ([#10382](https://github.com/hashicorp/terraform/issues/10382)) - * provider/postgresql: Added 'connect_timeout' argument to provider 'postgresql' ([#10380](https://github.com/hashicorp/terraform/issues/10380)) - * provider/cloudstack: Support using secondary IP addresses with the `cloudstack_static_nat` resource ([#10420](https://github.com/hashicorp/terraform/issues/10420)) - * provider/google: Added support for session affinity to compute_backend_service ([#10387](https://github.com/hashicorp/terraform/issues/10387)) - * provider/google: Projects are now importable ([#10469](https://github.com/hashicorp/terraform/issues/10469)) - -BUG FIXES: - - * core: Changed attribute console output shows up on Windows. ([#10417](https://github.com/hashicorp/terraform/issues/10417)) - * core: Destroying deposed resources in create before destroy waits until the creation step of its specific index. (0.8 regression) ([#10416](https://github.com/hashicorp/terraform/issues/10416)) - * core: Certain invalid configurations will no longer print "illegal". ([#10448](https://github.com/hashicorp/terraform/issues/10448)) - * core: Fix a crash that could occur when multiple deposed instances exist. ([#10504](https://github.com/hashicorp/terraform/issues/10504)) - * command/console: variable access works ([#10446](https://github.com/hashicorp/terraform/issues/10446)) - * provider/aws: Do not return a root device for instance store backed AMIs. ([#9483](https://github.com/hashicorp/terraform/issues/9483)) - * provider/aws: resource_aws_opsworks_application does not accept document_root parameter ([#10477](https://github.com/hashicorp/terraform/issues/10477)) - * provider/aws: bug fix when specifying level on aws_opsworks_permission ([#10394](https://github.com/hashicorp/terraform/issues/10394)) - -## 0.8.0-rc1 (November 23, 2016) - -BASED ON: 0.7.13 (includes any changes up to that point as well) - -**Please read prior beta notes, as those are also included. The 0.8 changes -will be coalesced for a 0.8 final, but will remain separate for the pre-release -period.** - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * The chef provider now accepts `key_material` as an alternative to `private_key_pem`. The `private_key_pem` attribute will be deprecated in a future release - * The `template_file` resource no longer accepts a direct file path for the `template` attribute. You may either specify a path wrapped in a `file` function or specify a file path with the `filepath` attribute. This was deprecated during 0.7.x. - -FEATURES: - * core: allow outputs to have descriptions ([#9722](https://github.com/hashicorp/terraform/issues/9722)) - * state/azure: support passing of lease ID when writing storage blob ([#10115](https://github.com/hashicorp/terraform/issues/10115)) - * **New Resource:** `aws_ebs_snapshot` ([#10017](https://github.com/hashicorp/terraform/issues/10017)) - * **New Resource:** `openstack_blockstorage_volume_attach_v2` ([#10259](https://github.com/hashicorp/terraform/issues/10259)) - * **New Resource:** `openstack_compute_volume_attach_v2` ([#10260](https://github.com/hashicorp/terraform/issues/10260)) - * **New Data Source:** `aws_ebs_snapshot` ([#10017](https://github.com/hashicorp/terraform/issues/10017)) - * The `import` command can now specify a provider alias to use. ([#10310](https://github.com/hashicorp/terraform/issues/10310)) - -IMPROVEMENTS: - - * provider/aws: Addition of suspended_processes to aws_autoscaling_group ([#10096](https://github.com/hashicorp/terraform/issues/10096)) - * provider/aws: added auto_minor_version_upgrade on aws_rds_cluster_insstance ([#10284](https://github.com/hashicorp/terraform/issues/10284)) - * provider/aws: Add JSON validation to the aws_iam_policy resource ([#10239](https://github.com/hashicorp/terraform/issues/10239)) - * provider/azurerm: enable import of more resources ([#10195](https://github.com/hashicorp/terraform/issues/10195)) - * provider/chef: Migrate Chef to use KEY_MATERIAL rather than using a Pem file ([#10105](https://github.com/hashicorp/terraform/issues/10105)) - * provider/docker: authentication via values instead of files ([#10151](https://github.com/hashicorp/terraform/issues/10151)) - * provider/google: Add Service Accounts resource ([#9946](https://github.com/hashicorp/terraform/issues/9946)) - * provider/nomad: Update to support Nomad 0.5.0 - * provider/openstack: Add Swauth/Swift Authentication ([#9943](https://github.com/hashicorp/terraform/issues/9943)) - * state/remote/swift: Add support for versioning state file in swift and expiring versioned state ([#10055](https://github.com/hashicorp/terraform/issues/10055)) - -BUG FIXES: - - * core: Catch parse errors for null characters mid-file ([#9134](https://github.com/hashicorp/terraform/issues/9134)) - * core: escape sequence for " works (0.8 beta regression) ([#10236](https://github.com/hashicorp/terraform/issues/10236)) - * core: Terraform starts on Windows (0.8 beta2 regression) ([#10266](https://github.com/hashicorp/terraform/issues/10266)) - * core: Remove extra dot from state command backup files ([#10300](https://github.com/hashicorp/terraform/issues/10300)) - * core: Validate data sources do not have provisioners ([#10318](https://github.com/hashicorp/terraform/issues/10318)) - * core: Disable checkpoint settings take effect ([#10206](https://github.com/hashicorp/terraform/issues/10206)) - * provider/aws: Skip VPC endpoint routes when removing default route table's routes ([#10303](https://github.com/hashicorp/terraform/issues/10303)) - * provider/azurerm: Prevent null reference when reading boot_diagnostics settings in azurerm_virtual_machine ([#10283](https://github.com/hashicorp/terraform/issues/10283)) - * provider/template: No file path error when setting template to `/` ([#10297](https://github.com/hashicorp/terraform/issues/10297)) - -PLUGIN CHANGES: - - * The protocol version has been incremented, requiring all plugins for - 0.8 to be built with 0.8 sources (or newer). This should only require - a simple recompile for compatibility. - -## 0.8.0-beta2 (November 16, 2016) - -BASED ON: 0.7.11 (includes any changes up to that point as well) - -**Please read prior beta notes, as those are also included. The 0.8 changes -will be coalesced for a 0.8 final, but will remain separate for the pre-release -period.** - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * Math operators now follow the standard order of operations: *, /, % followed - by +, -. See the updated interpolation docs for more information. You can - continue to force ordering with parentheses. - -FEATURES: - - * **New command:** `terraform console`, an interactive console for experimenting - with and using interpolations. ([#10093](https://github.com/hashicorp/terraform/issues/10093)) - * **Terraform version requirement in configuration.** You can now specify - a Terraform version requirement in configuration and modules. ([#10080](https://github.com/hashicorp/terraform/issues/10080)) - * **`depends_on` can reference modules.** This allows a resource or output - to depend on everything within a module. ([#10076](https://github.com/hashicorp/terraform/issues/10076)) - * **`output` supports `depends_on`.** This is useful when the output depends - on a certain ordering to happen that can't be represented with interpolations. - ([#10072](https://github.com/hashicorp/terraform/issues/10072)) - -## 0.8.0-beta1 (November 11, 2016) - -BASED ON: 0.7.10 (includes any changes up to that point as well) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * `template_file` _inline_ templates must escape their variable usage. What - was previously `${foo}` must now be `$${foo}`. Note that this is only - for _inline_ templates. Templates read from files are unchanged. ([#9698](https://github.com/hashicorp/terraform/issues/9698)) - * Escape sequences used to require double-escaping when used within interpolations. - You now must only escape once (which is the expected/typical behavior). - For example: `${replace(var.foo, "\\", "\\\\")}` is correct. Before, - that would cause very strange behavior. However, this may break existing - configurations which found a level of escape sequences to work. Check - `terraform plan` for incorrect output. - -FEATURES: - - * **New provider:** `nomad` ([#9538](https://github.com/hashicorp/terraform/issues/9538)) - * **New provider:** `vault` ([#9158](https://github.com/hashicorp/terraform/issues/9158)) - * The `import` command will now read provider configuration from Terraform - configuration files (including loading tfvars files and so on). ([#9809](https://github.com/hashicorp/terraform/issues/9809)) - * Providers and resources are now notified by Terraform core to "stop" when - an interrupt is received, allowing resources to gracefully exit much, much - faster. ([#9607](https://github.com/hashicorp/terraform/issues/9607)) - -IMPROVEMENTS: - - * core: Human-friendly error when a computed count is used. ([#10060](https://github.com/hashicorp/terraform/issues/10060)) - * helper/schema: only map, list, and set elements that are actually causing - a resource to destroy/create are marked as "requires new". ([#9613](https://github.com/hashicorp/terraform/issues/9613)) - -BUG FIXES: - - * core: Escape sequences in interpolations work in every case. ([#8709](https://github.com/hashicorp/terraform/issues/8709)) - * core: Maps in outputs with computed values are no longer removed. ([#9549](https://github.com/hashicorp/terraform/issues/9549)) - * command/fmt: Multiline comments aren't indented every fmt. ([#6524](https://github.com/hashicorp/terraform/issues/6524)) - -## 0.7.13 (November 23, 2016) - -BUG FIXES: - - * core: New graph records dependencies for explicit self references ([#10319](https://github.com/hashicorp/terraform/issues/10319)) - -## 0.7.12 (November 22, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/cloudstack: `cloudstack_static_nat` has now deprecated `network_id` ([#10204](https://github.com/hashicorp/terraform/issues/10204)) - -FEATURES: - - * *New Data Source:* `aws_alb_listener` ([#10181](https://github.com/hashicorp/terraform/issues/10181)) - * *New Resource:* `github_label` ([#10213](https://github.com/hashicorp/terraform/issues/10213)) - -IMPROVEMENTS: - - * core: Experimental feature failures are less verbose. ([#10276](https://github.com/hashicorp/terraform/issues/10276)) - * provider/aws: Add name_prefix to aws_iam_policy ([#10178](https://github.com/hashicorp/terraform/issues/10178)) - * provider/aws: Add ability to select aws_prefix_list data source by name ([#10248](https://github.com/hashicorp/terraform/issues/10248)) - * provider/aws Return service CIDR blocks from aws_vpc_endpoint resource ([#10254](https://github.com/hashicorp/terraform/issues/10254)) - * provider/aws: Added `environment` configuration for AWS Lambda Functions ([#10275](https://github.com/hashicorp/terraform/issues/10275)) - -BUG FIXES: - - * core: Fix potential crashing race condition on state write ([#10277](https://github.com/hashicorp/terraform/issues/10277)) - * core: Data sources in modules lose their `data.` prefix when moved within the state ([#9996](https://github.com/hashicorp/terraform/issues/9996)) - * provider/aws: Fixed issue with `enable_dns_support` on creation in `aws_vpc` ([#10171](https://github.com/hashicorp/terraform/issues/10171)) - * provider/aws: Add CertificateNotFound retry waiter to aws_alb_listener ([#10180](https://github.com/hashicorp/terraform/issues/10180)) - * provider/aws: Remove IAM user's MFA devices with `force_destroy` ([#10262](https://github.com/hashicorp/terraform/issues/10262)) - * provider/scaleway: improve volume attachment ([#10084](https://github.com/hashicorp/terraform/issues/10084)) - -## 0.7.11 (November 15, 2016) - -FEATURES: - -IMPROVEMENTS: - - * provider/aws: Expose RDS DB Instance HostedZoneId attribute ([#10000](https://github.com/hashicorp/terraform/issues/10000)) - * provider/aws: Ignore AWS internal tags ([#7454](https://github.com/hashicorp/terraform/issues/7454)) - * provider/aws: Exposed aws_iam_role create_date attribute ([#10091](https://github.com/hashicorp/terraform/issues/10091)) - * provider/aws: Added aws_api_gateway_api_key created_date & last_updated_date attributes ([#9530](https://github.com/hashicorp/terraform/issues/9530)) - * provider/aws: Added aws_api_gateway_rest_api created_date attribute ([#9532](https://github.com/hashicorp/terraform/issues/9532)) - * provider/aws: Exposed aws_api_gateway_deployment.created_date attribute ([#9534](https://github.com/hashicorp/terraform/issues/9534)) - * provider/aws: Added `retry_duration` to `redshift_configuration` in `kinesis_firehose_delivery_stream` ([#10113](https://github.com/hashicorp/terraform/issues/10113)) - * provider/azurerm: allow updating load balancer sub-resources ([#10016](https://github.com/hashicorp/terraform/issues/10016)) - * provider/openstack: Instance `user_data` will now detect if input is already Base64-encode ([#9966](https://github.com/hashicorp/terraform/issues/9966)) - -BUG FIXES: - - * core: Fix diff mismatch error on "Destroy: true to false" scenarios. ([#10139](https://github.com/hashicorp/terraform/issues/10139)) - * core: New destroy graph `-target` includes dependencies. ([#10036](https://github.com/hashicorp/terraform/issues/10036)) - * core: New destroy graph creates proper edges through module outputs ([#10068](https://github.com/hashicorp/terraform/issues/10068)) - * core: Fix shadow error when using uuid() ([#10106](https://github.com/hashicorp/terraform/issues/10106)) - * core: Fix an issue where applies with data sources could hang ([#10134](https://github.com/hashicorp/terraform/issues/10134)) - * core: Fix plan operation diff mismatch for computed keys in slices ([#10118](https://github.com/hashicorp/terraform/issues/10118)) - * provider/aws: fix the validation of aws_redshift_cluster database_name ([#10019](https://github.com/hashicorp/terraform/issues/10019)) - * provider/aws: Fix panic in aws_acm_certificate datasource ([#10051](https://github.com/hashicorp/terraform/issues/10051)) - * provider/aws: increase aws_lambda_function timeout ([#10116](https://github.com/hashicorp/terraform/issues/10116)) - * provider/aws: Fixed ES buffering_interval option in `kinesis_firehose_delivery_stream` ([#10112](https://github.com/hashicorp/terraform/issues/10112)) - -## 0.7.10 (November 9, 2016) - -FEATURES: - - * **New Resource:** `azurerm_eventhub` ([#9889](https://github.com/hashicorp/terraform/issues/9889)) - * **New Resource:** `azurerm_virtual_machine_extension` ([#9962](https://github.com/hashicorp/terraform/issues/9962)) - * **Experimental new plan graph:** `terraform plan` is getting a new graph - creation process for 0.8. This is now available behind a flag `-Xnew-apply` - (on any command). This will become the default in 0.8. There may still be - bugs. ([#9973](https://github.com/hashicorp/terraform/issues/9973)) - -IMPROVEMENTS: - - * provider/aws: Add support for Service Access Security Group in `aws_emr_cluster` ([#9600](https://github.com/hashicorp/terraform/issues/9600)) - * provider/aws: Add Enhanced VPC routing to Redshift ([#9950](https://github.com/hashicorp/terraform/issues/9950)) - * provider/aws: Add key_name_prefix argument to aws_key_pair resource ([#9993](https://github.com/hashicorp/terraform/issues/9993)) - * provider/openstack: Add `value_specs` to `openstack_fw_policy_v1` resource, allowing vendor information ([#9835](https://github.com/hashicorp/terraform/issues/9835)) - * provider/openstack: Add `value_specs` to `openstack_fw_firewall_v1` resource, allowing vendor information ([#9836](https://github.com/hashicorp/terraform/issues/9836)) - * provider/random: The `b64` attribute on `random_id` resources is deprecated, replaced by `b64_url` and `b64_std` ([#9903](https://github.com/hashicorp/terraform/issues/9903)) - -BUG FIXES: - - * core: Splat variables (`foo.*.bar`) are now ordered by count index for deterministic ordering. ([#9883](https://github.com/hashicorp/terraform/issues/9883)) - * core: Prune orphan outputs (in the config but not in the state). ([#9971](https://github.com/hashicorp/terraform/issues/9971)) - * core: New apply graph doesn't prune module variables as aggressively. ([#9898](https://github.com/hashicorp/terraform/issues/9898)) - * core: New apply graph properly configures providers with aliases. ([#9894](https://github.com/hashicorp/terraform/issues/9894)) - * core: New destroy graph doesn't create edge loops to destroy nodes that reference themselves. ([#9968](https://github.com/hashicorp/terraform/issues/9968)) - * provider/aws: Fix crash when adding EBS volumes to spot fleet request. ([#9857](https://github.com/hashicorp/terraform/issues/9857)) - * provider/aws: Ignore NoSuchEntity error when IAM user does not have login profile ([#9900](https://github.com/hashicorp/terraform/issues/9900)) - * provider/aws: Setting static_routes_only on import of vpn_connection ([#9802](https://github.com/hashicorp/terraform/issues/9802)) - * provider/aws: aws_alb_target_group arn_suffix missing the targetgroup ([#9911](https://github.com/hashicorp/terraform/issues/9911)) - * provider/aws: Fix the validateFunc of aws_elasticache_replication_group ([#9918](https://github.com/hashicorp/terraform/issues/9918)) - * provider/aws: removing toLower when setting aws_db_parameter_group options ([#9820](https://github.com/hashicorp/terraform/issues/9820)) - * provider/aws: Fix panic when passing statuses to aws_acm_certificate ([#9990](https://github.com/hashicorp/terraform/issues/9990)) - * provider/aws: AWS IAM, User and Role allow + in the name ([#9991](https://github.com/hashicorp/terraform/issues/9991)) - * provider/scaleway: retry volume attachment ([#9972](https://github.com/hashicorp/terraform/issues/9972)) - * provider/scaleway: fix `scaleway_image` datasource returning unknown images ([#9899](https://github.com/hashicorp/terraform/issues/9899)) - * provider/google: fix crash when mistakenly configuring disks ([#9942](https://github.com/hashicorp/terraform/issues/9942)) - -## 0.7.9 (November 4, 2016) - -FEATURES: - - * **New Data Source:** `aws_acm_certificate` ([#8359](https://github.com/hashicorp/terraform/issues/8359)) - * **New Resource:** `aws_autoscaling_attachment` ([#9146](https://github.com/hashicorp/terraform/issues/9146)) - * **New Resource:** `postgresql_extension` ([#9210](https://github.com/hashicorp/terraform/issues/9210)) - -IMPROVEMENTS: - - * core: Improve shadow graph robustness by catching panics during graph evaluation. ([#9852](https://github.com/hashicorp/terraform/issues/9852)) - * provider/aws: Provide the option to skip_destroy on aws_volume_attachment ([#9792](https://github.com/hashicorp/terraform/issues/9792)) - * provider/aws: Allows aws_alb security_groups to be updated ([#9804](https://github.com/hashicorp/terraform/issues/9804)) - * provider/aws: Add the enable_sni attribute for Route53 health checks. ([#9822](https://github.com/hashicorp/terraform/issues/9822)) - * provider/openstack: Add `value_specs` to openstack_fw_rule_v1 resource, allowing vendor information ([#9834](https://github.com/hashicorp/terraform/issues/9834)) - * state/remote/swift: Enable OpenStack Identity/Keystone v3 authentication ([#9769](https://github.com/hashicorp/terraform/issues/9769)) - * state/remote/swift: Now supports all login/config options that the OpenStack Provider supports ([#9777](https://github.com/hashicorp/terraform/issues/9777)) - -BUG FIXES: - - * core: Provisioners in modules do not crash during `apply` (regression). ([#9846](https://github.com/hashicorp/terraform/issues/9846)) - * core: Computed bool fields with non-bool values will not crash ([#9812](https://github.com/hashicorp/terraform/issues/9812)) - * core: `formatlist` interpolation function accepts an empty list ([#9795](https://github.com/hashicorp/terraform/issues/9795)) - * core: Validate outputs have a name ([#9823](https://github.com/hashicorp/terraform/issues/9823)) - * core: Validate variables have a name ([#9818](https://github.com/hashicorp/terraform/issues/9818)) - * command/apply: If a partial set of required variables are provided with `-var`, ask for the remainder ([#9794](https://github.com/hashicorp/terraform/issues/9794)) - * command/fmt: Multiline strings aren't erroneously indented ([#9859](https://github.com/hashicorp/terraform/issues/9859)) - * provider/aws: Fix issue setting `certificate_upload_date` in `aws_api_gateway_domain_name` ([#9815](https://github.com/hashicorp/terraform/issues/9815)) - * provider/azurerm: allow storage_account resource with name "$root" ([#9813](https://github.com/hashicorp/terraform/issues/9813)) - * provider/google: fix for looking up project image families ([#9243](https://github.com/hashicorp/terraform/issues/9243)) - * provider/openstack: Don't pass `shared` in FWaaS Policy unless it's set ([#9830](https://github.com/hashicorp/terraform/issues/9830)) - * provider/openstack: openstack_fw_firewall_v1 `admin_state_up` should default to true ([#9832](https://github.com/hashicorp/terraform/issues/9832)) - -PLUGIN CHANGES: - - * Fields in resources can now have both `Optional` and `ConflictsWith` ([#9825](https://github.com/hashicorp/terraform/issues/9825)) - -## 0.7.8 (November 1, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/openstack: The OpenStack provider has switched to the new Gophercloud SDK. - No front-facing changes were made, but please be aware that there might be bugs. - Please report any if found. - * `archive_file` is now a data source, instead of a resource ([#8492](https://github.com/hashicorp/terraform/issues/8492)) - -FEATURES: - - * **Experimental new apply graph:** `terraform apply` is getting a new graph - creation process for 0.8. This is now available behind a flag `-Xnew-apply` - (on any command). This will become the default in 0.8. There may still be - bugs. ([#9388](https://github.com/hashicorp/terraform/issues/9388)) - * **Experimental new destroy graph:** `terraform destroy` is also getting - a new graph creation process for 0.8. This is now available behind a flag - `-Xnew-destroy`. This will become the default in 0.8. ([#9527](https://github.com/hashicorp/terraform/issues/9527)) - * **New Provider:** `pagerduty` ([#9022](https://github.com/hashicorp/terraform/issues/9022)) - * **New Resource:** `aws_iam_user_login_profile` ([#9605](https://github.com/hashicorp/terraform/issues/9605)) - * **New Resource:** `aws_waf_ipset` ([#8852](https://github.com/hashicorp/terraform/issues/8852)) - * **New Resource:** `aws_waf_rule` ([#8852](https://github.com/hashicorp/terraform/issues/8852)) - * **New Resource:** `aws_waf_web_acl` ([#8852](https://github.com/hashicorp/terraform/issues/8852)) - * **New Resource:** `aws_waf_byte_match_set` ([#9681](https://github.com/hashicorp/terraform/issues/9681)) - * **New Resource:** `aws_waf_size_constraint_set` ([#9689](https://github.com/hashicorp/terraform/issues/9689)) - * **New Resource:** `aws_waf_sql_injection_match_set` ([#9709](https://github.com/hashicorp/terraform/issues/9709)) - * **New Resource:** `aws_waf_xss_match_set` ([#9710](https://github.com/hashicorp/terraform/issues/9710)) - * **New Resource:** `aws_ssm_activation` ([#9111](https://github.com/hashicorp/terraform/issues/9111)) - * **New Resource:** `azurerm_key_vault` ([#9478](https://github.com/hashicorp/terraform/issues/9478)) - * **New Resource:** `azurerm_storage_share` ([#8674](https://github.com/hashicorp/terraform/issues/8674)) - * **New Resource:** `azurerm_eventhub_namespace` ([#9297](https://github.com/hashicorp/terraform/issues/9297)) - * **New Resource:** `cloudstack_security_group` ([#9103](https://github.com/hashicorp/terraform/issues/9103)) - * **New Resource:** `cloudstack_security_group_rule` ([#9645](https://github.com/hashicorp/terraform/issues/9645)) - * **New Resource:** `cloudstack_private_gateway` ([#9637](https://github.com/hashicorp/terraform/issues/9637)) - * **New Resource:** `cloudstack_static_route` ([#9637](https://github.com/hashicorp/terraform/issues/9637)) - * **New DataSource:** `aws_ebs_volume` ([#9753](https://github.com/hashicorp/terraform/issues/9753)) - * **New DataSource:** `aws_prefix_list` ([#9566](https://github.com/hashicorp/terraform/issues/9566)) - * **New DataSource:** `aws_security_group` ([#9604](https://github.com/hashicorp/terraform/issues/9604)) - * **New DataSource:** `azurerm_client_config` ([#9478](https://github.com/hashicorp/terraform/issues/9478)) - * **New Interpolation Function:** `ceil` ([#9692](https://github.com/hashicorp/terraform/issues/9692)) - * **New Interpolation Function:** `floor` ([#9692](https://github.com/hashicorp/terraform/issues/9692)) - * **New Interpolation Function:** `min` ([#9692](https://github.com/hashicorp/terraform/issues/9692)) - * **New Interpolation Function:** `max` ([#9692](https://github.com/hashicorp/terraform/issues/9692)) - * **New Interpolation Function:** `title` ([#9087](https://github.com/hashicorp/terraform/issues/9087)) - * **New Interpolation Function:** `zipmap` ([#9627](https://github.com/hashicorp/terraform/issues/9627)) - -IMPROVEMENTS: - - * provider/aws: No longer require `route_table_ids` list in `aws_vpc_endpoint` resources ([#9357](https://github.com/hashicorp/terraform/issues/9357)) - * provider/aws: Allow `description` in `aws_redshift_subnet_group` to be modified ([#9515](https://github.com/hashicorp/terraform/issues/9515)) - * provider/aws: Add tagging support to aws_redshift_subnet_group ([#9504](https://github.com/hashicorp/terraform/issues/9504)) - * provider/aws: Add validation to IAM User and Group Name ([#9584](https://github.com/hashicorp/terraform/issues/9584)) - * provider/aws: Add Ability To Enable / Disable ALB AccessLogs ([#9290](https://github.com/hashicorp/terraform/issues/9290)) - * provider/aws: Add support for `AutoMinorVersionUpgrade` to aws_elasticache_replication_group resource. ([#9657](https://github.com/hashicorp/terraform/issues/9657)) - * provider/aws: Fix import of RouteTable with destination prefixes ([#9686](https://github.com/hashicorp/terraform/issues/9686)) - * provider/aws: Add support for reference_name to aws_route53_health_check ([#9737](https://github.com/hashicorp/terraform/issues/9737)) - * provider/aws: Expose ARN suffix on ALB Target Group ([#9734](https://github.com/hashicorp/terraform/issues/9734)) - * provider/azurerm: add account_kind and access_tier to storage_account ([#9408](https://github.com/hashicorp/terraform/issues/9408)) - * provider/azurerm: write load_balanacer attributes to network_interface_card hash ([#9207](https://github.com/hashicorp/terraform/issues/9207)) - * provider/azurerm: Add disk_size_gb param to VM storage_os_disk ([#9200](https://github.com/hashicorp/terraform/issues/9200)) - * provider/azurerm: support importing of subnet resource ([#9646](https://github.com/hashicorp/terraform/issues/9646)) - * provider/azurerm: Add support for *all* of the Azure regions e.g. Germany, China and Government ([#9765](https://github.com/hashicorp/terraform/issues/9765)) - * provider/digitalocean: Allow resizing DigitalOcean Droplets without increasing disk size. ([#9573](https://github.com/hashicorp/terraform/issues/9573)) - * provider/google: enhance service scope list ([#9442](https://github.com/hashicorp/terraform/issues/9442)) - * provider/google Change default MySQL instance version to 5.6 ([#9674](https://github.com/hashicorp/terraform/issues/9674)) - * provider/google Support MySQL 5.7 instances ([#9673](https://github.com/hashicorp/terraform/issues/9673)) - * provider/google: Add support for using source_disk to google_compute_image ([#9614](https://github.com/hashicorp/terraform/issues/9614)) - * provider/google: Add support for default-internet-gateway alias for google_compute_route ([#9676](https://github.com/hashicorp/terraform/issues/9676)) - * provider/openstack: Added value_specs to openstack_networking_port_v2, allowing vendor information ([#9551](https://github.com/hashicorp/terraform/issues/9551)) - * provider/openstack: Added value_specs to openstack_networking_floatingip_v2, allowing vendor information ([#9552](https://github.com/hashicorp/terraform/issues/9552)) - * provider/openstack: Added value_specs to openstack_compute_keypair_v2, allowing vendor information ([#9554](https://github.com/hashicorp/terraform/issues/9554)) - * provider/openstack: Allow any protocol in openstack_fw_rule_v1 ([#9617](https://github.com/hashicorp/terraform/issues/9617)) - * provider/openstack: expose LoadBalancer v2 VIP Port ID ([#9727](https://github.com/hashicorp/terraform/issues/9727)) - * provider/openstack: Openstack Provider enhancements including environment variables ([#9725](https://github.com/hashicorp/terraform/issues/9725)) - * provider/scaleway: update sdk for ams1 region ([#9687](https://github.com/hashicorp/terraform/issues/9687)) - * provider/scaleway: server volume property ([#9695](https://github.com/hashicorp/terraform/issues/9695)) - -BUG FIXES: - - * core: Resources suffixed with 'panic' won't falsely trigger crash detection. ([#9395](https://github.com/hashicorp/terraform/issues/9395)) - * core: Validate lifecycle options don't contain interpolations. ([#9576](https://github.com/hashicorp/terraform/issues/9576)) - * core: Tainted resources will not process `ignore_changes`. ([#7855](https://github.com/hashicorp/terraform/issues/7855)) - * core: Boolean looking values passed in via `-var` no longer cause type errors. ([#9642](https://github.com/hashicorp/terraform/issues/9642)) - * core: Computed primitives in certain cases no longer cause diff mismatch errors. ([#9618](https://github.com/hashicorp/terraform/issues/9618)) - * core: Empty arrays for list vars in JSON work ([#8886](https://github.com/hashicorp/terraform/issues/8886)) - * core: Boolean types in tfvars work propertly ([#9751](https://github.com/hashicorp/terraform/issues/9751)) - * core: Deposed resource destruction is accounted for properly in `apply` counts. ([#9731](https://github.com/hashicorp/terraform/issues/9731)) - * core: Check for graph cycles on resource expansion to catch cycles between self-referenced resources. ([#9728](https://github.com/hashicorp/terraform/issues/9728)) - * core: `prevent_destroy` prevents decreasing count ([#9707](https://github.com/hashicorp/terraform/issues/9707)) - * core: removed optional items will trigger "requires new" if necessary ([#9699](https://github.com/hashicorp/terraform/issues/9699)) - * command/apply: `-backup` and `-state-out` work with plan files ([#9706](https://github.com/hashicorp/terraform/issues/9706)) - * command/fmt: Cleaner formatting for multiline standalone comments above resources - * command/validate: respond to `--help` ([#9660](https://github.com/hashicorp/terraform/issues/9660)) - * provider/archive: Converting to datasource. ([#8492](https://github.com/hashicorp/terraform/issues/8492)) - * provider/aws: Fix issue importing AWS Instances and setting the correct `associate_public_ip_address` value ([#9453](https://github.com/hashicorp/terraform/issues/9453)) - * provider/aws: Fix issue with updating ElasticBeanstalk environment variables ([#9259](https://github.com/hashicorp/terraform/issues/9259)) - * provider/aws: Allow zero value for `scaling_adjustment` in `aws_autoscaling_policy` when using `SimpleScaling` ([#8893](https://github.com/hashicorp/terraform/issues/8893)) - * provider/aws: Increase ECS service drain timeout ([#9521](https://github.com/hashicorp/terraform/issues/9521)) - * provider/aws: Remove VPC Endpoint from state if it's not found ([#9561](https://github.com/hashicorp/terraform/issues/9561)) - * provider/aws: Delete Loging Profile from IAM User on force_destroy ([#9583](https://github.com/hashicorp/terraform/issues/9583)) - * provider/aws: Exposed aws_api_gw_domain_name.certificate_upload_date attribute ([#9533](https://github.com/hashicorp/terraform/issues/9533)) - * provider/aws: fix aws_elasticache_replication_group for Redis in cluster mode ([#9601](https://github.com/hashicorp/terraform/issues/9601)) - * provider/aws: Validate regular expression passed via the ami data_source `name_regex` attribute. ([#9622](https://github.com/hashicorp/terraform/issues/9622)) - * provider/aws: Bug fix for NoSuckBucket on Destroy of aws_s3_bucket_policy ([#9641](https://github.com/hashicorp/terraform/issues/9641)) - * provider/aws: Refresh aws_autoscaling_schedule from state on 404 ([#9659](https://github.com/hashicorp/terraform/issues/9659)) - * provider/aws: Allow underscores in IAM user and group names ([#9684](https://github.com/hashicorp/terraform/issues/9684)) - * provider/aws: aws_ami: handle deletion of AMIs ([#9721](https://github.com/hashicorp/terraform/issues/9721)) - * provider/aws: Fix aws_route53_record alias perpetual diff ([#9704](https://github.com/hashicorp/terraform/issues/9704)) - * provider/aws: Allow `active` state while waiting for the VPC Peering Connection. ([#9754](https://github.com/hashicorp/terraform/issues/9754)) - * provider/aws: Normalize all-principals wildcard in `aws_iam_policy_document` ([#9720](https://github.com/hashicorp/terraform/issues/9720)) - * provider/azurerm: Fix Azure RM loadbalancer rules validation ([#9468](https://github.com/hashicorp/terraform/issues/9468)) - * provider/azurerm: Fix servicebus_topic values when using the Update func to stop perpetual diff ([#9323](https://github.com/hashicorp/terraform/issues/9323)) - * provider/azurerm: lower servicebus_topic max size to Azure limit ([#9649](https://github.com/hashicorp/terraform/issues/9649)) - * provider/azurerm: Fix VHD deletion when VM and Storage account are in separate resource groups ([#9631](https://github.com/hashicorp/terraform/issues/9631)) - * provider/azurerm: Guard against panic when importing arm_virtual_network ([#9739](https://github.com/hashicorp/terraform/issues/9739)) - * provider/azurerm: fix sql_database resource reading tags ([#9767](https://github.com/hashicorp/terraform/issues/9767)) - * provider/cloudflare: update client library to stop connection closed issues ([#9715](https://github.com/hashicorp/terraform/issues/9715)) - * provider/consul: Change to consul_service resource to introduce a `service_id` parameter ([#9366](https://github.com/hashicorp/terraform/issues/9366)) - * provider/datadog: Ignore float/int diffs on thresholds ([#9466](https://github.com/hashicorp/terraform/issues/9466)) - * provider/docker: Fixes for docker_container host object and documentation ([#9367](https://github.com/hashicorp/terraform/issues/9367)) - * provider/scaleway improve the performance of server deletion ([#9491](https://github.com/hashicorp/terraform/issues/9491)) - * provider/scaleway: fix scaleway_volume_attachment with count > 1 ([#9493](https://github.com/hashicorp/terraform/issues/9493)) - - -## 0.7.7 (October 18, 2016) - -FEATURES: - - * **New Data Source:** `scaleway_bootsscript`. ([#9386](https://github.com/hashicorp/terraform/issues/9386)) - * **New Data Source:** `scaleway_image`. ([#9386](https://github.com/hashicorp/terraform/issues/9386)) - -IMPROVEMENTS: - - * core: When the environment variable TF_LOG_PATH is specified, debug logs are now appended to the specified file instead of being truncated. ([#9440](https://github.com/hashicorp/terraform/pull/9440)) - * provider/aws: Expose ARN for `aws_lambda_alias`. ([#9390](https://github.com/hashicorp/terraform/issues/9390)) - * provider/aws: Add support for AWS US East (Ohio) region. ([#9414](https://github.com/hashicorp/terraform/issues/9414)) - * provider/scaleway: `scaleway_ip`, `scaleway_security_group`, `scalway_server` and `scaleway_volume` resources can now be imported. ([#9387](https://github.com/hashicorp/terraform/issues/9387)) - -BUG FIXES: - - * core: List and map indexes support arithmetic. ([#9372](https://github.com/hashicorp/terraform/issues/9372)) - * core: List and map indexes are implicitly converted to the correct type if possible. ([#9372](https://github.com/hashicorp/terraform/issues/9372)) - * provider/aws: Read back `associate_public_ip_address` in `aws_launch_configuration` resources to enable importing. ([#9399](https://github.com/hashicorp/terraform/issues/9399)) - * provider/aws: Remove `aws_route` resources from state if their associated `aws_route_table` has been removed. ([#9431](https://github.com/hashicorp/terraform/issues/9431)) - * provider/azurerm: Load balancer resources now have their `id` attribute set to the resource URI instead of the load balancer URI. ([#9401](https://github.com/hashicorp/terraform/issues/9401)) - * provider/google: Fix a bug causing a crash when migrating `google_compute_target_pool` resources from 0.6.x releases. ([#9370](https://github.com/hashicorp/terraform/issues/9370)) - -## 0.7.6 (October 14, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * `azurerm_virtual_machine` has deprecated the use of `diagnostics_profile` in favour of `boot_diagnostics`. ([#9122](https://github.com/hashicorp/terraform/issues/9122)) - * The deprecated `key_file` and `bastion_key_file` arguments to Provisioner Connections have been removed ([#9340](https://github.com/hashicorp/terraform/issues/9340)) - -FEATURES: - * **New Data Source:** `aws_billing_service_account` ([#8701](https://github.com/hashicorp/terraform/issues/8701)) - * **New Data Source:** `aws_availability_zone` ([#6819](https://github.com/hashicorp/terraform/issues/6819)) - * **New Data Source:** `aws_region` ([#6819](https://github.com/hashicorp/terraform/issues/6819)) - * **New Data Source:** `aws_subnet` ([#6819](https://github.com/hashicorp/terraform/issues/6819)) - * **New Data Source:** `aws_vpc` ([#6819](https://github.com/hashicorp/terraform/issues/6819)) - * **New Resource:** `azurerm_lb` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `azurerm_lb_backend_address_pool` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `azurerm_lb_nat_rule` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `azurerm_lb_nat_pool` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `azurerm_lb_probe` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `azurerm_lb_rule` ([#9199](https://github.com/hashicorp/terraform/issues/9199)) - * **New Resource:** `github_repository` ([#9327](https://github.com/hashicorp/terraform/issues/9327)) - -IMPROVEMENTS: - * core-validation: create validation package to provide common validation functions ([#8103](https://github.com/hashicorp/terraform/issues/8103)) - * provider/aws: Support Import of OpsWorks Custom Layers ([#9252](https://github.com/hashicorp/terraform/issues/9252)) - * provider/aws: Automatically constructed ARNs now support partitions other than `aws`, allowing operation with `aws-cn` and `aws-us-gov` ([#9273](https://github.com/hashicorp/terraform/issues/9273)) - * provider/aws: Retry setTags operation for EC2 resources ([#7890](https://github.com/hashicorp/terraform/issues/7890)) - * provider/aws: Support refresh of EC2 instance `user_data` ([#6736](https://github.com/hashicorp/terraform/issues/6736)) - * provider/aws: Poll to confirm delete of `resource_aws_customer_gateway` ([#9346](https://github.com/hashicorp/terraform/issues/9346)) - * provider/azurerm: expose default keys for `servicebus_namespace` ([#9242](https://github.com/hashicorp/terraform/issues/9242)) - * provider/azurerm: add `enable_blob_encryption` to `azurerm_storage_account` resource ([#9233](https://github.com/hashicorp/terraform/issues/9233)) - * provider/azurerm: set `resource_group_name` on resource import across the provider ([#9073](https://github.com/hashicorp/terraform/issues/9073)) - * provider/azurerm: `azurerm_cdn_profile` resources can now be imported ([#9306](https://github.com/hashicorp/terraform/issues/9306)) - * provider/datadog: add support for Datadog dashboard "type" and "style" options ([#9228](https://github.com/hashicorp/terraform/issues/9228)) - * provider/scaleway: `region` is now supported for provider configuration - -BUG FIXES: - * core: Local state can now be refreshed when no resources exist ([#7320](https://github.com/hashicorp/terraform/issues/7320)) - * core: Orphaned nested (depth 2+) modules will inherit provider configs ([#9318](https://github.com/hashicorp/terraform/issues/9318)) - * core: Fix crash when a map key contains an interpolation function ([#9282](https://github.com/hashicorp/terraform/issues/9282)) - * core: Numeric variables values were incorrectly converted to numbers ([#9263](https://github.com/hashicorp/terraform/issues/9263)) - * core: Fix input and output of map variables from HCL ([#9268](https://github.com/hashicorp/terraform/issues/9268)) - * core: Crash when interpolating a map value with a function in the key ([#9282](https://github.com/hashicorp/terraform/issues/9282)) - * core: Crash when copying a nil value in an InstanceState ([#9356](https://github.com/hashicorp/terraform/issues/9356)) - * command/fmt: Bare comment groups no longer have superfluous newlines - * command/fmt: Leading comments on list items are formatted properly - * provider/aws: Return correct AMI image when `most_recent` is set to `true`. ([#9277](https://github.com/hashicorp/terraform/issues/9277)) - * provider/aws: Fix issue with diff on import of `aws_eip` in EC2 Classic ([#9009](https://github.com/hashicorp/terraform/issues/9009)) - * provider/aws: Handle EC2 tags related errors in CloudFront Distribution resource. ([#9298](https://github.com/hashicorp/terraform/issues/9298)) - * provider/aws: Fix cause error when using `etag` and `kms_key_id` with `aws_s3_bucket_object` ([#9168](https://github.com/hashicorp/terraform/issues/9168)) - * provider/aws: Fix issue reassigning EIP instances appropriately ([#7686](https://github.com/hashicorp/terraform/issues/7686)) - * provider/azurerm: removing resources from state when the API returns a 404 for them ([#8859](https://github.com/hashicorp/terraform/issues/8859)) - * provider/azurerm: Fixed a panic in `azurerm_virtual_machine` when using `diagnostic_profile` ([#9122](https://github.com/hashicorp/terraform/issues/9122)) - -## 0.7.5 (October 6, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * `tls_cert_request` is now a managed resource instead of a data source, restoring the pre-Terraform 0.7 behaviour ([#9035](https://github.com/hashicorp/terraform/issues/9035)) - -FEATURES: - * **New Provider:** `bitbucket` ([#7405](https://github.com/hashicorp/terraform/issues/7405)) - * **New Resource:** `aws_api_gateway_client_certificate` ([#8775](https://github.com/hashicorp/terraform/issues/8775)) - * **New Resource:** `azurerm_servicebus_topic` ([#9151](https://github.com/hashicorp/terraform/issues/9151)) - * **New Resource:** `azurerm_servicebus_subscription` ([#9185](https://github.com/hashicorp/terraform/issues/9185)) - * **New Resource:** `aws_emr_cluster` ([#9106](https://github.com/hashicorp/terraform/issues/9106)) - * **New Resource:** `aws_emr_instance_group` ([#9106](https://github.com/hashicorp/terraform/issues/9106)) - -IMPROVEMENTS: - * helper/schema: Adding of MinItems as a validation to Lists and Maps ([#9216](https://github.com/hashicorp/terraform/issues/9216)) - * provider/aws: Add JSON validation to the `aws_cloudwatch_event_rule` resource ([#8897](https://github.com/hashicorp/terraform/issues/8897)) - * provider/aws: S3 bucket policies are imported as separate resources ([#8915](https://github.com/hashicorp/terraform/issues/8915)) - * provider/aws: S3 bucket policies can now be removed via the `aws_s3_bucket` resource ([#8915](https://github.com/hashicorp/terraform/issues/8915)) - * provider/aws: Added a `cluster_address` attribute to aws elasticache ([#8935](https://github.com/hashicorp/terraform/issues/8935)) - * provider/aws: Add JSON validation to the `aws_elasticsearch_domain resource`. ([#8898](https://github.com/hashicorp/terraform/issues/8898)) - * provider/aws: Add JSON validation to the `aws_kms_key resource`. ([#8900](https://github.com/hashicorp/terraform/issues/8900)) - * provider/aws: Add JSON validation to the `aws_s3_bucket_policy resource`. ([#8901](https://github.com/hashicorp/terraform/issues/8901)) - * provider/aws: Add JSON validation to the `aws_sns_topic resource`. ([#8902](https://github.com/hashicorp/terraform/issues/8902)) - * provider/aws: Add JSON validation to the `aws_sns_topic_policy resource`. ([#8903](https://github.com/hashicorp/terraform/issues/8903)) - * provider/aws: Add JSON validation to the `aws_sqs_queue resource`. ([#8904](https://github.com/hashicorp/terraform/issues/8904)) - * provider/aws: Add JSON validation to the `aws_sqs_queue_policy resource`. ([#8905](https://github.com/hashicorp/terraform/issues/8905)) - * provider/aws: Add JSON validation to the `aws_vpc_endpoint resource`. ([#8906](https://github.com/hashicorp/terraform/issues/8906)) - * provider/aws: Update `aws_cloudformation_stack` data source with new helper function. ([#8907](https://github.com/hashicorp/terraform/issues/8907)) - * provider/aws: Add JSON validation to the `aws_s3_bucket` resource. ([#8908](https://github.com/hashicorp/terraform/issues/8908)) - * provider/aws: Add support for `cloudwatch_logging_options` to Firehose Delivery Streams ([#8671](https://github.com/hashicorp/terraform/issues/8671)) - * provider/aws: Add HTTP/2 support via the http_version parameter to CloudFront distribution ([#8777](https://github.com/hashicorp/terraform/issues/8777)) - * provider/aws: Add `query_string_cache_keys` to allow for selective caching of CloudFront keys ([#8777](https://github.com/hashicorp/terraform/issues/8777)) - * provider/aws: Support Import `aws_elasticache_cluster` ([#9010](https://github.com/hashicorp/terraform/issues/9010)) - * provider/aws: Add support for tags to `aws_cloudfront_distribution` ([#9011](https://github.com/hashicorp/terraform/issues/9011)) - * provider/aws: Support Import `aws_opsworks_stack` ([#9124](https://github.com/hashicorp/terraform/issues/9124)) - * provider/aws: Support Import `aws_elasticache_replication_groups` ([#9140](https://github.com/hashicorp/terraform/issues/9140)) - * provider/aws: Add new aws api-gateway integration types ([#9213](https://github.com/hashicorp/terraform/issues/9213)) - * provider/aws: Import `aws_db_event_subscription` ([#9220](https://github.com/hashicorp/terraform/issues/9220)) - * provider/azurerm: Add normalizeJsonString and validateJsonString functions ([#8909](https://github.com/hashicorp/terraform/issues/8909)) - * provider/azurerm: Support AzureRM Sql Database DataWarehouse ([#9196](https://github.com/hashicorp/terraform/issues/9196)) - * provider/openstack: Use proxy environment variables for communication with services ([#8948](https://github.com/hashicorp/terraform/issues/8948)) - * provider/vsphere: Adding `detach_unknown_disks_on_delete` flag for VM resource ([#8947](https://github.com/hashicorp/terraform/issues/8947)) - * provisioner/chef: Add `skip_register` attribute to allow skipping the registering steps ([#9127](https://github.com/hashicorp/terraform/issues/9127)) - -BUG FIXES: - * core: Fixed variables not being in scope for destroy -target on modules ([#9021](https://github.com/hashicorp/terraform/issues/9021)) - * core: Fixed issue that prevented diffs from being properly generated in a specific resource schema scenario ([#8891](https://github.com/hashicorp/terraform/issues/8891)) - * provider/aws: Remove support for `ah` and `esp` literals in Security Group Ingress/Egress rules; you must use the actual protocol number for protocols other than `tcp`, `udp`, `icmp`, or `all` ([#8975](https://github.com/hashicorp/terraform/issues/8975)) - * provider/aws: Do not report drift for effect values differing only by case in AWS policies ([#9139](https://github.com/hashicorp/terraform/issues/9139)) - * provider/aws: VPC ID, Port, Protocol and Name change on aws_alb_target_group will ForceNew resource ([#8989](https://github.com/hashicorp/terraform/issues/8989)) - * provider/aws: Wait for Spot Fleet to drain before removing from state ([#8938](https://github.com/hashicorp/terraform/issues/8938)) - * provider/aws: Fix issue when importing `aws_eip` resources by IP address ([#8970](https://github.com/hashicorp/terraform/issues/8970)) - * provider/aws: Ensure that origin_access_identity is a required value within the CloudFront distribution s3_config block ([#8777](https://github.com/hashicorp/terraform/issues/8777)) - * provider/aws: Corrected Seoul S3 Website Endpoint format ([#9032](https://github.com/hashicorp/terraform/issues/9032)) - * provider/aws: Fix failed remove S3 lifecycle_rule ([#9031](https://github.com/hashicorp/terraform/issues/9031)) - * provider/aws: Fix crashing bug in `aws_ami` data source when using `name_regex` ([#9033](https://github.com/hashicorp/terraform/issues/9033)) - * provider/aws: Fix reading dimensions on cloudwatch alarms ([#9029](https://github.com/hashicorp/terraform/issues/9029)) - * provider/aws: Changing snapshot_identifier on aws_db_instance resource should force… ([#8806](https://github.com/hashicorp/terraform/issues/8806)) - * provider/aws: Refresh AWS EIP association from state when not found ([#9056](https://github.com/hashicorp/terraform/issues/9056)) - * provider/aws: Make encryption in Aurora instances computed-only ([#9060](https://github.com/hashicorp/terraform/issues/9060)) - * provider/aws: Make sure that VPC Peering Connection in a failed state returns an error. ([#9038](https://github.com/hashicorp/terraform/issues/9038)) - * provider/aws: guard against aws_route53_record delete panic ([#9049](https://github.com/hashicorp/terraform/issues/9049)) - * provider/aws: aws_db_option_group flattenOptions failing due to missing values ([#9052](https://github.com/hashicorp/terraform/issues/9052)) - * provider/aws: Add retry logic to the aws_ecr_repository delete func ([#9050](https://github.com/hashicorp/terraform/issues/9050)) - * provider/aws: Modifying the parameter_group_name of aws_elasticache_replication_group caused a panic ([#9101](https://github.com/hashicorp/terraform/issues/9101)) - * provider/aws: Fix issue with updating ELB subnets for subnets in the same AZ ([#9131](https://github.com/hashicorp/terraform/issues/9131)) - * provider/aws: aws_route53_record alias refresh manually updated record ([#9125](https://github.com/hashicorp/terraform/issues/9125)) - * provider/aws: Fix issue detaching volumes that were already detached ([#9023](https://github.com/hashicorp/terraform/issues/9023)) - * provider/aws: Add retry to the `aws_ssm_document` delete func ([#9188](https://github.com/hashicorp/terraform/issues/9188)) - * provider/aws: Fix issue updating `search_string` in aws_cloudwatch_metric_alarm ([#9230](https://github.com/hashicorp/terraform/issues/9230)) - * provider/aws: Update EFS resource to read performance mode and creation_token ([#9234](https://github.com/hashicorp/terraform/issues/9234)) - * provider/azurerm: fix resource ID parsing for subscriptions resources ([#9163](https://github.com/hashicorp/terraform/issues/9163)) - * provider/librato: Mandatory name and conditions attributes weren't being sent on Update unless changed ([#8984](https://github.com/hashicorp/terraform/issues/8984)) - * provisioner/chef: Fix an error with parsing certain `vault_json` content ([#9114](https://github.com/hashicorp/terraform/issues/9114)) - * provisioner/chef: Change to order in which to cleanup the user key so this is done before the Chef run starts ([#9114](https://github.com/hashicorp/terraform/issues/9114)) - -## 0.7.4 (September 19, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * In previous releases, the `private_key` field in the connection provisioner - inadvertently accepted a path argument and would read the file contents. - This functionality has been removed in this release ([#8577](https://github.com/hashicorp/terraform/issues/8577)), and the documented - method of using the `file()` interpolation function should be used to load - the key from a file. - -FEATURES: - * **New Resource:** `aws_codecommit_trigger` ([#8751](https://github.com/hashicorp/terraform/issues/8751)) - * **New Resource:** `aws_default_security_group` ([#8861](https://github.com/hashicorp/terraform/issues/8861)) - * **New Remote State Backend:** `manta` ([#8830](https://github.com/hashicorp/terraform/issues/8830)) - -IMPROVEMENTS: - * provider/aws: Support 'publish' attribute in `lambda_function` ([#8653](https://github.com/hashicorp/terraform/issues/8653)) - * provider/aws: Add `reader_endpoint` RDS Clusters ([#8884](https://github.com/hashicorp/terraform/issues/8884)) - * provider/aws: Export AWS ELB service account ARN ([#8700](https://github.com/hashicorp/terraform/issues/8700)) - * provider/aws: Allow `aws_alb` to have the name auto-generated ([#8673](https://github.com/hashicorp/terraform/issues/8673)) - * provider/aws: Expose `arn_suffix` on `aws_alb` ([#8833](https://github.com/hashicorp/terraform/issues/8833)) - * provider/aws: Add JSON validation to the `aws_cloudformation_stack` resource ([#8896](https://github.com/hashicorp/terraform/issues/8896)) - * provider/aws: Add JSON validation to the `aws_glacier_vault` resource ([#8899](https://github.com/hashicorp/terraform/issues/8899)) - * provider/azurerm: support Diagnostics Profile ([#8277](https://github.com/hashicorp/terraform/issues/8277)) - * provider/google: Resources depending on the `network` attribute can now reference the network by `self_link` or `name` ([#8639](https://github.com/hashicorp/terraform/issues/8639)) - * provider/postgresql: The standard environment variables PGHOST, PGUSER, PGPASSWORD and PGSSLMODE are now supported for provider configuration ([#8666](https://github.com/hashicorp/terraform/issues/8666)) - * helper/resource: Add timeout duration to timeout error message ([#8773](https://github.com/hashicorp/terraform/issues/8773)) - * provisioner/chef: Support recreating Chef clients by setting `recreate_client=true` ([#8577](https://github.com/hashicorp/terraform/issues/8577)) - * provisioner/chef: Support encrypting existing Chef-Vaults for newly created clients ([#8577](https://github.com/hashicorp/terraform/issues/8577)) - -BUG FIXES: - * core: Fix regression when loading variables from json ([#8820](https://github.com/hashicorp/terraform/issues/8820)) - * provider/aws: Prevent crash creating an `aws_sns_topic` with an empty policy ([#8834](https://github.com/hashicorp/terraform/issues/8834)) - * provider/aws: Bump `aws_elasticsearch_domain` timeout values ([#672](https://github.com/hashicorp/terraform/issues/672)) - * provider/aws: `aws_nat_gateways` will now recreate on `failed` state ([#8689](https://github.com/hashicorp/terraform/issues/8689)) - * provider/aws: Prevent crash on account ID validation ([#8731](https://github.com/hashicorp/terraform/issues/8731)) - * provider/aws: `aws_db_instance` unexpected state when configurating enhanced monitoring ([#8707](https://github.com/hashicorp/terraform/issues/8707)) - * provider/aws: Remove region condition from `aws_codecommit_repository` ([#8778](https://github.com/hashicorp/terraform/issues/8778)) - * provider/aws: Support Policy DiffSuppression in `aws_kms_key` policy ([#8675](https://github.com/hashicorp/terraform/issues/8675)) - * provider/aws: Fix issue updating Elastic Beanstalk Environment variables ([#8848](https://github.com/hashicorp/terraform/issues/8848)) - * provider/scaleway: Fix `security_group_rule` identification ([#8661](https://github.com/hashicorp/terraform/issues/8661)) - * provider/cloudstack: Fix renaming a VPC with the `cloudstack_vpc` resource ([#8784](https://github.com/hashicorp/terraform/issues/8784)) - -## 0.7.3 (September 5, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * Terraform now validates the uniqueness of variable and output names in your configurations. In prior versions certain ways of duplicating variable names would work. This is now a configuration error (and should've always been). If you get an error running Terraform you may need to remove the duplicates. Done right, this should not affect the behavior of Terraform. - * The internal structure of `.terraform/modules` changed slightly. For configurations with modules, you'll need to run `terraform get` again. - -FEATURES: - * **New Provider:** `rabbitmq` ([#7694](https://github.com/hashicorp/terraform/issues/7694)) - * **New Data Source:** `aws_cloudformation_stack` ([#8640](https://github.com/hashicorp/terraform/issues/8640)) - * **New Resource:** `aws_cloudwatch_log_stream` ([#8626](https://github.com/hashicorp/terraform/issues/8626)) - * **New Resource:** `aws_default_route_table` ([#8323](https://github.com/hashicorp/terraform/issues/8323)) - * **New Resource:** `aws_spot_datafeed_subscription` ([#8640](https://github.com/hashicorp/terraform/issues/8640)) - * **New Resource:** `aws_s3_bucket_policy` ([#8615](https://github.com/hashicorp/terraform/issues/8615)) - * **New Resource:** `aws_sns_topic_policy` ([#8654](https://github.com/hashicorp/terraform/issues/8654)) - * **New Resource:** `aws_sqs_queue_policy` ([#8657](https://github.com/hashicorp/terraform/issues/8657)) - * **New Resource:** `aws_ssm_association` ([#8376](https://github.com/hashicorp/terraform/issues/8376)) - * **New Resource:** `cloudstack_affinity_group` ([#8360](https://github.com/hashicorp/terraform/issues/8360)) - * **New Resource:** `librato_alert` ([#8170](https://github.com/hashicorp/terraform/issues/8170)) - * **New Resource:** `librato_service` ([#8170](https://github.com/hashicorp/terraform/issues/8170)) - * **New Remote State Backend:** `local` ([#8647](https://github.com/hashicorp/terraform/issues/8647)) - * Data source blocks can now have a count associated with them ([#8635](https://github.com/hashicorp/terraform/issues/8635)) - * The count of a resource can now be referenced for interpolations: `self.count` and `type.name.count` work ([#8581](https://github.com/hashicorp/terraform/issues/8581)) - * Provisioners now support connection using IPv6 in addition to IPv4 ([#6616](https://github.com/hashicorp/terraform/issues/6616)) - -IMPROVEMENTS: - * core: Add wildcard (match all) support to `ignore_changes` ([#8599](https://github.com/hashicorp/terraform/issues/8599)) - * core: HTTP module sources can now use netrc files for auth - * core: Show last resource state in a timeout error message ([#8510](https://github.com/hashicorp/terraform/issues/8510)) - * helper/schema: Add diff suppression callback ([#8585](https://github.com/hashicorp/terraform/issues/8585)) - * provider/aws: API Gateway Custom Authorizer ([#8535](https://github.com/hashicorp/terraform/issues/8535)) - * provider/aws: Add MemoryReservation To `aws_ecs_container_definition` data source ([#8437](https://github.com/hashicorp/terraform/issues/8437)) - * provider/aws: Add ability Enable/Disable For ELB Access logs ([#8438](https://github.com/hashicorp/terraform/issues/8438)) - * provider/aws: Add support for assuming a role prior to performing API operations ([#8638](https://github.com/hashicorp/terraform/issues/8638)) - * provider/aws: Export `arn` of `aws_autoscaling_group` ([#8503](https://github.com/hashicorp/terraform/issues/8503)) - * provider/aws: More robust handling of Lambda function archives hosted on S3 ([#6860](https://github.com/hashicorp/terraform/issues/6860)) - * provider/aws: Spurious diffs of `aws_s3_bucket` policy attributes due to JSON field ordering are reduced ([#8615](https://github.com/hashicorp/terraform/issues/8615)) - * provider/aws: `name_regex` attribute for local post-filtering of `aws_ami` data source results ([#8403](https://github.com/hashicorp/terraform/issues/8403)) - * provider/aws: Support for lifecycle hooks at ASG creation ([#5620](https://github.com/hashicorp/terraform/issues/5620)) - * provider/consul: Make provider settings truly optional ([#8551](https://github.com/hashicorp/terraform/issues/8551)) - * provider/statuscake: Add support for contact-group id in statuscake test ([#8417](https://github.com/hashicorp/terraform/issues/8417)) - -BUG FIXES: - * core: Changing a module source from file to VCS no longer errors ([#8398](https://github.com/hashicorp/terraform/issues/8398)) - * core: Configuration is now validated prior to input, fixing an obscure parse error when attempting to interpolate a count ([#8591](https://github.com/hashicorp/terraform/issues/8591)) - * core: JSON configuration with resources with a single key parse properly ([#8485](https://github.com/hashicorp/terraform/issues/8485)) - * core: States with duplicate modules are detected and an error is shown ([#8463](https://github.com/hashicorp/terraform/issues/8463)) - * core: Validate uniqueness of variables/outputs in a module ([#8482](https://github.com/hashicorp/terraform/issues/8482)) - * core: `-var` flag inputs starting with `/` work - * core: `-var` flag inputs starting with a number work and was fixed in such a way that this should overall be a lot more resilient to inputs ([#8044](https://github.com/hashicorp/terraform/issues/8044)) - * provider/aws: Add AWS error message to retry APIGateway account update ([#8533](https://github.com/hashicorp/terraform/issues/8533)) - * provider/aws: Do not set empty string to state for `aws_vpn_gateway` availability zone ([#8645](https://github.com/hashicorp/terraform/issues/8645)) - * provider/aws: Fix. Adjust create and destroy timeout in aws_vpn_gateway_attachment. ([#8636](https://github.com/hashicorp/terraform/issues/8636)) - * provider/aws: Handle missing EFS mount target in `aws_efs_mount_target` ([#8529](https://github.com/hashicorp/terraform/issues/8529)) - * provider/aws: If an `aws_security_group` was used in Lambda function it may have prevented you from destroying such SG due to dangling ENIs created by Lambda service. These ENIs are now automatically cleaned up prior to SG deletion ([#8033](https://github.com/hashicorp/terraform/issues/8033)) - * provider/aws: Increase `aws_route_table` timeouts from 1 min to 2 mins ([#8465](https://github.com/hashicorp/terraform/issues/8465)) - * provider/aws: Increase aws_rds_cluster timeout to 40 minutes ([#8623](https://github.com/hashicorp/terraform/issues/8623)) - * provider/aws: Refresh `aws_route` from state if `aws_route_table` not found ([#8443](https://github.com/hashicorp/terraform/issues/8443)) - * provider/aws: Remove `aws_elasticsearch_domain` from state if it doesn't exist ([#8643](https://github.com/hashicorp/terraform/issues/8643)) - * provider/aws: Remove unsafe ptr dereferencing from ECS/ECR ([#8514](https://github.com/hashicorp/terraform/issues/8514)) - * provider/aws: Set `apply_method` to state in `aws_db_parameter_group` ([#8603](https://github.com/hashicorp/terraform/issues/8603)) - * provider/aws: Stop `aws_instance` `source_dest_check` triggering an API call on each terraform run ([#8450](https://github.com/hashicorp/terraform/issues/8450)) - * provider/aws: Wait for `aws_route_53_record` to be in-sync after a delete ([#8646](https://github.com/hashicorp/terraform/issues/8646)) - * provider/aws: `aws_volume_attachment` detachment errors are caught ([#8479](https://github.com/hashicorp/terraform/issues/8479)) - * provider/aws: adds resource retry to `aws_spot_instance_request` ([#8516](https://github.com/hashicorp/terraform/issues/8516)) - * provider/aws: Add validation of Health Check target to aws_elb. ([#8578](https://github.com/hashicorp/terraform/issues/8578)) - * provider/aws: Skip detaching when aws_internet_gateway not found ([#8454](https://github.com/hashicorp/terraform/issues/8454)) - * provider/aws: Handle all kinds of CloudFormation stack failures ([#5606](https://github.com/hashicorp/terraform/issues/5606)) - * provider/azurerm: Reordering the checks after an Azure API Get ([#8607](https://github.com/hashicorp/terraform/issues/8607)) - * provider/chef: Fix "invalid header" errors that could occur ([#8382](https://github.com/hashicorp/terraform/issues/8382)) - * provider/github: Remove unsafe ptr dereferencing ([#8512](https://github.com/hashicorp/terraform/issues/8512)) - * provider/librato: Refresh space from state when not found ([#8596](https://github.com/hashicorp/terraform/issues/8596)) - * provider/mysql: Fix breakage in parsing MySQL version string ([#8571](https://github.com/hashicorp/terraform/issues/8571)) - * provider/template: `template_file` vars can be floating point ([#8590](https://github.com/hashicorp/terraform/issues/8590)) - * provider/triton: Fix bug where the ID of a `triton_key` was used prior to being set ([#8563](https://github.com/hashicorp/terraform/issues/8563)) - -## 0.7.2 (August 25, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * provider/openstack: changes were made to how volumes attached to instances are detected. If you attached a volume to an instance out of band to Terraform, it will be detached upon the next apply. You can resolve this by adding a `volume` entry for the attached volume. - * provider/aws: `aws_spot_fleet_request` has changed the `associate_public_ip_address` default from `true` to `false` - -FEATURES: - * **New Resource:** `aws_api_gateway_base_path_mapping` ([#8353](https://github.com/hashicorp/terraform/issues/8353)) - * **New Resource:** `aws_api_gateway_domain_name` ([#8353](https://github.com/hashicorp/terraform/issues/8353)) - * **New Resource:** `aws_ssm_document` ([#8460](https://github.com/hashicorp/terraform/issues/8460)) - -IMPROVEMENTS: - * core: Names generated with a unique prefix are now sortable based on age ([#8249](https://github.com/hashicorp/terraform/issues/8249)) - * provider/aws: Add Primary Endpoint Address attribute for `aws_elasticache_replication_group` ([#8385](https://github.com/hashicorp/terraform/issues/8385)) - * provider/aws: Add support for `network_mode` to `aws_ecs_task_definition` ([#8391](https://github.com/hashicorp/terraform/issues/8391)) - * provider/aws: Add support for LB target group to ECS service ([#8190](https://github.com/hashicorp/terraform/issues/8190)) - * provider/aws: Support Tags for `aws_alb` and `aws_alb_target_group` resources ([#8422](https://github.com/hashicorp/terraform/issues/8422)) - * provider/aws: Support `snapshot_name` for ElastiCache Cluster and Replication Groups ([#8419](https://github.com/hashicorp/terraform/issues/8419)) - * provider/aws: Add support to `aws_redshift_cluster` for restoring from snapshot ([#8414](https://github.com/hashicorp/terraform/issues/8414)) - * provider/aws: Add validation for master_password in `aws_redshift_cluster` ([#8434](https://github.com/hashicorp/terraform/issues/8434)) - * provider/openstack: Add `allowed_address_pairs` to `openstack_networking_port_v2` ([#8257](https://github.com/hashicorp/terraform/issues/8257)) - -BUG FIXES: - * core: fix crash case when malformed JSON given ([#8295](https://github.com/hashicorp/terraform/issues/8295)) - * core: when asking for input, spaces are allowed ([#8394](https://github.com/hashicorp/terraform/issues/8394)) - * core: module sources with URL encodings in the local file path won't error ([#8418](https://github.com/hashicorp/terraform/issues/8418)) - * command/apply: prefix destroying resources with module path ([#8396](https://github.com/hashicorp/terraform/issues/8396)) - * command/import: can import into specific indexes ([#8335](https://github.com/hashicorp/terraform/issues/8335)) - * command/push: -upload-modules=false works ([#8456](https://github.com/hashicorp/terraform/issues/8456)) - * command/state mv: nested modules can be moved ([#8304](https://github.com/hashicorp/terraform/issues/8304)) - * command/state mv: resources with a count > 1 can be moved ([#8304](https://github.com/hashicorp/terraform/issues/8304)) - * provider/aws: Refresh `aws_lambda_event_source_mapping` from state when NotFound ([#8378](https://github.com/hashicorp/terraform/issues/8378)) - * provider/aws: `aws_elasticache_replication_group_id` validation change ([#8381](https://github.com/hashicorp/terraform/issues/8381)) - * provider/aws: Fix possible crash if using duplicate Route53 records ([#8399](https://github.com/hashicorp/terraform/issues/8399)) - * provider/aws: Refresh `aws_autoscaling_policy` from state on 404 ([#8430](https://github.com/hashicorp/terraform/issues/8430)) - * provider/aws: Fix crash with VPC Peering connection accept/requests ([#8432](https://github.com/hashicorp/terraform/issues/8432)) - * provider/aws: AWS SpotFleet Requests now works with Subnets and AZs ([#8320](https://github.com/hashicorp/terraform/issues/8320)) - * provider/aws: Refresh `aws_cloudwatch_event_target` from state on `ResourceNotFoundException` ([#8442](https://github.com/hashicorp/terraform/issues/8442)) - * provider/aws: Validate `aws_iam_policy_attachment` Name parameter to stop being empty ([#8441](https://github.com/hashicorp/terraform/issues/8441)) - * provider/aws: Fix segmentation fault in `aws_api_gateway_base_path_mapping` resource ([#8466](https://github.com/hashicorp/terraform/issues/8466)) - * provider/google: fix crash regression from Terraform 0.7.1 on `google_compute_firewall` resource ([#8390](https://github.com/hashicorp/terraform/issues/8390)) - * provider/openstack: Volume Attachment and Detachment Fixes ([#8172](https://github.com/hashicorp/terraform/issues/8172)) - -## 0.7.1 (August 19, 2016) - -FEATURES: - * **New Command:** `terraform state rm` ([#8200](https://github.com/hashicorp/terraform/issues/8200)) - * **New Provider:** `archive` ([#7322](https://github.com/hashicorp/terraform/issues/7322)) - * **New Resource:** `aws_alb` ([#8254](https://github.com/hashicorp/terraform/issues/8254)) - * **New Resource:** `aws_alb_listener` ([#8269](https://github.com/hashicorp/terraform/issues/8269)) - * **New Resource:** `aws_alb_target_group` ([#8254](https://github.com/hashicorp/terraform/issues/8254)) - * **New Resource:** `aws_alb_target_group_attachment` ([#8254](https://github.com/hashicorp/terraform/issues/8254)) - * **New Resource:** `aws_alb_target_group_rule` ([#8321](https://github.com/hashicorp/terraform/issues/8321)) - * **New Resource:** `aws_vpn_gateway_attachment` ([#7870](https://github.com/hashicorp/terraform/issues/7870)) - * **New Resource:** `aws_load_balancer_policy` ([#7458](https://github.com/hashicorp/terraform/issues/7458)) - * **New Resource:** `aws_load_balancer_backend_server_policy` ([#7458](https://github.com/hashicorp/terraform/issues/7458)) - * **New Resource:** `aws_load_balancer_listener_policy` ([#7458](https://github.com/hashicorp/terraform/issues/7458)) - * **New Resource:** `aws_lb_ssl_negotiation_policy` ([#8084](https://github.com/hashicorp/terraform/issues/8084)) - * **New Resource:** `aws_elasticache_replication_groups` ([#8275](https://github.com/hashicorp/terraform/issues/8275)) - * **New Resource:** `azurerm_virtual_network_peering` ([#8168](https://github.com/hashicorp/terraform/issues/8168)) - * **New Resource:** `azurerm_servicebus_namespace` ([#8195](https://github.com/hashicorp/terraform/issues/8195)) - * **New Resource:** `google_compute_image` ([#7960](https://github.com/hashicorp/terraform/issues/7960)) - * **New Resource:** `packet_volume` ([#8142](https://github.com/hashicorp/terraform/issues/8142)) - * **New Resource:** `consul_prepared_query` ([#7474](https://github.com/hashicorp/terraform/issues/7474)) - * **New Data Source:** `aws_ip_ranges` ([#7984](https://github.com/hashicorp/terraform/issues/7984)) - * **New Data Source:** `fastly_ip_ranges` ([#7984](https://github.com/hashicorp/terraform/issues/7984)) - * **New Data Source:** `aws_caller_identity` ([#8206](https://github.com/hashicorp/terraform/issues/8206)) - * **New Data Source:** `aws_elb_service_account` ([#8221](https://github.com/hashicorp/terraform/issues/8221)) - * **New Data Source:** `aws_redshift_service_account` ([#8224](https://github.com/hashicorp/terraform/issues/8224)) - -IMPROVEMENTS - * provider/archive support folders in output_path ([#8278](https://github.com/hashicorp/terraform/issues/8278)) - * provider/aws: Introduce `aws_elasticsearch_domain` `elasticsearch_version` field (to specify ES version) ([#7860](https://github.com/hashicorp/terraform/issues/7860)) - * provider/aws: Add support for TargetGroups (`aws_alb_target_groups`) to `aws_autoscaling_group` [8327] - * provider/aws: CloudWatch Metrics are now supported for `aws_route53_health_check` resources ([#8319](https://github.com/hashicorp/terraform/issues/8319)) - * provider/aws: Query all pages of group membership ([#6726](https://github.com/hashicorp/terraform/issues/6726)) - * provider/aws: Query all pages of IAM Policy attachments ([#7779](https://github.com/hashicorp/terraform/issues/7779)) - * provider/aws: Change the way ARNs are built ([#7151](https://github.com/hashicorp/terraform/issues/7151)) - * provider/aws: Add support for Elasticsearch destination to firehose delivery streams ([#7839](https://github.com/hashicorp/terraform/issues/7839)) - * provider/aws: Retry AttachInternetGateway and increase timeout on `aws_internet_gateway` ([#7891](https://github.com/hashicorp/terraform/issues/7891)) - * provider/aws: Add support for Enhanced monitoring to `aws_rds_cluster_instance` ([#8038](https://github.com/hashicorp/terraform/issues/8038)) - * provider/aws: Add ability to set Requests Payer in `aws_s3_bucket` ([#8065](https://github.com/hashicorp/terraform/issues/8065)) - * provider/aws: Add ability to set canned ACL in `aws_s3_bucket_object` ([#8091](https://github.com/hashicorp/terraform/issues/8091)) - * provider/aws: Allow skipping credentials validation, requesting Account ID and/or metadata API check ([#7874](https://github.com/hashicorp/terraform/issues/7874)) - * provider/aws: API gateway request/response parameters can now be specified as map, original `*_in_json` parameters deprecated ([#7794](https://github.com/hashicorp/terraform/issues/7794)) - * provider/aws: Add support for `promotion_tier` to `aws_rds_cluster_instance` ([#8087](https://github.com/hashicorp/terraform/issues/8087)) - * provider/aws: Allow specifying custom S3 endpoint and enforcing S3 path style URLs via new provider options ([#7871](https://github.com/hashicorp/terraform/issues/7871)) - * provider/aws: Add ability to set Storage Class in `aws_s3_bucket_object` ([#8174](https://github.com/hashicorp/terraform/issues/8174)) - * provider/aws: Treat `aws_lambda_function` w/ empty `subnet_ids` & `security_groups_ids` in `vpc_config` as VPC-disabled function ([#6191](https://github.com/hashicorp/terraform/issues/6191)) - * provider/aws: Allow `source_ids` in `aws_db_event_subscription` to be Updatable ([#7892](https://github.com/hashicorp/terraform/issues/7892)) - * provider/aws: Make `aws_efs_mount_target` creation fail for 2+ targets per AZ ([#8205](https://github.com/hashicorp/terraform/issues/8205)) - * provider/aws: Add `force_destroy` option to `aws_route53_zone` ([#8239](https://github.com/hashicorp/terraform/issues/8239)) - * provider/aws: Support import of `aws_s3_bucket` ([#8262](https://github.com/hashicorp/terraform/issues/8262)) - * provider/aws: Increase timeout for retrying creation of IAM role ([#7733](https://github.com/hashicorp/terraform/issues/7733)) - * provider/aws: Add ability to set peering options in aws_vpc_peering_connection. ([#8310](https://github.com/hashicorp/terraform/issues/8310)) - * provider/azure: add custom_data argument for azure_instance resource ([#8158](https://github.com/hashicorp/terraform/issues/8158)) - * provider/azurerm: Adds support for uploading blobs to azure storage from local source ([#7994](https://github.com/hashicorp/terraform/issues/7994)) - * provider/azurerm: Storage blob contents can be copied from an existing blob ([#8126](https://github.com/hashicorp/terraform/issues/8126)) - * provider/datadog: Allow `tags` to be configured for monitor resources. ([#8284](https://github.com/hashicorp/terraform/issues/8284)) - * provider/google: allows atomic Cloud DNS record changes ([#6575](https://github.com/hashicorp/terraform/issues/6575)) - * provider/google: Move URLMap hosts to TypeSet from TypeList ([#7472](https://github.com/hashicorp/terraform/issues/7472)) - * provider/google: Support static private IP addresses in `resource_compute_instance` ([#6310](https://github.com/hashicorp/terraform/issues/6310)) - * provider/google: Add support for using a GCP Image Family ([#8083](https://github.com/hashicorp/terraform/issues/8083)) - * provider/openstack: Support updating the External Gateway assigned to a Neutron router ([#8070](https://github.com/hashicorp/terraform/issues/8070)) - * provider/openstack: Support for `value_specs` param on `openstack_networking_network_v2` ([#8155](https://github.com/hashicorp/terraform/issues/8155)) - * provider/openstack: Add `value_specs` param on `openstack_networking_subnet_v2` ([#8181](https://github.com/hashicorp/terraform/issues/8181)) - * provider/vsphere: Improved SCSI controller handling in `vsphere_virtual_machine` ([#7908](https://github.com/hashicorp/terraform/issues/7908)) - * provider/vsphere: Adding disk type of `Thick Lazy` to `vsphere_virtual_disk` and `vsphere_virtual_machine` ([#7916](https://github.com/hashicorp/terraform/issues/7916)) - * provider/vsphere: Standardizing datastore references to use builtin Path func ([#8075](https://github.com/hashicorp/terraform/issues/8075)) - * provider/consul: add tls config support to consul provider ([#7015](https://github.com/hashicorp/terraform/issues/7015)) - * remote/consul: Support setting datacenter when using consul remote state ([#8102](https://github.com/hashicorp/terraform/issues/8102)) - * provider/google: Support import of `google_compute_instance_template` ([#8147](https://github.com/hashicorp/terraform/issues/8147)), `google_compute_firewall` ([#8236](https://github.com/hashicorp/terraform/issues/8236)), `google_compute_target_pool` ([#8133](https://github.com/hashicorp/terraform/issues/8133)), `google_compute_fowarding_rule` ([#8122](https://github.com/hashicorp/terraform/issues/8122)), `google_compute_http_health_check` ([#8121](https://github.com/hashicorp/terraform/issues/8121)), `google_compute_autoscaler` ([#8115](https://github.com/hashicorp/terraform/issues/8115)) - -BUG FIXES: - * core: Fix issue preventing `taint` from working with resources that had no other attributes in their diff ([#8167](https://github.com/hashicorp/terraform/issues/8167)) - * core: CLI will only run exact match commands ([#7983](https://github.com/hashicorp/terraform/issues/7983)) - * core: Fix panic when resources ends up null in state file ([#8120](https://github.com/hashicorp/terraform/issues/8120)) - * core: Fix panic when validating a count with a unprefixed variable ([#8243](https://github.com/hashicorp/terraform/issues/8243)) - * core: Divide by zero in interpolations no longer panics ([#7701](https://github.com/hashicorp/terraform/issues/7701)) - * core: Fix panic on some invalid interpolation syntax ([#5672](https://github.com/hashicorp/terraform/issues/5672)) - * provider/aws: guard against missing image_digest in `aws_ecs_task_definition` ([#7966](https://github.com/hashicorp/terraform/issues/7966)) - * provider/aws: `aws_cloudformation_stack` now respects `timeout_in_minutes` field when waiting for CF API to finish an update operation ([#7997](https://github.com/hashicorp/terraform/issues/7997)) - * provider/aws: Prevent errors when `aws_s3_bucket` `acceleration_status` is not available in a given region ([#7999](https://github.com/hashicorp/terraform/issues/7999)) - * provider/aws: Add state filter to `aws_availability_zone`s data source ([#7965](https://github.com/hashicorp/terraform/issues/7965)) - * provider/aws: Handle lack of snapshot ID for a volume in `ami_copy` ([#7995](https://github.com/hashicorp/terraform/issues/7995)) - * provider/aws: Retry association of IAM Role & instance profile ([#7938](https://github.com/hashicorp/terraform/issues/7938)) - * provider/aws: Fix `aws_s3_bucket` resource `redirect_all_requests_to` action ([#7883](https://github.com/hashicorp/terraform/issues/7883)) - * provider/aws: Fix issue updating ElasticBeanstalk Environment Settings ([#7777](https://github.com/hashicorp/terraform/issues/7777)) - * provider/aws: `aws_rds_cluster` creation timeout bumped to 40 minutes ([#8052](https://github.com/hashicorp/terraform/issues/8052)) - * provider/aws: Update ElasticTranscoder to allow empty notifications, removing notifications, etc ([#8207](https://github.com/hashicorp/terraform/issues/8207)) - * provider/aws: Fix line ending errors/diffs with IAM Server Certs ([#8074](https://github.com/hashicorp/terraform/issues/8074)) - * provider/aws: Fixing IAM data source policy generation to prevent spurious diffs ([#6956](https://github.com/hashicorp/terraform/issues/6956)) - * provider/aws: Correct how CORS rules are handled in `aws_s3_bucket` ([#8096](https://github.com/hashicorp/terraform/issues/8096)) - * provider/aws: allow numeric characters in RedshiftClusterDbName ([#8178](https://github.com/hashicorp/terraform/issues/8178)) - * provider/aws: `aws_security_group` now creates tags as early as possible in the process ([#7849](https://github.com/hashicorp/terraform/issues/7849)) - * provider/aws: Defensively code around `db_security_group` ingress rules ([#7893](https://github.com/hashicorp/terraform/issues/7893)) - * provider/aws: `aws_spot_fleet_request` throws panic on missing subnet_id or availability_zone ([#8217](https://github.com/hashicorp/terraform/issues/8217)) - * provider/aws: Terraform fails during Redshift delete if FinalSnapshot is being taken. ([#8270](https://github.com/hashicorp/terraform/issues/8270)) - * provider/azurerm: `azurerm_storage_account` will interrupt for Ctrl-C ([#8215](https://github.com/hashicorp/terraform/issues/8215)) - * provider/azurerm: Public IP - Setting idle timeout value caused panic. #8283 - * provider/digitalocean: trim whitespace from ssh key ([#8173](https://github.com/hashicorp/terraform/issues/8173)) - * provider/digitalocean: Enforce Lowercase on IPV6 Addresses ([#7652](https://github.com/hashicorp/terraform/issues/7652)) - * provider/google: Use resource specific project when making queries/changes ([#7029](https://github.com/hashicorp/terraform/issues/7029)) - * provider/google: Fix read for the backend service resource ([#7476](https://github.com/hashicorp/terraform/issues/7476)) - * provider/mysql: `mysql_user` works with MySQL versions before 5.7.6 ([#8251](https://github.com/hashicorp/terraform/issues/8251)) - * provider/openstack: Fix typo in OpenStack LBaaSv2 pool resource ([#8179](https://github.com/hashicorp/terraform/issues/8179)) - * provider/vSphere: Fix for IPv6 only environment creation ([#7643](https://github.com/hashicorp/terraform/issues/7643)) - * provider/google: Correct update process for authorized networks in `google_sql_database_instance` ([#8290](https://github.com/hashicorp/terraform/issues/8290)) - -## 0.7.0 (August 2, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * Terraform Core - * Terraform's built-in plugins are now distributed as part of the main Terraform binary, and use the go-plugin framework. Overrides are still available using separate binaries, but will need recompiling against Terraform 0.7. - * The `terraform plan` command no longer persists state. This makes the command much safer to run, since it is now side-effect free. The `refresh` and `apply` commands still persist state to local and remote storage. Any automation that assumes that `terraform plan` persists state will need to be reworked to explicitly call `terraform refresh` to get the equivalent side-effect. (The `terraform plan` command no longer has the `-state-out` or `-backup` flags due to this change.) - * The `concat()` interpolation function can no longer be used to join strings. - * Quotation marks may no longer be escaped in HIL expressions ([#7201](https://github.com/hashicorp/terraform/issues/7201)) - * Lists materialized using splat syntax, for example `aws_instance.foo.*.id` are now ordered by the count index rather than lexographically sorted. If this produces a large number of undesirable differences, you can use the new `sort()` interpolation function to produce the previous behaviour. - * You now access the values of maps using the syntax `var.map["key"]` or the `lookup` function instead of `var.map.key`. - * Outputs on `terraform_remote_state` resources are now top level attributes rather than inside the `output` map. In order to access outputs, use the syntax: `terraform_remote_state.name.outputname`. Currently outputs cannot be named `config` or `backend`. - * AWS Provider - * `aws_elb` now defaults `cross_zone_load_balancing` to `true` - * `aws_instance`: EC2 Classic users may continue to use `security_groups` to reference Security Groups by their `name`. Users who are managing Instances inside VPCs will need to use `vpc_security_group_ids` instead, and reference the security groups by their `id`. Ref https://github.com/hashicorp/terraform/issues/6416#issuecomment-219145065 - * `aws_kinesis_firehose_delivery_stream`: AWS Kinesis Firehose has been refactored to support Redshift as a destination in addition to S3. As a result, the configuration has changed and users will need to update their configuration to match the new `s3_configuration` block. Checkout the documentaiton on [AWS Kinesis Firehose](http://localhost:4567/docs/providers/aws/r/kinesis_firehose_delivery_stream.html) for more information ([#7375](https://github.com/hashicorp/terraform/issues/7375)) - * `aws_route53_record`: `latency_routing_policy`, `geolocation_routing_policy`, and `failover_routing_policy` block options have been added. With these additions we’ve renamed the `weight` attribute to `weighted_routing_policy`, and it has changed from a string to a block to match the others. Please see the updated documentation on using `weighted_routing_policy`: https://www.terraform.io/docs/providers/aws/r/route53_record.html . ([#6954](https://github.com/hashicorp/terraform/issues/6954)) - * `aws_db_instance` now defaults `publicly_accessible` to false - * Microsoft Azure Provider - * In documentation, the "Azure (Resource Manager)" provider has been renamed to the "Microsoft Azure" provider. - * `azurerm_dns_cname_record` now accepts a single record rather than a list of records - * `azurerm_virtual_machine` computer_name now Required - * Openstack Provider - * `openstack_networking_subnet_v2` now defaults to turning DHCP on. - * `openstack_fw_policy_v1` now correctly applies rules in the order they are specified. Upon the next apply, current rules might be re-ordered. - * The `member` attribute of `openstack_lb_pool_v1` has been deprecated. Please ue the new `openstack_lb_member_v1` resource. - * Docker Provider - * `keep_updated` parameter removed from `docker_image` - This parameter never did what it was supposed to do. See relevant docs, specifically `pull_trigger` & new `docker_registry_image` data source to understand how to keep your `docker_image` updated. - * Atlas Provider - * `atlas_artifact` resource has be deprecated. Please use the new `atlas_artifact` Data Source. - * CloudStack Provider - * All deprecated parameters are removed from all `CloudStack` resources - -FEATURES: - - * **Data sources** are a new kind of primitive in Terraform. Attributes for data sources are refreshed and available during the planning stage. ([#6598](https://github.com/hashicorp/terraform/issues/6598)) - * **Lists and maps** can now be used as first class types for variables and may also be passed between modules. ([#6322](https://github.com/hashicorp/terraform/issues/6322)) - * **State management CLI commands** provide a variety of state manipulation functions for advanced use cases. This should be used where possible instead of manually modifying state files. ([#5811](https://github.com/hashicorp/terraform/issues/5811)) - * **State Import** allows a way to import existing resources into Terraform state for many types of resource. Initial coverage of AWS is quite high, and it is straightforward to add support for new resources. - * **New Command:** `terraform state` to provide access to a variety of state manipulation functions ([#5811](https://github.com/hashicorp/terraform/issues/5811)) - * **New Option:** `terraform output` now supports the `-json` flag to print a machine-readable representation of outputs ([#7608](https://github.com/hashicorp/terraform/issues/7608)) - * **New Data Source:** `aws_ami` ([#6911](https://github.com/hashicorp/terraform/issues/6911)) - * **New Data Source:** `aws_availability_zones` ([#6805](https://github.com/hashicorp/terraform/issues/6805)) - * **New Data Source:** `aws_iam_policy_document` ([#6881](https://github.com/hashicorp/terraform/issues/6881)) - * **New Data Source:** `aws_s3_bucket_object` ([#6946](https://github.com/hashicorp/terraform/issues/6946)) - * **New Data Source:** `aws_ecs_container_definition` ([#7230](https://github.com/hashicorp/terraform/issues/7230)) - * **New Data Source:** `atlas_artifact` ([#7419](https://github.com/hashicorp/terraform/issues/7419)) - * **New Data Source:** `docker_registry_image` ([#7000](https://github.com/hashicorp/terraform/issues/7000)) - * **New Data Source:** `consul_keys` ([#7678](https://github.com/hashicorp/terraform/issues/7678)) - * **New Interpolation Function:** `sort` ([#7128](https://github.com/hashicorp/terraform/issues/7128)) - * **New Interpolation Function:** `distinct` ([#7174](https://github.com/hashicorp/terraform/issues/7174)) - * **New Interpolation Function:** `list` ([#7528](https://github.com/hashicorp/terraform/issues/7528)) - * **New Interpolation Function:** `map` ([#7832](https://github.com/hashicorp/terraform/issues/7832)) - * **New Provider:** `grafana` ([#6206](https://github.com/hashicorp/terraform/issues/6206)) - * **New Provider:** `logentries` ([#7067](https://github.com/hashicorp/terraform/issues/7067)) - * **New Provider:** `scaleway` ([#7331](https://github.com/hashicorp/terraform/issues/7331)) - * **New Provider:** `random` - allows generation of random values without constantly generating diffs ([#6672](https://github.com/hashicorp/terraform/issues/6672)) - * **New Remote State Provider:** - `gcs` - Google Cloud Storage ([#6814](https://github.com/hashicorp/terraform/issues/6814)) - * **New Remote State Provider:** - `azure` - Microsoft Azure Storage ([#7064](https://github.com/hashicorp/terraform/issues/7064)) - * **New Resource:** `aws_elb_attachment` ([#6879](https://github.com/hashicorp/terraform/issues/6879)) - * **New Resource:** `aws_elastictranscoder_preset` ([#6965](https://github.com/hashicorp/terraform/issues/6965)) - * **New Resource:** `aws_elastictranscoder_pipeline` ([#6965](https://github.com/hashicorp/terraform/issues/6965)) - * **New Resource:** `aws_iam_group_policy_attachment` ([#6858](https://github.com/hashicorp/terraform/issues/6858)) - * **New Resource:** `aws_iam_role_policy_attachment` ([#6858](https://github.com/hashicorp/terraform/issues/6858)) - * **New Resource:** `aws_iam_user_policy_attachment` ([#6858](https://github.com/hashicorp/terraform/issues/6858)) - * **New Resource:** `aws_rds_cluster_parameter_group` ([#5269](https://github.com/hashicorp/terraform/issues/5269)) - * **New Resource:** `aws_spot_fleet_request` ([#7243](https://github.com/hashicorp/terraform/issues/7243)) - * **New Resource:** `aws_ses_active_receipt_rule_set` ([#5387](https://github.com/hashicorp/terraform/issues/5387)) - * **New Resource:** `aws_ses_receipt_filter` ([#5387](https://github.com/hashicorp/terraform/issues/5387)) - * **New Resource:** `aws_ses_receipt_rule` ([#5387](https://github.com/hashicorp/terraform/issues/5387)) - * **New Resource:** `aws_ses_receipt_rule_set` ([#5387](https://github.com/hashicorp/terraform/issues/5387)) - * **New Resource:** `aws_simpledb_domain` ([#7600](https://github.com/hashicorp/terraform/issues/7600)) - * **New Resource:** `aws_opsworks_user_profile` ([#6304](https://github.com/hashicorp/terraform/issues/6304)) - * **New Resource:** `aws_opsworks_permission` ([#6304](https://github.com/hashicorp/terraform/issues/6304)) - * **New Resource:** `aws_ami_launch_permission` ([#7365](https://github.com/hashicorp/terraform/issues/7365)) - * **New Resource:** `aws_appautoscaling_policy` ([#7663](https://github.com/hashicorp/terraform/issues/7663)) - * **New Resource:** `aws_appautoscaling_target` ([#7663](https://github.com/hashicorp/terraform/issues/7663)) - * **New Resource:** `openstack_blockstorage_volume_v2` ([#6693](https://github.com/hashicorp/terraform/issues/6693)) - * **New Resource:** `openstack_lb_loadbalancer_v2` ([#7012](https://github.com/hashicorp/terraform/issues/7012)) - * **New Resource:** `openstack_lb_listener_v2` ([#7012](https://github.com/hashicorp/terraform/issues/7012)) - * **New Resource:** `openstack_lb_pool_v2` ([#7012](https://github.com/hashicorp/terraform/issues/7012)) - * **New Resource:** `openstack_lb_member_v2` ([#7012](https://github.com/hashicorp/terraform/issues/7012)) - * **New Resource:** `openstack_lb_monitor_v2` ([#7012](https://github.com/hashicorp/terraform/issues/7012)) - * **New Resource:** `vsphere_virtual_disk` ([#6273](https://github.com/hashicorp/terraform/issues/6273)) - * **New Resource:** `github_repository_collaborator` ([#6861](https://github.com/hashicorp/terraform/issues/6861)) - * **New Resource:** `datadog_timeboard` ([#6900](https://github.com/hashicorp/terraform/issues/6900)) - * **New Resource:** `digitalocean_tag` ([#7500](https://github.com/hashicorp/terraform/issues/7500)) - * **New Resource:** `digitalocean_volume` ([#7560](https://github.com/hashicorp/terraform/issues/7560)) - * **New Resource:** `consul_agent_service` ([#7508](https://github.com/hashicorp/terraform/issues/7508)) - * **New Resource:** `consul_catalog_entry` ([#7508](https://github.com/hashicorp/terraform/issues/7508)) - * **New Resource:** `consul_node` ([#7508](https://github.com/hashicorp/terraform/issues/7508)) - * **New Resource:** `consul_service` ([#7508](https://github.com/hashicorp/terraform/issues/7508)) - * **New Resource:** `mysql_grant` ([#7656](https://github.com/hashicorp/terraform/issues/7656)) - * **New Resource:** `mysql_user` ([#7656](https://github.com/hashicorp/terraform/issues/7656)) - * **New Resource:** `azurerm_storage_table` ([#7327](https://github.com/hashicorp/terraform/issues/7327)) - * **New Resource:** `azurerm_virtual_machine_scale_set` ([#6711](https://github.com/hashicorp/terraform/issues/6711)) - * **New Resource:** `azurerm_traffic_manager_endpoint` ([#7826](https://github.com/hashicorp/terraform/issues/7826)) - * **New Resource:** `azurerm_traffic_manager_profile` ([#7826](https://github.com/hashicorp/terraform/issues/7826)) - * core: Tainted resources now show up in the plan and respect dependency ordering ([#6600](https://github.com/hashicorp/terraform/issues/6600)) - * core: The `lookup` interpolation function can now have a default fall-back value specified ([#6884](https://github.com/hashicorp/terraform/issues/6884)) - * core: The `terraform plan` command no longer persists state. ([#6811](https://github.com/hashicorp/terraform/issues/6811)) - -IMPROVEMENTS: - - * core: The `jsonencode` interpolation function now supports encoding lists and maps ([#6749](https://github.com/hashicorp/terraform/issues/6749)) - * core: Add the ability for resource definitions to mark attributes as "sensitive" which will omit them from UI output. ([#6923](https://github.com/hashicorp/terraform/issues/6923)) - * core: Support `.` in map keys ([#7654](https://github.com/hashicorp/terraform/issues/7654)) - * core: Enhance interpolation functions to account for first class maps and lists ([#7832](https://github.com/hashicorp/terraform/issues/7832)) ([#7834](https://github.com/hashicorp/terraform/issues/7834)) - * command: Remove second DefaultDataDirectory const ([#7666](https://github.com/hashicorp/terraform/issues/7666)) - * provider/aws: Add `dns_name` to `aws_efs_mount_target` ([#7428](https://github.com/hashicorp/terraform/issues/7428)) - * provider/aws: Add `force_destroy` to `aws_iam_user` for force-deleting access keys assigned to the user ([#7766](https://github.com/hashicorp/terraform/issues/7766)) - * provider/aws: Add `option_settings` to `aws_db_option_group` ([#6560](https://github.com/hashicorp/terraform/issues/6560)) - * provider/aws: Add more explicit support for Skipping Final Snapshot in RDS Cluster ([#6795](https://github.com/hashicorp/terraform/issues/6795)) - * provider/aws: Add support for S3 Bucket Acceleration ([#6628](https://github.com/hashicorp/terraform/issues/6628)) - * provider/aws: Add support for `kms_key_id` to `aws_db_instance` ([#6651](https://github.com/hashicorp/terraform/issues/6651)) - * provider/aws: Specifying more than one health check on an `aws_elb` fails with an error prior to making an API request ([#7489](https://github.com/hashicorp/terraform/issues/7489)) - * provider/aws: Add support to `aws_redshift_cluster` for `iam_roles` ([#6647](https://github.com/hashicorp/terraform/issues/6647)) - * provider/aws: SQS use raw policy string if compact fails ([#6724](https://github.com/hashicorp/terraform/issues/6724)) - * provider/aws: Set default description to "Managed by Terraform" ([#6104](https://github.com/hashicorp/terraform/issues/6104)) - * provider/aws: Support for Redshift Cluster encryption using a KMS key ([#6712](https://github.com/hashicorp/terraform/issues/6712)) - * provider/aws: Support tags for AWS redshift cluster ([#5356](https://github.com/hashicorp/terraform/issues/5356)) - * provider/aws: Add `iam_arn` to aws_cloudfront_origin_access_identity ([#6955](https://github.com/hashicorp/terraform/issues/6955)) - * provider/aws: Add `cross_zone_load_balancing` on `aws_elb` default to true ([#6897](https://github.com/hashicorp/terraform/issues/6897)) - * provider/aws: Add support for `character_set_name` to `aws_db_instance` ([#4861](https://github.com/hashicorp/terraform/issues/4861)) - * provider/aws: Add support for DB parameter group with RDS Cluster Instances (Aurora) ([#6865](https://github.com/hashicorp/terraform/issues/6865)) - * provider/aws: Add `name_prefix` to `aws_iam_instance_profile` and `aws_iam_role` ([#6939](https://github.com/hashicorp/terraform/issues/6939)) - * provider/aws: Allow authentication & credentials validation for federated IAM Roles and EC2 instance profiles ([#6536](https://github.com/hashicorp/terraform/issues/6536)) - * provider/aws: Rename parameter_group_name to db_cluster_parameter_group_name ([#7083](https://github.com/hashicorp/terraform/issues/7083)) - * provider/aws: Retry RouteTable Route/Assocation creation ([#7156](https://github.com/hashicorp/terraform/issues/7156)) - * provider/aws: `delegation_set_id` conflicts w/ `vpc_id` in `aws_route53_zone` as delegation sets can only be used for public zones ([#7213](https://github.com/hashicorp/terraform/issues/7213)) - * provider/aws: Support Elastic Beanstalk scheduledaction ([#7376](https://github.com/hashicorp/terraform/issues/7376)) - * provider/aws: Add support for NewInstancesProtectedFromScaleIn to `aws_autoscaling_group` ([#6490](https://github.com/hashicorp/terraform/issues/6490)) - * provider/aws: Added support for `snapshot_identifier` parameter in aws_rds_cluster ([#7158](https://github.com/hashicorp/terraform/issues/7158)) - * provider/aws: Add inplace edit/update DB Security Group Rule Ingress ([#7245](https://github.com/hashicorp/terraform/issues/7245)) - * provider/aws: Added support for redshift destination to firehose delivery streams ([#7375](https://github.com/hashicorp/terraform/issues/7375)) - * provider/aws: Allow `aws_redshift_security_group` ingress rules to change ([#5939](https://github.com/hashicorp/terraform/issues/5939)) - * provider/aws: Add support for `encryption` and `kms_key_id` to `aws_ami` ([#7181](https://github.com/hashicorp/terraform/issues/7181)) - * provider/aws: AWS prefix lists to enable security group egress to a VPC Endpoint ([#7511](https://github.com/hashicorp/terraform/issues/7511)) - * provider/aws: Retry creation of IAM role depending on new IAM user ([#7324](https://github.com/hashicorp/terraform/issues/7324)) - * provider/aws: Allow `port` on `aws_db_instance` to be updated ([#7441](https://github.com/hashicorp/terraform/issues/7441)) - * provider/aws: Allow VPC Classic Linking in Autoscaling Launch Configs ([#7470](https://github.com/hashicorp/terraform/issues/7470)) - * provider/aws: Support `task_role_arn` on `aws_ecs_task_definition ([#7653](https://github.com/hashicorp/terraform/issues/7653)) - * provider/aws: Support Tags on `aws_rds_cluster` ([#7695](https://github.com/hashicorp/terraform/issues/7695)) - * provider/aws: Support kms_key_id for `aws_rds_cluster` ([#7662](https://github.com/hashicorp/terraform/issues/7662)) - * provider/aws: Allow setting a `poll_interval` on `aws_elastic_beanstalk_environment` ([#7523](https://github.com/hashicorp/terraform/issues/7523)) - * provider/aws: Add support for Kinesis streams shard-level metrics ([#7684](https://github.com/hashicorp/terraform/issues/7684)) - * provider/aws: Support create / update greater than twenty db parameters in `aws_db_parameter_group` ([#7364](https://github.com/hashicorp/terraform/issues/7364)) - * provider/aws: expose network interface id in `aws_instance` ([#6751](https://github.com/hashicorp/terraform/issues/6751)) - * provider/aws: Adding passthrough behavior for API Gateway integration ([#7801](https://github.com/hashicorp/terraform/issues/7801)) - * provider/aws: Enable Redshift Cluster Logging ([#7813](https://github.com/hashicorp/terraform/issues/7813)) - * provider/aws: Add ability to set Performance Mode in `aws_efs_file_system` ([#7791](https://github.com/hashicorp/terraform/issues/7791)) - * provider/azurerm: Add support for EnableIPForwarding to `azurerm_network_interface` ([#6807](https://github.com/hashicorp/terraform/issues/6807)) - * provider/azurerm: Add support for exporting the `azurerm_storage_account` access keys ([#6742](https://github.com/hashicorp/terraform/issues/6742)) - * provider/azurerm: The Azure SDK now exposes better error messages ([#6976](https://github.com/hashicorp/terraform/issues/6976)) - * provider/azurerm: `azurerm_dns_zone` now returns `name_servers` ([#7434](https://github.com/hashicorp/terraform/issues/7434)) - * provider/azurerm: dump entire Request/Response in autorest Decorator ([#7719](https://github.com/hashicorp/terraform/issues/7719)) - * provider/azurerm: add option to delete VMs Data disks on termination ([#7793](https://github.com/hashicorp/terraform/issues/7793)) - * provider/clc: Add support for hyperscale and bareMetal server types and package installation - * provider/clc: Fix optional server password ([#6414](https://github.com/hashicorp/terraform/issues/6414)) - * provider/cloudstack: Add support for affinity groups to `cloudstack_instance` ([#6898](https://github.com/hashicorp/terraform/issues/6898)) - * provider/cloudstack: Enable swapping of ACLs without having to rebuild the network tier ([#6741](https://github.com/hashicorp/terraform/issues/6741)) - * provider/cloudstack: Improve ACL swapping ([#7315](https://github.com/hashicorp/terraform/issues/7315)) - * provider/cloudstack: Add project support to `cloudstack_network_acl` and `cloudstack_network_acl_rule` ([#7612](https://github.com/hashicorp/terraform/issues/7612)) - * provider/cloudstack: Add option to set `root_disk_size` to `cloudstack_instance` ([#7070](https://github.com/hashicorp/terraform/issues/7070)) - * provider/cloudstack: Do no longer force a new `cloudstack_instance` resource when updating `user_data` ([#7074](https://github.com/hashicorp/terraform/issues/7074)) - * provider/cloudstack: Add option to set `security_group_names` to `cloudstack_instance` ([#7240](https://github.com/hashicorp/terraform/issues/7240)) - * provider/cloudstack: Add option to set `affinity_group_names` to `cloudstack_instance` ([#7242](https://github.com/hashicorp/terraform/issues/7242)) - * provider/datadog: Add support for 'require full window' and 'locked' ([#6738](https://github.com/hashicorp/terraform/issues/6738)) - * provider/docker: Docker Container DNS Setting Enhancements ([#7392](https://github.com/hashicorp/terraform/issues/7392)) - * provider/docker: Add `destroy_grace_seconds` option to stop container before delete ([#7513](https://github.com/hashicorp/terraform/issues/7513)) - * provider/docker: Add `pull_trigger` option to `docker_image` to trigger pulling layers of a given image ([#7000](https://github.com/hashicorp/terraform/issues/7000)) - * provider/fastly: Add support for Cache Settings ([#6781](https://github.com/hashicorp/terraform/issues/6781)) - * provider/fastly: Add support for Service Request Settings on `fastly_service_v1` resources ([#6622](https://github.com/hashicorp/terraform/issues/6622)) - * provider/fastly: Add support for custom VCL configuration ([#6662](https://github.com/hashicorp/terraform/issues/6662)) - * provider/google: Support optional uuid naming for Instance Template ([#6604](https://github.com/hashicorp/terraform/issues/6604)) - * provider/openstack: Add support for client certificate authentication ([#6279](https://github.com/hashicorp/terraform/issues/6279)) - * provider/openstack: Allow Neutron-based Floating IP to target a specific tenant ([#6454](https://github.com/hashicorp/terraform/issues/6454)) - * provider/openstack: Enable DHCP By Default ([#6838](https://github.com/hashicorp/terraform/issues/6838)) - * provider/openstack: Implement fixed_ip on Neutron floating ip allocations ([#6837](https://github.com/hashicorp/terraform/issues/6837)) - * provider/openstack: Increase timeouts for image resize, subnets, and routers ([#6764](https://github.com/hashicorp/terraform/issues/6764)) - * provider/openstack: Add `lb_provider` argument to `lb_pool_v1` resource ([#6919](https://github.com/hashicorp/terraform/issues/6919)) - * provider/openstack: Enforce `ForceNew` on Instance Block Device ([#6921](https://github.com/hashicorp/terraform/issues/6921)) - * provider/openstack: Can now stop instances before destroying them ([#7184](https://github.com/hashicorp/terraform/issues/7184)) - * provider/openstack: Disassociate LBaaS v1 Monitors from Pool Before Deletion ([#6997](https://github.com/hashicorp/terraform/issues/6997)) - * provider/powerdns: Add support for PowerDNS 4 API ([#7819](https://github.com/hashicorp/terraform/issues/7819)) - * provider/triton: add `triton_machine` `domain names` ([#7149](https://github.com/hashicorp/terraform/issues/7149)) - * provider/vsphere: Add support for `controller_type` to `vsphere_virtual_machine` ([#6785](https://github.com/hashicorp/terraform/issues/6785)) - * provider/vsphere: Fix bug with `vsphere_virtual_machine` wait for ip ([#6377](https://github.com/hashicorp/terraform/issues/6377)) - * provider/vsphere: Virtual machine update disk ([#6619](https://github.com/hashicorp/terraform/issues/6619)) - * provider/vsphere: `vsphere_virtual_machine` adding controller creation logic ([#6853](https://github.com/hashicorp/terraform/issues/6853)) - * provider/vsphere: `vsphere_virtual_machine` added support for `mac address` on `network_interface` ([#6966](https://github.com/hashicorp/terraform/issues/6966)) - * provider/vsphere: Enhanced `vsphere` logging capabilities ([#6893](https://github.com/hashicorp/terraform/issues/6893)) - * provider/vsphere: Add DiskEnableUUID option to `vsphere_virtual_machine` ([#7088](https://github.com/hashicorp/terraform/issues/7088)) - * provider/vsphere: Virtual Machine and File resources handle Read errors properley ([#7220](https://github.com/hashicorp/terraform/issues/7220)) - * provider/vsphere: set uuid as `vsphere_virtual_machine` output ([#4382](https://github.com/hashicorp/terraform/issues/4382)) - * provider/vsphere: Add support for `keep_on_remove` to `vsphere_virtual_machine` ([#7169](https://github.com/hashicorp/terraform/issues/7169)) - * provider/vsphere: Add support for additional `vsphere_virtial_machine` SCSI controller types ([#7525](https://github.com/hashicorp/terraform/issues/7525)) - * provisioner/file: File provisioners may now have file content set as an attribute ([#7561](https://github.com/hashicorp/terraform/issues/7561)) - -BUG FIXES: - - * core: Correct the previous fix for a bug causing "attribute not found" messages during destroy, as it was insufficient ([#6599](https://github.com/hashicorp/terraform/issues/6599)) - * core: Fix issue causing syntax errors interpolating count attribute when value passed between modules ([#6833](https://github.com/hashicorp/terraform/issues/6833)) - * core: Fix "diffs didn't match during apply" error for computed sets ([#7205](https://github.com/hashicorp/terraform/issues/7205)) - * core: Fix issue where `terraform init .` would truncate existing files ([#7273](https://github.com/hashicorp/terraform/issues/7273)) - * core: Don't compare diffs between maps with computed values ([#7249](https://github.com/hashicorp/terraform/issues/7249)) - * core: Don't copy existing files over themselves when fetching modules ([#7273](https://github.com/hashicorp/terraform/issues/7273)) - * core: Always increment the state serial number when upgrading the version ([#7402](https://github.com/hashicorp/terraform/issues/7402)) - * core: Fix a crash during eval when we're upgrading an empty state ([#7403](https://github.com/hashicorp/terraform/issues/7403)) - * core: Honor the `-state-out` flag when applying with a plan file ([#7443](https://github.com/hashicorp/terraform/issues/7443)) - * core: Fix a panic when a `terraform_remote_state` data source doesn't exist ([#7464](https://github.com/hashicorp/terraform/issues/7464)) - * core: Fix issue where `ignore_changes` caused incorrect diffs on dependent resources ([#7563](https://github.com/hashicorp/terraform/issues/7563)) - * provider/aws: Manual changes to `aws_codedeploy_deployment_group` resources are now detected ([#7530](https://github.com/hashicorp/terraform/issues/7530)) - * provider/aws: Changing keys in `aws_dynamodb_table` correctly force new resources ([#6829](https://github.com/hashicorp/terraform/issues/6829)) - * provider/aws: Fix a bug where CloudWatch alarms are created repeatedly if the user does not have permission to use the the DescribeAlarms operation ([#7227](https://github.com/hashicorp/terraform/issues/7227)) - * provider/aws: Fix crash in `aws_elasticache_parameter_group` occuring following edits in the console ([#6687](https://github.com/hashicorp/terraform/issues/6687)) - * provider/aws: Fix issue reattaching a VPN gateway to a VPC ([#6987](https://github.com/hashicorp/terraform/issues/6987)) - * provider/aws: Fix issue with Root Block Devices and encrypted flag in Launch Configurations ([#6512](https://github.com/hashicorp/terraform/issues/6512)) - * provider/aws: If more ENIs are attached to `aws_instance`, the one w/ DeviceIndex `0` is always used in context of `aws_instance` (previously unpredictable) ([#6761](https://github.com/hashicorp/terraform/issues/6761)) - * provider/aws: Increased lambda event mapping creation timeout ([#7657](https://github.com/hashicorp/terraform/issues/7657)) - * provider/aws: Handle spurious failures in resourceAwsSecurityGroupRuleRead ([#7377](https://github.com/hashicorp/terraform/issues/7377)) - * provider/aws: Make 'stage_name' required in api_gateway_deployment ([#6797](https://github.com/hashicorp/terraform/issues/6797)) - * provider/aws: Mark Lambda function as gone when it's gone ([#6924](https://github.com/hashicorp/terraform/issues/6924)) - * provider/aws: Trim trailing `.` from `name` in `aws_route53_record` resources to prevent spurious diffs ([#6592](https://github.com/hashicorp/terraform/issues/6592)) - * provider/aws: Update Lambda functions on name change ([#7081](https://github.com/hashicorp/terraform/issues/7081)) - * provider/aws: Updating state when `aws_sns_topic_subscription` is missing ([#6629](https://github.com/hashicorp/terraform/issues/6629)) - * provider/aws: `aws_codedeploy_deployment_group` panic when setting `on_premises_instance_tag_filter` ([#6617](https://github.com/hashicorp/terraform/issues/6617)) - * provider/aws: `aws_db_instance` now defaults `publicly_accessible` to false ([#7117](https://github.com/hashicorp/terraform/issues/7117)) - * provider/aws: `aws_opsworks_application.app_source` SSH key is write-only ([#6649](https://github.com/hashicorp/terraform/issues/6649)) - * provider/aws: fix Elastic Beanstalk `cname_prefix` continual plans ([#6653](https://github.com/hashicorp/terraform/issues/6653)) - * provider/aws: Bundle IOPs and Allocated Storage update for DB Instances ([#7203](https://github.com/hashicorp/terraform/issues/7203)) - * provider/aws: Fix case when instanceId is absent in network interfaces ([#6851](https://github.com/hashicorp/terraform/issues/6851)) - * provider/aws: fix aws_security_group_rule refresh ([#6730](https://github.com/hashicorp/terraform/issues/6730)) - * provider/aws: Fix issue with Elastic Beanstalk and invalid settings ([#7222](https://github.com/hashicorp/terraform/issues/7222)) - * provider/aws: Fix issue where aws_app_cookie_stickiness_policy fails on destroy if LoadBalancer doesn't exist ([#7166](https://github.com/hashicorp/terraform/issues/7166)) - * provider/aws: Stickiness Policy exists, but isn't assigned to the ELB ([#7188](https://github.com/hashicorp/terraform/issues/7188)) - * provider/aws: Fix issue with `manage_bundler` on `aws_opsworks_layers` ([#7219](https://github.com/hashicorp/terraform/issues/7219)) - * provider/aws: Set Elastic Beanstalk stack name back to state ([#7445](https://github.com/hashicorp/terraform/issues/7445)) - * provider/aws: Allow recreation of VPC Peering Connection when state is rejected ([#7466](https://github.com/hashicorp/terraform/issues/7466)) - * provider/aws: Remove EFS File System from State when NotFound ([#7437](https://github.com/hashicorp/terraform/issues/7437)) - * provider/aws: `aws_customer_gateway` refreshing from state on deleted state ([#7482](https://github.com/hashicorp/terraform/issues/7482)) - * provider/aws: Retry finding `aws_route` after creating it ([#7463](https://github.com/hashicorp/terraform/issues/7463)) - * provider/aws: Refresh CloudWatch Group from state on 404 ([#7576](https://github.com/hashicorp/terraform/issues/7576)) - * provider/aws: Adding in additional retry logic due to latency with delete of `db_option_group` ([#7312](https://github.com/hashicorp/terraform/issues/7312)) - * provider/aws: Safely get ELB values ([#7585](https://github.com/hashicorp/terraform/issues/7585)) - * provider/aws: Fix bug for recurring plans on ec2-classic and vpc in beanstalk ([#6491](https://github.com/hashicorp/terraform/issues/6491)) - * provider/aws: Bump rds_cluster timeout to 15 mins ([#7604](https://github.com/hashicorp/terraform/issues/7604)) - * provider/aws: Fix ICMP fields in `aws_network_acl_rule` to allow ICMP code 0 (echo reply) to be configured ([#7669](https://github.com/hashicorp/terraform/issues/7669)) - * provider/aws: Fix bug with Updating `aws_autoscaling_group` `enabled_metrics` ([#7698](https://github.com/hashicorp/terraform/issues/7698)) - * provider/aws: Ignore IOPS on non io1 AWS root_block_device ([#7783](https://github.com/hashicorp/terraform/issues/7783)) - * provider/aws: Ignore missing ENI attachment when trying to detach ENI ([#7185](https://github.com/hashicorp/terraform/issues/7185)) - * provider/aws: Fix issue updating ElasticBeanstalk Environment templates ([#7811](https://github.com/hashicorp/terraform/issues/7811)) - * provider/aws: Restore Defaults to SQS Queues ([#7818](https://github.com/hashicorp/terraform/issues/7818)) - * provider/aws: Don't delete Lambda function from state on initial call of the Read func ([#7829](https://github.com/hashicorp/terraform/issues/7829)) - * provider/aws: `aws_vpn_gateway` should be removed from state when in deleted state ([#7861](https://github.com/hashicorp/terraform/issues/7861)) - * provider/aws: Fix aws_route53_record 0-2 migration ([#7907](https://github.com/hashicorp/terraform/issues/7907)) - * provider/azurerm: Fixes terraform crash when using SSH keys with `azurerm_virtual_machine` ([#6766](https://github.com/hashicorp/terraform/issues/6766)) - * provider/azurerm: Fix a bug causing 'diffs do not match' on `azurerm_network_interface` resources ([#6790](https://github.com/hashicorp/terraform/issues/6790)) - * provider/azurerm: Normalizes `availability_set_id` casing to avoid spurious diffs in `azurerm_virtual_machine` ([#6768](https://github.com/hashicorp/terraform/issues/6768)) - * provider/azurerm: Add support for storage container name validation ([#6852](https://github.com/hashicorp/terraform/issues/6852)) - * provider/azurerm: Remove storage containers and blobs when storage accounts are not found ([#6855](https://github.com/hashicorp/terraform/issues/6855)) - * provider/azurerm: `azurerm_virtual_machine` fix `additional_unattend_rm` Windows config option ([#7105](https://github.com/hashicorp/terraform/issues/7105)) - * provider/azurerm: Fix `azurerm_virtual_machine` windows_config ([#7123](https://github.com/hashicorp/terraform/issues/7123)) - * provider/azurerm: `azurerm_dns_cname_record` can create CNAME records again ([#7113](https://github.com/hashicorp/terraform/issues/7113)) - * provider/azurerm: `azurerm_network_security_group` now waits for the provisioning state of `ready` before proceeding ([#7307](https://github.com/hashicorp/terraform/issues/7307)) - * provider/azurerm: `computer_name` is now required for `azurerm_virtual_machine` resources ([#7308](https://github.com/hashicorp/terraform/issues/7308)) - * provider/azurerm: destroy azurerm_virtual_machine OS Disk VHD on deletion ([#7584](https://github.com/hashicorp/terraform/issues/7584)) - * provider/azurerm: catch `azurerm_template_deployment` erroring silently ([#7644](https://github.com/hashicorp/terraform/issues/7644)) - * provider/azurerm: changing the name of an `azurerm_virtual_machine` now forces a new resource ([#7646](https://github.com/hashicorp/terraform/issues/7646)) - * provider/azurerm: azurerm_storage_account now returns storage keys value instead of their names ([#7674](https://github.com/hashicorp/terraform/issues/7674)) - * provider/azurerm: `azurerm_virtual_machine` computer_name now Required ([#7308](https://github.com/hashicorp/terraform/issues/7308)) - * provider/azurerm: Change of `availability_set_id` on `azurerm_virtual_machine` should ForceNew ([#7650](https://github.com/hashicorp/terraform/issues/7650)) - * provider/azurerm: Wait for `azurerm_storage_account` to be available ([#7329](https://github.com/hashicorp/terraform/issues/7329)) - * provider/cloudflare: Fix issue upgrading CloudFlare Records created before v0.6.15 ([#6969](https://github.com/hashicorp/terraform/issues/6969)) - * provider/cloudstack: Fix using `cloudstack_network_acl` within a project ([#6743](https://github.com/hashicorp/terraform/issues/6743)) - * provider/cloudstack: Fix refresing `cloudstack_network_acl_rule` when the associated ACL is deleted ([#7612](https://github.com/hashicorp/terraform/issues/7612)) - * provider/cloudstack: Fix refresing `cloudstack_port_forward` when the associated IP address is no longer associated ([#7612](https://github.com/hashicorp/terraform/issues/7612)) - * provider/cloudstack: Fix creating `cloudstack_network` with offerings that do not support specifying IP ranges ([#7612](https://github.com/hashicorp/terraform/issues/7612)) - * provider/digitalocean: Stop `digitocean_droplet` forcing new resource on uppercase region ([#7044](https://github.com/hashicorp/terraform/issues/7044)) - * provider/digitalocean: Reassign Floating IP when droplet changes ([#7411](https://github.com/hashicorp/terraform/issues/7411)) - * provider/google: Fix a bug causing an error attempting to delete an already-deleted `google_compute_disk` ([#6689](https://github.com/hashicorp/terraform/issues/6689)) - * provider/mysql: Specifying empty provider credentials no longer causes a panic ([#7211](https://github.com/hashicorp/terraform/issues/7211)) - * provider/openstack: Reassociate Floating IP on network changes ([#6579](https://github.com/hashicorp/terraform/issues/6579)) - * provider/openstack: Ensure CIDRs Are Lower Case ([#6864](https://github.com/hashicorp/terraform/issues/6864)) - * provider/openstack: Rebuild Instances On Network Changes ([#6844](https://github.com/hashicorp/terraform/issues/6844)) - * provider/openstack: Firewall rules are applied in the correct order ([#7194](https://github.com/hashicorp/terraform/issues/7194)) - * provider/openstack: Fix Security Group EOF Error when Adding / Removing Multiple Groups ([#7468](https://github.com/hashicorp/terraform/issues/7468)) - * provider/openstack: Fixing boot volumes interfering with block storage volumes list ([#7649](https://github.com/hashicorp/terraform/issues/7649)) - * provider/vsphere: `gateway` and `ipv6_gateway` are now read from `vsphere_virtual_machine` resources ([#6522](https://github.com/hashicorp/terraform/issues/6522)) - * provider/vsphere: `ipv*_gateway` parameters won't force a new `vsphere_virtual_machine` ([#6635](https://github.com/hashicorp/terraform/issues/6635)) - * provider/vsphere: adding a `vsphere_virtual_machine` migration ([#7023](https://github.com/hashicorp/terraform/issues/7023)) - * provider/vsphere: Don't require vsphere debug paths to be set ([#7027](https://github.com/hashicorp/terraform/issues/7027)) - * provider/vsphere: Fix bug where `enable_disk_uuid` was not set on `vsphere_virtual_machine` resources ([#7275](https://github.com/hashicorp/terraform/issues/7275)) - * provider/vsphere: Make `vsphere_virtual_machine` `product_key` optional ([#7410](https://github.com/hashicorp/terraform/issues/7410)) - * provider/vsphere: Refreshing devices list after adding a disk or cdrom controller ([#7167](https://github.com/hashicorp/terraform/issues/7167)) - * provider/vsphere: `vsphere_virtual_machine` no longer has to be powered on to delete ([#7206](https://github.com/hashicorp/terraform/issues/7206)) - * provider/vSphere: Fixes the hasBootableVmdk flag when attaching multiple disks ([#7804](https://github.com/hashicorp/terraform/issues/7804)) - * provisioner/remote-exec: Properly seed random script paths so they are not deterministic across runs ([#7413](https://github.com/hashicorp/terraform/issues/7413)) - -## 0.6.16 (May 9, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `aws_eip` field `private_ip` is now a computed value, and cannot be set in your configuration. - Use `associate_with_private_ip` instead. See ([#6521](https://github.com/hashicorp/terraform/issues/6521)) - -FEATURES: - - * **New provider:** `librato` ([#3371](https://github.com/hashicorp/terraform/issues/3371)) - * **New provider:** `softlayer` ([#4327](https://github.com/hashicorp/terraform/issues/4327)) - * **New resource:** `aws_api_gateway_account` ([#6321](https://github.com/hashicorp/terraform/issues/6321)) - * **New resource:** `aws_api_gateway_authorizer` ([#6320](https://github.com/hashicorp/terraform/issues/6320)) - * **New resource:** `aws_db_event_subscription` ([#6367](https://github.com/hashicorp/terraform/issues/6367)) - * **New resource:** `aws_db_option_group` ([#4401](https://github.com/hashicorp/terraform/issues/4401)) - * **New resource:** `aws_eip_association` ([#6552](https://github.com/hashicorp/terraform/issues/6552)) - * **New resource:** `openstack_networking_secgroup_rule_v2` ([#6410](https://github.com/hashicorp/terraform/issues/6410)) - * **New resource:** `openstack_networking_secgroup_v2` ([#6410](https://github.com/hashicorp/terraform/issues/6410)) - * **New resource:** `vsphere_file` ([#6401](https://github.com/hashicorp/terraform/issues/6401)) - -IMPROVEMENTS: - - * core: update HCL dependency to improve whitespace handling in `terraform fmt` ([#6347](https://github.com/hashicorp/terraform/issues/6347)) - * core: Add support for marking outputs as sensitive ([#6559](https://github.com/hashicorp/terraform/issues/6559)) - * provider/aws: Add agent_version argument to `aws_opswork_stack` ([#6493](https://github.com/hashicorp/terraform/issues/6493)) - * provider/aws: Add support for request parameters to `api_gateway_method` & `api_gateway_integration` ([#6501](https://github.com/hashicorp/terraform/issues/6501)) - * provider/aws: Add support for response parameters to `api_gateway_method_response` & `api_gateway_integration_response` ([#6344](https://github.com/hashicorp/terraform/issues/6344)) - * provider/aws: Allow empty S3 config in Cloudfront Origin ([#6487](https://github.com/hashicorp/terraform/issues/6487)) - * provider/aws: Improve error handling in IAM Server Certificates ([#6442](https://github.com/hashicorp/terraform/issues/6442)) - * provider/aws: Use `sts:GetCallerIdentity` as additional method for getting AWS account ID ([#6385](https://github.com/hashicorp/terraform/issues/6385)) - * provider/aws: `aws_redshift_cluster` `automated_snapshot_retention_period` didn't allow 0 value ([#6537](https://github.com/hashicorp/terraform/issues/6537)) - * provider/aws: Add CloudFront `hosted_zone_id` attribute ([#6530](https://github.com/hashicorp/terraform/issues/6530)) - * provider/azurerm: Increase timeout for ARM Template deployments to 40 minutes ([#6319](https://github.com/hashicorp/terraform/issues/6319)) - * provider/azurerm: Make `private_ip_address` an exported field on `azurerm_network_interface` ([#6538](https://github.com/hashicorp/terraform/issues/6538)) - * provider/azurerm: Add support for `tags` to `azurerm_virtual_machine` ([#6556](https://github.com/hashicorp/terraform/issues/6556)) - * provider/azurerm: Add `os_type` and `image_uri` in `azurerm_virtual_machine` ([#6553](https://github.com/hashicorp/terraform/issues/6553)) - * provider/cloudflare: Add proxied option to `cloudflare_record` ([#5508](https://github.com/hashicorp/terraform/issues/5508)) - * provider/docker: Add ability to keep docker image locally on terraform destroy ([#6376](https://github.com/hashicorp/terraform/issues/6376)) - * provider/fastly: Add S3 Log Streaming to Fastly Service ([#6378](https://github.com/hashicorp/terraform/issues/6378)) - * provider/fastly: Add Conditions to Fastly Service ([#6481](https://github.com/hashicorp/terraform/issues/6481)) - * provider/github: Add support for Github Enterprise via base_url configuration option ([#6434](https://github.com/hashicorp/terraform/issues/6434)) - * provider/triton: Add support for specifying network interfaces on `triton machine` resources ([#6418](https://github.com/hashicorp/terraform/issues/6418)) - * provider/triton: Deleted firewall rules no longer prevent refresh ([#6529](https://github.com/hashicorp/terraform/issues/6529)) - * provider/vsphere: Add `skip_customization` option to `vsphere_virtual_machine` resources ([#6355](https://github.com/hashicorp/terraform/issues/6355)) - * provider/vsphere: Add ability to specify and mount bootable vmdk in `vsphere_virtual_machine` ([#6146](https://github.com/hashicorp/terraform/issues/6146)) - * provider/vsphere: Add support for IPV6 to `vsphere_virtual_machine` ([#6457](https://github.com/hashicorp/terraform/issues/6457)) - * provider/vsphere: Add support for `memory_reservation` to `vsphere_virtual_machine` ([#6036](https://github.com/hashicorp/terraform/issues/6036)) - * provider/vsphere: Checking for empty diskPath in `vsphere_virtual_machine` before creating ([#6400](https://github.com/hashicorp/terraform/issues/6400)) - * provider/vsphere: Support updates to vcpu and memory on `vsphere_virtual_machine` ([#6356](https://github.com/hashicorp/terraform/issues/6356)) - * remote/s3: Logic for loading credentials now follows the same [conventions as AWS provider](https://www.terraform.io/docs/providers/aws/index.html#authentication) which means it also supports EC2 role auth and session token (e.g. assumed IAM Roles) ([#5270](https://github.com/hashicorp/terraform/issues/5270)) - -BUG FIXES: - - * core: Boolean values in diffs are normalized to `true` and `false`, eliminating some erroneous diffs ([#6499](https://github.com/hashicorp/terraform/issues/6499)) - * core: Fix a bug causing "attribute not found" messages during destroy ([#6557](https://github.com/hashicorp/terraform/issues/6557)) - * provider/aws: Allow account ID checks on EC2 instances & w/ federated accounts ([#5030](https://github.com/hashicorp/terraform/issues/5030)) - * provider/aws: Fix an eventually consistent issue aws_security_group_rule and possible duplications ([#6325](https://github.com/hashicorp/terraform/issues/6325)) - * provider/aws: Fix bug where `aws_elastic_beanstalk_environment` ignored `wait_for_ready_timeout` ([#6358](https://github.com/hashicorp/terraform/issues/6358)) - * provider/aws: Fix bug where `aws_elastic_beanstalk_environment` update config template didn't work ([#6342](https://github.com/hashicorp/terraform/issues/6342)) - * provider/aws: Fix issue in updating CloudFront distribution LoggingConfig ([#6407](https://github.com/hashicorp/terraform/issues/6407)) - * provider/aws: Fix issue in upgrading AutoScaling Policy to use `min_adjustment_magnitude` ([#6440](https://github.com/hashicorp/terraform/issues/6440)) - * provider/aws: Fix issue replacing Network ACL Relationship ([#6421](https://github.com/hashicorp/terraform/issues/6421)) - * provider/aws: Fix issue with KMS Alias keys and name prefixes ([#6328](https://github.com/hashicorp/terraform/issues/6328)) - * provider/aws: Fix issue with encrypted snapshots of block devices in `aws_launch_configuration` resources ([#6452](https://github.com/hashicorp/terraform/issues/6452)) - * provider/aws: Fix read of `aws_cloudwatch_log_group` after an update is applied ([#6384](https://github.com/hashicorp/terraform/issues/6384)) - * provider/aws: Fix updating `number_of_nodes` on `aws_redshift_cluster` ([#6333](https://github.com/hashicorp/terraform/issues/6333)) - * provider/aws: Omit `aws_cloudfront_distribution` custom_error fields when not explicitly set ([#6382](https://github.com/hashicorp/terraform/issues/6382)) - * provider/aws: Refresh state on `aws_sqs_queue` not found ([#6381](https://github.com/hashicorp/terraform/issues/6381)) - * provider/aws: Respect `selection_pattern` in `aws_api_gateway_integration_response` (previously ignored field) ([#5893](https://github.com/hashicorp/terraform/issues/5893)) - * provider/aws: `aws_cloudfront_distribution` resources now require the `cookies` argument ([#6505](https://github.com/hashicorp/terraform/issues/6505)) - * provider/aws: `aws_route` crash when used with `aws_vpc_endpoint` ([#6338](https://github.com/hashicorp/terraform/issues/6338)) - * provider/aws: validate `cluster_id` length for `aws_elasticache_cluster` ([#6330](https://github.com/hashicorp/terraform/issues/6330)) - * provider/azurerm: `ssh_keys` can now be set for `azurerm_virtual_machine` resources, allowing provisioning ([#6541](https://github.com/hashicorp/terraform/issues/6541)) - * provider/azurerm: Fix issue that updating `azurerm_virtual_machine` was failing due to empty adminPassword ([#6528](https://github.com/hashicorp/terraform/issues/6528)) - * provider/azurerm: `storage_data_disk` settings now work correctly on `azurerm_virtual_machine` resources ([#6543](https://github.com/hashicorp/terraform/issues/6543)) - * provider/cloudflare: can manage apex records ([#6449](https://github.com/hashicorp/terraform/issues/6449)) - * provider/cloudflare: won't refresh with incorrect record if names match ([#6449](https://github.com/hashicorp/terraform/issues/6449)) - * provider/datadog: `notify_no_data` and `no_data_timeframe` are set correctly for `datadog_monitor` resources ([#6509](https://github.com/hashicorp/terraform/issues/6509)) - * provider/docker: Fix crash when using empty string in the `command` list in `docker_container` resources ([#6424](https://github.com/hashicorp/terraform/issues/6424)) - * provider/vsphere: Memory reservations are now set correctly in `vsphere_virtual_machine` resources ([#6482](https://github.com/hashicorp/terraform/issues/6482)) - -## 0.6.15 (April 22, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - * `aws_instance` - if you still use `security_groups` field for SG IDs - i.e. inside VPC, this will generate diffs during `plan` and `apply` will **recreate** the resource. Terraform expects IDs (VPC SGs) inside `vpc_security_group_ids`. - -FEATURES: - - * **New command:** `terraform fmt` to automatically normalize config file style ([#4955](https://github.com/hashicorp/terraform/issues/4955)) - * **New interpolation function:** `jsonencode` ([#5890](https://github.com/hashicorp/terraform/issues/5890)) - * **New provider:** `cobbler` ([#5969](https://github.com/hashicorp/terraform/issues/5969)) - * **New provider:** `fastly` ([#5814](https://github.com/hashicorp/terraform/issues/5814)) - * **New resource:** `aws_cloudfront_distribution` ([#5221](https://github.com/hashicorp/terraform/issues/5221)) - * **New resource:** `aws_cloudfront_origin_access_identity` ([#5221](https://github.com/hashicorp/terraform/issues/5221)) - * **New resource:** `aws_iam_user_ssh_key` ([#5774](https://github.com/hashicorp/terraform/issues/5774)) - * **New resource:** `aws_s3_bucket_notification` ([#5473](https://github.com/hashicorp/terraform/issues/5473)) - * **New resource:** `cloudstack_static_nat` ([#6004](https://github.com/hashicorp/terraform/issues/6004)) - * **New resource:** `consul_key_prefix` ([#5988](https://github.com/hashicorp/terraform/issues/5988)) - * **New resource:** `aws_default_network_acl` ([#6165](https://github.com/hashicorp/terraform/issues/6165)) - * **New resource:** `triton_fabric` ([#5920](https://github.com/hashicorp/terraform/issues/5920)) - * **New resource:** `triton_vlan` ([#5920](https://github.com/hashicorp/terraform/issues/5920)) - * **New resource:** `aws_opsworks_application` ([#4419](https://github.com/hashicorp/terraform/issues/4419)) - * **New resource:** `aws_opsworks_instance` ([#4276](https://github.com/hashicorp/terraform/issues/4276)) - * **New resource:** `aws_cloudwatch_log_subscription_filter` ([#5996](https://github.com/hashicorp/terraform/issues/5996)) - * **New resource:** `openstack_networking_router_route_v2` ([#6207](https://github.com/hashicorp/terraform/issues/6207)) - -IMPROVEMENTS: - - * command/apply: Output will now show periodic status updates of slow resources. ([#6163](https://github.com/hashicorp/terraform/issues/6163)) - * core: Variables passed between modules are now type checked ([#6185](https://github.com/hashicorp/terraform/issues/6185)) - * core: Smaller release binaries by stripping debug information ([#6238](https://github.com/hashicorp/terraform/issues/6238)) - * provider/aws: Add support for Step Scaling in `aws_autoscaling_policy` ([#4277](https://github.com/hashicorp/terraform/issues/4277)) - * provider/aws: Add support for `cname_prefix` to `aws_elastic_beanstalk_environment` resource ([#5966](https://github.com/hashicorp/terraform/issues/5966)) - * provider/aws: Add support for trigger_configuration to `aws_codedeploy_deployment_group` ([#5599](https://github.com/hashicorp/terraform/issues/5599)) - * provider/aws: Adding outputs for elastic_beanstalk_environment resource ([#5915](https://github.com/hashicorp/terraform/issues/5915)) - * provider/aws: Adds `wait_for_ready_timeout` option to `aws_elastic_beanstalk_environment` ([#5967](https://github.com/hashicorp/terraform/issues/5967)) - * provider/aws: Allow `aws_db_subnet_group` description to be updated ([#5921](https://github.com/hashicorp/terraform/issues/5921)) - * provider/aws: Allow multiple EIPs to associate to single ENI ([#6070](https://github.com/hashicorp/terraform/issues/6070)) - * provider/aws: Change `aws_elb` access_logs to list type ([#5065](https://github.com/hashicorp/terraform/issues/5065)) - * provider/aws: Check that InternetGateway exists before returning from creation ([#6105](https://github.com/hashicorp/terraform/issues/6105)) - * provider/aws: Don't Base64-encode EC2 userdata if it is already Base64 encoded ([#6140](https://github.com/hashicorp/terraform/issues/6140)) - * provider/aws: Making the Cloudwatch Event Rule Target `target_id` optional ([#5787](https://github.com/hashicorp/terraform/issues/5787)) - * provider/aws: Timeouts for `elasticsearch_domain` are increased ([#5910](https://github.com/hashicorp/terraform/issues/5910)) - * provider/aws: `aws_codecommit_repository` set `default_branch` only if defined ([#5904](https://github.com/hashicorp/terraform/issues/5904)) - * provider/aws: `aws_redshift_cluster` allows usernames with underscore in it ([#5935](https://github.com/hashicorp/terraform/issues/5935)) - * provider/aws: normalise json for `aws_sns_topic` ([#6089](https://github.com/hashicorp/terraform/issues/6089)) - * provider/aws: normalize json for `aws_cloudwatch_event_rule` ([#6025](https://github.com/hashicorp/terraform/issues/6025)) - * provider/aws: increase timeout for aws_redshift_cluster ([#6305](https://github.com/hashicorp/terraform/issues/6305)) - * provider/aws: Opsworks layers now support `custom_json` argument ([#4272](https://github.com/hashicorp/terraform/issues/4272)) - * provider/aws: Added migration for `tier` attribute in `aws_elastic_beanstalk_environment` ([#6167](https://github.com/hashicorp/terraform/issues/6167)) - * provider/aws: Use resource.Retry for route creation and deletion ([#6225](https://github.com/hashicorp/terraform/issues/6225)) - * provider/aws: Add support S3 Bucket Lifecycle Rule ([#6220](https://github.com/hashicorp/terraform/issues/6220)) - * provider/clc: Override default `account` alias in provider config ([#5785](https://github.com/hashicorp/terraform/issues/5785)) - * provider/cloudstack: Deprecate `ipaddress` in favour of `ip_address` in all resources ([#6010](https://github.com/hashicorp/terraform/issues/6010)) - * provider/cloudstack: Deprecate allowing names (instead of IDs) for parameters that reference other resources ([#6123](https://github.com/hashicorp/terraform/issues/6123)) - * provider/datadog: Add heredoc support to message, escalation_message, and query ([#5788](https://github.com/hashicorp/terraform/issues/5788)) - * provider/docker: Add support for docker run --user option ([#5300](https://github.com/hashicorp/terraform/issues/5300)) - * provider/github: Add support for privacy to `github_team` ([#6116](https://github.com/hashicorp/terraform/issues/6116)) - * provider/google: Accept GOOGLE_CLOUD_KEYFILE_JSON env var for credentials ([#6007](https://github.com/hashicorp/terraform/issues/6007)) - * provider/google: Add "project" argument and attribute to all GCP compute resources which inherit from the provider's value ([#6112](https://github.com/hashicorp/terraform/issues/6112)) - * provider/google: Make "project" attribute on provider configuration optional ([#6112](https://github.com/hashicorp/terraform/issues/6112)) - * provider/google: Read more common configuration values from the environment and clarify precedence ordering ([#6114](https://github.com/hashicorp/terraform/issues/6114)) - * provider/google: `addons_config` and `subnetwork` added as attributes to `google_container_cluster` ([#5871](https://github.com/hashicorp/terraform/issues/5871)) - * provider/fastly: Add support for Request Headers ([#6197](https://github.com/hashicorp/terraform/issues/6197)) - * provider/fastly: Add support for Gzip rules ([#6247](https://github.com/hashicorp/terraform/issues/6247)) - * provider/openstack: Add value_specs argument and attribute for routers ([#4898](https://github.com/hashicorp/terraform/issues/4898)) - * provider/openstack: Allow subnets with no gateway ([#6060](https://github.com/hashicorp/terraform/issues/6060)) - * provider/openstack: Enable Token Authentication ([#6081](https://github.com/hashicorp/terraform/issues/6081)) - * provider/postgresql: New `ssl_mode` argument allowing different SSL usage tradeoffs ([#6008](https://github.com/hashicorp/terraform/issues/6008)) - * provider/vsphere: Support for linked clones and Windows-specific guest config options ([#6087](https://github.com/hashicorp/terraform/issues/6087)) - * provider/vsphere: Checking for Powered Off State before `vsphere_virtual_machine` deletion ([#6283](https://github.com/hashicorp/terraform/issues/6283)) - * provider/vsphere: Support mounting ISO images to virtual cdrom drives ([#4243](https://github.com/hashicorp/terraform/issues/4243)) - * provider/vsphere: Fix missing ssh connection info ([#4283](https://github.com/hashicorp/terraform/issues/4283)) - * provider/google: Deprecate unused "region" attribute in `global_forwarding_rule`; this attribute was never used anywhere in the computation of the resource ([#6112](https://github.com/hashicorp/terraform/issues/6112)) - * provider/cloudstack: Add group attribute to `cloudstack_instance` resource ([#6023](https://github.com/hashicorp/terraform/issues/6023)) - * provider/azurerm: Provider meaningful error message when credentials not correct ([#6290](https://github.com/hashicorp/terraform/issues/6290)) - * provider/cloudstack: Improve support for using projects ([#6282](https://github.com/hashicorp/terraform/issues/6282)) - -BUG FIXES: - - * core: Providers are now correctly inherited down a nested module tree ([#6186](https://github.com/hashicorp/terraform/issues/6186)) - * provider/aws: Convert protocols to standard format for Security Groups ([#5881](https://github.com/hashicorp/terraform/issues/5881)) - * provider/aws: Fix Lambda VPC integration (missing `vpc_id` field in schema) ([#6157](https://github.com/hashicorp/terraform/issues/6157)) - * provider/aws: Fix `aws_route panic` when destination CIDR block is nil ([#5781](https://github.com/hashicorp/terraform/issues/5781)) - * provider/aws: Fix issue re-creating deleted VPC peering connections ([#5959](https://github.com/hashicorp/terraform/issues/5959)) - * provider/aws: Fix issue with changing iops when also changing storage type to io1 on RDS ([#5676](https://github.com/hashicorp/terraform/issues/5676)) - * provider/aws: Fix issue with retrying deletion of Network ACLs ([#5954](https://github.com/hashicorp/terraform/issues/5954)) - * provider/aws: Fix potential crash when receiving malformed `aws_route` API responses ([#5867](https://github.com/hashicorp/terraform/issues/5867)) - * provider/aws: Guard against empty responses from Lambda Permissions ([#5838](https://github.com/hashicorp/terraform/issues/5838)) - * provider/aws: Normalize and compact SQS Redrive, Policy JSON ([#5888](https://github.com/hashicorp/terraform/issues/5888)) - * provider/aws: Fix issue updating ElasticBeanstalk Configuraiton Templates ([#6307](https://github.com/hashicorp/terraform/issues/6307)) - * provider/aws: Remove CloudTrail Trail from state if not found ([#6024](https://github.com/hashicorp/terraform/issues/6024)) - * provider/aws: Fix crash in AWS S3 Bucket when website index/error is empty ([#6269](https://github.com/hashicorp/terraform/issues/6269)) - * provider/aws: Report better error message in `aws_route53_record` when `set_identifier` is required ([#5777](https://github.com/hashicorp/terraform/issues/5777)) - * provider/aws: Show human-readable error message when failing to read an EBS volume ([#6038](https://github.com/hashicorp/terraform/issues/6038)) - * provider/aws: set ASG `health_check_grace_period` default to 300 ([#5830](https://github.com/hashicorp/terraform/issues/5830)) - * provider/aws: Fix issue with with Opsworks and empty Custom Cook Book sources ([#6078](https://github.com/hashicorp/terraform/issues/6078)) - * provider/aws: wait for IAM instance profile to propagate when creating Opsworks stacks ([#6049](https://github.com/hashicorp/terraform/issues/6049)) - * provider/aws: Don't read back `aws_opsworks_stack` cookbooks source password ([#6203](https://github.com/hashicorp/terraform/issues/6203)) - * provider/aws: Resolves DefaultOS and ConfigurationManager conflict on `aws_opsworks_stack` ([#6244](https://github.com/hashicorp/terraform/issues/6244)) - * provider/aws: Renaming `aws_elastic_beanstalk_configuration_template``option_settings` to `setting` ([#6043](https://github.com/hashicorp/terraform/issues/6043)) - * provider/aws: `aws_customer_gateway` will properly populate `bgp_asn` on refresh. [no issue] - * provider/aws: provider/aws: Refresh state on `aws_directory_service_directory` not found ([#6294](https://github.com/hashicorp/terraform/issues/6294)) - * provider/aws: `aws_elb` `cross_zone_load_balancing` is not refreshed in the state file ([#6295](https://github.com/hashicorp/terraform/issues/6295)) - * provider/aws: `aws_autoscaling_group` will properly populate `tag` on refresh. [no issue] - * provider/azurerm: Fix detection of `azurerm_storage_account` resources removed manually ([#5878](https://github.com/hashicorp/terraform/issues/5878)) - * provider/docker: Docker Image will be deleted on destroy ([#5801](https://github.com/hashicorp/terraform/issues/5801)) - * provider/openstack: Fix Disabling DHCP on Subnets ([#6052](https://github.com/hashicorp/terraform/issues/6052)) - * provider/openstack: Fix resizing when Flavor Name changes ([#6020](https://github.com/hashicorp/terraform/issues/6020)) - * provider/openstack: Fix Access Address Detection ([#6181](https://github.com/hashicorp/terraform/issues/6181)) - * provider/openstack: Fix admin_state_up on openstack_lb_member_v1 ([#6267](https://github.com/hashicorp/terraform/issues/6267)) - * provider/triton: Firewall status on `triton_machine` resources is reflected correctly ([#6119](https://github.com/hashicorp/terraform/issues/6119)) - * provider/triton: Fix time out when applying updates to Triton machine metadata ([#6149](https://github.com/hashicorp/terraform/issues/6149)) - * provider/vsphere: Add error handling to `vsphere_folder` ([#6095](https://github.com/hashicorp/terraform/issues/6095)) - * provider/cloudstack: Fix mashalling errors when using CloudStack 4.7.x (or newer) [GH-#226] - -## 0.6.14 (March 21, 2016) - -FEATURES: - - * **New provider:** `triton` - Manage Joyent Triton public cloud or on-premise installations ([#5738](https://github.com/hashicorp/terraform/issues/5738)) - * **New provider:** `clc` - Manage CenturyLink Cloud resources ([#4893](https://github.com/hashicorp/terraform/issues/4893)) - * **New provider:** `github` - Manage GitHub Organization permissions with Terraform config ([#5194](https://github.com/hashicorp/terraform/issues/5194)) - * **New provider:** `influxdb` - Manage InfluxDB databases ([#3478](https://github.com/hashicorp/terraform/issues/3478)) - * **New provider:** `ultradns` - Manage UltraDNS records ([#5716](https://github.com/hashicorp/terraform/issues/5716)) - * **New resource:** `aws_cloudwatch_log_metric_filter` ([#5444](https://github.com/hashicorp/terraform/issues/5444)) - * **New resource:** `azurerm_virtual_machine` ([#5514](https://github.com/hashicorp/terraform/issues/5514)) - * **New resource:** `azurerm_template_deployment` ([#5758](https://github.com/hashicorp/terraform/issues/5758)) - * **New interpolation function:** `uuid` ([#5575](https://github.com/hashicorp/terraform/issues/5575)) - -IMPROVEMENTS: - - * core: provisioners connecting via WinRM now respect HTTPS settings ([#5761](https://github.com/hashicorp/terraform/issues/5761)) - * provider/aws: `aws_db_instance` now makes `identifier` optional and generates a unique ID when it is omitted ([#5723](https://github.com/hashicorp/terraform/issues/5723)) - * provider/aws: `aws_redshift_cluster` now allows`publicly_accessible` to be modified ([#5721](https://github.com/hashicorp/terraform/issues/5721)) - * provider/aws: `aws_kms_alias` now allows name to be auto-generated with a `name_prefix` ([#5594](https://github.com/hashicorp/terraform/issues/5594)) - -BUG FIXES: - - * core: Color output is now shown correctly when running Terraform on Windows ([#5718](https://github.com/hashicorp/terraform/issues/5718)) - * core: HEREDOCs can now be indented in line with configuration using `<<-` and hanging indent is removed ([#5740](https://github.com/hashicorp/terraform/issues/5740)) - * core: Invalid HCL syntax of nested object blocks no longer causes a crash ([#5740](https://github.com/hashicorp/terraform/issues/5740)) - * core: Local directory-based modules now use junctions instead of symbolic links on Windows ([#5739](https://github.com/hashicorp/terraform/issues/5739)) - * core: Modules sourced from a Mercurial repository now work correctly on Windows ([#5739](https://github.com/hashicorp/terraform/issues/5739)) - * core: Address some issues with ignore_changes ([#5635](https://github.com/hashicorp/terraform/issues/5635)) - * core: Add a lock to fix an interpolation issue caught by the Go 1.6 concurrent map access detector ([#5772](https://github.com/hashicorp/terraform/issues/5772)) - * provider/aws: Fix crash when an `aws_rds_cluster_instance` is removed outside of Terraform ([#5717](https://github.com/hashicorp/terraform/issues/5717)) - * provider/aws: `aws_cloudformation_stack` use `timeout_in_minutes` for retry timeout to prevent unecessary timeouts ([#5712](https://github.com/hashicorp/terraform/issues/5712)) - * provider/aws: `aws_lambda_function` resources no longer error on refresh if deleted externally to Terraform ([#5668](https://github.com/hashicorp/terraform/issues/5668)) - * provider/aws: `aws_vpn_connection` resources deleted via the console on longer cause a crash ([#5747](https://github.com/hashicorp/terraform/issues/5747)) - * provider/aws: Fix crasher in Elastic Beanstalk Configuration when using options ([#5756](https://github.com/hashicorp/terraform/issues/5756)) - * provider/aws: Fix issue preventing `aws_opsworks_stck` from working with Windows set as the OS ([#5724](https://github.com/hashicorp/terraform/issues/5724)) - * provider/digitalocean: `digitalocean_ssh_key` resources no longer cause a panic if there is no network connectivity ([#5748](https://github.com/hashicorp/terraform/issues/5748)) - * provider/google: Default description `google_dns_managed_zone` resources to "Managed By Terraform" ([#5428](https://github.com/hashicorp/terraform/issues/5428)) - * provider/google: Fix error message on invalid instance URL for `google_compute_instance_group` ([#5715](https://github.com/hashicorp/terraform/issues/5715)) - * provider/vsphere: provide `host` to provisioner connections ([#5558](https://github.com/hashicorp/terraform/issues/5558)) - * provisioner/remote-exec: Address race condition introduced with script cleanup step introduced in 0.6.13 ([#5751](https://github.com/hashicorp/terraform/issues/5751)) - -## 0.6.13 (March 16, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * provider/aws: `aws_s3_bucket_object` field `etag` is now trimming off quotes (returns raw MD5 hash) ([#5305](https://github.com/hashicorp/terraform/issues/5305)) - * provider/aws: `aws_autoscaling_group` now supports metrics collection, so a diff installing the default value of `1Minute` for the `metrics_granularity` field is expected. This diff should resolve in the next `terraform apply` w/ no AWS API calls ([#4688](https://github.com/hashicorp/terraform/issues/4688)) - * provider/consul: `consul_keys` `key` blocks now respect `delete` flag for removing individual blocks. Previously keys would be deleted only when the entire resource was removed. - * provider/google: `next_hop_network` on `google_compute_route` is now read-only, to mirror the behavior in the official docs ([#5564](https://github.com/hashicorp/terraform/issues/5564)) - * state/remote/http: PUT requests for this backend will now have `Content-Type: application/json` instead of `application/octet-stream` ([#5499](https://github.com/hashicorp/terraform/issues/5499)) - -FEATURES: - - * **New command:** `terraform untaint` ([#5527](https://github.com/hashicorp/terraform/issues/5527)) - * **New resource:** `aws_api_gateway_api_key` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_deployment` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_integration_response` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_integration` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_method_response` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_method` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_model` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_resource` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_api_gateway_rest_api` ([#4295](https://github.com/hashicorp/terraform/issues/4295)) - * **New resource:** `aws_elastic_beanstalk_application` ([#3157](https://github.com/hashicorp/terraform/issues/3157)) - * **New resource:** `aws_elastic_beanstalk_configuration_template` ([#3157](https://github.com/hashicorp/terraform/issues/3157)) - * **New resource:** `aws_elastic_beanstalk_environment` ([#3157](https://github.com/hashicorp/terraform/issues/3157)) - * **New resource:** `aws_iam_account_password_policy` ([#5029](https://github.com/hashicorp/terraform/issues/5029)) - * **New resource:** `aws_kms_alias` ([#3928](https://github.com/hashicorp/terraform/issues/3928)) - * **New resource:** `aws_kms_key` ([#3928](https://github.com/hashicorp/terraform/issues/3928)) - * **New resource:** `google_compute_instance_group` ([#4087](https://github.com/hashicorp/terraform/issues/4087)) - -IMPROVEMENTS: - - * provider/aws: Add `repository_link` as a computed field for `aws_ecr_repository` ([#5524](https://github.com/hashicorp/terraform/issues/5524)) - * provider/aws: Add ability to update Route53 zone comments ([#5318](https://github.com/hashicorp/terraform/issues/5318)) - * provider/aws: Add support for Metrics Collection to `aws_autoscaling_group` ([#4688](https://github.com/hashicorp/terraform/issues/4688)) - * provider/aws: Add support for `description` to `aws_network_interface` ([#5523](https://github.com/hashicorp/terraform/issues/5523)) - * provider/aws: Add support for `storage_encrypted` to `aws_rds_cluster` ([#5520](https://github.com/hashicorp/terraform/issues/5520)) - * provider/aws: Add support for routing rules on `aws_s3_bucket` resources ([#5327](https://github.com/hashicorp/terraform/issues/5327)) - * provider/aws: Enable updates & versioning for `aws_s3_bucket_object` ([#5305](https://github.com/hashicorp/terraform/issues/5305)) - * provider/aws: Guard against Nil Reference in Redshift Endpoints ([#5593](https://github.com/hashicorp/terraform/issues/5593)) - * provider/aws: Lambda S3 object version defaults to `$LATEST` if unspecified ([#5370](https://github.com/hashicorp/terraform/issues/5370)) - * provider/aws: Retry DB Creation on IAM propigation error ([#5515](https://github.com/hashicorp/terraform/issues/5515)) - * provider/aws: Support KMS encryption of S3 objects ([#5453](https://github.com/hashicorp/terraform/issues/5453)) - * provider/aws: `aws_autoscaling_lifecycle_hook` now have `notification_target_arn` and `role_arn` as optional ([#5616](https://github.com/hashicorp/terraform/issues/5616)) - * provider/aws: `aws_ecs_service` validates number of `load_balancer`s before creation/updates ([#5605](https://github.com/hashicorp/terraform/issues/5605)) - * provider/aws: send Terraform version in User-Agent ([#5621](https://github.com/hashicorp/terraform/issues/5621)) - * provider/cloudflare: Change `cloudflare_record` type to ForceNew ([#5353](https://github.com/hashicorp/terraform/issues/5353)) - * provider/consul: `consul_keys` now detects drift and supports deletion of individual `key` blocks ([#5210](https://github.com/hashicorp/terraform/issues/5210)) - * provider/digitalocean: Guard against Nil reference in `digitalocean_droplet` ([#5588](https://github.com/hashicorp/terraform/issues/5588)) - * provider/docker: Add support for `unless-stopped` to docker container `restart_policy` ([#5337](https://github.com/hashicorp/terraform/issues/5337)) - * provider/google: Mark `next_hop_network` as read-only on `google_compute_route` ([#5564](https://github.com/hashicorp/terraform/issues/5564)) - * provider/google: Validate VPN tunnel peer_ip at plan time ([#5501](https://github.com/hashicorp/terraform/issues/5501)) - * provider/openstack: Add Support for Domain ID and Domain Name environment variables ([#5355](https://github.com/hashicorp/terraform/issues/5355)) - * provider/openstack: Add support for instances to have multiple ephemeral disks. ([#5131](https://github.com/hashicorp/terraform/issues/5131)) - * provider/openstack: Re-Add server.AccessIPv4 and server.AccessIPv6 ([#5366](https://github.com/hashicorp/terraform/issues/5366)) - * provider/vsphere: Add support for disk init types ([#4284](https://github.com/hashicorp/terraform/issues/4284)) - * provisioner/remote-exec: Clear out scripts after uploading ([#5577](https://github.com/hashicorp/terraform/issues/5577)) - * state/remote/http: Change content type of PUT requests to the more appropriate `application/json` ([#5499](https://github.com/hashicorp/terraform/issues/5499)) - -BUG FIXES: - - * core: Disallow negative indices in the element() interpolation function, preventing crash ([#5263](https://github.com/hashicorp/terraform/issues/5263)) - * core: Fix issue that caused tainted resource destroys to be improperly filtered out when using -target and a plan file ([#5516](https://github.com/hashicorp/terraform/issues/5516)) - * core: Fix several issues with retry logic causing spurious "timeout while waiting for state to become ..." errors and unnecessary retry loops ([#5460](https://github.com/hashicorp/terraform/issues/5460)), ([#5538](https://github.com/hashicorp/terraform/issues/5538)), ([#5543](https://github.com/hashicorp/terraform/issues/5543)), ([#5553](https://github.com/hashicorp/terraform/issues/5553)) - * core: Includes upstream HCL fix to properly detect unbalanced braces and throw an error ([#5400](https://github.com/hashicorp/terraform/issues/5400)) - * provider/aws: Allow recovering from failed CloudWatch Event Target creation ([#5395](https://github.com/hashicorp/terraform/issues/5395)) - * provider/aws: Fix EC2 Classic SG Rule issue when referencing rules by name ([#5533](https://github.com/hashicorp/terraform/issues/5533)) - * provider/aws: Fix `aws_cloudformation_stack` update for `parameters` & `capabilities` if unmodified ([#5603](https://github.com/hashicorp/terraform/issues/5603)) - * provider/aws: Fix a bug where AWS Kinesis Stream includes closed shards in the shard_count ([#5401](https://github.com/hashicorp/terraform/issues/5401)) - * provider/aws: Fix a bug where ElasticSearch Domain tags were not being set correctly ([#5361](https://github.com/hashicorp/terraform/issues/5361)) - * provider/aws: Fix a bug where `aws_route` would show continual changes in the plan when not computed ([#5321](https://github.com/hashicorp/terraform/issues/5321)) - * provider/aws: Fix a bug where `publicly_assessible` wasn't being set to state in `aws_db_instance` ([#5535](https://github.com/hashicorp/terraform/issues/5535)) - * provider/aws: Fix a bug where listener protocol on `aws_elb` resources was case insensitive ([#5376](https://github.com/hashicorp/terraform/issues/5376)) - * provider/aws: Fix a bug which caused panics creating rules on security groups in EC2 Classic ([#5329](https://github.com/hashicorp/terraform/issues/5329)) - * provider/aws: Fix crash when `aws_lambda_function` VpcId is nil ([#5182](https://github.com/hashicorp/terraform/issues/5182)) - * provider/aws: Fix error with parsing JSON in `aws_s3_bucket` policy attribute ([#5474](https://github.com/hashicorp/terraform/issues/5474)) - * provider/aws: `aws_lambda_function` can be properly updated, either via `s3_object_version` or via `filename` & `source_code_hash` as described in docs ([#5239](https://github.com/hashicorp/terraform/issues/5239)) - * provider/google: Fix managed instance group preemptible instance creation ([#4834](https://github.com/hashicorp/terraform/issues/4834)) - * provider/openstack: Account for a 403 reply when os-tenant-networks is disabled ([#5432](https://github.com/hashicorp/terraform/issues/5432)) - * provider/openstack: Fix crashing during certain network updates in instances ([#5365](https://github.com/hashicorp/terraform/issues/5365)) - * provider/openstack: Fix create/delete statuses in load balancing resources ([#5557](https://github.com/hashicorp/terraform/issues/5557)) - * provider/openstack: Fix race condition between instance deletion and volume detachment ([#5359](https://github.com/hashicorp/terraform/issues/5359)) - * provider/template: Warn when `template` attribute specified as path ([#5563](https://github.com/hashicorp/terraform/issues/5563)) - -INTERNAL IMPROVEMENTS: - - * helper/schema: `MaxItems` attribute on schema lists and sets ([#5218](https://github.com/hashicorp/terraform/issues/5218)) - -## 0.6.12 (February 24, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * The `publicly_accessible` attribute on `aws_redshift_cluster` resources now defaults to true - -FEATURES: - - * **New command:** `validate` to perform syntax validation ([#3783](https://github.com/hashicorp/terraform/issues/3783)) - * **New provider:** `datadog` ([#5251](https://github.com/hashicorp/terraform/issues/5251)) - * **New interpolation function:** `md5` ([#5267](https://github.com/hashicorp/terraform/issues/5267)) - * **New interpolation function:** `signum` ([#4854](https://github.com/hashicorp/terraform/issues/4854)) - * **New resource:** `aws_cloudwatch_event_rule` ([#4986](https://github.com/hashicorp/terraform/issues/4986)) - * **New resource:** `aws_cloudwatch_event_target` ([#4986](https://github.com/hashicorp/terraform/issues/4986)) - * **New resource:** `aws_lambda_permission` ([#4826](https://github.com/hashicorp/terraform/issues/4826)) - * **New resource:** `azurerm_dns_a_record` ([#5013](https://github.com/hashicorp/terraform/issues/5013)) - * **New resource:** `azurerm_dns_aaaa_record` ([#5013](https://github.com/hashicorp/terraform/issues/5013)) - * **New resource:** `azurerm_dns_cname_record` ([#5013](https://github.com/hashicorp/terraform/issues/5013)) - * **New resource:** `azurerm_dns_mx_record` ([#5041](https://github.com/hashicorp/terraform/issues/5041)) - * **New resource:** `azurerm_dns_ns_record` ([#5041](https://github.com/hashicorp/terraform/issues/5041)) - * **New resource:** `azurerm_dns_srv_record` ([#5041](https://github.com/hashicorp/terraform/issues/5041)) - * **New resource:** `azurerm_dns_txt_record` ([#5041](https://github.com/hashicorp/terraform/issues/5041)) - * **New resource:** `azurerm_dns_zone` ([#4979](https://github.com/hashicorp/terraform/issues/4979)) - * **New resource:** `azurerm_search_service` ([#5203](https://github.com/hashicorp/terraform/issues/5203)) - * **New resource:** `azurerm_sql_database` ([#5003](https://github.com/hashicorp/terraform/issues/5003)) - * **New resource:** `azurerm_sql_firewall_rule` ([#5057](https://github.com/hashicorp/terraform/issues/5057)) - * **New resource:** `azurerm_sql_server` ([#4991](https://github.com/hashicorp/terraform/issues/4991)) - * **New resource:** `google_compute_subnetwork` ([#5130](https://github.com/hashicorp/terraform/issues/5130)) - -IMPROVEMENTS: - - * core: Backend names are now down cased during `init` in the same manner as `remote config` ([#5012](https://github.com/hashicorp/terraform/issues/5012)) - * core: Upgrade resource name validation warning to an error as planned ([#5272](https://github.com/hashicorp/terraform/issues/5272)) - * core: output "diffs didn't match" error details ([#5276](https://github.com/hashicorp/terraform/issues/5276)) - * provider/aws: Add `is_multi_region_trail` option to CloudTrail ([#4939](https://github.com/hashicorp/terraform/issues/4939)) - * provider/aws: Add support for HTTP(S) endpoints that auto confirm SNS subscription ([#4711](https://github.com/hashicorp/terraform/issues/4711)) - * provider/aws: Add support for Tags to CloudTrail ([#5135](https://github.com/hashicorp/terraform/issues/5135)) - * provider/aws: Add support for Tags to ElasticSearch ([#4973](https://github.com/hashicorp/terraform/issues/4973)) - * provider/aws: Add support for deployment configuration to `aws_ecs_service` ([#5220](https://github.com/hashicorp/terraform/issues/5220)) - * provider/aws: Add support for log validation + KMS encryption to `aws_cloudtrail` ([#5051](https://github.com/hashicorp/terraform/issues/5051)) - * provider/aws: Allow name-prefix and auto-generated names for IAM Server Cert ([#5178](https://github.com/hashicorp/terraform/issues/5178)) - * provider/aws: Expose additional VPN Connection attributes ([#5032](https://github.com/hashicorp/terraform/issues/5032)) - * provider/aws: Return an error if no matching route is found for an AWS Route ([#5155](https://github.com/hashicorp/terraform/issues/5155)) - * provider/aws: Support custom endpoints for AWS EC2 ELB and IAM ([#5114](https://github.com/hashicorp/terraform/issues/5114)) - * provider/aws: The `cluster_type` on `aws_redshift_cluster` resources is now computed ([#5238](https://github.com/hashicorp/terraform/issues/5238)) - * provider/aws: `aws_lambda_function` resources now support VPC configuration ([#5149](https://github.com/hashicorp/terraform/issues/5149)) - * provider/aws: Add support for Enhanced Monitoring to RDS Instances ([#4945](https://github.com/hashicorp/terraform/issues/4945)) - * provider/aws: Improve vpc cidr_block err message ([#5255](https://github.com/hashicorp/terraform/issues/5255)) - * provider/aws: Implement Retention Period for `aws_kinesis_stream` ([#5223](https://github.com/hashicorp/terraform/issues/5223)) - * provider/aws: Enable `stream_arm` output for DynamoDB Table when streams are enabled ([#5271](https://github.com/hashicorp/terraform/issues/5271)) - * provider/digitalocean: `digitalocean_record` resources now export a computed `fqdn` attribute ([#5071](https://github.com/hashicorp/terraform/issues/5071)) - * provider/google: Add assigned IP Address to CloudSQL Instance `google_sql_database_instance` ([#5245](https://github.com/hashicorp/terraform/issues/5245)) - * provider/openstack: Add support for Distributed Routers ([#4878](https://github.com/hashicorp/terraform/issues/4878)) - * provider/openstack: Add support for optional cacert_file parameter ([#5106](https://github.com/hashicorp/terraform/issues/5106)) - -BUG FIXES: - - * core: Fix bug detecting deeply nested module orphans ([#5022](https://github.com/hashicorp/terraform/issues/5022)) - * core: Fix bug where `ignore_changes` could produce "diffs didn't match during apply" errors ([#4965](https://github.com/hashicorp/terraform/issues/4965)) - * core: Fix race condition when handling tainted resource destroys ([#5026](https://github.com/hashicorp/terraform/issues/5026)) - * core: Improve handling of Provisioners in the graph, fixing "Provisioner already initialized" errors ([#4877](https://github.com/hashicorp/terraform/issues/4877)) - * core: Skip `create_before_destroy` processing during a `terraform destroy`, solving several issues preventing `destroy` - from working properly with CBD resources ([#5096](https://github.com/hashicorp/terraform/issues/5096)) - * core: Error instead of panic on self var in wrong scope ([#5273](https://github.com/hashicorp/terraform/issues/5273)) - * provider/aws: Fix Copy of Tags to DB Instance when created from Snapshot ([#5197](https://github.com/hashicorp/terraform/issues/5197)) - * provider/aws: Fix DynamoDB Table Refresh to ensure deleted tables are removed from state ([#4943](https://github.com/hashicorp/terraform/issues/4943)) - * provider/aws: Fix ElasticSearch `domain_name` validation ([#4973](https://github.com/hashicorp/terraform/issues/4973)) - * provider/aws: Fix issue applying security group changes in EC2 Classic RDS for aws_db_instance ([#4969](https://github.com/hashicorp/terraform/issues/4969)) - * provider/aws: Fix reading auto scaling group availability zones ([#5044](https://github.com/hashicorp/terraform/issues/5044)) - * provider/aws: Fix reading auto scaling group load balancers ([#5045](https://github.com/hashicorp/terraform/issues/5045)) - * provider/aws: Fix `aws_redshift_cluster` to allow `publicly_accessible` to be false ([#5262](https://github.com/hashicorp/terraform/issues/5262)) - * provider/aws: Wait longer for internet gateways to detach ([#5120](https://github.com/hashicorp/terraform/issues/5120)) - * provider/aws: Fix issue reading auto scaling group termination policies ([#5101](https://github.com/hashicorp/terraform/issues/5101)) - * provider/cloudflare: `ttl` no longer shows a change on each plan on `cloudflare_record` resources ([#5042](https://github.com/hashicorp/terraform/issues/5042)) - * provider/docker: Fix the default docker_host value ([#5088](https://github.com/hashicorp/terraform/issues/5088)) - * provider/google: Fix backend service max_utilization attribute ([#5075](https://github.com/hashicorp/terraform/issues/5075)) - * provider/google: Fix reading of `google_compute_vpn_gateway` without an explicit ([#5125](https://github.com/hashicorp/terraform/issues/5125)) - * provider/google: Fix crash when setting `ack_deadline_seconds` on `google_pubsub_subscription` ([#5110](https://github.com/hashicorp/terraform/issues/5110)) - * provider/openstack: Fix crash when `access_network` was not defined in instances ([#4966](https://github.com/hashicorp/terraform/issues/4966)) - * provider/powerdns: Fix refresh of `powerdns_record` no longer fails if the record name contains a `-` ([#5228](https://github.com/hashicorp/terraform/issues/5228)) - * provider/vcd: Wait for DHCP assignment when creating `vcd_vapp` resources with no static IP assignment ([#5195](https://github.com/hashicorp/terraform/issues/5195)) - -## 0.6.11 (February 1, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * The `max_size`, `min_size` and `desired_capacity` attributes on `aws_autoscaling_schedule` resources now default to 0 - -FEATURES: - - * **New provider: `powerdns` - PowerDNS REST API** ([#4885](https://github.com/hashicorp/terraform/issues/4885)) - * **New builtin function:** `trimspace` for trimming whitespaces ([#4910](https://github.com/hashicorp/terraform/issues/4910)) - * **New builtin function:** `base64sha256` for base64 encoding raw sha256 sum of a given string ([#4899](https://github.com/hashicorp/terraform/issues/4899)) - * **New resource:** `openstack_lb_member_v1` ([#4359](https://github.com/hashicorp/terraform/issues/4359)) - -IMPROVEMENTS: - - * provider/template: Remove unnecessary mime-type validation from `template_cloudinit_config` resources ([#4873](https://github.com/hashicorp/terraform/issues/4873)) - * provider/template: Correct spelling of "Boundary" in the part separator of rendered `template_cloudinit_config` resources ([#4873](https://github.com/hashicorp/terraform/issues/4873)) - * provider/aws: Provide a better message if no AWS creds are found ([#4869](https://github.com/hashicorp/terraform/issues/4869)) - * provider/openstack: Ability to specify per-network Floating IPs ([#4812](https://github.com/hashicorp/terraform/issues/4812)) - -BUG FIXES: - - * provider/aws: `aws_autoscale_schedule` 0 values ([#4693](https://github.com/hashicorp/terraform/issues/4693)) - * provider/aws: Fix regression with VPCs and ClassicLink for regions that do not support it ([#4879](https://github.com/hashicorp/terraform/issues/4879)) - * provider/aws: Change VPC ClassicLink to be computed ([#4933](https://github.com/hashicorp/terraform/issues/4933)) - * provider/aws: Fix SNS Topic Refresh to ensure deleted topics are removed from state ([#4891](https://github.com/hashicorp/terraform/issues/4891)) - * provider/aws: Refactor Route53 record to fix regression in deleting records created in previous versions of Terraform ([#4892](https://github.com/hashicorp/terraform/issues/4892)) - * provider/azurerm: Fix panic if no creds supplied ([#4902](https://github.com/hashicorp/terraform/issues/4902)) - * provider/openstack: Changing the port resource to mark the ip_address as optional ([#4850](https://github.com/hashicorp/terraform/issues/4850)) - * provider/docker: Catch potential custom network errors in docker ([#4918](https://github.com/hashicorp/terraform/issues/4918)) - - - -## 0.6.10 (January 27, 2016) - -BACKWARDS INCOMPATIBILITIES / NOTES: - - * The `-module-depth` flag available on `plan`, `apply`, `show`, and `graph` now defaults to `-1`, causing - resources within modules to be expanded in command output. This is only a cosmetic change; it does not affect - any behavior. - * This release includes a bugfix for `$${}` interpolation escaping. These strings are now properly converted to `${}` - during interpolation. This may cause diffs on existing configurations in certain cases. - * Users of `consul_keys` should note that the `value` sub-attribute of `key` will no longer be updated with the remote value of the key. It should be only used to _set_ a key in Consul K/V. To reference key values, use the `var` attribute. - * The 0.6.9 release contained a regression in `aws_autoscaling_group` capacity waiting behavior for configs where `min_elb_capacity != desired_capacity` or `min_size != desired_capacity`. This release remedies that regression by un-deprecating `min_elb_capacity` and restoring the prior behavior. - * Users of `aws_security_group` may notice new diffs in initial plans with 0.6.10 due to a bugfix that fixes drift detection on nested security group rules. These new diffs should reflect the actual state of the resources, which Terraform previously was unable to see. - - -FEATURES: - - * **New resource: `aws_lambda_alias`** ([#4664](https://github.com/hashicorp/terraform/issues/4664)) - * **New resource: `aws_redshift_cluster`** ([#3862](https://github.com/hashicorp/terraform/issues/3862)) - * **New resource: `aws_redshift_parameter_group`** ([#3862](https://github.com/hashicorp/terraform/issues/3862)) - * **New resource: `aws_redshift_security_group`** ([#3862](https://github.com/hashicorp/terraform/issues/3862)) - * **New resource: `aws_redshift_subnet_group`** ([#3862](https://github.com/hashicorp/terraform/issues/3862)) - * **New resource: `azurerm_cdn_endpoint`** ([#4759](https://github.com/hashicorp/terraform/issues/4759)) - * **New resource: `azurerm_cdn_profile`** ([#4740](https://github.com/hashicorp/terraform/issues/4740)) - * **New resource: `azurerm_network_interface`** ([#4598](https://github.com/hashicorp/terraform/issues/4598)) - * **New resource: `azurerm_network_security_rule`** ([#4586](https://github.com/hashicorp/terraform/issues/4586)) - * **New resource: `azurerm_route_table`** ([#4602](https://github.com/hashicorp/terraform/issues/4602)) - * **New resource: `azurerm_route`** ([#4604](https://github.com/hashicorp/terraform/issues/4604)) - * **New resource: `azurerm_storage_account`** ([#4698](https://github.com/hashicorp/terraform/issues/4698)) - * **New resource: `azurerm_storage_blob`** ([#4862](https://github.com/hashicorp/terraform/issues/4862)) - * **New resource: `azurerm_storage_container`** ([#4862](https://github.com/hashicorp/terraform/issues/4862)) - * **New resource: `azurerm_storage_queue`** ([#4862](https://github.com/hashicorp/terraform/issues/4862)) - * **New resource: `azurerm_subnet`** ([#4595](https://github.com/hashicorp/terraform/issues/4595)) - * **New resource: `docker_network`** ([#4483](https://github.com/hashicorp/terraform/issues/4483)) - * **New resource: `docker_volume`** ([#4483](https://github.com/hashicorp/terraform/issues/4483)) - * **New resource: `google_sql_user`** ([#4669](https://github.com/hashicorp/terraform/issues/4669)) - -IMPROVEMENTS: - - * core: Add `sha256()` interpolation function ([#4704](https://github.com/hashicorp/terraform/issues/4704)) - * core: Validate lifecycle keys to show helpful error messages whe they are mistypes ([#4745](https://github.com/hashicorp/terraform/issues/4745)) - * core: Default `module-depth` parameter to `-1`, which expands resources within modules in command output ([#4763](https://github.com/hashicorp/terraform/issues/4763)) - * core: Variable types may now be specified explicitly using the `type` argument ([#4795](https://github.com/hashicorp/terraform/issues/4795)) - * provider/aws: Add new parameters `az_mode` and `availability_zone(s)` in ElastiCache ([#4631](https://github.com/hashicorp/terraform/issues/4631)) - * provider/aws: Allow ap-northeast-2 (Seoul) as valid region ([#4637](https://github.com/hashicorp/terraform/issues/4637)) - * provider/aws: Limit SNS Topic Subscription protocols ([#4639](https://github.com/hashicorp/terraform/issues/4639)) - * provider/aws: Add support for configuring logging on `aws_s3_bucket` resources ([#4482](https://github.com/hashicorp/terraform/issues/4482)) - * provider/aws: Add AWS Classiclink for AWS VPC resource ([#3994](https://github.com/hashicorp/terraform/issues/3994)) - * provider/aws: Supporting New AWS Route53 HealthCheck additions ([#4564](https://github.com/hashicorp/terraform/issues/4564)) - * provider/aws: Store instance state ([#3261](https://github.com/hashicorp/terraform/issues/3261)) - * provider/aws: Add support for updating ELB availability zones and subnets ([#4597](https://github.com/hashicorp/terraform/issues/4597)) - * provider/aws: Enable specifying aws s3 redirect protocol ([#4098](https://github.com/hashicorp/terraform/issues/4098)) - * provider/aws: Added support for `encrypted` on `ebs_block_devices` in Launch Configurations ([#4481](https://github.com/hashicorp/terraform/issues/4481)) - * provider/aws: Retry Listener Creation for ELBs ([#4825](https://github.com/hashicorp/terraform/issues/4825)) - * provider/aws: Add support for creating Managed Microsoft Active Directory - and Directory Connectors ([#4388](https://github.com/hashicorp/terraform/issues/4388)) - * provider/aws: Mark some `aws_db_instance` fields as optional ([#3138](https://github.com/hashicorp/terraform/issues/3138)) - * provider/digitalocean: Add support for reassigning `digitalocean_floating_ip` resources ([#4476](https://github.com/hashicorp/terraform/issues/4476)) - * provider/dme: Add support for Global Traffic Director locations on `dme_record` resources ([#4305](https://github.com/hashicorp/terraform/issues/4305)) - * provider/docker: Add support for adding host entries on `docker_container` resources ([#3463](https://github.com/hashicorp/terraform/issues/3463)) - * provider/docker: Add support for mounting named volumes on `docker_container` resources ([#4480](https://github.com/hashicorp/terraform/issues/4480)) - * provider/google: Add content field to bucket object ([#3893](https://github.com/hashicorp/terraform/issues/3893)) - * provider/google: Add support for `named_port` blocks on `google_compute_instance_group_manager` resources ([#4605](https://github.com/hashicorp/terraform/issues/4605)) - * provider/openstack: Add "personality" support to instance resource ([#4623](https://github.com/hashicorp/terraform/issues/4623)) - * provider/packet: Handle external state changes for Packet resources gracefully ([#4676](https://github.com/hashicorp/terraform/issues/4676)) - * provider/tls: `tls_private_key` now exports attributes with public key in both PEM and OpenSSH format ([#4606](https://github.com/hashicorp/terraform/issues/4606)) - * provider/vdc: Add `allow_unverified_ssl` for connections to vCloud API ([#4811](https://github.com/hashicorp/terraform/issues/4811)) - * state/remote: Allow KMS Key Encryption to be used with S3 backend ([#2903](https://github.com/hashicorp/terraform/issues/2903)) - -BUG FIXES: - - * core: Fix handling of literals with escaped interpolations `$${var}` ([#4747](https://github.com/hashicorp/terraform/issues/4747)) - * core: Fix diff mismatch when RequiresNew field and list both change ([#4749](https://github.com/hashicorp/terraform/issues/4749)) - * core: Respect module target path argument on `terraform init` ([#4753](https://github.com/hashicorp/terraform/issues/4753)) - * core: Write planfile even on empty plans ([#4766](https://github.com/hashicorp/terraform/issues/4766)) - * core: Add validation error when output is missing value field ([#4762](https://github.com/hashicorp/terraform/issues/4762)) - * core: Fix improper handling of orphan resources when targeting ([#4574](https://github.com/hashicorp/terraform/issues/4574)) - * core: Properly handle references to computed set attributes ([#4840](https://github.com/hashicorp/terraform/issues/4840)) - * config: Detect a specific JSON edge case and show a helpful workaround ([#4746](https://github.com/hashicorp/terraform/issues/4746)) - * provider/openstack: Ensure valid Security Group Rule attribute combination ([#4466](https://github.com/hashicorp/terraform/issues/4466)) - * provider/openstack: Don't put fixed_ip in port creation request if not defined ([#4617](https://github.com/hashicorp/terraform/issues/4617)) - * provider/google: Clarify SQL Database Instance recent name restriction ([#4577](https://github.com/hashicorp/terraform/issues/4577)) - * provider/google: Split Instance network interface into two fields ([#4265](https://github.com/hashicorp/terraform/issues/4265)) - * provider/aws: Error with empty list item on security group ([#4140](https://github.com/hashicorp/terraform/issues/4140)) - * provider/aws: Fix issue with detecting drift in AWS Security Groups rules ([#4779](https://github.com/hashicorp/terraform/issues/4779)) - * provider/aws: Trap Instance error from mismatched SG IDs and Names ([#4240](https://github.com/hashicorp/terraform/issues/4240)) - * provider/aws: EBS optimised to force new resource in AWS Instance ([#4627](https://github.com/hashicorp/terraform/issues/4627)) - * provider/aws: Wait for NACL rule to be visible ([#4734](https://github.com/hashicorp/terraform/issues/4734)) - * provider/aws: `default_result` on `aws_autoscaling_lifecycle_hook` resources is now computed ([#4695](https://github.com/hashicorp/terraform/issues/4695)) - * provider/aws: fix ASG capacity waiting regression by un-deprecating `min_elb_capacity` ([#4864](https://github.com/hashicorp/terraform/issues/4864)) - * provider/consul: fix several bugs surrounding update behavior ([#4787](https://github.com/hashicorp/terraform/issues/4787)) - * provider/mailgun: Handle the fact that the domain destroy API is eventually consistent ([#4777](https://github.com/hashicorp/terraform/issues/4777)) - * provider/template: Fix race causing sporadic crashes in template_file with count > 1 ([#4694](https://github.com/hashicorp/terraform/issues/4694)) - * provider/template: Add support for updating `template_cloudinit_config` resources ([#4757](https://github.com/hashicorp/terraform/issues/4757)) - * provisioner/chef: Add ENV['no_proxy'] to chef provisioner if no_proxy is detected ([#4661](https://github.com/hashicorp/terraform/issues/4661)) - -## 0.6.9 (January 8, 2016) - -FEATURES: - - * **New provider: `vcd` - VMware vCloud Director** ([#3785](https://github.com/hashicorp/terraform/issues/3785)) - * **New provider: `postgresql` - Create PostgreSQL databases and roles** ([#3653](https://github.com/hashicorp/terraform/issues/3653)) - * **New provider: `chef` - Create chef environments, roles, etc** ([#3084](https://github.com/hashicorp/terraform/issues/3084)) - * **New provider: `azurerm` - Preliminary support for Azure Resource Manager** ([#4226](https://github.com/hashicorp/terraform/issues/4226)) - * **New provider: `mysql` - Create MySQL databases** ([#3122](https://github.com/hashicorp/terraform/issues/3122)) - * **New resource: `aws_autoscaling_schedule`** ([#4256](https://github.com/hashicorp/terraform/issues/4256)) - * **New resource: `aws_nat_gateway`** ([#4381](https://github.com/hashicorp/terraform/issues/4381)) - * **New resource: `aws_network_acl_rule`** ([#4286](https://github.com/hashicorp/terraform/issues/4286)) - * **New resources: `aws_ecr_repository` and `aws_ecr_repository_policy`** ([#4415](https://github.com/hashicorp/terraform/issues/4415)) - * **New resource: `google_pubsub_topic`** ([#3671](https://github.com/hashicorp/terraform/issues/3671)) - * **New resource: `google_pubsub_subscription`** ([#3671](https://github.com/hashicorp/terraform/issues/3671)) - * **New resource: `template_cloudinit_config`** ([#4095](https://github.com/hashicorp/terraform/issues/4095)) - * **New resource: `tls_locally_signed_cert`** ([#3930](https://github.com/hashicorp/terraform/issues/3930)) - * **New remote state backend: `artifactory`** ([#3684](https://github.com/hashicorp/terraform/issues/3684)) - -IMPROVEMENTS: - - * core: Change set internals for performance improvements ([#3992](https://github.com/hashicorp/terraform/issues/3992)) - * core: Support HTTP basic auth in consul remote state ([#4166](https://github.com/hashicorp/terraform/issues/4166)) - * core: Improve error message on resource arity mismatch ([#4244](https://github.com/hashicorp/terraform/issues/4244)) - * core: Add support for unary operators + and - to the interpolation syntax ([#3621](https://github.com/hashicorp/terraform/issues/3621)) - * core: Add SSH agent support for Windows ([#4323](https://github.com/hashicorp/terraform/issues/4323)) - * core: Add `sha1()` interpolation function ([#4450](https://github.com/hashicorp/terraform/issues/4450)) - * provider/aws: Add `placement_group` as an option for `aws_autoscaling_group` ([#3704](https://github.com/hashicorp/terraform/issues/3704)) - * provider/aws: Add support for DynamoDB Table StreamSpecifications ([#4208](https://github.com/hashicorp/terraform/issues/4208)) - * provider/aws: Add `name_prefix` to Security Groups ([#4167](https://github.com/hashicorp/terraform/issues/4167)) - * provider/aws: Add support for removing nodes to `aws_elasticache_cluster` ([#3809](https://github.com/hashicorp/terraform/issues/3809)) - * provider/aws: Add support for `skip_final_snapshot` to `aws_db_instance` ([#3853](https://github.com/hashicorp/terraform/issues/3853)) - * provider/aws: Adding support for Tags to DB SecurityGroup ([#4260](https://github.com/hashicorp/terraform/issues/4260)) - * provider/aws: Adding Tag support for DB Param Groups ([#4259](https://github.com/hashicorp/terraform/issues/4259)) - * provider/aws: Fix issue with updated route ids for VPC Endpoints ([#4264](https://github.com/hashicorp/terraform/issues/4264)) - * provider/aws: Added measure_latency option to Route 53 Health Check resource ([#3688](https://github.com/hashicorp/terraform/issues/3688)) - * provider/aws: Validate IOPs for EBS Volumes ([#4146](https://github.com/hashicorp/terraform/issues/4146)) - * provider/aws: DB Subnet group arn output ([#4261](https://github.com/hashicorp/terraform/issues/4261)) - * provider/aws: Get full Kinesis streams view with pagination ([#4368](https://github.com/hashicorp/terraform/issues/4368)) - * provider/aws: Allow changing private IPs for ENIs ([#4307](https://github.com/hashicorp/terraform/issues/4307)) - * provider/aws: Retry MalformedPolicy errors due to newly created principals in S3 Buckets ([#4315](https://github.com/hashicorp/terraform/issues/4315)) - * provider/aws: Validate `name` on `db_subnet_group` against AWS requirements ([#4340](https://github.com/hashicorp/terraform/issues/4340)) - * provider/aws: wait for ASG capacity on update ([#3947](https://github.com/hashicorp/terraform/issues/3947)) - * provider/aws: Add validation for ECR repository name ([#4431](https://github.com/hashicorp/terraform/issues/4431)) - * provider/cloudstack: performance improvements ([#4150](https://github.com/hashicorp/terraform/issues/4150)) - * provider/docker: Add support for setting the entry point on `docker_container` resources ([#3761](https://github.com/hashicorp/terraform/issues/3761)) - * provider/docker: Add support for setting the restart policy on `docker_container` resources ([#3761](https://github.com/hashicorp/terraform/issues/3761)) - * provider/docker: Add support for setting memory, swap and CPU shares on `docker_container` resources ([#3761](https://github.com/hashicorp/terraform/issues/3761)) - * provider/docker: Add support for setting labels on `docker_container` resources ([#3761](https://github.com/hashicorp/terraform/issues/3761)) - * provider/docker: Add support for setting log driver and options on `docker_container` resources ([#3761](https://github.com/hashicorp/terraform/issues/3761)) - * provider/docker: Add support for settings network mode on `docker_container` resources ([#4475](https://github.com/hashicorp/terraform/issues/4475)) - * provider/heroku: Improve handling of Applications within an Organization ([#4495](https://github.com/hashicorp/terraform/issues/4495)) - * provider/vsphere: Add support for custom vm params on `vsphere_virtual_machine` ([#3867](https://github.com/hashicorp/terraform/issues/3867)) - * provider/vsphere: Rename vcenter_server config parameter to something clearer ([#3718](https://github.com/hashicorp/terraform/issues/3718)) - * provider/vsphere: Make allow_unverified_ssl a configuable on the provider ([#3933](https://github.com/hashicorp/terraform/issues/3933)) - * provider/vsphere: Add folder handling for folder-qualified vm names ([#3939](https://github.com/hashicorp/terraform/issues/3939)) - * provider/vsphere: Change ip_address parameter for ipv6 support ([#4035](https://github.com/hashicorp/terraform/issues/4035)) - * provider/openstack: Increase instance timeout from 10 to 30 minutes ([#4223](https://github.com/hashicorp/terraform/issues/4223)) - * provider/google: Add `restart_policy` attribute to `google_managed_instance_group` ([#3892](https://github.com/hashicorp/terraform/issues/3892)) - -BUG FIXES: - - * core: skip provider input for deprecated fields ([#4193](https://github.com/hashicorp/terraform/issues/4193)) - * core: Fix issue which could cause fields that become empty to retain old values in the state ([#3257](https://github.com/hashicorp/terraform/issues/3257)) - * provider/docker: Fix an issue running with Docker Swarm by looking up containers by ID instead of name ([#4148](https://github.com/hashicorp/terraform/issues/4148)) - * provider/openstack: Better handling of load balancing resource state changes ([#3926](https://github.com/hashicorp/terraform/issues/3926)) - * provider/aws: Treat `INACTIVE` ECS cluster as deleted ([#4364](https://github.com/hashicorp/terraform/issues/4364)) - * provider/aws: Skip `source_security_group_id` determination logic for Classic ELBs ([#4075](https://github.com/hashicorp/terraform/issues/4075)) - * provider/aws: Fix issue destroy Route 53 zone/record if it no longer exists ([#4198](https://github.com/hashicorp/terraform/issues/4198)) - * provider/aws: Fix issue force destroying a versioned S3 bucket ([#4168](https://github.com/hashicorp/terraform/issues/4168)) - * provider/aws: Update DB Replica to honor storage type ([#4155](https://github.com/hashicorp/terraform/issues/4155)) - * provider/aws: Fix issue creating AWS RDS replicas across regions ([#4215](https://github.com/hashicorp/terraform/issues/4215)) - * provider/aws: Fix issue with Route53 and zero weighted records ([#4427](https://github.com/hashicorp/terraform/issues/4427)) - * provider/aws: Fix issue with iam_profile in aws_instance when a path is specified ([#3663](https://github.com/hashicorp/terraform/issues/3663)) - * provider/aws: Refactor AWS Authentication chain to fix issue with authentication and IAM ([#4254](https://github.com/hashicorp/terraform/issues/4254)) - * provider/aws: Fix issue with finding S3 Hosted Zone ID for eu-central-1 region ([#4236](https://github.com/hashicorp/terraform/issues/4236)) - * provider/aws: Fix missing AMI issue with Launch Configurations ([#4242](https://github.com/hashicorp/terraform/issues/4242)) - * provider/aws: Opsworks stack SSH key is write-only ([#4241](https://github.com/hashicorp/terraform/issues/4241)) - * provider/aws: Update VPC Endpoint to correctly set route table ids ([#4392](https://github.com/hashicorp/terraform/issues/4392)) - * provider/aws: Fix issue with ElasticSearch Domain `access_policies` always appear changed ([#4245](https://github.com/hashicorp/terraform/issues/4245)) - * provider/aws: Fix issue with nil parameter group value causing panic in `aws_db_parameter_group` ([#4318](https://github.com/hashicorp/terraform/issues/4318)) - * provider/aws: Fix issue with Elastic IPs not recognizing when they have been unassigned manually ([#4387](https://github.com/hashicorp/terraform/issues/4387)) - * provider/aws: Use body or URL for all CloudFormation stack updates ([#4370](https://github.com/hashicorp/terraform/issues/4370)) - * provider/aws: Fix template_url/template_body conflict ([#4540](https://github.com/hashicorp/terraform/issues/4540)) - * provider/aws: Fix bug w/ changing ECS svc/ELB association ([#4366](https://github.com/hashicorp/terraform/issues/4366)) - * provider/aws: Fix RDS unexpected state config ([#4490](https://github.com/hashicorp/terraform/issues/4490)) - * provider/digitalocean: Fix issue where a floating IP attached to a missing droplet causes a panic ([#4214](https://github.com/hashicorp/terraform/issues/4214)) - * provider/google: Fix project metadata sshKeys from showing up and causing unnecessary diffs ([#4512](https://github.com/hashicorp/terraform/issues/4512)) - * provider/heroku: Retry drain create until log channel is assigned ([#4823](https://github.com/hashicorp/terraform/issues/4823)) - * provider/openstack: Handle volumes in "deleting" state ([#4204](https://github.com/hashicorp/terraform/issues/4204)) - * provider/rundeck: Tolerate Rundeck server not returning project name when reading a job ([#4301](https://github.com/hashicorp/terraform/issues/4301)) - * provider/vsphere: Create and attach additional disks before bootup ([#4196](https://github.com/hashicorp/terraform/issues/4196)) - * provider/openstack: Convert block_device from a Set to a List ([#4288](https://github.com/hashicorp/terraform/issues/4288)) - * provider/google: Terraform identifies deleted resources and handles them appropriately on Read ([#3913](https://github.com/hashicorp/terraform/issues/3913)) - -## 0.6.8 (December 2, 2015) - -FEATURES: - - * **New provider: `statuscake`** ([#3340](https://github.com/hashicorp/terraform/issues/3340)) - * **New resource: `digitalocean_floating_ip`** ([#3748](https://github.com/hashicorp/terraform/issues/3748)) - * **New resource: `aws_lambda_event_source_mapping`** ([#4093](https://github.com/hashicorp/terraform/issues/4093)) - -IMPROVEMENTS: - - * provider/cloudstack: Reduce the number of network calls required for common operations ([#4051](https://github.com/hashicorp/terraform/issues/4051)) - * provider/aws: Make `publically_accessible` on an `aws_db_instance` update existing instances instead of forcing new ones ([#3895](https://github.com/hashicorp/terraform/issues/3895)) - * provider/aws: Allow `block_duration_minutes` to be set for spot instance requests ([#4071](https://github.com/hashicorp/terraform/issues/4071)) - * provider/aws: Make setting `acl` on S3 buckets update existing buckets instead of forcing new ones ([#4080](https://github.com/hashicorp/terraform/issues/4080)) - * provider/aws: Make updates to `assume_role_policy` modify existing IAM roles instead of forcing new ones ([#4107](https://github.com/hashicorp/terraform/issues/4107)) - -BUG FIXES: - - * core: Fix a bug which prevented HEREDOC syntax being used in lists ([#4078](https://github.com/hashicorp/terraform/issues/4078)) - * core: Fix a bug which prevented HEREDOC syntax where the anchor ends in a number ([#4128](https://github.com/hashicorp/terraform/issues/4128)) - * core: Fix a bug which prevented HEREDOC syntax being used with Windows line endings ([#4069](https://github.com/hashicorp/terraform/issues/4069)) - * provider/aws: Fix a bug which could result in a panic when reading EC2 metadata ([#4024](https://github.com/hashicorp/terraform/issues/4024)) - * provider/aws: Fix issue recreating security group rule if it has been destroyed ([#4050](https://github.com/hashicorp/terraform/issues/4050)) - * provider/aws: Fix issue with some attributes in Spot Instance Requests returning as nil ([#4132](https://github.com/hashicorp/terraform/issues/4132)) - * provider/aws: Fix issue where SPF records in Route 53 could show differences with no modification to the configuration ([#4108](https://github.com/hashicorp/terraform/issues/4108)) - * provisioner/chef: Fix issue with path separators breaking the Chef provisioner on Windows ([#4041](https://github.com/hashicorp/terraform/issues/4041)) - -## 0.6.7 (November 23, 2015) - -FEATURES: - - * **New provider: `tls`** - A utility provider for generating TLS keys/self-signed certificates for development and testing ([#2778](https://github.com/hashicorp/terraform/issues/2778)) - * **New provider: `dyn`** - Manage DNS records on Dyn - * **New resource: `aws_cloudformation_stack`** ([#2636](https://github.com/hashicorp/terraform/issues/2636)) - * **New resource: `aws_cloudtrail`** ([#3094](https://github.com/hashicorp/terraform/issues/3094)), ([#4010](https://github.com/hashicorp/terraform/issues/4010)) - * **New resource: `aws_route`** ([#3548](https://github.com/hashicorp/terraform/issues/3548)) - * **New resource: `aws_codecommit_repository`** ([#3274](https://github.com/hashicorp/terraform/issues/3274)) - * **New resource: `aws_kinesis_firehose_delivery_stream`** ([#3833](https://github.com/hashicorp/terraform/issues/3833)) - * **New resource: `google_sql_database` and `google_sql_database_instance`** ([#3617](https://github.com/hashicorp/terraform/issues/3617)) - * **New resource: `google_compute_global_address`** ([#3701](https://github.com/hashicorp/terraform/issues/3701)) - * **New resource: `google_compute_https_health_check`** ([#3883](https://github.com/hashicorp/terraform/issues/3883)) - * **New resource: `google_compute_ssl_certificate`** ([#3723](https://github.com/hashicorp/terraform/issues/3723)) - * **New resource: `google_compute_url_map`** ([#3722](https://github.com/hashicorp/terraform/issues/3722)) - * **New resource: `google_compute_target_http_proxy`** ([#3727](https://github.com/hashicorp/terraform/issues/3727)) - * **New resource: `google_compute_target_https_proxy`** ([#3728](https://github.com/hashicorp/terraform/issues/3728)) - * **New resource: `google_compute_global_forwarding_rule`** ([#3702](https://github.com/hashicorp/terraform/issues/3702)) - * **New resource: `openstack_networking_port_v2`** ([#3731](https://github.com/hashicorp/terraform/issues/3731)) - * New interpolation function: `coalesce` ([#3814](https://github.com/hashicorp/terraform/issues/3814)) - -IMPROVEMENTS: - - * core: Improve message to list only resources which will be destroyed when using `--target` ([#3859](https://github.com/hashicorp/terraform/issues/3859)) - * connection/ssh: Accept `private_key` contents instead of paths ([#3846](https://github.com/hashicorp/terraform/issues/3846)) - * provider/google: `preemptible` option for instance_template ([#3667](https://github.com/hashicorp/terraform/issues/3667)) - * provider/google: Accurate Terraform Version ([#3554](https://github.com/hashicorp/terraform/issues/3554)) - * provider/google: Simplified auth (DefaultClient support) ([#3553](https://github.com/hashicorp/terraform/issues/3553)) - * provider/google: `automatic_restart`, `preemptible`, `on_host_maintenance` options ([#3643](https://github.com/hashicorp/terraform/issues/3643)) - * provider/google: Read credentials as contents instead of path ([#3901](https://github.com/hashicorp/terraform/issues/3901)) - * null_resource: Enhance and document ([#3244](https://github.com/hashicorp/terraform/issues/3244), [#3659](https://github.com/hashicorp/terraform/issues/3659)) - * provider/aws: Add CORS settings to S3 bucket ([#3387](https://github.com/hashicorp/terraform/issues/3387)) - * provider/aws: Add notification topic ARN for ElastiCache clusters ([#3674](https://github.com/hashicorp/terraform/issues/3674)) - * provider/aws: Add `kinesis_endpoint` for configuring Kinesis ([#3255](https://github.com/hashicorp/terraform/issues/3255)) - * provider/aws: Add a computed ARN for S3 Buckets ([#3685](https://github.com/hashicorp/terraform/issues/3685)) - * provider/aws: Add S3 support for Lambda Function resource ([#3794](https://github.com/hashicorp/terraform/issues/3794)) - * provider/aws: Add `name_prefix` option to launch configurations ([#3802](https://github.com/hashicorp/terraform/issues/3802)) - * provider/aws: Add support for group name and path changes with IAM group update function ([#3237](https://github.com/hashicorp/terraform/issues/3237)) - * provider/aws: Provide `source_security_group_id` for ELBs inside a VPC ([#3780](https://github.com/hashicorp/terraform/issues/3780)) - * provider/aws: Add snapshot window and retention limits for ElastiCache (Redis) ([#3707](https://github.com/hashicorp/terraform/issues/3707)) - * provider/aws: Add username updates for `aws_iam_user` ([#3227](https://github.com/hashicorp/terraform/issues/3227)) - * provider/aws: Add AutoMinorVersionUpgrade to RDS Instances ([#3677](https://github.com/hashicorp/terraform/issues/3677)) - * provider/aws: Add `access_logs` to ELB resource ([#3756](https://github.com/hashicorp/terraform/issues/3756)) - * provider/aws: Add a retry function to rescue an error in creating Autoscaling Lifecycle Hooks ([#3694](https://github.com/hashicorp/terraform/issues/3694)) - * provider/aws: `engine_version` is now optional for DB Instance ([#3744](https://github.com/hashicorp/terraform/issues/3744)) - * provider/aws: Add configuration to enable copying RDS tags to final snapshot ([#3529](https://github.com/hashicorp/terraform/issues/3529)) - * provider/aws: RDS Cluster additions (`backup_retention_period`, `preferred_backup_window`, `preferred_maintenance_window`) ([#3757](https://github.com/hashicorp/terraform/issues/3757)) - * provider/aws: Document and validate ELB `ssl_certificate_id` and protocol requirements ([#3887](https://github.com/hashicorp/terraform/issues/3887)) - * provider/azure: Read `publish_settings` as contents instead of path ([#3899](https://github.com/hashicorp/terraform/issues/3899)) - * provider/openstack: Use IPv4 as the default IP version for subnets ([#3091](https://github.com/hashicorp/terraform/issues/3091)) - * provider/aws: Apply security group after restoring `db_instance` from snapshot ([#3513](https://github.com/hashicorp/terraform/issues/3513)) - * provider/aws: Make the AutoScalingGroup `name` optional ([#3710](https://github.com/hashicorp/terraform/issues/3710)) - * provider/openstack: Add "delete on termination" boot-from-volume option ([#3232](https://github.com/hashicorp/terraform/issues/3232)) - * provider/digitalocean: Make `user_data` force a new droplet ([#3740](https://github.com/hashicorp/terraform/issues/3740)) - * provider/vsphere: Do not add network interfaces by default ([#3652](https://github.com/hashicorp/terraform/issues/3652)) - * provider/openstack: Configure Fixed IPs through ports ([#3772](https://github.com/hashicorp/terraform/issues/3772)) - * provider/openstack: Specify a port ID on a Router Interface ([#3903](https://github.com/hashicorp/terraform/issues/3903)) - * provider/openstack: Make LBaaS Virtual IP computed ([#3927](https://github.com/hashicorp/terraform/issues/3927)) - -BUG FIXES: - - * `terraform remote config`: update `--help` output ([#3632](https://github.com/hashicorp/terraform/issues/3632)) - * core: Modules on Git branches now update properly ([#1568](https://github.com/hashicorp/terraform/issues/1568)) - * core: Fix issue preventing input prompts for unset variables during plan ([#3843](https://github.com/hashicorp/terraform/issues/3843)) - * core: Fix issue preventing input prompts for unset variables during refresh ([#4017](https://github.com/hashicorp/terraform/issues/4017)) - * core: Orphan resources can now be targets ([#3912](https://github.com/hashicorp/terraform/issues/3912)) - * helper/schema: Skip StateFunc when value is nil ([#4002](https://github.com/hashicorp/terraform/issues/4002)) - * provider/google: Timeout when deleting large `instance_group_manager` ([#3591](https://github.com/hashicorp/terraform/issues/3591)) - * provider/aws: Fix issue with order of Termination Policies in AutoScaling Groups. - This will introduce plans on upgrade to this version, in order to correct the ordering ([#2890](https://github.com/hashicorp/terraform/issues/2890)) - * provider/aws: Allow cluster name, not only ARN for `aws_ecs_service` ([#3668](https://github.com/hashicorp/terraform/issues/3668)) - * provider/aws: Fix a bug where a non-lower-cased `maintenance_window` can cause unnecessary planned changes ([#4020](https://github.com/hashicorp/terraform/issues/4020)) - * provider/aws: Only set `weight` on an `aws_route53_record` if it has been set in configuration ([#3900](https://github.com/hashicorp/terraform/issues/3900)) - * provider/aws: Ignore association not existing on route table destroy ([#3615](https://github.com/hashicorp/terraform/issues/3615)) - * provider/aws: Fix policy encoding issue with SNS Topics ([#3700](https://github.com/hashicorp/terraform/issues/3700)) - * provider/aws: Correctly export ARN in `aws_iam_saml_provider` ([#3827](https://github.com/hashicorp/terraform/issues/3827)) - * provider/aws: Fix issue deleting users who are attached to a group ([#4005](https://github.com/hashicorp/terraform/issues/4005)) - * provider/aws: Fix crash in Route53 Record if Zone not found ([#3945](https://github.com/hashicorp/terraform/issues/3945)) - * provider/aws: Retry deleting IAM Server Cert on dependency violation ([#3898](https://github.com/hashicorp/terraform/issues/3898)) - * provider/aws: Update Spot Instance request to provide connection information ([#3940](https://github.com/hashicorp/terraform/issues/3940)) - * provider/aws: Fix typo in error checking for IAM Policy Attachments ([#3970](https://github.com/hashicorp/terraform/issues/3970)) - * provider/aws: Fix issue with LB Cookie Stickiness and empty expiration period ([#3908](https://github.com/hashicorp/terraform/issues/3908)) - * provider/aws: Tolerate ElastiCache clusters being deleted outside Terraform ([#3767](https://github.com/hashicorp/terraform/issues/3767)) - * provider/aws: Downcase Route 53 record names in state file to match API output ([#3574](https://github.com/hashicorp/terraform/issues/3574)) - * provider/aws: Fix issue that could occur if no ECS Cluster was found for a given name ([#3829](https://github.com/hashicorp/terraform/issues/3829)) - * provider/aws: Fix issue with SNS topic policy if omitted ([#3777](https://github.com/hashicorp/terraform/issues/3777)) - * provider/aws: Support scratch volumes in `aws_ecs_task_definition` ([#3810](https://github.com/hashicorp/terraform/issues/3810)) - * provider/aws: Treat `aws_ecs_service` w/ Status==INACTIVE as deleted ([#3828](https://github.com/hashicorp/terraform/issues/3828)) - * provider/aws: Expand ~ to homedir in `aws_s3_bucket_object.source` ([#3910](https://github.com/hashicorp/terraform/issues/3910)) - * provider/aws: Fix issue with updating the `aws_ecs_task_definition` where `aws_ecs_service` didn't wait for a new computed ARN ([#3924](https://github.com/hashicorp/terraform/issues/3924)) - * provider/aws: Prevent crashing when deleting `aws_ecs_service` that is already gone ([#3914](https://github.com/hashicorp/terraform/issues/3914)) - * provider/aws: Allow spaces in `aws_db_subnet_group.name` (undocumented in the API) ([#3955](https://github.com/hashicorp/terraform/issues/3955)) - * provider/aws: Make VPC ID required on subnets ([#4021](https://github.com/hashicorp/terraform/issues/4021)) - * provider/azure: Various bug fixes ([#3695](https://github.com/hashicorp/terraform/issues/3695)) - * provider/digitalocean: Fix issue preventing SSH fingerprints from working ([#3633](https://github.com/hashicorp/terraform/issues/3633)) - * provider/digitalocean: Fix the DigitalOcean Droplet 404 potential on refresh of state ([#3768](https://github.com/hashicorp/terraform/issues/3768)) - * provider/openstack: Fix several issues causing unresolvable diffs ([#3440](https://github.com/hashicorp/terraform/issues/3440)) - * provider/openstack: Safely delete security groups ([#3696](https://github.com/hashicorp/terraform/issues/3696)) - * provider/openstack: Ignore order of `security_groups` in instance ([#3651](https://github.com/hashicorp/terraform/issues/3651)) - * provider/vsphere: Fix d.SetConnInfo error in case of a missing IP address ([#3636](https://github.com/hashicorp/terraform/issues/3636)) - * provider/openstack: Fix boot from volume ([#3206](https://github.com/hashicorp/terraform/issues/3206)) - * provider/openstack: Fix crashing when image is no longer accessible ([#2189](https://github.com/hashicorp/terraform/issues/2189)) - * provider/openstack: Better handling of network resource state changes ([#3712](https://github.com/hashicorp/terraform/issues/3712)) - * provider/openstack: Fix crashing when no security group is specified ([#3801](https://github.com/hashicorp/terraform/issues/3801)) - * provider/packet: Fix issue that could cause errors when provisioning many devices at once ([#3847](https://github.com/hashicorp/terraform/issues/3847)) - * provider/packet: Fix connection information for devices, allowing provisioners to run ([#3948](https://github.com/hashicorp/terraform/issues/3948)) - * provider/openstack: Fix issue preventing security group rules from being removed ([#3796](https://github.com/hashicorp/terraform/issues/3796)) - * provider/template: `template_file`: source contents instead of path ([#3909](https://github.com/hashicorp/terraform/issues/3909)) - -## 0.6.6 (October 23, 2015) - -FEATURES: - - * New interpolation functions: `cidrhost`, `cidrnetmask` and `cidrsubnet` ([#3127](https://github.com/hashicorp/terraform/issues/3127)) - -IMPROVEMENTS: - - * "forces new resource" now highlighted in plan output ([#3136](https://github.com/hashicorp/terraform/issues/3136)) - -BUG FIXES: - - * helper/schema: Better error message for assigning list/map to string ([#3009](https://github.com/hashicorp/terraform/issues/3009)) - * remote/state/atlas: Additional remote state conflict handling for semantically neutral state changes ([#3603](https://github.com/hashicorp/terraform/issues/3603)) - -## 0.6.5 (October 21, 2015) - -FEATURES: - - * **New resources: `aws_codeploy_app` and `aws_codeploy_deployment_group`** ([#2783](https://github.com/hashicorp/terraform/issues/2783)) - * New remote state backend: `etcd` ([#3487](https://github.com/hashicorp/terraform/issues/3487)) - * New interpolation functions: `upper` and `lower` ([#3558](https://github.com/hashicorp/terraform/issues/3558)) - -BUG FIXES: - - * core: Fix remote state conflicts caused by ambiguity in ordering of deeply nested modules ([#3573](https://github.com/hashicorp/terraform/issues/3573)) - * core: Fix remote state conflicts caused by state metadata differences ([#3569](https://github.com/hashicorp/terraform/issues/3569)) - * core: Avoid using http.DefaultClient ([#3532](https://github.com/hashicorp/terraform/issues/3532)) - -INTERNAL IMPROVEMENTS: - - * provider/digitalocean: use official Go client ([#3333](https://github.com/hashicorp/terraform/issues/3333)) - * core: extract module fetching to external library ([#3516](https://github.com/hashicorp/terraform/issues/3516)) - -## 0.6.4 (October 15, 2015) - -FEATURES: - - * **New provider: `rundeck`** ([#2412](https://github.com/hashicorp/terraform/issues/2412)) - * **New provider: `packet`** ([#2260](https://github.com/hashicorp/terraform/issues/2260)), ([#3472](https://github.com/hashicorp/terraform/issues/3472)) - * **New provider: `vsphere`**: Initial support for a VM resource ([#3419](https://github.com/hashicorp/terraform/issues/3419)) - * **New resource: `cloudstack_loadbalancer_rule`** ([#2934](https://github.com/hashicorp/terraform/issues/2934)) - * **New resource: `google_compute_project_metadata`** ([#3065](https://github.com/hashicorp/terraform/issues/3065)) - * **New resources: `aws_ami`, `aws_ami_copy`, `aws_ami_from_instance`** ([#2784](https://github.com/hashicorp/terraform/issues/2784)) - * **New resources: `aws_cloudwatch_log_group`** ([#2415](https://github.com/hashicorp/terraform/issues/2415)) - * **New resource: `google_storage_bucket_object`** ([#3192](https://github.com/hashicorp/terraform/issues/3192)) - * **New resources: `google_compute_vpn_gateway`, `google_compute_vpn_tunnel`** ([#3213](https://github.com/hashicorp/terraform/issues/3213)) - * **New resources: `google_storage_bucket_acl`, `google_storage_object_acl`** ([#3272](https://github.com/hashicorp/terraform/issues/3272)) - * **New resource: `aws_iam_saml_provider`** ([#3156](https://github.com/hashicorp/terraform/issues/3156)) - * **New resources: `aws_efs_file_system` and `aws_efs_mount_target`** ([#2196](https://github.com/hashicorp/terraform/issues/2196)) - * **New resources: `aws_opsworks_*`** ([#2162](https://github.com/hashicorp/terraform/issues/2162)) - * **New resource: `aws_elasticsearch_domain`** ([#3443](https://github.com/hashicorp/terraform/issues/3443)) - * **New resource: `aws_directory_service_directory`** ([#3228](https://github.com/hashicorp/terraform/issues/3228)) - * **New resource: `aws_autoscaling_lifecycle_hook`** ([#3351](https://github.com/hashicorp/terraform/issues/3351)) - * **New resource: `aws_placement_group`** ([#3457](https://github.com/hashicorp/terraform/issues/3457)) - * **New resource: `aws_glacier_vault`** ([#3491](https://github.com/hashicorp/terraform/issues/3491)) - * **New lifecycle flag: `ignore_changes`** ([#2525](https://github.com/hashicorp/terraform/issues/2525)) - -IMPROVEMENTS: - - * core: Add a function to find the index of an element in a list. ([#2704](https://github.com/hashicorp/terraform/issues/2704)) - * core: Print all outputs when `terraform output` is called with no arguments ([#2920](https://github.com/hashicorp/terraform/issues/2920)) - * core: In plan output summary, count resource replacement as Add/Remove instead of Change ([#3173](https://github.com/hashicorp/terraform/issues/3173)) - * core: Add interpolation functions for base64 encoding and decoding. ([#3325](https://github.com/hashicorp/terraform/issues/3325)) - * core: Expose parallelism as a CLI option instead of a hard-coding the default of 10 ([#3365](https://github.com/hashicorp/terraform/issues/3365)) - * core: Add interpolation function `compact`, to remove empty elements from a list. ([#3239](https://github.com/hashicorp/terraform/issues/3239)), ([#3479](https://github.com/hashicorp/terraform/issues/3479)) - * core: Allow filtering of log output by level, using e.g. ``TF_LOG=INFO`` ([#3380](https://github.com/hashicorp/terraform/issues/3380)) - * provider/aws: Add `instance_initiated_shutdown_behavior` to AWS Instance ([#2887](https://github.com/hashicorp/terraform/issues/2887)) - * provider/aws: Support IAM role names (previously just ARNs) in `aws_ecs_service.iam_role` ([#3061](https://github.com/hashicorp/terraform/issues/3061)) - * provider/aws: Add update method to RDS Subnet groups, can modify subnets without recreating ([#3053](https://github.com/hashicorp/terraform/issues/3053)) - * provider/aws: Paginate notifications returned for ASG Notifications ([#3043](https://github.com/hashicorp/terraform/issues/3043)) - * provider/aws: Adds additional S3 Bucket Object inputs ([#3265](https://github.com/hashicorp/terraform/issues/3265)) - * provider/aws: add `ses_smtp_password` to `aws_iam_access_key` ([#3165](https://github.com/hashicorp/terraform/issues/3165)) - * provider/aws: read `iam_instance_profile` for `aws_instance` and save to state ([#3167](https://github.com/hashicorp/terraform/issues/3167)) - * provider/aws: allow `instance` to be computed in `aws_eip` ([#3036](https://github.com/hashicorp/terraform/issues/3036)) - * provider/aws: Add `versioning` option to `aws_s3_bucket` ([#2942](https://github.com/hashicorp/terraform/issues/2942)) - * provider/aws: Add `configuration_endpoint` to `aws_elasticache_cluster` ([#3250](https://github.com/hashicorp/terraform/issues/3250)) - * provider/aws: Add validation for `app_cookie_stickiness_policy.name` ([#3277](https://github.com/hashicorp/terraform/issues/3277)) - * provider/aws: Add validation for `db_parameter_group.name` ([#3279](https://github.com/hashicorp/terraform/issues/3279)) - * provider/aws: Set DynamoDB Table ARN after creation ([#3500](https://github.com/hashicorp/terraform/issues/3500)) - * provider/aws: `aws_s3_bucket_object` allows interpolated content to be set with new `content` attribute. ([#3200](https://github.com/hashicorp/terraform/issues/3200)) - * provider/aws: Allow tags for `aws_kinesis_stream` resource. ([#3397](https://github.com/hashicorp/terraform/issues/3397)) - * provider/aws: Configurable capacity waiting duration for ASGs ([#3191](https://github.com/hashicorp/terraform/issues/3191)) - * provider/aws: Allow non-persistent Spot Requests ([#3311](https://github.com/hashicorp/terraform/issues/3311)) - * provider/aws: Support tags for AWS DB subnet group ([#3138](https://github.com/hashicorp/terraform/issues/3138)) - * provider/cloudstack: Add `project` parameter to `cloudstack_vpc`, `cloudstack_network`, `cloudstack_ipaddress` and `cloudstack_disk` ([#3035](https://github.com/hashicorp/terraform/issues/3035)) - * provider/openstack: add functionality to attach FloatingIP to Port ([#1788](https://github.com/hashicorp/terraform/issues/1788)) - * provider/google: Can now do multi-region deployments without using multiple providers ([#3258](https://github.com/hashicorp/terraform/issues/3258)) - * remote/s3: Allow canned ACLs to be set on state objects. ([#3233](https://github.com/hashicorp/terraform/issues/3233)) - * remote/s3: Remote state is stored in S3 with `Content-Type: application/json` ([#3385](https://github.com/hashicorp/terraform/issues/3385)) - -BUG FIXES: - - * core: Fix problems referencing list attributes in interpolations ([#2157](https://github.com/hashicorp/terraform/issues/2157)) - * core: don't error on computed value during input walk ([#2988](https://github.com/hashicorp/terraform/issues/2988)) - * core: Ignore missing variables during destroy phase ([#3393](https://github.com/hashicorp/terraform/issues/3393)) - * provider/google: Crashes with interface conversion in GCE Instance Template ([#3027](https://github.com/hashicorp/terraform/issues/3027)) - * provider/google: Convert int to int64 when building the GKE cluster.NodeConfig struct ([#2978](https://github.com/hashicorp/terraform/issues/2978)) - * provider/google: google_compute_instance_template.network_interface.network should be a URL ([#3226](https://github.com/hashicorp/terraform/issues/3226)) - * provider/aws: Retry creation of `aws_ecs_service` if IAM policy isn't ready yet ([#3061](https://github.com/hashicorp/terraform/issues/3061)) - * provider/aws: Fix issue with mixed capitalization for RDS Instances ([#3053](https://github.com/hashicorp/terraform/issues/3053)) - * provider/aws: Fix issue with RDS to allow major version upgrades ([#3053](https://github.com/hashicorp/terraform/issues/3053)) - * provider/aws: Fix shard_count in `aws_kinesis_stream` ([#2986](https://github.com/hashicorp/terraform/issues/2986)) - * provider/aws: Fix issue with `key_name` and using VPCs with spot instance requests ([#2954](https://github.com/hashicorp/terraform/issues/2954)) - * provider/aws: Fix unresolvable diffs coming from `aws_elasticache_cluster` names being downcased - by AWS ([#3120](https://github.com/hashicorp/terraform/issues/3120)) - * provider/aws: Read instance source_dest_check and save to state ([#3152](https://github.com/hashicorp/terraform/issues/3152)) - * provider/aws: Allow `weight = 0` in Route53 records ([#3196](https://github.com/hashicorp/terraform/issues/3196)) - * provider/aws: Normalize aws_elasticache_cluster id to lowercase, allowing convergence. ([#3235](https://github.com/hashicorp/terraform/issues/3235)) - * provider/aws: Fix ValidateAccountId for IAM Instance Profiles ([#3313](https://github.com/hashicorp/terraform/issues/3313)) - * provider/aws: Update Security Group Rules to Version 2 ([#3019](https://github.com/hashicorp/terraform/issues/3019)) - * provider/aws: Migrate KeyPair to version 1, fixing issue with using `file()` ([#3470](https://github.com/hashicorp/terraform/issues/3470)) - * provider/aws: Fix force_delete on autoscaling groups ([#3485](https://github.com/hashicorp/terraform/issues/3485)) - * provider/aws: Fix crash with VPC Peering connections ([#3490](https://github.com/hashicorp/terraform/issues/3490)) - * provider/aws: fix bug with reading GSIs from dynamodb ([#3300](https://github.com/hashicorp/terraform/issues/3300)) - * provider/docker: Fix issue preventing private images from being referenced ([#2619](https://github.com/hashicorp/terraform/issues/2619)) - * provider/digitalocean: Fix issue causing unnecessary diffs based on droplet slugsize case ([#3284](https://github.com/hashicorp/terraform/issues/3284)) - * provider/openstack: add state 'downloading' to list of expected states in - `blockstorage_volume_v1` creation ([#2866](https://github.com/hashicorp/terraform/issues/2866)) - * provider/openstack: remove security groups (by name) before adding security - groups (by id) ([#2008](https://github.com/hashicorp/terraform/issues/2008)) - -INTERNAL IMPROVEMENTS: - - * core: Makefile target "plugin-dev" for building just one plugin. ([#3229](https://github.com/hashicorp/terraform/issues/3229)) - * helper/schema: Don't allow ``Update`` func if no attributes can actually be updated, per schema. ([#3288](https://github.com/hashicorp/terraform/issues/3288)) - * helper/schema: Default hashing function for sets ([#3018](https://github.com/hashicorp/terraform/issues/3018)) - * helper/multierror: Remove in favor of [github.com/hashicorp/go-multierror](http://github.com/hashicorp/go-multierror). ([#3336](https://github.com/hashicorp/terraform/issues/3336)) - -## 0.6.3 (August 11, 2015) - -BUG FIXES: - - * core: Skip all descendents after error, not just children; helps prevent confusing - additional errors/crashes after initial failure ([#2963](https://github.com/hashicorp/terraform/issues/2963)) - * core: fix deadlock possibility when both a module and a dependent resource are - removed in the same run ([#2968](https://github.com/hashicorp/terraform/issues/2968)) - * provider/aws: Fix issue with authenticating when using IAM profiles ([#2959](https://github.com/hashicorp/terraform/issues/2959)) - -## 0.6.2 (August 6, 2015) - -FEATURES: - - * **New resource: `google_compute_instance_group_manager`** ([#2868](https://github.com/hashicorp/terraform/issues/2868)) - * **New resource: `google_compute_autoscaler`** ([#2868](https://github.com/hashicorp/terraform/issues/2868)) - * **New resource: `aws_s3_bucket_object`** ([#2898](https://github.com/hashicorp/terraform/issues/2898)) - -IMPROVEMENTS: - - * core: Add resource IDs to errors coming from `apply`/`refresh` ([#2815](https://github.com/hashicorp/terraform/issues/2815)) - * provider/aws: Validate credentials before walking the graph ([#2730](https://github.com/hashicorp/terraform/issues/2730)) - * provider/aws: Added website_domain for S3 buckets ([#2210](https://github.com/hashicorp/terraform/issues/2210)) - * provider/aws: ELB names are now optional, and generated by Terraform if omitted ([#2571](https://github.com/hashicorp/terraform/issues/2571)) - * provider/aws: Downcase RDS engine names to prevent continuous diffs ([#2745](https://github.com/hashicorp/terraform/issues/2745)) - * provider/aws: Added `source_dest_check` attribute to the aws_network_interface ([#2741](https://github.com/hashicorp/terraform/issues/2741)) - * provider/aws: Clean up externally removed Launch Configurations ([#2806](https://github.com/hashicorp/terraform/issues/2806)) - * provider/aws: Allow configuration of the DynamoDB Endpoint ([#2825](https://github.com/hashicorp/terraform/issues/2825)) - * provider/aws: Compute private ip addresses of ENIs if they are not specified ([#2743](https://github.com/hashicorp/terraform/issues/2743)) - * provider/aws: Add `arn` attribute for DynamoDB tables ([#2924](https://github.com/hashicorp/terraform/issues/2924)) - * provider/aws: Fail silently when account validation fails while from instance profile ([#3001](https://github.com/hashicorp/terraform/issues/3001)) - * provider/azure: Allow `settings_file` to accept XML string ([#2922](https://github.com/hashicorp/terraform/issues/2922)) - * provider/azure: Provide a simpler error when using a Platform Image without a - Storage Service ([#2861](https://github.com/hashicorp/terraform/issues/2861)) - * provider/google: `account_file` is now expected to be JSON. Paths are still supported for - backwards compatibility. ([#2839](https://github.com/hashicorp/terraform/issues/2839)) - -BUG FIXES: - - * core: Prevent error duplication in `apply` ([#2815](https://github.com/hashicorp/terraform/issues/2815)) - * core: Fix crash when a provider validation adds a warning ([#2878](https://github.com/hashicorp/terraform/issues/2878)) - * provider/aws: Fix issue with toggling monitoring in AWS Instances ([#2794](https://github.com/hashicorp/terraform/issues/2794)) - * provider/aws: Fix issue with Spot Instance Requests and cancellation ([#2805](https://github.com/hashicorp/terraform/issues/2805)) - * provider/aws: Fix issue with checking for ElastiCache cluster cache node status ([#2842](https://github.com/hashicorp/terraform/issues/2842)) - * provider/aws: Fix issue when unable to find a Root Block Device name of an Instance Backed - AMI ([#2646](https://github.com/hashicorp/terraform/issues/2646)) - * provider/dnsimple: Domain and type should force new records ([#2777](https://github.com/hashicorp/terraform/issues/2777)) - * provider/aws: Fix issue with IAM Server Certificates and Chains ([#2871](https://github.com/hashicorp/terraform/issues/2871)) - * provider/aws: Fix issue with IAM Server Certificates when using `path` ([#2871](https://github.com/hashicorp/terraform/issues/2871)) - * provider/aws: Fix issue in Security Group Rules when the Security Group is not found ([#2897](https://github.com/hashicorp/terraform/issues/2897)) - * provider/aws: allow external ENI attachments ([#2943](https://github.com/hashicorp/terraform/issues/2943)) - * provider/aws: Fix issue with S3 Buckets, and throwing an error when not found ([#2925](https://github.com/hashicorp/terraform/issues/2925)) - -## 0.6.1 (July 20, 2015) - -FEATURES: - - * **New resource: `google_container_cluster`** ([#2357](https://github.com/hashicorp/terraform/issues/2357)) - * **New resource: `aws_vpc_endpoint`** ([#2695](https://github.com/hashicorp/terraform/issues/2695)) - -IMPROVEMENTS: - - * connection/ssh: Print SSH bastion host details to output ([#2684](https://github.com/hashicorp/terraform/issues/2684)) - * provider/aws: Create RDS databases from snapshots ([#2062](https://github.com/hashicorp/terraform/issues/2062)) - * provider/aws: Add support for restoring from Redis backup stored in S3 ([#2634](https://github.com/hashicorp/terraform/issues/2634)) - * provider/aws: Add `maintenance_window` to ElastiCache cluster ([#2642](https://github.com/hashicorp/terraform/issues/2642)) - * provider/aws: Availability Zones are optional when specifying VPC Zone Identifiers in - Auto Scaling Groups updates ([#2724](https://github.com/hashicorp/terraform/issues/2724)) - * provider/google: Add metadata_startup_script to google_compute_instance ([#2375](https://github.com/hashicorp/terraform/issues/2375)) - -BUG FIXES: - - * core: Don't prompt for variables with defaults ([#2613](https://github.com/hashicorp/terraform/issues/2613)) - * core: Return correct number of planned updates ([#2620](https://github.com/hashicorp/terraform/issues/2620)) - * core: Fix "provider not found" error that can occur while running - a destroy plan with grandchildren modules ([#2755](https://github.com/hashicorp/terraform/issues/2755)) - * core: Fix UUID showing up in diff for computed splat (`foo.*.bar`) - variables. ([#2788](https://github.com/hashicorp/terraform/issues/2788)) - * core: Orphan modules that contain no resources (only other modules) - are properly destroyed up to arbitrary depth ([#2786](https://github.com/hashicorp/terraform/issues/2786)) - * core: Fix "attribute not available" during destroy plans in - cases where the parameter is passed between modules ([#2775](https://github.com/hashicorp/terraform/issues/2775)) - * core: Record schema version when destroy fails ([#2923](https://github.com/hashicorp/terraform/issues/2923)) - * connection/ssh: fix issue on machines with an SSH Agent available - preventing `key_file` from being read without explicitly - setting `agent = false` ([#2615](https://github.com/hashicorp/terraform/issues/2615)) - * provider/aws: Allow uppercase characters in `aws_elb.name` ([#2580](https://github.com/hashicorp/terraform/issues/2580)) - * provider/aws: Allow underscores in `aws_db_subnet_group.name` (undocumented by AWS) ([#2604](https://github.com/hashicorp/terraform/issues/2604)) - * provider/aws: Allow dots in `aws_db_subnet_group.name` (undocumented by AWS) ([#2665](https://github.com/hashicorp/terraform/issues/2665)) - * provider/aws: Fix issue with pending Spot Instance requests ([#2640](https://github.com/hashicorp/terraform/issues/2640)) - * provider/aws: Fix issue in AWS Classic environment with referencing external - Security Groups ([#2644](https://github.com/hashicorp/terraform/issues/2644)) - * provider/aws: Bump internet gateway detach timeout ([#2669](https://github.com/hashicorp/terraform/issues/2669)) - * provider/aws: Fix issue with detecting differences in DB Parameters ([#2728](https://github.com/hashicorp/terraform/issues/2728)) - * provider/aws: `ecs_cluster` rename (recreation) and deletion is handled correctly ([#2698](https://github.com/hashicorp/terraform/issues/2698)) - * provider/aws: `aws_route_table` ignores routes generated for VPC endpoints ([#2695](https://github.com/hashicorp/terraform/issues/2695)) - * provider/aws: Fix issue with Launch Configurations and enable_monitoring ([#2735](https://github.com/hashicorp/terraform/issues/2735)) - * provider/openstack: allow empty api_key and endpoint_type ([#2626](https://github.com/hashicorp/terraform/issues/2626)) - * provisioner/chef: Fix permission denied error with ohai hints ([#2781](https://github.com/hashicorp/terraform/issues/2781)) - -## 0.6.0 (June 30, 2015) - -BACKWARDS INCOMPATIBILITIES: - - * command/push: If a variable is already set within Atlas, it won't be - updated unless the `-overwrite` flag is present ([#2373](https://github.com/hashicorp/terraform/issues/2373)) - * connection/ssh: The `agent` field now defaults to `true` if - the `SSH_AGENT_SOCK` environment variable is present. In other words, - `ssh-agent` support is now opt-out instead of opt-in functionality. ([#2408](https://github.com/hashicorp/terraform/issues/2408)) - * provider/aws: If you were setting access and secret key to blank ("") - to force Terraform to load credentials from another source such as the - EC2 role, this will now error. Remove the blank lines and Terraform - will load from other sources. - * `concat()` has been repurposed to combine lists instead of strings (old behavior - of joining strings is maintained in this version but is deprecated, strings - should be combined using interpolation syntax, like "${var.foo}{var.bar}") - ([#1790](https://github.com/hashicorp/terraform/issues/1790)) - -FEATURES: - - * **New provider: `azure`** ([#2052](https://github.com/hashicorp/terraform/issues/2052), [#2053](https://github.com/hashicorp/terraform/issues/2053), [#2372](https://github.com/hashicorp/terraform/issues/2372), [#2380](https://github.com/hashicorp/terraform/issues/2380), [#2394](https://github.com/hashicorp/terraform/issues/2394), [#2515](https://github.com/hashicorp/terraform/issues/2515), [#2530](https://github.com/hashicorp/terraform/issues/2530), [#2562](https://github.com/hashicorp/terraform/issues/2562)) - * **New resource: `aws_autoscaling_notification`** ([#2197](https://github.com/hashicorp/terraform/issues/2197)) - * **New resource: `aws_autoscaling_policy`** ([#2201](https://github.com/hashicorp/terraform/issues/2201)) - * **New resource: `aws_cloudwatch_metric_alarm`** ([#2201](https://github.com/hashicorp/terraform/issues/2201)) - * **New resource: `aws_dynamodb_table`** ([#2121](https://github.com/hashicorp/terraform/issues/2121)) - * **New resource: `aws_ecs_cluster`** ([#1803](https://github.com/hashicorp/terraform/issues/1803)) - * **New resource: `aws_ecs_service`** ([#1803](https://github.com/hashicorp/terraform/issues/1803)) - * **New resource: `aws_ecs_task_definition`** ([#1803](https://github.com/hashicorp/terraform/issues/1803), [#2402](https://github.com/hashicorp/terraform/issues/2402)) - * **New resource: `aws_elasticache_parameter_group`** ([#2276](https://github.com/hashicorp/terraform/issues/2276)) - * **New resource: `aws_flow_log`** ([#2384](https://github.com/hashicorp/terraform/issues/2384)) - * **New resource: `aws_iam_group_association`** ([#2273](https://github.com/hashicorp/terraform/issues/2273)) - * **New resource: `aws_iam_policy_attachment`** ([#2395](https://github.com/hashicorp/terraform/issues/2395)) - * **New resource: `aws_lambda_function`** ([#2170](https://github.com/hashicorp/terraform/issues/2170)) - * **New resource: `aws_route53_delegation_set`** ([#1999](https://github.com/hashicorp/terraform/issues/1999)) - * **New resource: `aws_route53_health_check`** ([#2226](https://github.com/hashicorp/terraform/issues/2226)) - * **New resource: `aws_spot_instance_request`** ([#2263](https://github.com/hashicorp/terraform/issues/2263)) - * **New resource: `cloudstack_ssh_keypair`** ([#2004](https://github.com/hashicorp/terraform/issues/2004)) - * **New remote state backend: `swift`**: You can now store remote state in - a OpenStack Swift. ([#2254](https://github.com/hashicorp/terraform/issues/2254)) - * command/output: support display of module outputs ([#2102](https://github.com/hashicorp/terraform/issues/2102)) - * core: `keys()` and `values()` funcs for map variables ([#2198](https://github.com/hashicorp/terraform/issues/2198)) - * connection/ssh: SSH bastion host support and ssh-agent forwarding ([#2425](https://github.com/hashicorp/terraform/issues/2425)) - -IMPROVEMENTS: - - * core: HTTP remote state now accepts `skip_cert_verification` - option to ignore TLS cert verification. ([#2214](https://github.com/hashicorp/terraform/issues/2214)) - * core: S3 remote state now accepts the 'encrypt' option for SSE ([#2405](https://github.com/hashicorp/terraform/issues/2405)) - * core: `plan` now reports sum of resources to be changed/created/destroyed ([#2458](https://github.com/hashicorp/terraform/issues/2458)) - * core: Change string list representation so we can distinguish empty, single - element lists ([#2504](https://github.com/hashicorp/terraform/issues/2504)) - * core: Properly close provider and provisioner plugin connections ([#2406](https://github.com/hashicorp/terraform/issues/2406), [#2527](https://github.com/hashicorp/terraform/issues/2527)) - * provider/aws: AutoScaling groups now support updating Load Balancers without - recreation ([#2472](https://github.com/hashicorp/terraform/issues/2472)) - * provider/aws: Allow more in-place updates for ElastiCache cluster without recreating - ([#2469](https://github.com/hashicorp/terraform/issues/2469)) - * provider/aws: ElastiCache Subnet Groups can be updated - without destroying first ([#2191](https://github.com/hashicorp/terraform/issues/2191)) - * provider/aws: Normalize `certificate_chain` in `aws_iam_server_certificate` to - prevent unnecessary replacement. ([#2411](https://github.com/hashicorp/terraform/issues/2411)) - * provider/aws: `aws_instance` supports `monitoring' ([#2489](https://github.com/hashicorp/terraform/issues/2489)) - * provider/aws: `aws_launch_configuration` now supports `enable_monitoring` ([#2410](https://github.com/hashicorp/terraform/issues/2410)) - * provider/aws: Show outputs after `terraform refresh` ([#2347](https://github.com/hashicorp/terraform/issues/2347)) - * provider/aws: Add backoff/throttling during DynamoDB creation ([#2462](https://github.com/hashicorp/terraform/issues/2462)) - * provider/aws: Add validation for aws_vpc.cidr_block ([#2514](https://github.com/hashicorp/terraform/issues/2514)) - * provider/aws: Add validation for aws_db_subnet_group.name ([#2513](https://github.com/hashicorp/terraform/issues/2513)) - * provider/aws: Add validation for aws_db_instance.identifier ([#2516](https://github.com/hashicorp/terraform/issues/2516)) - * provider/aws: Add validation for aws_elb.name ([#2517](https://github.com/hashicorp/terraform/issues/2517)) - * provider/aws: Add validation for aws_security_group (name+description) ([#2518](https://github.com/hashicorp/terraform/issues/2518)) - * provider/aws: Add validation for aws_launch_configuration ([#2519](https://github.com/hashicorp/terraform/issues/2519)) - * provider/aws: Add validation for aws_autoscaling_group.name ([#2520](https://github.com/hashicorp/terraform/issues/2520)) - * provider/aws: Add validation for aws_iam_role.name ([#2521](https://github.com/hashicorp/terraform/issues/2521)) - * provider/aws: Add validation for aws_iam_role_policy.name ([#2552](https://github.com/hashicorp/terraform/issues/2552)) - * provider/aws: Add validation for aws_iam_instance_profile.name ([#2553](https://github.com/hashicorp/terraform/issues/2553)) - * provider/aws: aws_auto_scaling_group.default_cooldown no longer requires - resource replacement ([#2510](https://github.com/hashicorp/terraform/issues/2510)) - * provider/aws: add AH and ESP protocol integers ([#2321](https://github.com/hashicorp/terraform/issues/2321)) - * provider/docker: `docker_container` has the `privileged` - option. ([#2227](https://github.com/hashicorp/terraform/issues/2227)) - * provider/openstack: allow `OS_AUTH_TOKEN` environment variable - to set the openstack `api_key` field ([#2234](https://github.com/hashicorp/terraform/issues/2234)) - * provider/openstack: Can now configure endpoint type (public, admin, - internal) ([#2262](https://github.com/hashicorp/terraform/issues/2262)) - * provider/cloudstack: `cloudstack_instance` now supports projects ([#2115](https://github.com/hashicorp/terraform/issues/2115)) - * provisioner/chef: Added a `os_type` to specifically specify the target OS ([#2483](https://github.com/hashicorp/terraform/issues/2483)) - * provisioner/chef: Added a `ohai_hints` option to upload hint files ([#2487](https://github.com/hashicorp/terraform/issues/2487)) - -BUG FIXES: - - * core: lifecycle `prevent_destroy` can be any value that can be - coerced into a bool ([#2268](https://github.com/hashicorp/terraform/issues/2268)) - * core: matching provider types in sibling modules won't override - each other's config. ([#2464](https://github.com/hashicorp/terraform/issues/2464)) - * core: computed provider configurations now properly validate ([#2457](https://github.com/hashicorp/terraform/issues/2457)) - * core: orphan (commented out) resource dependencies are destroyed in - the correct order ([#2453](https://github.com/hashicorp/terraform/issues/2453)) - * core: validate object types in plugins are actually objects ([#2450](https://github.com/hashicorp/terraform/issues/2450)) - * core: fix `-no-color` flag in subcommands ([#2414](https://github.com/hashicorp/terraform/issues/2414)) - * core: Fix error of 'attribute not found for variable' when a computed - resource attribute is used as a parameter to a module ([#2477](https://github.com/hashicorp/terraform/issues/2477)) - * core: moduled orphans will properly inherit provider configs ([#2476](https://github.com/hashicorp/terraform/issues/2476)) - * core: modules with provider aliases work properly if the parent - doesn't implement those aliases ([#2475](https://github.com/hashicorp/terraform/issues/2475)) - * core: unknown resource attributes passed in as parameters to modules - now error ([#2478](https://github.com/hashicorp/terraform/issues/2478)) - * core: better error messages for missing variables ([#2479](https://github.com/hashicorp/terraform/issues/2479)) - * core: removed set items now properly appear in diffs and applies ([#2507](https://github.com/hashicorp/terraform/issues/2507)) - * core: '*' will not be added as part of the variable name when you - attempt multiplication without a space ([#2505](https://github.com/hashicorp/terraform/issues/2505)) - * core: fix target dependency calculation across module boundaries ([#2555](https://github.com/hashicorp/terraform/issues/2555)) - * command/*: fixed bug where variable input was not asked for unset - vars if terraform.tfvars existed ([#2502](https://github.com/hashicorp/terraform/issues/2502)) - * command/apply: prevent output duplication when reporting errors ([#2267](https://github.com/hashicorp/terraform/issues/2267)) - * command/apply: destroyed orphan resources are properly counted ([#2506](https://github.com/hashicorp/terraform/issues/2506)) - * provider/aws: loading credentials from the environment (vars, EC2 role, - etc.) is more robust and will not ask for credentials from stdin ([#1841](https://github.com/hashicorp/terraform/issues/1841)) - * provider/aws: fix panic when route has no `cidr_block` ([#2215](https://github.com/hashicorp/terraform/issues/2215)) - * provider/aws: fix issue preventing destruction of IAM Roles ([#2177](https://github.com/hashicorp/terraform/issues/2177)) - * provider/aws: fix issue where Security Group Rules could collide and fail - to save to the state file correctly ([#2376](https://github.com/hashicorp/terraform/issues/2376)) - * provider/aws: fix issue preventing destruction self referencing Securtity - Group Rules ([#2305](https://github.com/hashicorp/terraform/issues/2305)) - * provider/aws: fix issue causing perpetual diff on ELB listeners - when non-lowercase protocol strings were used ([#2246](https://github.com/hashicorp/terraform/issues/2246)) - * provider/aws: corrected frankfurt S3 website region ([#2259](https://github.com/hashicorp/terraform/issues/2259)) - * provider/aws: `aws_elasticache_cluster` port is required ([#2160](https://github.com/hashicorp/terraform/issues/2160)) - * provider/aws: Handle AMIs where RootBlockDevice does not appear in the - BlockDeviceMapping, preventing root_block_device from working ([#2271](https://github.com/hashicorp/terraform/issues/2271)) - * provider/aws: fix `terraform show` with remote state ([#2371](https://github.com/hashicorp/terraform/issues/2371)) - * provider/aws: detect `instance_type` drift on `aws_instance` ([#2374](https://github.com/hashicorp/terraform/issues/2374)) - * provider/aws: fix crash when `security_group_rule` referenced non-existent - security group ([#2434](https://github.com/hashicorp/terraform/issues/2434)) - * provider/aws: `aws_launch_configuration` retries if IAM instance - profile is not ready yet. ([#2452](https://github.com/hashicorp/terraform/issues/2452)) - * provider/aws: `fqdn` is populated during creation for `aws_route53_record` ([#2528](https://github.com/hashicorp/terraform/issues/2528)) - * provider/aws: retry VPC delete on DependencyViolation due to eventual - consistency ([#2532](https://github.com/hashicorp/terraform/issues/2532)) - * provider/aws: VPC peering connections in "failed" state are deleted ([#2544](https://github.com/hashicorp/terraform/issues/2544)) - * provider/aws: EIP deletion works if it was manually disassociated ([#2543](https://github.com/hashicorp/terraform/issues/2543)) - * provider/aws: `elasticache_subnet_group.subnet_ids` is now a required argument ([#2534](https://github.com/hashicorp/terraform/issues/2534)) - * provider/aws: handle nil response from VPN connection describes ([#2533](https://github.com/hashicorp/terraform/issues/2533)) - * provider/cloudflare: manual record deletion doesn't cause error ([#2545](https://github.com/hashicorp/terraform/issues/2545)) - * provider/digitalocean: handle case where droplet is deleted outside of - terraform ([#2497](https://github.com/hashicorp/terraform/issues/2497)) - * provider/dme: No longer an error if record deleted manually ([#2546](https://github.com/hashicorp/terraform/issues/2546)) - * provider/docker: Fix issues when using containers with links ([#2327](https://github.com/hashicorp/terraform/issues/2327)) - * provider/openstack: fix panic case if API returns nil network ([#2448](https://github.com/hashicorp/terraform/issues/2448)) - * provider/template: fix issue causing "unknown variable" rendering errors - when an existing set of template variables is changed ([#2386](https://github.com/hashicorp/terraform/issues/2386)) - * provisioner/chef: improve the decoding logic to prevent parameter not found errors ([#2206](https://github.com/hashicorp/terraform/issues/2206)) - -## 0.5.3 (June 1, 2015) - -IMPROVEMENTS: - - * **New resource: `aws_kinesis_stream`** ([#2110](https://github.com/hashicorp/terraform/issues/2110)) - * **New resource: `aws_iam_server_certificate`** ([#2086](https://github.com/hashicorp/terraform/issues/2086)) - * **New resource: `aws_sqs_queue`** ([#1939](https://github.com/hashicorp/terraform/issues/1939)) - * **New resource: `aws_sns_topic`** ([#1974](https://github.com/hashicorp/terraform/issues/1974)) - * **New resource: `aws_sns_topic_subscription`** ([#1974](https://github.com/hashicorp/terraform/issues/1974)) - * **New resource: `aws_volume_attachment`** ([#2050](https://github.com/hashicorp/terraform/issues/2050)) - * **New resource: `google_storage_bucket`** ([#2060](https://github.com/hashicorp/terraform/issues/2060)) - * provider/aws: support ec2 termination protection ([#1988](https://github.com/hashicorp/terraform/issues/1988)) - * provider/aws: support for RDS Read Replicas ([#1946](https://github.com/hashicorp/terraform/issues/1946)) - * provider/aws: `aws_s3_bucket` add support for `policy` ([#1992](https://github.com/hashicorp/terraform/issues/1992)) - * provider/aws: `aws_ebs_volume` add support for `tags` ([#2135](https://github.com/hashicorp/terraform/issues/2135)) - * provider/aws: `aws_elasticache_cluster` Confirm node status before reporting - available - * provider/aws: `aws_network_acl` Add support for ICMP Protocol ([#2148](https://github.com/hashicorp/terraform/issues/2148)) - * provider/aws: New `force_destroy` parameter for S3 buckets, to destroy - Buckets that contain objects ([#2007](https://github.com/hashicorp/terraform/issues/2007)) - * provider/aws: switching `health_check_type` on ASGs no longer requires - resource refresh ([#2147](https://github.com/hashicorp/terraform/issues/2147)) - * provider/aws: ignore empty `vpc_security_group_ids` on `aws_instance` ([#2311](https://github.com/hashicorp/terraform/issues/2311)) - -BUG FIXES: - - * provider/aws: Correctly handle AWS keypairs which no longer exist ([#2032](https://github.com/hashicorp/terraform/issues/2032)) - * provider/aws: Fix issue with restoring an Instance from snapshot ID ([#2120](https://github.com/hashicorp/terraform/issues/2120)) - * provider/template: store relative path in the state ([#2038](https://github.com/hashicorp/terraform/issues/2038)) - * provisioner/chef: fix interpolation in the Chef provisioner ([#2168](https://github.com/hashicorp/terraform/issues/2168)) - * provisioner/remote-exec: Don't prepend shebang on scripts that already - have one ([#2041](https://github.com/hashicorp/terraform/issues/2041)) - -## 0.5.2 (May 15, 2015) - -FEATURES: - - * **Chef provisioning**: You can now provision new hosts (both Linux and - Windows) with [Chef](https://chef.io) using a native provisioner ([#1868](https://github.com/hashicorp/terraform/issues/1868)) - -IMPROVEMENTS: - - * **New config function: `formatlist`** - Format lists in a similar way to `format`. - Useful for creating URLs from a list of IPs. ([#1829](https://github.com/hashicorp/terraform/issues/1829)) - * **New resource: `aws_route53_zone_association`** - * provider/aws: `aws_autoscaling_group` can wait for capacity in ELB - via `min_elb_capacity` ([#1970](https://github.com/hashicorp/terraform/issues/1970)) - * provider/aws: `aws_db_instances` supports `license_model` ([#1966](https://github.com/hashicorp/terraform/issues/1966)) - * provider/aws: `aws_elasticache_cluster` add support for Tags ([#1965](https://github.com/hashicorp/terraform/issues/1965)) - * provider/aws: `aws_network_acl` Network ACLs can be applied to multiple subnets ([#1931](https://github.com/hashicorp/terraform/issues/1931)) - * provider/aws: `aws_s3_bucket` exports `hosted_zone_id` and `region` ([#1865](https://github.com/hashicorp/terraform/issues/1865)) - * provider/aws: `aws_s3_bucket` add support for website `redirect_all_requests_to` ([#1909](https://github.com/hashicorp/terraform/issues/1909)) - * provider/aws: `aws_route53_record` exports `fqdn` ([#1847](https://github.com/hashicorp/terraform/issues/1847)) - * provider/aws: `aws_route53_zone` can create private hosted zones ([#1526](https://github.com/hashicorp/terraform/issues/1526)) - * provider/google: `google_compute_instance` `scratch` attribute added ([#1920](https://github.com/hashicorp/terraform/issues/1920)) - -BUG FIXES: - - * core: fix "resource not found" for interpolation issues with modules - * core: fix unflattenable error for orphans ([#1922](https://github.com/hashicorp/terraform/issues/1922)) - * core: fix deadlock with create-before-destroy + modules ([#1949](https://github.com/hashicorp/terraform/issues/1949)) - * core: fix "no roots found" error with create-before-destroy ([#1953](https://github.com/hashicorp/terraform/issues/1953)) - * core: variables set with environment variables won't validate as - not set without a default ([#1930](https://github.com/hashicorp/terraform/issues/1930)) - * core: resources with a blank ID in the state are now assumed to not exist ([#1905](https://github.com/hashicorp/terraform/issues/1905)) - * command/push: local vars override remote ones ([#1881](https://github.com/hashicorp/terraform/issues/1881)) - * provider/aws: Mark `aws_security_group` description as `ForceNew` ([#1871](https://github.com/hashicorp/terraform/issues/1871)) - * provider/aws: `aws_db_instance` ARN value is correct ([#1910](https://github.com/hashicorp/terraform/issues/1910)) - * provider/aws: `aws_db_instance` only submit modify request if there - is a change. ([#1906](https://github.com/hashicorp/terraform/issues/1906)) - * provider/aws: `aws_elasticache_cluster` export missing information on cluster nodes ([#1965](https://github.com/hashicorp/terraform/issues/1965)) - * provider/aws: bad AMI on a launch configuration won't block refresh ([#1901](https://github.com/hashicorp/terraform/issues/1901)) - * provider/aws: `aws_security_group` + `aws_subnet` - destroy timeout increased - to prevent DependencyViolation errors. ([#1886](https://github.com/hashicorp/terraform/issues/1886)) - * provider/google: `google_compute_instance` Local SSDs no-longer cause crash - ([#1088](https://github.com/hashicorp/terraform/issues/1088)) - * provider/google: `google_http_health_check` Defaults now driven from Terraform, - avoids errors on update ([#1894](https://github.com/hashicorp/terraform/issues/1894)) - * provider/google: `google_compute_template` Update Instance Template network - definition to match changes to Instance ([#980](https://github.com/hashicorp/terraform/issues/980)) - * provider/template: Fix infinite diff ([#1898](https://github.com/hashicorp/terraform/issues/1898)) - -## 0.5.1 (never released) - -This version was never released since we accidentally skipped it! - -## 0.5.0 (May 7, 2015) - -BACKWARDS INCOMPATIBILITIES: - - * provider/aws: Terraform now remove the default egress rule created by AWS in - a new security group. - -FEATURES: - - * **Multi-provider (a.k.a multi-region)**: Multiple instances of a single - provider can be configured so resources can apply to different settings. - As an example, this allows Terraform to manage multiple regions with AWS. - * **Environmental variables to set variables**: Environment variables can be - used to set variables. The environment variables must be in the format - `TF_VAR_name` and this will be checked last for a value. - * **New remote state backend: `s3`**: You can now store remote state in - an S3 bucket. ([#1723](https://github.com/hashicorp/terraform/issues/1723)) - * **Automatic AWS retries**: This release includes a lot of improvement - around automatic retries of transient errors in AWS. The number of - retry attempts is also configurable. - * **Templates**: A new `template_file` resource allows long strings needing - variable interpolation to be moved into files. ([#1778](https://github.com/hashicorp/terraform/issues/1778)) - * **Provision with WinRM**: Provisioners can now run remote commands on - Windows hosts. ([#1483](https://github.com/hashicorp/terraform/issues/1483)) - -IMPROVEMENTS: - - * **New config function: `length`** - Get the length of a string or a list. - Useful in conjunction with `split`. ([#1495](https://github.com/hashicorp/terraform/issues/1495)) - * **New resource: `aws_app_cookie_stickiness_policy`** - * **New resource: `aws_customer_gateway`** - * **New resource: `aws_ebs_volume`** - * **New resource: `aws_elasticache_cluster`** - * **New resource: `aws_elasticache_security_group`** - * **New resource: `aws_elasticache_subnet_group`** - * **New resource: `aws_iam_access_key`** - * **New resource: `aws_iam_group_policy`** - * **New resource: `aws_iam_group`** - * **New resource: `aws_iam_instance_profile`** - * **New resource: `aws_iam_policy`** - * **New resource: `aws_iam_role_policy`** - * **New resource: `aws_iam_role`** - * **New resource: `aws_iam_user_policy`** - * **New resource: `aws_iam_user`** - * **New resource: `aws_lb_cookie_stickiness_policy`** - * **New resource: `aws_proxy_protocol_policy`** - * **New resource: `aws_security_group_rule`** - * **New resource: `aws_vpc_dhcp_options_association`** - * **New resource: `aws_vpc_dhcp_options`** - * **New resource: `aws_vpn_connection_route`** - * **New resource: `google_dns_managed_zone`** - * **New resource: `google_dns_record_set`** - * **Migrate to upstream AWS SDK:** Migrate the AWS provider to - [awslabs/aws-sdk-go](https://github.com/awslabs/aws-sdk-go), - the official `awslabs` library. Previously we had forked the library for - stability while `awslabs` refactored. Now that work has completed, and we've - migrated back to the upstream version. - * core: Improve error message on diff mismatch ([#1501](https://github.com/hashicorp/terraform/issues/1501)) - * provisioner/file: expand `~` in source path ([#1569](https://github.com/hashicorp/terraform/issues/1569)) - * provider/aws: Better retry logic, now retries up to 11 times by default - with exponentional backoff. This number is configurable. ([#1787](https://github.com/hashicorp/terraform/issues/1787)) - * provider/aws: Improved credential detection ([#1470](https://github.com/hashicorp/terraform/issues/1470)) - * provider/aws: Can specify a `token` via the config file ([#1601](https://github.com/hashicorp/terraform/issues/1601)) - * provider/aws: Added new `vpc_security_group_ids` attribute for AWS - Instances. If using a VPC, you can now modify the security groups for that - Instance without destroying it ([#1539](https://github.com/hashicorp/terraform/issues/1539)) - * provider/aws: White or blacklist account IDs that can be used to - protect against accidents. ([#1595](https://github.com/hashicorp/terraform/issues/1595)) - * provider/aws: Add a subset of IAM resources ([#939](https://github.com/hashicorp/terraform/issues/939)) - * provider/aws: `aws_autoscaling_group` retries deletes through "in progress" - errors ([#1840](https://github.com/hashicorp/terraform/issues/1840)) - * provider/aws: `aws_autoscaling_group` waits for healthy capacity during - ASG creation ([#1839](https://github.com/hashicorp/terraform/issues/1839)) - * provider/aws: `aws_instance` supports placement groups ([#1358](https://github.com/hashicorp/terraform/issues/1358)) - * provider/aws: `aws_eip` supports network interface attachment ([#1681](https://github.com/hashicorp/terraform/issues/1681)) - * provider/aws: `aws_elb` supports in-place changing of listeners ([#1619](https://github.com/hashicorp/terraform/issues/1619)) - * provider/aws: `aws_elb` supports connection draining settings ([#1502](https://github.com/hashicorp/terraform/issues/1502)) - * provider/aws: `aws_elb` increase default idle timeout to 60s ([#1646](https://github.com/hashicorp/terraform/issues/1646)) - * provider/aws: `aws_key_pair` name can be omitted and generated ([#1751](https://github.com/hashicorp/terraform/issues/1751)) - * provider/aws: `aws_network_acl` improved validation for network ACL ports - and protocols ([#1798](https://github.com/hashicorp/terraform/issues/1798)) ([#1808](https://github.com/hashicorp/terraform/issues/1808)) - * provider/aws: `aws_route_table` can target network interfaces ([#968](https://github.com/hashicorp/terraform/issues/968)) - * provider/aws: `aws_route_table` can specify propagating VGWs ([#1516](https://github.com/hashicorp/terraform/issues/1516)) - * provider/aws: `aws_route53_record` supports weighted sets ([#1578](https://github.com/hashicorp/terraform/issues/1578)) - * provider/aws: `aws_route53_zone` exports nameservers ([#1525](https://github.com/hashicorp/terraform/issues/1525)) - * provider/aws: `aws_s3_bucket` website support ([#1738](https://github.com/hashicorp/terraform/issues/1738)) - * provider/aws: `aws_security_group` name becomes optional and can be - automatically set to a unique identifier; this helps with - `create_before_destroy` scenarios ([#1632](https://github.com/hashicorp/terraform/issues/1632)) - * provider/aws: `aws_security_group` description becomes optional with a - static default value ([#1632](https://github.com/hashicorp/terraform/issues/1632)) - * provider/aws: automatically set the private IP as the SSH address - if not specified and no public IP is available ([#1623](https://github.com/hashicorp/terraform/issues/1623)) - * provider/aws: `aws_elb` exports `source_security_group` field ([#1708](https://github.com/hashicorp/terraform/issues/1708)) - * provider/aws: `aws_route53_record` supports alias targeting ([#1775](https://github.com/hashicorp/terraform/issues/1775)) - * provider/aws: Remove default AWS egress rule for newly created Security Groups ([#1765](https://github.com/hashicorp/terraform/issues/1765)) - * provider/consul: add `scheme` configuration argument ([#1838](https://github.com/hashicorp/terraform/issues/1838)) - * provider/docker: `docker_container` can specify links ([#1564](https://github.com/hashicorp/terraform/issues/1564)) - * provider/google: `resource_compute_disk` supports snapshots ([#1426](https://github.com/hashicorp/terraform/issues/1426)) - * provider/google: `resource_compute_instance` supports specifying the - device name ([#1426](https://github.com/hashicorp/terraform/issues/1426)) - * provider/openstack: Floating IP support for LBaaS ([#1550](https://github.com/hashicorp/terraform/issues/1550)) - * provider/openstack: Add AZ to `openstack_blockstorage_volume_v1` ([#1726](https://github.com/hashicorp/terraform/issues/1726)) - -BUG FIXES: - - * core: Fix graph cycle issues surrounding modules ([#1582](https://github.com/hashicorp/terraform/issues/1582)) ([#1637](https://github.com/hashicorp/terraform/issues/1637)) - * core: math on arbitrary variables works if first operand isn't a - numeric primitive. ([#1381](https://github.com/hashicorp/terraform/issues/1381)) - * core: avoid unnecessary cycles by pruning tainted destroys from - graph if there are no tainted resources ([#1475](https://github.com/hashicorp/terraform/issues/1475)) - * core: fix issue where destroy nodes weren't pruned in specific - edge cases around matching prefixes, which could cause cycles ([#1527](https://github.com/hashicorp/terraform/issues/1527)) - * core: fix issue causing diff mismatch errors in certain scenarios during - resource replacement ([#1515](https://github.com/hashicorp/terraform/issues/1515)) - * core: dependencies on resources with a different index work when - count > 1 ([#1540](https://github.com/hashicorp/terraform/issues/1540)) - * core: don't panic if variable default type is invalid ([#1344](https://github.com/hashicorp/terraform/issues/1344)) - * core: fix perpetual diff issue for computed maps that are empty ([#1607](https://github.com/hashicorp/terraform/issues/1607)) - * core: validation added to check for `self` variables in modules ([#1609](https://github.com/hashicorp/terraform/issues/1609)) - * core: fix edge case where validation didn't pick up unknown fields - if the value was computed ([#1507](https://github.com/hashicorp/terraform/issues/1507)) - * core: Fix issue where values in sets on resources couldn't contain - hyphens. ([#1641](https://github.com/hashicorp/terraform/issues/1641)) - * core: Outputs removed from the config are removed from the state ([#1714](https://github.com/hashicorp/terraform/issues/1714)) - * core: Validate against the worst-case graph during plan phase to catch cycles - that would previously only show up during apply ([#1655](https://github.com/hashicorp/terraform/issues/1655)) - * core: Referencing invalid module output in module validates ([#1448](https://github.com/hashicorp/terraform/issues/1448)) - * command: remote states with uppercase types work ([#1356](https://github.com/hashicorp/terraform/issues/1356)) - * provider/aws: Support `AWS_SECURITY_TOKEN` env var again ([#1785](https://github.com/hashicorp/terraform/issues/1785)) - * provider/aws: Don't save "instance" for EIP if association fails ([#1776](https://github.com/hashicorp/terraform/issues/1776)) - * provider/aws: launch configuration ID set after create success ([#1518](https://github.com/hashicorp/terraform/issues/1518)) - * provider/aws: Fixed an issue with creating ELBs without any tags ([#1580](https://github.com/hashicorp/terraform/issues/1580)) - * provider/aws: Fix issue in Security Groups with empty IPRanges ([#1612](https://github.com/hashicorp/terraform/issues/1612)) - * provider/aws: manually deleted S3 buckets are refreshed properly ([#1574](https://github.com/hashicorp/terraform/issues/1574)) - * provider/aws: only check for EIP allocation ID in VPC ([#1555](https://github.com/hashicorp/terraform/issues/1555)) - * provider/aws: raw protocol numbers work in `aws_network_acl` ([#1435](https://github.com/hashicorp/terraform/issues/1435)) - * provider/aws: Block devices can be encrypted ([#1718](https://github.com/hashicorp/terraform/issues/1718)) - * provider/aws: ASG health check grace period can be updated in-place ([#1682](https://github.com/hashicorp/terraform/issues/1682)) - * provider/aws: ELB security groups can be updated in-place ([#1662](https://github.com/hashicorp/terraform/issues/1662)) - * provider/aws: `aws_main_route_table diff --git a/vendor/github.com/hashicorp/terraform/Dockerfile b/vendor/github.com/hashicorp/terraform/Dockerfile deleted file mode 100644 index c5afc0d..0000000 --- a/vendor/github.com/hashicorp/terraform/Dockerfile +++ /dev/null @@ -1,24 +0,0 @@ -# This Dockerfile builds on golang:alpine by building Terraform from source -# using the current working directory. -# -# This produces a docker image that contains a working Terraform binary along -# with all of its source code, which is what gets released on hub.docker.com -# as terraform:full. The main releases (terraform:latest, terraform:light and -# the release tags) are lighter images including only the officially-released -# binary from releases.hashicorp.com; these are built instead from -# scripts/docker-release/Dockerfile-release. - -FROM golang:alpine -LABEL maintainer="HashiCorp Terraform Team " - -RUN apk add --update git bash openssh - -ENV TF_DEV=true -ENV TF_RELEASE=1 - -WORKDIR $GOPATH/src/github.com/hashicorp/terraform -COPY . . -RUN /bin/bash scripts/build.sh - -WORKDIR $GOPATH -ENTRYPOINT ["terraform"] diff --git a/vendor/github.com/hashicorp/terraform/LICENSE b/vendor/github.com/hashicorp/terraform/LICENSE deleted file mode 100644 index c33dcc7..0000000 --- a/vendor/github.com/hashicorp/terraform/LICENSE +++ /dev/null @@ -1,354 +0,0 @@ -Mozilla Public License, version 2.0 - -1. Definitions - -1.1. “Contributor” - - means each individual or legal entity that creates, contributes to the - creation of, or owns Covered Software. - -1.2. “Contributor Version” - - means the combination of the Contributions of others (if any) used by a - Contributor and that particular Contributor’s Contribution. - -1.3. “Contribution” - - means Covered Software of a particular Contributor. - -1.4. “Covered Software” - - means Source Code Form to which the initial Contributor has attached the - notice in Exhibit A, the Executable Form of such Source Code Form, and - Modifications of such Source Code Form, in each case including portions - thereof. - -1.5. “Incompatible With Secondary Licenses” - means - - a. that the initial Contributor has attached the notice described in - Exhibit B to the Covered Software; or - - b. that the Covered Software was made available under the terms of version - 1.1 or earlier of the License, but not also under the terms of a - Secondary License. - -1.6. “Executable Form” - - means any form of the work other than Source Code Form. - -1.7. “Larger Work” - - means a work that combines Covered Software with other material, in a separate - file or files, that is not Covered Software. - -1.8. “License” - - means this document. - -1.9. “Licensable” - - means having the right to grant, to the maximum extent possible, whether at the - time of the initial grant or subsequently, any and all of the rights conveyed by - this License. - -1.10. “Modifications” - - means any of the following: - - a. any file in Source Code Form that results from an addition to, deletion - from, or modification of the contents of Covered Software; or - - b. any new file in Source Code Form that contains any Covered Software. - -1.11. “Patent Claims” of a Contributor - - means any patent claim(s), including without limitation, method, process, - and apparatus claims, in any patent Licensable by such Contributor that - would be infringed, but for the grant of the License, by the making, - using, selling, offering for sale, having made, import, or transfer of - either its Contributions or its Contributor Version. - -1.12. “Secondary License” - - means either the GNU General Public License, Version 2.0, the GNU Lesser - General Public License, Version 2.1, the GNU Affero General Public - License, Version 3.0, or any later versions of those licenses. - -1.13. “Source Code Form” - - means the form of the work preferred for making modifications. - -1.14. “You” (or “Your”) - - means an individual or a legal entity exercising rights under this - License. For legal entities, “You” includes any entity that controls, is - controlled by, or is under common control with You. For purposes of this - definition, “control” means (a) the power, direct or indirect, to cause - the direction or management of such entity, whether by contract or - otherwise, or (b) ownership of more than fifty percent (50%) of the - outstanding shares or beneficial ownership of such entity. - - -2. License Grants and Conditions - -2.1. Grants - - Each Contributor hereby grants You a world-wide, royalty-free, - non-exclusive license: - - a. under intellectual property rights (other than patent or trademark) - Licensable by such Contributor to use, reproduce, make available, - modify, display, perform, distribute, and otherwise exploit its - Contributions, either on an unmodified basis, with Modifications, or as - part of a Larger Work; and - - b. under Patent Claims of such Contributor to make, use, sell, offer for - sale, have made, import, and otherwise transfer either its Contributions - or its Contributor Version. - -2.2. Effective Date - - The licenses granted in Section 2.1 with respect to any Contribution become - effective for each Contribution on the date the Contributor first distributes - such Contribution. - -2.3. Limitations on Grant Scope - - The licenses granted in this Section 2 are the only rights granted under this - License. No additional rights or licenses will be implied from the distribution - or licensing of Covered Software under this License. Notwithstanding Section - 2.1(b) above, no patent license is granted by a Contributor: - - a. for any code that a Contributor has removed from Covered Software; or - - b. for infringements caused by: (i) Your and any other third party’s - modifications of Covered Software, or (ii) the combination of its - Contributions with other software (except as part of its Contributor - Version); or - - c. under Patent Claims infringed by Covered Software in the absence of its - Contributions. - - This License does not grant any rights in the trademarks, service marks, or - logos of any Contributor (except as may be necessary to comply with the - notice requirements in Section 3.4). - -2.4. Subsequent Licenses - - No Contributor makes additional grants as a result of Your choice to - distribute the Covered Software under a subsequent version of this License - (see Section 10.2) or under the terms of a Secondary License (if permitted - under the terms of Section 3.3). - -2.5. Representation - - Each Contributor represents that the Contributor believes its Contributions - are its original creation(s) or it has sufficient rights to grant the - rights to its Contributions conveyed by this License. - -2.6. Fair Use - - This License is not intended to limit any rights You have under applicable - copyright doctrines of fair use, fair dealing, or other equivalents. - -2.7. Conditions - - Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in - Section 2.1. - - -3. Responsibilities - -3.1. Distribution of Source Form - - All distribution of Covered Software in Source Code Form, including any - Modifications that You create or to which You contribute, must be under the - terms of this License. You must inform recipients that the Source Code Form - of the Covered Software is governed by the terms of this License, and how - they can obtain a copy of this License. You may not attempt to alter or - restrict the recipients’ rights in the Source Code Form. - -3.2. Distribution of Executable Form - - If You distribute Covered Software in Executable Form then: - - a. such Covered Software must also be made available in Source Code Form, - as described in Section 3.1, and You must inform recipients of the - Executable Form how they can obtain a copy of such Source Code Form by - reasonable means in a timely manner, at a charge no more than the cost - of distribution to the recipient; and - - b. You may distribute such Executable Form under the terms of this License, - or sublicense it under different terms, provided that the license for - the Executable Form does not attempt to limit or alter the recipients’ - rights in the Source Code Form under this License. - -3.3. Distribution of a Larger Work - - You may create and distribute a Larger Work under terms of Your choice, - provided that You also comply with the requirements of this License for the - Covered Software. If the Larger Work is a combination of Covered Software - with a work governed by one or more Secondary Licenses, and the Covered - Software is not Incompatible With Secondary Licenses, this License permits - You to additionally distribute such Covered Software under the terms of - such Secondary License(s), so that the recipient of the Larger Work may, at - their option, further distribute the Covered Software under the terms of - either this License or such Secondary License(s). - -3.4. Notices - - You may not remove or alter the substance of any license notices (including - copyright notices, patent notices, disclaimers of warranty, or limitations - of liability) contained within the Source Code Form of the Covered - Software, except that You may alter any license notices to the extent - required to remedy known factual inaccuracies. - -3.5. Application of Additional Terms - - You may choose to offer, and to charge a fee for, warranty, support, - indemnity or liability obligations to one or more recipients of Covered - Software. However, You may do so only on Your own behalf, and not on behalf - of any Contributor. You must make it absolutely clear that any such - warranty, support, indemnity, or liability obligation is offered by You - alone, and You hereby agree to indemnify every Contributor for any - liability incurred by such Contributor as a result of warranty, support, - indemnity or liability terms You offer. You may include additional - disclaimers of warranty and limitations of liability specific to any - jurisdiction. - -4. Inability to Comply Due to Statute or Regulation - - If it is impossible for You to comply with any of the terms of this License - with respect to some or all of the Covered Software due to statute, judicial - order, or regulation then You must: (a) comply with the terms of this License - to the maximum extent possible; and (b) describe the limitations and the code - they affect. Such description must be placed in a text file included with all - distributions of the Covered Software under this License. Except to the - extent prohibited by statute or regulation, such description must be - sufficiently detailed for a recipient of ordinary skill to be able to - understand it. - -5. Termination - -5.1. The rights granted under this License will terminate automatically if You - fail to comply with any of its terms. However, if You become compliant, - then the rights granted under this License from a particular Contributor - are reinstated (a) provisionally, unless and until such Contributor - explicitly and finally terminates Your grants, and (b) on an ongoing basis, - if such Contributor fails to notify You of the non-compliance by some - reasonable means prior to 60 days after You have come back into compliance. - Moreover, Your grants from a particular Contributor are reinstated on an - ongoing basis if such Contributor notifies You of the non-compliance by - some reasonable means, this is the first time You have received notice of - non-compliance with this License from such Contributor, and You become - compliant prior to 30 days after Your receipt of the notice. - -5.2. If You initiate litigation against any entity by asserting a patent - infringement claim (excluding declaratory judgment actions, counter-claims, - and cross-claims) alleging that a Contributor Version directly or - indirectly infringes any patent, then the rights granted to You by any and - all Contributors for the Covered Software under Section 2.1 of this License - shall terminate. - -5.3. In the event of termination under Sections 5.1 or 5.2 above, all end user - license agreements (excluding distributors and resellers) which have been - validly granted by You or Your distributors under this License prior to - termination shall survive termination. - -6. Disclaimer of Warranty - - Covered Software is provided under this License on an “as is” basis, without - warranty of any kind, either expressed, implied, or statutory, including, - without limitation, warranties that the Covered Software is free of defects, - merchantable, fit for a particular purpose or non-infringing. The entire - risk as to the quality and performance of the Covered Software is with You. - Should any Covered Software prove defective in any respect, You (not any - Contributor) assume the cost of any necessary servicing, repair, or - correction. This disclaimer of warranty constitutes an essential part of this - License. No use of any Covered Software is authorized under this License - except under this disclaimer. - -7. Limitation of Liability - - Under no circumstances and under no legal theory, whether tort (including - negligence), contract, or otherwise, shall any Contributor, or anyone who - distributes Covered Software as permitted above, be liable to You for any - direct, indirect, special, incidental, or consequential damages of any - character including, without limitation, damages for lost profits, loss of - goodwill, work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses, even if such party shall have been - informed of the possibility of such damages. This limitation of liability - shall not apply to liability for death or personal injury resulting from such - party’s negligence to the extent applicable law prohibits such limitation. - Some jurisdictions do not allow the exclusion or limitation of incidental or - consequential damages, so this exclusion and limitation may not apply to You. - -8. Litigation - - Any litigation relating to this License may be brought only in the courts of - a jurisdiction where the defendant maintains its principal place of business - and such litigation shall be governed by laws of that jurisdiction, without - reference to its conflict-of-law provisions. Nothing in this Section shall - prevent a party’s ability to bring cross-claims or counter-claims. - -9. Miscellaneous - - This License represents the complete agreement concerning the subject matter - hereof. If any provision of this License is held to be unenforceable, such - provision shall be reformed only to the extent necessary to make it - enforceable. Any law or regulation which provides that the language of a - contract shall be construed against the drafter shall not be used to construe - this License against a Contributor. - - -10. Versions of the License - -10.1. New Versions - - Mozilla Foundation is the license steward. Except as provided in Section - 10.3, no one other than the license steward has the right to modify or - publish new versions of this License. Each version will be given a - distinguishing version number. - -10.2. Effect of New Versions - - You may distribute the Covered Software under the terms of the version of - the License under which You originally received the Covered Software, or - under the terms of any subsequent version published by the license - steward. - -10.3. Modified Versions - - If you create software not governed by this License, and you want to - create a new license for such software, you may create and use a modified - version of this License if you rename the license and remove any - references to the name of the license steward (except to note that such - modified license differs from this License). - -10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses - If You choose to distribute Source Code Form that is Incompatible With - Secondary Licenses under the terms of this version of the License, the - notice described in Exhibit B of this License must be attached. - -Exhibit A - Source Code Form License Notice - - This Source Code Form is subject to the - terms of the Mozilla Public License, v. - 2.0. If a copy of the MPL was not - distributed with this file, You can - obtain one at - http://mozilla.org/MPL/2.0/. - -If it is not possible or desirable to put the notice in a particular file, then -You may include the notice in a location (such as a LICENSE file in a relevant -directory) where a recipient would be likely to look for such a notice. - -You may add additional accurate notices of copyright ownership. - -Exhibit B - “Incompatible With Secondary Licenses” Notice - - This Source Code Form is “Incompatible - With Secondary Licenses”, as defined by - the Mozilla Public License, v. 2.0. - diff --git a/vendor/github.com/hashicorp/terraform/Makefile b/vendor/github.com/hashicorp/terraform/Makefile deleted file mode 100644 index 07897da..0000000 --- a/vendor/github.com/hashicorp/terraform/Makefile +++ /dev/null @@ -1,105 +0,0 @@ -TEST?=./... -GOFMT_FILES?=$$(find . -name '*.go' | grep -v vendor) - -default: test vet - -tools: - go get -u github.com/kardianos/govendor - go get -u golang.org/x/tools/cmd/stringer - go get -u golang.org/x/tools/cmd/cover - -# bin generates the releaseable binaries for Terraform -bin: fmtcheck generate - @TF_RELEASE=1 sh -c "'$(CURDIR)/scripts/build.sh'" - -# dev creates binaries for testing Terraform locally. These are put -# into ./bin/ as well as $GOPATH/bin -dev: fmtcheck generate - @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" - -quickdev: generate - @TF_DEV=1 sh -c "'$(CURDIR)/scripts/build.sh'" - -# Shorthand for building and installing just one plugin for local testing. -# Run as (for example): make plugin-dev PLUGIN=provider-aws -plugin-dev: generate - go install github.com/hashicorp/terraform/builtin/bins/$(PLUGIN) - mv $(GOPATH)/bin/$(PLUGIN) $(GOPATH)/bin/terraform-$(PLUGIN) - -# test runs the unit tests -# we run this one package at a time here because running the entire suite in -# one command creates memory usage issues when running in Travis-CI. -test: fmtcheck generate - go test -i $(TEST) || exit 1 - go list $(TEST) | xargs -t -n4 go test $(TESTARGS) -timeout=60s -parallel=4 - -# testacc runs acceptance tests -testacc: fmtcheck generate - @if [ "$(TEST)" = "./..." ]; then \ - echo "ERROR: Set TEST to a specific package. For example,"; \ - echo " make testacc TEST=./builtin/providers/aws"; \ - exit 1; \ - fi - TF_ACC=1 go test $(TEST) -v $(TESTARGS) -timeout 120m - -# e2etest runs the end-to-end tests against a generated Terraform binary -# The TF_ACC here allows network access, but does not require any special -# credentials since the e2etests use local-only providers such as "null". -e2etest: generate - TF_ACC=1 go test -v ./command/e2etest - -test-compile: fmtcheck generate - @if [ "$(TEST)" = "./..." ]; then \ - echo "ERROR: Set TEST to a specific package. For example,"; \ - echo " make test-compile TEST=./builtin/providers/aws"; \ - exit 1; \ - fi - go test -c $(TEST) $(TESTARGS) - -# testrace runs the race checker -testrace: fmtcheck generate - TF_ACC= go test -race $(TEST) $(TESTARGS) - -cover: - @go tool cover 2>/dev/null; if [ $$? -eq 3 ]; then \ - go get -u golang.org/x/tools/cmd/cover; \ - fi - go test $(TEST) -coverprofile=coverage.out - go tool cover -html=coverage.out - rm coverage.out - -# vet runs the Go source code static analysis tool `vet` to find -# any common errors. -vet: - @echo 'go vet ./...' - @go vet ./... ; if [ $$? -eq 1 ]; then \ - echo ""; \ - echo "Vet found suspicious constructs. Please check the reported constructs"; \ - echo "and fix them if necessary before submitting the code for review."; \ - exit 1; \ - fi - -# generate runs `go generate` to build the dynamically generated -# source files. -generate: - @which stringer > /dev/null; if [ $$? -ne 0 ]; then \ - go get -u golang.org/x/tools/cmd/stringer; \ - fi - go generate ./... - @go fmt command/internal_plugin_list.go > /dev/null - -fmt: - gofmt -w $(GOFMT_FILES) - -fmtcheck: - @sh -c "'$(CURDIR)/scripts/gofmtcheck.sh'" - -vendor-status: - @govendor status - -# disallow any parallelism (-j) for Make. This is necessary since some -# commands during the build process create temporary files that collide -# under parallel conditions. -.NOTPARALLEL: - -.PHONY: bin cover default dev e2etest fmt fmtcheck generate plugin-dev quickdev test-compile test testacc testrace tools vendor-status vet diff --git a/vendor/github.com/hashicorp/terraform/README.md b/vendor/github.com/hashicorp/terraform/README.md deleted file mode 100644 index eed7f74..0000000 --- a/vendor/github.com/hashicorp/terraform/README.md +++ /dev/null @@ -1,170 +0,0 @@ -Terraform -========= - -- Website: https://www.terraform.io -- [![Gitter chat](https://badges.gitter.im/hashicorp-terraform/Lobby.png)](https://gitter.im/hashicorp-terraform/Lobby) -- Mailing list: [Google Groups](http://groups.google.com/group/terraform-tool) - -Terraform - -Terraform is a tool for building, changing, and versioning infrastructure safely and efficiently. Terraform can manage existing and popular service providers as well as custom in-house solutions. - -The key features of Terraform are: - -- **Infrastructure as Code**: Infrastructure is described using a high-level configuration syntax. This allows a blueprint of your datacenter to be versioned and treated as you would any other code. Additionally, infrastructure can be shared and re-used. - -- **Execution Plans**: Terraform has a "planning" step where it generates an *execution plan*. The execution plan shows what Terraform will do when you call apply. This lets you avoid any surprises when Terraform manipulates infrastructure. - -- **Resource Graph**: Terraform builds a graph of all your resources, and parallelizes the creation and modification of any non-dependent resources. Because of this, Terraform builds infrastructure as efficiently as possible, and operators get insight into dependencies in their infrastructure. - -- **Change Automation**: Complex changesets can be applied to your infrastructure with minimal human interaction. With the previously mentioned execution plan and resource graph, you know exactly what Terraform will change and in what order, avoiding many possible human errors. - -For more information, see the [introduction section](http://www.terraform.io/intro) of the Terraform website. - -Getting Started & Documentation -------------------------------- - -If you're new to Terraform and want to get started creating infrastructure, please checkout our [Getting Started](https://www.terraform.io/intro/getting-started/install.html) guide, available on the [Terraform website](http://www.terraform.io). - -All documentation is available on the [Terraform website](http://www.terraform.io): - - - [Intro](https://www.terraform.io/intro/index.html) - - [Docs](https://www.terraform.io/docs/index.html) - -Developing Terraform --------------------- - -If you wish to work on Terraform itself or any of its built-in providers, you'll first need [Go](http://www.golang.org) installed on your machine (version 1.9+ is *required*). Alternatively, you can use the Vagrantfile in the root of this repo to stand up a virtual machine with the appropriate dev tooling already set up for you. - -This repository contains only Terraform core, which includes the command line interface and the main graph engine. Providers are implemented as plugins that each have their own repository in [the `terraform-providers` organization](https://github.com/terraform-providers) on GitHub. Instructions for developing each provider are in the associated README file. For more information, see [the provider development overview](https://www.terraform.io/docs/plugins/provider.html). - -For local development of Terraform core, first make sure Go is properly installed and that a -[GOPATH](http://golang.org/doc/code.html#GOPATH) has been set. You will also need to add `$GOPATH/bin` to your `$PATH`. - -Next, using [Git](https://git-scm.com/), clone this repository into `$GOPATH/src/github.com/hashicorp/terraform`. All the necessary dependencies are either vendored or automatically installed, so you just need to type `make`. This will compile the code and then run the tests. If this exits with exit status 0, then everything is working! - -```sh -$ cd "$GOPATH/src/github.com/hashicorp/terraform" -$ make -``` - -To compile a development version of Terraform and the built-in plugins, run `make dev`. This will build everything using [gox](https://github.com/mitchellh/gox) and put Terraform binaries in the `bin` and `$GOPATH/bin` folders: - -```sh -$ make dev -... -$ bin/terraform -... -``` - -If you're developing a specific package, you can run tests for just that package by specifying the `TEST` variable. For example below, only`terraform` package tests will be run. - -```sh -$ make test TEST=./terraform -... -``` - -If you're working on a specific provider which has not been separated into an individual repository and only wish to rebuild that provider, you can use the `plugin-dev` target. For example, to build only the Test provider: - -```sh -$ make plugin-dev PLUGIN=provider-test -``` - -### Dependencies - -Terraform stores its dependencies under `vendor/`, which [Go 1.6+ will automatically recognize and load](https://golang.org/cmd/go/#hdr-Vendor_Directories). We use [`govendor`](https://github.com/kardianos/govendor) to manage the vendored dependencies. - -If you're developing Terraform, there are a few tasks you might need to perform. - -#### Adding a dependency - -If you're adding a dependency, you'll need to vendor it in the same Pull Request as the code that depends on it. You should do this in a separate commit from your code, as makes PR review easier and Git history simpler to read in the future. - -To add a dependency: - -Assuming your work is on a branch called `my-feature-branch`, the steps look like this: - -1. Add the new package to your GOPATH: - - ```bash - go get github.com/hashicorp/my-project - ``` - -2. Add the new package to your `vendor/` directory: - - ```bash - govendor add github.com/hashicorp/my-project/package - ``` - -3. Review the changes in git and commit them. - -#### Updating a dependency - -To update a dependency: - -1. Fetch the dependency: - - ```bash - govendor fetch github.com/hashicorp/my-project - ``` - -2. Review the changes in git and commit them. - -### Acceptance Tests - -Terraform has a comprehensive [acceptance -test](http://en.wikipedia.org/wiki/Acceptance_testing) suite covering the -built-in providers. Our [Contributing Guide](https://github.com/hashicorp/terraform/blob/master/.github/CONTRIBUTING.md) includes details about how and when to write and run acceptance tests in order to help contributions get accepted quickly. - - -### Cross Compilation and Building for Distribution - -If you wish to cross-compile Terraform for another architecture, you can set the `XC_OS` and `XC_ARCH` environment variables to values representing the target operating system and architecture before calling `make`. The output is placed in the `pkg` subdirectory tree both expanded in a directory representing the OS/architecture combination and as a ZIP archive. - -For example, to compile 64-bit Linux binaries on Mac OS X, you can run: - -```sh -$ XC_OS=linux XC_ARCH=amd64 make bin -... -$ file pkg/linux_amd64/terraform -terraform: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, not stripped -``` - -`XC_OS` and `XC_ARCH` can be space separated lists representing different combinations of operating system and architecture. For example, to compile for both Linux and Mac OS X, targeting both 32- and 64-bit architectures, you can run: - -```sh -$ XC_OS="linux darwin" XC_ARCH="386 amd64" make bin -... -$ tree ./pkg/ -P "terraform|*.zip" -./pkg/ -├── darwin_386 -│   └── terraform -├── darwin_386.zip -├── darwin_amd64 -│   └── terraform -├── darwin_amd64.zip -├── linux_386 -│   └── terraform -├── linux_386.zip -├── linux_amd64 -│   └── terraform -└── linux_amd64.zip - -4 directories, 8 files -``` - -_Note: Cross-compilation uses [gox](https://github.com/mitchellh/gox), which requires toolchains to be built with versions of Go prior to 1.5. In order to successfully cross-compile with older versions of Go, you will need to run `gox -build-toolchain` before running the commands detailed above._ - -#### Docker - -When using docker you don't need to have any of the Go development tools installed and you can clone terraform to any location on disk (doesn't have to be in your $GOPATH). This is useful for users who want to build `master` or a specific branch for testing without setting up a proper Go environment. - -For example, run the following command to build terraform in a linux-based container for macOS. - -```sh -docker run --rm -v $(pwd):/go/src/github.com/hashicorp/terraform -w /go/src/github.com/hashicorp/terraform -e XC_OS=darwin -e XC_ARCH=amd64 golang:latest bash -c "apt-get update && apt-get install -y zip && make bin" -``` - - -## License -[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fhashicorp%2Fterraform.svg?type=large)](https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fhashicorp%2Fterraform?ref=badge_large) diff --git a/vendor/github.com/hashicorp/terraform/Vagrantfile b/vendor/github.com/hashicorp/terraform/Vagrantfile deleted file mode 100644 index d140efb..0000000 --- a/vendor/github.com/hashicorp/terraform/Vagrantfile +++ /dev/null @@ -1,92 +0,0 @@ -# -*- mode: ruby -*- -# vi: set ft=ruby : - -# Vagrantfile API/syntax version. Don't touch unless you know what you're doing! -VAGRANTFILE_API_VERSION = "2" - -# Software version variables -GOVERSION = "1.9" -UBUNTUVERSION = "16.04" - -# CPU and RAM can be adjusted depending on your system -CPUCOUNT = "2" -RAM = "4096" - -$script = <" that closes the next token. If - // non-empty, the subsequent call to Next will return a raw or RCDATA text - // token: one that treats "

" as text instead of an element. - // rawTag's contents are lower-cased. - rawTag string - // textIsRaw is whether the current text token's data is not escaped. - textIsRaw bool - // convertNUL is whether NUL bytes in the current token's data should - // be converted into \ufffd replacement characters. - convertNUL bool - // allowCDATA is whether CDATA sections are allowed in the current context. - allowCDATA bool -} - -// AllowCDATA sets whether or not the tokenizer recognizes as -// the text "foo". The default value is false, which means to recognize it as -// a bogus comment "" instead. -// -// Strictly speaking, an HTML5 compliant tokenizer should allow CDATA if and -// only if tokenizing foreign content, such as MathML and SVG. However, -// tracking foreign-contentness is difficult to do purely in the tokenizer, -// as opposed to the parser, due to HTML integration points: an element -// can contain a that is foreign-to-SVG but not foreign-to- -// HTML. For strict compliance with the HTML5 tokenization algorithm, it is the -// responsibility of the user of a tokenizer to call AllowCDATA as appropriate. -// In practice, if using the tokenizer without caring whether MathML or SVG -// CDATA is text or comments, such as tokenizing HTML to find all the anchor -// text, it is acceptable to ignore this responsibility. -func (z *Tokenizer) AllowCDATA(allowCDATA bool) { - z.allowCDATA = allowCDATA -} - -// NextIsNotRawText instructs the tokenizer that the next token should not be -// considered as 'raw text'. Some elements, such as script and title elements, -// normally require the next token after the opening tag to be 'raw text' that -// has no child elements. For example, tokenizing "a<b>c</b>d" -// yields a start tag token for "", a text token for "a<b>c</b>d", and -// an end tag token for "". There are no distinct start tag or end tag -// tokens for the "" and "". -// -// This tokenizer implementation will generally look for raw text at the right -// times. Strictly speaking, an HTML5 compliant tokenizer should not look for -// raw text if in foreign content: generally needs raw text, but a -// <title> inside an <svg> does not. Another example is that a <textarea> -// generally needs raw text, but a <textarea> is not allowed as an immediate -// child of a <select>; in normal parsing, a <textarea> implies </select>, but -// one cannot close the implicit element when parsing a <select>'s InnerHTML. -// Similarly to AllowCDATA, tracking the correct moment to override raw-text- -// ness is difficult to do purely in the tokenizer, as opposed to the parser. -// For strict compliance with the HTML5 tokenization algorithm, it is the -// responsibility of the user of a tokenizer to call NextIsNotRawText as -// appropriate. In practice, like AllowCDATA, it is acceptable to ignore this -// responsibility for basic usage. -// -// Note that this 'raw text' concept is different from the one offered by the -// Tokenizer.Raw method. -func (z *Tokenizer) NextIsNotRawText() { - z.rawTag = "" -} - -// Err returns the error associated with the most recent ErrorToken token. -// This is typically io.EOF, meaning the end of tokenization. -func (z *Tokenizer) Err() error { - if z.tt != ErrorToken { - return nil - } - return z.err -} - -// readByte returns the next byte from the input stream, doing a buffered read -// from z.r into z.buf if necessary. z.buf[z.raw.start:z.raw.end] remains a contiguous byte -// slice that holds all the bytes read so far for the current token. -// It sets z.err if the underlying reader returns an error. -// Pre-condition: z.err == nil. -func (z *Tokenizer) readByte() byte { - if z.raw.end >= len(z.buf) { - // Our buffer is exhausted and we have to read from z.r. Check if the - // previous read resulted in an error. - if z.readErr != nil { - z.err = z.readErr - return 0 - } - // We copy z.buf[z.raw.start:z.raw.end] to the beginning of z.buf. If the length - // z.raw.end - z.raw.start is more than half the capacity of z.buf, then we - // allocate a new buffer before the copy. - c := cap(z.buf) - d := z.raw.end - z.raw.start - var buf1 []byte - if 2*d > c { - buf1 = make([]byte, d, 2*c) - } else { - buf1 = z.buf[:d] - } - copy(buf1, z.buf[z.raw.start:z.raw.end]) - if x := z.raw.start; x != 0 { - // Adjust the data/attr spans to refer to the same contents after the copy. - z.data.start -= x - z.data.end -= x - z.pendingAttr[0].start -= x - z.pendingAttr[0].end -= x - z.pendingAttr[1].start -= x - z.pendingAttr[1].end -= x - for i := range z.attr { - z.attr[i][0].start -= x - z.attr[i][0].end -= x - z.attr[i][1].start -= x - z.attr[i][1].end -= x - } - } - z.raw.start, z.raw.end, z.buf = 0, d, buf1[:d] - // Now that we have copied the live bytes to the start of the buffer, - // we read from z.r into the remainder. - var n int - n, z.readErr = readAtLeastOneByte(z.r, buf1[d:cap(buf1)]) - if n == 0 { - z.err = z.readErr - return 0 - } - z.buf = buf1[:d+n] - } - x := z.buf[z.raw.end] - z.raw.end++ - if z.maxBuf > 0 && z.raw.end-z.raw.start >= z.maxBuf { - z.err = ErrBufferExceeded - return 0 - } - return x -} - -// Buffered returns a slice containing data buffered but not yet tokenized. -func (z *Tokenizer) Buffered() []byte { - return z.buf[z.raw.end:] -} - -// readAtLeastOneByte wraps an io.Reader so that reading cannot return (0, nil). -// It returns io.ErrNoProgress if the underlying r.Read method returns (0, nil) -// too many times in succession. -func readAtLeastOneByte(r io.Reader, b []byte) (int, error) { - for i := 0; i < 100; i++ { - n, err := r.Read(b) - if n != 0 || err != nil { - return n, err - } - } - return 0, io.ErrNoProgress -} - -// skipWhiteSpace skips past any white space. -func (z *Tokenizer) skipWhiteSpace() { - if z.err != nil { - return - } - for { - c := z.readByte() - if z.err != nil { - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - // No-op. - default: - z.raw.end-- - return - } - } -} - -// readRawOrRCDATA reads until the next "</foo>", where "foo" is z.rawTag and -// is typically something like "script" or "textarea". -func (z *Tokenizer) readRawOrRCDATA() { - if z.rawTag == "script" { - z.readScript() - z.textIsRaw = true - z.rawTag = "" - return - } -loop: - for { - c := z.readByte() - if z.err != nil { - break loop - } - if c != '<' { - continue loop - } - c = z.readByte() - if z.err != nil { - break loop - } - if c != '/' { - continue loop - } - if z.readRawEndTag() || z.err != nil { - break loop - } - } - z.data.end = z.raw.end - // A textarea's or title's RCDATA can contain escaped entities. - z.textIsRaw = z.rawTag != "textarea" && z.rawTag != "title" - z.rawTag = "" -} - -// readRawEndTag attempts to read a tag like "</foo>", where "foo" is z.rawTag. -// If it succeeds, it backs up the input position to reconsume the tag and -// returns true. Otherwise it returns false. The opening "</" has already been -// consumed. -func (z *Tokenizer) readRawEndTag() bool { - for i := 0; i < len(z.rawTag); i++ { - c := z.readByte() - if z.err != nil { - return false - } - if c != z.rawTag[i] && c != z.rawTag[i]-('a'-'A') { - z.raw.end-- - return false - } - } - c := z.readByte() - if z.err != nil { - return false - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/', '>': - // The 3 is 2 for the leading "</" plus 1 for the trailing character c. - z.raw.end -= 3 + len(z.rawTag) - return true - } - z.raw.end-- - return false -} - -// readScript reads until the next </script> tag, following the byzantine -// rules for escaping/hiding the closing tag. -func (z *Tokenizer) readScript() { - defer func() { - z.data.end = z.raw.end - }() - var c byte - -scriptData: - c = z.readByte() - if z.err != nil { - return - } - if c == '<' { - goto scriptDataLessThanSign - } - goto scriptData - -scriptDataLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '/': - goto scriptDataEndTagOpen - case '!': - goto scriptDataEscapeStart - } - z.raw.end-- - goto scriptData - -scriptDataEndTagOpen: - if z.readRawEndTag() || z.err != nil { - return - } - goto scriptData - -scriptDataEscapeStart: - c = z.readByte() - if z.err != nil { - return - } - if c == '-' { - goto scriptDataEscapeStartDash - } - z.raw.end-- - goto scriptData - -scriptDataEscapeStartDash: - c = z.readByte() - if z.err != nil { - return - } - if c == '-' { - goto scriptDataEscapedDashDash - } - z.raw.end-- - goto scriptData - -scriptDataEscaped: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDash - case '<': - goto scriptDataEscapedLessThanSign - } - goto scriptDataEscaped - -scriptDataEscapedDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDashDash - case '<': - goto scriptDataEscapedLessThanSign - } - goto scriptDataEscaped - -scriptDataEscapedDashDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataEscapedDashDash - case '<': - goto scriptDataEscapedLessThanSign - case '>': - goto scriptData - } - goto scriptDataEscaped - -scriptDataEscapedLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - if c == '/' { - goto scriptDataEscapedEndTagOpen - } - if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' { - goto scriptDataDoubleEscapeStart - } - z.raw.end-- - goto scriptData - -scriptDataEscapedEndTagOpen: - if z.readRawEndTag() || z.err != nil { - return - } - goto scriptDataEscaped - -scriptDataDoubleEscapeStart: - z.raw.end-- - for i := 0; i < len("script"); i++ { - c = z.readByte() - if z.err != nil { - return - } - if c != "script"[i] && c != "SCRIPT"[i] { - z.raw.end-- - goto scriptDataEscaped - } - } - c = z.readByte() - if z.err != nil { - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/', '>': - goto scriptDataDoubleEscaped - } - z.raw.end-- - goto scriptDataEscaped - -scriptDataDoubleEscaped: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDashDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedDashDash: - c = z.readByte() - if z.err != nil { - return - } - switch c { - case '-': - goto scriptDataDoubleEscapedDashDash - case '<': - goto scriptDataDoubleEscapedLessThanSign - case '>': - goto scriptData - } - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapedLessThanSign: - c = z.readByte() - if z.err != nil { - return - } - if c == '/' { - goto scriptDataDoubleEscapeEnd - } - z.raw.end-- - goto scriptDataDoubleEscaped - -scriptDataDoubleEscapeEnd: - if z.readRawEndTag() { - z.raw.end += len("</script>") - goto scriptDataEscaped - } - if z.err != nil { - return - } - goto scriptDataDoubleEscaped -} - -// readComment reads the next comment token starting with "<!--". The opening -// "<!--" has already been consumed. -func (z *Tokenizer) readComment() { - z.data.start = z.raw.end - defer func() { - if z.data.end < z.data.start { - // It's a comment with no data, like <!-->. - z.data.end = z.data.start - } - }() - for dashCount := 2; ; { - c := z.readByte() - if z.err != nil { - // Ignore up to two dashes at EOF. - if dashCount > 2 { - dashCount = 2 - } - z.data.end = z.raw.end - dashCount - return - } - switch c { - case '-': - dashCount++ - continue - case '>': - if dashCount >= 2 { - z.data.end = z.raw.end - len("-->") - return - } - case '!': - if dashCount >= 2 { - c = z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - if c == '>' { - z.data.end = z.raw.end - len("--!>") - return - } - } - } - dashCount = 0 - } -} - -// readUntilCloseAngle reads until the next ">". -func (z *Tokenizer) readUntilCloseAngle() { - z.data.start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - if c == '>' { - z.data.end = z.raw.end - len(">") - return - } - } -} - -// readMarkupDeclaration reads the next token starting with "<!". It might be -// a "<!--comment-->", a "<!DOCTYPE foo>", a "<![CDATA[section]]>" or -// "<!a bogus comment". The opening "<!" has already been consumed. -func (z *Tokenizer) readMarkupDeclaration() TokenType { - z.data.start = z.raw.end - var c [2]byte - for i := 0; i < 2; i++ { - c[i] = z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return CommentToken - } - } - if c[0] == '-' && c[1] == '-' { - z.readComment() - return CommentToken - } - z.raw.end -= 2 - if z.readDoctype() { - return DoctypeToken - } - if z.allowCDATA && z.readCDATA() { - z.convertNUL = true - return TextToken - } - // It's a bogus comment. - z.readUntilCloseAngle() - return CommentToken -} - -// readDoctype attempts to read a doctype declaration and returns true if -// successful. The opening "<!" has already been consumed. -func (z *Tokenizer) readDoctype() bool { - const s = "DOCTYPE" - for i := 0; i < len(s); i++ { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return false - } - if c != s[i] && c != s[i]+('a'-'A') { - // Back up to read the fragment of "DOCTYPE" again. - z.raw.end = z.data.start - return false - } - } - if z.skipWhiteSpace(); z.err != nil { - z.data.start = z.raw.end - z.data.end = z.raw.end - return true - } - z.readUntilCloseAngle() - return true -} - -// readCDATA attempts to read a CDATA section and returns true if -// successful. The opening "<!" has already been consumed. -func (z *Tokenizer) readCDATA() bool { - const s = "[CDATA[" - for i := 0; i < len(s); i++ { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return false - } - if c != s[i] { - // Back up to read the fragment of "[CDATA[" again. - z.raw.end = z.data.start - return false - } - } - z.data.start = z.raw.end - brackets := 0 - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return true - } - switch c { - case ']': - brackets++ - case '>': - if brackets >= 2 { - z.data.end = z.raw.end - len("]]>") - return true - } - brackets = 0 - default: - brackets = 0 - } - } -} - -// startTagIn returns whether the start tag in z.buf[z.data.start:z.data.end] -// case-insensitively matches any element of ss. -func (z *Tokenizer) startTagIn(ss ...string) bool { -loop: - for _, s := range ss { - if z.data.end-z.data.start != len(s) { - continue loop - } - for i := 0; i < len(s); i++ { - c := z.buf[z.data.start+i] - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - if c != s[i] { - continue loop - } - } - return true - } - return false -} - -// readStartTag reads the next start tag token. The opening "<a" has already -// been consumed, where 'a' means anything in [A-Za-z]. -func (z *Tokenizer) readStartTag() TokenType { - z.readTag(true) - if z.err != nil { - return ErrorToken - } - // Several tags flag the tokenizer's next token as raw. - c, raw := z.buf[z.data.start], false - if 'A' <= c && c <= 'Z' { - c += 'a' - 'A' - } - switch c { - case 'i': - raw = z.startTagIn("iframe") - case 'n': - raw = z.startTagIn("noembed", "noframes", "noscript") - case 'p': - raw = z.startTagIn("plaintext") - case 's': - raw = z.startTagIn("script", "style") - case 't': - raw = z.startTagIn("textarea", "title") - case 'x': - raw = z.startTagIn("xmp") - } - if raw { - z.rawTag = strings.ToLower(string(z.buf[z.data.start:z.data.end])) - } - // Look for a self-closing token like "<br/>". - if z.err == nil && z.buf[z.raw.end-2] == '/' { - return SelfClosingTagToken - } - return StartTagToken -} - -// readTag reads the next tag token and its attributes. If saveAttr, those -// attributes are saved in z.attr, otherwise z.attr is set to an empty slice. -// The opening "<a" or "</a" has already been consumed, where 'a' means anything -// in [A-Za-z]. -func (z *Tokenizer) readTag(saveAttr bool) { - z.attr = z.attr[:0] - z.nAttrReturned = 0 - // Read the tag name and attribute key/value pairs. - z.readTagName() - if z.skipWhiteSpace(); z.err != nil { - return - } - for { - c := z.readByte() - if z.err != nil || c == '>' { - break - } - z.raw.end-- - z.readTagAttrKey() - z.readTagAttrVal() - // Save pendingAttr if saveAttr and that attribute has a non-empty key. - if saveAttr && z.pendingAttr[0].start != z.pendingAttr[0].end { - z.attr = append(z.attr, z.pendingAttr) - } - if z.skipWhiteSpace(); z.err != nil { - break - } - } -} - -// readTagName sets z.data to the "div" in "<div k=v>". The reader (z.raw.end) -// is positioned such that the first byte of the tag name (the "d" in "<div") -// has already been consumed. -func (z *Tokenizer) readTagName() { - z.data.start = z.raw.end - 1 - for { - c := z.readByte() - if z.err != nil { - z.data.end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - z.data.end = z.raw.end - 1 - return - case '/', '>': - z.raw.end-- - z.data.end = z.raw.end - return - } - } -} - -// readTagAttrKey sets z.pendingAttr[0] to the "k" in "<div k=v>". -// Precondition: z.err == nil. -func (z *Tokenizer) readTagAttrKey() { - z.pendingAttr[0].start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[0].end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f', '/': - z.pendingAttr[0].end = z.raw.end - 1 - return - case '=', '>': - z.raw.end-- - z.pendingAttr[0].end = z.raw.end - return - } - } -} - -// readTagAttrVal sets z.pendingAttr[1] to the "v" in "<div k=v>". -func (z *Tokenizer) readTagAttrVal() { - z.pendingAttr[1].start = z.raw.end - z.pendingAttr[1].end = z.raw.end - if z.skipWhiteSpace(); z.err != nil { - return - } - c := z.readByte() - if z.err != nil { - return - } - if c != '=' { - z.raw.end-- - return - } - if z.skipWhiteSpace(); z.err != nil { - return - } - quote := z.readByte() - if z.err != nil { - return - } - switch quote { - case '>': - z.raw.end-- - return - - case '\'', '"': - z.pendingAttr[1].start = z.raw.end - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[1].end = z.raw.end - return - } - if c == quote { - z.pendingAttr[1].end = z.raw.end - 1 - return - } - } - - default: - z.pendingAttr[1].start = z.raw.end - 1 - for { - c := z.readByte() - if z.err != nil { - z.pendingAttr[1].end = z.raw.end - return - } - switch c { - case ' ', '\n', '\r', '\t', '\f': - z.pendingAttr[1].end = z.raw.end - 1 - return - case '>': - z.raw.end-- - z.pendingAttr[1].end = z.raw.end - return - } - } - } -} - -// Next scans the next token and returns its type. -func (z *Tokenizer) Next() TokenType { - z.raw.start = z.raw.end - z.data.start = z.raw.end - z.data.end = z.raw.end - if z.err != nil { - z.tt = ErrorToken - return z.tt - } - if z.rawTag != "" { - if z.rawTag == "plaintext" { - // Read everything up to EOF. - for z.err == nil { - z.readByte() - } - z.data.end = z.raw.end - z.textIsRaw = true - } else { - z.readRawOrRCDATA() - } - if z.data.end > z.data.start { - z.tt = TextToken - z.convertNUL = true - return z.tt - } - } - z.textIsRaw = false - z.convertNUL = false - -loop: - for { - c := z.readByte() - if z.err != nil { - break loop - } - if c != '<' { - continue loop - } - - // Check if the '<' we have just read is part of a tag, comment - // or doctype. If not, it's part of the accumulated text token. - c = z.readByte() - if z.err != nil { - break loop - } - var tokenType TokenType - switch { - case 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z': - tokenType = StartTagToken - case c == '/': - tokenType = EndTagToken - case c == '!' || c == '?': - // We use CommentToken to mean any of "<!--actual comments-->", - // "<!DOCTYPE declarations>" and "<?xml processing instructions?>". - tokenType = CommentToken - default: - // Reconsume the current character. - z.raw.end-- - continue - } - - // We have a non-text token, but we might have accumulated some text - // before that. If so, we return the text first, and return the non- - // text token on the subsequent call to Next. - if x := z.raw.end - len("<a"); z.raw.start < x { - z.raw.end = x - z.data.end = x - z.tt = TextToken - return z.tt - } - switch tokenType { - case StartTagToken: - z.tt = z.readStartTag() - return z.tt - case EndTagToken: - c = z.readByte() - if z.err != nil { - break loop - } - if c == '>' { - // "</>" does not generate a token at all. Generate an empty comment - // to allow passthrough clients to pick up the data using Raw. - // Reset the tokenizer state and start again. - z.tt = CommentToken - return z.tt - } - if 'a' <= c && c <= 'z' || 'A' <= c && c <= 'Z' { - z.readTag(false) - if z.err != nil { - z.tt = ErrorToken - } else { - z.tt = EndTagToken - } - return z.tt - } - z.raw.end-- - z.readUntilCloseAngle() - z.tt = CommentToken - return z.tt - case CommentToken: - if c == '!' { - z.tt = z.readMarkupDeclaration() - return z.tt - } - z.raw.end-- - z.readUntilCloseAngle() - z.tt = CommentToken - return z.tt - } - } - if z.raw.start < z.raw.end { - z.data.end = z.raw.end - z.tt = TextToken - return z.tt - } - z.tt = ErrorToken - return z.tt -} - -// Raw returns the unmodified text of the current token. Calling Next, Token, -// Text, TagName or TagAttr may change the contents of the returned slice. -func (z *Tokenizer) Raw() []byte { - return z.buf[z.raw.start:z.raw.end] -} - -// convertNewlines converts "\r" and "\r\n" in s to "\n". -// The conversion happens in place, but the resulting slice may be shorter. -func convertNewlines(s []byte) []byte { - for i, c := range s { - if c != '\r' { - continue - } - - src := i + 1 - if src >= len(s) || s[src] != '\n' { - s[i] = '\n' - continue - } - - dst := i - for src < len(s) { - if s[src] == '\r' { - if src+1 < len(s) && s[src+1] == '\n' { - src++ - } - s[dst] = '\n' - } else { - s[dst] = s[src] - } - src++ - dst++ - } - return s[:dst] - } - return s -} - -var ( - nul = []byte("\x00") - replacement = []byte("\ufffd") -) - -// Text returns the unescaped text of a text, comment or doctype token. The -// contents of the returned slice may change on the next call to Next. -func (z *Tokenizer) Text() []byte { - switch z.tt { - case TextToken, CommentToken, DoctypeToken: - s := z.buf[z.data.start:z.data.end] - z.data.start = z.raw.end - z.data.end = z.raw.end - s = convertNewlines(s) - if (z.convertNUL || z.tt == CommentToken) && bytes.Contains(s, nul) { - s = bytes.Replace(s, nul, replacement, -1) - } - if !z.textIsRaw { - s = unescape(s, false) - } - return s - } - return nil -} - -// TagName returns the lower-cased name of a tag token (the `img` out of -// `<IMG SRC="foo">`) and whether the tag has attributes. -// The contents of the returned slice may change on the next call to Next. -func (z *Tokenizer) TagName() (name []byte, hasAttr bool) { - if z.data.start < z.data.end { - switch z.tt { - case StartTagToken, EndTagToken, SelfClosingTagToken: - s := z.buf[z.data.start:z.data.end] - z.data.start = z.raw.end - z.data.end = z.raw.end - return lower(s), z.nAttrReturned < len(z.attr) - } - } - return nil, false -} - -// TagAttr returns the lower-cased key and unescaped value of the next unparsed -// attribute for the current tag token and whether there are more attributes. -// The contents of the returned slices may change on the next call to Next. -func (z *Tokenizer) TagAttr() (key, val []byte, moreAttr bool) { - if z.nAttrReturned < len(z.attr) { - switch z.tt { - case StartTagToken, SelfClosingTagToken: - x := z.attr[z.nAttrReturned] - z.nAttrReturned++ - key = z.buf[x[0].start:x[0].end] - val = z.buf[x[1].start:x[1].end] - return lower(key), unescape(convertNewlines(val), true), z.nAttrReturned < len(z.attr) - } - } - return nil, nil, false -} - -// Token returns the current Token. The result's Data and Attr values remain -// valid after subsequent Next calls. -func (z *Tokenizer) Token() Token { - t := Token{Type: z.tt} - switch z.tt { - case TextToken, CommentToken, DoctypeToken: - t.Data = string(z.Text()) - case StartTagToken, SelfClosingTagToken, EndTagToken: - name, moreAttr := z.TagName() - for moreAttr { - var key, val []byte - key, val, moreAttr = z.TagAttr() - t.Attr = append(t.Attr, Attribute{"", atom.String(key), string(val)}) - } - if a := atom.Lookup(name); a != 0 { - t.DataAtom, t.Data = a, a.String() - } else { - t.DataAtom, t.Data = 0, string(name) - } - } - return t -} - -// SetMaxBuf sets a limit on the amount of data buffered during tokenization. -// A value of 0 means unlimited. -func (z *Tokenizer) SetMaxBuf(n int) { - z.maxBuf = n -} - -// NewTokenizer returns a new HTML Tokenizer for the given Reader. -// The input is assumed to be UTF-8 encoded. -func NewTokenizer(r io.Reader) *Tokenizer { - return NewTokenizerFragment(r, "") -} - -// NewTokenizerFragment returns a new HTML Tokenizer for the given Reader, for -// tokenizing an existing element's InnerHTML fragment. contextTag is that -// element's tag, such as "div" or "iframe". -// -// For example, how the InnerHTML "a<b" is tokenized depends on whether it is -// for a <p> tag or a <script> tag. -// -// The input is assumed to be UTF-8 encoded. -func NewTokenizerFragment(r io.Reader, contextTag string) *Tokenizer { - z := &Tokenizer{ - r: r, - buf: make([]byte, 0, 4096), - } - if contextTag != "" { - switch s := strings.ToLower(contextTag); s { - case "iframe", "noembed", "noframes", "noscript", "plaintext", "script", "style", "title", "textarea", "xmp": - z.rawTag = s - } - } - return z -} diff --git a/vendor/golang.org/x/net/html/token_test.go b/vendor/golang.org/x/net/html/token_test.go deleted file mode 100644 index 20221c3..0000000 --- a/vendor/golang.org/x/net/html/token_test.go +++ /dev/null @@ -1,748 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package html - -import ( - "bytes" - "io" - "io/ioutil" - "reflect" - "runtime" - "strings" - "testing" -) - -type tokenTest struct { - // A short description of the test case. - desc string - // The HTML to parse. - html string - // The string representations of the expected tokens, joined by '$'. - golden string -} - -var tokenTests = []tokenTest{ - { - "empty", - "", - "", - }, - // A single text node. The tokenizer should not break text nodes on whitespace, - // nor should it normalize whitespace within a text node. - { - "text", - "foo bar", - "foo bar", - }, - // An entity. - { - "entity", - "one < two", - "one < two", - }, - // A start, self-closing and end tag. The tokenizer does not care if the start - // and end tokens don't match; that is the job of the parser. - { - "tags", - "<a>b<c/>d</e>", - "<a>$b$<c/>$d$</e>", - }, - // Angle brackets that aren't a tag. - { - "not a tag #0", - "<", - "<", - }, - { - "not a tag #1", - "</", - "</", - }, - { - "not a tag #2", - "</>", - "<!---->", - }, - { - "not a tag #3", - "a</>b", - "a$<!---->$b", - }, - { - "not a tag #4", - "</ >", - "<!-- -->", - }, - { - "not a tag #5", - "</.", - "<!--.-->", - }, - { - "not a tag #6", - "</.>", - "<!--.-->", - }, - { - "not a tag #7", - "a < b", - "a < b", - }, - { - "not a tag #8", - "<.>", - "<.>", - }, - { - "not a tag #9", - "a<<<b>>>c", - "a<<$<b>$>>c", - }, - { - "not a tag #10", - "if x<0 and y < 0 then x*y>0", - "if x<0 and y < 0 then x*y>0", - }, - { - "not a tag #11", - "<<p>", - "<$<p>", - }, - // EOF in a tag name. - { - "tag name eof #0", - "<a", - "", - }, - { - "tag name eof #1", - "<a ", - "", - }, - { - "tag name eof #2", - "a<b", - "a", - }, - { - "tag name eof #3", - "<a><b", - "<a>", - }, - { - "tag name eof #4", - `<a x`, - ``, - }, - // Some malformed tags that are missing a '>'. - { - "malformed tag #0", - `<p</p>`, - `<p< p="">`, - }, - { - "malformed tag #1", - `<p </p>`, - `<p <="" p="">`, - }, - { - "malformed tag #2", - `<p id`, - ``, - }, - { - "malformed tag #3", - `<p id=`, - ``, - }, - { - "malformed tag #4", - `<p id=>`, - `<p id="">`, - }, - { - "malformed tag #5", - `<p id=0`, - ``, - }, - { - "malformed tag #6", - `<p id=0</p>`, - `<p id="0</p">`, - }, - { - "malformed tag #7", - `<p id="0</p>`, - ``, - }, - { - "malformed tag #8", - `<p id="0"</p>`, - `<p id="0" <="" p="">`, - }, - { - "malformed tag #9", - `<p></p id`, - `<p>`, - }, - // Raw text and RCDATA. - { - "basic raw text", - "<script><a></b></script>", - "<script>$<a></b>$</script>", - }, - { - "unfinished script end tag", - "<SCRIPT>a</SCR", - "<script>$a</SCR", - }, - { - "broken script end tag", - "<SCRIPT>a</SCR ipt>", - "<script>$a</SCR ipt>", - }, - { - "EOF in script end tag", - "<SCRIPT>a</SCRipt", - "<script>$a</SCRipt", - }, - { - "scriptx end tag", - "<SCRIPT>a</SCRiptx", - "<script>$a</SCRiptx", - }, - { - "' ' completes script end tag", - "<SCRIPT>a</SCRipt ", - "<script>$a", - }, - { - "'>' completes script end tag", - "<SCRIPT>a</SCRipt>", - "<script>$a$</script>", - }, - { - "self-closing script end tag", - "<SCRIPT>a</SCRipt/>", - "<script>$a$</script>", - }, - { - "nested script tag", - "<SCRIPT>a</SCRipt<script>", - "<script>$a</SCRipt<script>", - }, - { - "script end tag after unfinished", - "<SCRIPT>a</SCRipt</script>", - "<script>$a</SCRipt$</script>", - }, - { - "script/style mismatched tags", - "<script>a</style>", - "<script>$a</style>", - }, - { - "style element with entity", - "<style>'", - "<style>$&apos;", - }, - { - "textarea with tag", - "<textarea><div></textarea>", - "<textarea>$<div>$</textarea>", - }, - { - "title with tag and entity", - "<title><b>K&R C</b>", - "$<b>K&R C</b>$", - }, - // DOCTYPE tests. - { - "Proper DOCTYPE", - "", - "", - }, - { - "DOCTYPE with no space", - "", - "", - }, - { - "DOCTYPE with two spaces", - "", - "", - }, - { - "looks like DOCTYPE but isn't", - "", - "", - }, - { - "DOCTYPE at EOF", - "", - }, - // XML processing instructions. - { - "XML processing instruction", - "", - "", - }, - // Comments. - { - "comment0", - "abcdef", - "abc$$$$def", - }, - { - "comment1", - "az", - "a$$z", - }, - { - "comment2", - "az", - "a$$z", - }, - { - "comment3", - "az", - "a$$z", - }, - { - "comment4", - "az", - "a$$z", - }, - { - "comment5", - "az", - "a$$z", - }, - { - "comment6", - "az", - "a$$z", - }, - { - "comment7", - "a", - }, - { - "comment8", - "a", - }, - { - "comment9", - "a", - }, - { - "comment10", - "a", - }, - { - "comment11", - "a", - }, - { - "comment12", - "a", - }, - { - "comment13", - "az", - "a$$z", - }, - // An attribute with a backslash. - { - "backslash", - `

`, - `

`, - }, - // Entities, tag name and attribute key lower-casing, and whitespace - // normalization within a tag. - { - "tricky", - "

te<&;xt

", - `

$$te<&;xt$$

`, - }, - // A nonexistent entity. Tokenizing and converting back to a string should - // escape the "&" to become "&". - { - "noSuchEntity", - `<&alsoDoesntExist;&`, - `$<&alsoDoesntExist;&`, - }, - { - "entity without semicolon", - `¬it;∉`, - `¬it;∉$`, - }, - { - "entity with digits", - "½", - "½", - }, - // Attribute tests: - // http://dev.w3.org/html5/pf-summary/Overview.html#attributes - { - "Empty attribute", - ``, - ``, - }, - { - "Empty attribute, whitespace", - ``, - ``, - }, - { - "Unquoted attribute value", - ``, - ``, - }, - { - "Unquoted attribute value, spaces", - ``, - ``, - }, - { - "Unquoted attribute value, trailing space", - ``, - ``, - }, - { - "Single-quoted attribute value", - ``, - ``, - }, - { - "Single-quoted attribute value, trailing space", - ``, - ``, - }, - { - "Double-quoted attribute value", - ``, - ``, - }, - { - "Attribute name characters", - ``, - ``, - }, - { - "Mixed attributes", - `a

z`, - `a$

$z`, - }, - { - "Attributes with a solitary single quote", - `

`, - `

$

`, - }, -} - -func TestTokenizer(t *testing.T) { -loop: - for _, tt := range tokenTests { - z := NewTokenizer(strings.NewReader(tt.html)) - if tt.golden != "" { - for i, s := range strings.Split(tt.golden, "$") { - if z.Next() == ErrorToken { - t.Errorf("%s token %d: want %q got error %v", tt.desc, i, s, z.Err()) - continue loop - } - actual := z.Token().String() - if s != actual { - t.Errorf("%s token %d: want %q got %q", tt.desc, i, s, actual) - continue loop - } - } - } - z.Next() - if z.Err() != io.EOF { - t.Errorf("%s: want EOF got %q", tt.desc, z.Err()) - } - } -} - -func TestMaxBuffer(t *testing.T) { - // Exceeding the maximum buffer size generates ErrBufferExceeded. - z := NewTokenizer(strings.NewReader("<" + strings.Repeat("t", 10))) - z.SetMaxBuf(5) - tt := z.Next() - if got, want := tt, ErrorToken; got != want { - t.Fatalf("token type: got: %v want: %v", got, want) - } - if got, want := z.Err(), ErrBufferExceeded; got != want { - t.Errorf("error type: got: %v want: %v", got, want) - } - if got, want := string(z.Raw()), " 0 { - result.Write(z.Text()) - } - case StartTagToken, EndTagToken: - tn, _ := z.TagName() - if len(tn) == 1 && tn[0] == 'a' { - if tt == StartTagToken { - depth++ - } else { - depth-- - } - } - } - } - u := "14567" - v := string(result.Bytes()) - if u != v { - t.Errorf("TestBufAPI: want %q got %q", u, v) - } -} - -func TestConvertNewlines(t *testing.T) { - testCases := map[string]string{ - "Mac\rDOS\r\nUnix\n": "Mac\nDOS\nUnix\n", - "Unix\nMac\rDOS\r\n": "Unix\nMac\nDOS\n", - "DOS\r\nDOS\r\nDOS\r\n": "DOS\nDOS\nDOS\n", - "": "", - "\n": "\n", - "\n\r": "\n\n", - "\r": "\n", - "\r\n": "\n", - "\r\n\n": "\n\n", - "\r\n\r": "\n\n", - "\r\n\r\n": "\n\n", - "\r\r": "\n\n", - "\r\r\n": "\n\n", - "\r\r\n\n": "\n\n\n", - "\r\r\r\n": "\n\n\n", - "\r \n": "\n \n", - "xyz": "xyz", - } - for in, want := range testCases { - if got := string(convertNewlines([]byte(in))); got != want { - t.Errorf("input %q: got %q, want %q", in, got, want) - } - } -} - -func TestReaderEdgeCases(t *testing.T) { - const s = "

An io.Reader can return (0, nil) or (n, io.EOF).

" - testCases := []io.Reader{ - &zeroOneByteReader{s: s}, - &eofStringsReader{s: s}, - &stuckReader{}, - } - for i, tc := range testCases { - got := []TokenType{} - z := NewTokenizer(tc) - for { - tt := z.Next() - if tt == ErrorToken { - break - } - got = append(got, tt) - } - if err := z.Err(); err != nil && err != io.EOF { - if err != io.ErrNoProgress { - t.Errorf("i=%d: %v", i, err) - } - continue - } - want := []TokenType{ - StartTagToken, - TextToken, - EndTagToken, - } - if !reflect.DeepEqual(got, want) { - t.Errorf("i=%d: got %v, want %v", i, got, want) - continue - } - } -} - -// zeroOneByteReader is like a strings.Reader that alternates between -// returning 0 bytes and 1 byte at a time. -type zeroOneByteReader struct { - s string - n int -} - -func (r *zeroOneByteReader) Read(p []byte) (int, error) { - if len(p) == 0 { - return 0, nil - } - if len(r.s) == 0 { - return 0, io.EOF - } - r.n++ - if r.n%2 != 0 { - return 0, nil - } - p[0], r.s = r.s[0], r.s[1:] - return 1, nil -} - -// eofStringsReader is like a strings.Reader but can return an (n, err) where -// n > 0 && err != nil. -type eofStringsReader struct { - s string -} - -func (r *eofStringsReader) Read(p []byte) (int, error) { - n := copy(p, r.s) - r.s = r.s[n:] - if r.s != "" { - return n, nil - } - return n, io.EOF -} - -// stuckReader is an io.Reader that always returns no data and no error. -type stuckReader struct{} - -func (*stuckReader) Read(p []byte) (int, error) { - return 0, nil -} - -const ( - rawLevel = iota - lowLevel - highLevel -) - -func benchmarkTokenizer(b *testing.B, level int) { - buf, err := ioutil.ReadFile("testdata/go1.html") - if err != nil { - b.Fatalf("could not read testdata/go1.html: %v", err) - } - b.SetBytes(int64(len(buf))) - runtime.GC() - b.ReportAllocs() - b.ResetTimer() - for i := 0; i < b.N; i++ { - z := NewTokenizer(bytes.NewBuffer(buf)) - for { - tt := z.Next() - if tt == ErrorToken { - if err := z.Err(); err != nil && err != io.EOF { - b.Fatalf("tokenizer error: %v", err) - } - break - } - switch level { - case rawLevel: - // Calling z.Raw just returns the raw bytes of the token. It does - // not unescape < to <, or lower-case tag names and attribute keys. - z.Raw() - case lowLevel: - // Caling z.Text, z.TagName and z.TagAttr returns []byte values - // whose contents may change on the next call to z.Next. - switch tt { - case TextToken, CommentToken, DoctypeToken: - z.Text() - case StartTagToken, SelfClosingTagToken: - _, more := z.TagName() - for more { - _, _, more = z.TagAttr() - } - case EndTagToken: - z.TagName() - } - case highLevel: - // Calling z.Token converts []byte values to strings whose validity - // extend beyond the next call to z.Next. - z.Token() - } - } - } -} - -func BenchmarkRawLevelTokenizer(b *testing.B) { benchmarkTokenizer(b, rawLevel) } -func BenchmarkLowLevelTokenizer(b *testing.B) { benchmarkTokenizer(b, lowLevel) } -func BenchmarkHighLevelTokenizer(b *testing.B) { benchmarkTokenizer(b, highLevel) } diff --git a/vendor/golang.org/x/sys/windows/asm_windows_386.s b/vendor/golang.org/x/sys/windows/asm_windows_386.s deleted file mode 100644 index 1c20dd2..0000000 --- a/vendor/golang.org/x/sys/windows/asm_windows_386.s +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// -// System calls for 386, Windows are implemented in runtime/syscall_windows.goc -// - -TEXT ·getprocaddress(SB), 7, $0-8 - JMP syscall·getprocaddress(SB) - -TEXT ·loadlibrary(SB), 7, $0-4 - JMP syscall·loadlibrary(SB) diff --git a/vendor/golang.org/x/sys/windows/asm_windows_amd64.s b/vendor/golang.org/x/sys/windows/asm_windows_amd64.s deleted file mode 100644 index 4d025ab..0000000 --- a/vendor/golang.org/x/sys/windows/asm_windows_amd64.s +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// -// System calls for amd64, Windows are implemented in runtime/syscall_windows.goc -// - -TEXT ·getprocaddress(SB), 7, $0-32 - JMP syscall·getprocaddress(SB) - -TEXT ·loadlibrary(SB), 7, $0-8 - JMP syscall·loadlibrary(SB) diff --git a/vendor/golang.org/x/sys/windows/dll_windows.go b/vendor/golang.org/x/sys/windows/dll_windows.go deleted file mode 100644 index e92c05b..0000000 --- a/vendor/golang.org/x/sys/windows/dll_windows.go +++ /dev/null @@ -1,378 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -import ( - "sync" - "sync/atomic" - "syscall" - "unsafe" -) - -// DLLError describes reasons for DLL load failures. -type DLLError struct { - Err error - ObjName string - Msg string -} - -func (e *DLLError) Error() string { return e.Msg } - -// Implemented in runtime/syscall_windows.goc; we provide jumps to them in our assembly file. -func loadlibrary(filename *uint16) (handle uintptr, err syscall.Errno) -func getprocaddress(handle uintptr, procname *uint8) (proc uintptr, err syscall.Errno) - -// A DLL implements access to a single DLL. -type DLL struct { - Name string - Handle Handle -} - -// LoadDLL loads DLL file into memory. -// -// Warning: using LoadDLL without an absolute path name is subject to -// DLL preloading attacks. To safely load a system DLL, use LazyDLL -// with System set to true, or use LoadLibraryEx directly. -func LoadDLL(name string) (dll *DLL, err error) { - namep, err := UTF16PtrFromString(name) - if err != nil { - return nil, err - } - h, e := loadlibrary(namep) - if e != 0 { - return nil, &DLLError{ - Err: e, - ObjName: name, - Msg: "Failed to load " + name + ": " + e.Error(), - } - } - d := &DLL{ - Name: name, - Handle: Handle(h), - } - return d, nil -} - -// MustLoadDLL is like LoadDLL but panics if load operation failes. -func MustLoadDLL(name string) *DLL { - d, e := LoadDLL(name) - if e != nil { - panic(e) - } - return d -} - -// FindProc searches DLL d for procedure named name and returns *Proc -// if found. It returns an error if search fails. -func (d *DLL) FindProc(name string) (proc *Proc, err error) { - namep, err := BytePtrFromString(name) - if err != nil { - return nil, err - } - a, e := getprocaddress(uintptr(d.Handle), namep) - if e != 0 { - return nil, &DLLError{ - Err: e, - ObjName: name, - Msg: "Failed to find " + name + " procedure in " + d.Name + ": " + e.Error(), - } - } - p := &Proc{ - Dll: d, - Name: name, - addr: a, - } - return p, nil -} - -// MustFindProc is like FindProc but panics if search fails. -func (d *DLL) MustFindProc(name string) *Proc { - p, e := d.FindProc(name) - if e != nil { - panic(e) - } - return p -} - -// Release unloads DLL d from memory. -func (d *DLL) Release() (err error) { - return FreeLibrary(d.Handle) -} - -// A Proc implements access to a procedure inside a DLL. -type Proc struct { - Dll *DLL - Name string - addr uintptr -} - -// Addr returns the address of the procedure represented by p. -// The return value can be passed to Syscall to run the procedure. -func (p *Proc) Addr() uintptr { - return p.addr -} - -//go:uintptrescapes - -// Call executes procedure p with arguments a. It will panic, if more than 15 arguments -// are supplied. -// -// The returned error is always non-nil, constructed from the result of GetLastError. -// Callers must inspect the primary return value to decide whether an error occurred -// (according to the semantics of the specific function being called) before consulting -// the error. The error will be guaranteed to contain windows.Errno. -func (p *Proc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { - switch len(a) { - case 0: - return syscall.Syscall(p.Addr(), uintptr(len(a)), 0, 0, 0) - case 1: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], 0, 0) - case 2: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], 0) - case 3: - return syscall.Syscall(p.Addr(), uintptr(len(a)), a[0], a[1], a[2]) - case 4: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], 0, 0) - case 5: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], 0) - case 6: - return syscall.Syscall6(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5]) - case 7: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], 0, 0) - case 8: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], 0) - case 9: - return syscall.Syscall9(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8]) - case 10: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], 0, 0) - case 11: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], 0) - case 12: - return syscall.Syscall12(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11]) - case 13: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], 0, 0) - case 14: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], 0) - case 15: - return syscall.Syscall15(p.Addr(), uintptr(len(a)), a[0], a[1], a[2], a[3], a[4], a[5], a[6], a[7], a[8], a[9], a[10], a[11], a[12], a[13], a[14]) - default: - panic("Call " + p.Name + " with too many arguments " + itoa(len(a)) + ".") - } -} - -// A LazyDLL implements access to a single DLL. -// It will delay the load of the DLL until the first -// call to its Handle method or to one of its -// LazyProc's Addr method. -type LazyDLL struct { - Name string - - // System determines whether the DLL must be loaded from the - // Windows System directory, bypassing the normal DLL search - // path. - System bool - - mu sync.Mutex - dll *DLL // non nil once DLL is loaded -} - -// Load loads DLL file d.Name into memory. It returns an error if fails. -// Load will not try to load DLL, if it is already loaded into memory. -func (d *LazyDLL) Load() error { - // Non-racy version of: - // if d.dll != nil { - if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll))) != nil { - return nil - } - d.mu.Lock() - defer d.mu.Unlock() - if d.dll != nil { - return nil - } - - // kernel32.dll is special, since it's where LoadLibraryEx comes from. - // The kernel already special-cases its name, so it's always - // loaded from system32. - var dll *DLL - var err error - if d.Name == "kernel32.dll" { - dll, err = LoadDLL(d.Name) - } else { - dll, err = loadLibraryEx(d.Name, d.System) - } - if err != nil { - return err - } - - // Non-racy version of: - // d.dll = dll - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&d.dll)), unsafe.Pointer(dll)) - return nil -} - -// mustLoad is like Load but panics if search fails. -func (d *LazyDLL) mustLoad() { - e := d.Load() - if e != nil { - panic(e) - } -} - -// Handle returns d's module handle. -func (d *LazyDLL) Handle() uintptr { - d.mustLoad() - return uintptr(d.dll.Handle) -} - -// NewProc returns a LazyProc for accessing the named procedure in the DLL d. -func (d *LazyDLL) NewProc(name string) *LazyProc { - return &LazyProc{l: d, Name: name} -} - -// NewLazyDLL creates new LazyDLL associated with DLL file. -func NewLazyDLL(name string) *LazyDLL { - return &LazyDLL{Name: name} -} - -// NewLazySystemDLL is like NewLazyDLL, but will only -// search Windows System directory for the DLL if name is -// a base name (like "advapi32.dll"). -func NewLazySystemDLL(name string) *LazyDLL { - return &LazyDLL{Name: name, System: true} -} - -// A LazyProc implements access to a procedure inside a LazyDLL. -// It delays the lookup until the Addr method is called. -type LazyProc struct { - Name string - - mu sync.Mutex - l *LazyDLL - proc *Proc -} - -// Find searches DLL for procedure named p.Name. It returns -// an error if search fails. Find will not search procedure, -// if it is already found and loaded into memory. -func (p *LazyProc) Find() error { - // Non-racy version of: - // if p.proc == nil { - if atomic.LoadPointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc))) == nil { - p.mu.Lock() - defer p.mu.Unlock() - if p.proc == nil { - e := p.l.Load() - if e != nil { - return e - } - proc, e := p.l.dll.FindProc(p.Name) - if e != nil { - return e - } - // Non-racy version of: - // p.proc = proc - atomic.StorePointer((*unsafe.Pointer)(unsafe.Pointer(&p.proc)), unsafe.Pointer(proc)) - } - } - return nil -} - -// mustFind is like Find but panics if search fails. -func (p *LazyProc) mustFind() { - e := p.Find() - if e != nil { - panic(e) - } -} - -// Addr returns the address of the procedure represented by p. -// The return value can be passed to Syscall to run the procedure. -// It will panic if the procedure cannot be found. -func (p *LazyProc) Addr() uintptr { - p.mustFind() - return p.proc.Addr() -} - -//go:uintptrescapes - -// Call executes procedure p with arguments a. It will panic, if more than 15 arguments -// are supplied. It will also panic if the procedure cannot be found. -// -// The returned error is always non-nil, constructed from the result of GetLastError. -// Callers must inspect the primary return value to decide whether an error occurred -// (according to the semantics of the specific function being called) before consulting -// the error. The error will be guaranteed to contain windows.Errno. -func (p *LazyProc) Call(a ...uintptr) (r1, r2 uintptr, lastErr error) { - p.mustFind() - return p.proc.Call(a...) -} - -var canDoSearchSystem32Once struct { - sync.Once - v bool -} - -func initCanDoSearchSystem32() { - // https://msdn.microsoft.com/en-us/library/ms684179(v=vs.85).aspx says: - // "Windows 7, Windows Server 2008 R2, Windows Vista, and Windows - // Server 2008: The LOAD_LIBRARY_SEARCH_* flags are available on - // systems that have KB2533623 installed. To determine whether the - // flags are available, use GetProcAddress to get the address of the - // AddDllDirectory, RemoveDllDirectory, or SetDefaultDllDirectories - // function. If GetProcAddress succeeds, the LOAD_LIBRARY_SEARCH_* - // flags can be used with LoadLibraryEx." - canDoSearchSystem32Once.v = (modkernel32.NewProc("AddDllDirectory").Find() == nil) -} - -func canDoSearchSystem32() bool { - canDoSearchSystem32Once.Do(initCanDoSearchSystem32) - return canDoSearchSystem32Once.v -} - -func isBaseName(name string) bool { - for _, c := range name { - if c == ':' || c == '/' || c == '\\' { - return false - } - } - return true -} - -// loadLibraryEx wraps the Windows LoadLibraryEx function. -// -// See https://msdn.microsoft.com/en-us/library/windows/desktop/ms684179(v=vs.85).aspx -// -// If name is not an absolute path, LoadLibraryEx searches for the DLL -// in a variety of automatic locations unless constrained by flags. -// See: https://msdn.microsoft.com/en-us/library/ff919712%28VS.85%29.aspx -func loadLibraryEx(name string, system bool) (*DLL, error) { - loadDLL := name - var flags uintptr - if system { - if canDoSearchSystem32() { - const LOAD_LIBRARY_SEARCH_SYSTEM32 = 0x00000800 - flags = LOAD_LIBRARY_SEARCH_SYSTEM32 - } else if isBaseName(name) { - // WindowsXP or unpatched Windows machine - // trying to load "foo.dll" out of the system - // folder, but LoadLibraryEx doesn't support - // that yet on their system, so emulate it. - windir, _ := Getenv("WINDIR") // old var; apparently works on XP - if windir == "" { - return nil, errString("%WINDIR% not defined") - } - loadDLL = windir + "\\System32\\" + name - } - } - h, err := LoadLibraryEx(loadDLL, 0, flags) - if err != nil { - return nil, err - } - return &DLL{Name: name, Handle: h}, nil -} - -type errString string - -func (s errString) Error() string { return string(s) } diff --git a/vendor/golang.org/x/sys/windows/env_windows.go b/vendor/golang.org/x/sys/windows/env_windows.go deleted file mode 100644 index bdc71e2..0000000 --- a/vendor/golang.org/x/sys/windows/env_windows.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Windows environment variables. - -package windows - -import "syscall" - -func Getenv(key string) (value string, found bool) { - return syscall.Getenv(key) -} - -func Setenv(key, value string) error { - return syscall.Setenv(key, value) -} - -func Clearenv() { - syscall.Clearenv() -} - -func Environ() []string { - return syscall.Environ() -} - -func Unsetenv(key string) error { - return syscall.Unsetenv(key) -} diff --git a/vendor/golang.org/x/sys/windows/eventlog.go b/vendor/golang.org/x/sys/windows/eventlog.go deleted file mode 100644 index 40af946..0000000 --- a/vendor/golang.org/x/sys/windows/eventlog.go +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -package windows - -const ( - EVENTLOG_SUCCESS = 0 - EVENTLOG_ERROR_TYPE = 1 - EVENTLOG_WARNING_TYPE = 2 - EVENTLOG_INFORMATION_TYPE = 4 - EVENTLOG_AUDIT_SUCCESS = 8 - EVENTLOG_AUDIT_FAILURE = 16 -) - -//sys RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) [failretval==0] = advapi32.RegisterEventSourceW -//sys DeregisterEventSource(handle Handle) (err error) = advapi32.DeregisterEventSource -//sys ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) = advapi32.ReportEventW diff --git a/vendor/golang.org/x/sys/windows/exec_windows.go b/vendor/golang.org/x/sys/windows/exec_windows.go deleted file mode 100644 index 3606c3a..0000000 --- a/vendor/golang.org/x/sys/windows/exec_windows.go +++ /dev/null @@ -1,97 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Fork, exec, wait, etc. - -package windows - -// EscapeArg rewrites command line argument s as prescribed -// in http://msdn.microsoft.com/en-us/library/ms880421. -// This function returns "" (2 double quotes) if s is empty. -// Alternatively, these transformations are done: -// - every back slash (\) is doubled, but only if immediately -// followed by double quote ("); -// - every double quote (") is escaped by back slash (\); -// - finally, s is wrapped with double quotes (arg -> "arg"), -// but only if there is space or tab inside s. -func EscapeArg(s string) string { - if len(s) == 0 { - return "\"\"" - } - n := len(s) - hasSpace := false - for i := 0; i < len(s); i++ { - switch s[i] { - case '"', '\\': - n++ - case ' ', '\t': - hasSpace = true - } - } - if hasSpace { - n += 2 - } - if n == len(s) { - return s - } - - qs := make([]byte, n) - j := 0 - if hasSpace { - qs[j] = '"' - j++ - } - slashes := 0 - for i := 0; i < len(s); i++ { - switch s[i] { - default: - slashes = 0 - qs[j] = s[i] - case '\\': - slashes++ - qs[j] = s[i] - case '"': - for ; slashes > 0; slashes-- { - qs[j] = '\\' - j++ - } - qs[j] = '\\' - j++ - qs[j] = s[i] - } - j++ - } - if hasSpace { - for ; slashes > 0; slashes-- { - qs[j] = '\\' - j++ - } - qs[j] = '"' - j++ - } - return string(qs[:j]) -} - -func CloseOnExec(fd Handle) { - SetHandleInformation(Handle(fd), HANDLE_FLAG_INHERIT, 0) -} - -// FullPath retrieves the full path of the specified file. -func FullPath(name string) (path string, err error) { - p, err := UTF16PtrFromString(name) - if err != nil { - return "", err - } - n := uint32(100) - for { - buf := make([]uint16, n) - n, err = GetFullPathName(p, uint32(len(buf)), &buf[0], nil) - if err != nil { - return "", err - } - if n <= uint32(len(buf)) { - return UTF16ToString(buf[:n]), nil - } - } -} diff --git a/vendor/golang.org/x/sys/windows/memory_windows.go b/vendor/golang.org/x/sys/windows/memory_windows.go deleted file mode 100644 index f80a420..0000000 --- a/vendor/golang.org/x/sys/windows/memory_windows.go +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -const ( - MEM_COMMIT = 0x00001000 - MEM_RESERVE = 0x00002000 - MEM_DECOMMIT = 0x00004000 - MEM_RELEASE = 0x00008000 - MEM_RESET = 0x00080000 - MEM_TOP_DOWN = 0x00100000 - MEM_WRITE_WATCH = 0x00200000 - MEM_PHYSICAL = 0x00400000 - MEM_RESET_UNDO = 0x01000000 - MEM_LARGE_PAGES = 0x20000000 - - PAGE_NOACCESS = 0x01 - PAGE_READONLY = 0x02 - PAGE_READWRITE = 0x04 - PAGE_WRITECOPY = 0x08 - PAGE_EXECUTE_READ = 0x20 - PAGE_EXECUTE_READWRITE = 0x40 - PAGE_EXECUTE_WRITECOPY = 0x80 -) diff --git a/vendor/golang.org/x/sys/windows/mksyscall.go b/vendor/golang.org/x/sys/windows/mksyscall.go deleted file mode 100644 index fb7db0e..0000000 --- a/vendor/golang.org/x/sys/windows/mksyscall.go +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -//go:generate go run $GOROOT/src/syscall/mksyscall_windows.go -output zsyscall_windows.go eventlog.go service.go syscall_windows.go security_windows.go diff --git a/vendor/golang.org/x/sys/windows/race.go b/vendor/golang.org/x/sys/windows/race.go deleted file mode 100644 index a74e3e2..0000000 --- a/vendor/golang.org/x/sys/windows/race.go +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows,race - -package windows - -import ( - "runtime" - "unsafe" -) - -const raceenabled = true - -func raceAcquire(addr unsafe.Pointer) { - runtime.RaceAcquire(addr) -} - -func raceReleaseMerge(addr unsafe.Pointer) { - runtime.RaceReleaseMerge(addr) -} - -func raceReadRange(addr unsafe.Pointer, len int) { - runtime.RaceReadRange(addr, len) -} - -func raceWriteRange(addr unsafe.Pointer, len int) { - runtime.RaceWriteRange(addr, len) -} diff --git a/vendor/golang.org/x/sys/windows/race0.go b/vendor/golang.org/x/sys/windows/race0.go deleted file mode 100644 index e44a3cb..0000000 --- a/vendor/golang.org/x/sys/windows/race0.go +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows,!race - -package windows - -import ( - "unsafe" -) - -const raceenabled = false - -func raceAcquire(addr unsafe.Pointer) { -} - -func raceReleaseMerge(addr unsafe.Pointer) { -} - -func raceReadRange(addr unsafe.Pointer, len int) { -} - -func raceWriteRange(addr unsafe.Pointer, len int) { -} diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go deleted file mode 100644 index f1ec5dc..0000000 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ /dev/null @@ -1,476 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -import ( - "syscall" - "unsafe" -) - -const ( - STANDARD_RIGHTS_REQUIRED = 0xf0000 - STANDARD_RIGHTS_READ = 0x20000 - STANDARD_RIGHTS_WRITE = 0x20000 - STANDARD_RIGHTS_EXECUTE = 0x20000 - STANDARD_RIGHTS_ALL = 0x1F0000 -) - -const ( - NameUnknown = 0 - NameFullyQualifiedDN = 1 - NameSamCompatible = 2 - NameDisplay = 3 - NameUniqueId = 6 - NameCanonical = 7 - NameUserPrincipal = 8 - NameCanonicalEx = 9 - NameServicePrincipal = 10 - NameDnsDomain = 12 -) - -// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. -// http://blogs.msdn.com/b/drnick/archive/2007/12/19/windows-and-upn-format-credentials.aspx -//sys TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) [failretval&0xff==0] = secur32.TranslateNameW -//sys GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) [failretval&0xff==0] = secur32.GetUserNameExW - -// TranslateAccountName converts a directory service -// object name from one format to another. -func TranslateAccountName(username string, from, to uint32, initSize int) (string, error) { - u, e := UTF16PtrFromString(username) - if e != nil { - return "", e - } - n := uint32(50) - for { - b := make([]uint16, n) - e = TranslateName(u, from, to, &b[0], &n) - if e == nil { - return UTF16ToString(b[:n]), nil - } - if e != ERROR_INSUFFICIENT_BUFFER { - return "", e - } - if n <= uint32(len(b)) { - return "", e - } - } -} - -const ( - // do not reorder - NetSetupUnknownStatus = iota - NetSetupUnjoined - NetSetupWorkgroupName - NetSetupDomainName -) - -type UserInfo10 struct { - Name *uint16 - Comment *uint16 - UsrComment *uint16 - FullName *uint16 -} - -//sys NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) = netapi32.NetUserGetInfo -//sys NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) = netapi32.NetGetJoinInformation -//sys NetApiBufferFree(buf *byte) (neterr error) = netapi32.NetApiBufferFree - -const ( - // do not reorder - SidTypeUser = 1 + iota - SidTypeGroup - SidTypeDomain - SidTypeAlias - SidTypeWellKnownGroup - SidTypeDeletedAccount - SidTypeInvalid - SidTypeUnknown - SidTypeComputer - SidTypeLabel -) - -type SidIdentifierAuthority struct { - Value [6]byte -} - -var ( - SECURITY_NULL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 0}} - SECURITY_WORLD_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 1}} - SECURITY_LOCAL_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 2}} - SECURITY_CREATOR_SID_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 3}} - SECURITY_NON_UNIQUE_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 4}} - SECURITY_NT_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 5}} - SECURITY_MANDATORY_LABEL_AUTHORITY = SidIdentifierAuthority{[6]byte{0, 0, 0, 0, 0, 16}} -) - -const ( - SECURITY_NULL_RID = 0 - SECURITY_WORLD_RID = 0 - SECURITY_LOCAL_RID = 0 - SECURITY_CREATOR_OWNER_RID = 0 - SECURITY_CREATOR_GROUP_RID = 1 - SECURITY_DIALUP_RID = 1 - SECURITY_NETWORK_RID = 2 - SECURITY_BATCH_RID = 3 - SECURITY_INTERACTIVE_RID = 4 - SECURITY_LOGON_IDS_RID = 5 - SECURITY_SERVICE_RID = 6 - SECURITY_LOCAL_SYSTEM_RID = 18 - SECURITY_BUILTIN_DOMAIN_RID = 32 - SECURITY_PRINCIPAL_SELF_RID = 10 - SECURITY_CREATOR_OWNER_SERVER_RID = 0x2 - SECURITY_CREATOR_GROUP_SERVER_RID = 0x3 - SECURITY_LOGON_IDS_RID_COUNT = 0x3 - SECURITY_ANONYMOUS_LOGON_RID = 0x7 - SECURITY_PROXY_RID = 0x8 - SECURITY_ENTERPRISE_CONTROLLERS_RID = 0x9 - SECURITY_SERVER_LOGON_RID = SECURITY_ENTERPRISE_CONTROLLERS_RID - SECURITY_AUTHENTICATED_USER_RID = 0xb - SECURITY_RESTRICTED_CODE_RID = 0xc - SECURITY_NT_NON_UNIQUE_RID = 0x15 -) - -// Predefined domain-relative RIDs for local groups. -// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa379649(v=vs.85).aspx -const ( - DOMAIN_ALIAS_RID_ADMINS = 0x220 - DOMAIN_ALIAS_RID_USERS = 0x221 - DOMAIN_ALIAS_RID_GUESTS = 0x222 - DOMAIN_ALIAS_RID_POWER_USERS = 0x223 - DOMAIN_ALIAS_RID_ACCOUNT_OPS = 0x224 - DOMAIN_ALIAS_RID_SYSTEM_OPS = 0x225 - DOMAIN_ALIAS_RID_PRINT_OPS = 0x226 - DOMAIN_ALIAS_RID_BACKUP_OPS = 0x227 - DOMAIN_ALIAS_RID_REPLICATOR = 0x228 - DOMAIN_ALIAS_RID_RAS_SERVERS = 0x229 - DOMAIN_ALIAS_RID_PREW2KCOMPACCESS = 0x22a - DOMAIN_ALIAS_RID_REMOTE_DESKTOP_USERS = 0x22b - DOMAIN_ALIAS_RID_NETWORK_CONFIGURATION_OPS = 0x22c - DOMAIN_ALIAS_RID_INCOMING_FOREST_TRUST_BUILDERS = 0x22d - DOMAIN_ALIAS_RID_MONITORING_USERS = 0X22e - DOMAIN_ALIAS_RID_LOGGING_USERS = 0x22f - DOMAIN_ALIAS_RID_AUTHORIZATIONACCESS = 0x230 - DOMAIN_ALIAS_RID_TS_LICENSE_SERVERS = 0x231 - DOMAIN_ALIAS_RID_DCOM_USERS = 0x232 - DOMAIN_ALIAS_RID_IUSERS = 0x238 - DOMAIN_ALIAS_RID_CRYPTO_OPERATORS = 0x239 - DOMAIN_ALIAS_RID_CACHEABLE_PRINCIPALS_GROUP = 0x23b - DOMAIN_ALIAS_RID_NON_CACHEABLE_PRINCIPALS_GROUP = 0x23c - DOMAIN_ALIAS_RID_EVENT_LOG_READERS_GROUP = 0x23d - DOMAIN_ALIAS_RID_CERTSVC_DCOM_ACCESS_GROUP = 0x23e -) - -//sys LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountSidW -//sys LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) = advapi32.LookupAccountNameW -//sys ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) = advapi32.ConvertSidToStringSidW -//sys ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) = advapi32.ConvertStringSidToSidW -//sys GetLengthSid(sid *SID) (len uint32) = advapi32.GetLengthSid -//sys CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) = advapi32.CopySid -//sys AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) = advapi32.AllocateAndInitializeSid -//sys FreeSid(sid *SID) (err error) [failretval!=0] = advapi32.FreeSid -//sys EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) = advapi32.EqualSid - -// The security identifier (SID) structure is a variable-length -// structure used to uniquely identify users or groups. -type SID struct{} - -// StringToSid converts a string-format security identifier -// sid into a valid, functional sid. -func StringToSid(s string) (*SID, error) { - var sid *SID - p, e := UTF16PtrFromString(s) - if e != nil { - return nil, e - } - e = ConvertStringSidToSid(p, &sid) - if e != nil { - return nil, e - } - defer LocalFree((Handle)(unsafe.Pointer(sid))) - return sid.Copy() -} - -// LookupSID retrieves a security identifier sid for the account -// and the name of the domain on which the account was found. -// System specify target computer to search. -func LookupSID(system, account string) (sid *SID, domain string, accType uint32, err error) { - if len(account) == 0 { - return nil, "", 0, syscall.EINVAL - } - acc, e := UTF16PtrFromString(account) - if e != nil { - return nil, "", 0, e - } - var sys *uint16 - if len(system) > 0 { - sys, e = UTF16PtrFromString(system) - if e != nil { - return nil, "", 0, e - } - } - n := uint32(50) - dn := uint32(50) - for { - b := make([]byte, n) - db := make([]uint16, dn) - sid = (*SID)(unsafe.Pointer(&b[0])) - e = LookupAccountName(sys, acc, sid, &n, &db[0], &dn, &accType) - if e == nil { - return sid, UTF16ToString(db), accType, nil - } - if e != ERROR_INSUFFICIENT_BUFFER { - return nil, "", 0, e - } - if n <= uint32(len(b)) { - return nil, "", 0, e - } - } -} - -// String converts sid to a string format -// suitable for display, storage, or transmission. -func (sid *SID) String() (string, error) { - var s *uint16 - e := ConvertSidToStringSid(sid, &s) - if e != nil { - return "", e - } - defer LocalFree((Handle)(unsafe.Pointer(s))) - return UTF16ToString((*[256]uint16)(unsafe.Pointer(s))[:]), nil -} - -// Len returns the length, in bytes, of a valid security identifier sid. -func (sid *SID) Len() int { - return int(GetLengthSid(sid)) -} - -// Copy creates a duplicate of security identifier sid. -func (sid *SID) Copy() (*SID, error) { - b := make([]byte, sid.Len()) - sid2 := (*SID)(unsafe.Pointer(&b[0])) - e := CopySid(uint32(len(b)), sid2, sid) - if e != nil { - return nil, e - } - return sid2, nil -} - -// LookupAccount retrieves the name of the account for this sid -// and the name of the first domain on which this sid is found. -// System specify target computer to search for. -func (sid *SID) LookupAccount(system string) (account, domain string, accType uint32, err error) { - var sys *uint16 - if len(system) > 0 { - sys, err = UTF16PtrFromString(system) - if err != nil { - return "", "", 0, err - } - } - n := uint32(50) - dn := uint32(50) - for { - b := make([]uint16, n) - db := make([]uint16, dn) - e := LookupAccountSid(sys, sid, &b[0], &n, &db[0], &dn, &accType) - if e == nil { - return UTF16ToString(b), UTF16ToString(db), accType, nil - } - if e != ERROR_INSUFFICIENT_BUFFER { - return "", "", 0, e - } - if n <= uint32(len(b)) { - return "", "", 0, e - } - } -} - -const ( - // do not reorder - TOKEN_ASSIGN_PRIMARY = 1 << iota - TOKEN_DUPLICATE - TOKEN_IMPERSONATE - TOKEN_QUERY - TOKEN_QUERY_SOURCE - TOKEN_ADJUST_PRIVILEGES - TOKEN_ADJUST_GROUPS - TOKEN_ADJUST_DEFAULT - - TOKEN_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | - TOKEN_ASSIGN_PRIMARY | - TOKEN_DUPLICATE | - TOKEN_IMPERSONATE | - TOKEN_QUERY | - TOKEN_QUERY_SOURCE | - TOKEN_ADJUST_PRIVILEGES | - TOKEN_ADJUST_GROUPS | - TOKEN_ADJUST_DEFAULT - TOKEN_READ = STANDARD_RIGHTS_READ | TOKEN_QUERY - TOKEN_WRITE = STANDARD_RIGHTS_WRITE | - TOKEN_ADJUST_PRIVILEGES | - TOKEN_ADJUST_GROUPS | - TOKEN_ADJUST_DEFAULT - TOKEN_EXECUTE = STANDARD_RIGHTS_EXECUTE -) - -const ( - // do not reorder - TokenUser = 1 + iota - TokenGroups - TokenPrivileges - TokenOwner - TokenPrimaryGroup - TokenDefaultDacl - TokenSource - TokenType - TokenImpersonationLevel - TokenStatistics - TokenRestrictedSids - TokenSessionId - TokenGroupsAndPrivileges - TokenSessionReference - TokenSandBoxInert - TokenAuditPolicy - TokenOrigin - TokenElevationType - TokenLinkedToken - TokenElevation - TokenHasRestrictions - TokenAccessInformation - TokenVirtualizationAllowed - TokenVirtualizationEnabled - TokenIntegrityLevel - TokenUIAccess - TokenMandatoryPolicy - TokenLogonSid - MaxTokenInfoClass -) - -type SIDAndAttributes struct { - Sid *SID - Attributes uint32 -} - -type Tokenuser struct { - User SIDAndAttributes -} - -type Tokenprimarygroup struct { - PrimaryGroup *SID -} - -type Tokengroups struct { - GroupCount uint32 - Groups [1]SIDAndAttributes -} - -// Authorization Functions -//sys checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) = advapi32.CheckTokenMembership -//sys OpenProcessToken(h Handle, access uint32, token *Token) (err error) = advapi32.OpenProcessToken -//sys GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) = advapi32.GetTokenInformation -//sys GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) = userenv.GetUserProfileDirectoryW - -// An access token contains the security information for a logon session. -// The system creates an access token when a user logs on, and every -// process executed on behalf of the user has a copy of the token. -// The token identifies the user, the user's groups, and the user's -// privileges. The system uses the token to control access to securable -// objects and to control the ability of the user to perform various -// system-related operations on the local computer. -type Token Handle - -// OpenCurrentProcessToken opens the access token -// associated with current process. -func OpenCurrentProcessToken() (Token, error) { - p, e := GetCurrentProcess() - if e != nil { - return 0, e - } - var t Token - e = OpenProcessToken(p, TOKEN_QUERY, &t) - if e != nil { - return 0, e - } - return t, nil -} - -// Close releases access to access token. -func (t Token) Close() error { - return CloseHandle(Handle(t)) -} - -// getInfo retrieves a specified type of information about an access token. -func (t Token) getInfo(class uint32, initSize int) (unsafe.Pointer, error) { - n := uint32(initSize) - for { - b := make([]byte, n) - e := GetTokenInformation(t, class, &b[0], uint32(len(b)), &n) - if e == nil { - return unsafe.Pointer(&b[0]), nil - } - if e != ERROR_INSUFFICIENT_BUFFER { - return nil, e - } - if n <= uint32(len(b)) { - return nil, e - } - } -} - -// GetTokenUser retrieves access token t user account information. -func (t Token) GetTokenUser() (*Tokenuser, error) { - i, e := t.getInfo(TokenUser, 50) - if e != nil { - return nil, e - } - return (*Tokenuser)(i), nil -} - -// GetTokenGroups retrieves group accounts associated with access token t. -func (t Token) GetTokenGroups() (*Tokengroups, error) { - i, e := t.getInfo(TokenGroups, 50) - if e != nil { - return nil, e - } - return (*Tokengroups)(i), nil -} - -// GetTokenPrimaryGroup retrieves access token t primary group information. -// A pointer to a SID structure representing a group that will become -// the primary group of any objects created by a process using this access token. -func (t Token) GetTokenPrimaryGroup() (*Tokenprimarygroup, error) { - i, e := t.getInfo(TokenPrimaryGroup, 50) - if e != nil { - return nil, e - } - return (*Tokenprimarygroup)(i), nil -} - -// GetUserProfileDirectory retrieves path to the -// root directory of the access token t user's profile. -func (t Token) GetUserProfileDirectory() (string, error) { - n := uint32(100) - for { - b := make([]uint16, n) - e := GetUserProfileDirectory(t, &b[0], &n) - if e == nil { - return UTF16ToString(b), nil - } - if e != ERROR_INSUFFICIENT_BUFFER { - return "", e - } - if n <= uint32(len(b)) { - return "", e - } - } -} - -// IsMember reports whether the access token t is a member of the provided SID. -func (t Token) IsMember(sid *SID) (bool, error) { - var b int32 - if e := checkTokenMembership(t, sid, &b); e != nil { - return false, e - } - return b != 0, nil -} diff --git a/vendor/golang.org/x/sys/windows/service.go b/vendor/golang.org/x/sys/windows/service.go deleted file mode 100644 index a500dd7..0000000 --- a/vendor/golang.org/x/sys/windows/service.go +++ /dev/null @@ -1,164 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -package windows - -const ( - SC_MANAGER_CONNECT = 1 - SC_MANAGER_CREATE_SERVICE = 2 - SC_MANAGER_ENUMERATE_SERVICE = 4 - SC_MANAGER_LOCK = 8 - SC_MANAGER_QUERY_LOCK_STATUS = 16 - SC_MANAGER_MODIFY_BOOT_CONFIG = 32 - SC_MANAGER_ALL_ACCESS = 0xf003f -) - -//sys OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenSCManagerW - -const ( - SERVICE_KERNEL_DRIVER = 1 - SERVICE_FILE_SYSTEM_DRIVER = 2 - SERVICE_ADAPTER = 4 - SERVICE_RECOGNIZER_DRIVER = 8 - SERVICE_WIN32_OWN_PROCESS = 16 - SERVICE_WIN32_SHARE_PROCESS = 32 - SERVICE_WIN32 = SERVICE_WIN32_OWN_PROCESS | SERVICE_WIN32_SHARE_PROCESS - SERVICE_INTERACTIVE_PROCESS = 256 - SERVICE_DRIVER = SERVICE_KERNEL_DRIVER | SERVICE_FILE_SYSTEM_DRIVER | SERVICE_RECOGNIZER_DRIVER - SERVICE_TYPE_ALL = SERVICE_WIN32 | SERVICE_ADAPTER | SERVICE_DRIVER | SERVICE_INTERACTIVE_PROCESS - - SERVICE_BOOT_START = 0 - SERVICE_SYSTEM_START = 1 - SERVICE_AUTO_START = 2 - SERVICE_DEMAND_START = 3 - SERVICE_DISABLED = 4 - - SERVICE_ERROR_IGNORE = 0 - SERVICE_ERROR_NORMAL = 1 - SERVICE_ERROR_SEVERE = 2 - SERVICE_ERROR_CRITICAL = 3 - - SC_STATUS_PROCESS_INFO = 0 - - SERVICE_STOPPED = 1 - SERVICE_START_PENDING = 2 - SERVICE_STOP_PENDING = 3 - SERVICE_RUNNING = 4 - SERVICE_CONTINUE_PENDING = 5 - SERVICE_PAUSE_PENDING = 6 - SERVICE_PAUSED = 7 - SERVICE_NO_CHANGE = 0xffffffff - - SERVICE_ACCEPT_STOP = 1 - SERVICE_ACCEPT_PAUSE_CONTINUE = 2 - SERVICE_ACCEPT_SHUTDOWN = 4 - SERVICE_ACCEPT_PARAMCHANGE = 8 - SERVICE_ACCEPT_NETBINDCHANGE = 16 - SERVICE_ACCEPT_HARDWAREPROFILECHANGE = 32 - SERVICE_ACCEPT_POWEREVENT = 64 - SERVICE_ACCEPT_SESSIONCHANGE = 128 - - SERVICE_CONTROL_STOP = 1 - SERVICE_CONTROL_PAUSE = 2 - SERVICE_CONTROL_CONTINUE = 3 - SERVICE_CONTROL_INTERROGATE = 4 - SERVICE_CONTROL_SHUTDOWN = 5 - SERVICE_CONTROL_PARAMCHANGE = 6 - SERVICE_CONTROL_NETBINDADD = 7 - SERVICE_CONTROL_NETBINDREMOVE = 8 - SERVICE_CONTROL_NETBINDENABLE = 9 - SERVICE_CONTROL_NETBINDDISABLE = 10 - SERVICE_CONTROL_DEVICEEVENT = 11 - SERVICE_CONTROL_HARDWAREPROFILECHANGE = 12 - SERVICE_CONTROL_POWEREVENT = 13 - SERVICE_CONTROL_SESSIONCHANGE = 14 - - SERVICE_ACTIVE = 1 - SERVICE_INACTIVE = 2 - SERVICE_STATE_ALL = 3 - - SERVICE_QUERY_CONFIG = 1 - SERVICE_CHANGE_CONFIG = 2 - SERVICE_QUERY_STATUS = 4 - SERVICE_ENUMERATE_DEPENDENTS = 8 - SERVICE_START = 16 - SERVICE_STOP = 32 - SERVICE_PAUSE_CONTINUE = 64 - SERVICE_INTERROGATE = 128 - SERVICE_USER_DEFINED_CONTROL = 256 - SERVICE_ALL_ACCESS = STANDARD_RIGHTS_REQUIRED | SERVICE_QUERY_CONFIG | SERVICE_CHANGE_CONFIG | SERVICE_QUERY_STATUS | SERVICE_ENUMERATE_DEPENDENTS | SERVICE_START | SERVICE_STOP | SERVICE_PAUSE_CONTINUE | SERVICE_INTERROGATE | SERVICE_USER_DEFINED_CONTROL - SERVICE_RUNS_IN_SYSTEM_PROCESS = 1 - SERVICE_CONFIG_DESCRIPTION = 1 - SERVICE_CONFIG_FAILURE_ACTIONS = 2 - - NO_ERROR = 0 - - SC_ENUM_PROCESS_INFO = 0 -) - -type SERVICE_STATUS struct { - ServiceType uint32 - CurrentState uint32 - ControlsAccepted uint32 - Win32ExitCode uint32 - ServiceSpecificExitCode uint32 - CheckPoint uint32 - WaitHint uint32 -} - -type SERVICE_TABLE_ENTRY struct { - ServiceName *uint16 - ServiceProc uintptr -} - -type QUERY_SERVICE_CONFIG struct { - ServiceType uint32 - StartType uint32 - ErrorControl uint32 - BinaryPathName *uint16 - LoadOrderGroup *uint16 - TagId uint32 - Dependencies *uint16 - ServiceStartName *uint16 - DisplayName *uint16 -} - -type SERVICE_DESCRIPTION struct { - Description *uint16 -} - -type SERVICE_STATUS_PROCESS struct { - ServiceType uint32 - CurrentState uint32 - ControlsAccepted uint32 - Win32ExitCode uint32 - ServiceSpecificExitCode uint32 - CheckPoint uint32 - WaitHint uint32 - ProcessId uint32 - ServiceFlags uint32 -} - -type ENUM_SERVICE_STATUS_PROCESS struct { - ServiceName *uint16 - DisplayName *uint16 - ServiceStatusProcess SERVICE_STATUS_PROCESS -} - -//sys CloseServiceHandle(handle Handle) (err error) = advapi32.CloseServiceHandle -//sys CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) [failretval==0] = advapi32.CreateServiceW -//sys OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) [failretval==0] = advapi32.OpenServiceW -//sys DeleteService(service Handle) (err error) = advapi32.DeleteService -//sys StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) = advapi32.StartServiceW -//sys QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) = advapi32.QueryServiceStatus -//sys ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) = advapi32.ControlService -//sys StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) = advapi32.StartServiceCtrlDispatcherW -//sys SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) = advapi32.SetServiceStatus -//sys ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) = advapi32.ChangeServiceConfigW -//sys QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfigW -//sys ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) = advapi32.ChangeServiceConfig2W -//sys QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) = advapi32.QueryServiceConfig2W -//sys EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) = advapi32.EnumServicesStatusExW diff --git a/vendor/golang.org/x/sys/windows/str.go b/vendor/golang.org/x/sys/windows/str.go deleted file mode 100644 index 917cc2a..0000000 --- a/vendor/golang.org/x/sys/windows/str.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -package windows - -func itoa(val int) string { // do it here rather than with fmt to avoid dependency - if val < 0 { - return "-" + itoa(-val) - } - var buf [32]byte // big enough for int64 - i := len(buf) - 1 - for val >= 10 { - buf[i] = byte(val%10 + '0') - i-- - val /= 10 - } - buf[i] = byte(val + '0') - return string(buf[i:]) -} diff --git a/vendor/golang.org/x/sys/windows/syscall.go b/vendor/golang.org/x/sys/windows/syscall.go deleted file mode 100644 index b07bc23..0000000 --- a/vendor/golang.org/x/sys/windows/syscall.go +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -// Package windows contains an interface to the low-level operating system -// primitives. OS details vary depending on the underlying system, and -// by default, godoc will display the OS-specific documentation for the current -// system. If you want godoc to display syscall documentation for another -// system, set $GOOS and $GOARCH to the desired system. For example, if -// you want to view documentation for freebsd/arm on linux/amd64, set $GOOS -// to freebsd and $GOARCH to arm. -// The primary use of this package is inside other packages that provide a more -// portable interface to the system, such as "os", "time" and "net". Use -// those packages rather than this one if you can. -// For details of the functions and data types in this package consult -// the manuals for the appropriate operating system. -// These calls return err == nil to indicate success; otherwise -// err represents an operating system error describing the failure and -// holds a value of type syscall.Errno. -package windows // import "golang.org/x/sys/windows" - -import ( - "syscall" -) - -// ByteSliceFromString returns a NUL-terminated slice of bytes -// containing the text of s. If s contains a NUL byte at any -// location, it returns (nil, syscall.EINVAL). -func ByteSliceFromString(s string) ([]byte, error) { - for i := 0; i < len(s); i++ { - if s[i] == 0 { - return nil, syscall.EINVAL - } - } - a := make([]byte, len(s)+1) - copy(a, s) - return a, nil -} - -// BytePtrFromString returns a pointer to a NUL-terminated array of -// bytes containing the text of s. If s contains a NUL byte at any -// location, it returns (nil, syscall.EINVAL). -func BytePtrFromString(s string) (*byte, error) { - a, err := ByteSliceFromString(s) - if err != nil { - return nil, err - } - return &a[0], nil -} - -// Single-word zero for use when we need a valid pointer to 0 bytes. -// See mksyscall.pl. -var _zero uintptr - -func (ts *Timespec) Unix() (sec int64, nsec int64) { - return int64(ts.Sec), int64(ts.Nsec) -} - -func (tv *Timeval) Unix() (sec int64, nsec int64) { - return int64(tv.Sec), int64(tv.Usec) * 1000 -} - -func (ts *Timespec) Nano() int64 { - return int64(ts.Sec)*1e9 + int64(ts.Nsec) -} - -func (tv *Timeval) Nano() int64 { - return int64(tv.Sec)*1e9 + int64(tv.Usec)*1000 -} diff --git a/vendor/golang.org/x/sys/windows/syscall_test.go b/vendor/golang.org/x/sys/windows/syscall_test.go deleted file mode 100644 index d7009e4..0000000 --- a/vendor/golang.org/x/sys/windows/syscall_test.go +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build windows - -package windows_test - -import ( - "syscall" - "testing" - - "golang.org/x/sys/windows" -) - -func testSetGetenv(t *testing.T, key, value string) { - err := windows.Setenv(key, value) - if err != nil { - t.Fatalf("Setenv failed to set %q: %v", value, err) - } - newvalue, found := windows.Getenv(key) - if !found { - t.Fatalf("Getenv failed to find %v variable (want value %q)", key, value) - } - if newvalue != value { - t.Fatalf("Getenv(%v) = %q; want %q", key, newvalue, value) - } -} - -func TestEnv(t *testing.T) { - testSetGetenv(t, "TESTENV", "AVALUE") - // make sure TESTENV gets set to "", not deleted - testSetGetenv(t, "TESTENV", "") -} - -func TestGetProcAddressByOrdinal(t *testing.T) { - // Attempt calling shlwapi.dll:IsOS, resolving it by ordinal, as - // suggested in - // https://msdn.microsoft.com/en-us/library/windows/desktop/bb773795.aspx - h, err := windows.LoadLibrary("shlwapi.dll") - if err != nil { - t.Fatalf("Failed to load shlwapi.dll: %s", err) - } - procIsOS, err := windows.GetProcAddressByOrdinal(h, 437) - if err != nil { - t.Fatalf("Could not find shlwapi.dll:IsOS by ordinal: %s", err) - } - const OS_NT = 1 - r, _, _ := syscall.Syscall(procIsOS, 1, OS_NT, 0, 0) - if r == 0 { - t.Error("shlwapi.dll:IsOS(OS_NT) returned 0, expected non-zero value") - } -} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows.go b/vendor/golang.org/x/sys/windows/syscall_windows.go deleted file mode 100644 index 1e9f4bb..0000000 --- a/vendor/golang.org/x/sys/windows/syscall_windows.go +++ /dev/null @@ -1,1153 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Windows system calls. - -package windows - -import ( - errorspkg "errors" - "sync" - "syscall" - "unicode/utf16" - "unsafe" -) - -type Handle uintptr - -const ( - InvalidHandle = ^Handle(0) - - // Flags for DefineDosDevice. - DDD_EXACT_MATCH_ON_REMOVE = 0x00000004 - DDD_NO_BROADCAST_SYSTEM = 0x00000008 - DDD_RAW_TARGET_PATH = 0x00000001 - DDD_REMOVE_DEFINITION = 0x00000002 - - // Return values for GetDriveType. - DRIVE_UNKNOWN = 0 - DRIVE_NO_ROOT_DIR = 1 - DRIVE_REMOVABLE = 2 - DRIVE_FIXED = 3 - DRIVE_REMOTE = 4 - DRIVE_CDROM = 5 - DRIVE_RAMDISK = 6 - - // File system flags from GetVolumeInformation and GetVolumeInformationByHandle. - FILE_CASE_SENSITIVE_SEARCH = 0x00000001 - FILE_CASE_PRESERVED_NAMES = 0x00000002 - FILE_FILE_COMPRESSION = 0x00000010 - FILE_DAX_VOLUME = 0x20000000 - FILE_NAMED_STREAMS = 0x00040000 - FILE_PERSISTENT_ACLS = 0x00000008 - FILE_READ_ONLY_VOLUME = 0x00080000 - FILE_SEQUENTIAL_WRITE_ONCE = 0x00100000 - FILE_SUPPORTS_ENCRYPTION = 0x00020000 - FILE_SUPPORTS_EXTENDED_ATTRIBUTES = 0x00800000 - FILE_SUPPORTS_HARD_LINKS = 0x00400000 - FILE_SUPPORTS_OBJECT_IDS = 0x00010000 - FILE_SUPPORTS_OPEN_BY_FILE_ID = 0x01000000 - FILE_SUPPORTS_REPARSE_POINTS = 0x00000080 - FILE_SUPPORTS_SPARSE_FILES = 0x00000040 - FILE_SUPPORTS_TRANSACTIONS = 0x00200000 - FILE_SUPPORTS_USN_JOURNAL = 0x02000000 - FILE_UNICODE_ON_DISK = 0x00000004 - FILE_VOLUME_IS_COMPRESSED = 0x00008000 - FILE_VOLUME_QUOTAS = 0x00000020 -) - -// StringToUTF16 is deprecated. Use UTF16FromString instead. -// If s contains a NUL byte this function panics instead of -// returning an error. -func StringToUTF16(s string) []uint16 { - a, err := UTF16FromString(s) - if err != nil { - panic("windows: string with NUL passed to StringToUTF16") - } - return a -} - -// UTF16FromString returns the UTF-16 encoding of the UTF-8 string -// s, with a terminating NUL added. If s contains a NUL byte at any -// location, it returns (nil, syscall.EINVAL). -func UTF16FromString(s string) ([]uint16, error) { - for i := 0; i < len(s); i++ { - if s[i] == 0 { - return nil, syscall.EINVAL - } - } - return utf16.Encode([]rune(s + "\x00")), nil -} - -// UTF16ToString returns the UTF-8 encoding of the UTF-16 sequence s, -// with a terminating NUL removed. -func UTF16ToString(s []uint16) string { - for i, v := range s { - if v == 0 { - s = s[0:i] - break - } - } - return string(utf16.Decode(s)) -} - -// StringToUTF16Ptr is deprecated. Use UTF16PtrFromString instead. -// If s contains a NUL byte this function panics instead of -// returning an error. -func StringToUTF16Ptr(s string) *uint16 { return &StringToUTF16(s)[0] } - -// UTF16PtrFromString returns pointer to the UTF-16 encoding of -// the UTF-8 string s, with a terminating NUL added. If s -// contains a NUL byte at any location, it returns (nil, syscall.EINVAL). -func UTF16PtrFromString(s string) (*uint16, error) { - a, err := UTF16FromString(s) - if err != nil { - return nil, err - } - return &a[0], nil -} - -func Getpagesize() int { return 4096 } - -// NewCallback converts a Go function to a function pointer conforming to the stdcall calling convention. -// This is useful when interoperating with Windows code requiring callbacks. -func NewCallback(fn interface{}) uintptr { - return syscall.NewCallback(fn) -} - -// NewCallbackCDecl converts a Go function to a function pointer conforming to the cdecl calling convention. -// This is useful when interoperating with Windows code requiring callbacks. -func NewCallbackCDecl(fn interface{}) uintptr { - return syscall.NewCallbackCDecl(fn) -} - -// windows api calls - -//sys GetLastError() (lasterr error) -//sys LoadLibrary(libname string) (handle Handle, err error) = LoadLibraryW -//sys LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) = LoadLibraryExW -//sys FreeLibrary(handle Handle) (err error) -//sys GetProcAddress(module Handle, procname string) (proc uintptr, err error) -//sys GetVersion() (ver uint32, err error) -//sys FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) = FormatMessageW -//sys ExitProcess(exitcode uint32) -//sys CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) [failretval==InvalidHandle] = CreateFileW -//sys ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) -//sys WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) -//sys SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) [failretval==0xffffffff] -//sys CloseHandle(handle Handle) (err error) -//sys GetStdHandle(stdhandle uint32) (handle Handle, err error) [failretval==InvalidHandle] -//sys SetStdHandle(stdhandle uint32, handle Handle) (err error) -//sys findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstFileW -//sys findNextFile1(handle Handle, data *win32finddata1) (err error) = FindNextFileW -//sys FindClose(handle Handle) (err error) -//sys GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) -//sys GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) = GetCurrentDirectoryW -//sys SetCurrentDirectory(path *uint16) (err error) = SetCurrentDirectoryW -//sys CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) = CreateDirectoryW -//sys RemoveDirectory(path *uint16) (err error) = RemoveDirectoryW -//sys DeleteFile(path *uint16) (err error) = DeleteFileW -//sys MoveFile(from *uint16, to *uint16) (err error) = MoveFileW -//sys MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) = MoveFileExW -//sys GetComputerName(buf *uint16, n *uint32) (err error) = GetComputerNameW -//sys GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) = GetComputerNameExW -//sys SetEndOfFile(handle Handle) (err error) -//sys GetSystemTimeAsFileTime(time *Filetime) -//sys GetSystemTimePreciseAsFileTime(time *Filetime) -//sys GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) [failretval==0xffffffff] -//sys CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) -//sys GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) -//sys PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) -//sys CancelIo(s Handle) (err error) -//sys CancelIoEx(s Handle, o *Overlapped) (err error) -//sys CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) = CreateProcessW -//sys OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) -//sys TerminateProcess(handle Handle, exitcode uint32) (err error) -//sys GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) -//sys GetStartupInfo(startupInfo *StartupInfo) (err error) = GetStartupInfoW -//sys GetCurrentProcess() (pseudoHandle Handle, err error) -//sys GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) -//sys DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) -//sys WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) [failretval==0xffffffff] -//sys GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) = GetTempPathW -//sys CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) -//sys GetFileType(filehandle Handle) (n uint32, err error) -//sys CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) = advapi32.CryptAcquireContextW -//sys CryptReleaseContext(provhandle Handle, flags uint32) (err error) = advapi32.CryptReleaseContext -//sys CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) = advapi32.CryptGenRandom -//sys GetEnvironmentStrings() (envs *uint16, err error) [failretval==nil] = kernel32.GetEnvironmentStringsW -//sys FreeEnvironmentStrings(envs *uint16) (err error) = kernel32.FreeEnvironmentStringsW -//sys GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) = kernel32.GetEnvironmentVariableW -//sys SetEnvironmentVariable(name *uint16, value *uint16) (err error) = kernel32.SetEnvironmentVariableW -//sys SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) -//sys GetFileAttributes(name *uint16) (attrs uint32, err error) [failretval==INVALID_FILE_ATTRIBUTES] = kernel32.GetFileAttributesW -//sys SetFileAttributes(name *uint16, attrs uint32) (err error) = kernel32.SetFileAttributesW -//sys GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) = kernel32.GetFileAttributesExW -//sys GetCommandLine() (cmd *uint16) = kernel32.GetCommandLineW -//sys CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) [failretval==nil] = shell32.CommandLineToArgvW -//sys LocalFree(hmem Handle) (handle Handle, err error) [failretval!=0] -//sys SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) -//sys FlushFileBuffers(handle Handle) (err error) -//sys GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) = kernel32.GetFullPathNameW -//sys GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) = kernel32.GetLongPathNameW -//sys GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) = kernel32.GetShortPathNameW -//sys CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) = kernel32.CreateFileMappingW -//sys MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) -//sys UnmapViewOfFile(addr uintptr) (err error) -//sys FlushViewOfFile(addr uintptr, length uintptr) (err error) -//sys VirtualLock(addr uintptr, length uintptr) (err error) -//sys VirtualUnlock(addr uintptr, length uintptr) (err error) -//sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc -//sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree -//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect -//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile -//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW -//sys CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) = crypt32.CertOpenSystemStoreW -//sys CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) [failretval==InvalidHandle] = crypt32.CertOpenStore -//sys CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) [failretval==nil] = crypt32.CertEnumCertificatesInStore -//sys CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) = crypt32.CertAddCertificateContextToStore -//sys CertCloseStore(store Handle, flags uint32) (err error) = crypt32.CertCloseStore -//sys CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) = crypt32.CertGetCertificateChain -//sys CertFreeCertificateChain(ctx *CertChainContext) = crypt32.CertFreeCertificateChain -//sys CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) [failretval==nil] = crypt32.CertCreateCertificateContext -//sys CertFreeCertificateContext(ctx *CertContext) (err error) = crypt32.CertFreeCertificateContext -//sys CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) = crypt32.CertVerifyCertificateChainPolicy -//sys RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) = advapi32.RegOpenKeyExW -//sys RegCloseKey(key Handle) (regerrno error) = advapi32.RegCloseKey -//sys RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegQueryInfoKeyW -//sys RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) = advapi32.RegEnumKeyExW -//sys RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) = advapi32.RegQueryValueExW -//sys getCurrentProcessId() (pid uint32) = kernel32.GetCurrentProcessId -//sys GetConsoleMode(console Handle, mode *uint32) (err error) = kernel32.GetConsoleMode -//sys SetConsoleMode(console Handle, mode uint32) (err error) = kernel32.SetConsoleMode -//sys GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) = kernel32.GetConsoleScreenBufferInfo -//sys WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) = kernel32.WriteConsoleW -//sys ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) = kernel32.ReadConsoleW -//sys CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.CreateToolhelp32Snapshot -//sys Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32FirstW -//sys Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) = kernel32.Process32NextW -//sys DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) -// This function returns 1 byte BOOLEAN rather than the 4 byte BOOL. -//sys CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) [failretval&0xff==0] = CreateSymbolicLinkW -//sys CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) [failretval&0xff==0] = CreateHardLinkW -//sys GetCurrentThreadId() (id uint32) -//sys CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) = kernel32.CreateEventW -//sys CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) = kernel32.CreateEventExW -//sys OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) = kernel32.OpenEventW -//sys SetEvent(event Handle) (err error) = kernel32.SetEvent -//sys ResetEvent(event Handle) (err error) = kernel32.ResetEvent -//sys PulseEvent(event Handle) (err error) = kernel32.PulseEvent - -// Volume Management Functions -//sys DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) = DefineDosDeviceW -//sys DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) = DeleteVolumeMountPointW -//sys FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeW -//sys FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) [failretval==InvalidHandle] = FindFirstVolumeMountPointW -//sys FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) = FindNextVolumeW -//sys FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) = FindNextVolumeMountPointW -//sys FindVolumeClose(findVolume Handle) (err error) -//sys FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) -//sys GetDriveType(rootPathName *uint16) (driveType uint32) = GetDriveTypeW -//sys GetLogicalDrives() (drivesBitMask uint32, err error) [failretval==0] -//sys GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) [failretval==0] = GetLogicalDriveStringsW -//sys GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationW -//sys GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) = GetVolumeInformationByHandleW -//sys GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) = GetVolumeNameForVolumeMountPointW -//sys GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) = GetVolumePathNameW -//sys GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) = GetVolumePathNamesForVolumeNameW -//sys QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) [failretval==0] = QueryDosDeviceW -//sys SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) = SetVolumeLabelW -//sys SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) = SetVolumeMountPointW - -// syscall interface implementation for other packages - -// GetProcAddressByOrdinal retrieves the address of the exported -// function from module by ordinal. -func GetProcAddressByOrdinal(module Handle, ordinal uintptr) (proc uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), ordinal, 0) - proc = uintptr(r0) - if proc == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Exit(code int) { ExitProcess(uint32(code)) } - -func makeInheritSa() *SecurityAttributes { - var sa SecurityAttributes - sa.Length = uint32(unsafe.Sizeof(sa)) - sa.InheritHandle = 1 - return &sa -} - -func Open(path string, mode int, perm uint32) (fd Handle, err error) { - if len(path) == 0 { - return InvalidHandle, ERROR_FILE_NOT_FOUND - } - pathp, err := UTF16PtrFromString(path) - if err != nil { - return InvalidHandle, err - } - var access uint32 - switch mode & (O_RDONLY | O_WRONLY | O_RDWR) { - case O_RDONLY: - access = GENERIC_READ - case O_WRONLY: - access = GENERIC_WRITE - case O_RDWR: - access = GENERIC_READ | GENERIC_WRITE - } - if mode&O_CREAT != 0 { - access |= GENERIC_WRITE - } - if mode&O_APPEND != 0 { - access &^= GENERIC_WRITE - access |= FILE_APPEND_DATA - } - sharemode := uint32(FILE_SHARE_READ | FILE_SHARE_WRITE) - var sa *SecurityAttributes - if mode&O_CLOEXEC == 0 { - sa = makeInheritSa() - } - var createmode uint32 - switch { - case mode&(O_CREAT|O_EXCL) == (O_CREAT | O_EXCL): - createmode = CREATE_NEW - case mode&(O_CREAT|O_TRUNC) == (O_CREAT | O_TRUNC): - createmode = CREATE_ALWAYS - case mode&O_CREAT == O_CREAT: - createmode = OPEN_ALWAYS - case mode&O_TRUNC == O_TRUNC: - createmode = TRUNCATE_EXISTING - default: - createmode = OPEN_EXISTING - } - h, e := CreateFile(pathp, access, sharemode, sa, createmode, FILE_ATTRIBUTE_NORMAL, 0) - return h, e -} - -func Read(fd Handle, p []byte) (n int, err error) { - var done uint32 - e := ReadFile(fd, p, &done, nil) - if e != nil { - if e == ERROR_BROKEN_PIPE { - // NOTE(brainman): work around ERROR_BROKEN_PIPE is returned on reading EOF from stdin - return 0, nil - } - return 0, e - } - if raceenabled { - if done > 0 { - raceWriteRange(unsafe.Pointer(&p[0]), int(done)) - } - raceAcquire(unsafe.Pointer(&ioSync)) - } - return int(done), nil -} - -func Write(fd Handle, p []byte) (n int, err error) { - if raceenabled { - raceReleaseMerge(unsafe.Pointer(&ioSync)) - } - var done uint32 - e := WriteFile(fd, p, &done, nil) - if e != nil { - return 0, e - } - if raceenabled && done > 0 { - raceReadRange(unsafe.Pointer(&p[0]), int(done)) - } - return int(done), nil -} - -var ioSync int64 - -func Seek(fd Handle, offset int64, whence int) (newoffset int64, err error) { - var w uint32 - switch whence { - case 0: - w = FILE_BEGIN - case 1: - w = FILE_CURRENT - case 2: - w = FILE_END - } - hi := int32(offset >> 32) - lo := int32(offset) - // use GetFileType to check pipe, pipe can't do seek - ft, _ := GetFileType(fd) - if ft == FILE_TYPE_PIPE { - return 0, syscall.EPIPE - } - rlo, e := SetFilePointer(fd, lo, &hi, w) - if e != nil { - return 0, e - } - return int64(hi)<<32 + int64(rlo), nil -} - -func Close(fd Handle) (err error) { - return CloseHandle(fd) -} - -var ( - Stdin = getStdHandle(STD_INPUT_HANDLE) - Stdout = getStdHandle(STD_OUTPUT_HANDLE) - Stderr = getStdHandle(STD_ERROR_HANDLE) -) - -func getStdHandle(stdhandle uint32) (fd Handle) { - r, _ := GetStdHandle(stdhandle) - CloseOnExec(r) - return r -} - -const ImplementsGetwd = true - -func Getwd() (wd string, err error) { - b := make([]uint16, 300) - n, e := GetCurrentDirectory(uint32(len(b)), &b[0]) - if e != nil { - return "", e - } - return string(utf16.Decode(b[0:n])), nil -} - -func Chdir(path string) (err error) { - pathp, err := UTF16PtrFromString(path) - if err != nil { - return err - } - return SetCurrentDirectory(pathp) -} - -func Mkdir(path string, mode uint32) (err error) { - pathp, err := UTF16PtrFromString(path) - if err != nil { - return err - } - return CreateDirectory(pathp, nil) -} - -func Rmdir(path string) (err error) { - pathp, err := UTF16PtrFromString(path) - if err != nil { - return err - } - return RemoveDirectory(pathp) -} - -func Unlink(path string) (err error) { - pathp, err := UTF16PtrFromString(path) - if err != nil { - return err - } - return DeleteFile(pathp) -} - -func Rename(oldpath, newpath string) (err error) { - from, err := UTF16PtrFromString(oldpath) - if err != nil { - return err - } - to, err := UTF16PtrFromString(newpath) - if err != nil { - return err - } - return MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING) -} - -func ComputerName() (name string, err error) { - var n uint32 = MAX_COMPUTERNAME_LENGTH + 1 - b := make([]uint16, n) - e := GetComputerName(&b[0], &n) - if e != nil { - return "", e - } - return string(utf16.Decode(b[0:n])), nil -} - -func Ftruncate(fd Handle, length int64) (err error) { - curoffset, e := Seek(fd, 0, 1) - if e != nil { - return e - } - defer Seek(fd, curoffset, 0) - _, e = Seek(fd, length, 0) - if e != nil { - return e - } - e = SetEndOfFile(fd) - if e != nil { - return e - } - return nil -} - -func Gettimeofday(tv *Timeval) (err error) { - var ft Filetime - GetSystemTimeAsFileTime(&ft) - *tv = NsecToTimeval(ft.Nanoseconds()) - return nil -} - -func Pipe(p []Handle) (err error) { - if len(p) != 2 { - return syscall.EINVAL - } - var r, w Handle - e := CreatePipe(&r, &w, makeInheritSa(), 0) - if e != nil { - return e - } - p[0] = r - p[1] = w - return nil -} - -func Utimes(path string, tv []Timeval) (err error) { - if len(tv) != 2 { - return syscall.EINVAL - } - pathp, e := UTF16PtrFromString(path) - if e != nil { - return e - } - h, e := CreateFile(pathp, - FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, nil, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) - if e != nil { - return e - } - defer Close(h) - a := NsecToFiletime(tv[0].Nanoseconds()) - w := NsecToFiletime(tv[1].Nanoseconds()) - return SetFileTime(h, nil, &a, &w) -} - -func UtimesNano(path string, ts []Timespec) (err error) { - if len(ts) != 2 { - return syscall.EINVAL - } - pathp, e := UTF16PtrFromString(path) - if e != nil { - return e - } - h, e := CreateFile(pathp, - FILE_WRITE_ATTRIBUTES, FILE_SHARE_WRITE, nil, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0) - if e != nil { - return e - } - defer Close(h) - a := NsecToFiletime(TimespecToNsec(ts[0])) - w := NsecToFiletime(TimespecToNsec(ts[1])) - return SetFileTime(h, nil, &a, &w) -} - -func Fsync(fd Handle) (err error) { - return FlushFileBuffers(fd) -} - -func Chmod(path string, mode uint32) (err error) { - if mode == 0 { - return syscall.EINVAL - } - p, e := UTF16PtrFromString(path) - if e != nil { - return e - } - attrs, e := GetFileAttributes(p) - if e != nil { - return e - } - if mode&S_IWRITE != 0 { - attrs &^= FILE_ATTRIBUTE_READONLY - } else { - attrs |= FILE_ATTRIBUTE_READONLY - } - return SetFileAttributes(p, attrs) -} - -func LoadGetSystemTimePreciseAsFileTime() error { - return procGetSystemTimePreciseAsFileTime.Find() -} - -func LoadCancelIoEx() error { - return procCancelIoEx.Find() -} - -func LoadSetFileCompletionNotificationModes() error { - return procSetFileCompletionNotificationModes.Find() -} - -// net api calls - -const socket_error = uintptr(^uint32(0)) - -//sys WSAStartup(verreq uint32, data *WSAData) (sockerr error) = ws2_32.WSAStartup -//sys WSACleanup() (err error) [failretval==socket_error] = ws2_32.WSACleanup -//sys WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) [failretval==socket_error] = ws2_32.WSAIoctl -//sys socket(af int32, typ int32, protocol int32) (handle Handle, err error) [failretval==InvalidHandle] = ws2_32.socket -//sys Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) [failretval==socket_error] = ws2_32.setsockopt -//sys Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockopt -//sys bind(s Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socket_error] = ws2_32.bind -//sys connect(s Handle, name unsafe.Pointer, namelen int32) (err error) [failretval==socket_error] = ws2_32.connect -//sys getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getsockname -//sys getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) [failretval==socket_error] = ws2_32.getpeername -//sys listen(s Handle, backlog int32) (err error) [failretval==socket_error] = ws2_32.listen -//sys shutdown(s Handle, how int32) (err error) [failretval==socket_error] = ws2_32.shutdown -//sys Closesocket(s Handle) (err error) [failretval==socket_error] = ws2_32.closesocket -//sys AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) = mswsock.AcceptEx -//sys GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) = mswsock.GetAcceptExSockaddrs -//sys WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecv -//sys WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASend -//sys WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSARecvFrom -//sys WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) [failretval==socket_error] = ws2_32.WSASendTo -//sys GetHostByName(name string) (h *Hostent, err error) [failretval==nil] = ws2_32.gethostbyname -//sys GetServByName(name string, proto string) (s *Servent, err error) [failretval==nil] = ws2_32.getservbyname -//sys Ntohs(netshort uint16) (u uint16) = ws2_32.ntohs -//sys GetProtoByName(name string) (p *Protoent, err error) [failretval==nil] = ws2_32.getprotobyname -//sys DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) = dnsapi.DnsQuery_W -//sys DnsRecordListFree(rl *DNSRecord, freetype uint32) = dnsapi.DnsRecordListFree -//sys DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) = dnsapi.DnsNameCompare_W -//sys GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) = ws2_32.GetAddrInfoW -//sys FreeAddrInfoW(addrinfo *AddrinfoW) = ws2_32.FreeAddrInfoW -//sys GetIfEntry(pIfRow *MibIfRow) (errcode error) = iphlpapi.GetIfEntry -//sys GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) = iphlpapi.GetAdaptersInfo -//sys SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) = kernel32.SetFileCompletionNotificationModes -//sys WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) [failretval==-1] = ws2_32.WSAEnumProtocolsW -//sys GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) = iphlpapi.GetAdaptersAddresses -//sys GetACP() (acp uint32) = kernel32.GetACP -//sys MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) = kernel32.MultiByteToWideChar - -// For testing: clients can set this flag to force -// creation of IPv6 sockets to return EAFNOSUPPORT. -var SocketDisableIPv6 bool - -type RawSockaddrInet4 struct { - Family uint16 - Port uint16 - Addr [4]byte /* in_addr */ - Zero [8]uint8 -} - -type RawSockaddrInet6 struct { - Family uint16 - Port uint16 - Flowinfo uint32 - Addr [16]byte /* in6_addr */ - Scope_id uint32 -} - -type RawSockaddr struct { - Family uint16 - Data [14]int8 -} - -type RawSockaddrAny struct { - Addr RawSockaddr - Pad [96]int8 -} - -type Sockaddr interface { - sockaddr() (ptr unsafe.Pointer, len int32, err error) // lowercase; only we can define Sockaddrs -} - -type SockaddrInet4 struct { - Port int - Addr [4]byte - raw RawSockaddrInet4 -} - -func (sa *SockaddrInet4) sockaddr() (unsafe.Pointer, int32, error) { - if sa.Port < 0 || sa.Port > 0xFFFF { - return nil, 0, syscall.EINVAL - } - sa.raw.Family = AF_INET - p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) - p[0] = byte(sa.Port >> 8) - p[1] = byte(sa.Port) - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } - return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil -} - -type SockaddrInet6 struct { - Port int - ZoneId uint32 - Addr [16]byte - raw RawSockaddrInet6 -} - -func (sa *SockaddrInet6) sockaddr() (unsafe.Pointer, int32, error) { - if sa.Port < 0 || sa.Port > 0xFFFF { - return nil, 0, syscall.EINVAL - } - sa.raw.Family = AF_INET6 - p := (*[2]byte)(unsafe.Pointer(&sa.raw.Port)) - p[0] = byte(sa.Port >> 8) - p[1] = byte(sa.Port) - sa.raw.Scope_id = sa.ZoneId - for i := 0; i < len(sa.Addr); i++ { - sa.raw.Addr[i] = sa.Addr[i] - } - return unsafe.Pointer(&sa.raw), int32(unsafe.Sizeof(sa.raw)), nil -} - -type SockaddrUnix struct { - Name string -} - -func (sa *SockaddrUnix) sockaddr() (unsafe.Pointer, int32, error) { - // TODO(brainman): implement SockaddrUnix.sockaddr() - return nil, 0, syscall.EWINDOWS -} - -func (rsa *RawSockaddrAny) Sockaddr() (Sockaddr, error) { - switch rsa.Addr.Family { - case AF_UNIX: - return nil, syscall.EWINDOWS - - case AF_INET: - pp := (*RawSockaddrInet4)(unsafe.Pointer(rsa)) - sa := new(SockaddrInet4) - p := (*[2]byte)(unsafe.Pointer(&pp.Port)) - sa.Port = int(p[0])<<8 + int(p[1]) - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } - return sa, nil - - case AF_INET6: - pp := (*RawSockaddrInet6)(unsafe.Pointer(rsa)) - sa := new(SockaddrInet6) - p := (*[2]byte)(unsafe.Pointer(&pp.Port)) - sa.Port = int(p[0])<<8 + int(p[1]) - sa.ZoneId = pp.Scope_id - for i := 0; i < len(sa.Addr); i++ { - sa.Addr[i] = pp.Addr[i] - } - return sa, nil - } - return nil, syscall.EAFNOSUPPORT -} - -func Socket(domain, typ, proto int) (fd Handle, err error) { - if domain == AF_INET6 && SocketDisableIPv6 { - return InvalidHandle, syscall.EAFNOSUPPORT - } - return socket(int32(domain), int32(typ), int32(proto)) -} - -func SetsockoptInt(fd Handle, level, opt int, value int) (err error) { - v := int32(value) - return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&v)), int32(unsafe.Sizeof(v))) -} - -func Bind(fd Handle, sa Sockaddr) (err error) { - ptr, n, err := sa.sockaddr() - if err != nil { - return err - } - return bind(fd, ptr, n) -} - -func Connect(fd Handle, sa Sockaddr) (err error) { - ptr, n, err := sa.sockaddr() - if err != nil { - return err - } - return connect(fd, ptr, n) -} - -func Getsockname(fd Handle) (sa Sockaddr, err error) { - var rsa RawSockaddrAny - l := int32(unsafe.Sizeof(rsa)) - if err = getsockname(fd, &rsa, &l); err != nil { - return - } - return rsa.Sockaddr() -} - -func Getpeername(fd Handle) (sa Sockaddr, err error) { - var rsa RawSockaddrAny - l := int32(unsafe.Sizeof(rsa)) - if err = getpeername(fd, &rsa, &l); err != nil { - return - } - return rsa.Sockaddr() -} - -func Listen(s Handle, n int) (err error) { - return listen(s, int32(n)) -} - -func Shutdown(fd Handle, how int) (err error) { - return shutdown(fd, int32(how)) -} - -func WSASendto(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to Sockaddr, overlapped *Overlapped, croutine *byte) (err error) { - rsa, l, err := to.sockaddr() - if err != nil { - return err - } - return WSASendTo(s, bufs, bufcnt, sent, flags, (*RawSockaddrAny)(unsafe.Pointer(rsa)), l, overlapped, croutine) -} - -func LoadGetAddrInfo() error { - return procGetAddrInfoW.Find() -} - -var connectExFunc struct { - once sync.Once - addr uintptr - err error -} - -func LoadConnectEx() error { - connectExFunc.once.Do(func() { - var s Handle - s, connectExFunc.err = Socket(AF_INET, SOCK_STREAM, IPPROTO_TCP) - if connectExFunc.err != nil { - return - } - defer CloseHandle(s) - var n uint32 - connectExFunc.err = WSAIoctl(s, - SIO_GET_EXTENSION_FUNCTION_POINTER, - (*byte)(unsafe.Pointer(&WSAID_CONNECTEX)), - uint32(unsafe.Sizeof(WSAID_CONNECTEX)), - (*byte)(unsafe.Pointer(&connectExFunc.addr)), - uint32(unsafe.Sizeof(connectExFunc.addr)), - &n, nil, 0) - }) - return connectExFunc.err -} - -func connectEx(s Handle, name unsafe.Pointer, namelen int32, sendBuf *byte, sendDataLen uint32, bytesSent *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(connectExFunc.addr, 7, uintptr(s), uintptr(name), uintptr(namelen), uintptr(unsafe.Pointer(sendBuf)), uintptr(sendDataLen), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = error(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ConnectEx(fd Handle, sa Sockaddr, sendBuf *byte, sendDataLen uint32, bytesSent *uint32, overlapped *Overlapped) error { - err := LoadConnectEx() - if err != nil { - return errorspkg.New("failed to find ConnectEx: " + err.Error()) - } - ptr, n, err := sa.sockaddr() - if err != nil { - return err - } - return connectEx(fd, ptr, n, sendBuf, sendDataLen, bytesSent, overlapped) -} - -var sendRecvMsgFunc struct { - once sync.Once - sendAddr uintptr - recvAddr uintptr - err error -} - -func loadWSASendRecvMsg() error { - sendRecvMsgFunc.once.Do(func() { - var s Handle - s, sendRecvMsgFunc.err = Socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP) - if sendRecvMsgFunc.err != nil { - return - } - defer CloseHandle(s) - var n uint32 - sendRecvMsgFunc.err = WSAIoctl(s, - SIO_GET_EXTENSION_FUNCTION_POINTER, - (*byte)(unsafe.Pointer(&WSAID_WSARECVMSG)), - uint32(unsafe.Sizeof(WSAID_WSARECVMSG)), - (*byte)(unsafe.Pointer(&sendRecvMsgFunc.recvAddr)), - uint32(unsafe.Sizeof(sendRecvMsgFunc.recvAddr)), - &n, nil, 0) - if sendRecvMsgFunc.err != nil { - return - } - sendRecvMsgFunc.err = WSAIoctl(s, - SIO_GET_EXTENSION_FUNCTION_POINTER, - (*byte)(unsafe.Pointer(&WSAID_WSASENDMSG)), - uint32(unsafe.Sizeof(WSAID_WSASENDMSG)), - (*byte)(unsafe.Pointer(&sendRecvMsgFunc.sendAddr)), - uint32(unsafe.Sizeof(sendRecvMsgFunc.sendAddr)), - &n, nil, 0) - }) - return sendRecvMsgFunc.err -} - -func WSASendMsg(fd Handle, msg *WSAMsg, flags uint32, bytesSent *uint32, overlapped *Overlapped, croutine *byte) error { - err := loadWSASendRecvMsg() - if err != nil { - return err - } - r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.sendAddr, 6, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(flags), uintptr(unsafe.Pointer(bytesSent)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return err -} - -func WSARecvMsg(fd Handle, msg *WSAMsg, bytesReceived *uint32, overlapped *Overlapped, croutine *byte) error { - err := loadWSASendRecvMsg() - if err != nil { - return err - } - r1, _, e1 := syscall.Syscall6(sendRecvMsgFunc.recvAddr, 5, uintptr(fd), uintptr(unsafe.Pointer(msg)), uintptr(unsafe.Pointer(bytesReceived)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return err -} - -// Invented structures to support what package os expects. -type Rusage struct { - CreationTime Filetime - ExitTime Filetime - KernelTime Filetime - UserTime Filetime -} - -type WaitStatus struct { - ExitCode uint32 -} - -func (w WaitStatus) Exited() bool { return true } - -func (w WaitStatus) ExitStatus() int { return int(w.ExitCode) } - -func (w WaitStatus) Signal() Signal { return -1 } - -func (w WaitStatus) CoreDump() bool { return false } - -func (w WaitStatus) Stopped() bool { return false } - -func (w WaitStatus) Continued() bool { return false } - -func (w WaitStatus) StopSignal() Signal { return -1 } - -func (w WaitStatus) Signaled() bool { return false } - -func (w WaitStatus) TrapCause() int { return -1 } - -// Timespec is an invented structure on Windows, but here for -// consistency with the corresponding package for other operating systems. -type Timespec struct { - Sec int64 - Nsec int64 -} - -func TimespecToNsec(ts Timespec) int64 { return int64(ts.Sec)*1e9 + int64(ts.Nsec) } - -func NsecToTimespec(nsec int64) (ts Timespec) { - ts.Sec = nsec / 1e9 - ts.Nsec = nsec % 1e9 - return -} - -// TODO(brainman): fix all needed for net - -func Accept(fd Handle) (nfd Handle, sa Sockaddr, err error) { return 0, nil, syscall.EWINDOWS } -func Recvfrom(fd Handle, p []byte, flags int) (n int, from Sockaddr, err error) { - return 0, nil, syscall.EWINDOWS -} -func Sendto(fd Handle, p []byte, flags int, to Sockaddr) (err error) { return syscall.EWINDOWS } -func SetsockoptTimeval(fd Handle, level, opt int, tv *Timeval) (err error) { return syscall.EWINDOWS } - -// The Linger struct is wrong but we only noticed after Go 1. -// sysLinger is the real system call structure. - -// BUG(brainman): The definition of Linger is not appropriate for direct use -// with Setsockopt and Getsockopt. -// Use SetsockoptLinger instead. - -type Linger struct { - Onoff int32 - Linger int32 -} - -type sysLinger struct { - Onoff uint16 - Linger uint16 -} - -type IPMreq struct { - Multiaddr [4]byte /* in_addr */ - Interface [4]byte /* in_addr */ -} - -type IPv6Mreq struct { - Multiaddr [16]byte /* in6_addr */ - Interface uint32 -} - -func GetsockoptInt(fd Handle, level, opt int) (int, error) { return -1, syscall.EWINDOWS } - -func SetsockoptLinger(fd Handle, level, opt int, l *Linger) (err error) { - sys := sysLinger{Onoff: uint16(l.Onoff), Linger: uint16(l.Linger)} - return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&sys)), int32(unsafe.Sizeof(sys))) -} - -func SetsockoptInet4Addr(fd Handle, level, opt int, value [4]byte) (err error) { - return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(&value[0])), 4) -} -func SetsockoptIPMreq(fd Handle, level, opt int, mreq *IPMreq) (err error) { - return Setsockopt(fd, int32(level), int32(opt), (*byte)(unsafe.Pointer(mreq)), int32(unsafe.Sizeof(*mreq))) -} -func SetsockoptIPv6Mreq(fd Handle, level, opt int, mreq *IPv6Mreq) (err error) { - return syscall.EWINDOWS -} - -func Getpid() (pid int) { return int(getCurrentProcessId()) } - -func FindFirstFile(name *uint16, data *Win32finddata) (handle Handle, err error) { - // NOTE(rsc): The Win32finddata struct is wrong for the system call: - // the two paths are each one uint16 short. Use the correct struct, - // a win32finddata1, and then copy the results out. - // There is no loss of expressivity here, because the final - // uint16, if it is used, is supposed to be a NUL, and Go doesn't need that. - // For Go 1.1, we might avoid the allocation of win32finddata1 here - // by adding a final Bug [2]uint16 field to the struct and then - // adjusting the fields in the result directly. - var data1 win32finddata1 - handle, err = findFirstFile1(name, &data1) - if err == nil { - copyFindData(data, &data1) - } - return -} - -func FindNextFile(handle Handle, data *Win32finddata) (err error) { - var data1 win32finddata1 - err = findNextFile1(handle, &data1) - if err == nil { - copyFindData(data, &data1) - } - return -} - -func getProcessEntry(pid int) (*ProcessEntry32, error) { - snapshot, err := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0) - if err != nil { - return nil, err - } - defer CloseHandle(snapshot) - var procEntry ProcessEntry32 - procEntry.Size = uint32(unsafe.Sizeof(procEntry)) - if err = Process32First(snapshot, &procEntry); err != nil { - return nil, err - } - for { - if procEntry.ProcessID == uint32(pid) { - return &procEntry, nil - } - err = Process32Next(snapshot, &procEntry) - if err != nil { - return nil, err - } - } -} - -func Getppid() (ppid int) { - pe, err := getProcessEntry(Getpid()) - if err != nil { - return -1 - } - return int(pe.ParentProcessID) -} - -// TODO(brainman): fix all needed for os -func Fchdir(fd Handle) (err error) { return syscall.EWINDOWS } -func Link(oldpath, newpath string) (err error) { return syscall.EWINDOWS } -func Symlink(path, link string) (err error) { return syscall.EWINDOWS } - -func Fchmod(fd Handle, mode uint32) (err error) { return syscall.EWINDOWS } -func Chown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS } -func Lchown(path string, uid int, gid int) (err error) { return syscall.EWINDOWS } -func Fchown(fd Handle, uid int, gid int) (err error) { return syscall.EWINDOWS } - -func Getuid() (uid int) { return -1 } -func Geteuid() (euid int) { return -1 } -func Getgid() (gid int) { return -1 } -func Getegid() (egid int) { return -1 } -func Getgroups() (gids []int, err error) { return nil, syscall.EWINDOWS } - -type Signal int - -func (s Signal) Signal() {} - -func (s Signal) String() string { - if 0 <= s && int(s) < len(signals) { - str := signals[s] - if str != "" { - return str - } - } - return "signal " + itoa(int(s)) -} - -func LoadCreateSymbolicLink() error { - return procCreateSymbolicLinkW.Find() -} - -// Readlink returns the destination of the named symbolic link. -func Readlink(path string, buf []byte) (n int, err error) { - fd, err := CreateFile(StringToUTF16Ptr(path), GENERIC_READ, 0, nil, OPEN_EXISTING, - FILE_FLAG_OPEN_REPARSE_POINT|FILE_FLAG_BACKUP_SEMANTICS, 0) - if err != nil { - return -1, err - } - defer CloseHandle(fd) - - rdbbuf := make([]byte, MAXIMUM_REPARSE_DATA_BUFFER_SIZE) - var bytesReturned uint32 - err = DeviceIoControl(fd, FSCTL_GET_REPARSE_POINT, nil, 0, &rdbbuf[0], uint32(len(rdbbuf)), &bytesReturned, nil) - if err != nil { - return -1, err - } - - rdb := (*reparseDataBuffer)(unsafe.Pointer(&rdbbuf[0])) - var s string - switch rdb.ReparseTag { - case IO_REPARSE_TAG_SYMLINK: - data := (*symbolicLinkReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer)) - p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0])) - s = UTF16ToString(p[data.PrintNameOffset/2 : (data.PrintNameLength-data.PrintNameOffset)/2]) - case IO_REPARSE_TAG_MOUNT_POINT: - data := (*mountPointReparseBuffer)(unsafe.Pointer(&rdb.reparseBuffer)) - p := (*[0xffff]uint16)(unsafe.Pointer(&data.PathBuffer[0])) - s = UTF16ToString(p[data.PrintNameOffset/2 : (data.PrintNameLength-data.PrintNameOffset)/2]) - default: - // the path is not a symlink or junction but another type of reparse - // point - return -1, syscall.ENOENT - } - n = copy(buf, []byte(s)) - - return n, nil -} diff --git a/vendor/golang.org/x/sys/windows/syscall_windows_test.go b/vendor/golang.org/x/sys/windows/syscall_windows_test.go deleted file mode 100644 index 9c7133c..0000000 --- a/vendor/golang.org/x/sys/windows/syscall_windows_test.go +++ /dev/null @@ -1,107 +0,0 @@ -// Copyright 2012 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows_test - -import ( - "io/ioutil" - "os" - "path/filepath" - "syscall" - "testing" - "unsafe" - - "golang.org/x/sys/windows" -) - -func TestWin32finddata(t *testing.T) { - dir, err := ioutil.TempDir("", "go-build") - if err != nil { - t.Fatalf("failed to create temp directory: %v", err) - } - defer os.RemoveAll(dir) - - path := filepath.Join(dir, "long_name.and_extension") - f, err := os.Create(path) - if err != nil { - t.Fatalf("failed to create %v: %v", path, err) - } - f.Close() - - type X struct { - fd windows.Win32finddata - got byte - pad [10]byte // to protect ourselves - - } - var want byte = 2 // it is unlikely to have this character in the filename - x := X{got: want} - - pathp, _ := windows.UTF16PtrFromString(path) - h, err := windows.FindFirstFile(pathp, &(x.fd)) - if err != nil { - t.Fatalf("FindFirstFile failed: %v", err) - } - err = windows.FindClose(h) - if err != nil { - t.Fatalf("FindClose failed: %v", err) - } - - if x.got != want { - t.Fatalf("memory corruption: want=%d got=%d", want, x.got) - } -} - -func TestFormatMessage(t *testing.T) { - dll := windows.MustLoadDLL("pdh.dll") - - pdhOpenQuery := func(datasrc *uint16, userdata uint32, query *windows.Handle) (errno uintptr) { - r0, _, _ := syscall.Syscall(dll.MustFindProc("PdhOpenQueryW").Addr(), 3, uintptr(unsafe.Pointer(datasrc)), uintptr(userdata), uintptr(unsafe.Pointer(query))) - return r0 - } - - pdhCloseQuery := func(query windows.Handle) (errno uintptr) { - r0, _, _ := syscall.Syscall(dll.MustFindProc("PdhCloseQuery").Addr(), 1, uintptr(query), 0, 0) - return r0 - } - - var q windows.Handle - name, err := windows.UTF16PtrFromString("no_such_source") - if err != nil { - t.Fatal(err) - } - errno := pdhOpenQuery(name, 0, &q) - if errno == 0 { - pdhCloseQuery(q) - t.Fatal("PdhOpenQuery succeeded, but expected to fail.") - } - - const flags uint32 = syscall.FORMAT_MESSAGE_FROM_HMODULE | syscall.FORMAT_MESSAGE_ARGUMENT_ARRAY | syscall.FORMAT_MESSAGE_IGNORE_INSERTS - buf := make([]uint16, 300) - _, err = windows.FormatMessage(flags, uintptr(dll.Handle), uint32(errno), 0, buf, nil) - if err != nil { - t.Fatalf("FormatMessage for handle=%x and errno=%x failed: %v", dll.Handle, errno, err) - } -} - -func abort(funcname string, err error) { - panic(funcname + " failed: " + err.Error()) -} - -func ExampleLoadLibrary() { - h, err := windows.LoadLibrary("kernel32.dll") - if err != nil { - abort("LoadLibrary", err) - } - defer windows.FreeLibrary(h) - proc, err := windows.GetProcAddress(h, "GetVersion") - if err != nil { - abort("GetProcAddress", err) - } - r, _, _ := syscall.Syscall(uintptr(proc), 0, 0, 0, 0) - major := byte(r) - minor := uint8(r >> 8) - build := uint16(r >> 16) - print("windows version ", major, ".", minor, " (Build ", build, ")\n") -} diff --git a/vendor/golang.org/x/sys/windows/types_windows.go b/vendor/golang.org/x/sys/windows/types_windows.go deleted file mode 100644 index 52c2037..0000000 --- a/vendor/golang.org/x/sys/windows/types_windows.go +++ /dev/null @@ -1,1333 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -import "syscall" - -const ( - // Windows errors. - ERROR_FILE_NOT_FOUND syscall.Errno = 2 - ERROR_PATH_NOT_FOUND syscall.Errno = 3 - ERROR_ACCESS_DENIED syscall.Errno = 5 - ERROR_NO_MORE_FILES syscall.Errno = 18 - ERROR_HANDLE_EOF syscall.Errno = 38 - ERROR_NETNAME_DELETED syscall.Errno = 64 - ERROR_FILE_EXISTS syscall.Errno = 80 - ERROR_BROKEN_PIPE syscall.Errno = 109 - ERROR_BUFFER_OVERFLOW syscall.Errno = 111 - ERROR_INSUFFICIENT_BUFFER syscall.Errno = 122 - ERROR_MOD_NOT_FOUND syscall.Errno = 126 - ERROR_PROC_NOT_FOUND syscall.Errno = 127 - ERROR_ALREADY_EXISTS syscall.Errno = 183 - ERROR_ENVVAR_NOT_FOUND syscall.Errno = 203 - ERROR_MORE_DATA syscall.Errno = 234 - ERROR_OPERATION_ABORTED syscall.Errno = 995 - ERROR_IO_PENDING syscall.Errno = 997 - ERROR_SERVICE_SPECIFIC_ERROR syscall.Errno = 1066 - ERROR_NOT_FOUND syscall.Errno = 1168 - ERROR_PRIVILEGE_NOT_HELD syscall.Errno = 1314 - WSAEACCES syscall.Errno = 10013 - WSAEMSGSIZE syscall.Errno = 10040 - WSAECONNRESET syscall.Errno = 10054 -) - -const ( - // Invented values to support what package os expects. - O_RDONLY = 0x00000 - O_WRONLY = 0x00001 - O_RDWR = 0x00002 - O_CREAT = 0x00040 - O_EXCL = 0x00080 - O_NOCTTY = 0x00100 - O_TRUNC = 0x00200 - O_NONBLOCK = 0x00800 - O_APPEND = 0x00400 - O_SYNC = 0x01000 - O_ASYNC = 0x02000 - O_CLOEXEC = 0x80000 -) - -const ( - // More invented values for signals - SIGHUP = Signal(0x1) - SIGINT = Signal(0x2) - SIGQUIT = Signal(0x3) - SIGILL = Signal(0x4) - SIGTRAP = Signal(0x5) - SIGABRT = Signal(0x6) - SIGBUS = Signal(0x7) - SIGFPE = Signal(0x8) - SIGKILL = Signal(0x9) - SIGSEGV = Signal(0xb) - SIGPIPE = Signal(0xd) - SIGALRM = Signal(0xe) - SIGTERM = Signal(0xf) -) - -var signals = [...]string{ - 1: "hangup", - 2: "interrupt", - 3: "quit", - 4: "illegal instruction", - 5: "trace/breakpoint trap", - 6: "aborted", - 7: "bus error", - 8: "floating point exception", - 9: "killed", - 10: "user defined signal 1", - 11: "segmentation fault", - 12: "user defined signal 2", - 13: "broken pipe", - 14: "alarm clock", - 15: "terminated", -} - -const ( - GENERIC_READ = 0x80000000 - GENERIC_WRITE = 0x40000000 - GENERIC_EXECUTE = 0x20000000 - GENERIC_ALL = 0x10000000 - - FILE_LIST_DIRECTORY = 0x00000001 - FILE_APPEND_DATA = 0x00000004 - FILE_WRITE_ATTRIBUTES = 0x00000100 - - FILE_SHARE_READ = 0x00000001 - FILE_SHARE_WRITE = 0x00000002 - FILE_SHARE_DELETE = 0x00000004 - FILE_ATTRIBUTE_READONLY = 0x00000001 - FILE_ATTRIBUTE_HIDDEN = 0x00000002 - FILE_ATTRIBUTE_SYSTEM = 0x00000004 - FILE_ATTRIBUTE_DIRECTORY = 0x00000010 - FILE_ATTRIBUTE_ARCHIVE = 0x00000020 - FILE_ATTRIBUTE_NORMAL = 0x00000080 - FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400 - - INVALID_FILE_ATTRIBUTES = 0xffffffff - - CREATE_NEW = 1 - CREATE_ALWAYS = 2 - OPEN_EXISTING = 3 - OPEN_ALWAYS = 4 - TRUNCATE_EXISTING = 5 - - FILE_FLAG_OPEN_REPARSE_POINT = 0x00200000 - FILE_FLAG_BACKUP_SEMANTICS = 0x02000000 - FILE_FLAG_OVERLAPPED = 0x40000000 - - HANDLE_FLAG_INHERIT = 0x00000001 - STARTF_USESTDHANDLES = 0x00000100 - STARTF_USESHOWWINDOW = 0x00000001 - DUPLICATE_CLOSE_SOURCE = 0x00000001 - DUPLICATE_SAME_ACCESS = 0x00000002 - - STD_INPUT_HANDLE = -10 & (1<<32 - 1) - STD_OUTPUT_HANDLE = -11 & (1<<32 - 1) - STD_ERROR_HANDLE = -12 & (1<<32 - 1) - - FILE_BEGIN = 0 - FILE_CURRENT = 1 - FILE_END = 2 - - LANG_ENGLISH = 0x09 - SUBLANG_ENGLISH_US = 0x01 - - FORMAT_MESSAGE_ALLOCATE_BUFFER = 256 - FORMAT_MESSAGE_IGNORE_INSERTS = 512 - FORMAT_MESSAGE_FROM_STRING = 1024 - FORMAT_MESSAGE_FROM_HMODULE = 2048 - FORMAT_MESSAGE_FROM_SYSTEM = 4096 - FORMAT_MESSAGE_ARGUMENT_ARRAY = 8192 - FORMAT_MESSAGE_MAX_WIDTH_MASK = 255 - - MAX_PATH = 260 - MAX_LONG_PATH = 32768 - - MAX_COMPUTERNAME_LENGTH = 15 - - TIME_ZONE_ID_UNKNOWN = 0 - TIME_ZONE_ID_STANDARD = 1 - - TIME_ZONE_ID_DAYLIGHT = 2 - IGNORE = 0 - INFINITE = 0xffffffff - - WAIT_TIMEOUT = 258 - WAIT_ABANDONED = 0x00000080 - WAIT_OBJECT_0 = 0x00000000 - WAIT_FAILED = 0xFFFFFFFF - - PROCESS_TERMINATE = 1 - PROCESS_QUERY_INFORMATION = 0x00000400 - SYNCHRONIZE = 0x00100000 - - FILE_MAP_COPY = 0x01 - FILE_MAP_WRITE = 0x02 - FILE_MAP_READ = 0x04 - FILE_MAP_EXECUTE = 0x20 - - CTRL_C_EVENT = 0 - CTRL_BREAK_EVENT = 1 - - // Windows reserves errors >= 1<<29 for application use. - APPLICATION_ERROR = 1 << 29 -) - -const ( - // Process creation flags. - CREATE_BREAKAWAY_FROM_JOB = 0x01000000 - CREATE_DEFAULT_ERROR_MODE = 0x04000000 - CREATE_NEW_CONSOLE = 0x00000010 - CREATE_NEW_PROCESS_GROUP = 0x00000200 - CREATE_NO_WINDOW = 0x08000000 - CREATE_PROTECTED_PROCESS = 0x00040000 - CREATE_PRESERVE_CODE_AUTHZ_LEVEL = 0x02000000 - CREATE_SEPARATE_WOW_VDM = 0x00000800 - CREATE_SHARED_WOW_VDM = 0x00001000 - CREATE_SUSPENDED = 0x00000004 - CREATE_UNICODE_ENVIRONMENT = 0x00000400 - DEBUG_ONLY_THIS_PROCESS = 0x00000002 - DEBUG_PROCESS = 0x00000001 - DETACHED_PROCESS = 0x00000008 - EXTENDED_STARTUPINFO_PRESENT = 0x00080000 - INHERIT_PARENT_AFFINITY = 0x00010000 -) - -const ( - // flags for CreateToolhelp32Snapshot - TH32CS_SNAPHEAPLIST = 0x01 - TH32CS_SNAPPROCESS = 0x02 - TH32CS_SNAPTHREAD = 0x04 - TH32CS_SNAPMODULE = 0x08 - TH32CS_SNAPMODULE32 = 0x10 - TH32CS_SNAPALL = TH32CS_SNAPHEAPLIST | TH32CS_SNAPMODULE | TH32CS_SNAPPROCESS | TH32CS_SNAPTHREAD - TH32CS_INHERIT = 0x80000000 -) - -const ( - // filters for ReadDirectoryChangesW - FILE_NOTIFY_CHANGE_FILE_NAME = 0x001 - FILE_NOTIFY_CHANGE_DIR_NAME = 0x002 - FILE_NOTIFY_CHANGE_ATTRIBUTES = 0x004 - FILE_NOTIFY_CHANGE_SIZE = 0x008 - FILE_NOTIFY_CHANGE_LAST_WRITE = 0x010 - FILE_NOTIFY_CHANGE_LAST_ACCESS = 0x020 - FILE_NOTIFY_CHANGE_CREATION = 0x040 - FILE_NOTIFY_CHANGE_SECURITY = 0x100 -) - -const ( - // do not reorder - FILE_ACTION_ADDED = iota + 1 - FILE_ACTION_REMOVED - FILE_ACTION_MODIFIED - FILE_ACTION_RENAMED_OLD_NAME - FILE_ACTION_RENAMED_NEW_NAME -) - -const ( - // wincrypt.h - PROV_RSA_FULL = 1 - PROV_RSA_SIG = 2 - PROV_DSS = 3 - PROV_FORTEZZA = 4 - PROV_MS_EXCHANGE = 5 - PROV_SSL = 6 - PROV_RSA_SCHANNEL = 12 - PROV_DSS_DH = 13 - PROV_EC_ECDSA_SIG = 14 - PROV_EC_ECNRA_SIG = 15 - PROV_EC_ECDSA_FULL = 16 - PROV_EC_ECNRA_FULL = 17 - PROV_DH_SCHANNEL = 18 - PROV_SPYRUS_LYNKS = 20 - PROV_RNG = 21 - PROV_INTEL_SEC = 22 - PROV_REPLACE_OWF = 23 - PROV_RSA_AES = 24 - CRYPT_VERIFYCONTEXT = 0xF0000000 - CRYPT_NEWKEYSET = 0x00000008 - CRYPT_DELETEKEYSET = 0x00000010 - CRYPT_MACHINE_KEYSET = 0x00000020 - CRYPT_SILENT = 0x00000040 - CRYPT_DEFAULT_CONTAINER_OPTIONAL = 0x00000080 - - USAGE_MATCH_TYPE_AND = 0 - USAGE_MATCH_TYPE_OR = 1 - - X509_ASN_ENCODING = 0x00000001 - PKCS_7_ASN_ENCODING = 0x00010000 - - CERT_STORE_PROV_MEMORY = 2 - - CERT_STORE_ADD_ALWAYS = 4 - - CERT_STORE_DEFER_CLOSE_UNTIL_LAST_FREE_FLAG = 0x00000004 - - CERT_TRUST_NO_ERROR = 0x00000000 - CERT_TRUST_IS_NOT_TIME_VALID = 0x00000001 - CERT_TRUST_IS_REVOKED = 0x00000004 - CERT_TRUST_IS_NOT_SIGNATURE_VALID = 0x00000008 - CERT_TRUST_IS_NOT_VALID_FOR_USAGE = 0x00000010 - CERT_TRUST_IS_UNTRUSTED_ROOT = 0x00000020 - CERT_TRUST_REVOCATION_STATUS_UNKNOWN = 0x00000040 - CERT_TRUST_IS_CYCLIC = 0x00000080 - CERT_TRUST_INVALID_EXTENSION = 0x00000100 - CERT_TRUST_INVALID_POLICY_CONSTRAINTS = 0x00000200 - CERT_TRUST_INVALID_BASIC_CONSTRAINTS = 0x00000400 - CERT_TRUST_INVALID_NAME_CONSTRAINTS = 0x00000800 - CERT_TRUST_HAS_NOT_SUPPORTED_NAME_CONSTRAINT = 0x00001000 - CERT_TRUST_HAS_NOT_DEFINED_NAME_CONSTRAINT = 0x00002000 - CERT_TRUST_HAS_NOT_PERMITTED_NAME_CONSTRAINT = 0x00004000 - CERT_TRUST_HAS_EXCLUDED_NAME_CONSTRAINT = 0x00008000 - CERT_TRUST_IS_OFFLINE_REVOCATION = 0x01000000 - CERT_TRUST_NO_ISSUANCE_CHAIN_POLICY = 0x02000000 - CERT_TRUST_IS_EXPLICIT_DISTRUST = 0x04000000 - CERT_TRUST_HAS_NOT_SUPPORTED_CRITICAL_EXT = 0x08000000 - - CERT_CHAIN_POLICY_BASE = 1 - CERT_CHAIN_POLICY_AUTHENTICODE = 2 - CERT_CHAIN_POLICY_AUTHENTICODE_TS = 3 - CERT_CHAIN_POLICY_SSL = 4 - CERT_CHAIN_POLICY_BASIC_CONSTRAINTS = 5 - CERT_CHAIN_POLICY_NT_AUTH = 6 - CERT_CHAIN_POLICY_MICROSOFT_ROOT = 7 - CERT_CHAIN_POLICY_EV = 8 - - CERT_E_EXPIRED = 0x800B0101 - CERT_E_ROLE = 0x800B0103 - CERT_E_PURPOSE = 0x800B0106 - CERT_E_UNTRUSTEDROOT = 0x800B0109 - CERT_E_CN_NO_MATCH = 0x800B010F - - AUTHTYPE_CLIENT = 1 - AUTHTYPE_SERVER = 2 -) - -var ( - OID_PKIX_KP_SERVER_AUTH = []byte("1.3.6.1.5.5.7.3.1\x00") - OID_SERVER_GATED_CRYPTO = []byte("1.3.6.1.4.1.311.10.3.3\x00") - OID_SGC_NETSCAPE = []byte("2.16.840.1.113730.4.1\x00") -) - -// Invented values to support what package os expects. -type Timeval struct { - Sec int32 - Usec int32 -} - -func (tv *Timeval) Nanoseconds() int64 { - return (int64(tv.Sec)*1e6 + int64(tv.Usec)) * 1e3 -} - -func NsecToTimeval(nsec int64) (tv Timeval) { - tv.Sec = int32(nsec / 1e9) - tv.Usec = int32(nsec % 1e9 / 1e3) - return -} - -type SecurityAttributes struct { - Length uint32 - SecurityDescriptor uintptr - InheritHandle uint32 -} - -type Overlapped struct { - Internal uintptr - InternalHigh uintptr - Offset uint32 - OffsetHigh uint32 - HEvent Handle -} - -type FileNotifyInformation struct { - NextEntryOffset uint32 - Action uint32 - FileNameLength uint32 - FileName uint16 -} - -type Filetime struct { - LowDateTime uint32 - HighDateTime uint32 -} - -// Nanoseconds returns Filetime ft in nanoseconds -// since Epoch (00:00:00 UTC, January 1, 1970). -func (ft *Filetime) Nanoseconds() int64 { - // 100-nanosecond intervals since January 1, 1601 - nsec := int64(ft.HighDateTime)<<32 + int64(ft.LowDateTime) - // change starting time to the Epoch (00:00:00 UTC, January 1, 1970) - nsec -= 116444736000000000 - // convert into nanoseconds - nsec *= 100 - return nsec -} - -func NsecToFiletime(nsec int64) (ft Filetime) { - // convert into 100-nanosecond - nsec /= 100 - // change starting time to January 1, 1601 - nsec += 116444736000000000 - // split into high / low - ft.LowDateTime = uint32(nsec & 0xffffffff) - ft.HighDateTime = uint32(nsec >> 32 & 0xffffffff) - return ft -} - -type Win32finddata struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - FileSizeHigh uint32 - FileSizeLow uint32 - Reserved0 uint32 - Reserved1 uint32 - FileName [MAX_PATH - 1]uint16 - AlternateFileName [13]uint16 -} - -// This is the actual system call structure. -// Win32finddata is what we committed to in Go 1. -type win32finddata1 struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - FileSizeHigh uint32 - FileSizeLow uint32 - Reserved0 uint32 - Reserved1 uint32 - FileName [MAX_PATH]uint16 - AlternateFileName [14]uint16 -} - -func copyFindData(dst *Win32finddata, src *win32finddata1) { - dst.FileAttributes = src.FileAttributes - dst.CreationTime = src.CreationTime - dst.LastAccessTime = src.LastAccessTime - dst.LastWriteTime = src.LastWriteTime - dst.FileSizeHigh = src.FileSizeHigh - dst.FileSizeLow = src.FileSizeLow - dst.Reserved0 = src.Reserved0 - dst.Reserved1 = src.Reserved1 - - // The src is 1 element bigger than dst, but it must be NUL. - copy(dst.FileName[:], src.FileName[:]) - copy(dst.AlternateFileName[:], src.AlternateFileName[:]) -} - -type ByHandleFileInformation struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - VolumeSerialNumber uint32 - FileSizeHigh uint32 - FileSizeLow uint32 - NumberOfLinks uint32 - FileIndexHigh uint32 - FileIndexLow uint32 -} - -const ( - GetFileExInfoStandard = 0 - GetFileExMaxInfoLevel = 1 -) - -type Win32FileAttributeData struct { - FileAttributes uint32 - CreationTime Filetime - LastAccessTime Filetime - LastWriteTime Filetime - FileSizeHigh uint32 - FileSizeLow uint32 -} - -// ShowWindow constants -const ( - // winuser.h - SW_HIDE = 0 - SW_NORMAL = 1 - SW_SHOWNORMAL = 1 - SW_SHOWMINIMIZED = 2 - SW_SHOWMAXIMIZED = 3 - SW_MAXIMIZE = 3 - SW_SHOWNOACTIVATE = 4 - SW_SHOW = 5 - SW_MINIMIZE = 6 - SW_SHOWMINNOACTIVE = 7 - SW_SHOWNA = 8 - SW_RESTORE = 9 - SW_SHOWDEFAULT = 10 - SW_FORCEMINIMIZE = 11 -) - -type StartupInfo struct { - Cb uint32 - _ *uint16 - Desktop *uint16 - Title *uint16 - X uint32 - Y uint32 - XSize uint32 - YSize uint32 - XCountChars uint32 - YCountChars uint32 - FillAttribute uint32 - Flags uint32 - ShowWindow uint16 - _ uint16 - _ *byte - StdInput Handle - StdOutput Handle - StdErr Handle -} - -type ProcessInformation struct { - Process Handle - Thread Handle - ProcessId uint32 - ThreadId uint32 -} - -type ProcessEntry32 struct { - Size uint32 - Usage uint32 - ProcessID uint32 - DefaultHeapID uintptr - ModuleID uint32 - Threads uint32 - ParentProcessID uint32 - PriClassBase int32 - Flags uint32 - ExeFile [MAX_PATH]uint16 -} - -type Systemtime struct { - Year uint16 - Month uint16 - DayOfWeek uint16 - Day uint16 - Hour uint16 - Minute uint16 - Second uint16 - Milliseconds uint16 -} - -type Timezoneinformation struct { - Bias int32 - StandardName [32]uint16 - StandardDate Systemtime - StandardBias int32 - DaylightName [32]uint16 - DaylightDate Systemtime - DaylightBias int32 -} - -// Socket related. - -const ( - AF_UNSPEC = 0 - AF_UNIX = 1 - AF_INET = 2 - AF_INET6 = 23 - AF_NETBIOS = 17 - - SOCK_STREAM = 1 - SOCK_DGRAM = 2 - SOCK_RAW = 3 - SOCK_SEQPACKET = 5 - - IPPROTO_IP = 0 - IPPROTO_IPV6 = 0x29 - IPPROTO_TCP = 6 - IPPROTO_UDP = 17 - - SOL_SOCKET = 0xffff - SO_REUSEADDR = 4 - SO_KEEPALIVE = 8 - SO_DONTROUTE = 16 - SO_BROADCAST = 32 - SO_LINGER = 128 - SO_RCVBUF = 0x1002 - SO_SNDBUF = 0x1001 - SO_UPDATE_ACCEPT_CONTEXT = 0x700b - SO_UPDATE_CONNECT_CONTEXT = 0x7010 - - IOC_OUT = 0x40000000 - IOC_IN = 0x80000000 - IOC_VENDOR = 0x18000000 - IOC_INOUT = IOC_IN | IOC_OUT - IOC_WS2 = 0x08000000 - SIO_GET_EXTENSION_FUNCTION_POINTER = IOC_INOUT | IOC_WS2 | 6 - SIO_KEEPALIVE_VALS = IOC_IN | IOC_VENDOR | 4 - SIO_UDP_CONNRESET = IOC_IN | IOC_VENDOR | 12 - - // cf. http://support.microsoft.com/default.aspx?scid=kb;en-us;257460 - - IP_TOS = 0x3 - IP_TTL = 0x4 - IP_MULTICAST_IF = 0x9 - IP_MULTICAST_TTL = 0xa - IP_MULTICAST_LOOP = 0xb - IP_ADD_MEMBERSHIP = 0xc - IP_DROP_MEMBERSHIP = 0xd - - IPV6_V6ONLY = 0x1b - IPV6_UNICAST_HOPS = 0x4 - IPV6_MULTICAST_IF = 0x9 - IPV6_MULTICAST_HOPS = 0xa - IPV6_MULTICAST_LOOP = 0xb - IPV6_JOIN_GROUP = 0xc - IPV6_LEAVE_GROUP = 0xd - - MSG_OOB = 0x1 - MSG_PEEK = 0x2 - MSG_DONTROUTE = 0x4 - MSG_WAITALL = 0x8 - - MSG_TRUNC = 0x0100 - MSG_CTRUNC = 0x0200 - MSG_BCAST = 0x0400 - MSG_MCAST = 0x0800 - - SOMAXCONN = 0x7fffffff - - TCP_NODELAY = 1 - - SHUT_RD = 0 - SHUT_WR = 1 - SHUT_RDWR = 2 - - WSADESCRIPTION_LEN = 256 - WSASYS_STATUS_LEN = 128 -) - -type WSABuf struct { - Len uint32 - Buf *byte -} - -type WSAMsg struct { - Name *syscall.RawSockaddrAny - Namelen int32 - Buffers *WSABuf - BufferCount uint32 - Control WSABuf - Flags uint32 -} - -// Invented values to support what package os expects. -const ( - S_IFMT = 0x1f000 - S_IFIFO = 0x1000 - S_IFCHR = 0x2000 - S_IFDIR = 0x4000 - S_IFBLK = 0x6000 - S_IFREG = 0x8000 - S_IFLNK = 0xa000 - S_IFSOCK = 0xc000 - S_ISUID = 0x800 - S_ISGID = 0x400 - S_ISVTX = 0x200 - S_IRUSR = 0x100 - S_IWRITE = 0x80 - S_IWUSR = 0x80 - S_IXUSR = 0x40 -) - -const ( - FILE_TYPE_CHAR = 0x0002 - FILE_TYPE_DISK = 0x0001 - FILE_TYPE_PIPE = 0x0003 - FILE_TYPE_REMOTE = 0x8000 - FILE_TYPE_UNKNOWN = 0x0000 -) - -type Hostent struct { - Name *byte - Aliases **byte - AddrType uint16 - Length uint16 - AddrList **byte -} - -type Protoent struct { - Name *byte - Aliases **byte - Proto uint16 -} - -const ( - DNS_TYPE_A = 0x0001 - DNS_TYPE_NS = 0x0002 - DNS_TYPE_MD = 0x0003 - DNS_TYPE_MF = 0x0004 - DNS_TYPE_CNAME = 0x0005 - DNS_TYPE_SOA = 0x0006 - DNS_TYPE_MB = 0x0007 - DNS_TYPE_MG = 0x0008 - DNS_TYPE_MR = 0x0009 - DNS_TYPE_NULL = 0x000a - DNS_TYPE_WKS = 0x000b - DNS_TYPE_PTR = 0x000c - DNS_TYPE_HINFO = 0x000d - DNS_TYPE_MINFO = 0x000e - DNS_TYPE_MX = 0x000f - DNS_TYPE_TEXT = 0x0010 - DNS_TYPE_RP = 0x0011 - DNS_TYPE_AFSDB = 0x0012 - DNS_TYPE_X25 = 0x0013 - DNS_TYPE_ISDN = 0x0014 - DNS_TYPE_RT = 0x0015 - DNS_TYPE_NSAP = 0x0016 - DNS_TYPE_NSAPPTR = 0x0017 - DNS_TYPE_SIG = 0x0018 - DNS_TYPE_KEY = 0x0019 - DNS_TYPE_PX = 0x001a - DNS_TYPE_GPOS = 0x001b - DNS_TYPE_AAAA = 0x001c - DNS_TYPE_LOC = 0x001d - DNS_TYPE_NXT = 0x001e - DNS_TYPE_EID = 0x001f - DNS_TYPE_NIMLOC = 0x0020 - DNS_TYPE_SRV = 0x0021 - DNS_TYPE_ATMA = 0x0022 - DNS_TYPE_NAPTR = 0x0023 - DNS_TYPE_KX = 0x0024 - DNS_TYPE_CERT = 0x0025 - DNS_TYPE_A6 = 0x0026 - DNS_TYPE_DNAME = 0x0027 - DNS_TYPE_SINK = 0x0028 - DNS_TYPE_OPT = 0x0029 - DNS_TYPE_DS = 0x002B - DNS_TYPE_RRSIG = 0x002E - DNS_TYPE_NSEC = 0x002F - DNS_TYPE_DNSKEY = 0x0030 - DNS_TYPE_DHCID = 0x0031 - DNS_TYPE_UINFO = 0x0064 - DNS_TYPE_UID = 0x0065 - DNS_TYPE_GID = 0x0066 - DNS_TYPE_UNSPEC = 0x0067 - DNS_TYPE_ADDRS = 0x00f8 - DNS_TYPE_TKEY = 0x00f9 - DNS_TYPE_TSIG = 0x00fa - DNS_TYPE_IXFR = 0x00fb - DNS_TYPE_AXFR = 0x00fc - DNS_TYPE_MAILB = 0x00fd - DNS_TYPE_MAILA = 0x00fe - DNS_TYPE_ALL = 0x00ff - DNS_TYPE_ANY = 0x00ff - DNS_TYPE_WINS = 0xff01 - DNS_TYPE_WINSR = 0xff02 - DNS_TYPE_NBSTAT = 0xff01 -) - -const ( - DNS_INFO_NO_RECORDS = 0x251D -) - -const ( - // flags inside DNSRecord.Dw - DnsSectionQuestion = 0x0000 - DnsSectionAnswer = 0x0001 - DnsSectionAuthority = 0x0002 - DnsSectionAdditional = 0x0003 -) - -type DNSSRVData struct { - Target *uint16 - Priority uint16 - Weight uint16 - Port uint16 - Pad uint16 -} - -type DNSPTRData struct { - Host *uint16 -} - -type DNSMXData struct { - NameExchange *uint16 - Preference uint16 - Pad uint16 -} - -type DNSTXTData struct { - StringCount uint16 - StringArray [1]*uint16 -} - -type DNSRecord struct { - Next *DNSRecord - Name *uint16 - Type uint16 - Length uint16 - Dw uint32 - Ttl uint32 - Reserved uint32 - Data [40]byte -} - -const ( - TF_DISCONNECT = 1 - TF_REUSE_SOCKET = 2 - TF_WRITE_BEHIND = 4 - TF_USE_DEFAULT_WORKER = 0 - TF_USE_SYSTEM_THREAD = 16 - TF_USE_KERNEL_APC = 32 -) - -type TransmitFileBuffers struct { - Head uintptr - HeadLength uint32 - Tail uintptr - TailLength uint32 -} - -const ( - IFF_UP = 1 - IFF_BROADCAST = 2 - IFF_LOOPBACK = 4 - IFF_POINTTOPOINT = 8 - IFF_MULTICAST = 16 -) - -const SIO_GET_INTERFACE_LIST = 0x4004747F - -// TODO(mattn): SockaddrGen is union of sockaddr/sockaddr_in/sockaddr_in6_old. -// will be fixed to change variable type as suitable. - -type SockaddrGen [24]byte - -type InterfaceInfo struct { - Flags uint32 - Address SockaddrGen - BroadcastAddress SockaddrGen - Netmask SockaddrGen -} - -type IpAddressString struct { - String [16]byte -} - -type IpMaskString IpAddressString - -type IpAddrString struct { - Next *IpAddrString - IpAddress IpAddressString - IpMask IpMaskString - Context uint32 -} - -const MAX_ADAPTER_NAME_LENGTH = 256 -const MAX_ADAPTER_DESCRIPTION_LENGTH = 128 -const MAX_ADAPTER_ADDRESS_LENGTH = 8 - -type IpAdapterInfo struct { - Next *IpAdapterInfo - ComboIndex uint32 - AdapterName [MAX_ADAPTER_NAME_LENGTH + 4]byte - Description [MAX_ADAPTER_DESCRIPTION_LENGTH + 4]byte - AddressLength uint32 - Address [MAX_ADAPTER_ADDRESS_LENGTH]byte - Index uint32 - Type uint32 - DhcpEnabled uint32 - CurrentIpAddress *IpAddrString - IpAddressList IpAddrString - GatewayList IpAddrString - DhcpServer IpAddrString - HaveWins bool - PrimaryWinsServer IpAddrString - SecondaryWinsServer IpAddrString - LeaseObtained int64 - LeaseExpires int64 -} - -const MAXLEN_PHYSADDR = 8 -const MAX_INTERFACE_NAME_LEN = 256 -const MAXLEN_IFDESCR = 256 - -type MibIfRow struct { - Name [MAX_INTERFACE_NAME_LEN]uint16 - Index uint32 - Type uint32 - Mtu uint32 - Speed uint32 - PhysAddrLen uint32 - PhysAddr [MAXLEN_PHYSADDR]byte - AdminStatus uint32 - OperStatus uint32 - LastChange uint32 - InOctets uint32 - InUcastPkts uint32 - InNUcastPkts uint32 - InDiscards uint32 - InErrors uint32 - InUnknownProtos uint32 - OutOctets uint32 - OutUcastPkts uint32 - OutNUcastPkts uint32 - OutDiscards uint32 - OutErrors uint32 - OutQLen uint32 - DescrLen uint32 - Descr [MAXLEN_IFDESCR]byte -} - -type CertContext struct { - EncodingType uint32 - EncodedCert *byte - Length uint32 - CertInfo uintptr - Store Handle -} - -type CertChainContext struct { - Size uint32 - TrustStatus CertTrustStatus - ChainCount uint32 - Chains **CertSimpleChain - LowerQualityChainCount uint32 - LowerQualityChains **CertChainContext - HasRevocationFreshnessTime uint32 - RevocationFreshnessTime uint32 -} - -type CertSimpleChain struct { - Size uint32 - TrustStatus CertTrustStatus - NumElements uint32 - Elements **CertChainElement - TrustListInfo uintptr - HasRevocationFreshnessTime uint32 - RevocationFreshnessTime uint32 -} - -type CertChainElement struct { - Size uint32 - CertContext *CertContext - TrustStatus CertTrustStatus - RevocationInfo *CertRevocationInfo - IssuanceUsage *CertEnhKeyUsage - ApplicationUsage *CertEnhKeyUsage - ExtendedErrorInfo *uint16 -} - -type CertRevocationInfo struct { - Size uint32 - RevocationResult uint32 - RevocationOid *byte - OidSpecificInfo uintptr - HasFreshnessTime uint32 - FreshnessTime uint32 - CrlInfo uintptr // *CertRevocationCrlInfo -} - -type CertTrustStatus struct { - ErrorStatus uint32 - InfoStatus uint32 -} - -type CertUsageMatch struct { - Type uint32 - Usage CertEnhKeyUsage -} - -type CertEnhKeyUsage struct { - Length uint32 - UsageIdentifiers **byte -} - -type CertChainPara struct { - Size uint32 - RequestedUsage CertUsageMatch - RequstedIssuancePolicy CertUsageMatch - URLRetrievalTimeout uint32 - CheckRevocationFreshnessTime uint32 - RevocationFreshnessTime uint32 - CacheResync *Filetime -} - -type CertChainPolicyPara struct { - Size uint32 - Flags uint32 - ExtraPolicyPara uintptr -} - -type SSLExtraCertChainPolicyPara struct { - Size uint32 - AuthType uint32 - Checks uint32 - ServerName *uint16 -} - -type CertChainPolicyStatus struct { - Size uint32 - Error uint32 - ChainIndex uint32 - ElementIndex uint32 - ExtraPolicyStatus uintptr -} - -const ( - // do not reorder - HKEY_CLASSES_ROOT = 0x80000000 + iota - HKEY_CURRENT_USER - HKEY_LOCAL_MACHINE - HKEY_USERS - HKEY_PERFORMANCE_DATA - HKEY_CURRENT_CONFIG - HKEY_DYN_DATA - - KEY_QUERY_VALUE = 1 - KEY_SET_VALUE = 2 - KEY_CREATE_SUB_KEY = 4 - KEY_ENUMERATE_SUB_KEYS = 8 - KEY_NOTIFY = 16 - KEY_CREATE_LINK = 32 - KEY_WRITE = 0x20006 - KEY_EXECUTE = 0x20019 - KEY_READ = 0x20019 - KEY_WOW64_64KEY = 0x0100 - KEY_WOW64_32KEY = 0x0200 - KEY_ALL_ACCESS = 0xf003f -) - -const ( - // do not reorder - REG_NONE = iota - REG_SZ - REG_EXPAND_SZ - REG_BINARY - REG_DWORD_LITTLE_ENDIAN - REG_DWORD_BIG_ENDIAN - REG_LINK - REG_MULTI_SZ - REG_RESOURCE_LIST - REG_FULL_RESOURCE_DESCRIPTOR - REG_RESOURCE_REQUIREMENTS_LIST - REG_QWORD_LITTLE_ENDIAN - REG_DWORD = REG_DWORD_LITTLE_ENDIAN - REG_QWORD = REG_QWORD_LITTLE_ENDIAN -) - -type AddrinfoW struct { - Flags int32 - Family int32 - Socktype int32 - Protocol int32 - Addrlen uintptr - Canonname *uint16 - Addr uintptr - Next *AddrinfoW -} - -const ( - AI_PASSIVE = 1 - AI_CANONNAME = 2 - AI_NUMERICHOST = 4 -) - -type GUID struct { - Data1 uint32 - Data2 uint16 - Data3 uint16 - Data4 [8]byte -} - -var WSAID_CONNECTEX = GUID{ - 0x25a207b9, - 0xddf3, - 0x4660, - [8]byte{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}, -} - -var WSAID_WSASENDMSG = GUID{ - 0xa441e712, - 0x754f, - 0x43ca, - [8]byte{0x84, 0xa7, 0x0d, 0xee, 0x44, 0xcf, 0x60, 0x6d}, -} - -var WSAID_WSARECVMSG = GUID{ - 0xf689d7c8, - 0x6f1f, - 0x436b, - [8]byte{0x8a, 0x53, 0xe5, 0x4f, 0xe3, 0x51, 0xc3, 0x22}, -} - -const ( - FILE_SKIP_COMPLETION_PORT_ON_SUCCESS = 1 - FILE_SKIP_SET_EVENT_ON_HANDLE = 2 -) - -const ( - WSAPROTOCOL_LEN = 255 - MAX_PROTOCOL_CHAIN = 7 - BASE_PROTOCOL = 1 - LAYERED_PROTOCOL = 0 - - XP1_CONNECTIONLESS = 0x00000001 - XP1_GUARANTEED_DELIVERY = 0x00000002 - XP1_GUARANTEED_ORDER = 0x00000004 - XP1_MESSAGE_ORIENTED = 0x00000008 - XP1_PSEUDO_STREAM = 0x00000010 - XP1_GRACEFUL_CLOSE = 0x00000020 - XP1_EXPEDITED_DATA = 0x00000040 - XP1_CONNECT_DATA = 0x00000080 - XP1_DISCONNECT_DATA = 0x00000100 - XP1_SUPPORT_BROADCAST = 0x00000200 - XP1_SUPPORT_MULTIPOINT = 0x00000400 - XP1_MULTIPOINT_CONTROL_PLANE = 0x00000800 - XP1_MULTIPOINT_DATA_PLANE = 0x00001000 - XP1_QOS_SUPPORTED = 0x00002000 - XP1_UNI_SEND = 0x00008000 - XP1_UNI_RECV = 0x00010000 - XP1_IFS_HANDLES = 0x00020000 - XP1_PARTIAL_MESSAGE = 0x00040000 - XP1_SAN_SUPPORT_SDP = 0x00080000 - - PFL_MULTIPLE_PROTO_ENTRIES = 0x00000001 - PFL_RECOMMENDED_PROTO_ENTRY = 0x00000002 - PFL_HIDDEN = 0x00000004 - PFL_MATCHES_PROTOCOL_ZERO = 0x00000008 - PFL_NETWORKDIRECT_PROVIDER = 0x00000010 -) - -type WSAProtocolInfo struct { - ServiceFlags1 uint32 - ServiceFlags2 uint32 - ServiceFlags3 uint32 - ServiceFlags4 uint32 - ProviderFlags uint32 - ProviderId GUID - CatalogEntryId uint32 - ProtocolChain WSAProtocolChain - Version int32 - AddressFamily int32 - MaxSockAddr int32 - MinSockAddr int32 - SocketType int32 - Protocol int32 - ProtocolMaxOffset int32 - NetworkByteOrder int32 - SecurityScheme int32 - MessageSize uint32 - ProviderReserved uint32 - ProtocolName [WSAPROTOCOL_LEN + 1]uint16 -} - -type WSAProtocolChain struct { - ChainLen int32 - ChainEntries [MAX_PROTOCOL_CHAIN]uint32 -} - -type TCPKeepalive struct { - OnOff uint32 - Time uint32 - Interval uint32 -} - -type symbolicLinkReparseBuffer struct { - SubstituteNameOffset uint16 - SubstituteNameLength uint16 - PrintNameOffset uint16 - PrintNameLength uint16 - Flags uint32 - PathBuffer [1]uint16 -} - -type mountPointReparseBuffer struct { - SubstituteNameOffset uint16 - SubstituteNameLength uint16 - PrintNameOffset uint16 - PrintNameLength uint16 - PathBuffer [1]uint16 -} - -type reparseDataBuffer struct { - ReparseTag uint32 - ReparseDataLength uint16 - Reserved uint16 - - // GenericReparseBuffer - reparseBuffer byte -} - -const ( - FSCTL_GET_REPARSE_POINT = 0x900A8 - MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024 - IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003 - IO_REPARSE_TAG_SYMLINK = 0xA000000C - SYMBOLIC_LINK_FLAG_DIRECTORY = 0x1 -) - -const ( - ComputerNameNetBIOS = 0 - ComputerNameDnsHostname = 1 - ComputerNameDnsDomain = 2 - ComputerNameDnsFullyQualified = 3 - ComputerNamePhysicalNetBIOS = 4 - ComputerNamePhysicalDnsHostname = 5 - ComputerNamePhysicalDnsDomain = 6 - ComputerNamePhysicalDnsFullyQualified = 7 - ComputerNameMax = 8 -) - -const ( - MOVEFILE_REPLACE_EXISTING = 0x1 - MOVEFILE_COPY_ALLOWED = 0x2 - MOVEFILE_DELAY_UNTIL_REBOOT = 0x4 - MOVEFILE_WRITE_THROUGH = 0x8 - MOVEFILE_CREATE_HARDLINK = 0x10 - MOVEFILE_FAIL_IF_NOT_TRACKABLE = 0x20 -) - -const GAA_FLAG_INCLUDE_PREFIX = 0x00000010 - -const ( - IF_TYPE_OTHER = 1 - IF_TYPE_ETHERNET_CSMACD = 6 - IF_TYPE_ISO88025_TOKENRING = 9 - IF_TYPE_PPP = 23 - IF_TYPE_SOFTWARE_LOOPBACK = 24 - IF_TYPE_ATM = 37 - IF_TYPE_IEEE80211 = 71 - IF_TYPE_TUNNEL = 131 - IF_TYPE_IEEE1394 = 144 -) - -type SocketAddress struct { - Sockaddr *syscall.RawSockaddrAny - SockaddrLength int32 -} - -type IpAdapterUnicastAddress struct { - Length uint32 - Flags uint32 - Next *IpAdapterUnicastAddress - Address SocketAddress - PrefixOrigin int32 - SuffixOrigin int32 - DadState int32 - ValidLifetime uint32 - PreferredLifetime uint32 - LeaseLifetime uint32 - OnLinkPrefixLength uint8 -} - -type IpAdapterAnycastAddress struct { - Length uint32 - Flags uint32 - Next *IpAdapterAnycastAddress - Address SocketAddress -} - -type IpAdapterMulticastAddress struct { - Length uint32 - Flags uint32 - Next *IpAdapterMulticastAddress - Address SocketAddress -} - -type IpAdapterDnsServerAdapter struct { - Length uint32 - Reserved uint32 - Next *IpAdapterDnsServerAdapter - Address SocketAddress -} - -type IpAdapterPrefix struct { - Length uint32 - Flags uint32 - Next *IpAdapterPrefix - Address SocketAddress - PrefixLength uint32 -} - -type IpAdapterAddresses struct { - Length uint32 - IfIndex uint32 - Next *IpAdapterAddresses - AdapterName *byte - FirstUnicastAddress *IpAdapterUnicastAddress - FirstAnycastAddress *IpAdapterAnycastAddress - FirstMulticastAddress *IpAdapterMulticastAddress - FirstDnsServerAddress *IpAdapterDnsServerAdapter - DnsSuffix *uint16 - Description *uint16 - FriendlyName *uint16 - PhysicalAddress [syscall.MAX_ADAPTER_ADDRESS_LENGTH]byte - PhysicalAddressLength uint32 - Flags uint32 - Mtu uint32 - IfType uint32 - OperStatus uint32 - Ipv6IfIndex uint32 - ZoneIndices [16]uint32 - FirstPrefix *IpAdapterPrefix - /* more fields might be present here. */ -} - -const ( - IfOperStatusUp = 1 - IfOperStatusDown = 2 - IfOperStatusTesting = 3 - IfOperStatusUnknown = 4 - IfOperStatusDormant = 5 - IfOperStatusNotPresent = 6 - IfOperStatusLowerLayerDown = 7 -) - -// Console related constants used for the mode parameter to SetConsoleMode. See -// https://docs.microsoft.com/en-us/windows/console/setconsolemode for details. - -const ( - ENABLE_PROCESSED_INPUT = 0x1 - ENABLE_LINE_INPUT = 0x2 - ENABLE_ECHO_INPUT = 0x4 - ENABLE_WINDOW_INPUT = 0x8 - ENABLE_MOUSE_INPUT = 0x10 - ENABLE_INSERT_MODE = 0x20 - ENABLE_QUICK_EDIT_MODE = 0x40 - ENABLE_EXTENDED_FLAGS = 0x80 - ENABLE_AUTO_POSITION = 0x100 - ENABLE_VIRTUAL_TERMINAL_INPUT = 0x200 - - ENABLE_PROCESSED_OUTPUT = 0x1 - ENABLE_WRAP_AT_EOL_OUTPUT = 0x2 - ENABLE_VIRTUAL_TERMINAL_PROCESSING = 0x4 - DISABLE_NEWLINE_AUTO_RETURN = 0x8 - ENABLE_LVB_GRID_WORLDWIDE = 0x10 -) - -type Coord struct { - X int16 - Y int16 -} - -type SmallRect struct { - Left int16 - Top int16 - Right int16 - Bottom int16 -} - -// Used with GetConsoleScreenBuffer to retreive information about a console -// screen buffer. See -// https://docs.microsoft.com/en-us/windows/console/console-screen-buffer-info-str -// for details. - -type ConsoleScreenBufferInfo struct { - Size Coord - CursorPosition Coord - Attributes uint16 - Window SmallRect - MaximumWindowSize Coord -} diff --git a/vendor/golang.org/x/sys/windows/types_windows_386.go b/vendor/golang.org/x/sys/windows/types_windows_386.go deleted file mode 100644 index fe0ddd0..0000000 --- a/vendor/golang.org/x/sys/windows/types_windows_386.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -type WSAData struct { - Version uint16 - HighVersion uint16 - Description [WSADESCRIPTION_LEN + 1]byte - SystemStatus [WSASYS_STATUS_LEN + 1]byte - MaxSockets uint16 - MaxUdpDg uint16 - VendorInfo *byte -} - -type Servent struct { - Name *byte - Aliases **byte - Port uint16 - Proto *byte -} diff --git a/vendor/golang.org/x/sys/windows/types_windows_amd64.go b/vendor/golang.org/x/sys/windows/types_windows_amd64.go deleted file mode 100644 index 7e154c2..0000000 --- a/vendor/golang.org/x/sys/windows/types_windows_amd64.go +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package windows - -type WSAData struct { - Version uint16 - HighVersion uint16 - MaxSockets uint16 - MaxUdpDg uint16 - VendorInfo *byte - Description [WSADESCRIPTION_LEN + 1]byte - SystemStatus [WSASYS_STATUS_LEN + 1]byte -} - -type Servent struct { - Name *byte - Aliases **byte - Proto *byte - Port uint16 -} diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go deleted file mode 100644 index c7b3b15..0000000 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ /dev/null @@ -1,2687 +0,0 @@ -// MACHINE GENERATED BY 'go generate' COMMAND; DO NOT EDIT - -package windows - -import ( - "syscall" - "unsafe" -) - -var _ unsafe.Pointer - -// Do the interface allocations only once for common -// Errno values. -const ( - errnoERROR_IO_PENDING = 997 -) - -var ( - errERROR_IO_PENDING error = syscall.Errno(errnoERROR_IO_PENDING) -) - -// errnoErr returns common boxed Errno values, to prevent -// allocations at runtime. -func errnoErr(e syscall.Errno) error { - switch e { - case 0: - return nil - case errnoERROR_IO_PENDING: - return errERROR_IO_PENDING - } - // TODO: add more here, after collecting data on the common - // error values see on Windows. (perhaps when running - // all.bat?) - return e -} - -var ( - modadvapi32 = NewLazySystemDLL("advapi32.dll") - modkernel32 = NewLazySystemDLL("kernel32.dll") - modshell32 = NewLazySystemDLL("shell32.dll") - modmswsock = NewLazySystemDLL("mswsock.dll") - modcrypt32 = NewLazySystemDLL("crypt32.dll") - modws2_32 = NewLazySystemDLL("ws2_32.dll") - moddnsapi = NewLazySystemDLL("dnsapi.dll") - modiphlpapi = NewLazySystemDLL("iphlpapi.dll") - modsecur32 = NewLazySystemDLL("secur32.dll") - modnetapi32 = NewLazySystemDLL("netapi32.dll") - moduserenv = NewLazySystemDLL("userenv.dll") - - procRegisterEventSourceW = modadvapi32.NewProc("RegisterEventSourceW") - procDeregisterEventSource = modadvapi32.NewProc("DeregisterEventSource") - procReportEventW = modadvapi32.NewProc("ReportEventW") - procOpenSCManagerW = modadvapi32.NewProc("OpenSCManagerW") - procCloseServiceHandle = modadvapi32.NewProc("CloseServiceHandle") - procCreateServiceW = modadvapi32.NewProc("CreateServiceW") - procOpenServiceW = modadvapi32.NewProc("OpenServiceW") - procDeleteService = modadvapi32.NewProc("DeleteService") - procStartServiceW = modadvapi32.NewProc("StartServiceW") - procQueryServiceStatus = modadvapi32.NewProc("QueryServiceStatus") - procControlService = modadvapi32.NewProc("ControlService") - procStartServiceCtrlDispatcherW = modadvapi32.NewProc("StartServiceCtrlDispatcherW") - procSetServiceStatus = modadvapi32.NewProc("SetServiceStatus") - procChangeServiceConfigW = modadvapi32.NewProc("ChangeServiceConfigW") - procQueryServiceConfigW = modadvapi32.NewProc("QueryServiceConfigW") - procChangeServiceConfig2W = modadvapi32.NewProc("ChangeServiceConfig2W") - procQueryServiceConfig2W = modadvapi32.NewProc("QueryServiceConfig2W") - procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") - procGetLastError = modkernel32.NewProc("GetLastError") - procLoadLibraryW = modkernel32.NewProc("LoadLibraryW") - procLoadLibraryExW = modkernel32.NewProc("LoadLibraryExW") - procFreeLibrary = modkernel32.NewProc("FreeLibrary") - procGetProcAddress = modkernel32.NewProc("GetProcAddress") - procGetVersion = modkernel32.NewProc("GetVersion") - procFormatMessageW = modkernel32.NewProc("FormatMessageW") - procExitProcess = modkernel32.NewProc("ExitProcess") - procCreateFileW = modkernel32.NewProc("CreateFileW") - procReadFile = modkernel32.NewProc("ReadFile") - procWriteFile = modkernel32.NewProc("WriteFile") - procSetFilePointer = modkernel32.NewProc("SetFilePointer") - procCloseHandle = modkernel32.NewProc("CloseHandle") - procGetStdHandle = modkernel32.NewProc("GetStdHandle") - procSetStdHandle = modkernel32.NewProc("SetStdHandle") - procFindFirstFileW = modkernel32.NewProc("FindFirstFileW") - procFindNextFileW = modkernel32.NewProc("FindNextFileW") - procFindClose = modkernel32.NewProc("FindClose") - procGetFileInformationByHandle = modkernel32.NewProc("GetFileInformationByHandle") - procGetCurrentDirectoryW = modkernel32.NewProc("GetCurrentDirectoryW") - procSetCurrentDirectoryW = modkernel32.NewProc("SetCurrentDirectoryW") - procCreateDirectoryW = modkernel32.NewProc("CreateDirectoryW") - procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW") - procDeleteFileW = modkernel32.NewProc("DeleteFileW") - procMoveFileW = modkernel32.NewProc("MoveFileW") - procMoveFileExW = modkernel32.NewProc("MoveFileExW") - procGetComputerNameW = modkernel32.NewProc("GetComputerNameW") - procGetComputerNameExW = modkernel32.NewProc("GetComputerNameExW") - procSetEndOfFile = modkernel32.NewProc("SetEndOfFile") - procGetSystemTimeAsFileTime = modkernel32.NewProc("GetSystemTimeAsFileTime") - procGetSystemTimePreciseAsFileTime = modkernel32.NewProc("GetSystemTimePreciseAsFileTime") - procGetTimeZoneInformation = modkernel32.NewProc("GetTimeZoneInformation") - procCreateIoCompletionPort = modkernel32.NewProc("CreateIoCompletionPort") - procGetQueuedCompletionStatus = modkernel32.NewProc("GetQueuedCompletionStatus") - procPostQueuedCompletionStatus = modkernel32.NewProc("PostQueuedCompletionStatus") - procCancelIo = modkernel32.NewProc("CancelIo") - procCancelIoEx = modkernel32.NewProc("CancelIoEx") - procCreateProcessW = modkernel32.NewProc("CreateProcessW") - procOpenProcess = modkernel32.NewProc("OpenProcess") - procTerminateProcess = modkernel32.NewProc("TerminateProcess") - procGetExitCodeProcess = modkernel32.NewProc("GetExitCodeProcess") - procGetStartupInfoW = modkernel32.NewProc("GetStartupInfoW") - procGetCurrentProcess = modkernel32.NewProc("GetCurrentProcess") - procGetProcessTimes = modkernel32.NewProc("GetProcessTimes") - procDuplicateHandle = modkernel32.NewProc("DuplicateHandle") - procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject") - procGetTempPathW = modkernel32.NewProc("GetTempPathW") - procCreatePipe = modkernel32.NewProc("CreatePipe") - procGetFileType = modkernel32.NewProc("GetFileType") - procCryptAcquireContextW = modadvapi32.NewProc("CryptAcquireContextW") - procCryptReleaseContext = modadvapi32.NewProc("CryptReleaseContext") - procCryptGenRandom = modadvapi32.NewProc("CryptGenRandom") - procGetEnvironmentStringsW = modkernel32.NewProc("GetEnvironmentStringsW") - procFreeEnvironmentStringsW = modkernel32.NewProc("FreeEnvironmentStringsW") - procGetEnvironmentVariableW = modkernel32.NewProc("GetEnvironmentVariableW") - procSetEnvironmentVariableW = modkernel32.NewProc("SetEnvironmentVariableW") - procSetFileTime = modkernel32.NewProc("SetFileTime") - procGetFileAttributesW = modkernel32.NewProc("GetFileAttributesW") - procSetFileAttributesW = modkernel32.NewProc("SetFileAttributesW") - procGetFileAttributesExW = modkernel32.NewProc("GetFileAttributesExW") - procGetCommandLineW = modkernel32.NewProc("GetCommandLineW") - procCommandLineToArgvW = modshell32.NewProc("CommandLineToArgvW") - procLocalFree = modkernel32.NewProc("LocalFree") - procSetHandleInformation = modkernel32.NewProc("SetHandleInformation") - procFlushFileBuffers = modkernel32.NewProc("FlushFileBuffers") - procGetFullPathNameW = modkernel32.NewProc("GetFullPathNameW") - procGetLongPathNameW = modkernel32.NewProc("GetLongPathNameW") - procGetShortPathNameW = modkernel32.NewProc("GetShortPathNameW") - procCreateFileMappingW = modkernel32.NewProc("CreateFileMappingW") - procMapViewOfFile = modkernel32.NewProc("MapViewOfFile") - procUnmapViewOfFile = modkernel32.NewProc("UnmapViewOfFile") - procFlushViewOfFile = modkernel32.NewProc("FlushViewOfFile") - procVirtualLock = modkernel32.NewProc("VirtualLock") - procVirtualUnlock = modkernel32.NewProc("VirtualUnlock") - procVirtualAlloc = modkernel32.NewProc("VirtualAlloc") - procVirtualFree = modkernel32.NewProc("VirtualFree") - procVirtualProtect = modkernel32.NewProc("VirtualProtect") - procTransmitFile = modmswsock.NewProc("TransmitFile") - procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW") - procCertOpenSystemStoreW = modcrypt32.NewProc("CertOpenSystemStoreW") - procCertOpenStore = modcrypt32.NewProc("CertOpenStore") - procCertEnumCertificatesInStore = modcrypt32.NewProc("CertEnumCertificatesInStore") - procCertAddCertificateContextToStore = modcrypt32.NewProc("CertAddCertificateContextToStore") - procCertCloseStore = modcrypt32.NewProc("CertCloseStore") - procCertGetCertificateChain = modcrypt32.NewProc("CertGetCertificateChain") - procCertFreeCertificateChain = modcrypt32.NewProc("CertFreeCertificateChain") - procCertCreateCertificateContext = modcrypt32.NewProc("CertCreateCertificateContext") - procCertFreeCertificateContext = modcrypt32.NewProc("CertFreeCertificateContext") - procCertVerifyCertificateChainPolicy = modcrypt32.NewProc("CertVerifyCertificateChainPolicy") - procRegOpenKeyExW = modadvapi32.NewProc("RegOpenKeyExW") - procRegCloseKey = modadvapi32.NewProc("RegCloseKey") - procRegQueryInfoKeyW = modadvapi32.NewProc("RegQueryInfoKeyW") - procRegEnumKeyExW = modadvapi32.NewProc("RegEnumKeyExW") - procRegQueryValueExW = modadvapi32.NewProc("RegQueryValueExW") - procGetCurrentProcessId = modkernel32.NewProc("GetCurrentProcessId") - procGetConsoleMode = modkernel32.NewProc("GetConsoleMode") - procSetConsoleMode = modkernel32.NewProc("SetConsoleMode") - procGetConsoleScreenBufferInfo = modkernel32.NewProc("GetConsoleScreenBufferInfo") - procWriteConsoleW = modkernel32.NewProc("WriteConsoleW") - procReadConsoleW = modkernel32.NewProc("ReadConsoleW") - procCreateToolhelp32Snapshot = modkernel32.NewProc("CreateToolhelp32Snapshot") - procProcess32FirstW = modkernel32.NewProc("Process32FirstW") - procProcess32NextW = modkernel32.NewProc("Process32NextW") - procDeviceIoControl = modkernel32.NewProc("DeviceIoControl") - procCreateSymbolicLinkW = modkernel32.NewProc("CreateSymbolicLinkW") - procCreateHardLinkW = modkernel32.NewProc("CreateHardLinkW") - procGetCurrentThreadId = modkernel32.NewProc("GetCurrentThreadId") - procCreateEventW = modkernel32.NewProc("CreateEventW") - procCreateEventExW = modkernel32.NewProc("CreateEventExW") - procOpenEventW = modkernel32.NewProc("OpenEventW") - procSetEvent = modkernel32.NewProc("SetEvent") - procResetEvent = modkernel32.NewProc("ResetEvent") - procPulseEvent = modkernel32.NewProc("PulseEvent") - procDefineDosDeviceW = modkernel32.NewProc("DefineDosDeviceW") - procDeleteVolumeMountPointW = modkernel32.NewProc("DeleteVolumeMountPointW") - procFindFirstVolumeW = modkernel32.NewProc("FindFirstVolumeW") - procFindFirstVolumeMountPointW = modkernel32.NewProc("FindFirstVolumeMountPointW") - procFindNextVolumeW = modkernel32.NewProc("FindNextVolumeW") - procFindNextVolumeMountPointW = modkernel32.NewProc("FindNextVolumeMountPointW") - procFindVolumeClose = modkernel32.NewProc("FindVolumeClose") - procFindVolumeMountPointClose = modkernel32.NewProc("FindVolumeMountPointClose") - procGetDriveTypeW = modkernel32.NewProc("GetDriveTypeW") - procGetLogicalDrives = modkernel32.NewProc("GetLogicalDrives") - procGetLogicalDriveStringsW = modkernel32.NewProc("GetLogicalDriveStringsW") - procGetVolumeInformationW = modkernel32.NewProc("GetVolumeInformationW") - procGetVolumeInformationByHandleW = modkernel32.NewProc("GetVolumeInformationByHandleW") - procGetVolumeNameForVolumeMountPointW = modkernel32.NewProc("GetVolumeNameForVolumeMountPointW") - procGetVolumePathNameW = modkernel32.NewProc("GetVolumePathNameW") - procGetVolumePathNamesForVolumeNameW = modkernel32.NewProc("GetVolumePathNamesForVolumeNameW") - procQueryDosDeviceW = modkernel32.NewProc("QueryDosDeviceW") - procSetVolumeLabelW = modkernel32.NewProc("SetVolumeLabelW") - procSetVolumeMountPointW = modkernel32.NewProc("SetVolumeMountPointW") - procWSAStartup = modws2_32.NewProc("WSAStartup") - procWSACleanup = modws2_32.NewProc("WSACleanup") - procWSAIoctl = modws2_32.NewProc("WSAIoctl") - procsocket = modws2_32.NewProc("socket") - procsetsockopt = modws2_32.NewProc("setsockopt") - procgetsockopt = modws2_32.NewProc("getsockopt") - procbind = modws2_32.NewProc("bind") - procconnect = modws2_32.NewProc("connect") - procgetsockname = modws2_32.NewProc("getsockname") - procgetpeername = modws2_32.NewProc("getpeername") - proclisten = modws2_32.NewProc("listen") - procshutdown = modws2_32.NewProc("shutdown") - procclosesocket = modws2_32.NewProc("closesocket") - procAcceptEx = modmswsock.NewProc("AcceptEx") - procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs") - procWSARecv = modws2_32.NewProc("WSARecv") - procWSASend = modws2_32.NewProc("WSASend") - procWSARecvFrom = modws2_32.NewProc("WSARecvFrom") - procWSASendTo = modws2_32.NewProc("WSASendTo") - procgethostbyname = modws2_32.NewProc("gethostbyname") - procgetservbyname = modws2_32.NewProc("getservbyname") - procntohs = modws2_32.NewProc("ntohs") - procgetprotobyname = modws2_32.NewProc("getprotobyname") - procDnsQuery_W = moddnsapi.NewProc("DnsQuery_W") - procDnsRecordListFree = moddnsapi.NewProc("DnsRecordListFree") - procDnsNameCompare_W = moddnsapi.NewProc("DnsNameCompare_W") - procGetAddrInfoW = modws2_32.NewProc("GetAddrInfoW") - procFreeAddrInfoW = modws2_32.NewProc("FreeAddrInfoW") - procGetIfEntry = modiphlpapi.NewProc("GetIfEntry") - procGetAdaptersInfo = modiphlpapi.NewProc("GetAdaptersInfo") - procSetFileCompletionNotificationModes = modkernel32.NewProc("SetFileCompletionNotificationModes") - procWSAEnumProtocolsW = modws2_32.NewProc("WSAEnumProtocolsW") - procGetAdaptersAddresses = modiphlpapi.NewProc("GetAdaptersAddresses") - procGetACP = modkernel32.NewProc("GetACP") - procMultiByteToWideChar = modkernel32.NewProc("MultiByteToWideChar") - procTranslateNameW = modsecur32.NewProc("TranslateNameW") - procGetUserNameExW = modsecur32.NewProc("GetUserNameExW") - procNetUserGetInfo = modnetapi32.NewProc("NetUserGetInfo") - procNetGetJoinInformation = modnetapi32.NewProc("NetGetJoinInformation") - procNetApiBufferFree = modnetapi32.NewProc("NetApiBufferFree") - procLookupAccountSidW = modadvapi32.NewProc("LookupAccountSidW") - procLookupAccountNameW = modadvapi32.NewProc("LookupAccountNameW") - procConvertSidToStringSidW = modadvapi32.NewProc("ConvertSidToStringSidW") - procConvertStringSidToSidW = modadvapi32.NewProc("ConvertStringSidToSidW") - procGetLengthSid = modadvapi32.NewProc("GetLengthSid") - procCopySid = modadvapi32.NewProc("CopySid") - procAllocateAndInitializeSid = modadvapi32.NewProc("AllocateAndInitializeSid") - procFreeSid = modadvapi32.NewProc("FreeSid") - procEqualSid = modadvapi32.NewProc("EqualSid") - procCheckTokenMembership = modadvapi32.NewProc("CheckTokenMembership") - procOpenProcessToken = modadvapi32.NewProc("OpenProcessToken") - procGetTokenInformation = modadvapi32.NewProc("GetTokenInformation") - procGetUserProfileDirectoryW = moduserenv.NewProc("GetUserProfileDirectoryW") -) - -func RegisterEventSource(uncServerName *uint16, sourceName *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procRegisterEventSourceW.Addr(), 2, uintptr(unsafe.Pointer(uncServerName)), uintptr(unsafe.Pointer(sourceName)), 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DeregisterEventSource(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeregisterEventSource.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ReportEvent(log Handle, etype uint16, category uint16, eventId uint32, usrSId uintptr, numStrings uint16, dataSize uint32, strings **uint16, rawData *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procReportEventW.Addr(), 9, uintptr(log), uintptr(etype), uintptr(category), uintptr(eventId), uintptr(usrSId), uintptr(numStrings), uintptr(dataSize), uintptr(unsafe.Pointer(strings)), uintptr(unsafe.Pointer(rawData))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenSCManager(machineName *uint16, databaseName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenSCManagerW.Addr(), 3, uintptr(unsafe.Pointer(machineName)), uintptr(unsafe.Pointer(databaseName)), uintptr(access)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CloseServiceHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseServiceHandle.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateService(mgr Handle, serviceName *uint16, displayName *uint16, access uint32, srvType uint32, startType uint32, errCtl uint32, pathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall15(procCreateServiceW.Addr(), 13, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(unsafe.Pointer(displayName)), uintptr(access), uintptr(srvType), uintptr(startType), uintptr(errCtl), uintptr(unsafe.Pointer(pathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenService(mgr Handle, serviceName *uint16, access uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procOpenServiceW.Addr(), 3, uintptr(mgr), uintptr(unsafe.Pointer(serviceName)), uintptr(access)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DeleteService(service Handle) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteService.Addr(), 1, uintptr(service), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func StartService(service Handle, numArgs uint32, argVectors **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceW.Addr(), 3, uintptr(service), uintptr(numArgs), uintptr(unsafe.Pointer(argVectors))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func QueryServiceStatus(service Handle, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procQueryServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(status)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ControlService(service Handle, control uint32, status *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procControlService.Addr(), 3, uintptr(service), uintptr(control), uintptr(unsafe.Pointer(status))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func StartServiceCtrlDispatcher(serviceTable *SERVICE_TABLE_ENTRY) (err error) { - r1, _, e1 := syscall.Syscall(procStartServiceCtrlDispatcherW.Addr(), 1, uintptr(unsafe.Pointer(serviceTable)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetServiceStatus(service Handle, serviceStatus *SERVICE_STATUS) (err error) { - r1, _, e1 := syscall.Syscall(procSetServiceStatus.Addr(), 2, uintptr(service), uintptr(unsafe.Pointer(serviceStatus)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ChangeServiceConfig(service Handle, serviceType uint32, startType uint32, errorControl uint32, binaryPathName *uint16, loadOrderGroup *uint16, tagId *uint32, dependencies *uint16, serviceStartName *uint16, password *uint16, displayName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procChangeServiceConfigW.Addr(), 11, uintptr(service), uintptr(serviceType), uintptr(startType), uintptr(errorControl), uintptr(unsafe.Pointer(binaryPathName)), uintptr(unsafe.Pointer(loadOrderGroup)), uintptr(unsafe.Pointer(tagId)), uintptr(unsafe.Pointer(dependencies)), uintptr(unsafe.Pointer(serviceStartName)), uintptr(unsafe.Pointer(password)), uintptr(unsafe.Pointer(displayName)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func QueryServiceConfig(service Handle, serviceConfig *QUERY_SERVICE_CONFIG, bufSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfigW.Addr(), 4, uintptr(service), uintptr(unsafe.Pointer(serviceConfig)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ChangeServiceConfig2(service Handle, infoLevel uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procChangeServiceConfig2W.Addr(), 3, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(info))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func QueryServiceConfig2(service Handle, infoLevel uint32, buff *byte, buffSize uint32, bytesNeeded *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procQueryServiceConfig2W.Addr(), 5, uintptr(service), uintptr(infoLevel), uintptr(unsafe.Pointer(buff)), uintptr(buffSize), uintptr(unsafe.Pointer(bytesNeeded)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func EnumServicesStatusEx(mgr Handle, infoLevel uint32, serviceType uint32, serviceState uint32, services *byte, bufSize uint32, bytesNeeded *uint32, servicesReturned *uint32, resumeHandle *uint32, groupName *uint16) (err error) { - r1, _, e1 := syscall.Syscall12(procEnumServicesStatusExW.Addr(), 10, uintptr(mgr), uintptr(infoLevel), uintptr(serviceType), uintptr(serviceState), uintptr(unsafe.Pointer(services)), uintptr(bufSize), uintptr(unsafe.Pointer(bytesNeeded)), uintptr(unsafe.Pointer(servicesReturned)), uintptr(unsafe.Pointer(resumeHandle)), uintptr(unsafe.Pointer(groupName)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetLastError() (lasterr error) { - r0, _, _ := syscall.Syscall(procGetLastError.Addr(), 0, 0, 0, 0) - if r0 != 0 { - lasterr = syscall.Errno(r0) - } - return -} - -func LoadLibrary(libname string) (handle Handle, err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(libname) - if err != nil { - return - } - return _LoadLibrary(_p0) -} - -func _LoadLibrary(libname *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryW.Addr(), 1, uintptr(unsafe.Pointer(libname)), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func LoadLibraryEx(libname string, zero Handle, flags uintptr) (handle Handle, err error) { - var _p0 *uint16 - _p0, err = syscall.UTF16PtrFromString(libname) - if err != nil { - return - } - return _LoadLibraryEx(_p0, zero, flags) -} - -func _LoadLibraryEx(libname *uint16, zero Handle, flags uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLoadLibraryExW.Addr(), 3, uintptr(unsafe.Pointer(libname)), uintptr(zero), uintptr(flags)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FreeLibrary(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFreeLibrary.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetProcAddress(module Handle, procname string) (proc uintptr, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(procname) - if err != nil { - return - } - return _GetProcAddress(module, _p0) -} - -func _GetProcAddress(module Handle, procname *byte) (proc uintptr, err error) { - r0, _, e1 := syscall.Syscall(procGetProcAddress.Addr(), 2, uintptr(module), uintptr(unsafe.Pointer(procname)), 0) - proc = uintptr(r0) - if proc == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVersion() (ver uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetVersion.Addr(), 0, 0, 0, 0) - ver = uint32(r0) - if ver == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FormatMessage(flags uint32, msgsrc uintptr, msgid uint32, langid uint32, buf []uint16, args *byte) (n uint32, err error) { - var _p0 *uint16 - if len(buf) > 0 { - _p0 = &buf[0] - } - r0, _, e1 := syscall.Syscall9(procFormatMessageW.Addr(), 7, uintptr(flags), uintptr(msgsrc), uintptr(msgid), uintptr(langid), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(args)), 0, 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ExitProcess(exitcode uint32) { - syscall.Syscall(procExitProcess.Addr(), 1, uintptr(exitcode), 0, 0) - return -} - -func CreateFile(name *uint16, access uint32, mode uint32, sa *SecurityAttributes, createmode uint32, attrs uint32, templatefile int32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall9(procCreateFileW.Addr(), 7, uintptr(unsafe.Pointer(name)), uintptr(access), uintptr(mode), uintptr(unsafe.Pointer(sa)), uintptr(createmode), uintptr(attrs), uintptr(templatefile), 0, 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r1, _, e1 := syscall.Syscall6(procReadFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (err error) { - var _p0 *byte - if len(buf) > 0 { - _p0 = &buf[0] - } - r1, _, e1 := syscall.Syscall6(procWriteFile.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(_p0)), uintptr(len(buf)), uintptr(unsafe.Pointer(done)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetFilePointer(handle Handle, lowoffset int32, highoffsetptr *int32, whence uint32) (newlowoffset uint32, err error) { - r0, _, e1 := syscall.Syscall6(procSetFilePointer.Addr(), 4, uintptr(handle), uintptr(lowoffset), uintptr(unsafe.Pointer(highoffsetptr)), uintptr(whence), 0, 0) - newlowoffset = uint32(r0) - if newlowoffset == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CloseHandle(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCloseHandle.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetStdHandle(stdhandle uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetStdHandle.Addr(), 1, uintptr(stdhandle), 0, 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetStdHandle(stdhandle uint32, handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetStdHandle.Addr(), 2, uintptr(stdhandle), uintptr(handle), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func findFirstFile1(name *uint16, data *win32finddata1) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstFileW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(data)), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func findNextFile1(handle Handle, data *win32finddata1) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextFileW.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindClose(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindClose.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetFileInformationByHandle(handle Handle, data *ByHandleFileInformation) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileInformationByHandle.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(data)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetCurrentDirectory(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentDirectoryW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetCurrentDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetCurrentDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateDirectory(path *uint16, sa *SecurityAttributes) (err error) { - r1, _, e1 := syscall.Syscall(procCreateDirectoryW.Addr(), 2, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(sa)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func RemoveDirectory(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procRemoveDirectoryW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DeleteFile(path *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteFileW.Addr(), 1, uintptr(unsafe.Pointer(path)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func MoveFile(from *uint16, to *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileW.Addr(), 2, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func MoveFileEx(from *uint16, to *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procMoveFileExW.Addr(), 3, uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(to)), uintptr(flags)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetComputerName(buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameW.Addr(), 2, uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetComputerNameEx(nametype uint32, buf *uint16, n *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetComputerNameExW.Addr(), 3, uintptr(nametype), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(n))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetEndOfFile(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEndOfFile.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetSystemTimeAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimeAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) - return -} - -func GetSystemTimePreciseAsFileTime(time *Filetime) { - syscall.Syscall(procGetSystemTimePreciseAsFileTime.Addr(), 1, uintptr(unsafe.Pointer(time)), 0, 0) - return -} - -func GetTimeZoneInformation(tzi *Timezoneinformation) (rc uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTimeZoneInformation.Addr(), 1, uintptr(unsafe.Pointer(tzi)), 0, 0) - rc = uint32(r0) - if rc == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateIoCompletionPort(filehandle Handle, cphandle Handle, key uint32, threadcnt uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateIoCompletionPort.Addr(), 4, uintptr(filehandle), uintptr(cphandle), uintptr(key), uintptr(threadcnt), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetQueuedCompletionStatus(cphandle Handle, qty *uint32, key *uint32, overlapped **Overlapped, timeout uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetQueuedCompletionStatus.Addr(), 5, uintptr(cphandle), uintptr(unsafe.Pointer(qty)), uintptr(unsafe.Pointer(key)), uintptr(unsafe.Pointer(overlapped)), uintptr(timeout), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func PostQueuedCompletionStatus(cphandle Handle, qty uint32, key uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall6(procPostQueuedCompletionStatus.Addr(), 4, uintptr(cphandle), uintptr(qty), uintptr(key), uintptr(unsafe.Pointer(overlapped)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CancelIo(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIo.Addr(), 1, uintptr(s), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CancelIoEx(s Handle, o *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall(procCancelIoEx.Addr(), 2, uintptr(s), uintptr(unsafe.Pointer(o)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateProcess(appName *uint16, commandLine *uint16, procSecurity *SecurityAttributes, threadSecurity *SecurityAttributes, inheritHandles bool, creationFlags uint32, env *uint16, currentDir *uint16, startupInfo *StartupInfo, outProcInfo *ProcessInformation) (err error) { - var _p0 uint32 - if inheritHandles { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall12(procCreateProcessW.Addr(), 10, uintptr(unsafe.Pointer(appName)), uintptr(unsafe.Pointer(commandLine)), uintptr(unsafe.Pointer(procSecurity)), uintptr(unsafe.Pointer(threadSecurity)), uintptr(_p0), uintptr(creationFlags), uintptr(unsafe.Pointer(env)), uintptr(unsafe.Pointer(currentDir)), uintptr(unsafe.Pointer(startupInfo)), uintptr(unsafe.Pointer(outProcInfo)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenProcess(da uint32, inheritHandle bool, pid uint32) (handle Handle, err error) { - var _p0 uint32 - if inheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall(procOpenProcess.Addr(), 3, uintptr(da), uintptr(_p0), uintptr(pid)) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func TerminateProcess(handle Handle, exitcode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procTerminateProcess.Addr(), 2, uintptr(handle), uintptr(exitcode), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetExitCodeProcess(handle Handle, exitcode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetExitCodeProcess.Addr(), 2, uintptr(handle), uintptr(unsafe.Pointer(exitcode)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetStartupInfo(startupInfo *StartupInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetStartupInfoW.Addr(), 1, uintptr(unsafe.Pointer(startupInfo)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetCurrentProcess() (pseudoHandle Handle, err error) { - r0, _, e1 := syscall.Syscall(procGetCurrentProcess.Addr(), 0, 0, 0, 0) - pseudoHandle = Handle(r0) - if pseudoHandle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetProcessTimes(handle Handle, creationTime *Filetime, exitTime *Filetime, kernelTime *Filetime, userTime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procGetProcessTimes.Addr(), 5, uintptr(handle), uintptr(unsafe.Pointer(creationTime)), uintptr(unsafe.Pointer(exitTime)), uintptr(unsafe.Pointer(kernelTime)), uintptr(unsafe.Pointer(userTime)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DuplicateHandle(hSourceProcessHandle Handle, hSourceHandle Handle, hTargetProcessHandle Handle, lpTargetHandle *Handle, dwDesiredAccess uint32, bInheritHandle bool, dwOptions uint32) (err error) { - var _p0 uint32 - if bInheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall9(procDuplicateHandle.Addr(), 7, uintptr(hSourceProcessHandle), uintptr(hSourceHandle), uintptr(hTargetProcessHandle), uintptr(unsafe.Pointer(lpTargetHandle)), uintptr(dwDesiredAccess), uintptr(_p0), uintptr(dwOptions), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WaitForSingleObject(handle Handle, waitMilliseconds uint32) (event uint32, err error) { - r0, _, e1 := syscall.Syscall(procWaitForSingleObject.Addr(), 2, uintptr(handle), uintptr(waitMilliseconds), 0) - event = uint32(r0) - if event == 0xffffffff { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetTempPath(buflen uint32, buf *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetTempPathW.Addr(), 2, uintptr(buflen), uintptr(unsafe.Pointer(buf)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreatePipe(readhandle *Handle, writehandle *Handle, sa *SecurityAttributes, size uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCreatePipe.Addr(), 4, uintptr(unsafe.Pointer(readhandle)), uintptr(unsafe.Pointer(writehandle)), uintptr(unsafe.Pointer(sa)), uintptr(size), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetFileType(filehandle Handle) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileType.Addr(), 1, uintptr(filehandle), 0, 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CryptAcquireContext(provhandle *Handle, container *uint16, provider *uint16, provtype uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procCryptAcquireContextW.Addr(), 5, uintptr(unsafe.Pointer(provhandle)), uintptr(unsafe.Pointer(container)), uintptr(unsafe.Pointer(provider)), uintptr(provtype), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CryptReleaseContext(provhandle Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCryptReleaseContext.Addr(), 2, uintptr(provhandle), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CryptGenRandom(provhandle Handle, buflen uint32, buf *byte) (err error) { - r1, _, e1 := syscall.Syscall(procCryptGenRandom.Addr(), 3, uintptr(provhandle), uintptr(buflen), uintptr(unsafe.Pointer(buf))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetEnvironmentStrings() (envs *uint16, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentStringsW.Addr(), 0, 0, 0, 0) - envs = (*uint16)(unsafe.Pointer(r0)) - if envs == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FreeEnvironmentStrings(envs *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procFreeEnvironmentStringsW.Addr(), 1, uintptr(unsafe.Pointer(envs)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetEnvironmentVariable(name *uint16, buffer *uint16, size uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetEnvironmentVariableW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(buffer)), uintptr(size)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetEnvironmentVariable(name *uint16, value *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetEnvironmentVariableW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(value)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetFileTime(handle Handle, ctime *Filetime, atime *Filetime, wtime *Filetime) (err error) { - r1, _, e1 := syscall.Syscall6(procSetFileTime.Addr(), 4, uintptr(handle), uintptr(unsafe.Pointer(ctime)), uintptr(unsafe.Pointer(atime)), uintptr(unsafe.Pointer(wtime)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetFileAttributes(name *uint16) (attrs uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetFileAttributesW.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) - attrs = uint32(r0) - if attrs == INVALID_FILE_ATTRIBUTES { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetFileAttributes(name *uint16, attrs uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileAttributesW.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(attrs), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetFileAttributesEx(name *uint16, level uint32, info *byte) (err error) { - r1, _, e1 := syscall.Syscall(procGetFileAttributesExW.Addr(), 3, uintptr(unsafe.Pointer(name)), uintptr(level), uintptr(unsafe.Pointer(info))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetCommandLine() (cmd *uint16) { - r0, _, _ := syscall.Syscall(procGetCommandLineW.Addr(), 0, 0, 0, 0) - cmd = (*uint16)(unsafe.Pointer(r0)) - return -} - -func CommandLineToArgv(cmd *uint16, argc *int32) (argv *[8192]*[8192]uint16, err error) { - r0, _, e1 := syscall.Syscall(procCommandLineToArgvW.Addr(), 2, uintptr(unsafe.Pointer(cmd)), uintptr(unsafe.Pointer(argc)), 0) - argv = (*[8192]*[8192]uint16)(unsafe.Pointer(r0)) - if argv == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func LocalFree(hmem Handle) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procLocalFree.Addr(), 1, uintptr(hmem), 0, 0) - handle = Handle(r0) - if handle != 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetHandleInformation(handle Handle, mask uint32, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetHandleInformation.Addr(), 3, uintptr(handle), uintptr(mask), uintptr(flags)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FlushFileBuffers(handle Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFlushFileBuffers.Addr(), 1, uintptr(handle), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetFullPathName(path *uint16, buflen uint32, buf *uint16, fname **uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall6(procGetFullPathNameW.Addr(), 4, uintptr(unsafe.Pointer(path)), uintptr(buflen), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(fname)), 0, 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetLongPathName(path *uint16, buf *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLongPathNameW.Addr(), 3, uintptr(unsafe.Pointer(path)), uintptr(unsafe.Pointer(buf)), uintptr(buflen)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetShortPathName(longpath *uint16, shortpath *uint16, buflen uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetShortPathNameW.Addr(), 3, uintptr(unsafe.Pointer(longpath)), uintptr(unsafe.Pointer(shortpath)), uintptr(buflen)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateFileMapping(fhandle Handle, sa *SecurityAttributes, prot uint32, maxSizeHigh uint32, maxSizeLow uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateFileMappingW.Addr(), 6, uintptr(fhandle), uintptr(unsafe.Pointer(sa)), uintptr(prot), uintptr(maxSizeHigh), uintptr(maxSizeLow), uintptr(unsafe.Pointer(name))) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func MapViewOfFile(handle Handle, access uint32, offsetHigh uint32, offsetLow uint32, length uintptr) (addr uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procMapViewOfFile.Addr(), 5, uintptr(handle), uintptr(access), uintptr(offsetHigh), uintptr(offsetLow), uintptr(length), 0) - addr = uintptr(r0) - if addr == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func UnmapViewOfFile(addr uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procUnmapViewOfFile.Addr(), 1, uintptr(addr), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FlushViewOfFile(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procFlushViewOfFile.Addr(), 2, uintptr(addr), uintptr(length), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func VirtualLock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualLock.Addr(), 2, uintptr(addr), uintptr(length), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func VirtualUnlock(addr uintptr, length uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) { - r0, _, e1 := syscall.Syscall6(procVirtualAlloc.Addr(), 4, uintptr(address), uintptr(size), uintptr(alloctype), uintptr(protect), 0, 0) - value = uintptr(r0) - if value == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) { - r1, _, e1 := syscall.Syscall(procVirtualFree.Addr(), 3, uintptr(address), uintptr(size), uintptr(freetype)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procVirtualProtect.Addr(), 4, uintptr(address), uintptr(size), uintptr(newprotect), uintptr(unsafe.Pointer(oldprotect)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procTransmitFile.Addr(), 7, uintptr(s), uintptr(handle), uintptr(bytesToWrite), uintptr(bytsPerSend), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(transmitFileBuf)), uintptr(flags), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - var _p0 uint32 - if watchSubTree { - _p0 = 1 - } else { - _p0 = 0 - } - r1, _, e1 := syscall.Syscall9(procReadDirectoryChangesW.Addr(), 8, uintptr(handle), uintptr(unsafe.Pointer(buf)), uintptr(buflen), uintptr(_p0), uintptr(mask), uintptr(unsafe.Pointer(retlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertOpenSystemStore(hprov Handle, name *uint16) (store Handle, err error) { - r0, _, e1 := syscall.Syscall(procCertOpenSystemStoreW.Addr(), 2, uintptr(hprov), uintptr(unsafe.Pointer(name)), 0) - store = Handle(r0) - if store == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertOpenStore(storeProvider uintptr, msgAndCertEncodingType uint32, cryptProv uintptr, flags uint32, para uintptr) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCertOpenStore.Addr(), 5, uintptr(storeProvider), uintptr(msgAndCertEncodingType), uintptr(cryptProv), uintptr(flags), uintptr(para), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertEnumCertificatesInStore(store Handle, prevContext *CertContext) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertEnumCertificatesInStore.Addr(), 2, uintptr(store), uintptr(unsafe.Pointer(prevContext)), 0) - context = (*CertContext)(unsafe.Pointer(r0)) - if context == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertAddCertificateContextToStore(store Handle, certContext *CertContext, addDisposition uint32, storeContext **CertContext) (err error) { - r1, _, e1 := syscall.Syscall6(procCertAddCertificateContextToStore.Addr(), 4, uintptr(store), uintptr(unsafe.Pointer(certContext)), uintptr(addDisposition), uintptr(unsafe.Pointer(storeContext)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertCloseStore(store Handle, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCertCloseStore.Addr(), 2, uintptr(store), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertGetCertificateChain(engine Handle, leaf *CertContext, time *Filetime, additionalStore Handle, para *CertChainPara, flags uint32, reserved uintptr, chainCtx **CertChainContext) (err error) { - r1, _, e1 := syscall.Syscall9(procCertGetCertificateChain.Addr(), 8, uintptr(engine), uintptr(unsafe.Pointer(leaf)), uintptr(unsafe.Pointer(time)), uintptr(additionalStore), uintptr(unsafe.Pointer(para)), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(chainCtx)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertFreeCertificateChain(ctx *CertChainContext) { - syscall.Syscall(procCertFreeCertificateChain.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) - return -} - -func CertCreateCertificateContext(certEncodingType uint32, certEncoded *byte, encodedLen uint32) (context *CertContext, err error) { - r0, _, e1 := syscall.Syscall(procCertCreateCertificateContext.Addr(), 3, uintptr(certEncodingType), uintptr(unsafe.Pointer(certEncoded)), uintptr(encodedLen)) - context = (*CertContext)(unsafe.Pointer(r0)) - if context == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertFreeCertificateContext(ctx *CertContext) (err error) { - r1, _, e1 := syscall.Syscall(procCertFreeCertificateContext.Addr(), 1, uintptr(unsafe.Pointer(ctx)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CertVerifyCertificateChainPolicy(policyOID uintptr, chain *CertChainContext, para *CertChainPolicyPara, status *CertChainPolicyStatus) (err error) { - r1, _, e1 := syscall.Syscall6(procCertVerifyCertificateChainPolicy.Addr(), 4, uintptr(policyOID), uintptr(unsafe.Pointer(chain)), uintptr(unsafe.Pointer(para)), uintptr(unsafe.Pointer(status)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func RegOpenKeyEx(key Handle, subkey *uint16, options uint32, desiredAccess uint32, result *Handle) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegOpenKeyExW.Addr(), 5, uintptr(key), uintptr(unsafe.Pointer(subkey)), uintptr(options), uintptr(desiredAccess), uintptr(unsafe.Pointer(result)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func RegCloseKey(key Handle) (regerrno error) { - r0, _, _ := syscall.Syscall(procRegCloseKey.Addr(), 1, uintptr(key), 0, 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func RegQueryInfoKey(key Handle, class *uint16, classLen *uint32, reserved *uint32, subkeysLen *uint32, maxSubkeyLen *uint32, maxClassLen *uint32, valuesLen *uint32, maxValueNameLen *uint32, maxValueLen *uint32, saLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall12(procRegQueryInfoKeyW.Addr(), 12, uintptr(key), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(subkeysLen)), uintptr(unsafe.Pointer(maxSubkeyLen)), uintptr(unsafe.Pointer(maxClassLen)), uintptr(unsafe.Pointer(valuesLen)), uintptr(unsafe.Pointer(maxValueNameLen)), uintptr(unsafe.Pointer(maxValueLen)), uintptr(unsafe.Pointer(saLen)), uintptr(unsafe.Pointer(lastWriteTime))) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func RegEnumKeyEx(key Handle, index uint32, name *uint16, nameLen *uint32, reserved *uint32, class *uint16, classLen *uint32, lastWriteTime *Filetime) (regerrno error) { - r0, _, _ := syscall.Syscall9(procRegEnumKeyExW.Addr(), 8, uintptr(key), uintptr(index), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(class)), uintptr(unsafe.Pointer(classLen)), uintptr(unsafe.Pointer(lastWriteTime)), 0) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func RegQueryValueEx(key Handle, name *uint16, reserved *uint32, valtype *uint32, buf *byte, buflen *uint32) (regerrno error) { - r0, _, _ := syscall.Syscall6(procRegQueryValueExW.Addr(), 6, uintptr(key), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(reserved)), uintptr(unsafe.Pointer(valtype)), uintptr(unsafe.Pointer(buf)), uintptr(unsafe.Pointer(buflen))) - if r0 != 0 { - regerrno = syscall.Errno(r0) - } - return -} - -func getCurrentProcessId() (pid uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentProcessId.Addr(), 0, 0, 0, 0) - pid = uint32(r0) - return -} - -func GetConsoleMode(console Handle, mode *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleMode.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(mode)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetConsoleMode(console Handle, mode uint32) (err error) { - r1, _, e1 := syscall.Syscall(procSetConsoleMode.Addr(), 2, uintptr(console), uintptr(mode), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetConsoleScreenBufferInfo(console Handle, info *ConsoleScreenBufferInfo) (err error) { - r1, _, e1 := syscall.Syscall(procGetConsoleScreenBufferInfo.Addr(), 2, uintptr(console), uintptr(unsafe.Pointer(info)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WriteConsole(console Handle, buf *uint16, towrite uint32, written *uint32, reserved *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procWriteConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(towrite), uintptr(unsafe.Pointer(written)), uintptr(unsafe.Pointer(reserved)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ReadConsole(console Handle, buf *uint16, toread uint32, read *uint32, inputControl *byte) (err error) { - r1, _, e1 := syscall.Syscall6(procReadConsoleW.Addr(), 5, uintptr(console), uintptr(unsafe.Pointer(buf)), uintptr(toread), uintptr(unsafe.Pointer(read)), uintptr(unsafe.Pointer(inputControl)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateToolhelp32Snapshot(flags uint32, processId uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procCreateToolhelp32Snapshot.Addr(), 2, uintptr(flags), uintptr(processId), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Process32First(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32FirstW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Process32Next(snapshot Handle, procEntry *ProcessEntry32) (err error) { - r1, _, e1 := syscall.Syscall(procProcess32NextW.Addr(), 2, uintptr(snapshot), uintptr(unsafe.Pointer(procEntry)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DeviceIoControl(handle Handle, ioControlCode uint32, inBuffer *byte, inBufferSize uint32, outBuffer *byte, outBufferSize uint32, bytesReturned *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procDeviceIoControl.Addr(), 8, uintptr(handle), uintptr(ioControlCode), uintptr(unsafe.Pointer(inBuffer)), uintptr(inBufferSize), uintptr(unsafe.Pointer(outBuffer)), uintptr(outBufferSize), uintptr(unsafe.Pointer(bytesReturned)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateSymbolicLink(symlinkfilename *uint16, targetfilename *uint16, flags uint32) (err error) { - r1, _, e1 := syscall.Syscall(procCreateSymbolicLinkW.Addr(), 3, uintptr(unsafe.Pointer(symlinkfilename)), uintptr(unsafe.Pointer(targetfilename)), uintptr(flags)) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateHardLink(filename *uint16, existingfilename *uint16, reserved uintptr) (err error) { - r1, _, e1 := syscall.Syscall(procCreateHardLinkW.Addr(), 3, uintptr(unsafe.Pointer(filename)), uintptr(unsafe.Pointer(existingfilename)), uintptr(reserved)) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetCurrentThreadId() (id uint32) { - r0, _, _ := syscall.Syscall(procGetCurrentThreadId.Addr(), 0, 0, 0, 0) - id = uint32(r0) - return -} - -func CreateEvent(eventAttrs *SecurityAttributes, manualReset uint32, initialState uint32, name *uint16) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(manualReset), uintptr(initialState), uintptr(unsafe.Pointer(name)), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func CreateEventEx(eventAttrs *SecurityAttributes, name *uint16, flags uint32, desiredAccess uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall6(procCreateEventExW.Addr(), 4, uintptr(unsafe.Pointer(eventAttrs)), uintptr(unsafe.Pointer(name)), uintptr(flags), uintptr(desiredAccess), 0, 0) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenEvent(desiredAccess uint32, inheritHandle bool, name *uint16) (handle Handle, err error) { - var _p0 uint32 - if inheritHandle { - _p0 = 1 - } else { - _p0 = 0 - } - r0, _, e1 := syscall.Syscall(procOpenEventW.Addr(), 3, uintptr(desiredAccess), uintptr(_p0), uintptr(unsafe.Pointer(name))) - handle = Handle(r0) - if handle == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procSetEvent.Addr(), 1, uintptr(event), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ResetEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procResetEvent.Addr(), 1, uintptr(event), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func PulseEvent(event Handle) (err error) { - r1, _, e1 := syscall.Syscall(procPulseEvent.Addr(), 1, uintptr(event), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DefineDosDevice(flags uint32, deviceName *uint16, targetPath *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDefineDosDeviceW.Addr(), 3, uintptr(flags), uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DeleteVolumeMountPoint(volumeMountPoint *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procDeleteVolumeMountPointW.Addr(), 1, uintptr(unsafe.Pointer(volumeMountPoint)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindFirstVolume(volumeName *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeW.Addr(), 2, uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength), 0) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindFirstVolumeMountPoint(rootPathName *uint16, volumeMountPoint *uint16, bufferLength uint32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procFindFirstVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindNextVolume(findVolume Handle, volumeName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeW.Addr(), 3, uintptr(findVolume), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferLength)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindNextVolumeMountPoint(findVolumeMountPoint Handle, volumeMountPoint *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procFindNextVolumeMountPointW.Addr(), 3, uintptr(findVolumeMountPoint), uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(bufferLength)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindVolumeClose(findVolume Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeClose.Addr(), 1, uintptr(findVolume), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FindVolumeMountPointClose(findVolumeMountPoint Handle) (err error) { - r1, _, e1 := syscall.Syscall(procFindVolumeMountPointClose.Addr(), 1, uintptr(findVolumeMountPoint), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetDriveType(rootPathName *uint16) (driveType uint32) { - r0, _, _ := syscall.Syscall(procGetDriveTypeW.Addr(), 1, uintptr(unsafe.Pointer(rootPathName)), 0, 0) - driveType = uint32(r0) - return -} - -func GetLogicalDrives() (drivesBitMask uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDrives.Addr(), 0, 0, 0, 0) - drivesBitMask = uint32(r0) - if drivesBitMask == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetLogicalDriveStrings(bufferLength uint32, buffer *uint16) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procGetLogicalDriveStringsW.Addr(), 2, uintptr(bufferLength), uintptr(unsafe.Pointer(buffer)), 0) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVolumeInformation(rootPathName *uint16, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationW.Addr(), 8, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVolumeInformationByHandle(file Handle, volumeNameBuffer *uint16, volumeNameSize uint32, volumeNameSerialNumber *uint32, maximumComponentLength *uint32, fileSystemFlags *uint32, fileSystemNameBuffer *uint16, fileSystemNameSize uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procGetVolumeInformationByHandleW.Addr(), 8, uintptr(file), uintptr(unsafe.Pointer(volumeNameBuffer)), uintptr(volumeNameSize), uintptr(unsafe.Pointer(volumeNameSerialNumber)), uintptr(unsafe.Pointer(maximumComponentLength)), uintptr(unsafe.Pointer(fileSystemFlags)), uintptr(unsafe.Pointer(fileSystemNameBuffer)), uintptr(fileSystemNameSize), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVolumeNameForVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16, bufferlength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumeNameForVolumeMountPointW.Addr(), 3, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), uintptr(bufferlength)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVolumePathName(fileName *uint16, volumePathName *uint16, bufferLength uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetVolumePathNameW.Addr(), 3, uintptr(unsafe.Pointer(fileName)), uintptr(unsafe.Pointer(volumePathName)), uintptr(bufferLength)) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetVolumePathNamesForVolumeName(volumeName *uint16, volumePathNames *uint16, bufferLength uint32, returnLength *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetVolumePathNamesForVolumeNameW.Addr(), 4, uintptr(unsafe.Pointer(volumeName)), uintptr(unsafe.Pointer(volumePathNames)), uintptr(bufferLength), uintptr(unsafe.Pointer(returnLength)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func QueryDosDevice(deviceName *uint16, targetPath *uint16, max uint32) (n uint32, err error) { - r0, _, e1 := syscall.Syscall(procQueryDosDeviceW.Addr(), 3, uintptr(unsafe.Pointer(deviceName)), uintptr(unsafe.Pointer(targetPath)), uintptr(max)) - n = uint32(r0) - if n == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetVolumeLabel(rootPathName *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeLabelW.Addr(), 2, uintptr(unsafe.Pointer(rootPathName)), uintptr(unsafe.Pointer(volumeName)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func SetVolumeMountPoint(volumeMountPoint *uint16, volumeName *uint16) (err error) { - r1, _, e1 := syscall.Syscall(procSetVolumeMountPointW.Addr(), 2, uintptr(unsafe.Pointer(volumeMountPoint)), uintptr(unsafe.Pointer(volumeName)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSAStartup(verreq uint32, data *WSAData) (sockerr error) { - r0, _, _ := syscall.Syscall(procWSAStartup.Addr(), 2, uintptr(verreq), uintptr(unsafe.Pointer(data)), 0) - if r0 != 0 { - sockerr = syscall.Errno(r0) - } - return -} - -func WSACleanup() (err error) { - r1, _, e1 := syscall.Syscall(procWSACleanup.Addr(), 0, 0, 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSAIoctl(s Handle, iocc uint32, inbuf *byte, cbif uint32, outbuf *byte, cbob uint32, cbbr *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) { - r1, _, e1 := syscall.Syscall9(procWSAIoctl.Addr(), 9, uintptr(s), uintptr(iocc), uintptr(unsafe.Pointer(inbuf)), uintptr(cbif), uintptr(unsafe.Pointer(outbuf)), uintptr(cbob), uintptr(unsafe.Pointer(cbbr)), uintptr(unsafe.Pointer(overlapped)), uintptr(completionRoutine)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func socket(af int32, typ int32, protocol int32) (handle Handle, err error) { - r0, _, e1 := syscall.Syscall(procsocket.Addr(), 3, uintptr(af), uintptr(typ), uintptr(protocol)) - handle = Handle(r0) - if handle == InvalidHandle { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Setsockopt(s Handle, level int32, optname int32, optval *byte, optlen int32) (err error) { - r1, _, e1 := syscall.Syscall6(procsetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(optlen), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Getsockopt(s Handle, level int32, optname int32, optval *byte, optlen *int32) (err error) { - r1, _, e1 := syscall.Syscall6(procgetsockopt.Addr(), 5, uintptr(s), uintptr(level), uintptr(optname), uintptr(unsafe.Pointer(optval)), uintptr(unsafe.Pointer(optlen)), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func bind(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procbind.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func connect(s Handle, name unsafe.Pointer, namelen int32) (err error) { - r1, _, e1 := syscall.Syscall(procconnect.Addr(), 3, uintptr(s), uintptr(name), uintptr(namelen)) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getsockname(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetsockname.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func getpeername(s Handle, rsa *RawSockaddrAny, addrlen *int32) (err error) { - r1, _, e1 := syscall.Syscall(procgetpeername.Addr(), 3, uintptr(s), uintptr(unsafe.Pointer(rsa)), uintptr(unsafe.Pointer(addrlen))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func listen(s Handle, backlog int32) (err error) { - r1, _, e1 := syscall.Syscall(proclisten.Addr(), 2, uintptr(s), uintptr(backlog), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func shutdown(s Handle, how int32) (err error) { - r1, _, e1 := syscall.Syscall(procshutdown.Addr(), 2, uintptr(s), uintptr(how), 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Closesocket(s Handle) (err error) { - r1, _, e1 := syscall.Syscall(procclosesocket.Addr(), 1, uintptr(s), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) { - r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetAcceptExSockaddrs(buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, lrsa **RawSockaddrAny, lrsalen *int32, rrsa **RawSockaddrAny, rrsalen *int32) { - syscall.Syscall9(procGetAcceptExSockaddrs.Addr(), 8, uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(lrsa)), uintptr(unsafe.Pointer(lrsalen)), uintptr(unsafe.Pointer(rrsa)), uintptr(unsafe.Pointer(rrsalen)), 0) - return -} - -func WSARecv(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecv.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSASend(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASend.Addr(), 7, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine)), 0, 0) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSARecvFrom(s Handle, bufs *WSABuf, bufcnt uint32, recvd *uint32, flags *uint32, from *RawSockaddrAny, fromlen *int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSARecvFrom.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(flags)), uintptr(unsafe.Pointer(from)), uintptr(unsafe.Pointer(fromlen)), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSASendTo(s Handle, bufs *WSABuf, bufcnt uint32, sent *uint32, flags uint32, to *RawSockaddrAny, tolen int32, overlapped *Overlapped, croutine *byte) (err error) { - r1, _, e1 := syscall.Syscall9(procWSASendTo.Addr(), 9, uintptr(s), uintptr(unsafe.Pointer(bufs)), uintptr(bufcnt), uintptr(unsafe.Pointer(sent)), uintptr(flags), uintptr(unsafe.Pointer(to)), uintptr(tolen), uintptr(unsafe.Pointer(overlapped)), uintptr(unsafe.Pointer(croutine))) - if r1 == socket_error { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetHostByName(name string) (h *Hostent, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return - } - return _GetHostByName(_p0) -} - -func _GetHostByName(name *byte) (h *Hostent, err error) { - r0, _, e1 := syscall.Syscall(procgethostbyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) - h = (*Hostent)(unsafe.Pointer(r0)) - if h == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetServByName(name string, proto string) (s *Servent, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return - } - var _p1 *byte - _p1, err = syscall.BytePtrFromString(proto) - if err != nil { - return - } - return _GetServByName(_p0, _p1) -} - -func _GetServByName(name *byte, proto *byte) (s *Servent, err error) { - r0, _, e1 := syscall.Syscall(procgetservbyname.Addr(), 2, uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(proto)), 0) - s = (*Servent)(unsafe.Pointer(r0)) - if s == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func Ntohs(netshort uint16) (u uint16) { - r0, _, _ := syscall.Syscall(procntohs.Addr(), 1, uintptr(netshort), 0, 0) - u = uint16(r0) - return -} - -func GetProtoByName(name string) (p *Protoent, err error) { - var _p0 *byte - _p0, err = syscall.BytePtrFromString(name) - if err != nil { - return - } - return _GetProtoByName(_p0) -} - -func _GetProtoByName(name *byte) (p *Protoent, err error) { - r0, _, e1 := syscall.Syscall(procgetprotobyname.Addr(), 1, uintptr(unsafe.Pointer(name)), 0, 0) - p = (*Protoent)(unsafe.Pointer(r0)) - if p == nil { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func DnsQuery(name string, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - var _p0 *uint16 - _p0, status = syscall.UTF16PtrFromString(name) - if status != nil { - return - } - return _DnsQuery(_p0, qtype, options, extra, qrs, pr) -} - -func _DnsQuery(name *uint16, qtype uint16, options uint32, extra *byte, qrs **DNSRecord, pr *byte) (status error) { - r0, _, _ := syscall.Syscall6(procDnsQuery_W.Addr(), 6, uintptr(unsafe.Pointer(name)), uintptr(qtype), uintptr(options), uintptr(unsafe.Pointer(extra)), uintptr(unsafe.Pointer(qrs)), uintptr(unsafe.Pointer(pr))) - if r0 != 0 { - status = syscall.Errno(r0) - } - return -} - -func DnsRecordListFree(rl *DNSRecord, freetype uint32) { - syscall.Syscall(procDnsRecordListFree.Addr(), 2, uintptr(unsafe.Pointer(rl)), uintptr(freetype), 0) - return -} - -func DnsNameCompare(name1 *uint16, name2 *uint16) (same bool) { - r0, _, _ := syscall.Syscall(procDnsNameCompare_W.Addr(), 2, uintptr(unsafe.Pointer(name1)), uintptr(unsafe.Pointer(name2)), 0) - same = r0 != 0 - return -} - -func GetAddrInfoW(nodename *uint16, servicename *uint16, hints *AddrinfoW, result **AddrinfoW) (sockerr error) { - r0, _, _ := syscall.Syscall6(procGetAddrInfoW.Addr(), 4, uintptr(unsafe.Pointer(nodename)), uintptr(unsafe.Pointer(servicename)), uintptr(unsafe.Pointer(hints)), uintptr(unsafe.Pointer(result)), 0, 0) - if r0 != 0 { - sockerr = syscall.Errno(r0) - } - return -} - -func FreeAddrInfoW(addrinfo *AddrinfoW) { - syscall.Syscall(procFreeAddrInfoW.Addr(), 1, uintptr(unsafe.Pointer(addrinfo)), 0, 0) - return -} - -func GetIfEntry(pIfRow *MibIfRow) (errcode error) { - r0, _, _ := syscall.Syscall(procGetIfEntry.Addr(), 1, uintptr(unsafe.Pointer(pIfRow)), 0, 0) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func GetAdaptersInfo(ai *IpAdapterInfo, ol *uint32) (errcode error) { - r0, _, _ := syscall.Syscall(procGetAdaptersInfo.Addr(), 2, uintptr(unsafe.Pointer(ai)), uintptr(unsafe.Pointer(ol)), 0) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func SetFileCompletionNotificationModes(handle Handle, flags uint8) (err error) { - r1, _, e1 := syscall.Syscall(procSetFileCompletionNotificationModes.Addr(), 2, uintptr(handle), uintptr(flags), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func WSAEnumProtocols(protocols *int32, protocolBuffer *WSAProtocolInfo, bufferLength *uint32) (n int32, err error) { - r0, _, e1 := syscall.Syscall(procWSAEnumProtocolsW.Addr(), 3, uintptr(unsafe.Pointer(protocols)), uintptr(unsafe.Pointer(protocolBuffer)), uintptr(unsafe.Pointer(bufferLength))) - n = int32(r0) - if n == -1 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetAdaptersAddresses(family uint32, flags uint32, reserved uintptr, adapterAddresses *IpAdapterAddresses, sizePointer *uint32) (errcode error) { - r0, _, _ := syscall.Syscall6(procGetAdaptersAddresses.Addr(), 5, uintptr(family), uintptr(flags), uintptr(reserved), uintptr(unsafe.Pointer(adapterAddresses)), uintptr(unsafe.Pointer(sizePointer)), 0) - if r0 != 0 { - errcode = syscall.Errno(r0) - } - return -} - -func GetACP() (acp uint32) { - r0, _, _ := syscall.Syscall(procGetACP.Addr(), 0, 0, 0, 0) - acp = uint32(r0) - return -} - -func MultiByteToWideChar(codePage uint32, dwFlags uint32, str *byte, nstr int32, wchar *uint16, nwchar int32) (nwrite int32, err error) { - r0, _, e1 := syscall.Syscall6(procMultiByteToWideChar.Addr(), 6, uintptr(codePage), uintptr(dwFlags), uintptr(unsafe.Pointer(str)), uintptr(nstr), uintptr(unsafe.Pointer(wchar)), uintptr(nwchar)) - nwrite = int32(r0) - if nwrite == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func TranslateName(accName *uint16, accNameFormat uint32, desiredNameFormat uint32, translatedName *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procTranslateNameW.Addr(), 5, uintptr(unsafe.Pointer(accName)), uintptr(accNameFormat), uintptr(desiredNameFormat), uintptr(unsafe.Pointer(translatedName)), uintptr(unsafe.Pointer(nSize)), 0) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetUserNameEx(nameFormat uint32, nameBuffre *uint16, nSize *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserNameExW.Addr(), 3, uintptr(nameFormat), uintptr(unsafe.Pointer(nameBuffre)), uintptr(unsafe.Pointer(nSize))) - if r1&0xff == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func NetUserGetInfo(serverName *uint16, userName *uint16, level uint32, buf **byte) (neterr error) { - r0, _, _ := syscall.Syscall6(procNetUserGetInfo.Addr(), 4, uintptr(unsafe.Pointer(serverName)), uintptr(unsafe.Pointer(userName)), uintptr(level), uintptr(unsafe.Pointer(buf)), 0, 0) - if r0 != 0 { - neterr = syscall.Errno(r0) - } - return -} - -func NetGetJoinInformation(server *uint16, name **uint16, bufType *uint32) (neterr error) { - r0, _, _ := syscall.Syscall(procNetGetJoinInformation.Addr(), 3, uintptr(unsafe.Pointer(server)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(bufType))) - if r0 != 0 { - neterr = syscall.Errno(r0) - } - return -} - -func NetApiBufferFree(buf *byte) (neterr error) { - r0, _, _ := syscall.Syscall(procNetApiBufferFree.Addr(), 1, uintptr(unsafe.Pointer(buf)), 0, 0) - if r0 != 0 { - neterr = syscall.Errno(r0) - } - return -} - -func LookupAccountSid(systemName *uint16, sid *SID, name *uint16, nameLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountSidW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(name)), uintptr(unsafe.Pointer(nameLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func LookupAccountName(systemName *uint16, accountName *uint16, sid *SID, sidLen *uint32, refdDomainName *uint16, refdDomainNameLen *uint32, use *uint32) (err error) { - r1, _, e1 := syscall.Syscall9(procLookupAccountNameW.Addr(), 7, uintptr(unsafe.Pointer(systemName)), uintptr(unsafe.Pointer(accountName)), uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(sidLen)), uintptr(unsafe.Pointer(refdDomainName)), uintptr(unsafe.Pointer(refdDomainNameLen)), uintptr(unsafe.Pointer(use)), 0, 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ConvertSidToStringSid(sid *SID, stringSid **uint16) (err error) { - r1, _, e1 := syscall.Syscall(procConvertSidToStringSidW.Addr(), 2, uintptr(unsafe.Pointer(sid)), uintptr(unsafe.Pointer(stringSid)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func ConvertStringSidToSid(stringSid *uint16, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall(procConvertStringSidToSidW.Addr(), 2, uintptr(unsafe.Pointer(stringSid)), uintptr(unsafe.Pointer(sid)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetLengthSid(sid *SID) (len uint32) { - r0, _, _ := syscall.Syscall(procGetLengthSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - len = uint32(r0) - return -} - -func CopySid(destSidLen uint32, destSid *SID, srcSid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procCopySid.Addr(), 3, uintptr(destSidLen), uintptr(unsafe.Pointer(destSid)), uintptr(unsafe.Pointer(srcSid))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func AllocateAndInitializeSid(identAuth *SidIdentifierAuthority, subAuth byte, subAuth0 uint32, subAuth1 uint32, subAuth2 uint32, subAuth3 uint32, subAuth4 uint32, subAuth5 uint32, subAuth6 uint32, subAuth7 uint32, sid **SID) (err error) { - r1, _, e1 := syscall.Syscall12(procAllocateAndInitializeSid.Addr(), 11, uintptr(unsafe.Pointer(identAuth)), uintptr(subAuth), uintptr(subAuth0), uintptr(subAuth1), uintptr(subAuth2), uintptr(subAuth3), uintptr(subAuth4), uintptr(subAuth5), uintptr(subAuth6), uintptr(subAuth7), uintptr(unsafe.Pointer(sid)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func FreeSid(sid *SID) (err error) { - r1, _, e1 := syscall.Syscall(procFreeSid.Addr(), 1, uintptr(unsafe.Pointer(sid)), 0, 0) - if r1 != 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func EqualSid(sid1 *SID, sid2 *SID) (isEqual bool) { - r0, _, _ := syscall.Syscall(procEqualSid.Addr(), 2, uintptr(unsafe.Pointer(sid1)), uintptr(unsafe.Pointer(sid2)), 0) - isEqual = r0 != 0 - return -} - -func checkTokenMembership(tokenHandle Token, sidToCheck *SID, isMember *int32) (err error) { - r1, _, e1 := syscall.Syscall(procCheckTokenMembership.Addr(), 3, uintptr(tokenHandle), uintptr(unsafe.Pointer(sidToCheck)), uintptr(unsafe.Pointer(isMember))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func OpenProcessToken(h Handle, access uint32, token *Token) (err error) { - r1, _, e1 := syscall.Syscall(procOpenProcessToken.Addr(), 3, uintptr(h), uintptr(access), uintptr(unsafe.Pointer(token))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetTokenInformation(t Token, infoClass uint32, info *byte, infoLen uint32, returnedLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall6(procGetTokenInformation.Addr(), 5, uintptr(t), uintptr(infoClass), uintptr(unsafe.Pointer(info)), uintptr(infoLen), uintptr(unsafe.Pointer(returnedLen)), 0) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} - -func GetUserProfileDirectory(t Token, dir *uint16, dirLen *uint32) (err error) { - r1, _, e1 := syscall.Syscall(procGetUserProfileDirectoryW.Addr(), 3, uintptr(t), uintptr(unsafe.Pointer(dir)), uintptr(unsafe.Pointer(dirLen))) - if r1 == 0 { - if e1 != 0 { - err = errnoErr(e1) - } else { - err = syscall.EINVAL - } - } - return -} diff --git a/vendor/golang.org/x/tools/.gitattributes b/vendor/golang.org/x/tools/.gitattributes deleted file mode 100644 index d2f212e..0000000 --- a/vendor/golang.org/x/tools/.gitattributes +++ /dev/null @@ -1,10 +0,0 @@ -# Treat all files in this repo as binary, with no git magic updating -# line endings. Windows users contributing to Go will need to use a -# modern version of git and editors capable of LF line endings. -# -# We'll prevent accidental CRLF line endings from entering the repo -# via the git-review gofmt checks. -# -# See golang.org/issue/9281 - -* -text diff --git a/vendor/golang.org/x/tools/.gitignore b/vendor/golang.org/x/tools/.gitignore deleted file mode 100644 index 5a9d62e..0000000 --- a/vendor/golang.org/x/tools/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -# Add no patterns to .gitignore except for files generated by the build. -last-change diff --git a/vendor/golang.org/x/tools/AUTHORS b/vendor/golang.org/x/tools/AUTHORS deleted file mode 100644 index 15167cd..0000000 --- a/vendor/golang.org/x/tools/AUTHORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code refers to The Go Authors for copyright purposes. -# The master list of authors is in the main Go distribution, -# visible at http://tip.golang.org/AUTHORS. diff --git a/vendor/golang.org/x/tools/CONTRIBUTING.md b/vendor/golang.org/x/tools/CONTRIBUTING.md deleted file mode 100644 index 88dff59..0000000 --- a/vendor/golang.org/x/tools/CONTRIBUTING.md +++ /dev/null @@ -1,31 +0,0 @@ -# Contributing to Go - -Go is an open source project. - -It is the work of hundreds of contributors. We appreciate your help! - - -## Filing issues - -When [filing an issue](https://golang.org/issue/new), 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 [golang-nuts mailing list](https://groups.google.com/group/golang-nuts) 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 - -Please read the [Contribution Guidelines](https://golang.org/doc/contribute.html) -before sending patches. - -**We do not accept GitHub pull requests** -(we use [Gerrit](https://code.google.com/p/gerrit/) instead for code review). - -Unless otherwise noted, the Go source files are distributed under -the BSD-style license found in the LICENSE file. - diff --git a/vendor/golang.org/x/tools/CONTRIBUTORS b/vendor/golang.org/x/tools/CONTRIBUTORS deleted file mode 100644 index 1c4577e..0000000 --- a/vendor/golang.org/x/tools/CONTRIBUTORS +++ /dev/null @@ -1,3 +0,0 @@ -# This source code was written by the Go contributors. -# The master list of contributors is in the main Go distribution, -# visible at http://tip.golang.org/CONTRIBUTORS. diff --git a/vendor/golang.org/x/tools/LICENSE b/vendor/golang.org/x/tools/LICENSE deleted file mode 100644 index 6a66aea..0000000 --- a/vendor/golang.org/x/tools/LICENSE +++ /dev/null @@ -1,27 +0,0 @@ -Copyright (c) 2009 The Go Authors. 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 of Google Inc. 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 -OWNER 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/golang.org/x/tools/PATENTS b/vendor/golang.org/x/tools/PATENTS deleted file mode 100644 index 7330990..0000000 --- a/vendor/golang.org/x/tools/PATENTS +++ /dev/null @@ -1,22 +0,0 @@ -Additional IP Rights Grant (Patents) - -"This implementation" means the copyrightable works distributed by -Google as part of the Go project. - -Google 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, -transfer and otherwise run, modify and propagate the contents of this -implementation of Go, where such license applies only to those patent -claims, both currently owned or controlled by Google and acquired in -the future, licensable by Google that are necessarily infringed by this -implementation of Go. This grant does not include claims that would be -infringed only as a consequence of further modification of this -implementation. If you or your agent or exclusive licensee institute or -order or agree to the institution of patent litigation against any -entity (including a cross-claim or counterclaim in a lawsuit) alleging -that this implementation of Go or any code incorporated within this -implementation of Go constitutes direct or contributory patent -infringement, or inducement of patent infringement, then any patent -rights granted to you under this License for this implementation of Go -shall terminate as of the date such litigation is filed. diff --git a/vendor/golang.org/x/tools/README.md b/vendor/golang.org/x/tools/README.md deleted file mode 100644 index 20be9e1..0000000 --- a/vendor/golang.org/x/tools/README.md +++ /dev/null @@ -1,27 +0,0 @@ -# Go Tools - -This subrepository holds the source for various packages and tools that support -the Go programming language. - -Some of the tools, `godoc` and `vet` for example, are included in binary Go -distributions. - -Others, including the Go `guru` and the test coverage tool, can be fetched with -`go get`. - -Packages include a type-checker for Go and an implementation of the -Static Single Assignment form (SSA) representation for Go programs. - -## Download/Install - -The easiest way to install is to run `go get -u golang.org/x/tools/...`. You can -also manually git clone the repository to `$GOPATH/src/golang.org/x/tools`. - -## Report Issues / Send Patches - -This repository uses Gerrit for code changes. To learn how to submit changes to -this repository, see https://golang.org/doc/contribute.html. - -The main issue tracker for the tools repository is located at -https://github.com/golang/go/issues. Prefix your issue with "x/tools/(your -subdir):" in the subject line, so it is easy to find. diff --git a/vendor/golang.org/x/tools/codereview.cfg b/vendor/golang.org/x/tools/codereview.cfg deleted file mode 100644 index 3f8b14b..0000000 --- a/vendor/golang.org/x/tools/codereview.cfg +++ /dev/null @@ -1 +0,0 @@ -issuerepo: golang/go diff --git a/vendor/golang.org/x/tools/godoc/README.md b/vendor/golang.org/x/tools/godoc/README.md deleted file mode 100644 index 52bc8a4..0000000 --- a/vendor/golang.org/x/tools/godoc/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# godoc - -This directory contains most of the code for running a godoc server. The -executable lives at golang.org/x/tools/cmd/godoc. - -## Development mode - -In production, CSS/JS/template assets need to be compiled into the godoc -binary. It can be tedious to recompile assets every time, but you can pass a -flag to load CSS/JS/templates from disk every time a page loads: - -``` -godoc -templates=$GOPATH/src/golang.org/x/tools/godoc/static -http=:6060 -``` - -## Recompiling static assets - -The files that live at `static/style.css`, `static/jquery.js` and so on are not -present in the final binary. They are placed into `static/static.go` by running -`go generate`. So to compile a change and test it in your browser: - -1) Make changes to e.g. `static/style.css`. - -2) Run `go generate golang.org/x/tools/godoc/static` so `static/static.go` picks -up the change. - -3) Run `go install golang.org/x/tools/cmd/godoc` so the compiled `godoc` binary -picks up the change. - -4) Run `godoc -http=:6060` and view your changes in the browser. You may need -to disable your browser's cache to avoid reloading a stale file. diff --git a/vendor/golang.org/x/tools/godoc/appengine.go b/vendor/golang.org/x/tools/godoc/appengine.go deleted file mode 100644 index fe5e687..0000000 --- a/vendor/golang.org/x/tools/godoc/appengine.go +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2015 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build appengine - -package godoc - -import "google.golang.org/appengine" - -func init() { - onAppengine = !appengine.IsDevAppServer() -} diff --git a/vendor/golang.org/x/tools/godoc/cmdline.go b/vendor/golang.org/x/tools/godoc/cmdline.go deleted file mode 100644 index 7c53681..0000000 --- a/vendor/golang.org/x/tools/godoc/cmdline.go +++ /dev/null @@ -1,207 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "fmt" - "go/ast" - "go/build" - "io" - "log" - "os" - pathpkg "path" - "path/filepath" - "regexp" - "strings" - - "golang.org/x/tools/godoc/vfs" -) - -const ( - target = "/target" - cmdPrefix = "cmd/" - srcPrefix = "src/" - toolsPath = "golang.org/x/tools/cmd/" -) - -// CommandLine returns godoc results to w. -// Note that it may add a /target path to fs. -func CommandLine(w io.Writer, fs vfs.NameSpace, pres *Presentation, args []string) error { - path := args[0] - srcMode := pres.SrcMode - cmdMode := strings.HasPrefix(path, cmdPrefix) - if strings.HasPrefix(path, srcPrefix) { - path = strings.TrimPrefix(path, srcPrefix) - srcMode = true - } - var abspath, relpath string - if cmdMode { - path = strings.TrimPrefix(path, cmdPrefix) - } else { - abspath, relpath = paths(fs, pres, path) - } - - var mode PageInfoMode - if relpath == builtinPkgPath { - // the fake built-in package contains unexported identifiers - mode = NoFiltering | NoTypeAssoc - } - if srcMode { - // only filter exports if we don't have explicit command-line filter arguments - if len(args) > 1 { - mode |= NoFiltering - } - mode |= ShowSource - } - - // First, try as package unless forced as command. - var info *PageInfo - if !cmdMode { - info = pres.GetPkgPageInfo(abspath, relpath, mode) - } - - // Second, try as command (if the path is not absolute). - var cinfo *PageInfo - if !filepath.IsAbs(path) { - // First try go.tools/cmd. - abspath = pathpkg.Join(pres.PkgFSRoot(), toolsPath+path) - cinfo = pres.GetCmdPageInfo(abspath, relpath, mode) - if cinfo.IsEmpty() { - // Then try $GOROOT/cmd. - abspath = pathpkg.Join(pres.CmdFSRoot(), path) - cinfo = pres.GetCmdPageInfo(abspath, relpath, mode) - } - } - - // determine what to use - if info == nil || info.IsEmpty() { - if cinfo != nil && !cinfo.IsEmpty() { - // only cinfo exists - switch to cinfo - info = cinfo - } - } else if cinfo != nil && !cinfo.IsEmpty() { - // both info and cinfo exist - use cinfo if info - // contains only subdirectory information - if info.PAst == nil && info.PDoc == nil { - info = cinfo - } else if relpath != target { - // The above check handles the case where an operating system path - // is provided (see documentation for paths below). In that case, - // relpath is set to "/target" (in anticipation of accessing packages there), - // and is therefore not expected to match a command. - fmt.Fprintf(w, "use 'godoc %s%s' for documentation on the %s command \n\n", cmdPrefix, relpath, relpath) - } - } - - if info == nil { - return fmt.Errorf("%s: no such directory or package", args[0]) - } - if info.Err != nil { - return info.Err - } - - if info.PDoc != nil && info.PDoc.ImportPath == target { - // Replace virtual /target with actual argument from command line. - info.PDoc.ImportPath = args[0] - } - - // If we have more than one argument, use the remaining arguments for filtering. - if len(args) > 1 { - info.IsFiltered = true - filterInfo(args[1:], info) - } - - packageText := pres.PackageText - if pres.HTMLMode { - packageText = pres.PackageHTML - } - if err := packageText.Execute(w, info); err != nil { - return err - } - return nil -} - -// paths determines the paths to use. -// -// If we are passed an operating system path like . or ./foo or /foo/bar or c:\mysrc, -// we need to map that path somewhere in the fs name space so that routines -// like getPageInfo will see it. We use the arbitrarily-chosen virtual path "/target" -// for this. That is, if we get passed a directory like the above, we map that -// directory so that getPageInfo sees it as /target. -// Returns the absolute and relative paths. -func paths(fs vfs.NameSpace, pres *Presentation, path string) (string, string) { - if filepath.IsAbs(path) { - fs.Bind(target, vfs.OS(path), "/", vfs.BindReplace) - return target, target - } - if build.IsLocalImport(path) { - cwd, _ := os.Getwd() // ignore errors - path = filepath.Join(cwd, path) - fs.Bind(target, vfs.OS(path), "/", vfs.BindReplace) - return target, target - } - if bp, _ := build.Import(path, "", build.FindOnly); bp.Dir != "" && bp.ImportPath != "" { - fs.Bind(target, vfs.OS(bp.Dir), "/", vfs.BindReplace) - return target, bp.ImportPath - } - return pathpkg.Join(pres.PkgFSRoot(), path), path -} - -// filterInfo updates info to include only the nodes that match the given -// filter args. -func filterInfo(args []string, info *PageInfo) { - rx, err := makeRx(args) - if err != nil { - log.Fatalf("illegal regular expression from %v: %v", args, err) - } - - filter := func(s string) bool { return rx.MatchString(s) } - switch { - case info.PAst != nil: - newPAst := map[string]*ast.File{} - for name, a := range info.PAst { - cmap := ast.NewCommentMap(info.FSet, a, a.Comments) - a.Comments = []*ast.CommentGroup{} // remove all comments. - ast.FilterFile(a, filter) - if len(a.Decls) > 0 { - newPAst[name] = a - } - for _, d := range a.Decls { - // add back the comments associated with d only - comments := cmap.Filter(d).Comments() - a.Comments = append(a.Comments, comments...) - } - } - info.PAst = newPAst // add only matching files. - case info.PDoc != nil: - info.PDoc.Filter(filter) - } -} - -// Does s look like a regular expression? -func isRegexp(s string) bool { - return strings.ContainsAny(s, ".(|)*+?^$[]") -} - -// Make a regular expression of the form -// names[0]|names[1]|...names[len(names)-1]. -// Returns an error if the regular expression is illegal. -func makeRx(names []string) (*regexp.Regexp, error) { - if len(names) == 0 { - return nil, fmt.Errorf("no expression provided") - } - s := "" - for i, name := range names { - if i > 0 { - s += "|" - } - if isRegexp(name) { - s += name - } else { - s += "^" + name + "$" // must match exactly - } - } - return regexp.Compile(s) -} diff --git a/vendor/golang.org/x/tools/godoc/cmdline_test.go b/vendor/golang.org/x/tools/godoc/cmdline_test.go deleted file mode 100644 index 602f2bb..0000000 --- a/vendor/golang.org/x/tools/godoc/cmdline_test.go +++ /dev/null @@ -1,294 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "bytes" - "go/build" - "io/ioutil" - "os" - "path/filepath" - "reflect" - "regexp" - "runtime" - "testing" - "text/template" - - "golang.org/x/tools/godoc/vfs" - "golang.org/x/tools/godoc/vfs/mapfs" -) - -// setupGoroot creates temporary directory to act as GOROOT when running tests -// that depend upon the build package. It updates build.Default to point to the -// new GOROOT. -// It returns a function that can be called to reset build.Default and remove -// the temporary directory. -func setupGoroot(t *testing.T) (cleanup func()) { - var stdLib = map[string]string{ - "src/fmt/fmt.go": `// Package fmt implements formatted I/O. -package fmt - -type Stringer interface { - String() string -} -`, - } - goroot, err := ioutil.TempDir("", "cmdline_test") - if err != nil { - t.Fatal(err) - } - origContext := build.Default - build.Default = build.Context{ - GOROOT: goroot, - Compiler: "gc", - } - for relname, contents := range stdLib { - name := filepath.Join(goroot, relname) - if err := os.MkdirAll(filepath.Dir(name), 0770); err != nil { - t.Fatal(err) - } - if err := ioutil.WriteFile(name, []byte(contents), 0770); err != nil { - t.Fatal(err) - } - } - - return func() { - if err := os.RemoveAll(goroot); err != nil { - t.Log(err) - } - build.Default = origContext - } -} - -func TestPaths(t *testing.T) { - cleanup := setupGoroot(t) - defer cleanup() - - pres := &Presentation{ - pkgHandler: handlerServer{ - fsRoot: "/fsroot", - }, - } - fs := make(vfs.NameSpace) - - absPath := "/foo/fmt" - if runtime.GOOS == "windows" { - absPath = `c:\foo\fmt` - } - - for _, tc := range []struct { - desc string - path string - expAbs string - expRel string - }{ - { - "Absolute path", - absPath, - "/target", - "/target", - }, - { - "Local import", - "../foo/fmt", - "/target", - "/target", - }, - { - "Import", - "fmt", - "/target", - "fmt", - }, - { - "Default", - "unknownpkg", - "/fsroot/unknownpkg", - "unknownpkg", - }, - } { - abs, rel := paths(fs, pres, tc.path) - if abs != tc.expAbs || rel != tc.expRel { - t.Errorf("%s: paths(%q) = %s,%s; want %s,%s", tc.desc, tc.path, abs, rel, tc.expAbs, tc.expRel) - } - } -} - -func TestMakeRx(t *testing.T) { - for _, tc := range []struct { - desc string - names []string - exp string - }{ - { - desc: "empty string", - names: []string{""}, - exp: `^$`, - }, - { - desc: "simple text", - names: []string{"a"}, - exp: `^a$`, - }, - { - desc: "two words", - names: []string{"foo", "bar"}, - exp: `^foo$|^bar$`, - }, - { - desc: "word & non-trivial", - names: []string{"foo", `ab?c`}, - exp: `^foo$|ab?c`, - }, - { - desc: "bad regexp", - names: []string{`(."`}, - exp: `(."`, - }, - } { - expRE, expErr := regexp.Compile(tc.exp) - if re, err := makeRx(tc.names); !reflect.DeepEqual(err, expErr) && !reflect.DeepEqual(re, expRE) { - t.Errorf("%s: makeRx(%v) = %q,%q; want %q,%q", tc.desc, tc.names, re, err, expRE, expErr) - } - } -} - -func TestCommandLine(t *testing.T) { - cleanup := setupGoroot(t) - defer cleanup() - mfs := mapfs.New(map[string]string{ - "src/bar/bar.go": `// Package bar is an example. -package bar -`, - "src/foo/foo.go": `// Package foo. -package foo - -// First function is first. -func First() { -} - -// Second function is second. -func Second() { -} -`, - "src/gen/gen.go": `// Package gen -package gen - -//line notgen.go:3 -// F doc //line 1 should appear -// line 2 should appear -func F() -//line foo.go:100`, // no newline on end to check corner cases! - "src/vet/vet.go": `// Package vet -package vet -`, - "src/cmd/go/doc.go": `// The go command -package main -`, - "src/cmd/gofmt/doc.go": `// The gofmt command -package main -`, - "src/cmd/vet/vet.go": `// The vet command -package main -`, - }) - fs := make(vfs.NameSpace) - fs.Bind("/", mfs, "/", vfs.BindReplace) - c := NewCorpus(fs) - p := &Presentation{Corpus: c} - p.cmdHandler = handlerServer{ - p: p, - c: c, - pattern: "/cmd/", - fsRoot: "/src/cmd", - } - p.pkgHandler = handlerServer{ - p: p, - c: c, - pattern: "/pkg/", - fsRoot: "/src", - exclude: []string{"/src/cmd"}, - } - p.initFuncMap() - p.PackageText = template.Must(template.New("PackageText").Funcs(p.FuncMap()).Parse(`{{$info := .}}{{$filtered := .IsFiltered}}{{if $filtered}}{{range .PAst}}{{range .Decls}}{{node $info .}}{{end}}{{end}}{{else}}{{with .PAst}}{{range $filename, $ast := .}}{{$filename}}: -{{node $ $ast}}{{end}}{{end}}{{end}}{{with .PDoc}}{{if $.IsMain}}COMMAND {{.Doc}}{{else}}PACKAGE {{.Doc}}{{end}}{{with .Funcs}} -{{range .}}{{node $ .Decl}} -{{comment_text .Doc " " "\t"}}{{end}}{{end}}{{end}}`)) - - for _, tc := range []struct { - desc string - args []string - exp string - err bool - }{ - { - desc: "standard package", - args: []string{"fmt"}, - exp: "PACKAGE Package fmt implements formatted I/O.\n", - }, - { - desc: "package", - args: []string{"bar"}, - exp: "PACKAGE Package bar is an example.\n", - }, - { - desc: "package w. filter", - args: []string{"foo", "First"}, - exp: "PACKAGE \nfunc First()\n First function is first.\n", - }, - { - desc: "package w. bad filter", - args: []string{"foo", "DNE"}, - exp: "PACKAGE ", - }, - { - desc: "source mode", - args: []string{"src/bar"}, - exp: "bar/bar.go:\n// Package bar is an example.\npackage bar\n", - }, - { - desc: "source mode w. filter", - args: []string{"src/foo", "Second"}, - exp: "// Second function is second.\nfunc Second() {\n}", - }, - { - desc: "package w. //line comments", - args: []string{"gen", "F"}, - exp: "PACKAGE \nfunc F()\n F doc //line 1 should appear line 2 should appear\n", - }, - { - desc: "command", - args: []string{"go"}, - exp: "COMMAND The go command\n", - }, - { - desc: "forced command", - args: []string{"cmd/gofmt"}, - exp: "COMMAND The gofmt command\n", - }, - { - desc: "bad arg", - args: []string{"doesnotexist"}, - err: true, - }, - { - desc: "both command and package", - args: []string{"vet"}, - exp: "use 'godoc cmd/vet' for documentation on the vet command \n\nPACKAGE Package vet\n", - }, - { - desc: "root directory", - args: []string{"/"}, - exp: "", - }, - } { - w := new(bytes.Buffer) - err := CommandLine(w, fs, p, tc.args) - if got, want := w.String(), tc.exp; got != want || tc.err == (err == nil) { - t.Errorf("%s: CommandLine(%v) = %q (%v); want %q (%v)", - tc.desc, tc.args, got, err, want, tc.err) - } - } -} diff --git a/vendor/golang.org/x/tools/godoc/corpus.go b/vendor/golang.org/x/tools/godoc/corpus.go deleted file mode 100644 index f2c7ebb..0000000 --- a/vendor/golang.org/x/tools/godoc/corpus.go +++ /dev/null @@ -1,157 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "errors" - pathpkg "path" - "time" - - "golang.org/x/tools/godoc/analysis" - "golang.org/x/tools/godoc/util" - "golang.org/x/tools/godoc/vfs" -) - -// A Corpus holds all the state related to serving and indexing a -// collection of Go code. -// -// Construct a new Corpus with NewCorpus, then modify options, -// then call its Init method. -type Corpus struct { - fs vfs.FileSystem - - // Verbose logging. - Verbose bool - - // IndexEnabled controls whether indexing is enabled. - IndexEnabled bool - - // IndexFiles specifies a glob pattern specifying index files. - // If not empty, the index is read from these files in sorted - // order. - IndexFiles string - - // IndexThrottle specifies the indexing throttle value - // between 0.0 and 1.0. At 0.0, the indexer always sleeps. - // At 1.0, the indexer never sleeps. Because 0.0 is useless - // and redundant with setting IndexEnabled to false, the - // zero value for IndexThrottle means 0.9. - IndexThrottle float64 - - // IndexInterval specifies the time to sleep between reindexing - // all the sources. - // If zero, a default is used. If negative, the index is only - // built once. - IndexInterval time.Duration - - // IndexDocs enables indexing of Go documentation. - // This will produce search results for exported types, functions, - // methods, variables, and constants, and will link to the godoc - // documentation for those identifiers. - IndexDocs bool - - // IndexGoCode enables indexing of Go source code. - // This will produce search results for internal and external identifiers - // and will link to both declarations and uses of those identifiers in - // source code. - IndexGoCode bool - - // IndexFullText enables full-text indexing. - // This will provide search results for any matching text in any file that - // is indexed, including non-Go files (see whitelisted in index.go). - // Regexp searching is supported via full-text indexing. - IndexFullText bool - - // MaxResults optionally specifies the maximum results for indexing. - MaxResults int - - // SummarizePackage optionally specifies a function to - // summarize a package. It exists as an optimization to - // avoid reading files to parse package comments. - // - // If SummarizePackage returns false for ok, the caller - // ignores all return values and parses the files in the package - // as if SummarizePackage were nil. - // - // If showList is false, the package is hidden from the - // package listing. - SummarizePackage func(pkg string) (summary string, showList, ok bool) - - // IndexDirectory optionally specifies a function to determine - // whether the provided directory should be indexed. The dir - // will be of the form "/src/cmd/6a", "/doc/play", - // "/src/io", etc. - // If nil, all directories are indexed if indexing is enabled. - IndexDirectory func(dir string) bool - - testDir string // TODO(bradfitz,adg): migrate old godoc flag? looks unused. - - // Send a value on this channel to trigger a metadata refresh. - // It is buffered so that if a signal is not lost if sent - // during a refresh. - refreshMetadataSignal chan bool - - // file system information - fsTree util.RWValue // *Directory tree of packages, updated with each sync (but sync code is removed now) - fsModified util.RWValue // timestamp of last call to invalidateIndex - docMetadata util.RWValue // mapping from paths to *Metadata - - // SearchIndex is the search index in use. - searchIndex util.RWValue - - // Analysis is the result of type and pointer analysis. - Analysis analysis.Result -} - -// NewCorpus returns a new Corpus from a filesystem. -// The returned corpus has all indexing enabled and MaxResults set to 1000. -// Change or set any options on Corpus before calling the Corpus.Init method. -func NewCorpus(fs vfs.FileSystem) *Corpus { - c := &Corpus{ - fs: fs, - refreshMetadataSignal: make(chan bool, 1), - - MaxResults: 1000, - IndexEnabled: true, - IndexDocs: true, - IndexGoCode: true, - IndexFullText: true, - } - return c -} - -func (c *Corpus) CurrentIndex() (*Index, time.Time) { - v, t := c.searchIndex.Get() - idx, _ := v.(*Index) - return idx, t -} - -func (c *Corpus) FSModifiedTime() time.Time { - _, ts := c.fsModified.Get() - return ts -} - -// Init initializes Corpus, once options on Corpus are set. -// It must be called before any subsequent method calls. -func (c *Corpus) Init() error { - // TODO(bradfitz): do this in a goroutine because newDirectory might block for a long time? - // It used to be sometimes done in a goroutine before, at least in HTTP server mode. - if err := c.initFSTree(); err != nil { - return err - } - c.updateMetadata() - go c.refreshMetadataLoop() - return nil -} - -func (c *Corpus) initFSTree() error { - dir := c.newDirectory(pathpkg.Join("/", c.testDir), -1) - if dir == nil { - return errors.New("godoc: corpus fstree is nil") - } - c.fsTree.Set(dir) - c.invalidateIndex() - return nil -} diff --git a/vendor/golang.org/x/tools/godoc/dirtrees.go b/vendor/golang.org/x/tools/godoc/dirtrees.go deleted file mode 100644 index 2b14a41..0000000 --- a/vendor/golang.org/x/tools/godoc/dirtrees.go +++ /dev/null @@ -1,342 +0,0 @@ -// Copyright 2010 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains the code dealing with package directory trees. - -package godoc - -import ( - "go/doc" - "go/parser" - "go/token" - "log" - "os" - pathpkg "path" - "strings" -) - -// Conventional name for directories containing test data. -// Excluded from directory trees. -// -const testdataDirName = "testdata" - -type Directory struct { - Depth int - Path string // directory path; includes Name - Name string // directory name - HasPkg bool // true if the directory contains at least one package - Synopsis string // package documentation, if any - Dirs []*Directory // subdirectories -} - -func isGoFile(fi os.FileInfo) bool { - name := fi.Name() - return !fi.IsDir() && - len(name) > 0 && name[0] != '.' && // ignore .files - pathpkg.Ext(name) == ".go" -} - -func isPkgFile(fi os.FileInfo) bool { - return isGoFile(fi) && - !strings.HasSuffix(fi.Name(), "_test.go") // ignore test files -} - -func isPkgDir(fi os.FileInfo) bool { - name := fi.Name() - return fi.IsDir() && len(name) > 0 && - name[0] != '_' && name[0] != '.' // ignore _files and .files -} - -type treeBuilder struct { - c *Corpus - maxDepth int -} - -// ioGate is a semaphore controlling VFS activity (ReadDir, parseFile, etc). -// Send before an operation and receive after. -var ioGate = make(chan bool, 20) - -func (b *treeBuilder) newDirTree(fset *token.FileSet, path, name string, depth int) *Directory { - if name == testdataDirName { - return nil - } - - if depth >= b.maxDepth { - // return a dummy directory so that the parent directory - // doesn't get discarded just because we reached the max - // directory depth - return &Directory{ - Depth: depth, - Path: path, - Name: name, - } - } - - var synopses [3]string // prioritized package documentation (0 == highest priority) - - show := true // show in package listing - hasPkgFiles := false - haveSummary := false - - if hook := b.c.SummarizePackage; hook != nil { - if summary, show0, ok := hook(strings.TrimPrefix(path, "/src/")); ok { - hasPkgFiles = true - show = show0 - synopses[0] = summary - haveSummary = true - } - } - - ioGate <- true - list, err := b.c.fs.ReadDir(path) - <-ioGate - if err != nil { - // TODO: propagate more. See golang.org/issue/14252. - // For now: - if b.c.Verbose { - log.Printf("newDirTree reading %s: %v", path, err) - } - } - - // determine number of subdirectories and if there are package files - var dirchs []chan *Directory - - for _, d := range list { - filename := pathpkg.Join(path, d.Name()) - switch { - case isPkgDir(d): - ch := make(chan *Directory, 1) - dirchs = append(dirchs, ch) - name := d.Name() - go func() { - ch <- b.newDirTree(fset, filename, name, depth+1) - }() - case !haveSummary && isPkgFile(d): - // looks like a package file, but may just be a file ending in ".go"; - // don't just count it yet (otherwise we may end up with hasPkgFiles even - // though the directory doesn't contain any real package files - was bug) - // no "optimal" package synopsis yet; continue to collect synopses - ioGate <- true - const flags = parser.ParseComments | parser.PackageClauseOnly - file, err := b.c.parseFile(fset, filename, flags) - <-ioGate - if err != nil { - if b.c.Verbose { - log.Printf("Error parsing %v: %v", filename, err) - } - break - } - - hasPkgFiles = true - if file.Doc != nil { - // prioritize documentation - i := -1 - switch file.Name.Name { - case name: - i = 0 // normal case: directory name matches package name - case "main": - i = 1 // directory contains a main package - default: - i = 2 // none of the above - } - if 0 <= i && i < len(synopses) && synopses[i] == "" { - synopses[i] = doc.Synopsis(file.Doc.Text()) - } - } - haveSummary = synopses[0] != "" - } - } - - // create subdirectory tree - var dirs []*Directory - for _, ch := range dirchs { - if d := <-ch; d != nil { - dirs = append(dirs, d) - } - } - - // if there are no package files and no subdirectories - // containing package files, ignore the directory - if !hasPkgFiles && len(dirs) == 0 { - return nil - } - - // select the highest-priority synopsis for the directory entry, if any - synopsis := "" - for _, synopsis = range synopses { - if synopsis != "" { - break - } - } - - return &Directory{ - Depth: depth, - Path: path, - Name: name, - HasPkg: hasPkgFiles && show, // TODO(bradfitz): add proper Hide field? - Synopsis: synopsis, - Dirs: dirs, - } -} - -// newDirectory creates a new package directory tree with at most maxDepth -// levels, anchored at root. The result tree is pruned such that it only -// contains directories that contain package files or that contain -// subdirectories containing package files (transitively). If a non-nil -// pathFilter is provided, directory paths additionally must be accepted -// by the filter (i.e., pathFilter(path) must be true). If a value >= 0 is -// provided for maxDepth, nodes at larger depths are pruned as well; they -// are assumed to contain package files even if their contents are not known -// (i.e., in this case the tree may contain directories w/o any package files). -// -func (c *Corpus) newDirectory(root string, maxDepth int) *Directory { - // The root could be a symbolic link so use Stat not Lstat. - d, err := c.fs.Stat(root) - // If we fail here, report detailed error messages; otherwise - // is is hard to see why a directory tree was not built. - switch { - case err != nil: - log.Printf("newDirectory(%s): %s", root, err) - return nil - case root != "/" && !isPkgDir(d): - log.Printf("newDirectory(%s): not a package directory", root) - return nil - case root == "/" && !d.IsDir(): - log.Printf("newDirectory(%s): not a directory", root) - return nil - } - if maxDepth < 0 { - maxDepth = 1e6 // "infinity" - } - b := treeBuilder{c, maxDepth} - // the file set provided is only for local parsing, no position - // information escapes and thus we don't need to save the set - return b.newDirTree(token.NewFileSet(), root, d.Name(), 0) -} - -func (dir *Directory) walk(c chan<- *Directory, skipRoot bool) { - if dir != nil { - if !skipRoot { - c <- dir - } - for _, d := range dir.Dirs { - d.walk(c, false) - } - } -} - -func (dir *Directory) iter(skipRoot bool) <-chan *Directory { - c := make(chan *Directory) - go func() { - dir.walk(c, skipRoot) - close(c) - }() - return c -} - -func (dir *Directory) lookupLocal(name string) *Directory { - for _, d := range dir.Dirs { - if d.Name == name { - return d - } - } - return nil -} - -func splitPath(p string) []string { - p = strings.TrimPrefix(p, "/") - if p == "" { - return nil - } - return strings.Split(p, "/") -} - -// lookup looks for the *Directory for a given path, relative to dir. -func (dir *Directory) lookup(path string) *Directory { - d := splitPath(dir.Path) - p := splitPath(path) - i := 0 - for i < len(d) { - if i >= len(p) || d[i] != p[i] { - return nil - } - i++ - } - for dir != nil && i < len(p) { - dir = dir.lookupLocal(p[i]) - i++ - } - return dir -} - -// DirEntry describes a directory entry. The Depth and Height values -// are useful for presenting an entry in an indented fashion. -// -type DirEntry struct { - Depth int // >= 0 - Height int // = DirList.MaxHeight - Depth, > 0 - Path string // directory path; includes Name, relative to DirList root - Name string // directory name - HasPkg bool // true if the directory contains at least one package - Synopsis string // package documentation, if any -} - -type DirList struct { - MaxHeight int // directory tree height, > 0 - List []DirEntry -} - -// listing creates a (linear) directory listing from a directory tree. -// If skipRoot is set, the root directory itself is excluded from the list. -// If filter is set, only the directory entries whose paths match the filter -// are included. -// -func (root *Directory) listing(skipRoot bool, filter func(string) bool) *DirList { - if root == nil { - return nil - } - - // determine number of entries n and maximum height - n := 0 - minDepth := 1 << 30 // infinity - maxDepth := 0 - for d := range root.iter(skipRoot) { - n++ - if minDepth > d.Depth { - minDepth = d.Depth - } - if maxDepth < d.Depth { - maxDepth = d.Depth - } - } - maxHeight := maxDepth - minDepth + 1 - - if n == 0 { - return nil - } - - // create list - list := make([]DirEntry, 0, n) - for d := range root.iter(skipRoot) { - if filter != nil && !filter(d.Path) { - continue - } - var p DirEntry - p.Depth = d.Depth - minDepth - p.Height = maxHeight - p.Depth - // the path is relative to root.Path - remove the root.Path - // prefix (the prefix should always be present but avoid - // crashes and check) - path := strings.TrimPrefix(d.Path, root.Path) - // remove leading separator if any - path must be relative - path = strings.TrimPrefix(path, "/") - p.Path = path - p.Name = d.Name - p.HasPkg = d.HasPkg - p.Synopsis = d.Synopsis - list = append(list, p) - } - - return &DirList{maxHeight, list} -} diff --git a/vendor/golang.org/x/tools/godoc/format.go b/vendor/golang.org/x/tools/godoc/format.go deleted file mode 100644 index 6013238..0000000 --- a/vendor/golang.org/x/tools/godoc/format.go +++ /dev/null @@ -1,371 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file implements FormatSelections and FormatText. -// FormatText is used to HTML-format Go and non-Go source -// text with line numbers and highlighted sections. It is -// built on top of FormatSelections, a generic formatter -// for "selected" text. - -package godoc - -import ( - "fmt" - "go/scanner" - "go/token" - "io" - "regexp" - "strconv" - "text/template" -) - -// ---------------------------------------------------------------------------- -// Implementation of FormatSelections - -// A Segment describes a text segment [start, end). -// The zero value of a Segment is a ready-to-use empty segment. -// -type Segment struct { - start, end int -} - -func (seg *Segment) isEmpty() bool { return seg.start >= seg.end } - -// A Selection is an "iterator" function returning a text segment. -// Repeated calls to a selection return consecutive, non-overlapping, -// non-empty segments, followed by an infinite sequence of empty -// segments. The first empty segment marks the end of the selection. -// -type Selection func() Segment - -// A LinkWriter writes some start or end "tag" to w for the text offset offs. -// It is called by FormatSelections at the start or end of each link segment. -// -type LinkWriter func(w io.Writer, offs int, start bool) - -// A SegmentWriter formats a text according to selections and writes it to w. -// The selections parameter is a bit set indicating which selections provided -// to FormatSelections overlap with the text segment: If the n'th bit is set -// in selections, the n'th selection provided to FormatSelections is overlapping -// with the text. -// -type SegmentWriter func(w io.Writer, text []byte, selections int) - -// FormatSelections takes a text and writes it to w using link and segment -// writers lw and sw as follows: lw is invoked for consecutive segment starts -// and ends as specified through the links selection, and sw is invoked for -// consecutive segments of text overlapped by the same selections as specified -// by selections. The link writer lw may be nil, in which case the links -// Selection is ignored. -// -func FormatSelections(w io.Writer, text []byte, lw LinkWriter, links Selection, sw SegmentWriter, selections ...Selection) { - // If we have a link writer, make the links - // selection the last entry in selections - if lw != nil { - selections = append(selections, links) - } - - // compute the sequence of consecutive segment changes - changes := newMerger(selections) - - // The i'th bit in bitset indicates that the text - // at the current offset is covered by selections[i]. - bitset := 0 - lastOffs := 0 - - // Text segments are written in a delayed fashion - // such that consecutive segments belonging to the - // same selection can be combined (peephole optimization). - // last describes the last segment which has not yet been written. - var last struct { - begin, end int // valid if begin < end - bitset int - } - - // flush writes the last delayed text segment - flush := func() { - if last.begin < last.end { - sw(w, text[last.begin:last.end], last.bitset) - } - last.begin = last.end // invalidate last - } - - // segment runs the segment [lastOffs, end) with the selection - // indicated by bitset through the segment peephole optimizer. - segment := func(end int) { - if lastOffs < end { // ignore empty segments - if last.end != lastOffs || last.bitset != bitset { - // the last segment is not adjacent to or - // differs from the new one - flush() - // start a new segment - last.begin = lastOffs - } - last.end = end - last.bitset = bitset - } - } - - for { - // get the next segment change - index, offs, start := changes.next() - if index < 0 || offs > len(text) { - // no more segment changes or the next change - // is past the end of the text - we're done - break - } - // determine the kind of segment change - if lw != nil && index == len(selections)-1 { - // we have a link segment change (see start of this function): - // format the previous selection segment, write the - // link tag and start a new selection segment - segment(offs) - flush() - lastOffs = offs - lw(w, offs, start) - } else { - // we have a selection change: - // format the previous selection segment, determine - // the new selection bitset and start a new segment - segment(offs) - lastOffs = offs - mask := 1 << uint(index) - if start { - bitset |= mask - } else { - bitset &^= mask - } - } - } - segment(len(text)) - flush() -} - -// A merger merges a slice of Selections and produces a sequence of -// consecutive segment change events through repeated next() calls. -// -type merger struct { - selections []Selection - segments []Segment // segments[i] is the next segment of selections[i] -} - -const infinity int = 2e9 - -func newMerger(selections []Selection) *merger { - segments := make([]Segment, len(selections)) - for i, sel := range selections { - segments[i] = Segment{infinity, infinity} - if sel != nil { - if seg := sel(); !seg.isEmpty() { - segments[i] = seg - } - } - } - return &merger{selections, segments} -} - -// next returns the next segment change: index specifies the Selection -// to which the segment belongs, offs is the segment start or end offset -// as determined by the start value. If there are no more segment changes, -// next returns an index value < 0. -// -func (m *merger) next() (index, offs int, start bool) { - // find the next smallest offset where a segment starts or ends - offs = infinity - index = -1 - for i, seg := range m.segments { - switch { - case seg.start < offs: - offs = seg.start - index = i - start = true - case seg.end < offs: - offs = seg.end - index = i - start = false - } - } - if index < 0 { - // no offset found => all selections merged - return - } - // offset found - it's either the start or end offset but - // either way it is ok to consume the start offset: set it - // to infinity so it won't be considered in the following - // next call - m.segments[index].start = infinity - if start { - return - } - // end offset found - consume it - m.segments[index].end = infinity - // advance to the next segment for that selection - seg := m.selections[index]() - if !seg.isEmpty() { - m.segments[index] = seg - } - return -} - -// ---------------------------------------------------------------------------- -// Implementation of FormatText - -// lineSelection returns the line segments for text as a Selection. -func lineSelection(text []byte) Selection { - i, j := 0, 0 - return func() (seg Segment) { - // find next newline, if any - for j < len(text) { - j++ - if text[j-1] == '\n' { - break - } - } - if i < j { - // text[i:j] constitutes a line - seg = Segment{i, j} - i = j - } - return - } -} - -// tokenSelection returns, as a selection, the sequence of -// consecutive occurrences of token sel in the Go src text. -// -func tokenSelection(src []byte, sel token.Token) Selection { - var s scanner.Scanner - fset := token.NewFileSet() - file := fset.AddFile("", fset.Base(), len(src)) - s.Init(file, src, nil, scanner.ScanComments) - return func() (seg Segment) { - for { - pos, tok, lit := s.Scan() - if tok == token.EOF { - break - } - offs := file.Offset(pos) - if tok == sel { - seg = Segment{offs, offs + len(lit)} - break - } - } - return - } -} - -// makeSelection is a helper function to make a Selection from a slice of pairs. -// Pairs describing empty segments are ignored. -// -func makeSelection(matches [][]int) Selection { - i := 0 - return func() Segment { - for i < len(matches) { - m := matches[i] - i++ - if m[0] < m[1] { - // non-empty segment - return Segment{m[0], m[1]} - } - } - return Segment{} - } -} - -// regexpSelection computes the Selection for the regular expression expr in text. -func regexpSelection(text []byte, expr string) Selection { - var matches [][]int - if rx, err := regexp.Compile(expr); err == nil { - matches = rx.FindAllIndex(text, -1) - } - return makeSelection(matches) -} - -var selRx = regexp.MustCompile(`^([0-9]+):([0-9]+)`) - -// RangeSelection computes the Selection for a text range described -// by the argument str; the range description must match the selRx -// regular expression. -func RangeSelection(str string) Selection { - m := selRx.FindStringSubmatch(str) - if len(m) >= 2 { - from, _ := strconv.Atoi(m[1]) - to, _ := strconv.Atoi(m[2]) - if from < to { - return makeSelection([][]int{{from, to}}) - } - } - return nil -} - -// Span tags for all the possible selection combinations that may -// be generated by FormatText. Selections are indicated by a bitset, -// and the value of the bitset specifies the tag to be used. -// -// bit 0: comments -// bit 1: highlights -// bit 2: selections -// -var startTags = [][]byte{ - /* 000 */ []byte(``), - /* 001 */ []byte(``), - /* 010 */ []byte(``), - /* 011 */ []byte(``), - /* 100 */ []byte(``), - /* 101 */ []byte(``), - /* 110 */ []byte(``), - /* 111 */ []byte(``), -} - -var endTag = []byte(``) - -func selectionTag(w io.Writer, text []byte, selections int) { - if selections < len(startTags) { - if tag := startTags[selections]; len(tag) > 0 { - w.Write(tag) - template.HTMLEscape(w, text) - w.Write(endTag) - return - } - } - template.HTMLEscape(w, text) -} - -// FormatText HTML-escapes text and writes it to w. -// Consecutive text segments are wrapped in HTML spans (with tags as -// defined by startTags and endTag) as follows: -// -// - if line >= 0, line number (ln) spans are inserted before each line, -// starting with the value of line -// - if the text is Go source, comments get the "comment" span class -// - each occurrence of the regular expression pattern gets the "highlight" -// span class -// - text segments covered by selection get the "selection" span class -// -// Comments, highlights, and selections may overlap arbitrarily; the respective -// HTML span classes are specified in the startTags variable. -// -func FormatText(w io.Writer, text []byte, line int, goSource bool, pattern string, selection Selection) { - var comments, highlights Selection - if goSource { - comments = tokenSelection(text, token.COMMENT) - } - if pattern != "" { - highlights = regexpSelection(text, pattern) - } - if line >= 0 || comments != nil || highlights != nil || selection != nil { - var lineTag LinkWriter - if line >= 0 { - lineTag = func(w io.Writer, _ int, start bool) { - if start { - fmt.Fprintf(w, "%6d\t", line, line) - line++ - } - } - } - FormatSelections(w, text, lineTag, lineSelection(text), selectionTag, comments, highlights, selection) - } else { - template.HTMLEscape(w, text) - } -} diff --git a/vendor/golang.org/x/tools/godoc/godoc.go b/vendor/golang.org/x/tools/godoc/godoc.go deleted file mode 100644 index d6c27d0..0000000 --- a/vendor/golang.org/x/tools/godoc/godoc.go +++ /dev/null @@ -1,911 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package godoc is a work-in-progress (2013-07-17) package to -// begin splitting up the godoc binary into multiple pieces. -// -// This package comment will evolve over time as this package splits -// into smaller pieces. -package godoc // import "golang.org/x/tools/godoc" - -import ( - "bytes" - "fmt" - "go/ast" - "go/doc" - "go/format" - "go/printer" - "go/token" - htmltemplate "html/template" - "io" - "log" - "os" - pathpkg "path" - "regexp" - "strconv" - "strings" - "text/template" - "time" - "unicode" - "unicode/utf8" -) - -// Fake relative package path for built-ins. Documentation for all globals -// (not just exported ones) will be shown for packages in this directory. -const builtinPkgPath = "builtin" - -// FuncMap defines template functions used in godoc templates. -// -// Convention: template function names ending in "_html" or "_url" produce -// HTML- or URL-escaped strings; all other function results may -// require explicit escaping in the template. -func (p *Presentation) FuncMap() template.FuncMap { - p.initFuncMapOnce.Do(p.initFuncMap) - return p.funcMap -} - -func (p *Presentation) TemplateFuncs() template.FuncMap { - p.initFuncMapOnce.Do(p.initFuncMap) - return p.templateFuncs -} - -func (p *Presentation) initFuncMap() { - if p.Corpus == nil { - panic("nil Presentation.Corpus") - } - p.templateFuncs = template.FuncMap{ - "code": p.code, - } - p.funcMap = template.FuncMap{ - // various helpers - "filename": filenameFunc, - "repeat": strings.Repeat, - - // access to FileInfos (directory listings) - "fileInfoName": fileInfoNameFunc, - "fileInfoTime": fileInfoTimeFunc, - - // access to search result information - "infoKind_html": infoKind_htmlFunc, - "infoLine": p.infoLineFunc, - "infoSnippet_html": p.infoSnippet_htmlFunc, - - // formatting of AST nodes - "node": p.nodeFunc, - "node_html": p.node_htmlFunc, - "comment_html": comment_htmlFunc, - "comment_text": comment_textFunc, - "sanitize": sanitizeFunc, - - // support for URL attributes - "pkgLink": pkgLinkFunc, - "srcLink": srcLinkFunc, - "posLink_url": newPosLink_urlFunc(srcPosLinkFunc), - "docLink": docLinkFunc, - "queryLink": queryLinkFunc, - "srcBreadcrumb": srcBreadcrumbFunc, - "srcToPkgLink": srcToPkgLinkFunc, - - // formatting of Examples - "example_html": p.example_htmlFunc, - "example_text": p.example_textFunc, - "example_name": p.example_nameFunc, - "example_suffix": p.example_suffixFunc, - - // formatting of analysis information - "callgraph_html": p.callgraph_htmlFunc, - "implements_html": p.implements_htmlFunc, - "methodset_html": p.methodset_htmlFunc, - - // formatting of Notes - "noteTitle": noteTitle, - - // Number operation - "multiply": multiply, - - // formatting of PageInfoMode query string - "modeQueryString": modeQueryString, - } - if p.URLForSrc != nil { - p.funcMap["srcLink"] = p.URLForSrc - } - if p.URLForSrcPos != nil { - p.funcMap["posLink_url"] = newPosLink_urlFunc(p.URLForSrcPos) - } - if p.URLForSrcQuery != nil { - p.funcMap["queryLink"] = p.URLForSrcQuery - } -} - -func multiply(a, b int) int { return a * b } - -func filenameFunc(path string) string { - _, localname := pathpkg.Split(path) - return localname -} - -func fileInfoNameFunc(fi os.FileInfo) string { - name := fi.Name() - if fi.IsDir() { - name += "/" - } - return name -} - -func fileInfoTimeFunc(fi os.FileInfo) string { - if t := fi.ModTime(); t.Unix() != 0 { - return t.Local().String() - } - return "" // don't return epoch if time is obviously not set -} - -// The strings in infoKinds must be properly html-escaped. -var infoKinds = [nKinds]string{ - PackageClause: "package clause", - ImportDecl: "import decl", - ConstDecl: "const decl", - TypeDecl: "type decl", - VarDecl: "var decl", - FuncDecl: "func decl", - MethodDecl: "method decl", - Use: "use", -} - -func infoKind_htmlFunc(info SpotInfo) string { - return infoKinds[info.Kind()] // infoKind entries are html-escaped -} - -func (p *Presentation) infoLineFunc(info SpotInfo) int { - line := info.Lori() - if info.IsIndex() { - index, _ := p.Corpus.searchIndex.Get() - if index != nil { - line = index.(*Index).Snippet(line).Line - } else { - // no line information available because - // we don't have an index - this should - // never happen; be conservative and don't - // crash - line = 0 - } - } - return line -} - -func (p *Presentation) infoSnippet_htmlFunc(info SpotInfo) string { - if info.IsIndex() { - index, _ := p.Corpus.searchIndex.Get() - // Snippet.Text was HTML-escaped when it was generated - return index.(*Index).Snippet(info.Lori()).Text - } - return `no snippet text available` -} - -func (p *Presentation) nodeFunc(info *PageInfo, node interface{}) string { - var buf bytes.Buffer - p.writeNode(&buf, info.FSet, node) - return buf.String() -} - -func (p *Presentation) node_htmlFunc(info *PageInfo, node interface{}, linkify bool) string { - var buf1 bytes.Buffer - p.writeNode(&buf1, info.FSet, node) - - var buf2 bytes.Buffer - if n, _ := node.(ast.Node); n != nil && linkify && p.DeclLinks { - LinkifyText(&buf2, buf1.Bytes(), n) - if st, name := isStructTypeDecl(n); st != nil { - addStructFieldIDAttributes(&buf2, name, st) - } - } else { - FormatText(&buf2, buf1.Bytes(), -1, true, "", nil) - } - - return buf2.String() -} - -// isStructTypeDecl checks whether n is a struct declaration. -// It either returns a non-nil StructType and its name, or zero values. -func isStructTypeDecl(n ast.Node) (st *ast.StructType, name string) { - gd, ok := n.(*ast.GenDecl) - if !ok || gd.Tok != token.TYPE { - return nil, "" - } - if gd.Lparen > 0 { - // Parenthesized type. Who does that, anyway? - // TODO: Reportedly gri does. Fix this to handle that too. - return nil, "" - } - if len(gd.Specs) != 1 { - return nil, "" - } - ts, ok := gd.Specs[0].(*ast.TypeSpec) - if !ok { - return nil, "" - } - st, ok = ts.Type.(*ast.StructType) - if !ok { - return nil, "" - } - return st, ts.Name.Name -} - -// addStructFieldIDAttributes modifies the contents of buf such that -// all struct fields of the named struct have -// in them, so people can link to /#Struct.Field. -func addStructFieldIDAttributes(buf *bytes.Buffer, name string, st *ast.StructType) { - if st.Fields == nil { - return - } - // needsLink is a set of identifiers that still need to be - // linked, where value == key, to avoid an allocation in func - // linkedField. - needsLink := make(map[string]string) - - for _, f := range st.Fields.List { - if len(f.Names) == 0 { - continue - } - fieldName := f.Names[0].Name - needsLink[fieldName] = fieldName - } - var newBuf bytes.Buffer - foreachLine(buf.Bytes(), func(line []byte) { - if fieldName := linkedField(line, needsLink); fieldName != "" { - fmt.Fprintf(&newBuf, ``, name, fieldName) - delete(needsLink, fieldName) - } - newBuf.Write(line) - }) - buf.Reset() - buf.Write(newBuf.Bytes()) -} - -// foreachLine calls fn for each line of in, where a line includes -// the trailing "\n", except on the last line, if it doesn't exist. -func foreachLine(in []byte, fn func(line []byte)) { - for len(in) > 0 { - nl := bytes.IndexByte(in, '\n') - if nl == -1 { - fn(in) - return - } - fn(in[:nl+1]) - in = in[nl+1:] - } -} - -// commentPrefix is the line prefix for comments after they've been HTMLified. -var commentPrefix = []byte(`// `) - -// linkedField determines whether the given line starts with an -// identifer in the provided ids map (mapping from identifier to the -// same identifier). The line can start with either an identifier or -// an identifier in a comment. If one matches, it returns the -// identifier that matched. Otherwise it returns the empty string. -func linkedField(line []byte, ids map[string]string) string { - line = bytes.TrimSpace(line) - - // For fields with a doc string of the - // conventional form, we put the new span into - // the comment instead of the field. - // The "conventional" form is a complete sentence - // per https://golang.org/s/style#comment-sentences like: - // - // // Foo is an optional Fooer to foo the foos. - // Foo Fooer - // - // In this case, we want the #StructName.Foo - // link to make the browser go to the comment - // line "Foo is an optional Fooer" instead of - // the "Foo Fooer" line, which could otherwise - // obscure the docs above the browser's "fold". - // - // TODO: do this better, so it works for all - // comments, including unconventional ones. - if bytes.HasPrefix(line, commentPrefix) { - line = line[len(commentPrefix):] - } - id := scanIdentifier(line) - if len(id) == 0 { - // No leading identifier. Avoid map lookup for - // somewhat common case. - return "" - } - return ids[string(id)] -} - -// scanIdentifier scans a valid Go identifier off the front of v and -// either returns a subslice of v if there's a valid identifier, or -// returns a zero-length slice. -func scanIdentifier(v []byte) []byte { - var n int // number of leading bytes of v belonging to an identifier - for { - r, width := utf8.DecodeRune(v[n:]) - if !(isLetter(r) || n > 0 && isDigit(r)) { - break - } - n += width - } - return v[:n] -} - -func isLetter(ch rune) bool { - return 'a' <= ch && ch <= 'z' || 'A' <= ch && ch <= 'Z' || ch == '_' || ch >= utf8.RuneSelf && unicode.IsLetter(ch) -} - -func isDigit(ch rune) bool { - return '0' <= ch && ch <= '9' || ch >= utf8.RuneSelf && unicode.IsDigit(ch) -} - -func comment_htmlFunc(comment string) string { - var buf bytes.Buffer - // TODO(gri) Provide list of words (e.g. function parameters) - // to be emphasized by ToHTML. - doc.ToHTML(&buf, comment, nil) // does html-escaping - return buf.String() -} - -// punchCardWidth is the number of columns of fixed-width -// characters to assume when wrapping text. Very few people -// use terminals or cards smaller than 80 characters, so 80 it is. -// We do not try to sniff the environment or the tty to adapt to -// the situation; instead, by using a constant we make sure that -// godoc always produces the same output regardless of context, -// a consistency that is lost otherwise. For example, if we sniffed -// the environment or tty, then http://golang.org/pkg/math/?m=text -// would depend on the width of the terminal where godoc started, -// which is clearly bogus. More generally, the Unix tools that behave -// differently when writing to a tty than when writing to a file have -// a history of causing confusion (compare `ls` and `ls | cat`), and we -// want to avoid that mistake here. -const punchCardWidth = 80 - -func containsOnlySpace(buf []byte) bool { - isNotSpace := func(r rune) bool { return !unicode.IsSpace(r) } - return bytes.IndexFunc(buf, isNotSpace) == -1 -} - -func comment_textFunc(comment, indent, preIndent string) string { - var buf bytes.Buffer - doc.ToText(&buf, comment, indent, preIndent, punchCardWidth-2*len(indent)) - if containsOnlySpace(buf.Bytes()) { - return "" - } - return buf.String() -} - -// sanitizeFunc sanitizes the argument src by replacing newlines with -// blanks, removing extra blanks, and by removing trailing whitespace -// and commas before closing parentheses. -func sanitizeFunc(src string) string { - buf := make([]byte, len(src)) - j := 0 // buf index - comma := -1 // comma index if >= 0 - for i := 0; i < len(src); i++ { - ch := src[i] - switch ch { - case '\t', '\n', ' ': - // ignore whitespace at the beginning, after a blank, or after opening parentheses - if j == 0 { - continue - } - if p := buf[j-1]; p == ' ' || p == '(' || p == '{' || p == '[' { - continue - } - // replace all whitespace with blanks - ch = ' ' - case ',': - comma = j - case ')', '}', ']': - // remove any trailing comma - if comma >= 0 { - j = comma - } - // remove any trailing whitespace - if j > 0 && buf[j-1] == ' ' { - j-- - } - default: - comma = -1 - } - buf[j] = ch - j++ - } - // remove trailing blank, if any - if j > 0 && buf[j-1] == ' ' { - j-- - } - return string(buf[:j]) -} - -type PageInfo struct { - Dirname string // directory containing the package - Err error // error or nil - GoogleCN bool // page is being served from golang.google.cn - - Mode PageInfoMode // display metadata from query string - - // package info - FSet *token.FileSet // nil if no package documentation - PDoc *doc.Package // nil if no package documentation - Examples []*doc.Example // nil if no example code - Notes map[string][]*doc.Note // nil if no package Notes - PAst map[string]*ast.File // nil if no AST with package exports - IsMain bool // true for package main - IsFiltered bool // true if results were filtered - - // analysis info - TypeInfoIndex map[string]int // index of JSON datum for type T (if -analysis=type) - AnalysisData htmltemplate.JS // array of TypeInfoJSON values - CallGraph htmltemplate.JS // array of PCGNodeJSON values (if -analysis=pointer) - CallGraphIndex map[string]int // maps func name to index in CallGraph - - // directory info - Dirs *DirList // nil if no directory information - DirTime time.Time // directory time stamp - DirFlat bool // if set, show directory in a flat (non-indented) manner -} - -func (info *PageInfo) IsEmpty() bool { - return info.Err != nil || info.PAst == nil && info.PDoc == nil && info.Dirs == nil -} - -func pkgLinkFunc(path string) string { - // because of the irregular mapping under goroot - // we need to correct certain relative paths - path = strings.TrimPrefix(path, "/") - path = strings.TrimPrefix(path, "src/") - path = strings.TrimPrefix(path, "pkg/") - return "pkg/" + path -} - -// srcToPkgLinkFunc builds an
tag linking to the package -// documentation of relpath. -func srcToPkgLinkFunc(relpath string) string { - relpath = pkgLinkFunc(relpath) - relpath = pathpkg.Dir(relpath) - if relpath == "pkg" { - return `Index` - } - return fmt.Sprintf(`%s`, relpath, relpath[len("pkg/"):]) -} - -// srcBreadcrumbFun converts each segment of relpath to a HTML . -// Each segment links to its corresponding src directories. -func srcBreadcrumbFunc(relpath string) string { - segments := strings.Split(relpath, "/") - var buf bytes.Buffer - var selectedSegment string - var selectedIndex int - - if strings.HasSuffix(relpath, "/") { - // relpath is a directory ending with a "/". - // Selected segment is the segment before the last slash. - selectedIndex = len(segments) - 2 - selectedSegment = segments[selectedIndex] + "/" - } else { - selectedIndex = len(segments) - 1 - selectedSegment = segments[selectedIndex] - } - - for i := range segments[:selectedIndex] { - buf.WriteString(fmt.Sprintf(`%s/`, - strings.Join(segments[:i+1], "/"), - segments[i], - )) - } - - buf.WriteString(``) - buf.WriteString(selectedSegment) - buf.WriteString(``) - return buf.String() -} - -func newPosLink_urlFunc(srcPosLinkFunc func(s string, line, low, high int) string) func(info *PageInfo, n interface{}) string { - // n must be an ast.Node or a *doc.Note - return func(info *PageInfo, n interface{}) string { - var pos, end token.Pos - - switch n := n.(type) { - case ast.Node: - pos = n.Pos() - end = n.End() - case *doc.Note: - pos = n.Pos - end = n.End - default: - panic(fmt.Sprintf("wrong type for posLink_url template formatter: %T", n)) - } - - var relpath string - var line int - var low, high int // selection offset range - - if pos.IsValid() { - p := info.FSet.Position(pos) - relpath = p.Filename - line = p.Line - low = p.Offset - } - if end.IsValid() { - high = info.FSet.Position(end).Offset - } - - return srcPosLinkFunc(relpath, line, low, high) - } -} - -func srcPosLinkFunc(s string, line, low, high int) string { - s = srcLinkFunc(s) - var buf bytes.Buffer - template.HTMLEscape(&buf, []byte(s)) - // selection ranges are of form "s=low:high" - if low < high { - fmt.Fprintf(&buf, "?s=%d:%d", low, high) // no need for URL escaping - // if we have a selection, position the page - // such that the selection is a bit below the top - line -= 10 - if line < 1 { - line = 1 - } - } - // line id's in html-printed source are of the - // form "L%d" where %d stands for the line number - if line > 0 { - fmt.Fprintf(&buf, "#L%d", line) // no need for URL escaping - } - return buf.String() -} - -func srcLinkFunc(s string) string { - s = pathpkg.Clean("/" + s) - if !strings.HasPrefix(s, "/src/") { - s = "/src" + s - } - return s -} - -// queryLinkFunc returns a URL for a line in a source file with a highlighted -// query term. -// s is expected to be a path to a source file. -// query is expected to be a string that has already been appropriately escaped -// for use in a URL query. -func queryLinkFunc(s, query string, line int) string { - url := pathpkg.Clean("/"+s) + "?h=" + query - if line > 0 { - url += "#L" + strconv.Itoa(line) - } - return url -} - -func docLinkFunc(s string, ident string) string { - return pathpkg.Clean("/pkg/"+s) + "/#" + ident -} - -func (p *Presentation) example_textFunc(info *PageInfo, funcName, indent string) string { - if !p.ShowExamples { - return "" - } - - var buf bytes.Buffer - first := true - for _, eg := range info.Examples { - name := stripExampleSuffix(eg.Name) - if name != funcName { - continue - } - - if !first { - buf.WriteString("\n") - } - first = false - - // print code - cnode := &printer.CommentedNode{Node: eg.Code, Comments: eg.Comments} - config := &printer.Config{Mode: printer.UseSpaces, Tabwidth: p.TabWidth} - var buf1 bytes.Buffer - config.Fprint(&buf1, info.FSet, cnode) - code := buf1.String() - - // Additional formatting if this is a function body. Unfortunately, we - // can't print statements individually because we would lose comments - // on later statements. - if n := len(code); n >= 2 && code[0] == '{' && code[n-1] == '}' { - // remove surrounding braces - code = code[1 : n-1] - // unindent - code = replaceLeadingIndentation(code, strings.Repeat(" ", p.TabWidth), indent) - } - code = strings.Trim(code, "\n") - - buf.WriteString(indent) - buf.WriteString("Example:\n") - buf.WriteString(code) - buf.WriteString("\n\n") - } - return buf.String() -} - -func (p *Presentation) example_htmlFunc(info *PageInfo, funcName string) string { - var buf bytes.Buffer - for _, eg := range info.Examples { - name := stripExampleSuffix(eg.Name) - - if name != funcName { - continue - } - - // print code - cnode := &printer.CommentedNode{Node: eg.Code, Comments: eg.Comments} - code := p.node_htmlFunc(info, cnode, true) - out := eg.Output - wholeFile := true - - // Additional formatting if this is a function body. - if n := len(code); n >= 2 && code[0] == '{' && code[n-1] == '}' { - wholeFile = false - // remove surrounding braces - code = code[1 : n-1] - // unindent - code = replaceLeadingIndentation(code, strings.Repeat(" ", p.TabWidth), "") - // remove output comment - if loc := exampleOutputRx.FindStringIndex(code); loc != nil { - code = strings.TrimSpace(code[:loc[0]]) - } - } - - // Write out the playground code in standard Go style - // (use tabs, no comment highlight, etc). - play := "" - if eg.Play != nil && p.ShowPlayground { - var buf bytes.Buffer - if err := format.Node(&buf, info.FSet, eg.Play); err != nil { - log.Print(err) - } else { - play = buf.String() - } - } - - // Drop output, as the output comment will appear in the code. - if wholeFile && play == "" { - out = "" - } - - if p.ExampleHTML == nil { - out = "" - return "" - } - - err := p.ExampleHTML.Execute(&buf, struct { - Name, Doc, Code, Play, Output string - GoogleCN bool - }{eg.Name, eg.Doc, code, play, out, info.GoogleCN}) - if err != nil { - log.Print(err) - } - } - return buf.String() -} - -// example_nameFunc takes an example function name and returns its display -// name. For example, "Foo_Bar_quux" becomes "Foo.Bar (Quux)". -func (p *Presentation) example_nameFunc(s string) string { - name, suffix := splitExampleName(s) - // replace _ with . for method names - name = strings.Replace(name, "_", ".", 1) - // use "Package" if no name provided - if name == "" { - name = "Package" - } - return name + suffix -} - -// example_suffixFunc takes an example function name and returns its suffix in -// parenthesized form. For example, "Foo_Bar_quux" becomes " (Quux)". -func (p *Presentation) example_suffixFunc(name string) string { - _, suffix := splitExampleName(name) - return suffix -} - -// implements_html returns the "> Implements" toggle for a package-level named type. -// Its contents are populated from JSON data by client-side JS at load time. -func (p *Presentation) implements_htmlFunc(info *PageInfo, typeName string) string { - if p.ImplementsHTML == nil { - return "" - } - index, ok := info.TypeInfoIndex[typeName] - if !ok { - return "" - } - var buf bytes.Buffer - err := p.ImplementsHTML.Execute(&buf, struct{ Index int }{index}) - if err != nil { - log.Print(err) - } - return buf.String() -} - -// methodset_html returns the "> Method set" toggle for a package-level named type. -// Its contents are populated from JSON data by client-side JS at load time. -func (p *Presentation) methodset_htmlFunc(info *PageInfo, typeName string) string { - if p.MethodSetHTML == nil { - return "" - } - index, ok := info.TypeInfoIndex[typeName] - if !ok { - return "" - } - var buf bytes.Buffer - err := p.MethodSetHTML.Execute(&buf, struct{ Index int }{index}) - if err != nil { - log.Print(err) - } - return buf.String() -} - -// callgraph_html returns the "> Call graph" toggle for a package-level func. -// Its contents are populated from JSON data by client-side JS at load time. -func (p *Presentation) callgraph_htmlFunc(info *PageInfo, recv, name string) string { - if p.CallGraphHTML == nil { - return "" - } - if recv != "" { - // Format must match (*ssa.Function).RelString(). - name = fmt.Sprintf("(%s).%s", recv, name) - } - index, ok := info.CallGraphIndex[name] - if !ok { - return "" - } - var buf bytes.Buffer - err := p.CallGraphHTML.Execute(&buf, struct{ Index int }{index}) - if err != nil { - log.Print(err) - } - return buf.String() -} - -func noteTitle(note string) string { - return strings.Title(strings.ToLower(note)) -} - -func startsWithUppercase(s string) bool { - r, _ := utf8.DecodeRuneInString(s) - return unicode.IsUpper(r) -} - -var exampleOutputRx = regexp.MustCompile(`(?i)//[[:space:]]*(unordered )?output:`) - -// stripExampleSuffix strips lowercase braz in Foo_braz or Foo_Bar_braz from name -// while keeping uppercase Braz in Foo_Braz. -func stripExampleSuffix(name string) string { - if i := strings.LastIndex(name, "_"); i != -1 { - if i < len(name)-1 && !startsWithUppercase(name[i+1:]) { - name = name[:i] - } - } - return name -} - -func splitExampleName(s string) (name, suffix string) { - i := strings.LastIndex(s, "_") - if 0 <= i && i < len(s)-1 && !startsWithUppercase(s[i+1:]) { - name = s[:i] - suffix = " (" + strings.Title(s[i+1:]) + ")" - return - } - name = s - return -} - -// replaceLeadingIndentation replaces oldIndent at the beginning of each line -// with newIndent. This is used for formatting examples. Raw strings that -// span multiple lines are handled specially: oldIndent is not removed (since -// go/printer will not add any indentation there), but newIndent is added -// (since we may still want leading indentation). -func replaceLeadingIndentation(body, oldIndent, newIndent string) string { - // Handle indent at the beginning of the first line. After this, we handle - // indentation only after a newline. - var buf bytes.Buffer - if strings.HasPrefix(body, oldIndent) { - buf.WriteString(newIndent) - body = body[len(oldIndent):] - } - - // Use a state machine to keep track of whether we're in a string or - // rune literal while we process the rest of the code. - const ( - codeState = iota - runeState - interpretedStringState - rawStringState - ) - searchChars := []string{ - "'\"`\n", // codeState - `\'`, // runeState - `\"`, // interpretedStringState - "`\n", // rawStringState - // newlineState does not need to search - } - state := codeState - for { - i := strings.IndexAny(body, searchChars[state]) - if i < 0 { - buf.WriteString(body) - break - } - c := body[i] - buf.WriteString(body[:i+1]) - body = body[i+1:] - switch state { - case codeState: - switch c { - case '\'': - state = runeState - case '"': - state = interpretedStringState - case '`': - state = rawStringState - case '\n': - if strings.HasPrefix(body, oldIndent) { - buf.WriteString(newIndent) - body = body[len(oldIndent):] - } - } - - case runeState: - switch c { - case '\\': - r, size := utf8.DecodeRuneInString(body) - buf.WriteRune(r) - body = body[size:] - case '\'': - state = codeState - } - - case interpretedStringState: - switch c { - case '\\': - r, size := utf8.DecodeRuneInString(body) - buf.WriteRune(r) - body = body[size:] - case '"': - state = codeState - } - - case rawStringState: - switch c { - case '`': - state = codeState - case '\n': - buf.WriteString(newIndent) - } - } - } - return buf.String() -} - -// Write an AST node to w. -func (p *Presentation) writeNode(w io.Writer, fset *token.FileSet, x interface{}) { - // convert trailing tabs into spaces using a tconv filter - // to ensure a good outcome in most browsers (there may still - // be tabs in comments and strings, but converting those into - // the right number of spaces is much harder) - // - // TODO(gri) rethink printer flags - perhaps tconv can be eliminated - // with an another printer mode (which is more efficiently - // implemented in the printer than here with another layer) - mode := printer.TabIndent | printer.UseSpaces - err := (&printer.Config{Mode: mode, Tabwidth: p.TabWidth}).Fprint(&tconv{p: p, output: w}, fset, x) - if err != nil { - log.Print(err) - } -} - -// WriteNode writes x to w. -// TODO(bgarcia) Is this method needed? It's just a wrapper for p.writeNode. -func (p *Presentation) WriteNode(w io.Writer, fset *token.FileSet, x interface{}) { - p.writeNode(w, fset, x) -} diff --git a/vendor/golang.org/x/tools/godoc/godoc17_test.go b/vendor/golang.org/x/tools/godoc/godoc17_test.go deleted file mode 100644 index d153991..0000000 --- a/vendor/golang.org/x/tools/godoc/godoc17_test.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2017 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// +build go1.7 - -package godoc - -import ( - "bytes" - "fmt" - "testing" -) - -// Verify that scanIdentifier isn't quadratic. -// This doesn't actually measure and fail on its own, but it was previously -// very obvious when running by hand. -// -// TODO: if there's a reliable and non-flaky way to test this, do so. -// Maybe count user CPU time instead of wall time? But that's not easy -// to do portably in Go. -func TestStructField(t *testing.T) { - for _, n := range []int{10, 100, 1000, 10000} { - n := n - t.Run(fmt.Sprint(n), func(t *testing.T) { - var buf bytes.Buffer - fmt.Fprintf(&buf, "package foo\n\ntype T struct {\n") - for i := 0; i < n; i++ { - fmt.Fprintf(&buf, "\t// Field%d is foo.\n\tField%d int\n\n", i, i) - } - fmt.Fprintf(&buf, "}\n") - linkifySource(t, buf.Bytes()) - }) - } -} diff --git a/vendor/golang.org/x/tools/godoc/godoc_test.go b/vendor/golang.org/x/tools/godoc/godoc_test.go deleted file mode 100644 index c1d631c..0000000 --- a/vendor/golang.org/x/tools/godoc/godoc_test.go +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "bytes" - "go/parser" - "go/token" - "strings" - "testing" -) - -func TestPkgLinkFunc(t *testing.T) { - for _, tc := range []struct { - path string - want string - }{ - {"/src/fmt", "pkg/fmt"}, - {"src/fmt", "pkg/fmt"}, - {"/fmt", "pkg/fmt"}, - {"fmt", "pkg/fmt"}, - } { - if got := pkgLinkFunc(tc.path); got != tc.want { - t.Errorf("pkgLinkFunc(%v) = %v; want %v", tc.path, got, tc.want) - } - } -} - -func TestSrcPosLinkFunc(t *testing.T) { - for _, tc := range []struct { - src string - line int - low int - high int - want string - }{ - {"/src/fmt/print.go", 42, 30, 50, "/src/fmt/print.go?s=30:50#L32"}, - {"/src/fmt/print.go", 2, 1, 5, "/src/fmt/print.go?s=1:5#L1"}, - {"/src/fmt/print.go", 2, 0, 0, "/src/fmt/print.go#L2"}, - {"/src/fmt/print.go", 0, 0, 0, "/src/fmt/print.go"}, - {"/src/fmt/print.go", 0, 1, 5, "/src/fmt/print.go?s=1:5#L1"}, - {"fmt/print.go", 0, 0, 0, "/src/fmt/print.go"}, - {"fmt/print.go", 0, 1, 5, "/src/fmt/print.go?s=1:5#L1"}, - } { - if got := srcPosLinkFunc(tc.src, tc.line, tc.low, tc.high); got != tc.want { - t.Errorf("srcLinkFunc(%v, %v, %v, %v) = %v; want %v", tc.src, tc.line, tc.low, tc.high, got, tc.want) - } - } -} - -func TestSrcLinkFunc(t *testing.T) { - for _, tc := range []struct { - src string - want string - }{ - {"/src/fmt/print.go", "/src/fmt/print.go"}, - {"src/fmt/print.go", "/src/fmt/print.go"}, - {"/fmt/print.go", "/src/fmt/print.go"}, - {"fmt/print.go", "/src/fmt/print.go"}, - } { - if got := srcLinkFunc(tc.src); got != tc.want { - t.Errorf("srcLinkFunc(%v) = %v; want %v", tc.src, got, tc.want) - } - } -} - -func TestQueryLinkFunc(t *testing.T) { - for _, tc := range []struct { - src string - query string - line int - want string - }{ - {"/src/fmt/print.go", "Sprintf", 33, "/src/fmt/print.go?h=Sprintf#L33"}, - {"/src/fmt/print.go", "Sprintf", 0, "/src/fmt/print.go?h=Sprintf"}, - {"src/fmt/print.go", "EOF", 33, "/src/fmt/print.go?h=EOF#L33"}, - {"src/fmt/print.go", "a%3f+%26b", 1, "/src/fmt/print.go?h=a%3f+%26b#L1"}, - } { - if got := queryLinkFunc(tc.src, tc.query, tc.line); got != tc.want { - t.Errorf("queryLinkFunc(%v, %v, %v) = %v; want %v", tc.src, tc.query, tc.line, got, tc.want) - } - } -} - -func TestDocLinkFunc(t *testing.T) { - for _, tc := range []struct { - src string - ident string - want string - }{ - {"fmt", "Sprintf", "/pkg/fmt/#Sprintf"}, - {"fmt", "EOF", "/pkg/fmt/#EOF"}, - } { - if got := docLinkFunc(tc.src, tc.ident); got != tc.want { - t.Errorf("docLinkFunc(%v, %v) = %v; want %v", tc.src, tc.ident, got, tc.want) - } - } -} - -func TestSanitizeFunc(t *testing.T) { - for _, tc := range []struct { - src string - want string - }{ - {}, - {"foo", "foo"}, - {"func f()", "func f()"}, - {"func f(a int,)", "func f(a int)"}, - {"func f(a int,\n)", "func f(a int)"}, - {"func f(\n\ta int,\n\tb int,\n\tc int,\n)", "func f(a int, b int, c int)"}, - {" ( a, b, c ) ", "(a, b, c)"}, - {"( a, b, c int, foo bar , )", "(a, b, c int, foo bar)"}, - {"{ a, b}", "{a, b}"}, - {"[ a, b]", "[a, b]"}, - } { - if got := sanitizeFunc(tc.src); got != tc.want { - t.Errorf("sanitizeFunc(%v) = %v; want %v", tc.src, got, tc.want) - } - } -} - -// Test that we add elements -// to the HTML of struct fields. -func TestStructFieldsIDAttributes(t *testing.T) { - got := linkifySource(t, []byte(` -package foo - -type T struct { - NoDoc string - - // Doc has a comment. - Doc string - - // Opt, if non-nil, is an option. - Opt *int - - // Опция - другое поле. - Опция bool -} -`)) - want := `type T struct { -NoDoc string - -// Doc has a comment. -Doc string - -// Opt, if non-nil, is an option. -Opt *int - -// Опция - другое поле. -Опция bool -}` - if got != want { - t.Errorf("got: %s\n\nwant: %s\n", got, want) - } -} - -// Test that we add elements to the HTML -// of definitions in const and var specs. -func TestValueSpecIDAttributes(t *testing.T) { - got := linkifySource(t, []byte(` -package foo - -const ( - NoDoc string = "NoDoc" - - // Doc has a comment - Doc = "Doc" - - NoVal -)`)) - want := `const ( -NoDoc string = "NoDoc" - -// Doc has a comment -Doc = "Doc" - -NoVal -)` - if got != want { - t.Errorf("got: %s\n\nwant: %s\n", got, want) - } -} - -func TestCompositeLitLinkFields(t *testing.T) { - got := linkifySource(t, []byte(` -package foo - -type T struct { - X int -} - -var S T = T{X: 12}`)) - want := `type T struct { -X int -} -var S T = T{X: 12}` - if got != want { - t.Errorf("got: %s\n\nwant: %s\n", got, want) - } -} - -func TestFuncDeclNotLink(t *testing.T) { - // Function. - got := linkifySource(t, []byte(` -package http - -func Get(url string) (resp *Response, err error)`)) - want := `func Get(url string) (resp *Response, err error)` - if got != want { - t.Errorf("got: %s\n\nwant: %s\n", got, want) - } - - // Method. - got = linkifySource(t, []byte(` -package http - -func (h Header) Get(key string) string`)) - want = `func (h Header) Get(key string) string` - if got != want { - t.Errorf("got: %s\n\nwant: %s\n", got, want) - } -} - -func linkifySource(t *testing.T, src []byte) string { - p := &Presentation{ - DeclLinks: true, - } - fset := token.NewFileSet() - af, err := parser.ParseFile(fset, "foo.go", src, parser.ParseComments) - if err != nil { - t.Fatal(err) - } - var buf bytes.Buffer - pi := &PageInfo{ - FSet: fset, - } - sep := "" - for _, decl := range af.Decls { - buf.WriteString(sep) - sep = "\n" - buf.WriteString(p.node_htmlFunc(pi, decl, true)) - } - return buf.String() -} - -func TestScanIdentifier(t *testing.T) { - tests := []struct { - in, want string - }{ - {"foo bar", "foo"}, - {"foo/bar", "foo"}, - {" foo", ""}, - {"фоо", "фоо"}, - {"f123", "f123"}, - {"123f", ""}, - } - for _, tt := range tests { - got := scanIdentifier([]byte(tt.in)) - if string(got) != tt.want { - t.Errorf("scanIdentifier(%q) = %q; want %q", tt.in, got, tt.want) - } - } -} - -func TestReplaceLeadingIndentation(t *testing.T) { - oldIndent := strings.Repeat(" ", 2) - newIndent := strings.Repeat(" ", 4) - tests := []struct { - src, want string - }{ - {" foo\n bar\n baz", " foo\n bar\n baz"}, - {" '`'\n '`'\n", " '`'\n '`'\n"}, - {" '\\''\n '`'\n", " '\\''\n '`'\n"}, - {" \"`\"\n \"`\"\n", " \"`\"\n \"`\"\n"}, - {" `foo\n bar`", " `foo\n bar`"}, - {" `foo\\`\n bar", " `foo\\`\n bar"}, - {" '\\`'`foo\n bar", " '\\`'`foo\n bar"}, - { - " if true {\n foo := `One\n \tTwo\nThree`\n }\n", - " if true {\n foo := `One\n \tTwo\n Three`\n }\n", - }, - } - for _, tc := range tests { - if got := replaceLeadingIndentation(tc.src, oldIndent, newIndent); got != tc.want { - t.Errorf("replaceLeadingIndentation:\n%v\n---\nhave:\n%v\n---\nwant:\n%v\n", - tc.src, got, tc.want) - } - } -} - -func TestSrcBreadcrumbFunc(t *testing.T) { - for _, tc := range []struct { - path string - want string - }{ - {"src/", `src/`}, - {"src/fmt/", `src/fmt/`}, - {"src/fmt/print.go", `src/fmt/print.go`}, - } { - if got := srcBreadcrumbFunc(tc.path); got != tc.want { - t.Errorf("srcBreadcrumbFunc(%v) = %v; want %v", tc.path, got, tc.want) - } - } -} - -func TestSrcToPkgLinkFunc(t *testing.T) { - for _, tc := range []struct { - path string - want string - }{ - {"src/", `Index`}, - {"src/fmt/", `fmt`}, - {"pkg/", `Index`}, - {"pkg/LICENSE", `Index`}, - } { - if got := srcToPkgLinkFunc(tc.path); got != tc.want { - t.Errorf("srcToPkgLinkFunc(%v) = %v; want %v", tc.path, got, tc.want) - } - } -} diff --git a/vendor/golang.org/x/tools/godoc/index.go b/vendor/golang.org/x/tools/godoc/index.go deleted file mode 100644 index 8cefd14..0000000 --- a/vendor/golang.org/x/tools/godoc/index.go +++ /dev/null @@ -1,1581 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file contains the infrastructure to create an -// identifier and full-text index for a set of Go files. -// -// Algorithm for identifier index: -// - traverse all .go files of the file tree specified by root -// - for each identifier (word) encountered, collect all occurrences (spots) -// into a list; this produces a list of spots for each word -// - reduce the lists: from a list of spots to a list of FileRuns, -// and from a list of FileRuns into a list of PakRuns -// - make a HitList from the PakRuns -// -// Details: -// - keep two lists per word: one containing package-level declarations -// that have snippets, and one containing all other spots -// - keep the snippets in a separate table indexed by snippet index -// and store the snippet index in place of the line number in a SpotInfo -// (the line number for spots with snippets is stored in the snippet) -// - at the end, create lists of alternative spellings for a given -// word -// -// Algorithm for full text index: -// - concatenate all source code in a byte buffer (in memory) -// - add the files to a file set in lockstep as they are added to the byte -// buffer such that a byte buffer offset corresponds to the Pos value for -// that file location -// - create a suffix array from the concatenated sources -// -// String lookup in full text index: -// - use the suffix array to lookup a string's offsets - the offsets -// correspond to the Pos values relative to the file set -// - translate the Pos values back into file and line information and -// sort the result - -package godoc - -import ( - "bufio" - "bytes" - "encoding/gob" - "errors" - "fmt" - "go/ast" - "go/doc" - "go/parser" - "go/token" - "index/suffixarray" - "io" - "log" - "os" - pathpkg "path" - "path/filepath" - "regexp" - "runtime" - "sort" - "strconv" - "strings" - "sync" - "time" - "unicode" - - "golang.org/x/tools/godoc/util" - "golang.org/x/tools/godoc/vfs" -) - -// ---------------------------------------------------------------------------- -// InterfaceSlice is a helper type for sorting interface -// slices according to some slice-specific sort criteria. - -type comparer func(x, y interface{}) bool - -type interfaceSlice struct { - slice []interface{} - less comparer -} - -// ---------------------------------------------------------------------------- -// RunList - -// A RunList is a list of entries that can be sorted according to some -// criteria. A RunList may be compressed by grouping "runs" of entries -// which are equal (according to the sort critera) into a new RunList of -// runs. For instance, a RunList containing pairs (x, y) may be compressed -// into a RunList containing pair runs (x, {y}) where each run consists of -// a list of y's with the same x. -type RunList []interface{} - -func (h RunList) sort(less comparer) { - sort.Sort(&interfaceSlice{h, less}) -} - -func (p *interfaceSlice) Len() int { return len(p.slice) } -func (p *interfaceSlice) Less(i, j int) bool { return p.less(p.slice[i], p.slice[j]) } -func (p *interfaceSlice) Swap(i, j int) { p.slice[i], p.slice[j] = p.slice[j], p.slice[i] } - -// Compress entries which are the same according to a sort criteria -// (specified by less) into "runs". -func (h RunList) reduce(less comparer, newRun func(h RunList) interface{}) RunList { - if len(h) == 0 { - return nil - } - // len(h) > 0 - - // create runs of entries with equal values - h.sort(less) - - // for each run, make a new run object and collect them in a new RunList - var hh RunList - i, x := 0, h[0] - for j, y := range h { - if less(x, y) { - hh = append(hh, newRun(h[i:j])) - i, x = j, h[j] // start a new run - } - } - // add final run, if any - if i < len(h) { - hh = append(hh, newRun(h[i:])) - } - - return hh -} - -// ---------------------------------------------------------------------------- -// KindRun - -// Debugging support. Disable to see multiple entries per line. -const removeDuplicates = true - -// A KindRun is a run of SpotInfos of the same kind in a given file. -// The kind (3 bits) is stored in each SpotInfo element; to find the -// kind of a KindRun, look at any of its elements. -type KindRun []SpotInfo - -// KindRuns are sorted by line number or index. Since the isIndex bit -// is always the same for all infos in one list we can compare lori's. -func (k KindRun) Len() int { return len(k) } -func (k KindRun) Less(i, j int) bool { return k[i].Lori() < k[j].Lori() } -func (k KindRun) Swap(i, j int) { k[i], k[j] = k[j], k[i] } - -// FileRun contents are sorted by Kind for the reduction into KindRuns. -func lessKind(x, y interface{}) bool { return x.(SpotInfo).Kind() < y.(SpotInfo).Kind() } - -// newKindRun allocates a new KindRun from the SpotInfo run h. -func newKindRun(h RunList) interface{} { - run := make(KindRun, len(h)) - for i, x := range h { - run[i] = x.(SpotInfo) - } - - // Spots were sorted by file and kind to create this run. - // Within this run, sort them by line number or index. - sort.Sort(run) - - if removeDuplicates { - // Since both the lori and kind field must be - // same for duplicates, and since the isIndex - // bit is always the same for all infos in one - // list we can simply compare the entire info. - k := 0 - prev := SpotInfo(1<<32 - 1) // an unlikely value - for _, x := range run { - if x != prev { - run[k] = x - k++ - prev = x - } - } - run = run[0:k] - } - - return run -} - -// ---------------------------------------------------------------------------- -// FileRun - -// A Pak describes a Go package. -type Pak struct { - Path string // path of directory containing the package - Name string // package name as declared by package clause -} - -// Paks are sorted by name (primary key) and by import path (secondary key). -func (p *Pak) less(q *Pak) bool { - return p.Name < q.Name || p.Name == q.Name && p.Path < q.Path -} - -// A File describes a Go file. -type File struct { - Name string // directory-local file name - Pak *Pak // the package to which the file belongs -} - -// Path returns the file path of f. -func (f *File) Path() string { - return pathpkg.Join(f.Pak.Path, f.Name) -} - -// A Spot describes a single occurrence of a word. -type Spot struct { - File *File - Info SpotInfo -} - -// A FileRun is a list of KindRuns belonging to the same file. -type FileRun struct { - File *File - Groups []KindRun -} - -// Spots are sorted by file path for the reduction into FileRuns. -func lessSpot(x, y interface{}) bool { - fx := x.(Spot).File - fy := y.(Spot).File - // same as "return fx.Path() < fy.Path()" but w/o computing the file path first - px := fx.Pak.Path - py := fy.Pak.Path - return px < py || px == py && fx.Name < fy.Name -} - -// newFileRun allocates a new FileRun from the Spot run h. -func newFileRun(h RunList) interface{} { - file := h[0].(Spot).File - - // reduce the list of Spots into a list of KindRuns - h1 := make(RunList, len(h)) - for i, x := range h { - h1[i] = x.(Spot).Info - } - h2 := h1.reduce(lessKind, newKindRun) - - // create the FileRun - groups := make([]KindRun, len(h2)) - for i, x := range h2 { - groups[i] = x.(KindRun) - } - return &FileRun{file, groups} -} - -// ---------------------------------------------------------------------------- -// PakRun - -// A PakRun describes a run of *FileRuns of a package. -type PakRun struct { - Pak *Pak - Files []*FileRun -} - -// Sorting support for files within a PakRun. -func (p *PakRun) Len() int { return len(p.Files) } -func (p *PakRun) Less(i, j int) bool { return p.Files[i].File.Name < p.Files[j].File.Name } -func (p *PakRun) Swap(i, j int) { p.Files[i], p.Files[j] = p.Files[j], p.Files[i] } - -// FileRuns are sorted by package for the reduction into PakRuns. -func lessFileRun(x, y interface{}) bool { - return x.(*FileRun).File.Pak.less(y.(*FileRun).File.Pak) -} - -// newPakRun allocates a new PakRun from the *FileRun run h. -func newPakRun(h RunList) interface{} { - pak := h[0].(*FileRun).File.Pak - files := make([]*FileRun, len(h)) - for i, x := range h { - files[i] = x.(*FileRun) - } - run := &PakRun{pak, files} - sort.Sort(run) // files were sorted by package; sort them by file now - return run -} - -// ---------------------------------------------------------------------------- -// HitList - -// A HitList describes a list of PakRuns. -type HitList []*PakRun - -// PakRuns are sorted by package. -func lessPakRun(x, y interface{}) bool { return x.(*PakRun).Pak.less(y.(*PakRun).Pak) } - -func reduce(h0 RunList) HitList { - // reduce a list of Spots into a list of FileRuns - h1 := h0.reduce(lessSpot, newFileRun) - // reduce a list of FileRuns into a list of PakRuns - h2 := h1.reduce(lessFileRun, newPakRun) - // sort the list of PakRuns by package - h2.sort(lessPakRun) - // create a HitList - h := make(HitList, len(h2)) - for i, p := range h2 { - h[i] = p.(*PakRun) - } - return h -} - -// filter returns a new HitList created by filtering -// all PakRuns from h that have a matching pakname. -func (h HitList) filter(pakname string) HitList { - var hh HitList - for _, p := range h { - if p.Pak.Name == pakname { - hh = append(hh, p) - } - } - return hh -} - -// ---------------------------------------------------------------------------- -// AltWords - -type wordPair struct { - canon string // canonical word spelling (all lowercase) - alt string // alternative spelling -} - -// An AltWords describes a list of alternative spellings for a -// canonical (all lowercase) spelling of a word. -type AltWords struct { - Canon string // canonical word spelling (all lowercase) - Alts []string // alternative spelling for the same word -} - -// wordPairs are sorted by their canonical spelling. -func lessWordPair(x, y interface{}) bool { return x.(*wordPair).canon < y.(*wordPair).canon } - -// newAltWords allocates a new AltWords from the *wordPair run h. -func newAltWords(h RunList) interface{} { - canon := h[0].(*wordPair).canon - alts := make([]string, len(h)) - for i, x := range h { - alts[i] = x.(*wordPair).alt - } - return &AltWords{canon, alts} -} - -func (a *AltWords) filter(s string) *AltWords { - var alts []string - for _, w := range a.Alts { - if w != s { - alts = append(alts, w) - } - } - if len(alts) > 0 { - return &AltWords{a.Canon, alts} - } - return nil -} - -// Ident stores information about external identifiers in order to create -// links to package documentation. -type Ident struct { - Path string // e.g. "net/http" - Package string // e.g. "http" - Name string // e.g. "NewRequest" - Doc string // e.g. "NewRequest returns a new Request..." -} - -// byImportCount sorts the given slice of Idents by the import -// counts of the packages to which they belong. -type byImportCount struct { - Idents []Ident - ImportCount map[string]int -} - -func (ic byImportCount) Len() int { - return len(ic.Idents) -} - -func (ic byImportCount) Less(i, j int) bool { - ri := ic.ImportCount[ic.Idents[i].Path] - rj := ic.ImportCount[ic.Idents[j].Path] - if ri == rj { - return ic.Idents[i].Path < ic.Idents[j].Path - } - return ri > rj -} - -func (ic byImportCount) Swap(i, j int) { - ic.Idents[i], ic.Idents[j] = ic.Idents[j], ic.Idents[i] -} - -func (ic byImportCount) String() string { - buf := bytes.NewBuffer([]byte("[")) - for _, v := range ic.Idents { - buf.WriteString(fmt.Sprintf("\n\t%s, %s (%d)", v.Path, v.Name, ic.ImportCount[v.Path])) - } - buf.WriteString("\n]") - return buf.String() -} - -// filter creates a new Ident list where the results match the given -// package name. -func (ic byImportCount) filter(pakname string) []Ident { - if ic.Idents == nil { - return nil - } - var res []Ident - for _, i := range ic.Idents { - if i.Package == pakname { - res = append(res, i) - } - } - return res -} - -// top returns the top n identifiers. -func (ic byImportCount) top(n int) []Ident { - if len(ic.Idents) > n { - return ic.Idents[:n] - } - return ic.Idents -} - -// ---------------------------------------------------------------------------- -// Indexer - -type IndexResult struct { - Decls RunList // package-level declarations (with snippets) - Others RunList // all other occurrences -} - -// Statistics provides statistics information for an index. -type Statistics struct { - Bytes int // total size of indexed source files - Files int // number of indexed source files - Lines int // number of lines (all files) - Words int // number of different identifiers - Spots int // number of identifier occurrences -} - -// An Indexer maintains the data structures and provides the machinery -// for indexing .go files under a file tree. It implements the path.Visitor -// interface for walking file trees, and the ast.Visitor interface for -// walking Go ASTs. -type Indexer struct { - c *Corpus - fset *token.FileSet // file set for all indexed files - fsOpenGate chan bool // send pre fs.Open; receive on close - - mu sync.Mutex // guards all the following - sources bytes.Buffer // concatenated sources - strings map[string]string // interned string - packages map[Pak]*Pak // interned *Paks - words map[string]*IndexResult // RunLists of Spots - snippets []*Snippet // indices are stored in SpotInfos - current *token.File // last file added to file set - file *File // AST for current file - decl ast.Decl // AST for current decl - stats Statistics - throttle *util.Throttle - importCount map[string]int // package path ("net/http") => count - packagePath map[string]map[string]bool // "template" => "text/template" => true - exports map[string]map[string]SpotKind // "net/http" => "ListenAndServe" => FuncDecl - curPkgExports map[string]SpotKind - idents map[SpotKind]map[string][]Ident // kind => name => list of Idents -} - -func (x *Indexer) intern(s string) string { - if s, ok := x.strings[s]; ok { - return s - } - x.strings[s] = s - return s -} - -func (x *Indexer) lookupPackage(path, name string) *Pak { - // In the source directory tree, more than one package may - // live in the same directory. For the packages map, construct - // a key that includes both the directory path and the package - // name. - key := Pak{Path: x.intern(path), Name: x.intern(name)} - pak := x.packages[key] - if pak == nil { - pak = &key - x.packages[key] = pak - } - return pak -} - -func (x *Indexer) addSnippet(s *Snippet) int { - index := len(x.snippets) - x.snippets = append(x.snippets, s) - return index -} - -func (x *Indexer) visitIdent(kind SpotKind, id *ast.Ident) { - if id == nil { - return - } - name := x.intern(id.Name) - - switch kind { - case TypeDecl, FuncDecl, ConstDecl, VarDecl: - x.curPkgExports[name] = kind - } - - lists, found := x.words[name] - if !found { - lists = new(IndexResult) - x.words[name] = lists - } - - if kind == Use || x.decl == nil { - if x.c.IndexGoCode { - // not a declaration or no snippet required - info := makeSpotInfo(kind, x.current.Line(id.Pos()), false) - lists.Others = append(lists.Others, Spot{x.file, info}) - } - } else { - // a declaration with snippet - index := x.addSnippet(NewSnippet(x.fset, x.decl, id)) - info := makeSpotInfo(kind, index, true) - lists.Decls = append(lists.Decls, Spot{x.file, info}) - } - - x.stats.Spots++ -} - -func (x *Indexer) visitFieldList(kind SpotKind, flist *ast.FieldList) { - for _, f := range flist.List { - x.decl = nil // no snippets for fields - for _, name := range f.Names { - x.visitIdent(kind, name) - } - ast.Walk(x, f.Type) - // ignore tag - not indexed at the moment - } -} - -func (x *Indexer) visitSpec(kind SpotKind, spec ast.Spec) { - switch n := spec.(type) { - case *ast.ImportSpec: - x.visitIdent(ImportDecl, n.Name) - if n.Path != nil { - if imp, err := strconv.Unquote(n.Path.Value); err == nil { - x.importCount[x.intern(imp)]++ - } - } - - case *ast.ValueSpec: - for _, n := range n.Names { - x.visitIdent(kind, n) - } - ast.Walk(x, n.Type) - for _, v := range n.Values { - ast.Walk(x, v) - } - - case *ast.TypeSpec: - x.visitIdent(TypeDecl, n.Name) - ast.Walk(x, n.Type) - } -} - -func (x *Indexer) visitGenDecl(decl *ast.GenDecl) { - kind := VarDecl - if decl.Tok == token.CONST { - kind = ConstDecl - } - x.decl = decl - for _, s := range decl.Specs { - x.visitSpec(kind, s) - } -} - -func (x *Indexer) Visit(node ast.Node) ast.Visitor { - switch n := node.(type) { - case nil: - // nothing to do - - case *ast.Ident: - x.visitIdent(Use, n) - - case *ast.FieldList: - x.visitFieldList(VarDecl, n) - - case *ast.InterfaceType: - x.visitFieldList(MethodDecl, n.Methods) - - case *ast.DeclStmt: - // local declarations should only be *ast.GenDecls; - // ignore incorrect ASTs - if decl, ok := n.Decl.(*ast.GenDecl); ok { - x.decl = nil // no snippets for local declarations - x.visitGenDecl(decl) - } - - case *ast.GenDecl: - x.decl = n - x.visitGenDecl(n) - - case *ast.FuncDecl: - kind := FuncDecl - if n.Recv != nil { - kind = MethodDecl - ast.Walk(x, n.Recv) - } - x.decl = n - x.visitIdent(kind, n.Name) - ast.Walk(x, n.Type) - if n.Body != nil { - ast.Walk(x, n.Body) - } - - case *ast.File: - x.decl = nil - x.visitIdent(PackageClause, n.Name) - for _, d := range n.Decls { - ast.Walk(x, d) - } - - default: - return x - } - - return nil -} - -// addFile adds a file to the index if possible and returns the file set file -// and the file's AST if it was successfully parsed as a Go file. If addFile -// failed (that is, if the file was not added), it returns file == nil. -func (x *Indexer) addFile(f vfs.ReadSeekCloser, filename string, goFile bool) (file *token.File, ast *ast.File) { - defer f.Close() - - // The file set's base offset and x.sources size must be in lock-step; - // this permits the direct mapping of suffix array lookup results to - // to corresponding Pos values. - // - // When a file is added to the file set, its offset base increases by - // the size of the file + 1; and the initial base offset is 1. Add an - // extra byte to the sources here. - x.sources.WriteByte(0) - - // If the sources length doesn't match the file set base at this point - // the file set implementation changed or we have another error. - base := x.fset.Base() - if x.sources.Len() != base { - panic("internal error: file base incorrect") - } - - // append file contents (src) to x.sources - if _, err := x.sources.ReadFrom(f); err == nil { - src := x.sources.Bytes()[base:] - - if goFile { - // parse the file and in the process add it to the file set - if ast, err = parser.ParseFile(x.fset, filename, src, parser.ParseComments); err == nil { - file = x.fset.File(ast.Pos()) // ast.Pos() is inside the file - return - } - // file has parse errors, and the AST may be incorrect - - // set lines information explicitly and index as ordinary - // text file (cannot fall through to the text case below - // because the file has already been added to the file set - // by the parser) - file = x.fset.File(token.Pos(base)) // token.Pos(base) is inside the file - file.SetLinesForContent(src) - ast = nil - return - } - - if util.IsText(src) { - // only add the file to the file set (for the full text index) - file = x.fset.AddFile(filename, x.fset.Base(), len(src)) - file.SetLinesForContent(src) - return - } - } - - // discard possibly added data - x.sources.Truncate(base - 1) // -1 to remove added byte 0 since no file was added - return -} - -// Design note: Using an explicit white list of permitted files for indexing -// makes sure that the important files are included and massively reduces the -// number of files to index. The advantage over a blacklist is that unexpected -// (non-blacklisted) files won't suddenly explode the index. - -// Files are whitelisted if they have a file name or extension -// present as key in whitelisted. -var whitelisted = map[string]bool{ - ".bash": true, - ".c": true, - ".cc": true, - ".cpp": true, - ".cxx": true, - ".css": true, - ".go": true, - ".goc": true, - ".h": true, - ".hh": true, - ".hpp": true, - ".hxx": true, - ".html": true, - ".js": true, - ".out": true, - ".py": true, - ".s": true, - ".sh": true, - ".txt": true, - ".xml": true, - "AUTHORS": true, - "CONTRIBUTORS": true, - "LICENSE": true, - "Makefile": true, - "PATENTS": true, - "README": true, -} - -// isWhitelisted returns true if a file is on the list -// of "permitted" files for indexing. The filename must -// be the directory-local name of the file. -func isWhitelisted(filename string) bool { - key := pathpkg.Ext(filename) - if key == "" { - // file has no extension - use entire filename - key = filename - } - return whitelisted[key] -} - -func (x *Indexer) indexDocs(dirname string, filename string, astFile *ast.File) { - pkgName := x.intern(astFile.Name.Name) - if pkgName == "main" { - return - } - pkgPath := x.intern(strings.TrimPrefix(strings.TrimPrefix(dirname, "/src/"), "pkg/")) - astPkg := ast.Package{ - Name: pkgName, - Files: map[string]*ast.File{ - filename: astFile, - }, - } - var m doc.Mode - docPkg := doc.New(&astPkg, dirname, m) - addIdent := func(sk SpotKind, name string, docstr string) { - if x.idents[sk] == nil { - x.idents[sk] = make(map[string][]Ident) - } - name = x.intern(name) - x.idents[sk][name] = append(x.idents[sk][name], Ident{ - Path: pkgPath, - Package: pkgName, - Name: name, - Doc: doc.Synopsis(docstr), - }) - } - - if x.idents[PackageClause] == nil { - x.idents[PackageClause] = make(map[string][]Ident) - } - // List of words under which the package identifier will be stored. - // This includes the package name and the components of the directory - // in which it resides. - words := strings.Split(pathpkg.Dir(pkgPath), "/") - if words[0] == "." { - words = []string{} - } - name := x.intern(docPkg.Name) - synopsis := doc.Synopsis(docPkg.Doc) - words = append(words, name) - pkgIdent := Ident{ - Path: pkgPath, - Package: pkgName, - Name: name, - Doc: synopsis, - } - for _, word := range words { - word = x.intern(word) - found := false - pkgs := x.idents[PackageClause][word] - for i, p := range pkgs { - if p.Path == pkgPath { - if docPkg.Doc != "" { - p.Doc = synopsis - pkgs[i] = p - } - found = true - break - } - } - if !found { - x.idents[PackageClause][word] = append(x.idents[PackageClause][word], pkgIdent) - } - } - - for _, c := range docPkg.Consts { - for _, name := range c.Names { - addIdent(ConstDecl, name, c.Doc) - } - } - for _, t := range docPkg.Types { - addIdent(TypeDecl, t.Name, t.Doc) - for _, c := range t.Consts { - for _, name := range c.Names { - addIdent(ConstDecl, name, c.Doc) - } - } - for _, v := range t.Vars { - for _, name := range v.Names { - addIdent(VarDecl, name, v.Doc) - } - } - for _, f := range t.Funcs { - addIdent(FuncDecl, f.Name, f.Doc) - } - for _, f := range t.Methods { - addIdent(MethodDecl, f.Name, f.Doc) - // Change the name of methods to be ".". - // They will still be indexed as . - idents := x.idents[MethodDecl][f.Name] - idents[len(idents)-1].Name = x.intern(t.Name + "." + f.Name) - } - } - for _, v := range docPkg.Vars { - for _, name := range v.Names { - addIdent(VarDecl, name, v.Doc) - } - } - for _, f := range docPkg.Funcs { - addIdent(FuncDecl, f.Name, f.Doc) - } -} - -func (x *Indexer) indexGoFile(dirname string, filename string, file *token.File, astFile *ast.File) { - pkgName := astFile.Name.Name - - if x.c.IndexGoCode { - x.current = file - pak := x.lookupPackage(dirname, pkgName) - x.file = &File{filename, pak} - ast.Walk(x, astFile) - } - - if x.c.IndexDocs { - // Test files are already filtered out in visitFile if IndexGoCode and - // IndexFullText are false. Otherwise, check here. - isTestFile := (x.c.IndexGoCode || x.c.IndexFullText) && - (strings.HasSuffix(filename, "_test.go") || strings.HasPrefix(dirname, "/test/")) - if !isTestFile { - x.indexDocs(dirname, filename, astFile) - } - } - - ppKey := x.intern(pkgName) - if _, ok := x.packagePath[ppKey]; !ok { - x.packagePath[ppKey] = make(map[string]bool) - } - pkgPath := x.intern(strings.TrimPrefix(strings.TrimPrefix(dirname, "/src/"), "pkg/")) - x.packagePath[ppKey][pkgPath] = true - - // Merge in exported symbols found walking this file into - // the map for that package. - if len(x.curPkgExports) > 0 { - dest, ok := x.exports[pkgPath] - if !ok { - dest = make(map[string]SpotKind) - x.exports[pkgPath] = dest - } - for k, v := range x.curPkgExports { - dest[k] = v - } - } -} - -func (x *Indexer) visitFile(dirname string, fi os.FileInfo) { - if fi.IsDir() || !x.c.IndexEnabled { - return - } - - filename := pathpkg.Join(dirname, fi.Name()) - goFile := isGoFile(fi) - - switch { - case x.c.IndexFullText: - if !isWhitelisted(fi.Name()) { - return - } - case x.c.IndexGoCode: - if !goFile { - return - } - case x.c.IndexDocs: - if !goFile || - strings.HasSuffix(fi.Name(), "_test.go") || - strings.HasPrefix(dirname, "/test/") { - return - } - default: - // No indexing turned on. - return - } - - x.fsOpenGate <- true - defer func() { <-x.fsOpenGate }() - - // open file - f, err := x.c.fs.Open(filename) - if err != nil { - return - } - - x.mu.Lock() - defer x.mu.Unlock() - - x.throttle.Throttle() - - x.curPkgExports = make(map[string]SpotKind) - file, fast := x.addFile(f, filename, goFile) - if file == nil { - return // addFile failed - } - - if fast != nil { - x.indexGoFile(dirname, fi.Name(), file, fast) - } - - // update statistics - x.stats.Bytes += file.Size() - x.stats.Files++ - x.stats.Lines += file.LineCount() -} - -// indexOptions contains information that affects the contents of an index. -type indexOptions struct { - // Docs provides documentation search results. - // It is only consulted if IndexEnabled is true. - // The default values is true. - Docs bool - - // GoCode provides Go source code search results. - // It is only consulted if IndexEnabled is true. - // The default values is true. - GoCode bool - - // FullText provides search results from all files. - // It is only consulted if IndexEnabled is true. - // The default values is true. - FullText bool - - // MaxResults optionally specifies the maximum results for indexing. - // The default is 1000. - MaxResults int -} - -// ---------------------------------------------------------------------------- -// Index - -type LookupResult struct { - Decls HitList // package-level declarations (with snippets) - Others HitList // all other occurrences -} - -type Index struct { - fset *token.FileSet // file set used during indexing; nil if no textindex - suffixes *suffixarray.Index // suffixes for concatenated sources; nil if no textindex - words map[string]*LookupResult // maps words to hit lists - alts map[string]*AltWords // maps canonical(words) to lists of alternative spellings - snippets []*Snippet // all snippets, indexed by snippet index - stats Statistics - importCount map[string]int // package path ("net/http") => count - packagePath map[string]map[string]bool // "template" => "text/template" => true - exports map[string]map[string]SpotKind // "net/http" => "ListenAndServe" => FuncDecl - idents map[SpotKind]map[string][]Ident - opts indexOptions -} - -func canonical(w string) string { return strings.ToLower(w) } - -// Somewhat arbitrary, but I figure low enough to not hurt disk-based filesystems -// consuming file descriptors, where some systems have low 256 or 512 limits. -// Go should have a built-in way to cap fd usage under the ulimit. -const ( - maxOpenFiles = 200 - maxOpenDirs = 50 -) - -func (c *Corpus) throttle() float64 { - if c.IndexThrottle <= 0 { - return 0.9 - } - if c.IndexThrottle > 1.0 { - return 1.0 - } - return c.IndexThrottle -} - -// NewIndex creates a new index for the .go files provided by the corpus. -func (c *Corpus) NewIndex() *Index { - // initialize Indexer - // (use some reasonably sized maps to start) - x := &Indexer{ - c: c, - fset: token.NewFileSet(), - fsOpenGate: make(chan bool, maxOpenFiles), - strings: make(map[string]string), - packages: make(map[Pak]*Pak, 256), - words: make(map[string]*IndexResult, 8192), - throttle: util.NewThrottle(c.throttle(), 100*time.Millisecond), // run at least 0.1s at a time - importCount: make(map[string]int), - packagePath: make(map[string]map[string]bool), - exports: make(map[string]map[string]SpotKind), - idents: make(map[SpotKind]map[string][]Ident, 4), - } - - // index all files in the directories given by dirnames - var wg sync.WaitGroup // outstanding ReadDir + visitFile - dirGate := make(chan bool, maxOpenDirs) - for dirname := range c.fsDirnames() { - if c.IndexDirectory != nil && !c.IndexDirectory(dirname) { - continue - } - dirGate <- true - wg.Add(1) - go func(dirname string) { - defer func() { <-dirGate }() - defer wg.Done() - - list, err := c.fs.ReadDir(dirname) - if err != nil { - log.Printf("ReadDir(%q): %v; skipping directory", dirname, err) - return // ignore this directory - } - for _, fi := range list { - wg.Add(1) - go func(fi os.FileInfo) { - defer wg.Done() - x.visitFile(dirname, fi) - }(fi) - } - }(dirname) - } - wg.Wait() - - if !c.IndexFullText { - // the file set, the current file, and the sources are - // not needed after indexing if no text index is built - - // help GC and clear them - x.fset = nil - x.sources.Reset() - x.current = nil // contains reference to fset! - } - - // for each word, reduce the RunLists into a LookupResult; - // also collect the word with its canonical spelling in a - // word list for later computation of alternative spellings - words := make(map[string]*LookupResult) - var wlist RunList - for w, h := range x.words { - decls := reduce(h.Decls) - others := reduce(h.Others) - words[w] = &LookupResult{ - Decls: decls, - Others: others, - } - wlist = append(wlist, &wordPair{canonical(w), w}) - x.throttle.Throttle() - } - x.stats.Words = len(words) - - // reduce the word list {canonical(w), w} into - // a list of AltWords runs {canonical(w), {w}} - alist := wlist.reduce(lessWordPair, newAltWords) - - // convert alist into a map of alternative spellings - alts := make(map[string]*AltWords) - for i := 0; i < len(alist); i++ { - a := alist[i].(*AltWords) - alts[a.Canon] = a - } - - // create text index - var suffixes *suffixarray.Index - if c.IndexFullText { - suffixes = suffixarray.New(x.sources.Bytes()) - } - - // sort idents by the number of imports of their respective packages - for _, idMap := range x.idents { - for _, ir := range idMap { - sort.Sort(byImportCount{ir, x.importCount}) - } - } - - return &Index{ - fset: x.fset, - suffixes: suffixes, - words: words, - alts: alts, - snippets: x.snippets, - stats: x.stats, - importCount: x.importCount, - packagePath: x.packagePath, - exports: x.exports, - idents: x.idents, - opts: indexOptions{ - Docs: x.c.IndexDocs, - GoCode: x.c.IndexGoCode, - FullText: x.c.IndexFullText, - MaxResults: x.c.MaxResults, - }, - } -} - -var ErrFileIndexVersion = errors.New("file index version out of date") - -const fileIndexVersion = 3 - -// fileIndex is the subset of Index that's gob-encoded for use by -// Index.Write and Index.Read. -type fileIndex struct { - Version int - Words map[string]*LookupResult - Alts map[string]*AltWords - Snippets []*Snippet - Fulltext bool - Stats Statistics - ImportCount map[string]int - PackagePath map[string]map[string]bool - Exports map[string]map[string]SpotKind - Idents map[SpotKind]map[string][]Ident - Opts indexOptions -} - -func (x *fileIndex) Write(w io.Writer) error { - return gob.NewEncoder(w).Encode(x) -} - -func (x *fileIndex) Read(r io.Reader) error { - return gob.NewDecoder(r).Decode(x) -} - -// WriteTo writes the index x to w. -func (x *Index) WriteTo(w io.Writer) (n int64, err error) { - w = countingWriter{&n, w} - fulltext := false - if x.suffixes != nil { - fulltext = true - } - fx := fileIndex{ - Version: fileIndexVersion, - Words: x.words, - Alts: x.alts, - Snippets: x.snippets, - Fulltext: fulltext, - Stats: x.stats, - ImportCount: x.importCount, - PackagePath: x.packagePath, - Exports: x.exports, - Idents: x.idents, - Opts: x.opts, - } - if err := fx.Write(w); err != nil { - return 0, err - } - if fulltext { - encode := func(x interface{}) error { - return gob.NewEncoder(w).Encode(x) - } - if err := x.fset.Write(encode); err != nil { - return 0, err - } - if err := x.suffixes.Write(w); err != nil { - return 0, err - } - } - return n, nil -} - -// ReadFrom reads the index from r into x; x must not be nil. -// If r does not also implement io.ByteReader, it will be wrapped in a bufio.Reader. -// If the index is from an old version, the error is ErrFileIndexVersion. -func (x *Index) ReadFrom(r io.Reader) (n int64, err error) { - // We use the ability to read bytes as a plausible surrogate for buffering. - if _, ok := r.(io.ByteReader); !ok { - r = bufio.NewReader(r) - } - r = countingReader{&n, r.(byteReader)} - var fx fileIndex - if err := fx.Read(r); err != nil { - return n, err - } - if fx.Version != fileIndexVersion { - return 0, ErrFileIndexVersion - } - x.words = fx.Words - x.alts = fx.Alts - x.snippets = fx.Snippets - x.stats = fx.Stats - x.importCount = fx.ImportCount - x.packagePath = fx.PackagePath - x.exports = fx.Exports - x.idents = fx.Idents - x.opts = fx.Opts - if fx.Fulltext { - x.fset = token.NewFileSet() - decode := func(x interface{}) error { - return gob.NewDecoder(r).Decode(x) - } - if err := x.fset.Read(decode); err != nil { - return n, err - } - x.suffixes = new(suffixarray.Index) - if err := x.suffixes.Read(r); err != nil { - return n, err - } - } - return n, nil -} - -// Stats returns index statistics. -func (x *Index) Stats() Statistics { - return x.stats -} - -// ImportCount returns a map from import paths to how many times they were seen. -func (x *Index) ImportCount() map[string]int { - return x.importCount -} - -// PackagePath returns a map from short package name to a set -// of full package path names that use that short package name. -func (x *Index) PackagePath() map[string]map[string]bool { - return x.packagePath -} - -// Exports returns a map from full package path to exported -// symbol name to its type. -func (x *Index) Exports() map[string]map[string]SpotKind { - return x.exports -} - -// Idents returns a map from identifier type to exported -// symbol name to the list of identifiers matching that name. -func (x *Index) Idents() map[SpotKind]map[string][]Ident { - return x.idents -} - -func (x *Index) lookupWord(w string) (match *LookupResult, alt *AltWords) { - match = x.words[w] - alt = x.alts[canonical(w)] - // remove current spelling from alternatives - // (if there is no match, the alternatives do - // not contain the current spelling) - if match != nil && alt != nil { - alt = alt.filter(w) - } - return -} - -// isIdentifier reports whether s is a Go identifier. -func isIdentifier(s string) bool { - for i, ch := range s { - if unicode.IsLetter(ch) || ch == '_' || i > 0 && unicode.IsDigit(ch) { - continue - } - return false - } - return len(s) > 0 -} - -// For a given query, which is either a single identifier or a qualified -// identifier, Lookup returns a SearchResult containing packages, a LookupResult, a -// list of alternative spellings, and identifiers, if any. Any and all results -// may be nil. If the query syntax is wrong, an error is reported. -func (x *Index) Lookup(query string) (*SearchResult, error) { - ss := strings.Split(query, ".") - - // check query syntax - for _, s := range ss { - if !isIdentifier(s) { - return nil, errors.New("all query parts must be identifiers") - } - } - rslt := &SearchResult{ - Query: query, - Idents: make(map[SpotKind][]Ident, 5), - } - // handle simple and qualified identifiers - switch len(ss) { - case 1: - ident := ss[0] - rslt.Hit, rslt.Alt = x.lookupWord(ident) - if rslt.Hit != nil { - // found a match - filter packages with same name - // for the list of packages called ident, if any - rslt.Pak = rslt.Hit.Others.filter(ident) - } - for k, v := range x.idents { - const rsltLimit = 50 - ids := byImportCount{v[ident], x.importCount} - rslt.Idents[k] = ids.top(rsltLimit) - } - - case 2: - pakname, ident := ss[0], ss[1] - rslt.Hit, rslt.Alt = x.lookupWord(ident) - if rslt.Hit != nil { - // found a match - filter by package name - // (no paks - package names are not qualified) - decls := rslt.Hit.Decls.filter(pakname) - others := rslt.Hit.Others.filter(pakname) - rslt.Hit = &LookupResult{decls, others} - } - for k, v := range x.idents { - ids := byImportCount{v[ident], x.importCount} - rslt.Idents[k] = ids.filter(pakname) - } - - default: - return nil, errors.New("query is not a (qualified) identifier") - } - - return rslt, nil -} - -func (x *Index) Snippet(i int) *Snippet { - // handle illegal snippet indices gracefully - if 0 <= i && i < len(x.snippets) { - return x.snippets[i] - } - return nil -} - -type positionList []struct { - filename string - line int -} - -func (list positionList) Len() int { return len(list) } -func (list positionList) Less(i, j int) bool { return list[i].filename < list[j].filename } -func (list positionList) Swap(i, j int) { list[i], list[j] = list[j], list[i] } - -// unique returns the list sorted and with duplicate entries removed -func unique(list []int) []int { - sort.Ints(list) - var last int - i := 0 - for _, x := range list { - if i == 0 || x != last { - last = x - list[i] = x - i++ - } - } - return list[0:i] -} - -// A FileLines value specifies a file and line numbers within that file. -type FileLines struct { - Filename string - Lines []int -} - -// LookupRegexp returns the number of matches and the matches where a regular -// expression r is found in the full text index. At most n matches are -// returned (thus found <= n). -// -func (x *Index) LookupRegexp(r *regexp.Regexp, n int) (found int, result []FileLines) { - if x.suffixes == nil || n <= 0 { - return - } - // n > 0 - - var list positionList - // FindAllIndex may returns matches that span across file boundaries. - // Such matches are unlikely, buf after eliminating them we may end up - // with fewer than n matches. If we don't have enough at the end, redo - // the search with an increased value n1, but only if FindAllIndex - // returned all the requested matches in the first place (if it - // returned fewer than that there cannot be more). - for n1 := n; found < n; n1 += n - found { - found = 0 - matches := x.suffixes.FindAllIndex(r, n1) - // compute files, exclude matches that span file boundaries, - // and map offsets to file-local offsets - list = make(positionList, len(matches)) - for _, m := range matches { - // by construction, an offset corresponds to the Pos value - // for the file set - use it to get the file and line - p := token.Pos(m[0]) - if file := x.fset.File(p); file != nil { - if base := file.Base(); base <= m[1] && m[1] <= base+file.Size() { - // match [m[0], m[1]) is within the file boundaries - list[found].filename = file.Name() - list[found].line = file.Line(p) - found++ - } - } - } - if found == n || len(matches) < n1 { - // found all matches or there's no chance to find more - break - } - } - list = list[0:found] - sort.Sort(list) // sort by filename - - // collect matches belonging to the same file - var last string - var lines []int - addLines := func() { - if len(lines) > 0 { - // remove duplicate lines - result = append(result, FileLines{last, unique(lines)}) - lines = nil - } - } - for _, m := range list { - if m.filename != last { - addLines() - last = m.filename - } - lines = append(lines, m.line) - } - addLines() - - return -} - -// InvalidateIndex should be called whenever any of the file systems -// under godoc's observation change so that the indexer is kicked on. -func (c *Corpus) invalidateIndex() { - c.fsModified.Set(nil) - c.refreshMetadata() -} - -// feedDirnames feeds the directory names of all directories -// under the file system given by root to channel c. -// -func (c *Corpus) feedDirnames(ch chan<- string) { - if dir, _ := c.fsTree.Get(); dir != nil { - for d := range dir.(*Directory).iter(false) { - ch <- d.Path - } - } -} - -// fsDirnames() returns a channel sending all directory names -// of all the file systems under godoc's observation. -// -func (c *Corpus) fsDirnames() <-chan string { - ch := make(chan string, 256) // buffered for fewer context switches - go func() { - c.feedDirnames(ch) - close(ch) - }() - return ch -} - -// CompatibleWith reports whether the Index x is compatible with the corpus -// indexing options set in c. -func (x *Index) CompatibleWith(c *Corpus) bool { - return x.opts.Docs == c.IndexDocs && - x.opts.GoCode == c.IndexGoCode && - x.opts.FullText == c.IndexFullText && - x.opts.MaxResults == c.MaxResults -} - -func (c *Corpus) readIndex(filenames string) error { - matches, err := filepath.Glob(filenames) - if err != nil { - return err - } else if matches == nil { - return fmt.Errorf("no index files match %q", filenames) - } - sort.Strings(matches) // make sure files are in the right order - files := make([]io.Reader, 0, len(matches)) - for _, filename := range matches { - f, err := os.Open(filename) - if err != nil { - return err - } - defer f.Close() - files = append(files, f) - } - return c.ReadIndexFrom(io.MultiReader(files...)) -} - -// ReadIndexFrom sets the current index from the serialized version found in r. -func (c *Corpus) ReadIndexFrom(r io.Reader) error { - x := new(Index) - if _, err := x.ReadFrom(r); err != nil { - return err - } - if !x.CompatibleWith(c) { - return fmt.Errorf("index file options are incompatible: %v", x.opts) - } - c.searchIndex.Set(x) - return nil -} - -func (c *Corpus) UpdateIndex() { - if c.Verbose { - log.Printf("updating index...") - } - start := time.Now() - index := c.NewIndex() - stop := time.Now() - c.searchIndex.Set(index) - if c.Verbose { - secs := stop.Sub(start).Seconds() - stats := index.Stats() - log.Printf("index updated (%gs, %d bytes of source, %d files, %d lines, %d unique words, %d spots)", - secs, stats.Bytes, stats.Files, stats.Lines, stats.Words, stats.Spots) - } - memstats := new(runtime.MemStats) - runtime.ReadMemStats(memstats) - if c.Verbose { - log.Printf("before GC: bytes = %d footprint = %d", memstats.HeapAlloc, memstats.Sys) - } - runtime.GC() - runtime.ReadMemStats(memstats) - if c.Verbose { - log.Printf("after GC: bytes = %d footprint = %d", memstats.HeapAlloc, memstats.Sys) - } -} - -// RunIndexer runs forever, indexing. -func (c *Corpus) RunIndexer() { - // initialize the index from disk if possible - if c.IndexFiles != "" { - c.initFSTree() - if err := c.readIndex(c.IndexFiles); err != nil { - log.Printf("error reading index from file %s: %v", c.IndexFiles, err) - } - return - } - - // Repeatedly update the package directory tree and index. - // TODO(bgarcia): Use fsnotify to only update when notified of a filesystem change. - for { - c.initFSTree() - c.UpdateIndex() - if c.IndexInterval < 0 { - return - } - delay := 5 * time.Minute // by default, reindex every 5 minutes - if c.IndexInterval > 0 { - delay = c.IndexInterval - } - time.Sleep(delay) - } -} - -type countingWriter struct { - n *int64 - w io.Writer -} - -func (c countingWriter) Write(p []byte) (n int, err error) { - n, err = c.w.Write(p) - *c.n += int64(n) - return -} - -type byteReader interface { - io.Reader - io.ByteReader -} - -type countingReader struct { - n *int64 - r byteReader -} - -func (c countingReader) Read(p []byte) (n int, err error) { - n, err = c.r.Read(p) - *c.n += int64(n) - return -} - -func (c countingReader) ReadByte() (b byte, err error) { - b, err = c.r.ReadByte() - *c.n += 1 - return -} diff --git a/vendor/golang.org/x/tools/godoc/index_test.go b/vendor/golang.org/x/tools/godoc/index_test.go deleted file mode 100644 index 97f31e7..0000000 --- a/vendor/golang.org/x/tools/godoc/index_test.go +++ /dev/null @@ -1,323 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "bytes" - "reflect" - "sort" - "strings" - "testing" - - "golang.org/x/tools/godoc/vfs/mapfs" -) - -func newCorpus(t *testing.T) *Corpus { - c := NewCorpus(mapfs.New(map[string]string{ - "src/foo/foo.go": `// Package foo is an example. -package foo - -import "bar" - -const Pi = 3.1415 - -var Foos []Foo - -// Foo is stuff. -type Foo struct{} - -func New() *Foo { - return new(Foo) -} -`, - "src/bar/bar.go": `// Package bar is another example to test races. -package bar -`, - "src/other/bar/bar.go": `// Package bar is another bar package. -package bar -func X() {} -`, - "src/skip/skip.go": `// Package skip should be skipped. -package skip -func Skip() {} -`, - "src/bar/readme.txt": `Whitelisted text file. -`, - "src/bar/baz.zzz": `Text file not whitelisted. -`, - })) - c.IndexEnabled = true - c.IndexDirectory = func(dir string) bool { - return !strings.Contains(dir, "skip") - } - - if err := c.Init(); err != nil { - t.Fatal(err) - } - return c -} - -func TestIndex(t *testing.T) { - for _, docs := range []bool{true, false} { - for _, goCode := range []bool{true, false} { - for _, fullText := range []bool{true, false} { - c := newCorpus(t) - c.IndexDocs = docs - c.IndexGoCode = goCode - c.IndexFullText = fullText - c.UpdateIndex() - ix, _ := c.CurrentIndex() - if ix == nil { - t.Fatal("no index") - } - t.Logf("docs, goCode, fullText = %v,%v,%v", docs, goCode, fullText) - testIndex(t, c, ix) - } - } - } -} - -func TestIndexWriteRead(t *testing.T) { - type key struct { - docs, goCode, fullText bool - } - type val struct { - buf *bytes.Buffer - c *Corpus - } - m := map[key]val{} - - for _, docs := range []bool{true, false} { - for _, goCode := range []bool{true, false} { - for _, fullText := range []bool{true, false} { - k := key{docs, goCode, fullText} - c := newCorpus(t) - c.IndexDocs = docs - c.IndexGoCode = goCode - c.IndexFullText = fullText - c.UpdateIndex() - ix, _ := c.CurrentIndex() - if ix == nil { - t.Fatal("no index") - } - var buf bytes.Buffer - nw, err := ix.WriteTo(&buf) - if err != nil { - t.Fatalf("Index.WriteTo: %v", err) - } - m[k] = val{bytes.NewBuffer(buf.Bytes()), c} - ix2 := new(Index) - nr, err := ix2.ReadFrom(&buf) - if err != nil { - t.Fatalf("Index.ReadFrom: %v", err) - } - if nr != nw { - t.Errorf("Wrote %d bytes to index but read %d", nw, nr) - } - testIndex(t, c, ix) - } - } - } - // Test CompatibleWith - for k1, v1 := range m { - ix := new(Index) - if _, err := ix.ReadFrom(v1.buf); err != nil { - t.Fatalf("Index.ReadFrom: %v", err) - } - for k2, v2 := range m { - if got, want := ix.CompatibleWith(v2.c), k1 == k2; got != want { - t.Errorf("CompatibleWith = %v; want %v for %v, %v", got, want, k1, k2) - } - } - } -} - -func testIndex(t *testing.T, c *Corpus, ix *Index) { - if _, ok := ix.words["Skip"]; ok { - t.Errorf("the word Skip was found; expected it to be skipped") - } - checkStats(t, c, ix) - checkImportCount(t, c, ix) - checkPackagePath(t, c, ix) - checkExports(t, c, ix) - checkIdents(t, c, ix) -} - -// checkStats checks the Index's statistics. -// Some statistics are only set when we're indexing Go code. -func checkStats(t *testing.T, c *Corpus, ix *Index) { - want := Statistics{} - if c.IndexFullText { - want.Bytes = 314 - want.Files = 4 - want.Lines = 21 - } else if c.IndexDocs || c.IndexGoCode { - want.Bytes = 291 - want.Files = 3 - want.Lines = 20 - } - if c.IndexGoCode { - want.Words = 8 - want.Spots = 12 - } - if got := ix.Stats(); !reflect.DeepEqual(got, want) { - t.Errorf("Stats = %#v; want %#v", got, want) - } -} - -// checkImportCount checks the Index's import count map. -// It is only set when we're indexing Go code. -func checkImportCount(t *testing.T, c *Corpus, ix *Index) { - want := map[string]int{} - if c.IndexGoCode { - want = map[string]int{ - "bar": 1, - } - } - if got := ix.ImportCount(); !reflect.DeepEqual(got, want) { - t.Errorf("ImportCount = %v; want %v", got, want) - } -} - -// checkPackagePath checks the Index's package path map. -// It is set if at least one of the indexing options is enabled. -func checkPackagePath(t *testing.T, c *Corpus, ix *Index) { - want := map[string]map[string]bool{} - if c.IndexDocs || c.IndexGoCode || c.IndexFullText { - want = map[string]map[string]bool{ - "foo": { - "foo": true, - }, - "bar": { - "bar": true, - "other/bar": true, - }, - } - } - if got := ix.PackagePath(); !reflect.DeepEqual(got, want) { - t.Errorf("PackagePath = %v; want %v", got, want) - } -} - -// checkExports checks the Index's exports map. -// It is only set when we're indexing Go code. -func checkExports(t *testing.T, c *Corpus, ix *Index) { - want := map[string]map[string]SpotKind{} - if c.IndexGoCode { - want = map[string]map[string]SpotKind{ - "foo": { - "Pi": ConstDecl, - "Foos": VarDecl, - "Foo": TypeDecl, - "New": FuncDecl, - }, - "other/bar": { - "X": FuncDecl, - }, - } - } - if got := ix.Exports(); !reflect.DeepEqual(got, want) { - t.Errorf("Exports = %v; want %v", got, want) - } -} - -// checkIdents checks the Index's indents map. -// It is only set when we're indexing documentation. -func checkIdents(t *testing.T, c *Corpus, ix *Index) { - want := map[SpotKind]map[string][]Ident{} - if c.IndexDocs { - want = map[SpotKind]map[string][]Ident{ - PackageClause: { - "bar": { - {"bar", "bar", "bar", "Package bar is another example to test races."}, - {"other/bar", "bar", "bar", "Package bar is another bar package."}, - }, - "foo": {{"foo", "foo", "foo", "Package foo is an example."}}, - "other": {{"other/bar", "bar", "bar", "Package bar is another bar package."}}, - }, - ConstDecl: { - "Pi": {{"foo", "foo", "Pi", ""}}, - }, - VarDecl: { - "Foos": {{"foo", "foo", "Foos", ""}}, - }, - TypeDecl: { - "Foo": {{"foo", "foo", "Foo", "Foo is stuff."}}, - }, - FuncDecl: { - "New": {{"foo", "foo", "New", ""}}, - "X": {{"other/bar", "bar", "X", ""}}, - }, - } - } - if got := ix.Idents(); !reflect.DeepEqual(got, want) { - t.Errorf("Idents = %v; want %v", got, want) - } -} - -func TestIdentResultSort(t *testing.T) { - ic := map[string]int{ - "/a/b/pkg1": 10, - "/a/b/pkg2": 2, - "/b/d/pkg3": 20, - } - for _, tc := range []struct { - ir []Ident - exp []Ident - }{ - { - ir: []Ident{ - {"/a/b/pkg2", "pkg2", "MyFunc2", ""}, - {"/b/d/pkg3", "pkg3", "MyFunc3", ""}, - {"/a/b/pkg1", "pkg1", "MyFunc1", ""}, - }, - exp: []Ident{ - {"/b/d/pkg3", "pkg3", "MyFunc3", ""}, - {"/a/b/pkg1", "pkg1", "MyFunc1", ""}, - {"/a/b/pkg2", "pkg2", "MyFunc2", ""}, - }, - }, - { - ir: []Ident{ - {"/a/a/pkg1", "pkg1", "MyFunc1", ""}, - {"/a/b/pkg1", "pkg1", "MyFunc1", ""}, - }, - exp: []Ident{ - {"/a/b/pkg1", "pkg1", "MyFunc1", ""}, - {"/a/a/pkg1", "pkg1", "MyFunc1", ""}, - }, - }, - } { - if sort.Sort(byImportCount{tc.ir, ic}); !reflect.DeepEqual(tc.ir, tc.exp) { - t.Errorf("got: %v, want %v", tc.ir, tc.exp) - } - } -} - -func TestIdentFilter(t *testing.T) { - ic := map[string]int{} - for _, tc := range []struct { - ir []Ident - pak string - exp []Ident - }{ - { - ir: []Ident{ - {"/a/b/pkg2", "pkg2", "MyFunc2", ""}, - {"/b/d/pkg3", "pkg3", "MyFunc3", ""}, - {"/a/b/pkg1", "pkg1", "MyFunc1", ""}, - }, - pak: "pkg2", - exp: []Ident{ - {"/a/b/pkg2", "pkg2", "MyFunc2", ""}, - }, - }, - } { - res := byImportCount{tc.ir, ic}.filter(tc.pak) - if !reflect.DeepEqual(res, tc.exp) { - t.Errorf("got: %v, want %v", res, tc.exp) - } - } -} diff --git a/vendor/golang.org/x/tools/godoc/linkify.go b/vendor/golang.org/x/tools/godoc/linkify.go deleted file mode 100644 index e4add22..0000000 --- a/vendor/golang.org/x/tools/godoc/linkify.go +++ /dev/null @@ -1,195 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// This file implements LinkifyText which introduces -// links for identifiers pointing to their declarations. -// The approach does not cover all cases because godoc -// doesn't have complete type information, but it's -// reasonably good for browsing. - -package godoc - -import ( - "fmt" - "go/ast" - "go/doc" - "go/token" - "io" - "strconv" -) - -// LinkifyText HTML-escapes source text and writes it to w. -// Identifiers that are in a "use" position (i.e., that are -// not being declared), are wrapped with HTML links pointing -// to the respective declaration, if possible. Comments are -// formatted the same way as with FormatText. -// -func LinkifyText(w io.Writer, text []byte, n ast.Node) { - links := linksFor(n) - - i := 0 // links index - prev := "" // prev HTML tag - linkWriter := func(w io.Writer, _ int, start bool) { - // end tag - if !start { - if prev != "" { - fmt.Fprintf(w, ``, prev) - prev = "" - } - return - } - - // start tag - prev = "" - if i < len(links) { - switch info := links[i]; { - case info.path != "" && info.name == "": - // package path - fmt.Fprintf(w, ``, info.path) - prev = "a" - case info.path != "" && info.name != "": - // qualified identifier - fmt.Fprintf(w, ``, info.path, info.name) - prev = "a" - case info.path == "" && info.name != "": - // local identifier - if info.isVal { - fmt.Fprintf(w, ``, info.name) - prev = "span" - } else if ast.IsExported(info.name) { - fmt.Fprintf(w, ``, info.name) - prev = "a" - } - } - i++ - } - } - - idents := tokenSelection(text, token.IDENT) - comments := tokenSelection(text, token.COMMENT) - FormatSelections(w, text, linkWriter, idents, selectionTag, comments) -} - -// A link describes the (HTML) link information for an identifier. -// The zero value of a link represents "no link". -// -type link struct { - path, name string // package path, identifier name - isVal bool // identifier is defined in a const or var declaration -} - -// linksFor returns the list of links for the identifiers used -// by node in the same order as they appear in the source. -// -func linksFor(node ast.Node) (links []link) { - // linkMap tracks link information for each ast.Ident node. Entries may - // be created out of source order (for example, when we visit a parent - // definition node). These links are appended to the returned slice when - // their ast.Ident nodes are visited. - linkMap := make(map[*ast.Ident]link) - - ast.Inspect(node, func(node ast.Node) bool { - switch n := node.(type) { - case *ast.Field: - for _, n := range n.Names { - linkMap[n] = link{} - } - case *ast.ImportSpec: - if name := n.Name; name != nil { - linkMap[name] = link{} - } - case *ast.ValueSpec: - for _, n := range n.Names { - linkMap[n] = link{name: n.Name, isVal: true} - } - case *ast.FuncDecl: - linkMap[n.Name] = link{} - case *ast.TypeSpec: - linkMap[n.Name] = link{} - case *ast.AssignStmt: - // Short variable declarations only show up if we apply - // this code to all source code (as opposed to exported - // declarations only). - if n.Tok == token.DEFINE { - // Some of the lhs variables may be re-declared, - // so technically they are not defs. We don't - // care for now. - for _, x := range n.Lhs { - // Each lhs expression should be an - // ident, but we are conservative and check. - if n, _ := x.(*ast.Ident); n != nil { - linkMap[n] = link{isVal: true} - } - } - } - case *ast.SelectorExpr: - // Detect qualified identifiers of the form pkg.ident. - // If anything fails we return true and collect individual - // identifiers instead. - if x, _ := n.X.(*ast.Ident); x != nil { - // Create links only if x is a qualified identifier. - if obj := x.Obj; obj != nil && obj.Kind == ast.Pkg { - if spec, _ := obj.Decl.(*ast.ImportSpec); spec != nil { - // spec.Path.Value is the import path - if path, err := strconv.Unquote(spec.Path.Value); err == nil { - // Register two links, one for the package - // and one for the qualified identifier. - linkMap[x] = link{path: path} - linkMap[n.Sel] = link{path: path, name: n.Sel.Name} - } - } - } - } - case *ast.CompositeLit: - // Detect field names within composite literals. These links should - // be prefixed by the type name. - fieldPath := "" - prefix := "" - switch typ := n.Type.(type) { - case *ast.Ident: - prefix = typ.Name + "." - case *ast.SelectorExpr: - if x, _ := typ.X.(*ast.Ident); x != nil { - // Create links only if x is a qualified identifier. - if obj := x.Obj; obj != nil && obj.Kind == ast.Pkg { - if spec, _ := obj.Decl.(*ast.ImportSpec); spec != nil { - // spec.Path.Value is the import path - if path, err := strconv.Unquote(spec.Path.Value); err == nil { - // Register two links, one for the package - // and one for the qualified identifier. - linkMap[x] = link{path: path} - linkMap[typ.Sel] = link{path: path, name: typ.Sel.Name} - fieldPath = path - prefix = typ.Sel.Name + "." - } - } - } - } - } - for _, e := range n.Elts { - if kv, ok := e.(*ast.KeyValueExpr); ok { - if k, ok := kv.Key.(*ast.Ident); ok { - // Note: there is some syntactic ambiguity here. We cannot determine - // if this is a struct literal or a map literal without type - // information. We assume struct literal. - name := prefix + k.Name - linkMap[k] = link{path: fieldPath, name: name} - } - } - } - case *ast.Ident: - if l, ok := linkMap[n]; ok { - links = append(links, l) - } else { - l := link{name: n.Name} - if n.Obj == nil && doc.IsPredeclared(n.Name) { - l.path = builtinPkgPath - } - links = append(links, l) - } - } - return true - }) - return -} diff --git a/vendor/golang.org/x/tools/godoc/meta.go b/vendor/golang.org/x/tools/godoc/meta.go deleted file mode 100644 index 41ade39..0000000 --- a/vendor/golang.org/x/tools/godoc/meta.go +++ /dev/null @@ -1,144 +0,0 @@ -// Copyright 2009 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package godoc - -import ( - "bytes" - "encoding/json" - "log" - pathpkg "path" - "strings" - "time" - - "golang.org/x/tools/godoc/vfs" -) - -var ( - doctype = []byte("") -) - -// ---------------------------------------------------------------------------- -// Documentation Metadata - -// TODO(adg): why are some exported and some aren't? -brad -type Metadata struct { - Title string - Subtitle string - Template bool // execute as template - Path string // canonical path for this page - filePath string // filesystem path relative to goroot -} - -func (m *Metadata) FilePath() string { return m.filePath } - -// extractMetadata extracts the Metadata from a byte slice. -// It returns the Metadata value and the remaining data. -// If no metadata is present the original byte slice is returned. -// -func extractMetadata(b []byte) (meta Metadata, tail []byte, err error) { - tail = b - if !bytes.HasPrefix(b, jsonStart) { - return - } - end := bytes.Index(b, jsonEnd) - if end < 0 { - return - } - b = b[len(jsonStart)-1 : end+1] // drop leading %s", command, buf.Bytes()) - return text, nil -} - -// parseArg returns the integer or string value of the argument and tells which it is. -func parseArg(arg interface{}, file string, max int) (ival int, sval string, isInt bool) { - switch n := arg.(type) { - case int: - if n <= 0 || n > max { - log.Panicf("%q:%d is out of range", file, n) - } - return n, "", true - case string: - return 0, n, false - } - log.Panicf("unrecognized argument %v type %T", arg, arg) - return -} - -// oneLine returns the single line generated by a two-argument code invocation. -func (c *Corpus) oneLine(file, text string, arg interface{}) string { - lines := strings.SplitAfter(c.contents(file), "\n") - line, pattern, isInt := parseArg(arg, file, len(lines)) - if isInt { - return lines[line-1] - } - return lines[match(file, 0, lines, pattern)-1] -} - -// multipleLines returns the text generated by a three-argument code invocation. -func (c *Corpus) multipleLines(file, text string, arg1, arg2 interface{}) string { - lines := strings.SplitAfter(c.contents(file), "\n") - line1, pattern1, isInt1 := parseArg(arg1, file, len(lines)) - line2, pattern2, isInt2 := parseArg(arg2, file, len(lines)) - if !isInt1 { - line1 = match(file, 0, lines, pattern1) - } - if !isInt2 { - line2 = match(file, line1, lines, pattern2) - } else if line2 < line1 { - log.Panicf("lines out of order for %q: %d %d", text, line1, line2) - } - for k := line1 - 1; k < line2; k++ { - if strings.HasSuffix(lines[k], "OMIT\n") { - lines[k] = "" - } - } - return strings.Join(lines[line1-1:line2], "") -} - -// match identifies the input line that matches the pattern in a code invocation. -// If start>0, match lines starting there rather than at the beginning. -// The return value is 1-indexed. -func match(file string, start int, lines []string, pattern string) int { - // $ matches the end of the file. - if pattern == "$" { - if len(lines) == 0 { - log.Panicf("%q: empty file", file) - } - return len(lines) - } - // /regexp/ matches the line that matches the regexp. - if len(pattern) > 2 && pattern[0] == '/' && pattern[len(pattern)-1] == '/' { - re, err := regexp.Compile(pattern[1 : len(pattern)-1]) - if err != nil { - log.Panic(err) - } - for i := start; i < len(lines); i++ { - if re.MatchString(lines[i]) { - return i + 1 - } - } - log.Panicf("%s: no match for %#q", file, pattern) - } - log.Panicf("unrecognized pattern: %q", pattern) - return 0 -} diff --git a/vendor/golang.org/x/tools/godoc/vfs/emptyvfs.go b/vendor/golang.org/x/tools/godoc/vfs/emptyvfs.go deleted file mode 100644 index 01b6942..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/emptyvfs.go +++ /dev/null @@ -1,85 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package vfs - -import ( - "fmt" - "os" - "time" -) - -// NewNameSpace returns a NameSpace pre-initialized with an empty -// emulated directory mounted on the root mount point "/". This -// allows directory traversal routines to work properly even if -// a folder is not explicitly mounted at root by the user. -func NewNameSpace() NameSpace { - ns := NameSpace{} - ns.Bind("/", &emptyVFS{}, "/", BindReplace) - return ns -} - -// type emptyVFS emulates a FileSystem consisting of an empty directory -type emptyVFS struct{} - -// Open implements Opener. Since emptyVFS is an empty directory, all -// attempts to open a file should returns errors. -func (e *emptyVFS) Open(path string) (ReadSeekCloser, error) { - if path == "/" { - return nil, fmt.Errorf("open: / is a directory") - } - return nil, os.ErrNotExist -} - -// Stat returns os.FileInfo for an empty directory if the path is -// is root "/" or error. os.FileInfo is implemented by emptyVFS -func (e *emptyVFS) Stat(path string) (os.FileInfo, error) { - if path == "/" { - return e, nil - } - return nil, os.ErrNotExist -} - -func (e *emptyVFS) Lstat(path string) (os.FileInfo, error) { - return e.Stat(path) -} - -// ReadDir returns an empty os.FileInfo slice for "/", else error. -func (e *emptyVFS) ReadDir(path string) ([]os.FileInfo, error) { - if path == "/" { - return []os.FileInfo{}, nil - } - return nil, os.ErrNotExist -} - -func (e *emptyVFS) String() string { - return "emptyVFS(/)" -} - -// These functions below implement os.FileInfo for the single -// empty emulated directory. - -func (e *emptyVFS) Name() string { - return "/" -} - -func (e *emptyVFS) Size() int64 { - return 0 -} - -func (e *emptyVFS) Mode() os.FileMode { - return os.ModeDir | os.ModePerm -} - -func (e *emptyVFS) ModTime() time.Time { - return time.Time{} -} - -func (e *emptyVFS) IsDir() bool { - return true -} - -func (e *emptyVFS) Sys() interface{} { - return nil -} diff --git a/vendor/golang.org/x/tools/godoc/vfs/emptyvfs_test.go b/vendor/golang.org/x/tools/godoc/vfs/emptyvfs_test.go deleted file mode 100644 index 8ea9b01..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/emptyvfs_test.go +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package vfs_test - -import ( - "testing" - "time" - - "golang.org/x/tools/godoc/vfs" - "golang.org/x/tools/godoc/vfs/mapfs" -) - -func TestNewNameSpace(t *testing.T) { - - // We will mount this filesystem under /fs1 - mount := mapfs.New(map[string]string{"fs1file": "abcdefgh"}) - - // Existing process. This should give error on Stat("/") - t1 := vfs.NameSpace{} - t1.Bind("/fs1", mount, "/", vfs.BindReplace) - - // using NewNameSpace. This should work fine. - t2 := vfs.NewNameSpace() - t2.Bind("/fs1", mount, "/", vfs.BindReplace) - - testcases := map[string][]bool{ - "/": {false, true}, - "/fs1": {true, true}, - "/fs1/fs1file": {true, true}, - } - - fss := []vfs.FileSystem{t1, t2} - - for j, fs := range fss { - for k, v := range testcases { - _, err := fs.Stat(k) - result := err == nil - if result != v[j] { - t.Errorf("fs: %d, testcase: %s, want: %v, got: %v, err: %s", j, k, v[j], result, err) - } - } - } - - fi, err := t2.Stat("/") - if err != nil { - t.Fatal(err) - } - - if fi.Name() != "/" { - t.Errorf("t2.Name() : want:%s got:%s", "/", fi.Name()) - } - - if !fi.ModTime().IsZero() { - t.Errorf("t2.Modime() : want:%v got:%v", time.Time{}, fi.ModTime()) - } -} diff --git a/vendor/golang.org/x/tools/godoc/vfs/httpfs/httpfs.go b/vendor/golang.org/x/tools/godoc/vfs/httpfs/httpfs.go deleted file mode 100644 index f232f03..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/httpfs/httpfs.go +++ /dev/null @@ -1,94 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package httpfs implements http.FileSystem using a godoc vfs.FileSystem. -package httpfs // import "golang.org/x/tools/godoc/vfs/httpfs" - -import ( - "fmt" - "io" - "net/http" - "os" - - "golang.org/x/tools/godoc/vfs" -) - -func New(fs vfs.FileSystem) http.FileSystem { - return &httpFS{fs} -} - -type httpFS struct { - fs vfs.FileSystem -} - -func (h *httpFS) Open(name string) (http.File, error) { - fi, err := h.fs.Stat(name) - if err != nil { - return nil, err - } - if fi.IsDir() { - return &httpDir{h.fs, name, nil}, nil - } - f, err := h.fs.Open(name) - if err != nil { - return nil, err - } - return &httpFile{h.fs, f, name}, nil -} - -// httpDir implements http.File for a directory in a FileSystem. -type httpDir struct { - fs vfs.FileSystem - name string - pending []os.FileInfo -} - -func (h *httpDir) Close() error { return nil } -func (h *httpDir) Stat() (os.FileInfo, error) { return h.fs.Stat(h.name) } -func (h *httpDir) Read([]byte) (int, error) { - return 0, fmt.Errorf("cannot Read from directory %s", h.name) -} - -func (h *httpDir) Seek(offset int64, whence int) (int64, error) { - if offset == 0 && whence == 0 { - h.pending = nil - return 0, nil - } - return 0, fmt.Errorf("unsupported Seek in directory %s", h.name) -} - -func (h *httpDir) Readdir(count int) ([]os.FileInfo, error) { - if h.pending == nil { - d, err := h.fs.ReadDir(h.name) - if err != nil { - return nil, err - } - if d == nil { - d = []os.FileInfo{} // not nil - } - h.pending = d - } - - if len(h.pending) == 0 && count > 0 { - return nil, io.EOF - } - if count <= 0 || count > len(h.pending) { - count = len(h.pending) - } - d := h.pending[:count] - h.pending = h.pending[count:] - return d, nil -} - -// httpFile implements http.File for a file (not directory) in a FileSystem. -type httpFile struct { - fs vfs.FileSystem - vfs.ReadSeekCloser - name string -} - -func (h *httpFile) Stat() (os.FileInfo, error) { return h.fs.Stat(h.name) } -func (h *httpFile) Readdir(int) ([]os.FileInfo, error) { - return nil, fmt.Errorf("cannot Readdir from file %s", h.name) -} diff --git a/vendor/golang.org/x/tools/godoc/vfs/namespace.go b/vendor/golang.org/x/tools/godoc/vfs/namespace.go deleted file mode 100644 index ca1213e..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/namespace.go +++ /dev/null @@ -1,389 +0,0 @@ -// Copyright 2011 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package vfs - -import ( - "fmt" - "io" - "os" - pathpkg "path" - "sort" - "strings" - "time" -) - -// Setting debugNS = true will enable debugging prints about -// name space translations. -const debugNS = false - -// A NameSpace is a file system made up of other file systems -// mounted at specific locations in the name space. -// -// The representation is a map from mount point locations -// to the list of file systems mounted at that location. A traditional -// Unix mount table would use a single file system per mount point, -// but we want to be able to mount multiple file systems on a single -// mount point and have the system behave as if the union of those -// file systems were present at the mount point. -// For example, if the OS file system has a Go installation in -// c:\Go and additional Go path trees in d:\Work1 and d:\Work2, then -// this name space creates the view we want for the godoc server: -// -// NameSpace{ -// "/": { -// {old: "/", fs: OS(`c:\Go`), new: "/"}, -// }, -// "/src/pkg": { -// {old: "/src/pkg", fs: OS(`c:\Go`), new: "/src/pkg"}, -// {old: "/src/pkg", fs: OS(`d:\Work1`), new: "/src"}, -// {old: "/src/pkg", fs: OS(`d:\Work2`), new: "/src"}, -// }, -// } -// -// This is created by executing: -// -// ns := NameSpace{} -// ns.Bind("/", OS(`c:\Go`), "/", BindReplace) -// ns.Bind("/src/pkg", OS(`d:\Work1`), "/src", BindAfter) -// ns.Bind("/src/pkg", OS(`d:\Work2`), "/src", BindAfter) -// -// A particular mount point entry is a triple (old, fs, new), meaning that to -// operate on a path beginning with old, replace that prefix (old) with new -// and then pass that path to the FileSystem implementation fs. -// -// If you do not explicitly mount a FileSystem at the root mountpoint "/" of the -// NameSpace like above, Stat("/") will return a "not found" error which could -// break typical directory traversal routines. In such cases, use NewNameSpace() -// to get a NameSpace pre-initialized with an emulated empty directory at root. -// -// Given this name space, a ReadDir of /src/pkg/code will check each prefix -// of the path for a mount point (first /src/pkg/code, then /src/pkg, then /src, -// then /), stopping when it finds one. For the above example, /src/pkg/code -// will find the mount point at /src/pkg: -// -// {old: "/src/pkg", fs: OS(`c:\Go`), new: "/src/pkg"}, -// {old: "/src/pkg", fs: OS(`d:\Work1`), new: "/src"}, -// {old: "/src/pkg", fs: OS(`d:\Work2`), new: "/src"}, -// -// ReadDir will when execute these three calls and merge the results: -// -// OS(`c:\Go`).ReadDir("/src/pkg/code") -// OS(`d:\Work1').ReadDir("/src/code") -// OS(`d:\Work2').ReadDir("/src/code") -// -// Note that the "/src/pkg" in "/src/pkg/code" has been replaced by -// just "/src" in the final two calls. -// -// OS is itself an implementation of a file system: it implements -// OS(`c:\Go`).ReadDir("/src/pkg/code") as ioutil.ReadDir(`c:\Go\src\pkg\code`). -// -// Because the new path is evaluated by fs (here OS(root)), another way -// to read the mount table is to mentally combine fs+new, so that this table: -// -// {old: "/src/pkg", fs: OS(`c:\Go`), new: "/src/pkg"}, -// {old: "/src/pkg", fs: OS(`d:\Work1`), new: "/src"}, -// {old: "/src/pkg", fs: OS(`d:\Work2`), new: "/src"}, -// -// reads as: -// -// "/src/pkg" -> c:\Go\src\pkg -// "/src/pkg" -> d:\Work1\src -// "/src/pkg" -> d:\Work2\src -// -// An invariant (a redundancy) of the name space representation is that -// ns[mtpt][i].old is always equal to mtpt (in the example, ns["/src/pkg"]'s -// mount table entries always have old == "/src/pkg"). The 'old' field is -// useful to callers, because they receive just a []mountedFS and not any -// other indication of which mount point was found. -// -type NameSpace map[string][]mountedFS - -// A mountedFS handles requests for path by replacing -// a prefix 'old' with 'new' and then calling the fs methods. -type mountedFS struct { - old string - fs FileSystem - new string -} - -// hasPathPrefix returns true if x == y or x == y + "/" + more -func hasPathPrefix(x, y string) bool { - return x == y || strings.HasPrefix(x, y) && (strings.HasSuffix(y, "/") || strings.HasPrefix(x[len(y):], "/")) -} - -// translate translates path for use in m, replacing old with new. -// -// mountedFS{"/src/pkg", fs, "/src"}.translate("/src/pkg/code") == "/src/code". -func (m mountedFS) translate(path string) string { - path = pathpkg.Clean("/" + path) - if !hasPathPrefix(path, m.old) { - panic("translate " + path + " but old=" + m.old) - } - return pathpkg.Join(m.new, path[len(m.old):]) -} - -func (NameSpace) String() string { - return "ns" -} - -// Fprint writes a text representation of the name space to w. -func (ns NameSpace) Fprint(w io.Writer) { - fmt.Fprint(w, "name space {\n") - var all []string - for mtpt := range ns { - all = append(all, mtpt) - } - sort.Strings(all) - for _, mtpt := range all { - fmt.Fprintf(w, "\t%s:\n", mtpt) - for _, m := range ns[mtpt] { - fmt.Fprintf(w, "\t\t%s %s\n", m.fs, m.new) - } - } - fmt.Fprint(w, "}\n") -} - -// clean returns a cleaned, rooted path for evaluation. -// It canonicalizes the path so that we can use string operations -// to analyze it. -func (NameSpace) clean(path string) string { - return pathpkg.Clean("/" + path) -} - -type BindMode int - -const ( - BindReplace BindMode = iota - BindBefore - BindAfter -) - -// Bind causes references to old to redirect to the path new in newfs. -// If mode is BindReplace, old redirections are discarded. -// If mode is BindBefore, this redirection takes priority over existing ones, -// but earlier ones are still consulted for paths that do not exist in newfs. -// If mode is BindAfter, this redirection happens only after existing ones -// have been tried and failed. -func (ns NameSpace) Bind(old string, newfs FileSystem, new string, mode BindMode) { - old = ns.clean(old) - new = ns.clean(new) - m := mountedFS{old, newfs, new} - var mtpt []mountedFS - switch mode { - case BindReplace: - mtpt = append(mtpt, m) - case BindAfter: - mtpt = append(mtpt, ns.resolve(old)...) - mtpt = append(mtpt, m) - case BindBefore: - mtpt = append(mtpt, m) - mtpt = append(mtpt, ns.resolve(old)...) - } - - // Extend m.old, m.new in inherited mount point entries. - for i := range mtpt { - m := &mtpt[i] - if m.old != old { - if !hasPathPrefix(old, m.old) { - // This should not happen. If it does, panic so - // that we can see the call trace that led to it. - panic(fmt.Sprintf("invalid Bind: old=%q m={%q, %s, %q}", old, m.old, m.fs.String(), m.new)) - } - suffix := old[len(m.old):] - m.old = pathpkg.Join(m.old, suffix) - m.new = pathpkg.Join(m.new, suffix) - } - } - - ns[old] = mtpt -} - -// resolve resolves a path to the list of mountedFS to use for path. -func (ns NameSpace) resolve(path string) []mountedFS { - path = ns.clean(path) - for { - if m := ns[path]; m != nil { - if debugNS { - fmt.Printf("resolve %s: %v\n", path, m) - } - return m - } - if path == "/" { - break - } - path = pathpkg.Dir(path) - } - return nil -} - -// Open implements the FileSystem Open method. -func (ns NameSpace) Open(path string) (ReadSeekCloser, error) { - var err error - for _, m := range ns.resolve(path) { - if debugNS { - fmt.Printf("tx %s: %v\n", path, m.translate(path)) - } - tp := m.translate(path) - r, err1 := m.fs.Open(tp) - if err1 == nil { - return r, nil - } - // IsNotExist errors in overlay FSes can mask real errors in - // the underlying FS, so ignore them if there is another error. - if err == nil || os.IsNotExist(err) { - err = err1 - } - } - if err == nil { - err = &os.PathError{Op: "open", Path: path, Err: os.ErrNotExist} - } - return nil, err -} - -// stat implements the FileSystem Stat and Lstat methods. -func (ns NameSpace) stat(path string, f func(FileSystem, string) (os.FileInfo, error)) (os.FileInfo, error) { - var err error - for _, m := range ns.resolve(path) { - fi, err1 := f(m.fs, m.translate(path)) - if err1 == nil { - return fi, nil - } - if err == nil { - err = err1 - } - } - if err == nil { - err = &os.PathError{Op: "stat", Path: path, Err: os.ErrNotExist} - } - return nil, err -} - -func (ns NameSpace) Stat(path string) (os.FileInfo, error) { - return ns.stat(path, FileSystem.Stat) -} - -func (ns NameSpace) Lstat(path string) (os.FileInfo, error) { - return ns.stat(path, FileSystem.Lstat) -} - -// dirInfo is a trivial implementation of os.FileInfo for a directory. -type dirInfo string - -func (d dirInfo) Name() string { return string(d) } -func (d dirInfo) Size() int64 { return 0 } -func (d dirInfo) Mode() os.FileMode { return os.ModeDir | 0555 } -func (d dirInfo) ModTime() time.Time { return startTime } -func (d dirInfo) IsDir() bool { return true } -func (d dirInfo) Sys() interface{} { return nil } - -var startTime = time.Now() - -// ReadDir implements the FileSystem ReadDir method. It's where most of the magic is. -// (The rest is in resolve.) -// -// Logically, ReadDir must return the union of all the directories that are named -// by path. In order to avoid misinterpreting Go packages, of all the directories -// that contain Go source code, we only include the files from the first, -// but we include subdirectories from all. -// -// ReadDir must also return directory entries needed to reach mount points. -// If the name space looks like the example in the type NameSpace comment, -// but c:\Go does not have a src/pkg subdirectory, we still want to be able -// to find that subdirectory, because we've mounted d:\Work1 and d:\Work2 -// there. So if we don't see "src" in the directory listing for c:\Go, we add an -// entry for it before returning. -// -func (ns NameSpace) ReadDir(path string) ([]os.FileInfo, error) { - path = ns.clean(path) - - var ( - haveGo = false - haveName = map[string]bool{} - all []os.FileInfo - err error - first []os.FileInfo - ) - - for _, m := range ns.resolve(path) { - dir, err1 := m.fs.ReadDir(m.translate(path)) - if err1 != nil { - if err == nil { - err = err1 - } - continue - } - - if dir == nil { - dir = []os.FileInfo{} - } - - if first == nil { - first = dir - } - - // If we don't yet have Go files in 'all' and this directory - // has some, add all the files from this directory. - // Otherwise, only add subdirectories. - useFiles := false - if !haveGo { - for _, d := range dir { - if strings.HasSuffix(d.Name(), ".go") { - useFiles = true - haveGo = true - break - } - } - } - - for _, d := range dir { - name := d.Name() - if (d.IsDir() || useFiles) && !haveName[name] { - haveName[name] = true - all = append(all, d) - } - } - } - - // We didn't find any directories containing Go files. - // If some directory returned successfully, use that. - if !haveGo { - for _, d := range first { - if !haveName[d.Name()] { - haveName[d.Name()] = true - all = append(all, d) - } - } - } - - // Built union. Add any missing directories needed to reach mount points. - for old := range ns { - if hasPathPrefix(old, path) && old != path { - // Find next element after path in old. - elem := old[len(path):] - elem = strings.TrimPrefix(elem, "/") - if i := strings.Index(elem, "/"); i >= 0 { - elem = elem[:i] - } - if !haveName[elem] { - haveName[elem] = true - all = append(all, dirInfo(elem)) - } - } - } - - if len(all) == 0 { - return nil, err - } - - sort.Sort(byName(all)) - return all, nil -} - -// byName implements sort.Interface. -type byName []os.FileInfo - -func (f byName) Len() int { return len(f) } -func (f byName) Less(i, j int) bool { return f[i].Name() < f[j].Name() } -func (f byName) Swap(i, j int) { f[i], f[j] = f[j], f[i] } diff --git a/vendor/golang.org/x/tools/godoc/vfs/os.go b/vendor/golang.org/x/tools/godoc/vfs/os.go deleted file mode 100644 index fa98142..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/os.go +++ /dev/null @@ -1,65 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -package vfs - -import ( - "fmt" - "io/ioutil" - "os" - pathpkg "path" - "path/filepath" -) - -// OS returns an implementation of FileSystem reading from the -// tree rooted at root. Recording a root is convenient everywhere -// but necessary on Windows, because the slash-separated path -// passed to Open has no way to specify a drive letter. Using a root -// lets code refer to OS(`c:\`), OS(`d:\`) and so on. -func OS(root string) FileSystem { - return osFS(root) -} - -type osFS string - -func (root osFS) String() string { return "os(" + string(root) + ")" } - -func (root osFS) resolve(path string) string { - // Clean the path so that it cannot possibly begin with ../. - // If it did, the result of filepath.Join would be outside the - // tree rooted at root. We probably won't ever see a path - // with .. in it, but be safe anyway. - path = pathpkg.Clean("/" + path) - - return filepath.Join(string(root), path) -} - -func (root osFS) Open(path string) (ReadSeekCloser, error) { - f, err := os.Open(root.resolve(path)) - if err != nil { - return nil, err - } - fi, err := f.Stat() - if err != nil { - f.Close() - return nil, err - } - if fi.IsDir() { - f.Close() - return nil, fmt.Errorf("Open: %s is a directory", path) - } - return f, nil -} - -func (root osFS) Lstat(path string) (os.FileInfo, error) { - return os.Lstat(root.resolve(path)) -} - -func (root osFS) Stat(path string) (os.FileInfo, error) { - return os.Stat(root.resolve(path)) -} - -func (root osFS) ReadDir(path string) ([]os.FileInfo, error) { - return ioutil.ReadDir(root.resolve(path)) // is sorted -} diff --git a/vendor/golang.org/x/tools/godoc/vfs/vfs.go b/vendor/golang.org/x/tools/godoc/vfs/vfs.go deleted file mode 100644 index ad06b1a..0000000 --- a/vendor/golang.org/x/tools/godoc/vfs/vfs.go +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2013 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -// Package vfs defines types for abstract file system access and provides an -// implementation accessing the file system of the underlying OS. -package vfs // import "golang.org/x/tools/godoc/vfs" - -import ( - "io" - "io/ioutil" - "os" -) - -// The FileSystem interface specifies the methods godoc is using -// to access the file system for which it serves documentation. -type FileSystem interface { - Opener - Lstat(path string) (os.FileInfo, error) - Stat(path string) (os.FileInfo, error) - ReadDir(path string) ([]os.FileInfo, error) - String() string -} - -// Opener is a minimal virtual filesystem that can only open regular files. -type Opener interface { - Open(name string) (ReadSeekCloser, error) -} - -// A ReadSeekCloser can Read, Seek, and Close. -type ReadSeekCloser interface { - io.Reader - io.Seeker - io.Closer -} - -// ReadFile reads the file named by path from fs and returns the contents. -func ReadFile(fs Opener, path string) ([]byte, error) { - rc, err := fs.Open(path) - if err != nil { - return nil, err - } - defer rc.Close() - return ioutil.ReadAll(rc) -} diff --git a/vendor/google.golang.org/grpc/balancer/balancer.go b/vendor/google.golang.org/grpc/balancer/balancer.go deleted file mode 100644 index 219a294..0000000 --- a/vendor/google.golang.org/grpc/balancer/balancer.go +++ /dev/null @@ -1,223 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 balancer defines APIs for load balancing in gRPC. -// All APIs in this package are experimental. -package balancer - -import ( - "errors" - "net" - "strings" - - "golang.org/x/net/context" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/resolver" -) - -var ( - // m is a map from name to balancer builder. - m = make(map[string]Builder) -) - -// Register registers the balancer builder to the balancer map. -// b.Name (lowercased) will be used as the name registered with -// this builder. -func Register(b Builder) { - m[strings.ToLower(b.Name())] = b -} - -// Get returns the resolver builder registered with the given name. -// Note that the compare is done in a case-insenstive fashion. -// If no builder is register with the name, nil will be returned. -func Get(name string) Builder { - if b, ok := m[strings.ToLower(name)]; ok { - return b - } - return nil -} - -// SubConn represents a gRPC sub connection. -// Each sub connection contains a list of addresses. gRPC will -// try to connect to them (in sequence), and stop trying the -// remainder once one connection is successful. -// -// The reconnect backoff will be applied on the list, not a single address. -// For example, try_on_all_addresses -> backoff -> try_on_all_addresses. -// -// All SubConns start in IDLE, and will not try to connect. To trigger -// the connecting, Balancers must call Connect. -// When the connection encounters an error, it will reconnect immediately. -// When the connection becomes IDLE, it will not reconnect unless Connect is -// called. -// -// This interface is to be implemented by gRPC. Users should not need a -// brand new implementation of this interface. For the situations like -// testing, the new implementation should embed this interface. This allows -// gRPC to add new methods to this interface. -type SubConn interface { - // UpdateAddresses updates the addresses used in this SubConn. - // gRPC checks if currently-connected address is still in the new list. - // If it's in the list, the connection will be kept. - // If it's not in the list, the connection will gracefully closed, and - // a new connection will be created. - // - // This will trigger a state transition for the SubConn. - UpdateAddresses([]resolver.Address) - // Connect starts the connecting for this SubConn. - Connect() -} - -// NewSubConnOptions contains options to create new SubConn. -type NewSubConnOptions struct{} - -// ClientConn represents a gRPC ClientConn. -// -// This interface is to be implemented by gRPC. Users should not need a -// brand new implementation of this interface. For the situations like -// testing, the new implementation should embed this interface. This allows -// gRPC to add new methods to this interface. -type ClientConn interface { - // NewSubConn is called by balancer to create a new SubConn. - // It doesn't block and wait for the connections to be established. - // Behaviors of the SubConn can be controlled by options. - NewSubConn([]resolver.Address, NewSubConnOptions) (SubConn, error) - // RemoveSubConn removes the SubConn from ClientConn. - // The SubConn will be shutdown. - RemoveSubConn(SubConn) - - // UpdateBalancerState is called by balancer to nofity gRPC that some internal - // state in balancer has changed. - // - // gRPC will update the connectivity state of the ClientConn, and will call pick - // on the new picker to pick new SubConn. - UpdateBalancerState(s connectivity.State, p Picker) - - // ResolveNow is called by balancer to notify gRPC to do a name resolving. - ResolveNow(resolver.ResolveNowOption) - - // Target returns the dial target for this ClientConn. - Target() string -} - -// BuildOptions contains additional information for Build. -type BuildOptions struct { - // DialCreds is the transport credential the Balancer implementation can - // use to dial to a remote load balancer server. The Balancer implementations - // can ignore this if it does not need to talk to another party securely. - DialCreds credentials.TransportCredentials - // Dialer is the custom dialer the Balancer implementation can use to dial - // to a remote load balancer server. The Balancer implementations - // can ignore this if it doesn't need to talk to remote balancer. - Dialer func(context.Context, string) (net.Conn, error) -} - -// Builder creates a balancer. -type Builder interface { - // Build creates a new balancer with the ClientConn. - Build(cc ClientConn, opts BuildOptions) Balancer - // Name returns the name of balancers built by this builder. - // It will be used to pick balancers (for example in service config). - Name() string -} - -// PickOptions contains addition information for the Pick operation. -type PickOptions struct{} - -// DoneInfo contains additional information for done. -type DoneInfo struct { - // Err is the rpc error the RPC finished with. It could be nil. - Err error - // BytesSent indicates if any bytes have been sent to the server. - BytesSent bool - // BytesReceived indicates if any byte has been received from the server. - BytesReceived bool -} - -var ( - // ErrNoSubConnAvailable indicates no SubConn is available for pick(). - // gRPC will block the RPC until a new picker is available via UpdateBalancerState(). - ErrNoSubConnAvailable = errors.New("no SubConn is available") - // ErrTransientFailure indicates all SubConns are in TransientFailure. - // WaitForReady RPCs will block, non-WaitForReady RPCs will fail. - ErrTransientFailure = errors.New("all SubConns are in TransientFailure") -) - -// Picker is used by gRPC to pick a SubConn to send an RPC. -// Balancer is expected to generate a new picker from its snapshot everytime its -// internal state has changed. -// -// The pickers used by gRPC can be updated by ClientConn.UpdateBalancerState(). -type Picker interface { - // Pick returns the SubConn to be used to send the RPC. - // The returned SubConn must be one returned by NewSubConn(). - // - // This functions is expected to return: - // - a SubConn that is known to be READY; - // - ErrNoSubConnAvailable if no SubConn is available, but progress is being - // made (for example, some SubConn is in CONNECTING mode); - // - other errors if no active connecting is happening (for example, all SubConn - // are in TRANSIENT_FAILURE mode). - // - // If a SubConn is returned: - // - If it is READY, gRPC will send the RPC on it; - // - If it is not ready, or becomes not ready after it's returned, gRPC will block - // until UpdateBalancerState() is called and will call pick on the new picker. - // - // If the returned error is not nil: - // - If the error is ErrNoSubConnAvailable, gRPC will block until UpdateBalancerState() - // - If the error is ErrTransientFailure: - // - If the RPC is wait-for-ready, gRPC will block until UpdateBalancerState() - // is called to pick again; - // - Otherwise, RPC will fail with unavailable error. - // - Else (error is other non-nil error): - // - The RPC will fail with unavailable error. - // - // The returned done() function will be called once the rpc has finished, with the - // final status of that RPC. - // done may be nil if balancer doesn't care about the RPC status. - Pick(ctx context.Context, opts PickOptions) (conn SubConn, done func(DoneInfo), err error) -} - -// Balancer takes input from gRPC, manages SubConns, and collects and aggregates -// the connectivity states. -// -// It also generates and updates the Picker used by gRPC to pick SubConns for RPCs. -// -// HandleSubConnectionStateChange, HandleResolvedAddrs and Close are guaranteed -// to be called synchronously from the same goroutine. -// There's no guarantee on picker.Pick, it may be called anytime. -type Balancer interface { - // HandleSubConnStateChange is called by gRPC when the connectivity state - // of sc has changed. - // Balancer is expected to aggregate all the state of SubConn and report - // that back to gRPC. - // Balancer should also generate and update Pickers when its internal state has - // been changed by the new state. - HandleSubConnStateChange(sc SubConn, state connectivity.State) - // HandleResolvedAddrs is called by gRPC to send updated resolved addresses to - // balancers. - // Balancer can create new SubConn or remove SubConn with the addresses. - // An empty address slice and a non-nil error will be passed if the resolver returns - // non-nil error to gRPC. - HandleResolvedAddrs([]resolver.Address, error) - // Close closes the balancer. The balancer is not required to call - // ClientConn.RemoveSubConn for its existing SubConns. - Close() -} diff --git a/vendor/google.golang.org/grpc/balancer/base/balancer.go b/vendor/google.golang.org/grpc/balancer/base/balancer.go deleted file mode 100644 index 1e962b7..0000000 --- a/vendor/google.golang.org/grpc/balancer/base/balancer.go +++ /dev/null @@ -1,209 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 base - -import ( - "golang.org/x/net/context" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/connectivity" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/resolver" -) - -type baseBuilder struct { - name string - pickerBuilder PickerBuilder -} - -func (bb *baseBuilder) Build(cc balancer.ClientConn, opt balancer.BuildOptions) balancer.Balancer { - return &baseBalancer{ - cc: cc, - pickerBuilder: bb.pickerBuilder, - - subConns: make(map[resolver.Address]balancer.SubConn), - scStates: make(map[balancer.SubConn]connectivity.State), - csEvltr: &connectivityStateEvaluator{}, - // Initialize picker to a picker that always return - // ErrNoSubConnAvailable, because when state of a SubConn changes, we - // may call UpdateBalancerState with this picker. - picker: NewErrPicker(balancer.ErrNoSubConnAvailable), - } -} - -func (bb *baseBuilder) Name() string { - return bb.name -} - -type baseBalancer struct { - cc balancer.ClientConn - pickerBuilder PickerBuilder - - csEvltr *connectivityStateEvaluator - state connectivity.State - - subConns map[resolver.Address]balancer.SubConn - scStates map[balancer.SubConn]connectivity.State - picker balancer.Picker -} - -func (b *baseBalancer) HandleResolvedAddrs(addrs []resolver.Address, err error) { - if err != nil { - grpclog.Infof("base.baseBalancer: HandleResolvedAddrs called with error %v", err) - return - } - grpclog.Infoln("base.baseBalancer: got new resolved addresses: ", addrs) - // addrsSet is the set converted from addrs, it's used for quick lookup of an address. - addrsSet := make(map[resolver.Address]struct{}) - for _, a := range addrs { - addrsSet[a] = struct{}{} - if _, ok := b.subConns[a]; !ok { - // a is a new address (not existing in b.subConns). - sc, err := b.cc.NewSubConn([]resolver.Address{a}, balancer.NewSubConnOptions{}) - if err != nil { - grpclog.Warningf("base.baseBalancer: failed to create new SubConn: %v", err) - continue - } - b.subConns[a] = sc - b.scStates[sc] = connectivity.Idle - sc.Connect() - } - } - for a, sc := range b.subConns { - // a was removed by resolver. - if _, ok := addrsSet[a]; !ok { - b.cc.RemoveSubConn(sc) - delete(b.subConns, a) - // Keep the state of this sc in b.scStates until sc's state becomes Shutdown. - // The entry will be deleted in HandleSubConnStateChange. - } - } -} - -// regeneratePicker takes a snapshot of the balancer, and generates a picker -// from it. The picker is -// - errPicker with ErrTransientFailure if the balancer is in TransientFailure, -// - built by the pickerBuilder with all READY SubConns otherwise. -func (b *baseBalancer) regeneratePicker() { - if b.state == connectivity.TransientFailure { - b.picker = NewErrPicker(balancer.ErrTransientFailure) - return - } - readySCs := make(map[resolver.Address]balancer.SubConn) - - // Filter out all ready SCs from full subConn map. - for addr, sc := range b.subConns { - if st, ok := b.scStates[sc]; ok && st == connectivity.Ready { - readySCs[addr] = sc - } - } - b.picker = b.pickerBuilder.Build(readySCs) -} - -func (b *baseBalancer) HandleSubConnStateChange(sc balancer.SubConn, s connectivity.State) { - grpclog.Infof("base.baseBalancer: handle SubConn state change: %p, %v", sc, s) - oldS, ok := b.scStates[sc] - if !ok { - grpclog.Infof("base.baseBalancer: got state changes for an unknown SubConn: %p, %v", sc, s) - return - } - b.scStates[sc] = s - switch s { - case connectivity.Idle: - sc.Connect() - case connectivity.Shutdown: - // When an address was removed by resolver, b called RemoveSubConn but - // kept the sc's state in scStates. Remove state for this sc here. - delete(b.scStates, sc) - } - - oldAggrState := b.state - b.state = b.csEvltr.recordTransition(oldS, s) - - // Regenerate picker when one of the following happens: - // - this sc became ready from not-ready - // - this sc became not-ready from ready - // - the aggregated state of balancer became TransientFailure from non-TransientFailure - // - the aggregated state of balancer became non-TransientFailure from TransientFailure - if (s == connectivity.Ready) != (oldS == connectivity.Ready) || - (b.state == connectivity.TransientFailure) != (oldAggrState == connectivity.TransientFailure) { - b.regeneratePicker() - } - - b.cc.UpdateBalancerState(b.state, b.picker) - return -} - -// Close is a nop because base balancer doesn't have internal state to clean up, -// and it doesn't need to call RemoveSubConn for the SubConns. -func (b *baseBalancer) Close() { -} - -// NewErrPicker returns a picker that always returns err on Pick(). -func NewErrPicker(err error) balancer.Picker { - return &errPicker{err: err} -} - -type errPicker struct { - err error // Pick() always returns this err. -} - -func (p *errPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - return nil, nil, p.err -} - -// connectivityStateEvaluator gets updated by addrConns when their -// states transition, based on which it evaluates the state of -// ClientConn. -type connectivityStateEvaluator struct { - numReady uint64 // Number of addrConns in ready state. - numConnecting uint64 // Number of addrConns in connecting state. - numTransientFailure uint64 // Number of addrConns in transientFailure. -} - -// recordTransition records state change happening in every subConn and based on -// that it evaluates what aggregated state should be. -// It can only transition between Ready, Connecting and TransientFailure. Other states, -// Idle and Shutdown are transitioned into by ClientConn; in the beginning of the connection -// before any subConn is created ClientConn is in idle state. In the end when ClientConn -// closes it is in Shutdown state. -// -// recordTransition should only be called synchronously from the same goroutine. -func (cse *connectivityStateEvaluator) recordTransition(oldState, newState connectivity.State) connectivity.State { - // Update counters. - for idx, state := range []connectivity.State{oldState, newState} { - updateVal := 2*uint64(idx) - 1 // -1 for oldState and +1 for new. - switch state { - case connectivity.Ready: - cse.numReady += updateVal - case connectivity.Connecting: - cse.numConnecting += updateVal - case connectivity.TransientFailure: - cse.numTransientFailure += updateVal - } - } - - // Evaluate. - if cse.numReady > 0 { - return connectivity.Ready - } - if cse.numConnecting > 0 { - return connectivity.Connecting - } - return connectivity.TransientFailure -} diff --git a/vendor/google.golang.org/grpc/balancer/base/base.go b/vendor/google.golang.org/grpc/balancer/base/base.go deleted file mode 100644 index 012ace2..0000000 --- a/vendor/google.golang.org/grpc/balancer/base/base.go +++ /dev/null @@ -1,52 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 base defines a balancer base that can be used to build balancers with -// different picking algorithms. -// -// The base balancer creates a new SubConn for each resolved address. The -// provided picker will only be notified about READY SubConns. -// -// This package is the base of round_robin balancer, its purpose is to be used -// to build round_robin like balancers with complex picking algorithms. -// Balancers with more complicated logic should try to implement a balancer -// builder from scratch. -// -// All APIs in this package are experimental. -package base - -import ( - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/resolver" -) - -// PickerBuilder creates balancer.Picker. -type PickerBuilder interface { - // Build takes a slice of ready SubConns, and returns a picker that will be - // used by gRPC to pick a SubConn. - Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker -} - -// NewBalancerBuilder returns a balancer builder. The balancers -// built by this builder will use the picker builder to build pickers. -func NewBalancerBuilder(name string, pb PickerBuilder) balancer.Builder { - return &baseBuilder{ - name: name, - pickerBuilder: pb, - } -} diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go deleted file mode 100644 index 2eda0a1..0000000 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin.go +++ /dev/null @@ -1,79 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 roundrobin defines a roundrobin balancer. Roundrobin balancer is -// installed as one of the default balancers in gRPC, users don't need to -// explicitly install this balancer. -package roundrobin - -import ( - "sync" - - "golang.org/x/net/context" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/balancer/base" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/resolver" -) - -// Name is the name of round_robin balancer. -const Name = "round_robin" - -// newBuilder creates a new roundrobin balancer builder. -func newBuilder() balancer.Builder { - return base.NewBalancerBuilder(Name, &rrPickerBuilder{}) -} - -func init() { - balancer.Register(newBuilder()) -} - -type rrPickerBuilder struct{} - -func (*rrPickerBuilder) Build(readySCs map[resolver.Address]balancer.SubConn) balancer.Picker { - grpclog.Infof("roundrobinPicker: newPicker called with readySCs: %v", readySCs) - var scs []balancer.SubConn - for _, sc := range readySCs { - scs = append(scs, sc) - } - return &rrPicker{ - subConns: scs, - } -} - -type rrPicker struct { - // subConns is the snapshot of the roundrobin balancer when this picker was - // created. The slice is immutable. Each Get() will do a round robin - // selection from it and return the selected SubConn. - subConns []balancer.SubConn - - mu sync.Mutex - next int -} - -func (p *rrPicker) Pick(ctx context.Context, opts balancer.PickOptions) (balancer.SubConn, func(balancer.DoneInfo), error) { - if len(p.subConns) <= 0 { - return nil, nil, balancer.ErrNoSubConnAvailable - } - - p.mu.Lock() - sc := p.subConns[p.next] - p.next = (p.next + 1) % len(p.subConns) - p.mu.Unlock() - return sc, nil, nil -} diff --git a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go b/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go deleted file mode 100644 index 59cac4b..0000000 --- a/vendor/google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go +++ /dev/null @@ -1,477 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 roundrobin_test - -import ( - "fmt" - "net" - "sync" - "testing" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/balancer/roundrobin" - "google.golang.org/grpc/codes" - _ "google.golang.org/grpc/grpclog/glogger" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/resolver/manual" - "google.golang.org/grpc/status" - testpb "google.golang.org/grpc/test/grpc_testing" - "google.golang.org/grpc/test/leakcheck" -) - -type testServer struct { - testpb.TestServiceServer -} - -func (s *testServer) EmptyCall(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) { - return &testpb.Empty{}, nil -} - -func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - return nil -} - -type test struct { - servers []*grpc.Server - addresses []string -} - -func (t *test) cleanup() { - for _, s := range t.servers { - s.Stop() - } -} - -func startTestServers(count int) (_ *test, err error) { - t := &test{} - - defer func() { - if err != nil { - for _, s := range t.servers { - s.Stop() - } - } - }() - for i := 0; i < count; i++ { - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - return nil, fmt.Errorf("Failed to listen %v", err) - } - - s := grpc.NewServer() - testpb.RegisterTestServiceServer(s, &testServer{}) - t.servers = append(t.servers, s) - t.addresses = append(t.addresses, lis.Addr().String()) - - go func(s *grpc.Server, l net.Listener) { - s.Serve(l) - }(s, lis) - } - - return t, nil -} - -func TestOneBackend(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - test, err := startTestServers(1) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}}) - // The second RPC should succeed. - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } -} - -func TestBackendsRoundRobin(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - backendCount := 5 - test, err := startTestServers(backendCount) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - var resolvedAddrs []resolver.Address - for i := 0; i < backendCount; i++ { - resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]}) - } - - r.NewAddress(resolvedAddrs) - var p peer.Peer - // Make sure connections to all servers are up. - for si := 0; si < backendCount; si++ { - var connected bool - for i := 0; i < 1000; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() == test.addresses[si] { - connected = true - break - } - time.Sleep(time.Millisecond) - } - if !connected { - t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si]) - } - } - - for i := 0; i < 3*backendCount; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() != test.addresses[i%backendCount] { - t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String()) - } - } -} - -func TestAddressesRemoved(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - test, err := startTestServers(1) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}}) - // The second RPC should succeed. - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - - r.NewAddress([]resolver.Address{}) - for i := 0; i < 1000; i++ { - ctx, cancel := context.WithTimeout(context.Background(), 50*time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}, grpc.FailFast(false)); status.Code(err) == codes.DeadlineExceeded { - return - } - time.Sleep(time.Millisecond) - } - t.Fatalf("No RPC failed after removing all addresses, want RPC to fail with DeadlineExceeded") -} - -func TestCloseWithPendingRPC(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - test, err := startTestServers(1) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - testc := testpb.NewTestServiceClient(cc) - - var wg sync.WaitGroup - for i := 0; i < 3; i++ { - wg.Add(1) - go func() { - defer wg.Done() - // This RPC blocks until cc is closed. - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); status.Code(err) == codes.DeadlineExceeded { - t.Errorf("RPC failed because of deadline after cc is closed; want error the client connection is closing") - } - cancel() - }() - } - cc.Close() - wg.Wait() -} - -func TestNewAddressWhileBlocking(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - test, err := startTestServers(1) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name)) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}}) - // The second RPC should succeed. - ctx, cancel = context.WithTimeout(context.Background(), 2*time.Second) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, nil", err) - } - - r.NewAddress([]resolver.Address{}) - - var wg sync.WaitGroup - for i := 0; i < 3; i++ { - wg.Add(1) - go func() { - defer wg.Done() - // This RPC blocks until NewAddress is called. - testc.EmptyCall(context.Background(), &testpb.Empty{}) - }() - } - time.Sleep(50 * time.Millisecond) - r.NewAddress([]resolver.Address{{Addr: test.addresses[0]}}) - wg.Wait() -} - -func TestOneServerDown(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - backendCount := 3 - test, err := startTestServers(backendCount) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name), grpc.WithWaitForHandshake()) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - var resolvedAddrs []resolver.Address - for i := 0; i < backendCount; i++ { - resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]}) - } - - r.NewAddress(resolvedAddrs) - var p peer.Peer - // Make sure connections to all servers are up. - for si := 0; si < backendCount; si++ { - var connected bool - for i := 0; i < 1000; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() == test.addresses[si] { - connected = true - break - } - time.Sleep(time.Millisecond) - } - if !connected { - t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si]) - } - } - - for i := 0; i < 3*backendCount; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() != test.addresses[i%backendCount] { - t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String()) - } - } - - // Stop one server, RPCs should roundrobin among the remaining servers. - backendCount-- - test.servers[backendCount].Stop() - // Loop until see server[backendCount-1] twice without seeing server[backendCount]. - var targetSeen int - for i := 0; i < 1000; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - targetSeen = 0 - t.Logf("EmptyCall() = _, %v, want _, ", err) - // Due to a race, this RPC could possibly get the connection that - // was closing, and this RPC may fail. Keep trying when this - // happens. - continue - } - switch p.Addr.String() { - case test.addresses[backendCount-1]: - targetSeen++ - case test.addresses[backendCount]: - // Reset targetSeen if peer is server[backendCount]. - targetSeen = 0 - } - // Break to make sure the last picked address is server[-1], so the following for loop won't be flaky. - if targetSeen >= 2 { - break - } - } - if targetSeen != 2 { - t.Fatal("Failed to see server[backendCount-1] twice without seeing server[backendCount]") - } - for i := 0; i < 3*backendCount; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() != test.addresses[i%backendCount] { - t.Errorf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String()) - } - } -} - -func TestAllServersDown(t *testing.T) { - defer leakcheck.Check(t) - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - backendCount := 3 - test, err := startTestServers(backendCount) - if err != nil { - t.Fatalf("failed to start servers: %v", err) - } - defer test.cleanup() - - cc, err := grpc.Dial(r.Scheme()+":///test.server", grpc.WithInsecure(), grpc.WithBalancerName(roundrobin.Name), grpc.WithWaitForHandshake()) - if err != nil { - t.Fatalf("failed to dial: %v", err) - } - defer cc.Close() - testc := testpb.NewTestServiceClient(cc) - // The first RPC should fail because there's no address. - ctx, cancel := context.WithTimeout(context.Background(), time.Millisecond) - defer cancel() - if _, err := testc.EmptyCall(ctx, &testpb.Empty{}); err == nil || status.Code(err) != codes.DeadlineExceeded { - t.Fatalf("EmptyCall() = _, %v, want _, DeadlineExceeded", err) - } - - var resolvedAddrs []resolver.Address - for i := 0; i < backendCount; i++ { - resolvedAddrs = append(resolvedAddrs, resolver.Address{Addr: test.addresses[i]}) - } - - r.NewAddress(resolvedAddrs) - var p peer.Peer - // Make sure connections to all servers are up. - for si := 0; si < backendCount; si++ { - var connected bool - for i := 0; i < 1000; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() == test.addresses[si] { - connected = true - break - } - time.Sleep(time.Millisecond) - } - if !connected { - t.Fatalf("Connection to %v was not up after more than 1 second", test.addresses[si]) - } - } - - for i := 0; i < 3*backendCount; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}, grpc.Peer(&p)); err != nil { - t.Fatalf("EmptyCall() = _, %v, want _, ", err) - } - if p.Addr.String() != test.addresses[i%backendCount] { - t.Fatalf("Index %d: want peer %v, got peer %v", i, test.addresses[i%backendCount], p.Addr.String()) - } - } - - // All servers are stopped, failfast RPC should fail with unavailable. - for i := 0; i < backendCount; i++ { - test.servers[i].Stop() - } - time.Sleep(100 * time.Millisecond) - for i := 0; i < 1000; i++ { - if _, err := testc.EmptyCall(context.Background(), &testpb.Empty{}); status.Code(err) == codes.Unavailable { - return - } - time.Sleep(time.Millisecond) - } - t.Fatalf("Failfast RPCs didn't fail with Unavailable after all servers are stopped") -} diff --git a/vendor/google.golang.org/grpc/connectivity/connectivity.go b/vendor/google.golang.org/grpc/connectivity/connectivity.go deleted file mode 100644 index 568ef5d..0000000 --- a/vendor/google.golang.org/grpc/connectivity/connectivity.go +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 connectivity defines connectivity semantics. -// For details, see https://github.com/grpc/grpc/blob/master/doc/connectivity-semantics-and-api.md. -// All APIs in this package are experimental. -package connectivity - -import ( - "golang.org/x/net/context" - "google.golang.org/grpc/grpclog" -) - -// State indicates the state of connectivity. -// It can be the state of a ClientConn or SubConn. -type State int - -func (s State) String() string { - switch s { - case Idle: - return "IDLE" - case Connecting: - return "CONNECTING" - case Ready: - return "READY" - case TransientFailure: - return "TRANSIENT_FAILURE" - case Shutdown: - return "SHUTDOWN" - default: - grpclog.Errorf("unknown connectivity state: %d", s) - return "Invalid-State" - } -} - -const ( - // Idle indicates the ClientConn is idle. - Idle State = iota - // Connecting indicates the ClienConn is connecting. - Connecting - // Ready indicates the ClientConn is ready for work. - Ready - // TransientFailure indicates the ClientConn has seen a failure but expects to recover. - TransientFailure - // Shutdown indicates the ClientConn has started shutting down. - Shutdown -) - -// Reporter reports the connectivity states. -type Reporter interface { - // CurrentState returns the current state of the reporter. - CurrentState() State - // WaitForStateChange blocks until the reporter's state is different from the given state, - // and returns true. - // It returns false if <-ctx.Done() can proceed (ctx got timeout or got canceled). - WaitForStateChange(context.Context, State) bool -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials.go b/vendor/google.golang.org/grpc/credentials/credentials.go deleted file mode 100644 index 1d2e864..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials.go +++ /dev/null @@ -1,219 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 credentials implements various credentials supported by gRPC library, -// which encapsulate all the state needed by a client to authenticate with a -// server and make various assertions, e.g., about the client's identity, role, -// or whether it is authorized to make a particular call. -package credentials // import "google.golang.org/grpc/credentials" - -import ( - "crypto/tls" - "crypto/x509" - "errors" - "fmt" - "io/ioutil" - "net" - "strings" - - "golang.org/x/net/context" -) - -// alpnProtoStr are the specified application level protocols for gRPC. -var alpnProtoStr = []string{"h2"} - -// PerRPCCredentials defines the common interface for the credentials which need to -// attach security information to every RPC (e.g., oauth2). -type PerRPCCredentials interface { - // GetRequestMetadata gets the current request metadata, refreshing - // tokens if required. This should be called by the transport layer on - // each request, and the data should be populated in headers or other - // context. uri is the URI of the entry point for the request. When - // supported by the underlying implementation, ctx can be used for - // timeout and cancellation. - // TODO(zhaoq): Define the set of the qualified keys instead of leaving - // it as an arbitrary string. - GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) - // RequireTransportSecurity indicates whether the credentials requires - // transport security. - RequireTransportSecurity() bool -} - -// ProtocolInfo provides information regarding the gRPC wire protocol version, -// security protocol, security protocol version in use, server name, etc. -type ProtocolInfo struct { - // ProtocolVersion is the gRPC wire protocol version. - ProtocolVersion string - // SecurityProtocol is the security protocol in use. - SecurityProtocol string - // SecurityVersion is the security protocol version. - SecurityVersion string - // ServerName is the user-configured server name. - ServerName string -} - -// AuthInfo defines the common interface for the auth information the users are interested in. -type AuthInfo interface { - AuthType() string -} - -// ErrConnDispatched indicates that rawConn has been dispatched out of gRPC -// and the caller should not close rawConn. -var ErrConnDispatched = errors.New("credentials: rawConn is dispatched out of gRPC") - -// TransportCredentials defines the common interface for all the live gRPC wire -// protocols and supported transport security protocols (e.g., TLS, SSL). -type TransportCredentials interface { - // ClientHandshake does the authentication handshake specified by the corresponding - // authentication protocol on rawConn for clients. It returns the authenticated - // connection and the corresponding auth information about the connection. - // Implementations must use the provided context to implement timely cancellation. - // gRPC will try to reconnect if the error returned is a temporary error - // (io.EOF, context.DeadlineExceeded or err.Temporary() == true). - // If the returned error is a wrapper error, implementations should make sure that - // the error implements Temporary() to have the correct retry behaviors. - // - // If the returned net.Conn is closed, it MUST close the net.Conn provided. - ClientHandshake(context.Context, string, net.Conn) (net.Conn, AuthInfo, error) - // ServerHandshake does the authentication handshake for servers. It returns - // the authenticated connection and the corresponding auth information about - // the connection. - // - // If the returned net.Conn is closed, it MUST close the net.Conn provided. - ServerHandshake(net.Conn) (net.Conn, AuthInfo, error) - // Info provides the ProtocolInfo of this TransportCredentials. - Info() ProtocolInfo - // Clone makes a copy of this TransportCredentials. - Clone() TransportCredentials - // OverrideServerName overrides the server name used to verify the hostname on the returned certificates from the server. - // gRPC internals also use it to override the virtual hosting name if it is set. - // It must be called before dialing. Currently, this is only used by grpclb. - OverrideServerName(string) error -} - -// TLSInfo contains the auth information for a TLS authenticated connection. -// It implements the AuthInfo interface. -type TLSInfo struct { - State tls.ConnectionState -} - -// AuthType returns the type of TLSInfo as a string. -func (t TLSInfo) AuthType() string { - return "tls" -} - -// tlsCreds is the credentials required for authenticating a connection using TLS. -type tlsCreds struct { - // TLS configuration - config *tls.Config -} - -func (c tlsCreds) Info() ProtocolInfo { - return ProtocolInfo{ - SecurityProtocol: "tls", - SecurityVersion: "1.2", - ServerName: c.config.ServerName, - } -} - -func (c *tlsCreds) ClientHandshake(ctx context.Context, authority string, rawConn net.Conn) (_ net.Conn, _ AuthInfo, err error) { - // use local cfg to avoid clobbering ServerName if using multiple endpoints - cfg := cloneTLSConfig(c.config) - if cfg.ServerName == "" { - colonPos := strings.LastIndex(authority, ":") - if colonPos == -1 { - colonPos = len(authority) - } - cfg.ServerName = authority[:colonPos] - } - conn := tls.Client(rawConn, cfg) - errChannel := make(chan error, 1) - go func() { - errChannel <- conn.Handshake() - }() - select { - case err := <-errChannel: - if err != nil { - return nil, nil, err - } - case <-ctx.Done(): - return nil, nil, ctx.Err() - } - return conn, TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) ServerHandshake(rawConn net.Conn) (net.Conn, AuthInfo, error) { - conn := tls.Server(rawConn, c.config) - if err := conn.Handshake(); err != nil { - return nil, nil, err - } - return conn, TLSInfo{conn.ConnectionState()}, nil -} - -func (c *tlsCreds) Clone() TransportCredentials { - return NewTLS(c.config) -} - -func (c *tlsCreds) OverrideServerName(serverNameOverride string) error { - c.config.ServerName = serverNameOverride - return nil -} - -// NewTLS uses c to construct a TransportCredentials based on TLS. -func NewTLS(c *tls.Config) TransportCredentials { - tc := &tlsCreds{cloneTLSConfig(c)} - tc.config.NextProtos = alpnProtoStr - return tc -} - -// NewClientTLSFromCert constructs TLS credentials from the input certificate for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromCert(cp *x509.CertPool, serverNameOverride string) TransportCredentials { - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}) -} - -// NewClientTLSFromFile constructs TLS credentials from the input certificate file for client. -// serverNameOverride is for testing only. If set to a non empty string, -// it will override the virtual host name of authority (e.g. :authority header field) in requests. -func NewClientTLSFromFile(certFile, serverNameOverride string) (TransportCredentials, error) { - b, err := ioutil.ReadFile(certFile) - if err != nil { - return nil, err - } - cp := x509.NewCertPool() - if !cp.AppendCertsFromPEM(b) { - return nil, fmt.Errorf("credentials: failed to append certificates") - } - return NewTLS(&tls.Config{ServerName: serverNameOverride, RootCAs: cp}), nil -} - -// NewServerTLSFromCert constructs TLS credentials from the input certificate for server. -func NewServerTLSFromCert(cert *tls.Certificate) TransportCredentials { - return NewTLS(&tls.Config{Certificates: []tls.Certificate{*cert}}) -} - -// NewServerTLSFromFile constructs TLS credentials from the input certificate file and key -// file for server. -func NewServerTLSFromFile(certFile, keyFile string) (TransportCredentials, error) { - cert, err := tls.LoadX509KeyPair(certFile, keyFile) - if err != nil { - return nil, err - } - return NewTLS(&tls.Config{Certificates: []tls.Certificate{cert}}), nil -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_test.go b/vendor/google.golang.org/grpc/credentials/credentials_test.go deleted file mode 100644 index 9b13db5..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials_test.go +++ /dev/null @@ -1,206 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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 credentials - -import ( - "crypto/tls" - "net" - "testing" - - "golang.org/x/net/context" - "google.golang.org/grpc/testdata" -) - -func TestTLSOverrideServerName(t *testing.T) { - expectedServerName := "server.name" - c := NewTLS(nil) - c.OverrideServerName(expectedServerName) - if c.Info().ServerName != expectedServerName { - t.Fatalf("c.Info().ServerName = %v, want %v", c.Info().ServerName, expectedServerName) - } -} - -func TestTLSClone(t *testing.T) { - expectedServerName := "server.name" - c := NewTLS(nil) - c.OverrideServerName(expectedServerName) - cc := c.Clone() - if cc.Info().ServerName != expectedServerName { - t.Fatalf("cc.Info().ServerName = %v, want %v", cc.Info().ServerName, expectedServerName) - } - cc.OverrideServerName("") - if c.Info().ServerName != expectedServerName { - t.Fatalf("Change in clone should not affect the original, c.Info().ServerName = %v, want %v", c.Info().ServerName, expectedServerName) - } - -} - -type serverHandshake func(net.Conn) (AuthInfo, error) - -func TestClientHandshakeReturnsAuthInfo(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, tlsServerHandshake, done) - defer lis.Close() - lisAddr := lis.Addr().String() - clientAuthInfo := clientHandle(t, gRPCClientHandshake, lisAddr) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("c.ClientHandshake(_, %v, _) = %v, want %v.", lisAddr, clientAuthInfo, serverAuthInfo) - } -} - -func TestServerHandshakeReturnsAuthInfo(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, gRPCServerHandshake, done) - defer lis.Close() - clientAuthInfo := clientHandle(t, tlsClientHandshake, lis.Addr().String()) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("ServerHandshake(_) = %v, want %v.", serverAuthInfo, clientAuthInfo) - } -} - -func TestServerAndClientHandshake(t *testing.T) { - done := make(chan AuthInfo, 1) - lis := launchServer(t, gRPCServerHandshake, done) - defer lis.Close() - clientAuthInfo := clientHandle(t, gRPCClientHandshake, lis.Addr().String()) - // wait until server sends serverAuthInfo or fails. - serverAuthInfo, ok := <-done - if !ok { - t.Fatalf("Error at server-side") - } - if !compare(clientAuthInfo, serverAuthInfo) { - t.Fatalf("AuthInfo returned by server: %v and client: %v aren't same", serverAuthInfo, clientAuthInfo) - } -} - -func compare(a1, a2 AuthInfo) bool { - if a1.AuthType() != a2.AuthType() { - return false - } - switch a1.AuthType() { - case "tls": - state1 := a1.(TLSInfo).State - state2 := a2.(TLSInfo).State - if state1.Version == state2.Version && - state1.HandshakeComplete == state2.HandshakeComplete && - state1.CipherSuite == state2.CipherSuite && - state1.NegotiatedProtocol == state2.NegotiatedProtocol { - return true - } - return false - default: - return false - } -} - -func launchServer(t *testing.T, hs serverHandshake, done chan AuthInfo) net.Listener { - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen: %v", err) - } - go serverHandle(t, hs, done, lis) - return lis -} - -// Is run in a separate goroutine. -func serverHandle(t *testing.T, hs serverHandshake, done chan AuthInfo, lis net.Listener) { - serverRawConn, err := lis.Accept() - if err != nil { - t.Errorf("Server failed to accept connection: %v", err) - close(done) - return - } - serverAuthInfo, err := hs(serverRawConn) - if err != nil { - t.Errorf("Server failed while handshake. Error: %v", err) - serverRawConn.Close() - close(done) - return - } - done <- serverAuthInfo -} - -func clientHandle(t *testing.T, hs func(net.Conn, string) (AuthInfo, error), lisAddr string) AuthInfo { - conn, err := net.Dial("tcp", lisAddr) - if err != nil { - t.Fatalf("Client failed to connect to %s. Error: %v", lisAddr, err) - } - defer conn.Close() - clientAuthInfo, err := hs(conn, lisAddr) - if err != nil { - t.Fatalf("Error on client while handshake. Error: %v", err) - } - return clientAuthInfo -} - -// Server handshake implementation in gRPC. -func gRPCServerHandshake(conn net.Conn) (AuthInfo, error) { - serverTLS, err := NewServerTLSFromFile(testdata.Path("server1.pem"), testdata.Path("server1.key")) - if err != nil { - return nil, err - } - _, serverAuthInfo, err := serverTLS.ServerHandshake(conn) - if err != nil { - return nil, err - } - return serverAuthInfo, nil -} - -// Client handshake implementation in gRPC. -func gRPCClientHandshake(conn net.Conn, lisAddr string) (AuthInfo, error) { - clientTLS := NewTLS(&tls.Config{InsecureSkipVerify: true}) - _, authInfo, err := clientTLS.ClientHandshake(context.Background(), lisAddr, conn) - if err != nil { - return nil, err - } - return authInfo, nil -} - -func tlsServerHandshake(conn net.Conn) (AuthInfo, error) { - cert, err := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key")) - if err != nil { - return nil, err - } - serverTLSConfig := &tls.Config{Certificates: []tls.Certificate{cert}} - serverConn := tls.Server(conn, serverTLSConfig) - err = serverConn.Handshake() - if err != nil { - return nil, err - } - return TLSInfo{State: serverConn.ConnectionState()}, nil -} - -func tlsClientHandshake(conn net.Conn, _ string) (AuthInfo, error) { - clientTLSConfig := &tls.Config{InsecureSkipVerify: true} - clientConn := tls.Client(conn, clientTLSConfig) - if err := clientConn.Handshake(); err != nil { - return nil, err - } - return TLSInfo{State: clientConn.ConnectionState()}, nil -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go deleted file mode 100644 index 60409aa..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go17.go +++ /dev/null @@ -1,60 +0,0 @@ -// +build go1.7 -// +build !go1.8 - -/* - * - * Copyright 2016 gRPC authors. - * - * 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 credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - SessionTicketsDisabled: cfg.SessionTicketsDisabled, - SessionTicketKey: cfg.SessionTicketKey, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - DynamicRecordSizingDisabled: cfg.DynamicRecordSizingDisabled, - Renegotiation: cfg.Renegotiation, - } -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go b/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go deleted file mode 100644 index 93f0e1d..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_go18.go +++ /dev/null @@ -1,38 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - - return cfg.Clone() -} diff --git a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go b/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go deleted file mode 100644 index d6bbcc9..0000000 --- a/vendor/google.golang.org/grpc/credentials/credentials_util_pre_go17.go +++ /dev/null @@ -1,57 +0,0 @@ -// +build !go1.7 - -/* - * - * Copyright 2016 gRPC authors. - * - * 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 credentials - -import ( - "crypto/tls" -) - -// cloneTLSConfig returns a shallow clone of the exported -// fields of cfg, ignoring the unexported sync.Once, which -// contains a mutex and must not be copied. -// -// If cfg is nil, a new zero tls.Config is returned. -func cloneTLSConfig(cfg *tls.Config) *tls.Config { - if cfg == nil { - return &tls.Config{} - } - return &tls.Config{ - Rand: cfg.Rand, - Time: cfg.Time, - Certificates: cfg.Certificates, - NameToCertificate: cfg.NameToCertificate, - GetCertificate: cfg.GetCertificate, - RootCAs: cfg.RootCAs, - NextProtos: cfg.NextProtos, - ServerName: cfg.ServerName, - ClientAuth: cfg.ClientAuth, - ClientCAs: cfg.ClientCAs, - InsecureSkipVerify: cfg.InsecureSkipVerify, - CipherSuites: cfg.CipherSuites, - PreferServerCipherSuites: cfg.PreferServerCipherSuites, - SessionTicketsDisabled: cfg.SessionTicketsDisabled, - SessionTicketKey: cfg.SessionTicketKey, - ClientSessionCache: cfg.ClientSessionCache, - MinVersion: cfg.MinVersion, - MaxVersion: cfg.MaxVersion, - CurvePreferences: cfg.CurvePreferences, - } -} diff --git a/vendor/google.golang.org/grpc/encoding/encoding.go b/vendor/google.golang.org/grpc/encoding/encoding.go deleted file mode 100644 index 47d10b0..0000000 --- a/vendor/google.golang.org/grpc/encoding/encoding.go +++ /dev/null @@ -1,61 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 encoding defines the interface for the compressor and the functions -// to register and get the compossor. -// This package is EXPERIMENTAL. -package encoding - -import ( - "io" -) - -var registerCompressor = make(map[string]Compressor) - -// Compressor is used for compressing and decompressing when sending or receiving messages. -type Compressor interface { - // Compress writes the data written to wc to w after compressing it. If an error - // occurs while initializing the compressor, that error is returned instead. - Compress(w io.Writer) (io.WriteCloser, error) - // Decompress reads data from r, decompresses it, and provides the uncompressed data - // via the returned io.Reader. If an error occurs while initializing the decompressor, that error - // is returned instead. - Decompress(r io.Reader) (io.Reader, error) - // Name is the name of the compression codec and is used to set the content coding header. - Name() string -} - -// RegisterCompressor registers the compressor with gRPC by its name. It can be activated when -// sending an RPC via grpc.UseCompressor(). It will be automatically accessed when receiving a -// message based on the content coding header. Servers also use it to send a response with the -// same encoding as the request. -// -// NOTE: this function must only be called during initialization time (i.e. in an init() function). If -// multiple Compressors are registered with the same name, the one registered last will take effect. -func RegisterCompressor(c Compressor) { - registerCompressor[c.Name()] = c -} - -// GetCompressor returns Compressor for the given compressor name. -func GetCompressor(name string) Compressor { - return registerCompressor[name] -} - -// Identity specifies the optional encoding for uncompressed streams. -// It is intended for grpc internal use only. -const Identity = "identity" diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go deleted file mode 100644 index f4a2712..0000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.pb.go +++ /dev/null @@ -1,615 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_lb_v1/messages/messages.proto - -/* -Package messages is a generated protocol buffer package. - -It is generated from these files: - grpc_lb_v1/messages/messages.proto - -It has these top-level messages: - Duration - Timestamp - LoadBalanceRequest - InitialLoadBalanceRequest - ClientStats - LoadBalanceResponse - InitialLoadBalanceResponse - ServerList - Server -*/ -package messages - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type Duration struct { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Duration) Reset() { *m = Duration{} } -func (m *Duration) String() string { return proto.CompactTextString(m) } -func (*Duration) ProtoMessage() {} -func (*Duration) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *Duration) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Duration) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type Timestamp struct { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - Seconds int64 `protobuf:"varint,1,opt,name=seconds" json:"seconds,omitempty"` - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - Nanos int32 `protobuf:"varint,2,opt,name=nanos" json:"nanos,omitempty"` -} - -func (m *Timestamp) Reset() { *m = Timestamp{} } -func (m *Timestamp) String() string { return proto.CompactTextString(m) } -func (*Timestamp) ProtoMessage() {} -func (*Timestamp) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *Timestamp) GetSeconds() int64 { - if m != nil { - return m.Seconds - } - return 0 -} - -func (m *Timestamp) GetNanos() int32 { - if m != nil { - return m.Nanos - } - return 0 -} - -type LoadBalanceRequest struct { - // Types that are valid to be assigned to LoadBalanceRequestType: - // *LoadBalanceRequest_InitialRequest - // *LoadBalanceRequest_ClientStats - LoadBalanceRequestType isLoadBalanceRequest_LoadBalanceRequestType `protobuf_oneof:"load_balance_request_type"` -} - -func (m *LoadBalanceRequest) Reset() { *m = LoadBalanceRequest{} } -func (m *LoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceRequest) ProtoMessage() {} -func (*LoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } - -type isLoadBalanceRequest_LoadBalanceRequestType interface { - isLoadBalanceRequest_LoadBalanceRequestType() -} - -type LoadBalanceRequest_InitialRequest struct { - InitialRequest *InitialLoadBalanceRequest `protobuf:"bytes,1,opt,name=initial_request,json=initialRequest,oneof"` -} -type LoadBalanceRequest_ClientStats struct { - ClientStats *ClientStats `protobuf:"bytes,2,opt,name=client_stats,json=clientStats,oneof"` -} - -func (*LoadBalanceRequest_InitialRequest) isLoadBalanceRequest_LoadBalanceRequestType() {} -func (*LoadBalanceRequest_ClientStats) isLoadBalanceRequest_LoadBalanceRequestType() {} - -func (m *LoadBalanceRequest) GetLoadBalanceRequestType() isLoadBalanceRequest_LoadBalanceRequestType { - if m != nil { - return m.LoadBalanceRequestType - } - return nil -} - -func (m *LoadBalanceRequest) GetInitialRequest() *InitialLoadBalanceRequest { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_InitialRequest); ok { - return x.InitialRequest - } - return nil -} - -func (m *LoadBalanceRequest) GetClientStats() *ClientStats { - if x, ok := m.GetLoadBalanceRequestType().(*LoadBalanceRequest_ClientStats); ok { - return x.ClientStats - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceRequest) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceRequest_OneofMarshaler, _LoadBalanceRequest_OneofUnmarshaler, _LoadBalanceRequest_OneofSizer, []interface{}{ - (*LoadBalanceRequest_InitialRequest)(nil), - (*LoadBalanceRequest_ClientStats)(nil), - } -} - -func _LoadBalanceRequest_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialRequest); err != nil { - return err - } - case *LoadBalanceRequest_ClientStats: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ClientStats); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceRequest.LoadBalanceRequestType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceRequest_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceRequest) - switch tag { - case 1: // load_balance_request_type.initial_request - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceRequest) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_InitialRequest{msg} - return true, err - case 2: // load_balance_request_type.client_stats - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ClientStats) - err := b.DecodeMessage(msg) - m.LoadBalanceRequestType = &LoadBalanceRequest_ClientStats{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceRequest_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceRequest) - // load_balance_request_type - switch x := m.LoadBalanceRequestType.(type) { - case *LoadBalanceRequest_InitialRequest: - s := proto.Size(x.InitialRequest) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceRequest_ClientStats: - s := proto.Size(x.ClientStats) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceRequest struct { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` -} - -func (m *InitialLoadBalanceRequest) Reset() { *m = InitialLoadBalanceRequest{} } -func (m *InitialLoadBalanceRequest) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceRequest) ProtoMessage() {} -func (*InitialLoadBalanceRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } - -func (m *InitialLoadBalanceRequest) GetName() string { - if m != nil { - return m.Name - } - return "" -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -type ClientStats struct { - // The timestamp of generating the report. - Timestamp *Timestamp `protobuf:"bytes,1,opt,name=timestamp" json:"timestamp,omitempty"` - // The total number of RPCs that started. - NumCallsStarted int64 `protobuf:"varint,2,opt,name=num_calls_started,json=numCallsStarted" json:"num_calls_started,omitempty"` - // The total number of RPCs that finished. - NumCallsFinished int64 `protobuf:"varint,3,opt,name=num_calls_finished,json=numCallsFinished" json:"num_calls_finished,omitempty"` - // The total number of RPCs that were dropped by the client because of rate - // limiting. - NumCallsFinishedWithDropForRateLimiting int64 `protobuf:"varint,4,opt,name=num_calls_finished_with_drop_for_rate_limiting,json=numCallsFinishedWithDropForRateLimiting" json:"num_calls_finished_with_drop_for_rate_limiting,omitempty"` - // The total number of RPCs that were dropped by the client because of load - // balancing. - NumCallsFinishedWithDropForLoadBalancing int64 `protobuf:"varint,5,opt,name=num_calls_finished_with_drop_for_load_balancing,json=numCallsFinishedWithDropForLoadBalancing" json:"num_calls_finished_with_drop_for_load_balancing,omitempty"` - // The total number of RPCs that failed to reach a server except dropped RPCs. - NumCallsFinishedWithClientFailedToSend int64 `protobuf:"varint,6,opt,name=num_calls_finished_with_client_failed_to_send,json=numCallsFinishedWithClientFailedToSend" json:"num_calls_finished_with_client_failed_to_send,omitempty"` - // The total number of RPCs that finished and are known to have been received - // by a server. - NumCallsFinishedKnownReceived int64 `protobuf:"varint,7,opt,name=num_calls_finished_known_received,json=numCallsFinishedKnownReceived" json:"num_calls_finished_known_received,omitempty"` -} - -func (m *ClientStats) Reset() { *m = ClientStats{} } -func (m *ClientStats) String() string { return proto.CompactTextString(m) } -func (*ClientStats) ProtoMessage() {} -func (*ClientStats) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } - -func (m *ClientStats) GetTimestamp() *Timestamp { - if m != nil { - return m.Timestamp - } - return nil -} - -func (m *ClientStats) GetNumCallsStarted() int64 { - if m != nil { - return m.NumCallsStarted - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinished() int64 { - if m != nil { - return m.NumCallsFinished - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForRateLimiting() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForRateLimiting - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithDropForLoadBalancing() int64 { - if m != nil { - return m.NumCallsFinishedWithDropForLoadBalancing - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedWithClientFailedToSend() int64 { - if m != nil { - return m.NumCallsFinishedWithClientFailedToSend - } - return 0 -} - -func (m *ClientStats) GetNumCallsFinishedKnownReceived() int64 { - if m != nil { - return m.NumCallsFinishedKnownReceived - } - return 0 -} - -type LoadBalanceResponse struct { - // Types that are valid to be assigned to LoadBalanceResponseType: - // *LoadBalanceResponse_InitialResponse - // *LoadBalanceResponse_ServerList - LoadBalanceResponseType isLoadBalanceResponse_LoadBalanceResponseType `protobuf_oneof:"load_balance_response_type"` -} - -func (m *LoadBalanceResponse) Reset() { *m = LoadBalanceResponse{} } -func (m *LoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*LoadBalanceResponse) ProtoMessage() {} -func (*LoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } - -type isLoadBalanceResponse_LoadBalanceResponseType interface { - isLoadBalanceResponse_LoadBalanceResponseType() -} - -type LoadBalanceResponse_InitialResponse struct { - InitialResponse *InitialLoadBalanceResponse `protobuf:"bytes,1,opt,name=initial_response,json=initialResponse,oneof"` -} -type LoadBalanceResponse_ServerList struct { - ServerList *ServerList `protobuf:"bytes,2,opt,name=server_list,json=serverList,oneof"` -} - -func (*LoadBalanceResponse_InitialResponse) isLoadBalanceResponse_LoadBalanceResponseType() {} -func (*LoadBalanceResponse_ServerList) isLoadBalanceResponse_LoadBalanceResponseType() {} - -func (m *LoadBalanceResponse) GetLoadBalanceResponseType() isLoadBalanceResponse_LoadBalanceResponseType { - if m != nil { - return m.LoadBalanceResponseType - } - return nil -} - -func (m *LoadBalanceResponse) GetInitialResponse() *InitialLoadBalanceResponse { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_InitialResponse); ok { - return x.InitialResponse - } - return nil -} - -func (m *LoadBalanceResponse) GetServerList() *ServerList { - if x, ok := m.GetLoadBalanceResponseType().(*LoadBalanceResponse_ServerList); ok { - return x.ServerList - } - return nil -} - -// XXX_OneofFuncs is for the internal use of the proto package. -func (*LoadBalanceResponse) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { - return _LoadBalanceResponse_OneofMarshaler, _LoadBalanceResponse_OneofUnmarshaler, _LoadBalanceResponse_OneofSizer, []interface{}{ - (*LoadBalanceResponse_InitialResponse)(nil), - (*LoadBalanceResponse_ServerList)(nil), - } -} - -func _LoadBalanceResponse_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - b.EncodeVarint(1<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.InitialResponse); err != nil { - return err - } - case *LoadBalanceResponse_ServerList: - b.EncodeVarint(2<<3 | proto.WireBytes) - if err := b.EncodeMessage(x.ServerList); err != nil { - return err - } - case nil: - default: - return fmt.Errorf("LoadBalanceResponse.LoadBalanceResponseType has unexpected type %T", x) - } - return nil -} - -func _LoadBalanceResponse_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { - m := msg.(*LoadBalanceResponse) - switch tag { - case 1: // load_balance_response_type.initial_response - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(InitialLoadBalanceResponse) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_InitialResponse{msg} - return true, err - case 2: // load_balance_response_type.server_list - if wire != proto.WireBytes { - return true, proto.ErrInternalBadWireType - } - msg := new(ServerList) - err := b.DecodeMessage(msg) - m.LoadBalanceResponseType = &LoadBalanceResponse_ServerList{msg} - return true, err - default: - return false, nil - } -} - -func _LoadBalanceResponse_OneofSizer(msg proto.Message) (n int) { - m := msg.(*LoadBalanceResponse) - // load_balance_response_type - switch x := m.LoadBalanceResponseType.(type) { - case *LoadBalanceResponse_InitialResponse: - s := proto.Size(x.InitialResponse) - n += proto.SizeVarint(1<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case *LoadBalanceResponse_ServerList: - s := proto.Size(x.ServerList) - n += proto.SizeVarint(2<<3 | proto.WireBytes) - n += proto.SizeVarint(uint64(s)) - n += s - case nil: - default: - panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) - } - return n -} - -type InitialLoadBalanceResponse struct { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - LoadBalancerDelegate string `protobuf:"bytes,1,opt,name=load_balancer_delegate,json=loadBalancerDelegate" json:"load_balancer_delegate,omitempty"` - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - ClientStatsReportInterval *Duration `protobuf:"bytes,2,opt,name=client_stats_report_interval,json=clientStatsReportInterval" json:"client_stats_report_interval,omitempty"` -} - -func (m *InitialLoadBalanceResponse) Reset() { *m = InitialLoadBalanceResponse{} } -func (m *InitialLoadBalanceResponse) String() string { return proto.CompactTextString(m) } -func (*InitialLoadBalanceResponse) ProtoMessage() {} -func (*InitialLoadBalanceResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } - -func (m *InitialLoadBalanceResponse) GetLoadBalancerDelegate() string { - if m != nil { - return m.LoadBalancerDelegate - } - return "" -} - -func (m *InitialLoadBalanceResponse) GetClientStatsReportInterval() *Duration { - if m != nil { - return m.ClientStatsReportInterval - } - return nil -} - -type ServerList struct { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - Servers []*Server `protobuf:"bytes,1,rep,name=servers" json:"servers,omitempty"` -} - -func (m *ServerList) Reset() { *m = ServerList{} } -func (m *ServerList) String() string { return proto.CompactTextString(m) } -func (*ServerList) ProtoMessage() {} -func (*ServerList) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } - -func (m *ServerList) GetServers() []*Server { - if m != nil { - return m.Servers - } - return nil -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -type Server struct { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - IpAddress []byte `protobuf:"bytes,1,opt,name=ip_address,json=ipAddress,proto3" json:"ip_address,omitempty"` - // A resolved port number for the server. - Port int32 `protobuf:"varint,2,opt,name=port" json:"port,omitempty"` - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - LoadBalanceToken string `protobuf:"bytes,3,opt,name=load_balance_token,json=loadBalanceToken" json:"load_balance_token,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - DropForRateLimiting bool `protobuf:"varint,4,opt,name=drop_for_rate_limiting,json=dropForRateLimiting" json:"drop_for_rate_limiting,omitempty"` - // Indicates whether this particular request should be dropped by the client - // for load balancing. - DropForLoadBalancing bool `protobuf:"varint,5,opt,name=drop_for_load_balancing,json=dropForLoadBalancing" json:"drop_for_load_balancing,omitempty"` -} - -func (m *Server) Reset() { *m = Server{} } -func (m *Server) String() string { return proto.CompactTextString(m) } -func (*Server) ProtoMessage() {} -func (*Server) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } - -func (m *Server) GetIpAddress() []byte { - if m != nil { - return m.IpAddress - } - return nil -} - -func (m *Server) GetPort() int32 { - if m != nil { - return m.Port - } - return 0 -} - -func (m *Server) GetLoadBalanceToken() string { - if m != nil { - return m.LoadBalanceToken - } - return "" -} - -func (m *Server) GetDropForRateLimiting() bool { - if m != nil { - return m.DropForRateLimiting - } - return false -} - -func (m *Server) GetDropForLoadBalancing() bool { - if m != nil { - return m.DropForLoadBalancing - } - return false -} - -func init() { - proto.RegisterType((*Duration)(nil), "grpc.lb.v1.Duration") - proto.RegisterType((*Timestamp)(nil), "grpc.lb.v1.Timestamp") - proto.RegisterType((*LoadBalanceRequest)(nil), "grpc.lb.v1.LoadBalanceRequest") - proto.RegisterType((*InitialLoadBalanceRequest)(nil), "grpc.lb.v1.InitialLoadBalanceRequest") - proto.RegisterType((*ClientStats)(nil), "grpc.lb.v1.ClientStats") - proto.RegisterType((*LoadBalanceResponse)(nil), "grpc.lb.v1.LoadBalanceResponse") - proto.RegisterType((*InitialLoadBalanceResponse)(nil), "grpc.lb.v1.InitialLoadBalanceResponse") - proto.RegisterType((*ServerList)(nil), "grpc.lb.v1.ServerList") - proto.RegisterType((*Server)(nil), "grpc.lb.v1.Server") -} - -func init() { proto.RegisterFile("grpc_lb_v1/messages/messages.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 709 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdd, 0x4e, 0x1b, 0x3b, - 0x10, 0x26, 0x27, 0x01, 0x92, 0x09, 0x3a, 0xe4, 0x98, 0x1c, 0x08, 0x14, 0x24, 0xba, 0x52, 0x69, - 0x54, 0xd1, 0x20, 0xa0, 0xbd, 0xe8, 0xcf, 0x45, 0x1b, 0x10, 0x0a, 0x2d, 0x17, 0x95, 0x43, 0x55, - 0xa9, 0x52, 0x65, 0x39, 0xd9, 0x21, 0x58, 0x6c, 0xec, 0xad, 0xed, 0x04, 0xf5, 0x11, 0xfa, 0x28, - 0x7d, 0x8c, 0xaa, 0xcf, 0xd0, 0xf7, 0xa9, 0xd6, 0xbb, 0x9b, 0x5d, 0x20, 0x80, 0x7a, 0x67, 0x8f, - 0xbf, 0xf9, 0xbe, 0xf1, 0xac, 0xbf, 0x59, 0xf0, 0x06, 0x3a, 0xec, 0xb3, 0xa0, 0xc7, 0xc6, 0xbb, - 0x3b, 0x43, 0x34, 0x86, 0x0f, 0xd0, 0x4c, 0x16, 0xad, 0x50, 0x2b, 0xab, 0x08, 0x44, 0x98, 0x56, - 0xd0, 0x6b, 0x8d, 0x77, 0xbd, 0x97, 0x50, 0x3e, 0x1c, 0x69, 0x6e, 0x85, 0x92, 0xa4, 0x01, 0xf3, - 0x06, 0xfb, 0x4a, 0xfa, 0xa6, 0x51, 0xd8, 0x2c, 0x34, 0x8b, 0x34, 0xdd, 0x92, 0x3a, 0xcc, 0x4a, - 0x2e, 0x95, 0x69, 0xfc, 0xb3, 0x59, 0x68, 0xce, 0xd2, 0x78, 0xe3, 0xbd, 0x82, 0xca, 0xa9, 0x18, - 0xa2, 0xb1, 0x7c, 0x18, 0xfe, 0x75, 0xf2, 0xcf, 0x02, 0x90, 0x13, 0xc5, 0xfd, 0x36, 0x0f, 0xb8, - 0xec, 0x23, 0xc5, 0xaf, 0x23, 0x34, 0x96, 0x7c, 0x80, 0x45, 0x21, 0x85, 0x15, 0x3c, 0x60, 0x3a, - 0x0e, 0x39, 0xba, 0xea, 0xde, 0xa3, 0x56, 0x56, 0x75, 0xeb, 0x38, 0x86, 0xdc, 0xcc, 0xef, 0xcc, - 0xd0, 0x7f, 0x93, 0xfc, 0x94, 0xf1, 0x35, 0x2c, 0xf4, 0x03, 0x81, 0xd2, 0x32, 0x63, 0xb9, 0x8d, - 0xab, 0xa8, 0xee, 0xad, 0xe4, 0xe9, 0x0e, 0xdc, 0x79, 0x37, 0x3a, 0xee, 0xcc, 0xd0, 0x6a, 0x3f, - 0xdb, 0xb6, 0x1f, 0xc0, 0x6a, 0xa0, 0xb8, 0xcf, 0x7a, 0xb1, 0x4c, 0x5a, 0x14, 0xb3, 0xdf, 0x42, - 0xf4, 0x76, 0x60, 0xf5, 0xd6, 0x4a, 0x08, 0x81, 0x92, 0xe4, 0x43, 0x74, 0xe5, 0x57, 0xa8, 0x5b, - 0x7b, 0xdf, 0x4b, 0x50, 0xcd, 0x89, 0x91, 0x7d, 0xa8, 0xd8, 0xb4, 0x83, 0xc9, 0x3d, 0xff, 0xcf, - 0x17, 0x36, 0x69, 0x2f, 0xcd, 0x70, 0xe4, 0x09, 0xfc, 0x27, 0x47, 0x43, 0xd6, 0xe7, 0x41, 0x60, - 0xa2, 0x3b, 0x69, 0x8b, 0xbe, 0xbb, 0x55, 0x91, 0x2e, 0xca, 0xd1, 0xf0, 0x20, 0x8a, 0x77, 0xe3, - 0x30, 0xd9, 0x06, 0x92, 0x61, 0xcf, 0x84, 0x14, 0xe6, 0x1c, 0xfd, 0x46, 0xd1, 0x81, 0x6b, 0x29, - 0xf8, 0x28, 0x89, 0x13, 0x06, 0xad, 0x9b, 0x68, 0x76, 0x29, 0xec, 0x39, 0xf3, 0xb5, 0x0a, 0xd9, - 0x99, 0xd2, 0x4c, 0x73, 0x8b, 0x2c, 0x10, 0x43, 0x61, 0x85, 0x1c, 0x34, 0x4a, 0x8e, 0xe9, 0xf1, - 0x75, 0xa6, 0x4f, 0xc2, 0x9e, 0x1f, 0x6a, 0x15, 0x1e, 0x29, 0x4d, 0xb9, 0xc5, 0x93, 0x04, 0x4e, - 0x38, 0xec, 0xdc, 0x2b, 0x90, 0x6b, 0x77, 0xa4, 0x30, 0xeb, 0x14, 0x9a, 0x77, 0x28, 0x64, 0xbd, - 0x8f, 0x24, 0xbe, 0xc0, 0xd3, 0xdb, 0x24, 0x92, 0x67, 0x70, 0xc6, 0x45, 0x80, 0x3e, 0xb3, 0x8a, - 0x19, 0x94, 0x7e, 0x63, 0xce, 0x09, 0x6c, 0x4d, 0x13, 0x88, 0x3f, 0xd5, 0x91, 0xc3, 0x9f, 0xaa, - 0x2e, 0x4a, 0x9f, 0x74, 0xe0, 0xe1, 0x14, 0xfa, 0x0b, 0xa9, 0x2e, 0x25, 0xd3, 0xd8, 0x47, 0x31, - 0x46, 0xbf, 0x31, 0xef, 0x28, 0x37, 0xae, 0x53, 0xbe, 0x8f, 0x50, 0x34, 0x01, 0x79, 0xbf, 0x0a, - 0xb0, 0x74, 0xe5, 0xd9, 0x98, 0x50, 0x49, 0x83, 0xa4, 0x0b, 0xb5, 0xcc, 0x01, 0x71, 0x2c, 0x79, - 0x1a, 0x5b, 0xf7, 0x59, 0x20, 0x46, 0x77, 0x66, 0xe8, 0xe2, 0xc4, 0x03, 0x09, 0xe9, 0x0b, 0xa8, - 0x1a, 0xd4, 0x63, 0xd4, 0x2c, 0x10, 0xc6, 0x26, 0x1e, 0x58, 0xce, 0xf3, 0x75, 0xdd, 0xf1, 0x89, - 0x70, 0x1e, 0x02, 0x33, 0xd9, 0xb5, 0xd7, 0x61, 0xed, 0x9a, 0x03, 0x62, 0xce, 0xd8, 0x02, 0x3f, - 0x0a, 0xb0, 0x76, 0x7b, 0x29, 0xe4, 0x19, 0x2c, 0xe7, 0x93, 0x35, 0xf3, 0x31, 0xc0, 0x01, 0xb7, - 0xa9, 0x2d, 0xea, 0x41, 0x96, 0xa4, 0x0f, 0x93, 0x33, 0xf2, 0x11, 0xd6, 0xf3, 0x96, 0x65, 0x1a, - 0x43, 0xa5, 0x2d, 0x13, 0xd2, 0xa2, 0x1e, 0xf3, 0x20, 0x29, 0xbf, 0x9e, 0x2f, 0x3f, 0x1d, 0x62, - 0x74, 0x35, 0xe7, 0x5e, 0xea, 0xf2, 0x8e, 0x93, 0x34, 0xef, 0x0d, 0x40, 0x76, 0x4b, 0xb2, 0x1d, - 0x0d, 0xac, 0x68, 0x17, 0x0d, 0xac, 0x62, 0xb3, 0xba, 0x47, 0x6e, 0xb6, 0x83, 0xa6, 0x90, 0x77, - 0xa5, 0x72, 0xb1, 0x56, 0xf2, 0x7e, 0x17, 0x60, 0x2e, 0x3e, 0x21, 0x1b, 0x00, 0x22, 0x64, 0xdc, - 0xf7, 0x35, 0x9a, 0x78, 0xe4, 0x2d, 0xd0, 0x8a, 0x08, 0xdf, 0xc6, 0x81, 0xc8, 0xfd, 0x91, 0x76, - 0x32, 0xf3, 0xdc, 0x3a, 0x32, 0xe3, 0x95, 0x4e, 0x5a, 0x75, 0x81, 0xd2, 0x99, 0xb1, 0x42, 0x6b, - 0xb9, 0x46, 0x9c, 0x46, 0x71, 0xb2, 0x0f, 0xcb, 0x77, 0x98, 0xae, 0x4c, 0x97, 0xfc, 0x29, 0x06, - 0x7b, 0x0e, 0x2b, 0x77, 0x19, 0xa9, 0x4c, 0xeb, 0xfe, 0x14, 0xd3, 0xb4, 0xe1, 0x73, 0x39, 0xfd, - 0x47, 0xf4, 0xe6, 0xdc, 0x4f, 0x62, 0xff, 0x4f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xa3, 0x36, 0x86, - 0xa6, 0x4a, 0x06, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto b/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto deleted file mode 100644 index 42d99c1..0000000 --- a/vendor/google.golang.org/grpc/grpclb/grpc_lb_v1/messages/messages.proto +++ /dev/null @@ -1,155 +0,0 @@ -// Copyright 2016 gRPC authors. -// -// 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. - -syntax = "proto3"; - -package grpc.lb.v1; -option go_package = "google.golang.org/grpc/grpclb/grpc_lb_v1/messages"; - -message Duration { - // Signed seconds of the span of time. Must be from -315,576,000,000 - // to +315,576,000,000 inclusive. - int64 seconds = 1; - - // Signed fractions of a second at nanosecond resolution of the span - // of time. Durations less than one second are represented with a 0 - // `seconds` field and a positive or negative `nanos` field. For durations - // of one second or more, a non-zero value for the `nanos` field must be - // of the same sign as the `seconds` field. Must be from -999,999,999 - // to +999,999,999 inclusive. - int32 nanos = 2; -} - -message Timestamp { - // Represents seconds of UTC time since Unix epoch - // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to - // 9999-12-31T23:59:59Z inclusive. - int64 seconds = 1; - - // Non-negative fractions of a second at nanosecond resolution. Negative - // second values with fractions must still have non-negative nanos values - // that count forward in time. Must be from 0 to 999,999,999 - // inclusive. - int32 nanos = 2; -} - -message LoadBalanceRequest { - oneof load_balance_request_type { - // This message should be sent on the first request to the load balancer. - InitialLoadBalanceRequest initial_request = 1; - - // The client stats should be periodically reported to the load balancer - // based on the duration defined in the InitialLoadBalanceResponse. - ClientStats client_stats = 2; - } -} - -message InitialLoadBalanceRequest { - // Name of load balanced service (IE, balancer.service.com) - // length should be less than 256 bytes. - string name = 1; -} - -// Contains client level statistics that are useful to load balancing. Each -// count except the timestamp should be reset to zero after reporting the stats. -message ClientStats { - // The timestamp of generating the report. - Timestamp timestamp = 1; - - // The total number of RPCs that started. - int64 num_calls_started = 2; - - // The total number of RPCs that finished. - int64 num_calls_finished = 3; - - // The total number of RPCs that were dropped by the client because of rate - // limiting. - int64 num_calls_finished_with_drop_for_rate_limiting = 4; - - // The total number of RPCs that were dropped by the client because of load - // balancing. - int64 num_calls_finished_with_drop_for_load_balancing = 5; - - // The total number of RPCs that failed to reach a server except dropped RPCs. - int64 num_calls_finished_with_client_failed_to_send = 6; - - // The total number of RPCs that finished and are known to have been received - // by a server. - int64 num_calls_finished_known_received = 7; -} - -message LoadBalanceResponse { - oneof load_balance_response_type { - // This message should be sent on the first response to the client. - InitialLoadBalanceResponse initial_response = 1; - - // Contains the list of servers selected by the load balancer. The client - // should send requests to these servers in the specified order. - ServerList server_list = 2; - } -} - -message InitialLoadBalanceResponse { - // This is an application layer redirect that indicates the client should use - // the specified server for load balancing. When this field is non-empty in - // the response, the client should open a separate connection to the - // load_balancer_delegate and call the BalanceLoad method. Its length should - // be less than 64 bytes. - string load_balancer_delegate = 1; - - // This interval defines how often the client should send the client stats - // to the load balancer. Stats should only be reported when the duration is - // positive. - Duration client_stats_report_interval = 2; -} - -message ServerList { - // Contains a list of servers selected by the load balancer. The list will - // be updated when server resolutions change or as needed to balance load - // across more servers. The client should consume the server list in order - // unless instructed otherwise via the client_config. - repeated Server servers = 1; - - // Was google.protobuf.Duration expiration_interval. - reserved 3; -} - -// Contains server information. When none of the [drop_for_*] fields are true, -// use the other fields. When drop_for_rate_limiting is true, ignore all other -// fields. Use drop_for_load_balancing only when it is true and -// drop_for_rate_limiting is false. -message Server { - // A resolved address for the server, serialized in network-byte-order. It may - // either be an IPv4 or IPv6 address. - bytes ip_address = 1; - - // A resolved port number for the server. - int32 port = 2; - - // An opaque but printable token given to the frontend for each pick. All - // frontend requests for that pick must include the token in its initial - // metadata. The token is used by the backend to verify the request and to - // allow the backend to report load to the gRPC LB system. - // - // Its length is variable but less than 50 bytes. - string load_balance_token = 3; - - // Indicates whether this particular request should be dropped by the client - // for rate limiting. - bool drop_for_rate_limiting = 4; - - // Indicates whether this particular request should be dropped by the client - // for load balancing. - bool drop_for_load_balancing = 5; -} diff --git a/vendor/google.golang.org/grpc/grpclb/grpclb_test.go b/vendor/google.golang.org/grpc/grpclb/grpclb_test.go deleted file mode 100644 index d83ea6b..0000000 --- a/vendor/google.golang.org/grpc/grpclb/grpclb_test.go +++ /dev/null @@ -1,975 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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. - * - */ - -//go:generate protoc --go_out=plugins=:$GOPATH grpc_lb_v1/messages/messages.proto -//go:generate protoc --go_out=plugins=grpc:$GOPATH grpc_lb_v1/service/service.proto - -// Package grpclb_test is currently used only for grpclb testing. -package grpclb_test - -import ( - "errors" - "fmt" - "io" - "net" - "strconv" - "strings" - "sync" - "testing" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/balancer" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - lbmpb "google.golang.org/grpc/grpclb/grpc_lb_v1/messages" - lbspb "google.golang.org/grpc/grpclb/grpc_lb_v1/service" - _ "google.golang.org/grpc/grpclog/glogger" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/resolver/manual" - "google.golang.org/grpc/status" - testpb "google.golang.org/grpc/test/grpc_testing" - "google.golang.org/grpc/test/leakcheck" - - _ "google.golang.org/grpc/grpclog/glogger" -) - -var ( - lbServerName = "bar.com" - beServerName = "foo.com" - lbToken = "iamatoken" - - // Resolver replaces localhost with fakeName in Next(). - // Dialer replaces fakeName with localhost when dialing. - // This will test that custom dialer is passed from Dial to grpclb. - fakeName = "fake.Name" -) - -type serverNameCheckCreds struct { - mu sync.Mutex - sn string - expected string -} - -func (c *serverNameCheckCreds) ServerHandshake(rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { - if _, err := io.WriteString(rawConn, c.sn); err != nil { - fmt.Printf("Failed to write the server name %s to the client %v", c.sn, err) - return nil, nil, err - } - return rawConn, nil, nil -} -func (c *serverNameCheckCreds) ClientHandshake(ctx context.Context, addr string, rawConn net.Conn) (net.Conn, credentials.AuthInfo, error) { - c.mu.Lock() - defer c.mu.Unlock() - b := make([]byte, len(c.expected)) - errCh := make(chan error, 1) - go func() { - _, err := rawConn.Read(b) - errCh <- err - }() - select { - case err := <-errCh: - if err != nil { - fmt.Printf("Failed to read the server name from the server %v", err) - return nil, nil, err - } - case <-ctx.Done(): - return nil, nil, ctx.Err() - } - if c.expected != string(b) { - fmt.Printf("Read the server name %s want %s", string(b), c.expected) - return nil, nil, errors.New("received unexpected server name") - } - return rawConn, nil, nil -} -func (c *serverNameCheckCreds) Info() credentials.ProtocolInfo { - c.mu.Lock() - defer c.mu.Unlock() - return credentials.ProtocolInfo{} -} -func (c *serverNameCheckCreds) Clone() credentials.TransportCredentials { - c.mu.Lock() - defer c.mu.Unlock() - return &serverNameCheckCreds{ - expected: c.expected, - } -} -func (c *serverNameCheckCreds) OverrideServerName(s string) error { - c.mu.Lock() - defer c.mu.Unlock() - c.expected = s - return nil -} - -// fakeNameDialer replaces fakeName with localhost when dialing. -// This will test that custom dialer is passed from Dial to grpclb. -func fakeNameDialer(addr string, timeout time.Duration) (net.Conn, error) { - addr = strings.Replace(addr, fakeName, "localhost", 1) - return net.DialTimeout("tcp", addr, timeout) -} - -type remoteBalancer struct { - sls chan *lbmpb.ServerList - statsDura time.Duration - done chan struct{} - mu sync.Mutex - stats lbmpb.ClientStats -} - -func newRemoteBalancer(intervals []time.Duration) *remoteBalancer { - return &remoteBalancer{ - sls: make(chan *lbmpb.ServerList, 1), - done: make(chan struct{}), - } -} - -func (b *remoteBalancer) stop() { - close(b.sls) - close(b.done) -} - -func (b *remoteBalancer) BalanceLoad(stream lbspb.LoadBalancer_BalanceLoadServer) error { - req, err := stream.Recv() - if err != nil { - return err - } - initReq := req.GetInitialRequest() - if initReq.Name != beServerName { - return status.Errorf(codes.InvalidArgument, "invalid service name: %v", initReq.Name) - } - resp := &lbmpb.LoadBalanceResponse{ - LoadBalanceResponseType: &lbmpb.LoadBalanceResponse_InitialResponse{ - InitialResponse: &lbmpb.InitialLoadBalanceResponse{ - ClientStatsReportInterval: &lbmpb.Duration{ - Seconds: int64(b.statsDura.Seconds()), - Nanos: int32(b.statsDura.Nanoseconds() - int64(b.statsDura.Seconds())*1e9), - }, - }, - }, - } - if err := stream.Send(resp); err != nil { - return err - } - go func() { - for { - var ( - req *lbmpb.LoadBalanceRequest - err error - ) - if req, err = stream.Recv(); err != nil { - return - } - b.mu.Lock() - b.stats.NumCallsStarted += req.GetClientStats().NumCallsStarted - b.stats.NumCallsFinished += req.GetClientStats().NumCallsFinished - b.stats.NumCallsFinishedWithDropForRateLimiting += req.GetClientStats().NumCallsFinishedWithDropForRateLimiting - b.stats.NumCallsFinishedWithDropForLoadBalancing += req.GetClientStats().NumCallsFinishedWithDropForLoadBalancing - b.stats.NumCallsFinishedWithClientFailedToSend += req.GetClientStats().NumCallsFinishedWithClientFailedToSend - b.stats.NumCallsFinishedKnownReceived += req.GetClientStats().NumCallsFinishedKnownReceived - b.mu.Unlock() - } - }() - for v := range b.sls { - resp = &lbmpb.LoadBalanceResponse{ - LoadBalanceResponseType: &lbmpb.LoadBalanceResponse_ServerList{ - ServerList: v, - }, - } - if err := stream.Send(resp); err != nil { - return err - } - } - <-b.done - return nil -} - -type testServer struct { - testpb.TestServiceServer - - addr string - fallback bool -} - -const testmdkey = "testmd" - -func (s *testServer) EmptyCall(ctx context.Context, in *testpb.Empty) (*testpb.Empty, error) { - md, ok := metadata.FromIncomingContext(ctx) - if !ok { - return nil, status.Error(codes.Internal, "failed to receive metadata") - } - if !s.fallback && (md == nil || md["lb-token"][0] != lbToken) { - return nil, status.Errorf(codes.Internal, "received unexpected metadata: %v", md) - } - grpc.SetTrailer(ctx, metadata.Pairs(testmdkey, s.addr)) - return &testpb.Empty{}, nil -} - -func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - return nil -} - -func startBackends(sn string, fallback bool, lis ...net.Listener) (servers []*grpc.Server) { - for _, l := range lis { - creds := &serverNameCheckCreds{ - sn: sn, - } - s := grpc.NewServer(grpc.Creds(creds)) - testpb.RegisterTestServiceServer(s, &testServer{addr: l.Addr().String(), fallback: fallback}) - servers = append(servers, s) - go func(s *grpc.Server, l net.Listener) { - s.Serve(l) - }(s, l) - } - return -} - -func stopBackends(servers []*grpc.Server) { - for _, s := range servers { - s.Stop() - } -} - -type testServers struct { - lbAddr string - ls *remoteBalancer - lb *grpc.Server - beIPs []net.IP - bePorts []int -} - -func newLoadBalancer(numberOfBackends int) (tss *testServers, cleanup func(), err error) { - var ( - beListeners []net.Listener - ls *remoteBalancer - lb *grpc.Server - beIPs []net.IP - bePorts []int - ) - for i := 0; i < numberOfBackends; i++ { - // Start a backend. - beLis, e := net.Listen("tcp", "localhost:0") - if e != nil { - err = fmt.Errorf("Failed to listen %v", err) - return - } - beIPs = append(beIPs, beLis.Addr().(*net.TCPAddr).IP) - bePorts = append(bePorts, beLis.Addr().(*net.TCPAddr).Port) - - beListeners = append(beListeners, beLis) - } - backends := startBackends(beServerName, false, beListeners...) - - // Start a load balancer. - lbLis, err := net.Listen("tcp", "localhost:0") - if err != nil { - err = fmt.Errorf("Failed to create the listener for the load balancer %v", err) - return - } - lbCreds := &serverNameCheckCreds{ - sn: lbServerName, - } - lb = grpc.NewServer(grpc.Creds(lbCreds)) - if err != nil { - err = fmt.Errorf("Failed to generate the port number %v", err) - return - } - ls = newRemoteBalancer(nil) - lbspb.RegisterLoadBalancerServer(lb, ls) - go func() { - lb.Serve(lbLis) - }() - - tss = &testServers{ - lbAddr: fakeName + ":" + strconv.Itoa(lbLis.Addr().(*net.TCPAddr).Port), - ls: ls, - lb: lb, - beIPs: beIPs, - bePorts: bePorts, - } - cleanup = func() { - defer stopBackends(backends) - defer func() { - ls.stop() - lb.Stop() - }() - } - return -} - -func TestGRPCLB(t *testing.T) { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - tss, cleanup, err := newLoadBalancer(1) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - - be := &lbmpb.Server{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - } - var bes []*lbmpb.Server - bes = append(bes, be) - sl := &lbmpb.ServerList{ - Servers: bes, - } - tss.ls.sls <- sl - creds := serverNameCheckCreds{ - expected: beServerName, - } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithTransportCredentials(&creds), grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - testC := testpb.NewTestServiceClient(cc) - - r.NewAddress([]resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}) - - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } -} - -// The remote balancer sends response with duplicates to grpclb client. -func TestGRPCLBWeighted(t *testing.T) { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - tss, cleanup, err := newLoadBalancer(2) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - - beServers := []*lbmpb.Server{{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - }, { - IpAddress: tss.beIPs[1], - Port: int32(tss.bePorts[1]), - LoadBalanceToken: lbToken, - }} - portsToIndex := make(map[int]int) - for i := range beServers { - portsToIndex[tss.bePorts[i]] = i - } - - creds := serverNameCheckCreds{ - expected: beServerName, - } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithTransportCredentials(&creds), grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - testC := testpb.NewTestServiceClient(cc) - - r.NewAddress([]resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}) - - sequences := []string{"00101", "00011"} - for _, seq := range sequences { - var ( - bes []*lbmpb.Server - p peer.Peer - result string - ) - for _, s := range seq { - bes = append(bes, beServers[s-'0']) - } - tss.ls.sls <- &lbmpb.ServerList{Servers: bes} - - for i := 0; i < 1000; i++ { - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false), grpc.Peer(&p)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - result += strconv.Itoa(portsToIndex[p.Addr.(*net.TCPAddr).Port]) - } - // The generated result will be in format of "0010100101". - if !strings.Contains(result, strings.Repeat(seq, 2)) { - t.Errorf("got result sequence %q, want patten %q", result, seq) - } - } -} - -func TestDropRequest(t *testing.T) { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - tss, cleanup, err := newLoadBalancer(1) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - tss.ls.sls <- &lbmpb.ServerList{ - Servers: []*lbmpb.Server{{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - DropForLoadBalancing: false, - }, { - DropForLoadBalancing: true, - }}, - } - creds := serverNameCheckCreds{ - expected: beServerName, - } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithTransportCredentials(&creds), grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - testC := testpb.NewTestServiceClient(cc) - - r.NewAddress([]resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}) - - // The 1st, non-fail-fast RPC should succeed. This ensures both server - // connections are made, because the first one has DropForLoadBalancing set to true. - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false)); err != nil { - t.Fatalf("%v.SayHello(_, _) = _, %v, want _, ", testC, err) - } - for _, failfast := range []bool{true, false} { - for i := 0; i < 3; i++ { - // Even RPCs should fail, because the 2st backend has - // DropForLoadBalancing set to true. - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(failfast)); status.Code(err) != codes.Unavailable { - t.Errorf("%v.EmptyCall(_, _) = _, %v, want _, %s", testC, err, codes.Unavailable) - } - // Odd RPCs should succeed since they choose the non-drop-request - // backend according to the round robin policy. - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(failfast)); err != nil { - t.Errorf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - } - } -} - -// When the balancer in use disconnects, grpclb should connect to the next address from resolved balancer address list. -func TestBalancerDisconnects(t *testing.T) { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - var ( - tests []*testServers - lbs []*grpc.Server - ) - for i := 0; i < 2; i++ { - tss, cleanup, err := newLoadBalancer(1) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - - be := &lbmpb.Server{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - } - var bes []*lbmpb.Server - bes = append(bes, be) - sl := &lbmpb.ServerList{ - Servers: bes, - } - tss.ls.sls <- sl - - tests = append(tests, tss) - lbs = append(lbs, tss.lb) - } - - creds := serverNameCheckCreds{ - expected: beServerName, - } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithTransportCredentials(&creds), grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - testC := testpb.NewTestServiceClient(cc) - - r.NewAddress([]resolver.Address{{ - Addr: tests[0].lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }, { - Addr: tests[1].lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}) - - var p peer.Peer - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false), grpc.Peer(&p)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - if p.Addr.(*net.TCPAddr).Port != tests[0].bePorts[0] { - t.Fatalf("got peer: %v, want peer port: %v", p.Addr, tests[0].bePorts[0]) - } - - lbs[0].Stop() - // Stop balancer[0], balancer[1] should be used by grpclb. - // Check peer address to see if that happened. - for i := 0; i < 1000; i++ { - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false), grpc.Peer(&p)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - if p.Addr.(*net.TCPAddr).Port == tests[1].bePorts[0] { - return - } - time.Sleep(time.Millisecond) - } - t.Fatalf("No RPC sent to second backend after 1 second") -} - -type customGRPCLBBuilder struct { - balancer.Builder - name string -} - -func (b *customGRPCLBBuilder) Name() string { - return b.name -} - -const grpclbCustomFallbackName = "grpclb_with_custom_fallback_timeout" - -func init() { - balancer.Register(&customGRPCLBBuilder{ - Builder: grpc.NewLBBuilderWithFallbackTimeout(100 * time.Millisecond), - name: grpclbCustomFallbackName, - }) -} - -func TestFallback(t *testing.T) { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - tss, cleanup, err := newLoadBalancer(1) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - - // Start a standalone backend. - beLis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen %v", err) - } - defer beLis.Close() - standaloneBEs := startBackends(beServerName, true, beLis) - defer stopBackends(standaloneBEs) - - be := &lbmpb.Server{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - } - var bes []*lbmpb.Server - bes = append(bes, be) - sl := &lbmpb.ServerList{ - Servers: bes, - } - tss.ls.sls <- sl - creds := serverNameCheckCreds{ - expected: beServerName, - } - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithBalancerName(grpclbCustomFallbackName), - grpc.WithTransportCredentials(&creds), grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - testC := testpb.NewTestServiceClient(cc) - - r.NewAddress([]resolver.Address{{ - Addr: "", - Type: resolver.GRPCLB, - ServerName: lbServerName, - }, { - Addr: beLis.Addr().String(), - Type: resolver.Backend, - ServerName: beServerName, - }}) - - var p peer.Peer - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false), grpc.Peer(&p)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - if p.Addr.String() != beLis.Addr().String() { - t.Fatalf("got peer: %v, want peer: %v", p.Addr, beLis.Addr()) - } - - r.NewAddress([]resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }, { - Addr: beLis.Addr().String(), - Type: resolver.Backend, - ServerName: beServerName, - }}) - - for i := 0; i < 1000; i++ { - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false), grpc.Peer(&p)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - if p.Addr.(*net.TCPAddr).Port == tss.bePorts[0] { - return - } - time.Sleep(time.Millisecond) - } - t.Fatalf("No RPC sent to backend behind remote balancer after 1 second") -} - -type failPreRPCCred struct{} - -func (failPreRPCCred) GetRequestMetadata(ctx context.Context, uri ...string) (map[string]string, error) { - if strings.Contains(uri[0], failtosendURI) { - return nil, fmt.Errorf("rpc should fail to send") - } - return nil, nil -} - -func (failPreRPCCred) RequireTransportSecurity() bool { - return false -} - -func checkStats(stats *lbmpb.ClientStats, expected *lbmpb.ClientStats) error { - if !proto.Equal(stats, expected) { - return fmt.Errorf("stats not equal: got %+v, want %+v", stats, expected) - } - return nil -} - -func runAndGetStats(t *testing.T, dropForLoadBalancing, dropForRateLimiting bool, runRPCs func(*grpc.ClientConn)) lbmpb.ClientStats { - defer leakcheck.Check(t) - - r, cleanup := manual.GenerateAndRegisterManualResolver() - defer cleanup() - - tss, cleanup, err := newLoadBalancer(1) - if err != nil { - t.Fatalf("failed to create new load balancer: %v", err) - } - defer cleanup() - tss.ls.sls <- &lbmpb.ServerList{ - Servers: []*lbmpb.Server{{ - IpAddress: tss.beIPs[0], - Port: int32(tss.bePorts[0]), - LoadBalanceToken: lbToken, - DropForLoadBalancing: dropForLoadBalancing, - DropForRateLimiting: dropForRateLimiting, - }}, - } - tss.ls.statsDura = 100 * time.Millisecond - creds := serverNameCheckCreds{expected: beServerName} - - ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second) - defer cancel() - cc, err := grpc.DialContext(ctx, r.Scheme()+":///"+beServerName, - grpc.WithTransportCredentials(&creds), - grpc.WithPerRPCCredentials(failPreRPCCred{}), - grpc.WithDialer(fakeNameDialer)) - if err != nil { - t.Fatalf("Failed to dial to the backend %v", err) - } - defer cc.Close() - - r.NewAddress([]resolver.Address{{ - Addr: tss.lbAddr, - Type: resolver.GRPCLB, - ServerName: lbServerName, - }}) - - runRPCs(cc) - time.Sleep(1 * time.Second) - tss.ls.mu.Lock() - stats := tss.ls.stats - tss.ls.mu.Unlock() - return stats -} - -const ( - countRPC = 40 - failtosendURI = "failtosend" - dropErrDesc = "request dropped by grpclb" -) - -func TestGRPCLBStatsUnarySuccess(t *testing.T) { - defer leakcheck.Check(t) - stats := runAndGetStats(t, false, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - // The first non-failfast RPC succeeds, all connections are up. - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - for i := 0; i < countRPC-1; i++ { - testC.EmptyCall(context.Background(), &testpb.Empty{}) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC), - NumCallsFinished: int64(countRPC), - NumCallsFinishedKnownReceived: int64(countRPC), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsUnaryDropLoadBalancing(t *testing.T) { - defer leakcheck.Check(t) - c := 0 - stats := runAndGetStats(t, true, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - for { - c++ - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - if strings.Contains(err.Error(), dropErrDesc) { - break - } - } - } - for i := 0; i < countRPC; i++ { - testC.EmptyCall(context.Background(), &testpb.Empty{}) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC + c), - NumCallsFinished: int64(countRPC + c), - NumCallsFinishedWithDropForLoadBalancing: int64(countRPC + 1), - NumCallsFinishedWithClientFailedToSend: int64(c - 1), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsUnaryDropRateLimiting(t *testing.T) { - defer leakcheck.Check(t) - c := 0 - stats := runAndGetStats(t, false, true, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - for { - c++ - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - if strings.Contains(err.Error(), dropErrDesc) { - break - } - } - } - for i := 0; i < countRPC; i++ { - testC.EmptyCall(context.Background(), &testpb.Empty{}) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC + c), - NumCallsFinished: int64(countRPC + c), - NumCallsFinishedWithDropForRateLimiting: int64(countRPC + 1), - NumCallsFinishedWithClientFailedToSend: int64(c - 1), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsUnaryFailedToSend(t *testing.T) { - defer leakcheck.Check(t) - stats := runAndGetStats(t, false, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - // The first non-failfast RPC succeeds, all connections are up. - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}, grpc.FailFast(false)); err != nil { - t.Fatalf("%v.EmptyCall(_, _) = _, %v, want _, ", testC, err) - } - for i := 0; i < countRPC-1; i++ { - grpc.Invoke(context.Background(), failtosendURI, &testpb.Empty{}, nil, cc) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC), - NumCallsFinished: int64(countRPC), - NumCallsFinishedWithClientFailedToSend: int64(countRPC - 1), - NumCallsFinishedKnownReceived: 1, - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsStreamingSuccess(t *testing.T) { - defer leakcheck.Check(t) - stats := runAndGetStats(t, false, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - // The first non-failfast RPC succeeds, all connections are up. - stream, err := testC.FullDuplexCall(context.Background(), grpc.FailFast(false)) - if err != nil { - t.Fatalf("%v.FullDuplexCall(_, _) = _, %v, want _, ", testC, err) - } - for { - if _, err = stream.Recv(); err == io.EOF { - break - } - } - for i := 0; i < countRPC-1; i++ { - stream, err = testC.FullDuplexCall(context.Background()) - if err == nil { - // Wait for stream to end if err is nil. - for { - if _, err = stream.Recv(); err == io.EOF { - break - } - } - } - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC), - NumCallsFinished: int64(countRPC), - NumCallsFinishedKnownReceived: int64(countRPC), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsStreamingDropLoadBalancing(t *testing.T) { - defer leakcheck.Check(t) - c := 0 - stats := runAndGetStats(t, true, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - for { - c++ - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - if strings.Contains(err.Error(), dropErrDesc) { - break - } - } - } - for i := 0; i < countRPC; i++ { - testC.FullDuplexCall(context.Background()) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC + c), - NumCallsFinished: int64(countRPC + c), - NumCallsFinishedWithDropForLoadBalancing: int64(countRPC + 1), - NumCallsFinishedWithClientFailedToSend: int64(c - 1), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsStreamingDropRateLimiting(t *testing.T) { - defer leakcheck.Check(t) - c := 0 - stats := runAndGetStats(t, false, true, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - for { - c++ - if _, err := testC.EmptyCall(context.Background(), &testpb.Empty{}); err != nil { - if strings.Contains(err.Error(), dropErrDesc) { - break - } - } - } - for i := 0; i < countRPC; i++ { - testC.FullDuplexCall(context.Background()) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC + c), - NumCallsFinished: int64(countRPC + c), - NumCallsFinishedWithDropForRateLimiting: int64(countRPC + 1), - NumCallsFinishedWithClientFailedToSend: int64(c - 1), - }); err != nil { - t.Fatal(err) - } -} - -func TestGRPCLBStatsStreamingFailedToSend(t *testing.T) { - defer leakcheck.Check(t) - stats := runAndGetStats(t, false, false, func(cc *grpc.ClientConn) { - testC := testpb.NewTestServiceClient(cc) - // The first non-failfast RPC succeeds, all connections are up. - stream, err := testC.FullDuplexCall(context.Background(), grpc.FailFast(false)) - if err != nil { - t.Fatalf("%v.FullDuplexCall(_, _) = _, %v, want _, ", testC, err) - } - for { - if _, err = stream.Recv(); err == io.EOF { - break - } - } - for i := 0; i < countRPC-1; i++ { - grpc.NewClientStream(context.Background(), &grpc.StreamDesc{}, cc, failtosendURI) - } - }) - - if err := checkStats(&stats, &lbmpb.ClientStats{ - NumCallsStarted: int64(countRPC), - NumCallsFinished: int64(countRPC), - NumCallsFinishedWithClientFailedToSend: int64(countRPC - 1), - NumCallsFinishedKnownReceived: 1, - }); err != nil { - t.Fatal(err) - } -} diff --git a/vendor/google.golang.org/grpc/grpclog/grpclog.go b/vendor/google.golang.org/grpc/grpclog/grpclog.go deleted file mode 100644 index 16a7d88..0000000 --- a/vendor/google.golang.org/grpc/grpclog/grpclog.go +++ /dev/null @@ -1,123 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 grpclog defines logging for grpc. -// -// All logs in transport package only go to verbose level 2. -// All logs in other packages in grpc are logged in spite of the verbosity level. -// -// In the default logger, -// severity level can be set by environment variable GRPC_GO_LOG_SEVERITY_LEVEL, -// verbosity level can be set by GRPC_GO_LOG_VERBOSITY_LEVEL. -package grpclog // import "google.golang.org/grpc/grpclog" - -import "os" - -var logger = newLoggerV2() - -// V reports whether verbosity level l is at least the requested verbose level. -func V(l int) bool { - return logger.V(l) -} - -// Info logs to the INFO log. -func Info(args ...interface{}) { - logger.Info(args...) -} - -// Infof logs to the INFO log. Arguments are handled in the manner of fmt.Printf. -func Infof(format string, args ...interface{}) { - logger.Infof(format, args...) -} - -// Infoln logs to the INFO log. Arguments are handled in the manner of fmt.Println. -func Infoln(args ...interface{}) { - logger.Infoln(args...) -} - -// Warning logs to the WARNING log. -func Warning(args ...interface{}) { - logger.Warning(args...) -} - -// Warningf logs to the WARNING log. Arguments are handled in the manner of fmt.Printf. -func Warningf(format string, args ...interface{}) { - logger.Warningf(format, args...) -} - -// Warningln logs to the WARNING log. Arguments are handled in the manner of fmt.Println. -func Warningln(args ...interface{}) { - logger.Warningln(args...) -} - -// Error logs to the ERROR log. -func Error(args ...interface{}) { - logger.Error(args...) -} - -// Errorf logs to the ERROR log. Arguments are handled in the manner of fmt.Printf. -func Errorf(format string, args ...interface{}) { - logger.Errorf(format, args...) -} - -// Errorln logs to the ERROR log. Arguments are handled in the manner of fmt.Println. -func Errorln(args ...interface{}) { - logger.Errorln(args...) -} - -// Fatal logs to the FATAL log. Arguments are handled in the manner of fmt.Print. -// It calls os.Exit() with exit code 1. -func Fatal(args ...interface{}) { - logger.Fatal(args...) - // Make sure fatal logs will exit. - os.Exit(1) -} - -// Fatalf logs to the FATAL log. Arguments are handled in the manner of fmt.Printf. -// It calles os.Exit() with exit code 1. -func Fatalf(format string, args ...interface{}) { - logger.Fatalf(format, args...) - // Make sure fatal logs will exit. - os.Exit(1) -} - -// Fatalln logs to the FATAL log. Arguments are handled in the manner of fmt.Println. -// It calle os.Exit()) with exit code 1. -func Fatalln(args ...interface{}) { - logger.Fatalln(args...) - // Make sure fatal logs will exit. - os.Exit(1) -} - -// Print prints to the logger. Arguments are handled in the manner of fmt.Print. -// Deprecated: use Info. -func Print(args ...interface{}) { - logger.Info(args...) -} - -// Printf prints to the logger. Arguments are handled in the manner of fmt.Printf. -// Deprecated: use Infof. -func Printf(format string, args ...interface{}) { - logger.Infof(format, args...) -} - -// Println prints to the logger. Arguments are handled in the manner of fmt.Println. -// Deprecated: use Infoln. -func Println(args ...interface{}) { - logger.Infoln(args...) -} diff --git a/vendor/google.golang.org/grpc/grpclog/logger.go b/vendor/google.golang.org/grpc/grpclog/logger.go deleted file mode 100644 index d03b239..0000000 --- a/vendor/google.golang.org/grpc/grpclog/logger.go +++ /dev/null @@ -1,83 +0,0 @@ -/* - * - * Copyright 2015 gRPC authors. - * - * 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 grpclog - -// Logger mimics golang's standard Logger as an interface. -// Deprecated: use LoggerV2. -type Logger interface { - Fatal(args ...interface{}) - Fatalf(format string, args ...interface{}) - Fatalln(args ...interface{}) - Print(args ...interface{}) - Printf(format string, args ...interface{}) - Println(args ...interface{}) -} - -// SetLogger sets the logger that is used in grpc. Call only from -// init() functions. -// Deprecated: use SetLoggerV2. -func SetLogger(l Logger) { - logger = &loggerWrapper{Logger: l} -} - -// loggerWrapper wraps Logger into a LoggerV2. -type loggerWrapper struct { - Logger -} - -func (g *loggerWrapper) Info(args ...interface{}) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Infoln(args ...interface{}) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Infof(format string, args ...interface{}) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Warning(args ...interface{}) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Warningln(args ...interface{}) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Warningf(format string, args ...interface{}) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) Error(args ...interface{}) { - g.Logger.Print(args...) -} - -func (g *loggerWrapper) Errorln(args ...interface{}) { - g.Logger.Println(args...) -} - -func (g *loggerWrapper) Errorf(format string, args ...interface{}) { - g.Logger.Printf(format, args...) -} - -func (g *loggerWrapper) V(l int) bool { - // Returns true for all verbose level. - return true -} diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2.go b/vendor/google.golang.org/grpc/grpclog/loggerv2.go deleted file mode 100644 index d493257..0000000 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2.go +++ /dev/null @@ -1,195 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 grpclog - -import ( - "io" - "io/ioutil" - "log" - "os" - "strconv" -) - -// LoggerV2 does underlying logging work for grpclog. -type LoggerV2 interface { - // Info logs to INFO log. Arguments are handled in the manner of fmt.Print. - Info(args ...interface{}) - // Infoln logs to INFO log. Arguments are handled in the manner of fmt.Println. - Infoln(args ...interface{}) - // Infof logs to INFO log. Arguments are handled in the manner of fmt.Printf. - Infof(format string, args ...interface{}) - // Warning logs to WARNING log. Arguments are handled in the manner of fmt.Print. - Warning(args ...interface{}) - // Warningln logs to WARNING log. Arguments are handled in the manner of fmt.Println. - Warningln(args ...interface{}) - // Warningf logs to WARNING log. Arguments are handled in the manner of fmt.Printf. - Warningf(format string, args ...interface{}) - // Error logs to ERROR log. Arguments are handled in the manner of fmt.Print. - Error(args ...interface{}) - // Errorln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - Errorln(args ...interface{}) - // Errorf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - Errorf(format string, args ...interface{}) - // Fatal logs to ERROR log. Arguments are handled in the manner of fmt.Print. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatal(args ...interface{}) - // Fatalln logs to ERROR log. Arguments are handled in the manner of fmt.Println. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalln(args ...interface{}) - // Fatalf logs to ERROR log. Arguments are handled in the manner of fmt.Printf. - // gRPC ensures that all Fatal logs will exit with os.Exit(1). - // Implementations may also call os.Exit() with a non-zero exit code. - Fatalf(format string, args ...interface{}) - // V reports whether verbosity level l is at least the requested verbose level. - V(l int) bool -} - -// SetLoggerV2 sets logger that is used in grpc to a V2 logger. -// Not mutex-protected, should be called before any gRPC functions. -func SetLoggerV2(l LoggerV2) { - logger = l -} - -const ( - // infoLog indicates Info severity. - infoLog int = iota - // warningLog indicates Warning severity. - warningLog - // errorLog indicates Error severity. - errorLog - // fatalLog indicates Fatal severity. - fatalLog -) - -// severityName contains the string representation of each severity. -var severityName = []string{ - infoLog: "INFO", - warningLog: "WARNING", - errorLog: "ERROR", - fatalLog: "FATAL", -} - -// loggerT is the default logger used by grpclog. -type loggerT struct { - m []*log.Logger - v int -} - -// NewLoggerV2 creates a loggerV2 with the provided writers. -// Fatal logs will be written to errorW, warningW, infoW, followed by exit(1). -// Error logs will be written to errorW, warningW and infoW. -// Warning logs will be written to warningW and infoW. -// Info logs will be written to infoW. -func NewLoggerV2(infoW, warningW, errorW io.Writer) LoggerV2 { - return NewLoggerV2WithVerbosity(infoW, warningW, errorW, 0) -} - -// NewLoggerV2WithVerbosity creates a loggerV2 with the provided writers and -// verbosity level. -func NewLoggerV2WithVerbosity(infoW, warningW, errorW io.Writer, v int) LoggerV2 { - var m []*log.Logger - m = append(m, log.New(infoW, severityName[infoLog]+": ", log.LstdFlags)) - m = append(m, log.New(io.MultiWriter(infoW, warningW), severityName[warningLog]+": ", log.LstdFlags)) - ew := io.MultiWriter(infoW, warningW, errorW) // ew will be used for error and fatal. - m = append(m, log.New(ew, severityName[errorLog]+": ", log.LstdFlags)) - m = append(m, log.New(ew, severityName[fatalLog]+": ", log.LstdFlags)) - return &loggerT{m: m, v: v} -} - -// newLoggerV2 creates a loggerV2 to be used as default logger. -// All logs are written to stderr. -func newLoggerV2() LoggerV2 { - errorW := ioutil.Discard - warningW := ioutil.Discard - infoW := ioutil.Discard - - logLevel := os.Getenv("GRPC_GO_LOG_SEVERITY_LEVEL") - switch logLevel { - case "", "ERROR", "error": // If env is unset, set level to ERROR. - errorW = os.Stderr - case "WARNING", "warning": - warningW = os.Stderr - case "INFO", "info": - infoW = os.Stderr - } - - var v int - vLevel := os.Getenv("GRPC_GO_LOG_VERBOSITY_LEVEL") - if vl, err := strconv.Atoi(vLevel); err == nil { - v = vl - } - return NewLoggerV2WithVerbosity(infoW, warningW, errorW, v) -} - -func (g *loggerT) Info(args ...interface{}) { - g.m[infoLog].Print(args...) -} - -func (g *loggerT) Infoln(args ...interface{}) { - g.m[infoLog].Println(args...) -} - -func (g *loggerT) Infof(format string, args ...interface{}) { - g.m[infoLog].Printf(format, args...) -} - -func (g *loggerT) Warning(args ...interface{}) { - g.m[warningLog].Print(args...) -} - -func (g *loggerT) Warningln(args ...interface{}) { - g.m[warningLog].Println(args...) -} - -func (g *loggerT) Warningf(format string, args ...interface{}) { - g.m[warningLog].Printf(format, args...) -} - -func (g *loggerT) Error(args ...interface{}) { - g.m[errorLog].Print(args...) -} - -func (g *loggerT) Errorln(args ...interface{}) { - g.m[errorLog].Println(args...) -} - -func (g *loggerT) Errorf(format string, args ...interface{}) { - g.m[errorLog].Printf(format, args...) -} - -func (g *loggerT) Fatal(args ...interface{}) { - g.m[fatalLog].Fatal(args...) - // No need to call os.Exit() again because log.Logger.Fatal() calls os.Exit(). -} - -func (g *loggerT) Fatalln(args ...interface{}) { - g.m[fatalLog].Fatalln(args...) - // No need to call os.Exit() again because log.Logger.Fatal() calls os.Exit(). -} - -func (g *loggerT) Fatalf(format string, args ...interface{}) { - g.m[fatalLog].Fatalf(format, args...) - // No need to call os.Exit() again because log.Logger.Fatal() calls os.Exit(). -} - -func (g *loggerT) V(l int) bool { - return l <= g.v -} diff --git a/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go b/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go deleted file mode 100644 index 756f215..0000000 --- a/vendor/google.golang.org/grpc/grpclog/loggerv2_test.go +++ /dev/null @@ -1,62 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 grpclog - -import ( - "bytes" - "fmt" - "regexp" - "testing" -) - -func TestLoggerV2Severity(t *testing.T) { - buffers := []*bytes.Buffer{new(bytes.Buffer), new(bytes.Buffer), new(bytes.Buffer)} - SetLoggerV2(NewLoggerV2(buffers[infoLog], buffers[warningLog], buffers[errorLog])) - - Info(severityName[infoLog]) - Warning(severityName[warningLog]) - Error(severityName[errorLog]) - - for i := 0; i < fatalLog; i++ { - buf := buffers[i] - // The content of info buffer should be something like: - // INFO: 2017/04/07 14:55:42 INFO - // WARNING: 2017/04/07 14:55:42 WARNING - // ERROR: 2017/04/07 14:55:42 ERROR - for j := i; j < fatalLog; j++ { - b, err := buf.ReadBytes('\n') - if err != nil { - t.Fatal(err) - } - if err := checkLogForSeverity(j, b); err != nil { - t.Fatal(err) - } - } - } -} - -// check if b is in the format of: -// WARNING: 2017/04/07 14:55:42 WARNING -func checkLogForSeverity(s int, b []byte) error { - expected := regexp.MustCompile(fmt.Sprintf(`^%s: [0-9]{4}/[0-9]{2}/[0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} %s\n$`, severityName[s], severityName[s])) - if m := expected.Match(b); !m { - return fmt.Errorf("got: %v, want string in format of: %v", string(b), severityName[s]+": 2016/10/05 17:09:26 "+severityName[s]) - } - return nil -} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go deleted file mode 100644 index fdcbb9e..0000000 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.pb.go +++ /dev/null @@ -1,190 +0,0 @@ -// Code generated by protoc-gen-go. DO NOT EDIT. -// source: grpc_health_v1/health.proto - -/* -Package grpc_health_v1 is a generated protocol buffer package. - -It is generated from these files: - grpc_health_v1/health.proto - -It has these top-level messages: - HealthCheckRequest - HealthCheckResponse -*/ -package grpc_health_v1 - -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" - -import ( - context "golang.org/x/net/context" - grpc "google.golang.org/grpc" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package - -type HealthCheckResponse_ServingStatus int32 - -const ( - HealthCheckResponse_UNKNOWN HealthCheckResponse_ServingStatus = 0 - HealthCheckResponse_SERVING HealthCheckResponse_ServingStatus = 1 - HealthCheckResponse_NOT_SERVING HealthCheckResponse_ServingStatus = 2 -) - -var HealthCheckResponse_ServingStatus_name = map[int32]string{ - 0: "UNKNOWN", - 1: "SERVING", - 2: "NOT_SERVING", -} -var HealthCheckResponse_ServingStatus_value = map[string]int32{ - "UNKNOWN": 0, - "SERVING": 1, - "NOT_SERVING": 2, -} - -func (x HealthCheckResponse_ServingStatus) String() string { - return proto.EnumName(HealthCheckResponse_ServingStatus_name, int32(x)) -} -func (HealthCheckResponse_ServingStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor0, []int{1, 0} -} - -type HealthCheckRequest struct { - Service string `protobuf:"bytes,1,opt,name=service" json:"service,omitempty"` -} - -func (m *HealthCheckRequest) Reset() { *m = HealthCheckRequest{} } -func (m *HealthCheckRequest) String() string { return proto.CompactTextString(m) } -func (*HealthCheckRequest) ProtoMessage() {} -func (*HealthCheckRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } - -func (m *HealthCheckRequest) GetService() string { - if m != nil { - return m.Service - } - return "" -} - -type HealthCheckResponse struct { - Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,enum=grpc.health.v1.HealthCheckResponse_ServingStatus" json:"status,omitempty"` -} - -func (m *HealthCheckResponse) Reset() { *m = HealthCheckResponse{} } -func (m *HealthCheckResponse) String() string { return proto.CompactTextString(m) } -func (*HealthCheckResponse) ProtoMessage() {} -func (*HealthCheckResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } - -func (m *HealthCheckResponse) GetStatus() HealthCheckResponse_ServingStatus { - if m != nil { - return m.Status - } - return HealthCheckResponse_UNKNOWN -} - -func init() { - proto.RegisterType((*HealthCheckRequest)(nil), "grpc.health.v1.HealthCheckRequest") - proto.RegisterType((*HealthCheckResponse)(nil), "grpc.health.v1.HealthCheckResponse") - proto.RegisterEnum("grpc.health.v1.HealthCheckResponse_ServingStatus", HealthCheckResponse_ServingStatus_name, HealthCheckResponse_ServingStatus_value) -} - -// Reference imports to suppress errors if they are not otherwise used. -var _ context.Context -var _ grpc.ClientConn - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the grpc package it is being compiled against. -const _ = grpc.SupportPackageIsVersion4 - -// Client API for Health service - -type HealthClient interface { - Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) -} - -type healthClient struct { - cc *grpc.ClientConn -} - -func NewHealthClient(cc *grpc.ClientConn) HealthClient { - return &healthClient{cc} -} - -func (c *healthClient) Check(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error) { - out := new(HealthCheckResponse) - err := grpc.Invoke(ctx, "/grpc.health.v1.Health/Check", in, out, c.cc, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -// Server API for Health service - -type HealthServer interface { - Check(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error) -} - -func RegisterHealthServer(s *grpc.Server, srv HealthServer) { - s.RegisterService(&_Health_serviceDesc, srv) -} - -func _Health_Check_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(HealthCheckRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(HealthServer).Check(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/grpc.health.v1.Health/Check", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(HealthServer).Check(ctx, req.(*HealthCheckRequest)) - } - return interceptor(ctx, in, info, handler) -} - -var _Health_serviceDesc = grpc.ServiceDesc{ - ServiceName: "grpc.health.v1.Health", - HandlerType: (*HealthServer)(nil), - Methods: []grpc.MethodDesc{ - { - MethodName: "Check", - Handler: _Health_Check_Handler, - }, - }, - Streams: []grpc.StreamDesc{}, - Metadata: "grpc_health_v1/health.proto", -} - -func init() { proto.RegisterFile("grpc_health_v1/health.proto", fileDescriptor0) } - -var fileDescriptor0 = []byte{ - // 213 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4e, 0x2f, 0x2a, 0x48, - 0x8e, 0xcf, 0x48, 0x4d, 0xcc, 0x29, 0xc9, 0x88, 0x2f, 0x33, 0xd4, 0x87, 0xb0, 0xf4, 0x0a, 0x8a, - 0xf2, 0x4b, 0xf2, 0x85, 0xf8, 0x40, 0x92, 0x7a, 0x50, 0xa1, 0x32, 0x43, 0x25, 0x3d, 0x2e, 0x21, - 0x0f, 0x30, 0xc7, 0x39, 0x23, 0x35, 0x39, 0x3b, 0x28, 0xb5, 0xb0, 0x34, 0xb5, 0xb8, 0x44, 0x48, - 0x82, 0x8b, 0xbd, 0x38, 0xb5, 0xa8, 0x2c, 0x33, 0x39, 0x55, 0x82, 0x51, 0x81, 0x51, 0x83, 0x33, - 0x08, 0xc6, 0x55, 0x9a, 0xc3, 0xc8, 0x25, 0x8c, 0xa2, 0xa1, 0xb8, 0x20, 0x3f, 0xaf, 0x38, 0x55, - 0xc8, 0x93, 0x8b, 0xad, 0xb8, 0x24, 0xb1, 0xa4, 0xb4, 0x18, 0xac, 0x81, 0xcf, 0xc8, 0x50, 0x0f, - 0xd5, 0x22, 0x3d, 0x2c, 0x9a, 0xf4, 0x82, 0x41, 0x86, 0xe6, 0xa5, 0x07, 0x83, 0x35, 0x06, 0x41, - 0x0d, 0x50, 0xb2, 0xe2, 0xe2, 0x45, 0x91, 0x10, 0xe2, 0xe6, 0x62, 0x0f, 0xf5, 0xf3, 0xf6, 0xf3, - 0x0f, 0xf7, 0x13, 0x60, 0x00, 0x71, 0x82, 0x5d, 0x83, 0xc2, 0x3c, 0xfd, 0xdc, 0x05, 0x18, 0x85, - 0xf8, 0xb9, 0xb8, 0xfd, 0xfc, 0x43, 0xe2, 0x61, 0x02, 0x4c, 0x46, 0x51, 0x5c, 0x6c, 0x10, 0x8b, - 0x84, 0x02, 0xb8, 0x58, 0xc1, 0x96, 0x09, 0x29, 0xe1, 0x75, 0x09, 0xd8, 0xbf, 0x52, 0xca, 0x44, - 0xb8, 0x36, 0x89, 0x0d, 0x1c, 0x82, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x53, 0x2b, 0x65, - 0x20, 0x60, 0x01, 0x00, 0x00, -} diff --git a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto b/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto deleted file mode 100644 index 6072fdc..0000000 --- a/vendor/google.golang.org/grpc/health/grpc_health_v1/health.proto +++ /dev/null @@ -1,34 +0,0 @@ -// Copyright 2017 gRPC authors. -// -// 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. - -syntax = "proto3"; - -package grpc.health.v1; - -message HealthCheckRequest { - string service = 1; -} - -message HealthCheckResponse { - enum ServingStatus { - UNKNOWN = 0; - SERVING = 1; - NOT_SERVING = 2; - } - ServingStatus status = 1; -} - -service Health{ - rpc Check(HealthCheckRequest) returns (HealthCheckResponse); -} diff --git a/vendor/google.golang.org/grpc/health/health.go b/vendor/google.golang.org/grpc/health/health.go deleted file mode 100644 index 30a7866..0000000 --- a/vendor/google.golang.org/grpc/health/health.go +++ /dev/null @@ -1,72 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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. - * - */ - -//go:generate protoc --go_out=plugins=grpc:. grpc_health_v1/health.proto - -// Package health provides some utility functions to health-check a server. The implementation -// is based on protobuf. Users need to write their own implementations if other IDLs are used. -package health - -import ( - "sync" - - "golang.org/x/net/context" - "google.golang.org/grpc/codes" - healthpb "google.golang.org/grpc/health/grpc_health_v1" - "google.golang.org/grpc/status" -) - -// Server implements `service Health`. -type Server struct { - mu sync.Mutex - // statusMap stores the serving status of the services this Server monitors. - statusMap map[string]healthpb.HealthCheckResponse_ServingStatus -} - -// NewServer returns a new Server. -func NewServer() *Server { - return &Server{ - statusMap: make(map[string]healthpb.HealthCheckResponse_ServingStatus), - } -} - -// Check implements `service Health`. -func (s *Server) Check(ctx context.Context, in *healthpb.HealthCheckRequest) (*healthpb.HealthCheckResponse, error) { - s.mu.Lock() - defer s.mu.Unlock() - if in.Service == "" { - // check the server overall health status. - return &healthpb.HealthCheckResponse{ - Status: healthpb.HealthCheckResponse_SERVING, - }, nil - } - if status, ok := s.statusMap[in.Service]; ok { - return &healthpb.HealthCheckResponse{ - Status: status, - }, nil - } - return nil, status.Error(codes.NotFound, "unknown service") -} - -// SetServingStatus is called when need to reset the serving status of a service -// or insert a new service entry into the statusMap. -func (s *Server) SetServingStatus(service string, status healthpb.HealthCheckResponse_ServingStatus) { - s.mu.Lock() - s.statusMap[service] = status - s.mu.Unlock() -} diff --git a/vendor/google.golang.org/grpc/internal/internal.go b/vendor/google.golang.org/grpc/internal/internal.go deleted file mode 100644 index 53f1775..0000000 --- a/vendor/google.golang.org/grpc/internal/internal.go +++ /dev/null @@ -1,27 +0,0 @@ -/* - * Copyright 2016 gRPC authors. - * - * 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 internal contains gRPC-internal code for testing, to avoid polluting -// the godoc of the top-level grpc package. -package internal - -// TestingUseHandlerImpl enables the http.Handler-based server implementation. -// It must be called before Serve and requires TLS credentials. -// -// The provided grpcServer must be of type *grpc.Server. It is untyped -// for circular dependency reasons. -var TestingUseHandlerImpl func(grpcServer interface{}) diff --git a/vendor/google.golang.org/grpc/keepalive/keepalive.go b/vendor/google.golang.org/grpc/keepalive/keepalive.go deleted file mode 100644 index f8adc7e..0000000 --- a/vendor/google.golang.org/grpc/keepalive/keepalive.go +++ /dev/null @@ -1,65 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 keepalive defines configurable parameters for point-to-point healthcheck. -package keepalive - -import ( - "time" -) - -// ClientParameters is used to set keepalive parameters on the client-side. -// These configure how the client will actively probe to notice when a connection is broken -// and send pings so intermediaries will be aware of the liveness of the connection. -// Make sure these parameters are set in coordination with the keepalive policy on the server, -// as incompatible settings can result in closing of connection. -type ClientParameters struct { - // After a duration of this time if the client doesn't see any activity it pings the server to see if the transport is still alive. - Time time.Duration // The current default value is infinity. - // After having pinged for keepalive check, the client waits for a duration of Timeout and if no activity is seen even after that - // the connection is closed. - Timeout time.Duration // The current default value is 20 seconds. - // If true, client runs keepalive checks even with no active RPCs. - PermitWithoutStream bool // false by default. -} - -// ServerParameters is used to set keepalive and max-age parameters on the server-side. -type ServerParameters struct { - // MaxConnectionIdle is a duration for the amount of time after which an idle connection would be closed by sending a GoAway. - // Idleness duration is defined since the most recent time the number of outstanding RPCs became zero or the connection establishment. - MaxConnectionIdle time.Duration // The current default value is infinity. - // MaxConnectionAge is a duration for the maximum amount of time a connection may exist before it will be closed by sending a GoAway. - // A random jitter of +/-10% will be added to MaxConnectionAge to spread out connection storms. - MaxConnectionAge time.Duration // The current default value is infinity. - // MaxConnectinoAgeGrace is an additive period after MaxConnectionAge after which the connection will be forcibly closed. - MaxConnectionAgeGrace time.Duration // The current default value is infinity. - // After a duration of this time if the server doesn't see any activity it pings the client to see if the transport is still alive. - Time time.Duration // The current default value is 2 hours. - // After having pinged for keepalive check, the server waits for a duration of Timeout and if no activity is seen even after that - // the connection is closed. - Timeout time.Duration // The current default value is 20 seconds. -} - -// EnforcementPolicy is used to set keepalive enforcement policy on the server-side. -// Server will close connection with a client that violates this policy. -type EnforcementPolicy struct { - // MinTime is the minimum amount of time a client should wait before sending a keepalive ping. - MinTime time.Duration // The current default value is 5 minutes. - // If true, server expects keepalive pings even when there are no active streams(RPCs). - PermitWithoutStream bool // false by default. -} diff --git a/vendor/google.golang.org/grpc/metadata/metadata.go b/vendor/google.golang.org/grpc/metadata/metadata.go deleted file mode 100644 index ccfea5d..0000000 --- a/vendor/google.golang.org/grpc/metadata/metadata.go +++ /dev/null @@ -1,137 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 define the structure of the metadata supported by gRPC library. -// Please refer to https://grpc.io/docs/guides/wire.html for more information about custom-metadata. -package metadata // import "google.golang.org/grpc/metadata" - -import ( - "fmt" - "strings" - - "golang.org/x/net/context" -) - -// DecodeKeyValue returns k, v, nil. It is deprecated and should not be used. -func DecodeKeyValue(k, v string) (string, string, error) { - return k, v, nil -} - -// MD is a mapping from metadata keys to values. Users should use the following -// two convenience functions New and Pairs to generate MD. -type MD map[string][]string - -// New creates an MD from a given key-value map. -// -// Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. -// Uppercase letters are automatically converted to lowercase. -// -// Keys beginning with "grpc-" are reserved for grpc-internal use only and may -// result in errors if set in metadata. -func New(m map[string]string) MD { - md := MD{} - for k, val := range m { - key := strings.ToLower(k) - md[key] = append(md[key], val) - } - return md -} - -// Pairs returns an MD formed by the mapping of key, value ... -// Pairs panics if len(kv) is odd. -// -// Only the following ASCII characters are allowed in keys: -// - digits: 0-9 -// - uppercase letters: A-Z (normalized to lower) -// - lowercase letters: a-z -// - special characters: -_. -// Uppercase letters are automatically converted to lowercase. -// -// Keys beginning with "grpc-" are reserved for grpc-internal use only and may -// result in errors if set in metadata. -func Pairs(kv ...string) MD { - if len(kv)%2 == 1 { - panic(fmt.Sprintf("metadata: Pairs got the odd number of input pairs for metadata: %d", len(kv))) - } - md := MD{} - var key string - for i, s := range kv { - if i%2 == 0 { - key = strings.ToLower(s) - continue - } - md[key] = append(md[key], s) - } - return md -} - -// Len returns the number of items in md. -func (md MD) Len() int { - return len(md) -} - -// Copy returns a copy of md. -func (md MD) Copy() MD { - return Join(md) -} - -// Join joins any number of mds into a single MD. -// The order of values for each key is determined by the order in which -// the mds containing those values are presented to Join. -func Join(mds ...MD) MD { - out := MD{} - for _, md := range mds { - for k, v := range md { - out[k] = append(out[k], v...) - } - } - return out -} - -type mdIncomingKey struct{} -type mdOutgoingKey struct{} - -// NewIncomingContext creates a new context with incoming md attached. -func NewIncomingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdIncomingKey{}, md) -} - -// NewOutgoingContext creates a new context with outgoing md attached. -func NewOutgoingContext(ctx context.Context, md MD) context.Context { - return context.WithValue(ctx, mdOutgoingKey{}, md) -} - -// FromIncomingContext returns the incoming metadata in ctx if it exists. The -// returned MD should not be modified. Writing to it may cause races. -// Modification should be made to copies of the returned MD. -func FromIncomingContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdIncomingKey{}).(MD) - return -} - -// FromOutgoingContext returns the outgoing metadata in ctx if it exists. The -// returned MD should not be modified. Writing to it may cause races. -// Modification should be made to the copies of the returned MD. -func FromOutgoingContext(ctx context.Context) (md MD, ok bool) { - md, ok = ctx.Value(mdOutgoingKey{}).(MD) - return -} diff --git a/vendor/google.golang.org/grpc/metadata/metadata_test.go b/vendor/google.golang.org/grpc/metadata/metadata_test.go deleted file mode 100644 index 210cbb2..0000000 --- a/vendor/google.golang.org/grpc/metadata/metadata_test.go +++ /dev/null @@ -1,71 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 ( - "reflect" - "testing" -) - -func TestPairsMD(t *testing.T) { - for _, test := range []struct { - // input - kv []string - // output - md MD - }{ - {[]string{}, MD{}}, - {[]string{"k1", "v1", "k1", "v2"}, MD{"k1": []string{"v1", "v2"}}}, - } { - md := Pairs(test.kv...) - if !reflect.DeepEqual(md, test.md) { - t.Fatalf("Pairs(%v) = %v, want %v", test.kv, md, test.md) - } - } -} - -func TestCopy(t *testing.T) { - const key, val = "key", "val" - orig := Pairs(key, val) - copy := orig.Copy() - if !reflect.DeepEqual(orig, copy) { - t.Errorf("copied value not equal to the original, got %v, want %v", copy, orig) - } - orig[key][0] = "foo" - if v := copy[key][0]; v != val { - t.Errorf("change in original should not affect copy, got %q, want %q", v, val) - } -} - -func TestJoin(t *testing.T) { - for _, test := range []struct { - mds []MD - want MD - }{ - {[]MD{}, MD{}}, - {[]MD{Pairs("foo", "bar")}, Pairs("foo", "bar")}, - {[]MD{Pairs("foo", "bar"), Pairs("foo", "baz")}, Pairs("foo", "bar", "foo", "baz")}, - {[]MD{Pairs("foo", "bar"), Pairs("foo", "baz"), Pairs("zip", "zap")}, Pairs("foo", "bar", "foo", "baz", "zip", "zap")}, - } { - md := Join(test.mds...) - if !reflect.DeepEqual(md, test.want) { - t.Errorf("context's metadata is %v, want %v", md, test.want) - } - } -} diff --git a/vendor/google.golang.org/grpc/naming/dns_resolver.go b/vendor/google.golang.org/grpc/naming/dns_resolver.go deleted file mode 100644 index 7e69a2c..0000000 --- a/vendor/google.golang.org/grpc/naming/dns_resolver.go +++ /dev/null @@ -1,290 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import ( - "errors" - "fmt" - "net" - "strconv" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc/grpclog" -) - -const ( - defaultPort = "443" - defaultFreq = time.Minute * 30 -) - -var ( - errMissingAddr = errors.New("missing address") - errWatcherClose = errors.New("watcher has been closed") -) - -// NewDNSResolverWithFreq creates a DNS Resolver that can resolve DNS names, and -// create watchers that poll the DNS server using the frequency set by freq. -func NewDNSResolverWithFreq(freq time.Duration) (Resolver, error) { - return &dnsResolver{freq: freq}, nil -} - -// NewDNSResolver creates a DNS Resolver that can resolve DNS names, and create -// watchers that poll the DNS server using the default frequency defined by defaultFreq. -func NewDNSResolver() (Resolver, error) { - return NewDNSResolverWithFreq(defaultFreq) -} - -// dnsResolver handles name resolution for names following the DNS scheme -type dnsResolver struct { - // frequency of polling the DNS server that the watchers created by this resolver will use. - freq time.Duration -} - -// formatIP returns ok = false if addr is not a valid textual representation of an IP address. -// If addr is an IPv4 address, return the addr and ok = true. -// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true. -func formatIP(addr string) (addrIP string, ok bool) { - ip := net.ParseIP(addr) - if ip == nil { - return "", false - } - if ip.To4() != nil { - return addr, true - } - return "[" + addr + "]", true -} - -// parseTarget takes the user input target string, returns formatted host and port info. -// If target doesn't specify a port, set the port to be the defaultPort. -// If target is in IPv6 format and host-name is enclosed in sqarue brackets, brackets -// are strippd when setting the host. -// examples: -// target: "www.google.com" returns host: "www.google.com", port: "443" -// target: "ipv4-host:80" returns host: "ipv4-host", port: "80" -// target: "[ipv6-host]" returns host: "ipv6-host", port: "443" -// target: ":80" returns host: "localhost", port: "80" -// target: ":" returns host: "localhost", port: "443" -func parseTarget(target string) (host, port string, err error) { - if target == "" { - return "", "", errMissingAddr - } - - if ip := net.ParseIP(target); ip != nil { - // target is an IPv4 or IPv6(without brackets) address - return target, defaultPort, nil - } - if host, port, err := net.SplitHostPort(target); err == nil { - // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port - if host == "" { - // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. - host = "localhost" - } - if port == "" { - // If the port field is empty(target ends with colon), e.g. "[::1]:", defaultPort is used. - port = defaultPort - } - return host, port, nil - } - if host, port, err := net.SplitHostPort(target + ":" + defaultPort); err == nil { - // target doesn't have port - return host, port, nil - } - return "", "", fmt.Errorf("invalid target address %v", target) -} - -// Resolve creates a watcher that watches the name resolution of the target. -func (r *dnsResolver) Resolve(target string) (Watcher, error) { - host, port, err := parseTarget(target) - if err != nil { - return nil, err - } - - if net.ParseIP(host) != nil { - ipWatcher := &ipWatcher{ - updateChan: make(chan *Update, 1), - } - host, _ = formatIP(host) - ipWatcher.updateChan <- &Update{Op: Add, Addr: host + ":" + port} - return ipWatcher, nil - } - - ctx, cancel := context.WithCancel(context.Background()) - return &dnsWatcher{ - r: r, - host: host, - port: port, - ctx: ctx, - cancel: cancel, - t: time.NewTimer(0), - }, nil -} - -// dnsWatcher watches for the name resolution update for a specific target -type dnsWatcher struct { - r *dnsResolver - host string - port string - // The latest resolved address set - curAddrs map[string]*Update - ctx context.Context - cancel context.CancelFunc - t *time.Timer -} - -// ipWatcher watches for the name resolution update for an IP address. -type ipWatcher struct { - updateChan chan *Update -} - -// Next returns the adrress resolution Update for the target. For IP address, -// the resolution is itself, thus polling name server is unncessary. Therefore, -// Next() will return an Update the first time it is called, and will be blocked -// for all following calls as no Update exisits until watcher is closed. -func (i *ipWatcher) Next() ([]*Update, error) { - u, ok := <-i.updateChan - if !ok { - return nil, errWatcherClose - } - return []*Update{u}, nil -} - -// Close closes the ipWatcher. -func (i *ipWatcher) Close() { - close(i.updateChan) -} - -// AddressType indicates the address type returned by name resolution. -type AddressType uint8 - -const ( - // Backend indicates the server is a backend server. - Backend AddressType = iota - // GRPCLB indicates the server is a grpclb load balancer. - GRPCLB -) - -// AddrMetadataGRPCLB contains the information the name resolver for grpclb should provide. The -// name resolver used by the grpclb balancer is required to provide this type of metadata in -// its address updates. -type AddrMetadataGRPCLB struct { - // AddrType is the type of server (grpc load balancer or backend). - AddrType AddressType - // ServerName is the name of the grpc load balancer. Used for authentication. - ServerName string -} - -// compileUpdate compares the old resolved addresses and newly resolved addresses, -// and generates an update list -func (w *dnsWatcher) compileUpdate(newAddrs map[string]*Update) []*Update { - var res []*Update - for a, u := range w.curAddrs { - if _, ok := newAddrs[a]; !ok { - u.Op = Delete - res = append(res, u) - } - } - for a, u := range newAddrs { - if _, ok := w.curAddrs[a]; !ok { - res = append(res, u) - } - } - return res -} - -func (w *dnsWatcher) lookupSRV() map[string]*Update { - newAddrs := make(map[string]*Update) - _, srvs, err := lookupSRV(w.ctx, "grpclb", "tcp", w.host) - if err != nil { - grpclog.Infof("grpc: failed dns SRV record lookup due to %v.\n", err) - return nil - } - for _, s := range srvs { - lbAddrs, err := lookupHost(w.ctx, s.Target) - if err != nil { - grpclog.Warningf("grpc: failed load banlacer address dns lookup due to %v.\n", err) - continue - } - for _, a := range lbAddrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + strconv.Itoa(int(s.Port)) - newAddrs[addr] = &Update{Addr: addr, - Metadata: AddrMetadataGRPCLB{AddrType: GRPCLB, ServerName: s.Target}} - } - } - return newAddrs -} - -func (w *dnsWatcher) lookupHost() map[string]*Update { - newAddrs := make(map[string]*Update) - addrs, err := lookupHost(w.ctx, w.host) - if err != nil { - grpclog.Warningf("grpc: failed dns A record lookup due to %v.\n", err) - return nil - } - for _, a := range addrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + w.port - newAddrs[addr] = &Update{Addr: addr} - } - return newAddrs -} - -func (w *dnsWatcher) lookup() []*Update { - newAddrs := w.lookupSRV() - if newAddrs == nil { - // If failed to get any balancer address (either no corresponding SRV for the - // target, or caused by failure during resolution/parsing of the balancer target), - // return any A record info available. - newAddrs = w.lookupHost() - } - result := w.compileUpdate(newAddrs) - w.curAddrs = newAddrs - return result -} - -// Next returns the resolved address update(delta) for the target. If there's no -// change, it will sleep for 30 mins and try to resolve again after that. -func (w *dnsWatcher) Next() ([]*Update, error) { - for { - select { - case <-w.ctx.Done(): - return nil, errWatcherClose - case <-w.t.C: - } - result := w.lookup() - // Next lookup should happen after an interval defined by w.r.freq. - w.t.Reset(w.r.freq) - if len(result) > 0 { - return result, nil - } - } -} - -func (w *dnsWatcher) Close() { - w.cancel() -} diff --git a/vendor/google.golang.org/grpc/naming/dns_resolver_test.go b/vendor/google.golang.org/grpc/naming/dns_resolver_test.go deleted file mode 100644 index be1ac1a..0000000 --- a/vendor/google.golang.org/grpc/naming/dns_resolver_test.go +++ /dev/null @@ -1,315 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import ( - "fmt" - "net" - "reflect" - "sync" - "testing" - "time" -) - -func newUpdateWithMD(op Operation, addr, lb string) *Update { - return &Update{ - Op: op, - Addr: addr, - Metadata: AddrMetadataGRPCLB{AddrType: GRPCLB, ServerName: lb}, - } -} - -func toMap(u []*Update) map[string]*Update { - m := make(map[string]*Update) - for _, v := range u { - m[v.Addr] = v - } - return m -} - -func TestCompileUpdate(t *testing.T) { - tests := []struct { - oldAddrs []string - newAddrs []string - want []*Update - }{ - { - []string{}, - []string{"1.0.0.1"}, - []*Update{{Op: Add, Addr: "1.0.0.1"}}, - }, - { - []string{"1.0.0.1"}, - []string{"1.0.0.1"}, - []*Update{}, - }, - { - []string{"1.0.0.0"}, - []string{"1.0.0.1"}, - []*Update{{Op: Delete, Addr: "1.0.0.0"}, {Op: Add, Addr: "1.0.0.1"}}, - }, - { - []string{"1.0.0.1"}, - []string{"1.0.0.0"}, - []*Update{{Op: Add, Addr: "1.0.0.0"}, {Op: Delete, Addr: "1.0.0.1"}}, - }, - { - []string{"1.0.0.1"}, - []string{"1.0.0.1", "1.0.0.2", "1.0.0.3"}, - []*Update{{Op: Add, Addr: "1.0.0.2"}, {Op: Add, Addr: "1.0.0.3"}}, - }, - { - []string{"1.0.0.1", "1.0.0.2", "1.0.0.3"}, - []string{"1.0.0.0"}, - []*Update{{Op: Add, Addr: "1.0.0.0"}, {Op: Delete, Addr: "1.0.0.1"}, {Op: Delete, Addr: "1.0.0.2"}, {Op: Delete, Addr: "1.0.0.3"}}, - }, - { - []string{"1.0.0.1", "1.0.0.3", "1.0.0.5"}, - []string{"1.0.0.2", "1.0.0.3", "1.0.0.6"}, - []*Update{{Op: Delete, Addr: "1.0.0.1"}, {Op: Add, Addr: "1.0.0.2"}, {Op: Delete, Addr: "1.0.0.5"}, {Op: Add, Addr: "1.0.0.6"}}, - }, - { - []string{"1.0.0.1", "1.0.0.1", "1.0.0.2"}, - []string{"1.0.0.1"}, - []*Update{{Op: Delete, Addr: "1.0.0.2"}}, - }, - } - - var w dnsWatcher - for _, c := range tests { - w.curAddrs = make(map[string]*Update) - newUpdates := make(map[string]*Update) - for _, a := range c.oldAddrs { - w.curAddrs[a] = &Update{Addr: a} - } - for _, a := range c.newAddrs { - newUpdates[a] = &Update{Addr: a} - } - r := w.compileUpdate(newUpdates) - if !reflect.DeepEqual(toMap(c.want), toMap(r)) { - t.Errorf("w(%+v).compileUpdate(%+v) = %+v, want %+v", c.oldAddrs, c.newAddrs, updatesToSlice(r), updatesToSlice(c.want)) - } - } -} - -func TestResolveFunc(t *testing.T) { - tests := []struct { - addr string - want error - }{ - // TODO(yuxuanli): More false cases? - {"www.google.com", nil}, - {"foo.bar:12345", nil}, - {"127.0.0.1", nil}, - {"127.0.0.1:12345", nil}, - {"[::1]:80", nil}, - {"[2001:db8:a0b:12f0::1]:21", nil}, - {":80", nil}, - {"127.0.0...1:12345", nil}, - {"[fe80::1%lo0]:80", nil}, - {"golang.org:http", nil}, - {"[2001:db8::1]:http", nil}, - {":", nil}, - {"", errMissingAddr}, - {"[2001:db8:a0b:12f0::1", fmt.Errorf("invalid target address %v", "[2001:db8:a0b:12f0::1")}, - } - - r, err := NewDNSResolver() - if err != nil { - t.Errorf("%v", err) - } - for _, v := range tests { - _, err := r.Resolve(v.addr) - if !reflect.DeepEqual(err, v.want) { - t.Errorf("Resolve(%q) = %v, want %v", v.addr, err, v.want) - } - } -} - -var hostLookupTbl = map[string][]string{ - "foo.bar.com": {"1.2.3.4", "5.6.7.8"}, - "ipv4.single.fake": {"1.2.3.4"}, - "ipv4.multi.fake": {"1.2.3.4", "5.6.7.8", "9.10.11.12"}, - "ipv6.single.fake": {"2607:f8b0:400a:801::1001"}, - "ipv6.multi.fake": {"2607:f8b0:400a:801::1001", "2607:f8b0:400a:801::1002", "2607:f8b0:400a:801::1003"}, -} - -func hostLookup(host string) ([]string, error) { - if addrs, ok := hostLookupTbl[host]; ok { - return addrs, nil - } - return nil, fmt.Errorf("failed to lookup host:%s resolution in hostLookupTbl", host) -} - -var srvLookupTbl = map[string][]*net.SRV{ - "_grpclb._tcp.srv.ipv4.single.fake": {&net.SRV{Target: "ipv4.single.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv4.multi.fake": {&net.SRV{Target: "ipv4.multi.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv6.single.fake": {&net.SRV{Target: "ipv6.single.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv6.multi.fake": {&net.SRV{Target: "ipv6.multi.fake", Port: 1234}}, -} - -func srvLookup(service, proto, name string) (string, []*net.SRV, error) { - cname := "_" + service + "._" + proto + "." + name - if srvs, ok := srvLookupTbl[cname]; ok { - return cname, srvs, nil - } - return "", nil, fmt.Errorf("failed to lookup srv record for %s in srvLookupTbl", cname) -} - -func updatesToSlice(updates []*Update) []Update { - res := make([]Update, len(updates)) - for i, u := range updates { - res[i] = *u - } - return res -} - -func testResolver(t *testing.T, freq time.Duration, slp time.Duration) { - tests := []struct { - target string - want []*Update - }{ - { - "foo.bar.com", - []*Update{{Op: Add, Addr: "1.2.3.4" + colonDefaultPort}, {Op: Add, Addr: "5.6.7.8" + colonDefaultPort}}, - }, - { - "foo.bar.com:1234", - []*Update{{Op: Add, Addr: "1.2.3.4:1234"}, {Op: Add, Addr: "5.6.7.8:1234"}}, - }, - { - "srv.ipv4.single.fake", - []*Update{newUpdateWithMD(Add, "1.2.3.4:1234", "ipv4.single.fake")}, - }, - { - "srv.ipv4.multi.fake", - []*Update{ - newUpdateWithMD(Add, "1.2.3.4:1234", "ipv4.multi.fake"), - newUpdateWithMD(Add, "5.6.7.8:1234", "ipv4.multi.fake"), - newUpdateWithMD(Add, "9.10.11.12:1234", "ipv4.multi.fake")}, - }, - { - "srv.ipv6.single.fake", - []*Update{newUpdateWithMD(Add, "[2607:f8b0:400a:801::1001]:1234", "ipv6.single.fake")}, - }, - { - "srv.ipv6.multi.fake", - []*Update{ - newUpdateWithMD(Add, "[2607:f8b0:400a:801::1001]:1234", "ipv6.multi.fake"), - newUpdateWithMD(Add, "[2607:f8b0:400a:801::1002]:1234", "ipv6.multi.fake"), - newUpdateWithMD(Add, "[2607:f8b0:400a:801::1003]:1234", "ipv6.multi.fake"), - }, - }, - } - - for _, a := range tests { - r, err := NewDNSResolverWithFreq(freq) - if err != nil { - t.Fatalf("%v\n", err) - } - w, err := r.Resolve(a.target) - if err != nil { - t.Fatalf("%v\n", err) - } - updates, err := w.Next() - if err != nil { - t.Fatalf("%v\n", err) - } - if !reflect.DeepEqual(toMap(a.want), toMap(updates)) { - t.Errorf("Resolve(%q) = %+v, want %+v\n", a.target, updatesToSlice(updates), updatesToSlice(a.want)) - } - var wg sync.WaitGroup - wg.Add(1) - go func() { - defer wg.Done() - for { - _, err := w.Next() - if err != nil { - return - } - t.Error("Execution shouldn't reach here, since w.Next() should be blocked until close happen.") - } - }() - // Sleep for sometime to let watcher do more than one lookup - time.Sleep(slp) - w.Close() - wg.Wait() - } -} - -func TestResolve(t *testing.T) { - defer replaceNetFunc()() - testResolver(t, time.Millisecond*5, time.Millisecond*10) -} - -const colonDefaultPort = ":" + defaultPort - -func TestIPWatcher(t *testing.T) { - tests := []struct { - target string - want []*Update - }{ - {"127.0.0.1", []*Update{{Op: Add, Addr: "127.0.0.1" + colonDefaultPort}}}, - {"127.0.0.1:12345", []*Update{{Op: Add, Addr: "127.0.0.1:12345"}}}, - {"::1", []*Update{{Op: Add, Addr: "[::1]" + colonDefaultPort}}}, - {"[::1]:12345", []*Update{{Op: Add, Addr: "[::1]:12345"}}}, - {"[::1]:", []*Update{{Op: Add, Addr: "[::1]:443"}}}, - {"2001:db8:85a3::8a2e:370:7334", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}}, - {"[2001:db8:85a3::8a2e:370:7334]", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}}, - {"[2001:db8:85a3::8a2e:370:7334]:12345", []*Update{{Op: Add, Addr: "[2001:db8:85a3::8a2e:370:7334]:12345"}}}, - {"[2001:db8::1]:http", []*Update{{Op: Add, Addr: "[2001:db8::1]:http"}}}, - // TODO(yuxuanli): zone support? - } - - for _, v := range tests { - r, err := NewDNSResolverWithFreq(time.Millisecond * 5) - if err != nil { - t.Fatalf("%v\n", err) - } - w, err := r.Resolve(v.target) - if err != nil { - t.Fatalf("%v\n", err) - } - var updates []*Update - var wg sync.WaitGroup - wg.Add(1) - count := 0 - go func() { - defer wg.Done() - for { - u, err := w.Next() - if err != nil { - return - } - updates = u - count++ - } - }() - // Sleep for sometime to let watcher do more than one lookup - time.Sleep(time.Millisecond * 10) - w.Close() - wg.Wait() - if !reflect.DeepEqual(v.want, updates) { - t.Errorf("Resolve(%q) = %v, want %+v\n", v.target, updatesToSlice(updates), updatesToSlice(v.want)) - } - if count != 1 { - t.Errorf("IPWatcher Next() should return only once, not %d times\n", count) - } - } -} diff --git a/vendor/google.golang.org/grpc/naming/go17.go b/vendor/google.golang.org/grpc/naming/go17.go deleted file mode 100644 index 57b65d7..0000000 --- a/vendor/google.golang.org/grpc/naming/go17.go +++ /dev/null @@ -1,34 +0,0 @@ -// +build go1.6,!go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import ( - "net" - - "golang.org/x/net/context" -) - -var ( - lookupHost = func(ctx context.Context, host string) ([]string, error) { return net.LookupHost(host) } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return net.LookupSRV(service, proto, name) - } -) diff --git a/vendor/google.golang.org/grpc/naming/go17_test.go b/vendor/google.golang.org/grpc/naming/go17_test.go deleted file mode 100644 index db39b9a..0000000 --- a/vendor/google.golang.org/grpc/naming/go17_test.go +++ /dev/null @@ -1,42 +0,0 @@ -// +build go1.6, !go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import ( - "net" - - "golang.org/x/net/context" -) - -func replaceNetFunc() func() { - oldLookupHost := lookupHost - oldLookupSRV := lookupSRV - lookupHost = func(ctx context.Context, host string) ([]string, error) { - return hostLookup(host) - } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return srvLookup(service, proto, name) - } - return func() { - lookupHost = oldLookupHost - lookupSRV = oldLookupSRV - } -} diff --git a/vendor/google.golang.org/grpc/naming/go18.go b/vendor/google.golang.org/grpc/naming/go18.go deleted file mode 100644 index b5a0f84..0000000 --- a/vendor/google.golang.org/grpc/naming/go18.go +++ /dev/null @@ -1,28 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import "net" - -var ( - lookupHost = net.DefaultResolver.LookupHost - lookupSRV = net.DefaultResolver.LookupSRV -) diff --git a/vendor/google.golang.org/grpc/naming/go18_test.go b/vendor/google.golang.org/grpc/naming/go18_test.go deleted file mode 100644 index 5e29753..0000000 --- a/vendor/google.golang.org/grpc/naming/go18_test.go +++ /dev/null @@ -1,41 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 naming - -import ( - "context" - "net" -) - -func replaceNetFunc() func() { - oldLookupHost := lookupHost - oldLookupSRV := lookupSRV - lookupHost = func(ctx context.Context, host string) ([]string, error) { - return hostLookup(host) - } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return srvLookup(service, proto, name) - } - return func() { - lookupHost = oldLookupHost - lookupSRV = oldLookupSRV - } -} diff --git a/vendor/google.golang.org/grpc/naming/naming.go b/vendor/google.golang.org/grpc/naming/naming.go deleted file mode 100644 index 1af7e32..0000000 --- a/vendor/google.golang.org/grpc/naming/naming.go +++ /dev/null @@ -1,59 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 naming defines the naming API and related data structures for gRPC. -// The interface is EXPERIMENTAL and may be suject to change. -package naming - -// Operation defines the corresponding operations for a name resolution change. -type Operation uint8 - -const ( - // Add indicates a new address is added. - Add Operation = iota - // Delete indicates an exisiting address is deleted. - Delete -) - -// Update defines a name resolution update. Notice that it is not valid having both -// empty string Addr and nil Metadata in an Update. -type Update struct { - // Op indicates the operation of the update. - Op Operation - // Addr is the updated address. It is empty string if there is no address update. - Addr string - // Metadata is the updated metadata. It is nil if there is no metadata update. - // Metadata is not required for a custom naming implementation. - Metadata interface{} -} - -// Resolver creates a Watcher for a target to track its resolution changes. -type Resolver interface { - // Resolve creates a Watcher for target. - Resolve(target string) (Watcher, error) -} - -// Watcher watches for the updates on the specified target. -type Watcher interface { - // Next blocks until an update or error happens. It may return one or more - // updates. The first call should get the full set of the results. It should - // return an error if and only if Watcher cannot recover. - Next() ([]*Update, error) - // Close closes the Watcher. - Close() -} diff --git a/vendor/google.golang.org/grpc/peer/peer.go b/vendor/google.golang.org/grpc/peer/peer.go deleted file mode 100644 index 317b8b9..0000000 --- a/vendor/google.golang.org/grpc/peer/peer.go +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 peer defines various peer information associated with RPCs and -// corresponding utils. -package peer - -import ( - "net" - - "golang.org/x/net/context" - "google.golang.org/grpc/credentials" -) - -// Peer contains the information of the peer for an RPC, such as the address -// and authentication information. -type Peer struct { - // Addr is the peer address. - Addr net.Addr - // AuthInfo is the authentication information of the transport. - // It is nil if there is no transport security being used. - AuthInfo credentials.AuthInfo -} - -type peerKey struct{} - -// NewContext creates a new context with peer information attached. -func NewContext(ctx context.Context, p *Peer) context.Context { - return context.WithValue(ctx, peerKey{}, p) -} - -// FromContext returns the peer information in ctx if it exists. -func FromContext(ctx context.Context) (p *Peer, ok bool) { - p, ok = ctx.Value(peerKey{}).(*Peer) - return -} diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go deleted file mode 100644 index a543a70..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver.go +++ /dev/null @@ -1,377 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns implements a dns resolver to be installed as the default resolver -// in grpc. -package dns - -import ( - "encoding/json" - "errors" - "fmt" - "math/rand" - "net" - "os" - "strconv" - "strings" - "sync" - "time" - - "golang.org/x/net/context" - "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/resolver" -) - -func init() { - resolver.Register(NewBuilder()) -} - -const ( - defaultPort = "443" - defaultFreq = time.Minute * 30 - golang = "GO" - // In DNS, service config is encoded in a TXT record via the mechanism - // described in RFC-1464 using the attribute name grpc_config. - txtAttribute = "grpc_config=" -) - -var errMissingAddr = errors.New("missing address") - -// NewBuilder creates a dnsBuilder which is used to factory DNS resolvers. -func NewBuilder() resolver.Builder { - return &dnsBuilder{freq: defaultFreq} -} - -type dnsBuilder struct { - // frequency of polling the DNS server. - freq time.Duration -} - -// Build creates and starts a DNS resolver that watches the name resolution of the target. -func (b *dnsBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - host, port, err := parseTarget(target.Endpoint) - if err != nil { - return nil, err - } - - // IP address. - if net.ParseIP(host) != nil { - host, _ = formatIP(host) - addr := []resolver.Address{{Addr: host + ":" + port}} - i := &ipResolver{ - cc: cc, - ip: addr, - rn: make(chan struct{}, 1), - q: make(chan struct{}), - } - cc.NewAddress(addr) - go i.watcher() - return i, nil - } - - // DNS address (non-IP). - ctx, cancel := context.WithCancel(context.Background()) - d := &dnsResolver{ - freq: b.freq, - host: host, - port: port, - ctx: ctx, - cancel: cancel, - cc: cc, - t: time.NewTimer(0), - rn: make(chan struct{}, 1), - } - - d.wg.Add(1) - go d.watcher() - return d, nil -} - -// Scheme returns the naming scheme of this resolver builder, which is "dns". -func (b *dnsBuilder) Scheme() string { - return "dns" -} - -// ipResolver watches for the name resolution update for an IP address. -type ipResolver struct { - cc resolver.ClientConn - ip []resolver.Address - // rn channel is used by ResolveNow() to force an immediate resolution of the target. - rn chan struct{} - q chan struct{} -} - -// ResolveNow resend the address it stores, no resolution is needed. -func (i *ipResolver) ResolveNow(opt resolver.ResolveNowOption) { - select { - case i.rn <- struct{}{}: - default: - } -} - -// Close closes the ipResolver. -func (i *ipResolver) Close() { - close(i.q) -} - -func (i *ipResolver) watcher() { - for { - select { - case <-i.rn: - i.cc.NewAddress(i.ip) - case <-i.q: - return - } - } -} - -// dnsResolver watches for the name resolution update for a non-IP target. -type dnsResolver struct { - freq time.Duration - host string - port string - ctx context.Context - cancel context.CancelFunc - cc resolver.ClientConn - // rn channel is used by ResolveNow() to force an immediate resolution of the target. - rn chan struct{} - t *time.Timer - // wg is used to enforce Close() to return after the watcher() goroutine has finished. - // Otherwise, data race will be possible. [Race Example] in dns_resolver_test we - // replace the real lookup functions with mocked ones to facilitate testing. - // If Close() doesn't wait for watcher() goroutine finishes, race detector sometimes - // will warns lookup (READ the lookup function pointers) inside watcher() goroutine - // has data race with replaceNetFunc (WRITE the lookup function pointers). - wg sync.WaitGroup -} - -// ResolveNow invoke an immediate resolution of the target that this dnsResolver watches. -func (d *dnsResolver) ResolveNow(opt resolver.ResolveNowOption) { - select { - case d.rn <- struct{}{}: - default: - } -} - -// Close closes the dnsResolver. -func (d *dnsResolver) Close() { - d.cancel() - d.wg.Wait() - d.t.Stop() -} - -func (d *dnsResolver) watcher() { - defer d.wg.Done() - for { - select { - case <-d.ctx.Done(): - return - case <-d.t.C: - case <-d.rn: - } - result, sc := d.lookup() - // Next lookup should happen after an interval defined by d.freq. - d.t.Reset(d.freq) - d.cc.NewServiceConfig(string(sc)) - d.cc.NewAddress(result) - } -} - -func (d *dnsResolver) lookupSRV() []resolver.Address { - var newAddrs []resolver.Address - _, srvs, err := lookupSRV(d.ctx, "grpclb", "tcp", d.host) - if err != nil { - grpclog.Infof("grpc: failed dns SRV record lookup due to %v.\n", err) - return nil - } - for _, s := range srvs { - lbAddrs, err := lookupHost(d.ctx, s.Target) - if err != nil { - grpclog.Warningf("grpc: failed load banlacer address dns lookup due to %v.\n", err) - continue - } - for _, a := range lbAddrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + strconv.Itoa(int(s.Port)) - newAddrs = append(newAddrs, resolver.Address{Addr: addr, Type: resolver.GRPCLB, ServerName: s.Target}) - } - } - return newAddrs -} - -func (d *dnsResolver) lookupTXT() string { - ss, err := lookupTXT(d.ctx, d.host) - if err != nil { - grpclog.Warningf("grpc: failed dns TXT record lookup due to %v.\n", err) - return "" - } - var res string - for _, s := range ss { - res += s - } - - // TXT record must have "grpc_config=" attribute in order to be used as service config. - if !strings.HasPrefix(res, txtAttribute) { - grpclog.Warningf("grpc: TXT record %v missing %v attribute", res, txtAttribute) - return "" - } - return strings.TrimPrefix(res, txtAttribute) -} - -func (d *dnsResolver) lookupHost() []resolver.Address { - var newAddrs []resolver.Address - addrs, err := lookupHost(d.ctx, d.host) - if err != nil { - grpclog.Warningf("grpc: failed dns A record lookup due to %v.\n", err) - return nil - } - for _, a := range addrs { - a, ok := formatIP(a) - if !ok { - grpclog.Errorf("grpc: failed IP parsing due to %v.\n", err) - continue - } - addr := a + ":" + d.port - newAddrs = append(newAddrs, resolver.Address{Addr: addr}) - } - return newAddrs -} - -func (d *dnsResolver) lookup() ([]resolver.Address, string) { - var newAddrs []resolver.Address - newAddrs = d.lookupSRV() - // Support fallback to non-balancer address. - newAddrs = append(newAddrs, d.lookupHost()...) - sc := d.lookupTXT() - return newAddrs, canaryingSC(sc) -} - -// formatIP returns ok = false if addr is not a valid textual representation of an IP address. -// If addr is an IPv4 address, return the addr and ok = true. -// If addr is an IPv6 address, return the addr enclosed in square brackets and ok = true. -func formatIP(addr string) (addrIP string, ok bool) { - ip := net.ParseIP(addr) - if ip == nil { - return "", false - } - if ip.To4() != nil { - return addr, true - } - return "[" + addr + "]", true -} - -// parseTarget takes the user input target string, returns formatted host and port info. -// If target doesn't specify a port, set the port to be the defaultPort. -// If target is in IPv6 format and host-name is enclosed in sqarue brackets, brackets -// are strippd when setting the host. -// examples: -// target: "www.google.com" returns host: "www.google.com", port: "443" -// target: "ipv4-host:80" returns host: "ipv4-host", port: "80" -// target: "[ipv6-host]" returns host: "ipv6-host", port: "443" -// target: ":80" returns host: "localhost", port: "80" -// target: ":" returns host: "localhost", port: "443" -func parseTarget(target string) (host, port string, err error) { - if target == "" { - return "", "", errMissingAddr - } - if ip := net.ParseIP(target); ip != nil { - // target is an IPv4 or IPv6(without brackets) address - return target, defaultPort, nil - } - if host, port, err = net.SplitHostPort(target); err == nil { - // target has port, i.e ipv4-host:port, [ipv6-host]:port, host-name:port - if host == "" { - // Keep consistent with net.Dial(): If the host is empty, as in ":80", the local system is assumed. - host = "localhost" - } - if port == "" { - // If the port field is empty(target ends with colon), e.g. "[::1]:", defaultPort is used. - port = defaultPort - } - return host, port, nil - } - if host, port, err = net.SplitHostPort(target + ":" + defaultPort); err == nil { - // target doesn't have port - return host, port, nil - } - return "", "", fmt.Errorf("invalid target address %v, error info: %v", target, err) -} - -type rawChoice struct { - ClientLanguage *[]string `json:"clientLanguage,omitempty"` - Percentage *int `json:"percentage,omitempty"` - ClientHostName *[]string `json:"clientHostName,omitempty"` - ServiceConfig *json.RawMessage `json:"serviceConfig,omitempty"` -} - -func containsString(a *[]string, b string) bool { - if a == nil { - return true - } - for _, c := range *a { - if c == b { - return true - } - } - return false -} - -func chosenByPercentage(a *int) bool { - if a == nil { - return true - } - s := rand.NewSource(time.Now().UnixNano()) - r := rand.New(s) - if r.Intn(100)+1 > *a { - return false - } - return true -} - -func canaryingSC(js string) string { - if js == "" { - return "" - } - var rcs []rawChoice - err := json.Unmarshal([]byte(js), &rcs) - if err != nil { - grpclog.Warningf("grpc: failed to parse service config json string due to %v.\n", err) - return "" - } - cliHostname, err := os.Hostname() - if err != nil { - grpclog.Warningf("grpc: failed to get client hostname due to %v.\n", err) - return "" - } - var sc string - for _, c := range rcs { - if !containsString(c.ClientLanguage, golang) || - !chosenByPercentage(c.Percentage) || - !containsString(c.ClientHostName, cliHostname) || - c.ServiceConfig == nil { - continue - } - sc = string(*c.ServiceConfig) - break - } - return sc -} diff --git a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go b/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go deleted file mode 100644 index 41a9ecb..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/dns_resolver_test.go +++ /dev/null @@ -1,894 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns - -import ( - "fmt" - "net" - "os" - "reflect" - "sync" - "testing" - "time" - - "google.golang.org/grpc/resolver" - "google.golang.org/grpc/test/leakcheck" -) - -func TestMain(m *testing.M) { - cleanup := replaceNetFunc() - code := m.Run() - cleanup() - os.Exit(code) -} - -const ( - txtBytesLimit = 255 -) - -type testClientConn struct { - target string - m1 sync.Mutex - addrs []resolver.Address - a int - m2 sync.Mutex - sc string - s int -} - -func (t *testClientConn) NewAddress(addresses []resolver.Address) { - t.m1.Lock() - defer t.m1.Unlock() - t.addrs = addresses - t.a++ -} - -func (t *testClientConn) getAddress() ([]resolver.Address, int) { - t.m1.Lock() - defer t.m1.Unlock() - return t.addrs, t.a -} - -func (t *testClientConn) NewServiceConfig(serviceConfig string) { - t.m2.Lock() - defer t.m2.Unlock() - t.sc = serviceConfig - t.s++ -} - -func (t *testClientConn) getSc() (string, int) { - t.m2.Lock() - defer t.m2.Unlock() - return t.sc, t.s -} - -var hostLookupTbl = struct { - sync.Mutex - tbl map[string][]string -}{ - tbl: map[string][]string{ - "foo.bar.com": {"1.2.3.4", "5.6.7.8"}, - "ipv4.single.fake": {"1.2.3.4"}, - "srv.ipv4.single.fake": {"2.4.6.8"}, - "ipv4.multi.fake": {"1.2.3.4", "5.6.7.8", "9.10.11.12"}, - "ipv6.single.fake": {"2607:f8b0:400a:801::1001"}, - "ipv6.multi.fake": {"2607:f8b0:400a:801::1001", "2607:f8b0:400a:801::1002", "2607:f8b0:400a:801::1003"}, - }, -} - -func hostLookup(host string) ([]string, error) { - hostLookupTbl.Lock() - defer hostLookupTbl.Unlock() - if addrs, cnt := hostLookupTbl.tbl[host]; cnt { - return addrs, nil - } - return nil, fmt.Errorf("failed to lookup host:%s resolution in hostLookupTbl", host) -} - -var srvLookupTbl = struct { - sync.Mutex - tbl map[string][]*net.SRV -}{ - tbl: map[string][]*net.SRV{ - "_grpclb._tcp.srv.ipv4.single.fake": {&net.SRV{Target: "ipv4.single.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv4.multi.fake": {&net.SRV{Target: "ipv4.multi.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv6.single.fake": {&net.SRV{Target: "ipv6.single.fake", Port: 1234}}, - "_grpclb._tcp.srv.ipv6.multi.fake": {&net.SRV{Target: "ipv6.multi.fake", Port: 1234}}, - }, -} - -func srvLookup(service, proto, name string) (string, []*net.SRV, error) { - cname := "_" + service + "._" + proto + "." + name - srvLookupTbl.Lock() - defer srvLookupTbl.Unlock() - if srvs, cnt := srvLookupTbl.tbl[cname]; cnt { - return cname, srvs, nil - } - return "", nil, fmt.Errorf("failed to lookup srv record for %s in srvLookupTbl", cname) -} - -// div divides a byte slice into a slice of strings, each of which is of maximum -// 255 bytes length, which is the length limit per TXT record in DNS. -func div(b []byte) []string { - var r []string - for i := 0; i < len(b); i += txtBytesLimit { - if i+txtBytesLimit > len(b) { - r = append(r, string(b[i:])) - } else { - r = append(r, string(b[i:i+txtBytesLimit])) - } - } - return r -} - -// scfs contains an array of service config file string in JSON format. -// Notes about the scfs contents and usage: -// scfs contains 4 service config file JSON strings for testing. Inside each -// service config file, there are multiple choices. scfs[0:3] each contains 5 -// choices, and first 3 choices are nonmatching choices based on canarying rule, -// while the last two are matched choices. scfs[3] only contains 3 choices, and -// all of them are nonmatching based on canarying rule. For each of scfs[0:3], -// the eventually returned service config, which is from the first of the two -// matched choices, is stored in the corresponding scs element (e.g. -// scfs[0]->scs[0]). scfs and scs elements are used in pair to test the dns -// resolver functionality, with scfs as the input and scs used for validation of -// the output. For scfs[3], it corresponds to empty service config, since there -// isn't a matched choice. -var scfs = []string{ - `[ - { - "clientLanguage": [ - "CPP", - "JAVA" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "percentage": 0, - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientHostName": [ - "localhost" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientLanguage": [ - "GO" - ], - "percentage": 100, - "serviceConfig": { - "methodConfig": [ - { - "name": [ - { - "method": "bar" - } - ], - "maxRequestMessageBytes": 1024, - "maxResponseMessageBytes": 1024 - } - ] - } - }, - { - "serviceConfig": { - "loadBalancingPolicy": "round_robin", - "methodConfig": [ - { - "name": [ - { - "service": "foo", - "method": "bar" - } - ], - "waitForReady": true - } - ] - } - } -]`, - `[ - { - "clientLanguage": [ - "CPP", - "JAVA" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "percentage": 0, - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientHostName": [ - "localhost" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientLanguage": [ - "GO" - ], - "percentage": 100, - "serviceConfig": { - "methodConfig": [ - { - "name": [ - { - "service": "foo", - "method": "bar" - } - ], - "waitForReady": true, - "timeout": "1s", - "maxRequestMessageBytes": 1024, - "maxResponseMessageBytes": 1024 - } - ] - } - }, - { - "serviceConfig": { - "loadBalancingPolicy": "round_robin", - "methodConfig": [ - { - "name": [ - { - "service": "foo", - "method": "bar" - } - ], - "waitForReady": true - } - ] - } - } -]`, - `[ - { - "clientLanguage": [ - "CPP", - "JAVA" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "percentage": 0, - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientHostName": [ - "localhost" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientLanguage": [ - "GO" - ], - "percentage": 100, - "serviceConfig": { - "loadBalancingPolicy": "round_robin", - "methodConfig": [ - { - "name": [ - { - "service": "foo" - } - ], - "waitForReady": true, - "timeout": "1s" - }, - { - "name": [ - { - "service": "bar" - } - ], - "waitForReady": false - } - ] - } - }, - { - "serviceConfig": { - "loadBalancingPolicy": "round_robin", - "methodConfig": [ - { - "name": [ - { - "service": "foo", - "method": "bar" - } - ], - "waitForReady": true - } - ] - } - } -]`, - `[ - { - "clientLanguage": [ - "CPP", - "JAVA" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "percentage": 0, - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - }, - { - "clientHostName": [ - "localhost" - ], - "serviceConfig": { - "loadBalancingPolicy": "grpclb", - "methodConfig": [ - { - "name": [ - { - "service": "all" - } - ], - "timeout": "1s" - } - ] - } - } -]`, -} - -// scs contains an array of service config string in JSON format. -var scs = []string{ - `{ - "methodConfig": [ - { - "name": [ - { - "method": "bar" - } - ], - "maxRequestMessageBytes": 1024, - "maxResponseMessageBytes": 1024 - } - ] - }`, - `{ - "methodConfig": [ - { - "name": [ - { - "service": "foo", - "method": "bar" - } - ], - "waitForReady": true, - "timeout": "1s", - "maxRequestMessageBytes": 1024, - "maxResponseMessageBytes": 1024 - } - ] - }`, - `{ - "loadBalancingPolicy": "round_robin", - "methodConfig": [ - { - "name": [ - { - "service": "foo" - } - ], - "waitForReady": true, - "timeout": "1s" - }, - { - "name": [ - { - "service": "bar" - } - ], - "waitForReady": false - } - ] - }`, -} - -// scLookupTbl is a set, which contains targets that have service config. Target -// not in this set should not have service config. -var scLookupTbl = map[string]bool{ - "foo.bar.com": true, - "srv.ipv4.single.fake": true, - "srv.ipv4.multi.fake": true, - "no.attribute": true, -} - -// generateSCF generates a slice of strings (aggregately representing a single -// service config file) for the input name, which mocks the result from a real -// DNS TXT record lookup. -func generateSCF(name string) []string { - var b []byte - switch name { - case "foo.bar.com": - b = []byte(scfs[0]) - case "srv.ipv4.single.fake": - b = []byte(scfs[1]) - case "srv.ipv4.multi.fake": - b = []byte(scfs[2]) - default: - b = []byte(scfs[3]) - } - if name == "no.attribute" { - return div(b) - } - return div(append([]byte(txtAttribute), b...)) -} - -// generateSC returns a service config string in JSON format for the input name. -func generateSC(name string) string { - _, cnt := scLookupTbl[name] - if !cnt || name == "no.attribute" { - return "" - } - switch name { - case "foo.bar.com": - return scs[0] - case "srv.ipv4.single.fake": - return scs[1] - case "srv.ipv4.multi.fake": - return scs[2] - default: - return "" - } -} - -var txtLookupTbl = struct { - sync.Mutex - tbl map[string][]string -}{ - tbl: map[string][]string{ - "foo.bar.com": generateSCF("foo.bar.com"), - "srv.ipv4.single.fake": generateSCF("srv.ipv4.single.fake"), - "srv.ipv4.multi.fake": generateSCF("srv.ipv4.multi.fake"), - "srv.ipv6.single.fake": generateSCF("srv.ipv6.single.fake"), - "srv.ipv6.multi.fake": generateSCF("srv.ipv6.multi.fake"), - "no.attribute": generateSCF("no.attribute"), - }, -} - -func txtLookup(host string) ([]string, error) { - txtLookupTbl.Lock() - defer txtLookupTbl.Unlock() - if scs, cnt := txtLookupTbl.tbl[host]; cnt { - return scs, nil - } - return nil, fmt.Errorf("failed to lookup TXT:%s resolution in txtLookupTbl", host) -} - -func TestResolve(t *testing.T) { - testDNSResolver(t) - testDNSResolveNow(t) - testIPResolver(t) -} - -func testDNSResolver(t *testing.T) { - defer leakcheck.Check(t) - tests := []struct { - target string - addrWant []resolver.Address - scWant string - }{ - { - "foo.bar.com", - []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}}, - generateSC("foo.bar.com"), - }, - { - "foo.bar.com:1234", - []resolver.Address{{Addr: "1.2.3.4:1234"}, {Addr: "5.6.7.8:1234"}}, - generateSC("foo.bar.com"), - }, - { - "srv.ipv4.single.fake", - []resolver.Address{{Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.single.fake"}, {Addr: "2.4.6.8" + colonDefaultPort}}, - generateSC("srv.ipv4.single.fake"), - }, - { - "srv.ipv4.multi.fake", - []resolver.Address{ - {Addr: "1.2.3.4:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"}, - {Addr: "5.6.7.8:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"}, - {Addr: "9.10.11.12:1234", Type: resolver.GRPCLB, ServerName: "ipv4.multi.fake"}, - }, - generateSC("srv.ipv4.multi.fake"), - }, - { - "srv.ipv6.single.fake", - []resolver.Address{{Addr: "[2607:f8b0:400a:801::1001]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.single.fake"}}, - generateSC("srv.ipv6.single.fake"), - }, - { - "srv.ipv6.multi.fake", - []resolver.Address{ - {Addr: "[2607:f8b0:400a:801::1001]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"}, - {Addr: "[2607:f8b0:400a:801::1002]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"}, - {Addr: "[2607:f8b0:400a:801::1003]:1234", Type: resolver.GRPCLB, ServerName: "ipv6.multi.fake"}, - }, - generateSC("srv.ipv6.multi.fake"), - }, - { - "no.attribute", - nil, - generateSC("no.attribute"), - }, - } - - for _, a := range tests { - b := NewBuilder() - cc := &testClientConn{target: a.target} - r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{}) - if err != nil { - t.Fatalf("%v\n", err) - } - var addrs []resolver.Address - var cnt int - for { - addrs, cnt = cc.getAddress() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) - } - var sc string - for { - sc, cnt = cc.getSc() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) - } - if !reflect.DeepEqual(a.addrWant, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant) - } - if !reflect.DeepEqual(a.scWant, sc) { - t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) - } - r.Close() - } -} - -func mutateTbl(target string) func() { - hostLookupTbl.Lock() - oldHostTblEntry := hostLookupTbl.tbl[target] - hostLookupTbl.tbl[target] = hostLookupTbl.tbl[target][:len(oldHostTblEntry)-1] - hostLookupTbl.Unlock() - txtLookupTbl.Lock() - oldTxtTblEntry := txtLookupTbl.tbl[target] - txtLookupTbl.tbl[target] = []string{""} - txtLookupTbl.Unlock() - - return func() { - hostLookupTbl.Lock() - hostLookupTbl.tbl[target] = oldHostTblEntry - hostLookupTbl.Unlock() - txtLookupTbl.Lock() - txtLookupTbl.tbl[target] = oldTxtTblEntry - txtLookupTbl.Unlock() - } -} - -func testDNSResolveNow(t *testing.T) { - defer leakcheck.Check(t) - tests := []struct { - target string - addrWant []resolver.Address - addrNext []resolver.Address - scWant string - scNext string - }{ - { - "foo.bar.com", - []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}, {Addr: "5.6.7.8" + colonDefaultPort}}, - []resolver.Address{{Addr: "1.2.3.4" + colonDefaultPort}}, - generateSC("foo.bar.com"), - "", - }, - } - - for _, a := range tests { - b := NewBuilder() - cc := &testClientConn{target: a.target} - r, err := b.Build(resolver.Target{Endpoint: a.target}, cc, resolver.BuildOption{}) - if err != nil { - t.Fatalf("%v\n", err) - } - var addrs []resolver.Address - var cnt int - for { - addrs, cnt = cc.getAddress() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) - } - var sc string - for { - sc, cnt = cc.getSc() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) - } - if !reflect.DeepEqual(a.addrWant, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrWant) - } - if !reflect.DeepEqual(a.scWant, sc) { - t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scWant) - } - revertTbl := mutateTbl(a.target) - r.ResolveNow(resolver.ResolveNowOption{}) - for { - addrs, cnt = cc.getAddress() - if cnt == 2 { - break - } - time.Sleep(time.Millisecond) - } - for { - sc, cnt = cc.getSc() - if cnt == 2 { - break - } - time.Sleep(time.Millisecond) - } - if !reflect.DeepEqual(a.addrNext, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", a.target, addrs, a.addrNext) - } - if !reflect.DeepEqual(a.scNext, sc) { - t.Errorf("Resolved service config of target: %q = %+v, want %+v\n", a.target, sc, a.scNext) - } - revertTbl() - r.Close() - } -} - -const colonDefaultPort = ":" + defaultPort - -func testIPResolver(t *testing.T) { - defer leakcheck.Check(t) - tests := []struct { - target string - want []resolver.Address - }{ - {"127.0.0.1", []resolver.Address{{Addr: "127.0.0.1" + colonDefaultPort}}}, - {"127.0.0.1:12345", []resolver.Address{{Addr: "127.0.0.1:12345"}}}, - {"::1", []resolver.Address{{Addr: "[::1]" + colonDefaultPort}}}, - {"[::1]:12345", []resolver.Address{{Addr: "[::1]:12345"}}}, - {"[::1]:", []resolver.Address{{Addr: "[::1]:443"}}}, - {"2001:db8:85a3::8a2e:370:7334", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}}, - {"[2001:db8:85a3::8a2e:370:7334]", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]" + colonDefaultPort}}}, - {"[2001:db8:85a3::8a2e:370:7334]:12345", []resolver.Address{{Addr: "[2001:db8:85a3::8a2e:370:7334]:12345"}}}, - {"[2001:db8::1]:http", []resolver.Address{{Addr: "[2001:db8::1]:http"}}}, - // TODO(yuxuanli): zone support? - } - - for _, v := range tests { - b := NewBuilder() - cc := &testClientConn{target: v.target} - r, err := b.Build(resolver.Target{Endpoint: v.target}, cc, resolver.BuildOption{}) - if err != nil { - t.Fatalf("%v\n", err) - } - var addrs []resolver.Address - var cnt int - for { - addrs, cnt = cc.getAddress() - if cnt > 0 { - break - } - time.Sleep(time.Millisecond) - } - if !reflect.DeepEqual(v.want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want) - } - r.ResolveNow(resolver.ResolveNowOption{}) - for { - addrs, cnt = cc.getAddress() - if cnt == 2 { - break - } - time.Sleep(time.Millisecond) - } - if !reflect.DeepEqual(v.want, addrs) { - t.Errorf("Resolved addresses of target: %q = %+v, want %+v\n", v.target, addrs, v.want) - } - r.Close() - } -} - -func TestResolveFunc(t *testing.T) { - defer leakcheck.Check(t) - tests := []struct { - addr string - want error - }{ - // TODO(yuxuanli): More false cases? - {"www.google.com", nil}, - {"foo.bar:12345", nil}, - {"127.0.0.1", nil}, - {"127.0.0.1:12345", nil}, - {"[::1]:80", nil}, - {"[2001:db8:a0b:12f0::1]:21", nil}, - {":80", nil}, - {"127.0.0...1:12345", nil}, - {"[fe80::1%lo0]:80", nil}, - {"golang.org:http", nil}, - {"[2001:db8::1]:http", nil}, - {":", nil}, - {"", errMissingAddr}, - {"[2001:db8:a0b:12f0::1", errForInvalidTarget}, - } - - b := NewBuilder() - for _, v := range tests { - cc := &testClientConn{target: v.addr} - r, err := b.Build(resolver.Target{Endpoint: v.addr}, cc, resolver.BuildOption{}) - if err == nil { - r.Close() - } - if !reflect.DeepEqual(err, v.want) { - t.Errorf("Build(%q, cc, resolver.BuildOption{}) = %v, want %v", v.addr, err, v.want) - } - } -} diff --git a/vendor/google.golang.org/grpc/resolver/dns/go17.go b/vendor/google.golang.org/grpc/resolver/dns/go17.go deleted file mode 100644 index b466bc8..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/go17.go +++ /dev/null @@ -1,35 +0,0 @@ -// +build go1.6, !go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns - -import ( - "net" - - "golang.org/x/net/context" -) - -var ( - lookupHost = func(ctx context.Context, host string) ([]string, error) { return net.LookupHost(host) } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return net.LookupSRV(service, proto, name) - } - lookupTXT = func(ctx context.Context, name string) ([]string, error) { return net.LookupTXT(name) } -) diff --git a/vendor/google.golang.org/grpc/resolver/dns/go17_test.go b/vendor/google.golang.org/grpc/resolver/dns/go17_test.go deleted file mode 100644 index 21eaa88..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/go17_test.go +++ /dev/null @@ -1,50 +0,0 @@ -// +build go1.6, !go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns - -import ( - "fmt" - "net" - - "golang.org/x/net/context" -) - -var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: missing ']' in address [2001:db8:a0b:12f0::1:443") - -func replaceNetFunc() func() { - oldLookupHost := lookupHost - oldLookupSRV := lookupSRV - oldLookupTXT := lookupTXT - lookupHost = func(ctx context.Context, host string) ([]string, error) { - return hostLookup(host) - } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return srvLookup(service, proto, name) - } - lookupTXT = func(ctx context.Context, host string) ([]string, error) { - return txtLookup(host) - } - return func() { - lookupHost = oldLookupHost - lookupSRV = oldLookupSRV - lookupTXT = oldLookupTXT - } -} diff --git a/vendor/google.golang.org/grpc/resolver/dns/go18.go b/vendor/google.golang.org/grpc/resolver/dns/go18.go deleted file mode 100644 index fa34f14..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/go18.go +++ /dev/null @@ -1,29 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns - -import "net" - -var ( - lookupHost = net.DefaultResolver.LookupHost - lookupSRV = net.DefaultResolver.LookupSRV - lookupTXT = net.DefaultResolver.LookupTXT -) diff --git a/vendor/google.golang.org/grpc/resolver/dns/go18_test.go b/vendor/google.golang.org/grpc/resolver/dns/go18_test.go deleted file mode 100644 index b0149c8..0000000 --- a/vendor/google.golang.org/grpc/resolver/dns/go18_test.go +++ /dev/null @@ -1,49 +0,0 @@ -// +build go1.8 - -/* - * - * Copyright 2017 gRPC authors. - * - * 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 dns - -import ( - "context" - "fmt" - "net" -) - -var errForInvalidTarget = fmt.Errorf("invalid target address [2001:db8:a0b:12f0::1, error info: address [2001:db8:a0b:12f0::1:443: missing ']' in address") - -func replaceNetFunc() func() { - oldLookupHost := lookupHost - oldLookupSRV := lookupSRV - oldLookupTXT := lookupTXT - lookupHost = func(ctx context.Context, host string) ([]string, error) { - return hostLookup(host) - } - lookupSRV = func(ctx context.Context, service, proto, name string) (string, []*net.SRV, error) { - return srvLookup(service, proto, name) - } - lookupTXT = func(ctx context.Context, host string) ([]string, error) { - return txtLookup(host) - } - return func() { - lookupHost = oldLookupHost - lookupSRV = oldLookupSRV - lookupTXT = oldLookupTXT - } -} diff --git a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go b/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go deleted file mode 100644 index b76010d..0000000 --- a/vendor/google.golang.org/grpc/resolver/passthrough/passthrough.go +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 passthrough implements a pass-through resolver. It sends the target -// name without scheme back to gRPC as resolved address. -package passthrough - -import "google.golang.org/grpc/resolver" - -const scheme = "passthrough" - -type passthroughBuilder struct{} - -func (*passthroughBuilder) Build(target resolver.Target, cc resolver.ClientConn, opts resolver.BuildOption) (resolver.Resolver, error) { - r := &passthroughResolver{ - target: target, - cc: cc, - } - r.start() - return r, nil -} - -func (*passthroughBuilder) Scheme() string { - return scheme -} - -type passthroughResolver struct { - target resolver.Target - cc resolver.ClientConn -} - -func (r *passthroughResolver) start() { - r.cc.NewAddress([]resolver.Address{{Addr: r.target.Endpoint}}) -} - -func (*passthroughResolver) ResolveNow(o resolver.ResolveNowOption) {} - -func (*passthroughResolver) Close() {} - -func init() { - resolver.Register(&passthroughBuilder{}) -} diff --git a/vendor/google.golang.org/grpc/resolver/resolver.go b/vendor/google.golang.org/grpc/resolver/resolver.go deleted file mode 100644 index df097ee..0000000 --- a/vendor/google.golang.org/grpc/resolver/resolver.go +++ /dev/null @@ -1,155 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 resolver defines APIs for name resolution in gRPC. -// All APIs in this package are experimental. -package resolver - -var ( - // m is a map from scheme to resolver builder. - m = make(map[string]Builder) - // defaultScheme is the default scheme to use. - defaultScheme = "passthrough" -) - -// TODO(bar) install dns resolver in init(){}. - -// Register registers the resolver builder to the resolver map. -// b.Scheme will be used as the scheme registered with this builder. -func Register(b Builder) { - m[b.Scheme()] = b -} - -// Get returns the resolver builder registered with the given scheme. -// If no builder is register with the scheme, the default scheme will -// be used. -// If the default scheme is not modified, "passthrough" will be the default -// scheme, and the preinstalled dns resolver will be used. -// If the default scheme is modified, and a resolver is registered with -// the scheme, that resolver will be returned. -// If the default scheme is modified, and no resolver is registered with -// the scheme, nil will be returned. -func Get(scheme string) Builder { - if b, ok := m[scheme]; ok { - return b - } - if b, ok := m[defaultScheme]; ok { - return b - } - return nil -} - -// SetDefaultScheme sets the default scheme that will be used. -// The default default scheme is "passthrough". -func SetDefaultScheme(scheme string) { - defaultScheme = scheme -} - -// AddressType indicates the address type returned by name resolution. -type AddressType uint8 - -const ( - // Backend indicates the address is for a backend server. - Backend AddressType = iota - // GRPCLB indicates the address is for a grpclb load balancer. - GRPCLB -) - -// Address represents a server the client connects to. -// This is the EXPERIMENTAL API and may be changed or extended in the future. -type Address struct { - // Addr is the server address on which a connection will be established. - Addr string - // Type is the type of this address. - Type AddressType - // ServerName is the name of this address. - // - // e.g. if Type is GRPCLB, ServerName should be the name of the remote load - // balancer, not the name of the backend. - ServerName string - // Metadata is the information associated with Addr, which may be used - // to make load balancing decision. - Metadata interface{} -} - -// BuildOption includes additional information for the builder to create -// the resolver. -type BuildOption struct { - // UserOptions can be used to pass configuration between DialOptions and the - // resolver. - UserOptions interface{} -} - -// ClientConn contains the callbacks for resolver to notify any updates -// to the gRPC ClientConn. -// -// This interface is to be implemented by gRPC. Users should not need a -// brand new implementation of this interface. For the situations like -// testing, the new implementation should embed this interface. This allows -// gRPC to add new methods to this interface. -type ClientConn interface { - // NewAddress is called by resolver to notify ClientConn a new list - // of resolved addresses. - // The address list should be the complete list of resolved addresses. - NewAddress(addresses []Address) - // NewServiceConfig is called by resolver to notify ClientConn a new - // service config. The service config should be provided as a json string. - NewServiceConfig(serviceConfig string) -} - -// Target represents a target for gRPC, as specified in: -// https://github.com/grpc/grpc/blob/master/doc/naming.md. -type Target struct { - Scheme string - Authority string - Endpoint string -} - -// Builder creates a resolver that will be used to watch name resolution updates. -type Builder interface { - // Build creates a new resolver for the given target. - // - // gRPC dial calls Build synchronously, and fails if the returned error is - // not nil. - Build(target Target, cc ClientConn, opts BuildOption) (Resolver, error) - // Scheme returns the scheme supported by this resolver. - // Scheme is defined at https://github.com/grpc/grpc/blob/master/doc/naming.md. - Scheme() string -} - -// ResolveNowOption includes additional information for ResolveNow. -type ResolveNowOption struct{} - -// Resolver watches for the updates on the specified target. -// Updates include address updates and service config updates. -type Resolver interface { - // ResolveNow will be called by gRPC to try to resolve the target name - // again. It's just a hint, resolver can ignore this if it's not necessary. - // - // It could be called multiple times concurrently. - ResolveNow(ResolveNowOption) - // Close closes the resolver. - Close() -} - -// UnregisterForTesting removes the resolver builder with the given scheme from the -// resolver map. -// This function is for testing only. -func UnregisterForTesting(scheme string) { - delete(m, scheme) -} diff --git a/vendor/google.golang.org/grpc/stats/handlers.go b/vendor/google.golang.org/grpc/stats/handlers.go deleted file mode 100644 index 05b384c..0000000 --- a/vendor/google.golang.org/grpc/stats/handlers.go +++ /dev/null @@ -1,64 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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 stats - -import ( - "net" - - "golang.org/x/net/context" -) - -// ConnTagInfo defines the relevant information needed by connection context tagger. -type ConnTagInfo struct { - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr -} - -// RPCTagInfo defines the relevant information needed by RPC context tagger. -type RPCTagInfo struct { - // FullMethodName is the RPC method in the format of /package.service/method. - FullMethodName string - // FailFast indicates if this RPC is failfast. - // This field is only valid on client side, it's always false on server side. - FailFast bool -} - -// Handler defines the interface for the related stats handling (e.g., RPCs, connections). -type Handler interface { - // TagRPC can attach some information to the given context. - // The context used for the rest lifetime of the RPC will be derived from - // the returned context. - TagRPC(context.Context, *RPCTagInfo) context.Context - // HandleRPC processes the RPC stats. - HandleRPC(context.Context, RPCStats) - - // TagConn can attach some information to the given context. - // The returned context will be used for stats handling. - // For conn stats handling, the context used in HandleConn for this - // connection will be derived from the context returned. - // For RPC stats handling, - // - On server side, the context used in HandleRPC for all RPCs on this - // connection will be derived from the context returned. - // - On client side, the context is not derived from the context returned. - TagConn(context.Context, *ConnTagInfo) context.Context - // HandleConn processes the Conn stats. - HandleConn(context.Context, ConnStats) -} diff --git a/vendor/google.golang.org/grpc/stats/stats.go b/vendor/google.golang.org/grpc/stats/stats.go deleted file mode 100644 index d5aa2f7..0000000 --- a/vendor/google.golang.org/grpc/stats/stats.go +++ /dev/null @@ -1,294 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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. - * - */ - -//go:generate protoc --go_out=plugins=grpc:. grpc_testing/test.proto - -// Package stats is for collecting and reporting various network and RPC stats. -// This package is for monitoring purpose only. All fields are read-only. -// All APIs are experimental. -package stats // import "google.golang.org/grpc/stats" - -import ( - "net" - "time" - - "golang.org/x/net/context" -) - -// RPCStats contains stats information about RPCs. -type RPCStats interface { - isRPCStats() - // IsClient returns true if this RPCStats is from client side. - IsClient() bool -} - -// Begin contains stats when an RPC begins. -// FailFast is only valid if this Begin is from client side. -type Begin struct { - // Client is true if this Begin is from client side. - Client bool - // BeginTime is the time when the RPC begins. - BeginTime time.Time - // FailFast indicates if this RPC is failfast. - FailFast bool -} - -// IsClient indicates if the stats information is from client side. -func (s *Begin) IsClient() bool { return s.Client } - -func (s *Begin) isRPCStats() {} - -// InPayload contains the information for an incoming payload. -type InPayload struct { - // Client is true if this InPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // RecvTime is the time when the payload is received. - RecvTime time.Time -} - -// IsClient indicates if the stats information is from client side. -func (s *InPayload) IsClient() bool { return s.Client } - -func (s *InPayload) isRPCStats() {} - -// InHeader contains stats when a header is received. -type InHeader struct { - // Client is true if this InHeader is from client side. - Client bool - // WireLength is the wire length of header. - WireLength int - - // The following fields are valid only if Client is false. - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if the stats information is from client side. -func (s *InHeader) IsClient() bool { return s.Client } - -func (s *InHeader) isRPCStats() {} - -// InTrailer contains stats when a trailer is received. -type InTrailer struct { - // Client is true if this InTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if the stats information is from client side. -func (s *InTrailer) IsClient() bool { return s.Client } - -func (s *InTrailer) isRPCStats() {} - -// OutPayload contains the information for an outgoing payload. -type OutPayload struct { - // Client is true if this OutPayload is from client side. - Client bool - // Payload is the payload with original type. - Payload interface{} - // Data is the serialized message payload. - Data []byte - // Length is the length of uncompressed data. - Length int - // WireLength is the length of data on wire (compressed, signed, encrypted). - WireLength int - // SentTime is the time when the payload is sent. - SentTime time.Time -} - -// IsClient indicates if this stats information is from client side. -func (s *OutPayload) IsClient() bool { return s.Client } - -func (s *OutPayload) isRPCStats() {} - -// OutHeader contains stats when a header is sent. -type OutHeader struct { - // Client is true if this OutHeader is from client side. - Client bool - - // The following fields are valid only if Client is true. - // FullMethod is the full RPC method string, i.e., /package.service/method. - FullMethod string - // RemoteAddr is the remote address of the corresponding connection. - RemoteAddr net.Addr - // LocalAddr is the local address of the corresponding connection. - LocalAddr net.Addr - // Compression is the compression algorithm used for the RPC. - Compression string -} - -// IsClient indicates if this stats information is from client side. -func (s *OutHeader) IsClient() bool { return s.Client } - -func (s *OutHeader) isRPCStats() {} - -// OutTrailer contains stats when a trailer is sent. -type OutTrailer struct { - // Client is true if this OutTrailer is from client side. - Client bool - // WireLength is the wire length of trailer. - WireLength int -} - -// IsClient indicates if this stats information is from client side. -func (s *OutTrailer) IsClient() bool { return s.Client } - -func (s *OutTrailer) isRPCStats() {} - -// End contains stats when an RPC ends. -type End struct { - // Client is true if this End is from client side. - Client bool - // EndTime is the time when the RPC ends. - EndTime time.Time - // Error is the error the RPC ended with. It is an error generated from - // status.Status and can be converted back to status.Status using - // status.FromError if non-nil. - Error error -} - -// IsClient indicates if this is from client side. -func (s *End) IsClient() bool { return s.Client } - -func (s *End) isRPCStats() {} - -// ConnStats contains stats information about connections. -type ConnStats interface { - isConnStats() - // IsClient returns true if this ConnStats is from client side. - IsClient() bool -} - -// ConnBegin contains the stats of a connection when it is established. -type ConnBegin struct { - // Client is true if this ConnBegin is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnBegin) IsClient() bool { return s.Client } - -func (s *ConnBegin) isConnStats() {} - -// ConnEnd contains the stats of a connection when it ends. -type ConnEnd struct { - // Client is true if this ConnEnd is from client side. - Client bool -} - -// IsClient indicates if this is from client side. -func (s *ConnEnd) IsClient() bool { return s.Client } - -func (s *ConnEnd) isConnStats() {} - -type incomingTagsKey struct{} -type outgoingTagsKey struct{} - -// SetTags attaches stats tagging data to the context, which will be sent in -// the outgoing RPC with the header grpc-tags-bin. Subsequent calls to -// SetTags will overwrite the values from earlier calls. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func SetTags(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, outgoingTagsKey{}, b) -} - -// Tags returns the tags from the context for the inbound RPC. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func Tags(ctx context.Context) []byte { - b, _ := ctx.Value(incomingTagsKey{}).([]byte) - return b -} - -// SetIncomingTags attaches stats tagging data to the context, to be read by -// the application (not sent in outgoing RPCs). -// -// This is intended for gRPC-internal use ONLY. -func SetIncomingTags(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, incomingTagsKey{}, b) -} - -// OutgoingTags returns the tags from the context for the outbound RPC. -// -// This is intended for gRPC-internal use ONLY. -func OutgoingTags(ctx context.Context) []byte { - b, _ := ctx.Value(outgoingTagsKey{}).([]byte) - return b -} - -type incomingTraceKey struct{} -type outgoingTraceKey struct{} - -// SetTrace attaches stats tagging data to the context, which will be sent in -// the outgoing RPC with the header grpc-trace-bin. Subsequent calls to -// SetTrace will overwrite the values from earlier calls. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func SetTrace(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, outgoingTraceKey{}, b) -} - -// Trace returns the trace from the context for the inbound RPC. -// -// NOTE: this is provided only for backward compatibility with existing clients -// and will likely be removed in an upcoming release. New uses should transmit -// this type of data using metadata with a different, non-reserved (i.e. does -// not begin with "grpc-") header name. -func Trace(ctx context.Context) []byte { - b, _ := ctx.Value(incomingTraceKey{}).([]byte) - return b -} - -// SetIncomingTrace attaches stats tagging data to the context, to be read by -// the application (not sent in outgoing RPCs). It is intended for -// gRPC-internal use. -func SetIncomingTrace(ctx context.Context, b []byte) context.Context { - return context.WithValue(ctx, incomingTraceKey{}, b) -} - -// OutgoingTrace returns the trace from the context for the outbound RPC. It is -// intended for gRPC-internal use. -func OutgoingTrace(ctx context.Context) []byte { - b, _ := ctx.Value(outgoingTraceKey{}).([]byte) - return b -} diff --git a/vendor/google.golang.org/grpc/stats/stats_test.go b/vendor/google.golang.org/grpc/stats/stats_test.go deleted file mode 100644 index fef0d7c..0000000 --- a/vendor/google.golang.org/grpc/stats/stats_test.go +++ /dev/null @@ -1,1275 +0,0 @@ -// +build go1.7 - -/* - * - * Copyright 2016 gRPC authors. - * - * 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 stats_test - -import ( - "fmt" - "io" - "net" - "reflect" - "sync" - "testing" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "google.golang.org/grpc" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - testpb "google.golang.org/grpc/stats/grpc_testing" - "google.golang.org/grpc/status" -) - -func init() { - grpc.EnableTracing = false -} - -type connCtxKey struct{} -type rpcCtxKey struct{} - -var ( - // For headers: - testMetadata = metadata.MD{ - "key1": []string{"value1"}, - "key2": []string{"value2"}, - } - // For trailers: - testTrailerMetadata = metadata.MD{ - "tkey1": []string{"trailerValue1"}, - "tkey2": []string{"trailerValue2"}, - } - // The id for which the service handler should return error. - errorID int32 = 32202 -) - -type testServer struct{} - -func (s *testServer) UnaryCall(ctx context.Context, in *testpb.SimpleRequest) (*testpb.SimpleResponse, error) { - md, ok := metadata.FromIncomingContext(ctx) - if ok { - if err := grpc.SendHeader(ctx, md); err != nil { - return nil, status.Errorf(status.Code(err), "grpc.SendHeader(_, %v) = %v, want ", md, err) - } - if err := grpc.SetTrailer(ctx, testTrailerMetadata); err != nil { - return nil, status.Errorf(status.Code(err), "grpc.SetTrailer(_, %v) = %v, want ", testTrailerMetadata, err) - } - } - - if in.Id == errorID { - return nil, fmt.Errorf("got error id: %v", in.Id) - } - - return &testpb.SimpleResponse{Id: in.Id}, nil -} - -func (s *testServer) FullDuplexCall(stream testpb.TestService_FullDuplexCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) - } - for { - in, err := stream.Recv() - if err == io.EOF { - // read done. - return nil - } - if err != nil { - return err - } - - if in.Id == errorID { - return fmt.Errorf("got error id: %v", in.Id) - } - - if err := stream.Send(&testpb.SimpleResponse{Id: in.Id}); err != nil { - return err - } - } -} - -func (s *testServer) ClientStreamCall(stream testpb.TestService_ClientStreamCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) - } - for { - in, err := stream.Recv() - if err == io.EOF { - // read done. - return stream.SendAndClose(&testpb.SimpleResponse{Id: int32(0)}) - } - if err != nil { - return err - } - - if in.Id == errorID { - return fmt.Errorf("got error id: %v", in.Id) - } - } -} - -func (s *testServer) ServerStreamCall(in *testpb.SimpleRequest, stream testpb.TestService_ServerStreamCallServer) error { - md, ok := metadata.FromIncomingContext(stream.Context()) - if ok { - if err := stream.SendHeader(md); err != nil { - return status.Errorf(status.Code(err), "%v.SendHeader(%v) = %v, want %v", stream, md, err, nil) - } - stream.SetTrailer(testTrailerMetadata) - } - - if in.Id == errorID { - return fmt.Errorf("got error id: %v", in.Id) - } - - for i := 0; i < 5; i++ { - if err := stream.Send(&testpb.SimpleResponse{Id: in.Id}); err != nil { - return err - } - } - return nil -} - -// test is an end-to-end test. It should be created with the newTest -// func, modified as needed, and then started with its startServer method. -// It should be cleaned up with the tearDown method. -type test struct { - t *testing.T - compress string - clientStatsHandler stats.Handler - serverStatsHandler stats.Handler - - testServer testpb.TestServiceServer // nil means none - // srv and srvAddr are set once startServer is called. - srv *grpc.Server - srvAddr string - - cc *grpc.ClientConn // nil until requested via clientConn -} - -func (te *test) tearDown() { - if te.cc != nil { - te.cc.Close() - te.cc = nil - } - te.srv.Stop() -} - -type testConfig struct { - compress string -} - -// newTest returns a new test using the provided testing.T and -// environment. It is returned with default values. Tests should -// modify it before calling its startServer and clientConn methods. -func newTest(t *testing.T, tc *testConfig, ch stats.Handler, sh stats.Handler) *test { - te := &test{ - t: t, - compress: tc.compress, - clientStatsHandler: ch, - serverStatsHandler: sh, - } - return te -} - -// startServer starts a gRPC server listening. Callers should defer a -// call to te.tearDown to clean up. -func (te *test) startServer(ts testpb.TestServiceServer) { - te.testServer = ts - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - te.t.Fatalf("Failed to listen: %v", err) - } - var opts []grpc.ServerOption - if te.compress == "gzip" { - opts = append(opts, - grpc.RPCCompressor(grpc.NewGZIPCompressor()), - grpc.RPCDecompressor(grpc.NewGZIPDecompressor()), - ) - } - if te.serverStatsHandler != nil { - opts = append(opts, grpc.StatsHandler(te.serverStatsHandler)) - } - s := grpc.NewServer(opts...) - te.srv = s - if te.testServer != nil { - testpb.RegisterTestServiceServer(s, te.testServer) - } - - go s.Serve(lis) - te.srvAddr = lis.Addr().String() -} - -func (te *test) clientConn() *grpc.ClientConn { - if te.cc != nil { - return te.cc - } - opts := []grpc.DialOption{grpc.WithInsecure(), grpc.WithBlock()} - if te.compress == "gzip" { - opts = append(opts, - grpc.WithCompressor(grpc.NewGZIPCompressor()), - grpc.WithDecompressor(grpc.NewGZIPDecompressor()), - ) - } - if te.clientStatsHandler != nil { - opts = append(opts, grpc.WithStatsHandler(te.clientStatsHandler)) - } - - var err error - te.cc, err = grpc.Dial(te.srvAddr, opts...) - if err != nil { - te.t.Fatalf("Dial(%q) = %v", te.srvAddr, err) - } - return te.cc -} - -type rpcType int - -const ( - unaryRPC rpcType = iota - clientStreamRPC - serverStreamRPC - fullDuplexStreamRPC -) - -type rpcConfig struct { - count int // Number of requests and responses for streaming RPCs. - success bool // Whether the RPC should succeed or return error. - failfast bool - callType rpcType // Type of RPC. - noLastRecv bool // Whether to call recv for io.EOF. When true, last recv won't be called. Only valid for streaming RPCs. -} - -func (te *test) doUnaryCall(c *rpcConfig) (*testpb.SimpleRequest, *testpb.SimpleResponse, error) { - var ( - resp *testpb.SimpleResponse - req *testpb.SimpleRequest - err error - ) - tc := testpb.NewTestServiceClient(te.clientConn()) - if c.success { - req = &testpb.SimpleRequest{Id: errorID + 1} - } else { - req = &testpb.SimpleRequest{Id: errorID} - } - ctx := metadata.NewOutgoingContext(context.Background(), testMetadata) - - resp, err = tc.UnaryCall(ctx, req, grpc.FailFast(c.failfast)) - return req, resp, err -} - -func (te *test) doFullDuplexCallRoundtrip(c *rpcConfig) ([]*testpb.SimpleRequest, []*testpb.SimpleResponse, error) { - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - ) - tc := testpb.NewTestServiceClient(te.clientConn()) - stream, err := tc.FullDuplexCall(metadata.NewOutgoingContext(context.Background(), testMetadata), grpc.FailFast(c.failfast)) - if err != nil { - return reqs, resps, err - } - var startID int32 - if !c.success { - startID = errorID - } - for i := 0; i < c.count; i++ { - req := &testpb.SimpleRequest{ - Id: int32(i) + startID, - } - reqs = append(reqs, req) - if err = stream.Send(req); err != nil { - return reqs, resps, err - } - var resp *testpb.SimpleResponse - if resp, err = stream.Recv(); err != nil { - return reqs, resps, err - } - resps = append(resps, resp) - } - if err = stream.CloseSend(); err != nil && err != io.EOF { - return reqs, resps, err - } - if !c.noLastRecv { - if _, err = stream.Recv(); err != io.EOF { - return reqs, resps, err - } - } else { - // In the case of not calling the last recv, sleep to avoid - // returning too fast to miss the remaining stats (InTrailer and End). - time.Sleep(time.Second) - } - - return reqs, resps, nil -} - -func (te *test) doClientStreamCall(c *rpcConfig) ([]*testpb.SimpleRequest, *testpb.SimpleResponse, error) { - var ( - reqs []*testpb.SimpleRequest - resp *testpb.SimpleResponse - err error - ) - tc := testpb.NewTestServiceClient(te.clientConn()) - stream, err := tc.ClientStreamCall(metadata.NewOutgoingContext(context.Background(), testMetadata), grpc.FailFast(c.failfast)) - if err != nil { - return reqs, resp, err - } - var startID int32 - if !c.success { - startID = errorID - } - for i := 0; i < c.count; i++ { - req := &testpb.SimpleRequest{ - Id: int32(i) + startID, - } - reqs = append(reqs, req) - if err = stream.Send(req); err != nil { - return reqs, resp, err - } - } - resp, err = stream.CloseAndRecv() - return reqs, resp, err -} - -func (te *test) doServerStreamCall(c *rpcConfig) (*testpb.SimpleRequest, []*testpb.SimpleResponse, error) { - var ( - req *testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - ) - - tc := testpb.NewTestServiceClient(te.clientConn()) - - var startID int32 - if !c.success { - startID = errorID - } - req = &testpb.SimpleRequest{Id: startID} - stream, err := tc.ServerStreamCall(metadata.NewOutgoingContext(context.Background(), testMetadata), req, grpc.FailFast(c.failfast)) - if err != nil { - return req, resps, err - } - for { - var resp *testpb.SimpleResponse - resp, err := stream.Recv() - if err == io.EOF { - return req, resps, nil - } else if err != nil { - return req, resps, err - } - resps = append(resps, resp) - } -} - -type expectedData struct { - method string - serverAddr string - compression string - reqIdx int - requests []*testpb.SimpleRequest - respIdx int - responses []*testpb.SimpleResponse - err error - failfast bool -} - -type gotData struct { - ctx context.Context - client bool - s interface{} // This could be RPCStats or ConnStats. -} - -const ( - begin int = iota - end - inPayload - inHeader - inTrailer - outPayload - outHeader - outTrailer - connbegin - connend -) - -func checkBegin(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.Begin - ) - if st, ok = d.s.(*stats.Begin); !ok { - t.Fatalf("got %T, want Begin", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.BeginTime.IsZero() { - t.Fatalf("st.BeginTime = %v, want ", st.BeginTime) - } - if d.client { - if st.FailFast != e.failfast { - t.Fatalf("st.FailFast = %v, want %v", st.FailFast, e.failfast) - } - } -} - -func checkInHeader(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.InHeader - ) - if st, ok = d.s.(*stats.InHeader); !ok { - t.Fatalf("got %T, want InHeader", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if !d.client { - if st.FullMethod != e.method { - t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method) - } - if st.LocalAddr.String() != e.serverAddr { - t.Fatalf("st.LocalAddr = %v, want %v", st.LocalAddr, e.serverAddr) - } - if st.Compression != e.compression { - t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) - } - - if connInfo, ok := d.ctx.Value(connCtxKey{}).(*stats.ConnTagInfo); ok { - if connInfo.RemoteAddr != st.RemoteAddr { - t.Fatalf("connInfo.RemoteAddr = %v, want %v", connInfo.RemoteAddr, st.RemoteAddr) - } - if connInfo.LocalAddr != st.LocalAddr { - t.Fatalf("connInfo.LocalAddr = %v, want %v", connInfo.LocalAddr, st.LocalAddr) - } - } else { - t.Fatalf("got context %v, want one with connCtxKey", d.ctx) - } - if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok { - if rpcInfo.FullMethodName != st.FullMethod { - t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod) - } - } else { - t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx) - } - } -} - -func checkInPayload(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.InPayload - ) - if st, ok = d.s.(*stats.InPayload); !ok { - t.Fatalf("got %T, want InPayload", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if d.client { - b, err := proto.Marshal(e.responses[e.respIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx]) - } - e.respIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } else { - b, err := proto.Marshal(e.requests[e.reqIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx]) - } - e.reqIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } - // TODO check WireLength and ReceivedTime. - if st.RecvTime.IsZero() { - t.Fatalf("st.ReceivedTime = %v, want ", st.RecvTime) - } -} - -func checkInTrailer(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - ) - if _, ok = d.s.(*stats.InTrailer); !ok { - t.Fatalf("got %T, want InTrailer", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } -} - -func checkOutHeader(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutHeader - ) - if st, ok = d.s.(*stats.OutHeader); !ok { - t.Fatalf("got %T, want OutHeader", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if d.client { - if st.FullMethod != e.method { - t.Fatalf("st.FullMethod = %s, want %v", st.FullMethod, e.method) - } - if st.RemoteAddr.String() != e.serverAddr { - t.Fatalf("st.RemoteAddr = %v, want %v", st.RemoteAddr, e.serverAddr) - } - if st.Compression != e.compression { - t.Fatalf("st.Compression = %v, want %v", st.Compression, e.compression) - } - - if rpcInfo, ok := d.ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo); ok { - if rpcInfo.FullMethodName != st.FullMethod { - t.Fatalf("rpcInfo.FullMethod = %s, want %v", rpcInfo.FullMethodName, st.FullMethod) - } - } else { - t.Fatalf("got context %v, want one with rpcCtxKey", d.ctx) - } - } -} - -func checkOutPayload(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutPayload - ) - if st, ok = d.s.(*stats.OutPayload); !ok { - t.Fatalf("got %T, want OutPayload", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if d.client { - b, err := proto.Marshal(e.requests[e.reqIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.requests[e.reqIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.requests[e.reqIdx]) - } - e.reqIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } else { - b, err := proto.Marshal(e.responses[e.respIdx]) - if err != nil { - t.Fatalf("failed to marshal message: %v", err) - } - if reflect.TypeOf(st.Payload) != reflect.TypeOf(e.responses[e.respIdx]) { - t.Fatalf("st.Payload = %T, want %T", st.Payload, e.responses[e.respIdx]) - } - e.respIdx++ - if string(st.Data) != string(b) { - t.Fatalf("st.Data = %v, want %v", st.Data, b) - } - if st.Length != len(b) { - t.Fatalf("st.Lenght = %v, want %v", st.Length, len(b)) - } - } - // TODO check WireLength and ReceivedTime. - if st.SentTime.IsZero() { - t.Fatalf("st.SentTime = %v, want ", st.SentTime) - } -} - -func checkOutTrailer(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.OutTrailer - ) - if st, ok = d.s.(*stats.OutTrailer); !ok { - t.Fatalf("got %T, want OutTrailer", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.Client { - t.Fatalf("st IsClient = true, want false") - } -} - -func checkEnd(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.End - ) - if st, ok = d.s.(*stats.End); !ok { - t.Fatalf("got %T, want End", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - if st.EndTime.IsZero() { - t.Fatalf("st.EndTime = %v, want ", st.EndTime) - } - - actual, ok := status.FromError(st.Error) - if !ok { - t.Fatalf("expected st.Error to be a statusError, got %T", st.Error) - } - - expectedStatus, _ := status.FromError(e.err) - if actual.Code() != expectedStatus.Code() || actual.Message() != expectedStatus.Message() { - t.Fatalf("st.Error = %v, want %v", st.Error, e.err) - } -} - -func checkConnBegin(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.ConnBegin - ) - if st, ok = d.s.(*stats.ConnBegin); !ok { - t.Fatalf("got %T, want ConnBegin", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - st.IsClient() // TODO remove this. -} - -func checkConnEnd(t *testing.T, d *gotData, e *expectedData) { - var ( - ok bool - st *stats.ConnEnd - ) - if st, ok = d.s.(*stats.ConnEnd); !ok { - t.Fatalf("got %T, want ConnEnd", d.s) - } - if d.ctx == nil { - t.Fatalf("d.ctx = nil, want ") - } - st.IsClient() // TODO remove this. -} - -type statshandler struct { - mu sync.Mutex - gotRPC []*gotData - gotConn []*gotData -} - -func (h *statshandler) TagConn(ctx context.Context, info *stats.ConnTagInfo) context.Context { - return context.WithValue(ctx, connCtxKey{}, info) -} - -func (h *statshandler) TagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { - return context.WithValue(ctx, rpcCtxKey{}, info) -} - -func (h *statshandler) HandleConn(ctx context.Context, s stats.ConnStats) { - h.mu.Lock() - defer h.mu.Unlock() - h.gotConn = append(h.gotConn, &gotData{ctx, s.IsClient(), s}) -} - -func (h *statshandler) HandleRPC(ctx context.Context, s stats.RPCStats) { - h.mu.Lock() - defer h.mu.Unlock() - h.gotRPC = append(h.gotRPC, &gotData{ctx, s.IsClient(), s}) -} - -func checkConnStats(t *testing.T, got []*gotData) { - if len(got) <= 0 || len(got)%2 != 0 { - for i, g := range got { - t.Errorf(" - %v, %T = %+v, ctx: %v", i, g.s, g.s, g.ctx) - } - t.Fatalf("got %v stats, want even positive number", len(got)) - } - // The first conn stats must be a ConnBegin. - checkConnBegin(t, got[0], nil) - // The last conn stats must be a ConnEnd. - checkConnEnd(t, got[len(got)-1], nil) -} - -func checkServerStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) { - if len(got) != len(checkFuncs) { - for i, g := range got { - t.Errorf(" - %v, %T", i, g.s) - } - t.Fatalf("got %v stats, want %v stats", len(got), len(checkFuncs)) - } - - var rpcctx context.Context - for i := 0; i < len(got); i++ { - if _, ok := got[i].s.(stats.RPCStats); ok { - if rpcctx != nil && got[i].ctx != rpcctx { - t.Fatalf("got different contexts with stats %T", got[i].s) - } - rpcctx = got[i].ctx - } - } - - for i, f := range checkFuncs { - f(t, got[i], expect) - } -} - -func testServerStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs []func(t *testing.T, d *gotData, e *expectedData)) { - h := &statshandler{} - te := newTest(t, tc, nil, h) - te.startServer(&testServer{}) - defer te.tearDown() - - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - err error - method string - - req *testpb.SimpleRequest - resp *testpb.SimpleResponse - e error - ) - - switch cc.callType { - case unaryRPC: - method = "/grpc.testing.TestService/UnaryCall" - req, resp, e = te.doUnaryCall(cc) - reqs = []*testpb.SimpleRequest{req} - resps = []*testpb.SimpleResponse{resp} - err = e - case clientStreamRPC: - method = "/grpc.testing.TestService/ClientStreamCall" - reqs, resp, e = te.doClientStreamCall(cc) - resps = []*testpb.SimpleResponse{resp} - err = e - case serverStreamRPC: - method = "/grpc.testing.TestService/ServerStreamCall" - req, resps, e = te.doServerStreamCall(cc) - reqs = []*testpb.SimpleRequest{req} - err = e - case fullDuplexStreamRPC: - method = "/grpc.testing.TestService/FullDuplexCall" - reqs, resps, err = te.doFullDuplexCallRoundtrip(cc) - } - if cc.success != (err == nil) { - t.Fatalf("cc.success: %v, got error: %v", cc.success, err) - } - te.cc.Close() - te.srv.GracefulStop() // Wait for the server to stop. - - for { - h.mu.Lock() - if len(h.gotRPC) >= len(checkFuncs) { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - for { - h.mu.Lock() - if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - expect := &expectedData{ - serverAddr: te.srvAddr, - compression: tc.compress, - method: method, - requests: reqs, - responses: resps, - err: err, - } - - h.mu.Lock() - checkConnStats(t, h.gotConn) - h.mu.Unlock() - checkServerStats(t, h.gotRPC, expect, checkFuncs) -} - -func TestServerStatsUnaryRPC(t *testing.T) { - testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: true, callType: unaryRPC}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - checkOutPayload, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsUnaryRPCError(t *testing.T) { - testServerStats(t, &testConfig{compress: ""}, &rpcConfig{success: false, callType: unaryRPC}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsClientStreamRPC(t *testing.T) { - count := 5 - checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - } - ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInPayload, - } - for i := 0; i < count; i++ { - checkFuncs = append(checkFuncs, ioPayFuncs...) - } - checkFuncs = append(checkFuncs, - checkOutPayload, - checkOutTrailer, - checkEnd, - ) - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: clientStreamRPC}, checkFuncs) -} - -func TestServerStatsClientStreamRPCError(t *testing.T) { - count := 1 - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: clientStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - checkInPayload, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsServerStreamRPC(t *testing.T) { - count := 5 - checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - } - ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkOutPayload, - } - for i := 0; i < count; i++ { - checkFuncs = append(checkFuncs, ioPayFuncs...) - } - checkFuncs = append(checkFuncs, - checkOutTrailer, - checkEnd, - ) - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: serverStreamRPC}, checkFuncs) -} - -func TestServerStatsServerStreamRPCError(t *testing.T) { - count := 5 - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: serverStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkInPayload, - checkOutHeader, - checkOutTrailer, - checkEnd, - }) -} - -func TestServerStatsFullDuplexRPC(t *testing.T) { - count := 5 - checkFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - } - ioPayFuncs := []func(t *testing.T, d *gotData, e *expectedData){ - checkInPayload, - checkOutPayload, - } - for i := 0; i < count; i++ { - checkFuncs = append(checkFuncs, ioPayFuncs...) - } - checkFuncs = append(checkFuncs, - checkOutTrailer, - checkEnd, - ) - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, callType: fullDuplexStreamRPC}, checkFuncs) -} - -func TestServerStatsFullDuplexRPCError(t *testing.T) { - count := 5 - testServerStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, callType: fullDuplexStreamRPC}, []func(t *testing.T, d *gotData, e *expectedData){ - checkInHeader, - checkBegin, - checkOutHeader, - checkInPayload, - checkOutTrailer, - checkEnd, - }) -} - -type checkFuncWithCount struct { - f func(t *testing.T, d *gotData, e *expectedData) - c int // expected count -} - -func checkClientStats(t *testing.T, got []*gotData, expect *expectedData, checkFuncs map[int]*checkFuncWithCount) { - var expectLen int - for _, v := range checkFuncs { - expectLen += v.c - } - if len(got) != expectLen { - for i, g := range got { - t.Errorf(" - %v, %T", i, g.s) - } - t.Fatalf("got %v stats, want %v stats", len(got), expectLen) - } - - var tagInfoInCtx *stats.RPCTagInfo - for i := 0; i < len(got); i++ { - if _, ok := got[i].s.(stats.RPCStats); ok { - tagInfoInCtxNew, _ := got[i].ctx.Value(rpcCtxKey{}).(*stats.RPCTagInfo) - if tagInfoInCtx != nil && tagInfoInCtx != tagInfoInCtxNew { - t.Fatalf("got context containing different tagInfo with stats %T", got[i].s) - } - tagInfoInCtx = tagInfoInCtxNew - } - } - - for _, s := range got { - switch s.s.(type) { - case *stats.Begin: - if checkFuncs[begin].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[begin].f(t, s, expect) - checkFuncs[begin].c-- - case *stats.OutHeader: - if checkFuncs[outHeader].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[outHeader].f(t, s, expect) - checkFuncs[outHeader].c-- - case *stats.OutPayload: - if checkFuncs[outPayload].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[outPayload].f(t, s, expect) - checkFuncs[outPayload].c-- - case *stats.InHeader: - if checkFuncs[inHeader].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inHeader].f(t, s, expect) - checkFuncs[inHeader].c-- - case *stats.InPayload: - if checkFuncs[inPayload].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inPayload].f(t, s, expect) - checkFuncs[inPayload].c-- - case *stats.InTrailer: - if checkFuncs[inTrailer].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[inTrailer].f(t, s, expect) - checkFuncs[inTrailer].c-- - case *stats.End: - if checkFuncs[end].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[end].f(t, s, expect) - checkFuncs[end].c-- - case *stats.ConnBegin: - if checkFuncs[connbegin].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[connbegin].f(t, s, expect) - checkFuncs[connbegin].c-- - case *stats.ConnEnd: - if checkFuncs[connend].c <= 0 { - t.Fatalf("unexpected stats: %T", s.s) - } - checkFuncs[connend].f(t, s, expect) - checkFuncs[connend].c-- - default: - t.Fatalf("unexpected stats: %T", s.s) - } - } -} - -func testClientStats(t *testing.T, tc *testConfig, cc *rpcConfig, checkFuncs map[int]*checkFuncWithCount) { - h := &statshandler{} - te := newTest(t, tc, h, nil) - te.startServer(&testServer{}) - defer te.tearDown() - - var ( - reqs []*testpb.SimpleRequest - resps []*testpb.SimpleResponse - method string - err error - - req *testpb.SimpleRequest - resp *testpb.SimpleResponse - e error - ) - switch cc.callType { - case unaryRPC: - method = "/grpc.testing.TestService/UnaryCall" - req, resp, e = te.doUnaryCall(cc) - reqs = []*testpb.SimpleRequest{req} - resps = []*testpb.SimpleResponse{resp} - err = e - case clientStreamRPC: - method = "/grpc.testing.TestService/ClientStreamCall" - reqs, resp, e = te.doClientStreamCall(cc) - resps = []*testpb.SimpleResponse{resp} - err = e - case serverStreamRPC: - method = "/grpc.testing.TestService/ServerStreamCall" - req, resps, e = te.doServerStreamCall(cc) - reqs = []*testpb.SimpleRequest{req} - err = e - case fullDuplexStreamRPC: - method = "/grpc.testing.TestService/FullDuplexCall" - reqs, resps, err = te.doFullDuplexCallRoundtrip(cc) - } - if cc.success != (err == nil) { - t.Fatalf("cc.success: %v, got error: %v", cc.success, err) - } - te.cc.Close() - te.srv.GracefulStop() // Wait for the server to stop. - - lenRPCStats := 0 - for _, v := range checkFuncs { - lenRPCStats += v.c - } - for { - h.mu.Lock() - if len(h.gotRPC) >= lenRPCStats { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - for { - h.mu.Lock() - if _, ok := h.gotConn[len(h.gotConn)-1].s.(*stats.ConnEnd); ok { - h.mu.Unlock() - break - } - h.mu.Unlock() - time.Sleep(10 * time.Millisecond) - } - - expect := &expectedData{ - serverAddr: te.srvAddr, - compression: tc.compress, - method: method, - requests: reqs, - responses: resps, - failfast: cc.failfast, - err: err, - } - - h.mu.Lock() - checkConnStats(t, h.gotConn) - h.mu.Unlock() - checkClientStats(t, h.gotRPC, expect, checkFuncs) -} - -func TestClientStatsUnaryRPC(t *testing.T) { - testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: true, failfast: false, callType: unaryRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsUnaryRPCError(t *testing.T) { - testClientStats(t, &testConfig{compress: ""}, &rpcConfig{success: false, failfast: false, callType: unaryRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsClientStreamRPC(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: clientStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - inHeader: {checkInHeader, 1}, - outPayload: {checkOutPayload, count}, - inTrailer: {checkInTrailer, 1}, - inPayload: {checkInPayload, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsClientStreamRPCError(t *testing.T) { - count := 1 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: clientStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - inHeader: {checkInHeader, 1}, - outPayload: {checkOutPayload, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsServerStreamRPC(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: serverStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, count}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsServerStreamRPCError(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: serverStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsFullDuplexRPC(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: fullDuplexStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, count}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, count}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestClientStatsFullDuplexRPCError(t *testing.T) { - count := 5 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: false, failfast: false, callType: fullDuplexStreamRPC}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, 1}, - inHeader: {checkInHeader, 1}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -// If the user doesn't call the last recv() on clientStream. -func TestClientStatsFullDuplexRPCNotCallingLastRecv(t *testing.T) { - count := 1 - testClientStats(t, &testConfig{compress: "gzip"}, &rpcConfig{count: count, success: true, failfast: false, callType: fullDuplexStreamRPC, noLastRecv: true}, map[int]*checkFuncWithCount{ - begin: {checkBegin, 1}, - outHeader: {checkOutHeader, 1}, - outPayload: {checkOutPayload, count}, - inHeader: {checkInHeader, 1}, - inPayload: {checkInPayload, count}, - inTrailer: {checkInTrailer, 1}, - end: {checkEnd, 1}, - }) -} - -func TestTags(t *testing.T) { - b := []byte{5, 2, 4, 3, 1} - ctx := stats.SetTags(context.Background(), b) - if tg := stats.OutgoingTags(ctx); !reflect.DeepEqual(tg, b) { - t.Errorf("OutgoingTags(%v) = %v; want %v", ctx, tg, b) - } - if tg := stats.Tags(ctx); tg != nil { - t.Errorf("Tags(%v) = %v; want nil", ctx, tg) - } - - ctx = stats.SetIncomingTags(context.Background(), b) - if tg := stats.Tags(ctx); !reflect.DeepEqual(tg, b) { - t.Errorf("Tags(%v) = %v; want %v", ctx, tg, b) - } - if tg := stats.OutgoingTags(ctx); tg != nil { - t.Errorf("OutgoingTags(%v) = %v; want nil", ctx, tg) - } -} - -func TestTrace(t *testing.T) { - b := []byte{5, 2, 4, 3, 1} - ctx := stats.SetTrace(context.Background(), b) - if tr := stats.OutgoingTrace(ctx); !reflect.DeepEqual(tr, b) { - t.Errorf("OutgoingTrace(%v) = %v; want %v", ctx, tr, b) - } - if tr := stats.Trace(ctx); tr != nil { - t.Errorf("Trace(%v) = %v; want nil", ctx, tr) - } - - ctx = stats.SetIncomingTrace(context.Background(), b) - if tr := stats.Trace(ctx); !reflect.DeepEqual(tr, b) { - t.Errorf("Trace(%v) = %v; want %v", ctx, tr, b) - } - if tr := stats.OutgoingTrace(ctx); tr != nil { - t.Errorf("OutgoingTrace(%v) = %v; want nil", ctx, tr) - } -} diff --git a/vendor/google.golang.org/grpc/tap/tap.go b/vendor/google.golang.org/grpc/tap/tap.go deleted file mode 100644 index 22b8fb5..0000000 --- a/vendor/google.golang.org/grpc/tap/tap.go +++ /dev/null @@ -1,51 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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 tap defines the function handles which are executed on the transport -// layer of gRPC-Go and related information. Everything here is EXPERIMENTAL. -package tap - -import ( - "golang.org/x/net/context" -) - -// Info defines the relevant information needed by the handles. -type Info struct { - // FullMethodName is the string of grpc method (in the format of - // /package.service/method). - FullMethodName string - // TODO: More to be added. -} - -// ServerInHandle defines the function which runs before a new stream is created -// on the server side. If it returns a non-nil error, the stream will not be -// created and a RST_STREAM will be sent back to the client with REFUSED_STREAM. -// The client will receive an RPC error "code = Unavailable, desc = stream -// terminated by RST_STREAM with error code: REFUSED_STREAM". -// -// It's intended to be used in situations where you don't want to waste the -// resources to accept the new stream (e.g. rate-limiting). And the content of -// the error will be ignored and won't be sent back to the client. For other -// general usages, please use interceptors. -// -// Note that it is executed in the per-connection I/O goroutine(s) instead of -// per-RPC goroutine. Therefore, users should NOT have any -// blocking/time-consuming work in this handle. Otherwise all the RPCs would -// slow down. Also, for the same reason, this handle won't be called -// concurrently by gRPC. -type ServerInHandle func(ctx context.Context, info *Info) (context.Context, error) diff --git a/vendor/google.golang.org/grpc/transport/bdp_estimator.go b/vendor/google.golang.org/grpc/transport/bdp_estimator.go deleted file mode 100644 index 63cd262..0000000 --- a/vendor/google.golang.org/grpc/transport/bdp_estimator.go +++ /dev/null @@ -1,140 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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 transport - -import ( - "sync" - "time" -) - -const ( - // bdpLimit is the maximum value the flow control windows - // will be increased to. - bdpLimit = (1 << 20) * 4 - // alpha is a constant factor used to keep a moving average - // of RTTs. - alpha = 0.9 - // If the current bdp sample is greater than or equal to - // our beta * our estimated bdp and the current bandwidth - // sample is the maximum bandwidth observed so far, we - // increase our bbp estimate by a factor of gamma. - beta = 0.66 - // To put our bdp to be smaller than or equal to twice the real BDP, - // we should multiply our current sample with 4/3, however to round things out - // we use 2 as the multiplication factor. - gamma = 2 -) - -// Adding arbitrary data to ping so that its ack can be identified. -// Easter-egg: what does the ping message say? -var bdpPing = &ping{data: [8]byte{2, 4, 16, 16, 9, 14, 7, 7}} - -type bdpEstimator struct { - // sentAt is the time when the ping was sent. - sentAt time.Time - - mu sync.Mutex - // bdp is the current bdp estimate. - bdp uint32 - // sample is the number of bytes received in one measurement cycle. - sample uint32 - // bwMax is the maximum bandwidth noted so far (bytes/sec). - bwMax float64 - // bool to keep track of the beginning of a new measurement cycle. - isSent bool - // Callback to update the window sizes. - updateFlowControl func(n uint32) - // sampleCount is the number of samples taken so far. - sampleCount uint64 - // round trip time (seconds) - rtt float64 -} - -// timesnap registers the time bdp ping was sent out so that -// network rtt can be calculated when its ack is received. -// It is called (by controller) when the bdpPing is -// being written on the wire. -func (b *bdpEstimator) timesnap(d [8]byte) { - if bdpPing.data != d { - return - } - b.sentAt = time.Now() -} - -// add adds bytes to the current sample for calculating bdp. -// It returns true only if a ping must be sent. This can be used -// by the caller (handleData) to make decision about batching -// a window update with it. -func (b *bdpEstimator) add(n uint32) bool { - b.mu.Lock() - defer b.mu.Unlock() - if b.bdp == bdpLimit { - return false - } - if !b.isSent { - b.isSent = true - b.sample = n - b.sentAt = time.Time{} - b.sampleCount++ - return true - } - b.sample += n - return false -} - -// calculate is called when an ack for a bdp ping is received. -// Here we calculate the current bdp and bandwidth sample and -// decide if the flow control windows should go up. -func (b *bdpEstimator) calculate(d [8]byte) { - // Check if the ping acked for was the bdp ping. - if bdpPing.data != d { - return - } - b.mu.Lock() - rttSample := time.Since(b.sentAt).Seconds() - if b.sampleCount < 10 { - // Bootstrap rtt with an average of first 10 rtt samples. - b.rtt += (rttSample - b.rtt) / float64(b.sampleCount) - } else { - // Heed to the recent past more. - b.rtt += (rttSample - b.rtt) * float64(alpha) - } - b.isSent = false - // The number of bytes accumulated so far in the sample is smaller - // than or equal to 1.5 times the real BDP on a saturated connection. - bwCurrent := float64(b.sample) / (b.rtt * float64(1.5)) - if bwCurrent > b.bwMax { - b.bwMax = bwCurrent - } - // If the current sample (which is smaller than or equal to the 1.5 times the real BDP) is - // greater than or equal to 2/3rd our perceived bdp AND this is the maximum bandwidth seen so far, we - // should update our perception of the network BDP. - if float64(b.sample) >= beta*float64(b.bdp) && bwCurrent == b.bwMax && b.bdp != bdpLimit { - sampleFloat := float64(b.sample) - b.bdp = uint32(gamma * sampleFloat) - if b.bdp > bdpLimit { - b.bdp = bdpLimit - } - bdp := b.bdp - b.mu.Unlock() - b.updateFlowControl(bdp) - return - } - b.mu.Unlock() -} diff --git a/vendor/google.golang.org/grpc/transport/control.go b/vendor/google.golang.org/grpc/transport/control.go deleted file mode 100644 index 0474b09..0000000 --- a/vendor/google.golang.org/grpc/transport/control.go +++ /dev/null @@ -1,334 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "fmt" - "io" - "math" - "sync" - "time" - - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" -) - -const ( - // The default value of flow control window size in HTTP2 spec. - defaultWindowSize = 65535 - // The initial window size for flow control. - initialWindowSize = defaultWindowSize // for an RPC - infinity = time.Duration(math.MaxInt64) - defaultClientKeepaliveTime = infinity - defaultClientKeepaliveTimeout = time.Duration(20 * time.Second) - defaultMaxStreamsClient = 100 - defaultMaxConnectionIdle = infinity - defaultMaxConnectionAge = infinity - defaultMaxConnectionAgeGrace = infinity - defaultServerKeepaliveTime = time.Duration(2 * time.Hour) - defaultServerKeepaliveTimeout = time.Duration(20 * time.Second) - defaultKeepalivePolicyMinTime = time.Duration(5 * time.Minute) - // max window limit set by HTTP2 Specs. - maxWindowSize = math.MaxInt32 - // defaultLocalSendQuota sets is default value for number of data - // bytes that each stream can schedule before some of it being - // flushed out. - defaultLocalSendQuota = 128 * 1024 -) - -// The following defines various control items which could flow through -// the control buffer of transport. They represent different aspects of -// control tasks, e.g., flow control, settings, streaming resetting, etc. - -type headerFrame struct { - streamID uint32 - hf []hpack.HeaderField - endStream bool -} - -func (*headerFrame) item() {} - -type continuationFrame struct { - streamID uint32 - endHeaders bool - headerBlockFragment []byte -} - -type dataFrame struct { - streamID uint32 - endStream bool - d []byte - f func() -} - -func (*dataFrame) item() {} - -func (*continuationFrame) item() {} - -type windowUpdate struct { - streamID uint32 - increment uint32 -} - -func (*windowUpdate) item() {} - -type settings struct { - ss []http2.Setting -} - -func (*settings) item() {} - -type settingsAck struct { -} - -func (*settingsAck) item() {} - -type resetStream struct { - streamID uint32 - code http2.ErrCode -} - -func (*resetStream) item() {} - -type goAway struct { - code http2.ErrCode - debugData []byte - headsUp bool - closeConn bool -} - -func (*goAway) item() {} - -type flushIO struct { - closeTr bool -} - -func (*flushIO) item() {} - -type ping struct { - ack bool - data [8]byte -} - -func (*ping) item() {} - -// quotaPool is a pool which accumulates the quota and sends it to acquire() -// when it is available. -type quotaPool struct { - mu sync.Mutex - c chan struct{} - version uint32 - quota int -} - -// newQuotaPool creates a quotaPool which has quota q available to consume. -func newQuotaPool(q int) *quotaPool { - qb := "aPool{ - quota: q, - c: make(chan struct{}, 1), - } - return qb -} - -// add cancels the pending quota sent on acquired, incremented by v and sends -// it back on acquire. -func (qb *quotaPool) add(v int) { - qb.mu.Lock() - defer qb.mu.Unlock() - qb.lockedAdd(v) -} - -func (qb *quotaPool) lockedAdd(v int) { - var wakeUp bool - if qb.quota <= 0 { - wakeUp = true // Wake up potential waiters. - } - qb.quota += v - if wakeUp && qb.quota > 0 { - select { - case qb.c <- struct{}{}: - default: - } - } -} - -func (qb *quotaPool) addAndUpdate(v int) { - qb.mu.Lock() - qb.lockedAdd(v) - qb.version++ - qb.mu.Unlock() -} - -func (qb *quotaPool) get(v int, wc waiters) (int, uint32, error) { - qb.mu.Lock() - if qb.quota > 0 { - if v > qb.quota { - v = qb.quota - } - qb.quota -= v - ver := qb.version - qb.mu.Unlock() - return v, ver, nil - } - qb.mu.Unlock() - for { - select { - case <-wc.ctx.Done(): - return 0, 0, ContextErr(wc.ctx.Err()) - case <-wc.tctx.Done(): - return 0, 0, ErrConnClosing - case <-wc.done: - return 0, 0, io.EOF - case <-wc.goAway: - return 0, 0, errStreamDrain - case <-qb.c: - qb.mu.Lock() - if qb.quota > 0 { - if v > qb.quota { - v = qb.quota - } - qb.quota -= v - ver := qb.version - if qb.quota > 0 { - select { - case qb.c <- struct{}{}: - default: - } - } - qb.mu.Unlock() - return v, ver, nil - - } - qb.mu.Unlock() - } - } -} - -func (qb *quotaPool) compareAndExecute(version uint32, success, failure func()) bool { - qb.mu.Lock() - if version == qb.version { - success() - qb.mu.Unlock() - return true - } - failure() - qb.mu.Unlock() - return false -} - -// inFlow deals with inbound flow control -type inFlow struct { - mu sync.Mutex - // The inbound flow control limit for pending data. - limit uint32 - // pendingData is the overall data which have been received but not been - // consumed by applications. - pendingData uint32 - // The amount of data the application has consumed but grpc has not sent - // window update for them. Used to reduce window update frequency. - pendingUpdate uint32 - // delta is the extra window update given by receiver when an application - // is reading data bigger in size than the inFlow limit. - delta uint32 -} - -// newLimit updates the inflow window to a new value n. -// It assumes that n is always greater than the old limit. -func (f *inFlow) newLimit(n uint32) uint32 { - f.mu.Lock() - defer f.mu.Unlock() - d := n - f.limit - f.limit = n - return d -} - -func (f *inFlow) maybeAdjust(n uint32) uint32 { - if n > uint32(math.MaxInt32) { - n = uint32(math.MaxInt32) - } - f.mu.Lock() - defer f.mu.Unlock() - // estSenderQuota is the receiver's view of the maximum number of bytes the sender - // can send without a window update. - estSenderQuota := int32(f.limit - (f.pendingData + f.pendingUpdate)) - // estUntransmittedData is the maximum number of bytes the sends might not have put - // on the wire yet. A value of 0 or less means that we have already received all or - // more bytes than the application is requesting to read. - estUntransmittedData := int32(n - f.pendingData) // Casting into int32 since it could be negative. - // This implies that unless we send a window update, the sender won't be able to send all the bytes - // for this message. Therefore we must send an update over the limit since there's an active read - // request from the application. - if estUntransmittedData > estSenderQuota { - // Sender's window shouldn't go more than 2^31 - 1 as speecified in the HTTP spec. - if f.limit+n > maxWindowSize { - f.delta = maxWindowSize - f.limit - } else { - // Send a window update for the whole message and not just the difference between - // estUntransmittedData and estSenderQuota. This will be helpful in case the message - // is padded; We will fallback on the current available window(at least a 1/4th of the limit). - f.delta = n - } - return f.delta - } - return 0 -} - -// onData is invoked when some data frame is received. It updates pendingData. -func (f *inFlow) onData(n uint32) error { - f.mu.Lock() - defer f.mu.Unlock() - f.pendingData += n - if f.pendingData+f.pendingUpdate > f.limit+f.delta { - return fmt.Errorf("received %d-bytes data exceeding the limit %d bytes", f.pendingData+f.pendingUpdate, f.limit) - } - return nil -} - -// onRead is invoked when the application reads the data. It returns the window size -// to be sent to the peer. -func (f *inFlow) onRead(n uint32) uint32 { - f.mu.Lock() - defer f.mu.Unlock() - if f.pendingData == 0 { - return 0 - } - f.pendingData -= n - if n > f.delta { - n -= f.delta - f.delta = 0 - } else { - f.delta -= n - n = 0 - } - f.pendingUpdate += n - if f.pendingUpdate >= f.limit/4 { - wu := f.pendingUpdate - f.pendingUpdate = 0 - return wu - } - return 0 -} - -func (f *inFlow) resetPendingUpdate() uint32 { - f.mu.Lock() - defer f.mu.Unlock() - n := f.pendingUpdate - f.pendingUpdate = 0 - return n -} diff --git a/vendor/google.golang.org/grpc/transport/go16.go b/vendor/google.golang.org/grpc/transport/go16.go deleted file mode 100644 index 5babcf9..0000000 --- a/vendor/google.golang.org/grpc/transport/go16.go +++ /dev/null @@ -1,51 +0,0 @@ -// +build go1.6,!go1.7 - -/* - * - * Copyright 2016 gRPC authors. - * - * 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 transport - -import ( - "net" - "net/http" - - "google.golang.org/grpc/codes" - - "golang.org/x/net/context" -) - -// dialContext connects to the address on the named network. -func dialContext(ctx context.Context, network, address string) (net.Conn, error) { - return (&net.Dialer{Cancel: ctx.Done()}).Dial(network, address) -} - -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { - switch err { - case context.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) - case context.Canceled: - return streamErrorf(codes.Canceled, "%v", err) - } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) -} - -// contextFromRequest returns a background context. -func contextFromRequest(r *http.Request) context.Context { - return context.Background() -} diff --git a/vendor/google.golang.org/grpc/transport/go17.go b/vendor/google.golang.org/grpc/transport/go17.go deleted file mode 100644 index b7fa6bd..0000000 --- a/vendor/google.golang.org/grpc/transport/go17.go +++ /dev/null @@ -1,52 +0,0 @@ -// +build go1.7 - -/* - * - * Copyright 2016 gRPC authors. - * - * 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 transport - -import ( - "context" - "net" - "net/http" - - "google.golang.org/grpc/codes" - - netctx "golang.org/x/net/context" -) - -// dialContext connects to the address on the named network. -func dialContext(ctx context.Context, network, address string) (net.Conn, error) { - return (&net.Dialer{}).DialContext(ctx, network, address) -} - -// ContextErr converts the error from context package into a StreamError. -func ContextErr(err error) StreamError { - switch err { - case context.DeadlineExceeded, netctx.DeadlineExceeded: - return streamErrorf(codes.DeadlineExceeded, "%v", err) - case context.Canceled, netctx.Canceled: - return streamErrorf(codes.Canceled, "%v", err) - } - return streamErrorf(codes.Internal, "Unexpected error from context packet: %v", err) -} - -// contextFromRequest returns a context from the HTTP Request. -func contextFromRequest(r *http.Request) context.Context { - return r.Context() -} diff --git a/vendor/google.golang.org/grpc/transport/handler_server.go b/vendor/google.golang.org/grpc/transport/handler_server.go deleted file mode 100644 index 27c4ebb..0000000 --- a/vendor/google.golang.org/grpc/transport/handler_server.go +++ /dev/null @@ -1,413 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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. - * - */ - -// This file is the implementation of a gRPC server using HTTP/2 which -// uses the standard Go http2 Server implementation (via the -// http.Handler interface), rather than speaking low-level HTTP/2 -// frames itself. It is the implementation of *grpc.Server.ServeHTTP. - -package transport - -import ( - "errors" - "fmt" - "io" - "net" - "net/http" - "strings" - "sync" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "golang.org/x/net/http2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/status" -) - -// NewServerHandlerTransport returns a ServerTransport handling gRPC -// from inside an http.Handler. It requires that the http Server -// supports HTTP/2. -func NewServerHandlerTransport(w http.ResponseWriter, r *http.Request) (ServerTransport, error) { - if r.ProtoMajor != 2 { - return nil, errors.New("gRPC requires HTTP/2") - } - if r.Method != "POST" { - return nil, errors.New("invalid gRPC request method") - } - if !validContentType(r.Header.Get("Content-Type")) { - return nil, errors.New("invalid gRPC request content-type") - } - if _, ok := w.(http.Flusher); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.Flusher") - } - if _, ok := w.(http.CloseNotifier); !ok { - return nil, errors.New("gRPC requires a ResponseWriter supporting http.CloseNotifier") - } - - st := &serverHandlerTransport{ - rw: w, - req: r, - closedCh: make(chan struct{}), - writes: make(chan func()), - } - - if v := r.Header.Get("grpc-timeout"); v != "" { - to, err := decodeTimeout(v) - if err != nil { - return nil, streamErrorf(codes.Internal, "malformed time-out: %v", err) - } - st.timeoutSet = true - st.timeout = to - } - - var metakv []string - if r.Host != "" { - metakv = append(metakv, ":authority", r.Host) - } - for k, vv := range r.Header { - k = strings.ToLower(k) - if isReservedHeader(k) && !isWhitelistedPseudoHeader(k) { - continue - } - for _, v := range vv { - v, err := decodeMetadataHeader(k, v) - if err != nil { - return nil, streamErrorf(codes.InvalidArgument, "malformed binary metadata: %v", err) - } - metakv = append(metakv, k, v) - } - } - st.headerMD = metadata.Pairs(metakv...) - - return st, nil -} - -// serverHandlerTransport is an implementation of ServerTransport -// which replies to exactly one gRPC request (exactly one HTTP request), -// using the net/http.Handler interface. This http.Handler is guaranteed -// at this point to be speaking over HTTP/2, so it's able to speak valid -// gRPC. -type serverHandlerTransport struct { - rw http.ResponseWriter - req *http.Request - timeoutSet bool - timeout time.Duration - didCommonHeaders bool - - headerMD metadata.MD - - closeOnce sync.Once - closedCh chan struct{} // closed on Close - - // writes is a channel of code to run serialized in the - // ServeHTTP (HandleStreams) goroutine. The channel is closed - // when WriteStatus is called. - writes chan func() - - // block concurrent WriteStatus calls - // e.g. grpc/(*serverStream).SendMsg/RecvMsg - writeStatusMu sync.Mutex -} - -func (ht *serverHandlerTransport) Close() error { - ht.closeOnce.Do(ht.closeCloseChanOnce) - return nil -} - -func (ht *serverHandlerTransport) closeCloseChanOnce() { close(ht.closedCh) } - -func (ht *serverHandlerTransport) RemoteAddr() net.Addr { return strAddr(ht.req.RemoteAddr) } - -// strAddr is a net.Addr backed by either a TCP "ip:port" string, or -// the empty string if unknown. -type strAddr string - -func (a strAddr) Network() string { - if a != "" { - // Per the documentation on net/http.Request.RemoteAddr, if this is - // set, it's set to the IP:port of the peer (hence, TCP): - // https://golang.org/pkg/net/http/#Request - // - // If we want to support Unix sockets later, we can - // add our own grpc-specific convention within the - // grpc codebase to set RemoteAddr to a different - // format, or probably better: we can attach it to the - // context and use that from serverHandlerTransport.RemoteAddr. - return "tcp" - } - return "" -} - -func (a strAddr) String() string { return string(a) } - -// do runs fn in the ServeHTTP goroutine. -func (ht *serverHandlerTransport) do(fn func()) error { - // Avoid a panic writing to closed channel. Imperfect but maybe good enough. - select { - case <-ht.closedCh: - return ErrConnClosing - default: - select { - case ht.writes <- fn: - return nil - case <-ht.closedCh: - return ErrConnClosing - } - } -} - -func (ht *serverHandlerTransport) WriteStatus(s *Stream, st *status.Status) error { - ht.writeStatusMu.Lock() - defer ht.writeStatusMu.Unlock() - - err := ht.do(func() { - ht.writeCommonHeaders(s) - - // And flush, in case no header or body has been sent yet. - // This forces a separation of headers and trailers if this is the - // first call (for example, in end2end tests's TestNoService). - ht.rw.(http.Flusher).Flush() - - h := ht.rw.Header() - h.Set("Grpc-Status", fmt.Sprintf("%d", st.Code())) - if m := st.Message(); m != "" { - h.Set("Grpc-Message", encodeGrpcMessage(m)) - } - - if p := st.Proto(); p != nil && len(p.Details) > 0 { - stBytes, err := proto.Marshal(p) - if err != nil { - // TODO: return error instead, when callers are able to handle it. - panic(err) - } - - h.Set("Grpc-Status-Details-Bin", encodeBinHeader(stBytes)) - } - - if md := s.Trailer(); len(md) > 0 { - for k, vv := range md { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - // http2 ResponseWriter mechanism to send undeclared Trailers after - // the headers have possibly been written. - h.Add(http2.TrailerPrefix+k, encodeMetadataHeader(k, v)) - } - } - } - }) - - if err == nil { // transport has not been closed - ht.Close() - close(ht.writes) - } - return err -} - -// writeCommonHeaders sets common headers on the first write -// call (Write, WriteHeader, or WriteStatus). -func (ht *serverHandlerTransport) writeCommonHeaders(s *Stream) { - if ht.didCommonHeaders { - return - } - ht.didCommonHeaders = true - - h := ht.rw.Header() - h["Date"] = nil // suppress Date to make tests happy; TODO: restore - h.Set("Content-Type", "application/grpc") - - // Predeclare trailers we'll set later in WriteStatus (after the body). - // This is a SHOULD in the HTTP RFC, and the way you add (known) - // Trailers per the net/http.ResponseWriter contract. - // See https://golang.org/pkg/net/http/#ResponseWriter - // and https://golang.org/pkg/net/http/#example_ResponseWriter_trailers - h.Add("Trailer", "Grpc-Status") - h.Add("Trailer", "Grpc-Message") - h.Add("Trailer", "Grpc-Status-Details-Bin") - - if s.sendCompress != "" { - h.Set("Grpc-Encoding", s.sendCompress) - } -} - -func (ht *serverHandlerTransport) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - return ht.do(func() { - ht.writeCommonHeaders(s) - ht.rw.Write(hdr) - ht.rw.Write(data) - if !opts.Delay { - ht.rw.(http.Flusher).Flush() - } - }) -} - -func (ht *serverHandlerTransport) WriteHeader(s *Stream, md metadata.MD) error { - return ht.do(func() { - ht.writeCommonHeaders(s) - h := ht.rw.Header() - for k, vv := range md { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - v = encodeMetadataHeader(k, v) - h.Add(k, v) - } - } - ht.rw.WriteHeader(200) - ht.rw.(http.Flusher).Flush() - }) -} - -func (ht *serverHandlerTransport) HandleStreams(startStream func(*Stream), traceCtx func(context.Context, string) context.Context) { - // With this transport type there will be exactly 1 stream: this HTTP request. - - ctx := contextFromRequest(ht.req) - var cancel context.CancelFunc - if ht.timeoutSet { - ctx, cancel = context.WithTimeout(ctx, ht.timeout) - } else { - ctx, cancel = context.WithCancel(ctx) - } - - // requestOver is closed when either the request's context is done - // or the status has been written via WriteStatus. - requestOver := make(chan struct{}) - - // clientGone receives a single value if peer is gone, either - // because the underlying connection is dead or because the - // peer sends an http2 RST_STREAM. - clientGone := ht.rw.(http.CloseNotifier).CloseNotify() - go func() { - select { - case <-requestOver: - return - case <-ht.closedCh: - case <-clientGone: - } - cancel() - }() - - req := ht.req - - s := &Stream{ - id: 0, // irrelevant - requestRead: func(int) {}, - cancel: cancel, - buf: newRecvBuffer(), - st: ht, - method: req.URL.Path, - recvCompress: req.Header.Get("grpc-encoding"), - } - pr := &peer.Peer{ - Addr: ht.RemoteAddr(), - } - if req.TLS != nil { - pr.AuthInfo = credentials.TLSInfo{State: *req.TLS} - } - ctx = metadata.NewIncomingContext(ctx, ht.headerMD) - ctx = peer.NewContext(ctx, pr) - s.ctx = newContextWithStream(ctx, s) - s.trReader = &transportReader{ - reader: &recvBufferReader{ctx: s.ctx, recv: s.buf}, - windowHandler: func(int) {}, - } - - // readerDone is closed when the Body.Read-ing goroutine exits. - readerDone := make(chan struct{}) - go func() { - defer close(readerDone) - - // TODO: minimize garbage, optimize recvBuffer code/ownership - const readSize = 8196 - for buf := make([]byte, readSize); ; { - n, err := req.Body.Read(buf) - if n > 0 { - s.buf.put(recvMsg{data: buf[:n:n]}) - buf = buf[n:] - } - if err != nil { - s.buf.put(recvMsg{err: mapRecvMsgError(err)}) - return - } - if len(buf) == 0 { - buf = make([]byte, readSize) - } - } - }() - - // startStream is provided by the *grpc.Server's serveStreams. - // It starts a goroutine serving s and exits immediately. - // The goroutine that is started is the one that then calls - // into ht, calling WriteHeader, Write, WriteStatus, Close, etc. - startStream(s) - - ht.runStream() - close(requestOver) - - // Wait for reading goroutine to finish. - req.Body.Close() - <-readerDone -} - -func (ht *serverHandlerTransport) runStream() { - for { - select { - case fn, ok := <-ht.writes: - if !ok { - return - } - fn() - case <-ht.closedCh: - return - } - } -} - -func (ht *serverHandlerTransport) Drain() { - panic("Drain() is not implemented") -} - -// mapRecvMsgError returns the non-nil err into the appropriate -// error value as expected by callers of *grpc.parser.recvMsg. -// In particular, in can only be: -// * io.EOF -// * io.ErrUnexpectedEOF -// * of type transport.ConnectionError -// * of type transport.StreamError -func mapRecvMsgError(err error) error { - if err == io.EOF || err == io.ErrUnexpectedEOF { - return err - } - if se, ok := err.(http2.StreamError); ok { - if code, ok := http2ErrConvTab[se.Code]; ok { - return StreamError{ - Code: code, - Desc: se.Error(), - } - } - } - return connectionErrorf(true, err, err.Error()) -} diff --git a/vendor/google.golang.org/grpc/transport/handler_server_test.go b/vendor/google.golang.org/grpc/transport/handler_server_test.go deleted file mode 100644 index 8505e1a..0000000 --- a/vendor/google.golang.org/grpc/transport/handler_server_test.go +++ /dev/null @@ -1,481 +0,0 @@ -/* - * - * Copyright 2016 gRPC authors. - * - * 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 transport - -import ( - "errors" - "fmt" - "io" - "net/http" - "net/http/httptest" - "net/url" - "reflect" - "sync" - "testing" - "time" - - "github.com/golang/protobuf/proto" - dpb "github.com/golang/protobuf/ptypes/duration" - "golang.org/x/net/context" - epb "google.golang.org/genproto/googleapis/rpc/errdetails" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/status" -) - -func TestHandlerTransport_NewServerHandlerTransport(t *testing.T) { - type testCase struct { - name string - req *http.Request - wantErr string - modrw func(http.ResponseWriter) http.ResponseWriter - check func(*serverHandlerTransport, *testCase) error - } - tests := []testCase{ - { - name: "http/1.1", - req: &http.Request{ - ProtoMajor: 1, - ProtoMinor: 1, - }, - wantErr: "gRPC requires HTTP/2", - }, - { - name: "bad method", - req: &http.Request{ - ProtoMajor: 2, - Method: "GET", - Header: http.Header{}, - RequestURI: "/", - }, - wantErr: "invalid gRPC request method", - }, - { - name: "bad content type", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/foo"}, - }, - RequestURI: "/service/foo.bar", - }, - wantErr: "invalid gRPC request content-type", - }, - { - name: "not flusher", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/grpc"}, - }, - RequestURI: "/service/foo.bar", - }, - modrw: func(w http.ResponseWriter) http.ResponseWriter { - // Return w without its Flush method - type onlyCloseNotifier interface { - http.ResponseWriter - http.CloseNotifier - } - return struct{ onlyCloseNotifier }{w.(onlyCloseNotifier)} - }, - wantErr: "gRPC requires a ResponseWriter supporting http.Flusher", - }, - { - name: "not closenotifier", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/grpc"}, - }, - RequestURI: "/service/foo.bar", - }, - modrw: func(w http.ResponseWriter) http.ResponseWriter { - // Return w without its CloseNotify method - type onlyFlusher interface { - http.ResponseWriter - http.Flusher - } - return struct{ onlyFlusher }{w.(onlyFlusher)} - }, - wantErr: "gRPC requires a ResponseWriter supporting http.CloseNotifier", - }, - { - name: "valid", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/grpc"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - }, - check: func(t *serverHandlerTransport, tt *testCase) error { - if t.req != tt.req { - return fmt.Errorf("t.req = %p; want %p", t.req, tt.req) - } - if t.rw == nil { - return errors.New("t.rw = nil; want non-nil") - } - return nil - }, - }, - { - name: "with timeout", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": []string{"application/grpc"}, - "Grpc-Timeout": {"200m"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - }, - check: func(t *serverHandlerTransport, tt *testCase) error { - if !t.timeoutSet { - return errors.New("timeout not set") - } - if want := 200 * time.Millisecond; t.timeout != want { - return fmt.Errorf("timeout = %v; want %v", t.timeout, want) - } - return nil - }, - }, - { - name: "with bad timeout", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": []string{"application/grpc"}, - "Grpc-Timeout": {"tomorrow"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - }, - wantErr: `stream error: code = Internal desc = "malformed time-out: transport: timeout unit is not recognized: \"tomorrow\""`, - }, - { - name: "with metadata", - req: &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": []string{"application/grpc"}, - "meta-foo": {"foo-val"}, - "meta-bar": {"bar-val1", "bar-val2"}, - "user-agent": {"x/y a/b"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - }, - check: func(ht *serverHandlerTransport, tt *testCase) error { - want := metadata.MD{ - "meta-bar": {"bar-val1", "bar-val2"}, - "user-agent": {"x/y a/b"}, - "meta-foo": {"foo-val"}, - } - - if !reflect.DeepEqual(ht.headerMD, want) { - return fmt.Errorf("metdata = %#v; want %#v", ht.headerMD, want) - } - return nil - }, - }, - } - - for _, tt := range tests { - rw := newTestHandlerResponseWriter() - if tt.modrw != nil { - rw = tt.modrw(rw) - } - got, gotErr := NewServerHandlerTransport(rw, tt.req) - if (gotErr != nil) != (tt.wantErr != "") || (gotErr != nil && gotErr.Error() != tt.wantErr) { - t.Errorf("%s: error = %v; want %q", tt.name, gotErr, tt.wantErr) - continue - } - if gotErr != nil { - continue - } - if tt.check != nil { - if err := tt.check(got.(*serverHandlerTransport), &tt); err != nil { - t.Errorf("%s: %v", tt.name, err) - } - } - } -} - -type testHandlerResponseWriter struct { - *httptest.ResponseRecorder - closeNotify chan bool -} - -func (w testHandlerResponseWriter) CloseNotify() <-chan bool { return w.closeNotify } -func (w testHandlerResponseWriter) Flush() {} - -func newTestHandlerResponseWriter() http.ResponseWriter { - return testHandlerResponseWriter{ - ResponseRecorder: httptest.NewRecorder(), - closeNotify: make(chan bool, 1), - } -} - -type handleStreamTest struct { - t *testing.T - bodyw *io.PipeWriter - req *http.Request - rw testHandlerResponseWriter - ht *serverHandlerTransport -} - -func newHandleStreamTest(t *testing.T) *handleStreamTest { - bodyr, bodyw := io.Pipe() - req := &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/grpc"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - Body: bodyr, - } - rw := newTestHandlerResponseWriter().(testHandlerResponseWriter) - ht, err := NewServerHandlerTransport(rw, req) - if err != nil { - t.Fatal(err) - } - return &handleStreamTest{ - t: t, - bodyw: bodyw, - ht: ht.(*serverHandlerTransport), - rw: rw, - } -} - -func TestHandlerTransport_HandleStreams(t *testing.T) { - st := newHandleStreamTest(t) - handleStream := func(s *Stream) { - if want := "/service/foo.bar"; s.method != want { - t.Errorf("stream method = %q; want %q", s.method, want) - } - st.bodyw.Close() // no body - st.ht.WriteStatus(s, status.New(codes.OK, "")) - } - st.ht.HandleStreams( - func(s *Stream) { go handleStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) - wantHeader := http.Header{ - "Date": nil, - "Content-Type": {"application/grpc"}, - "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, - "Grpc-Status": {"0"}, - } - if !reflect.DeepEqual(st.rw.HeaderMap, wantHeader) { - t.Errorf("Header+Trailer Map: %#v; want %#v", st.rw.HeaderMap, wantHeader) - } -} - -// Tests that codes.Unimplemented will close the body, per comment in handler_server.go. -func TestHandlerTransport_HandleStreams_Unimplemented(t *testing.T) { - handleStreamCloseBodyTest(t, codes.Unimplemented, "thingy is unimplemented") -} - -// Tests that codes.InvalidArgument will close the body, per comment in handler_server.go. -func TestHandlerTransport_HandleStreams_InvalidArgument(t *testing.T) { - handleStreamCloseBodyTest(t, codes.InvalidArgument, "bad arg") -} - -func handleStreamCloseBodyTest(t *testing.T, statusCode codes.Code, msg string) { - st := newHandleStreamTest(t) - - handleStream := func(s *Stream) { - st.ht.WriteStatus(s, status.New(statusCode, msg)) - } - st.ht.HandleStreams( - func(s *Stream) { go handleStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) - wantHeader := http.Header{ - "Date": nil, - "Content-Type": {"application/grpc"}, - "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, - "Grpc-Status": {fmt.Sprint(uint32(statusCode))}, - "Grpc-Message": {encodeGrpcMessage(msg)}, - } - - if !reflect.DeepEqual(st.rw.HeaderMap, wantHeader) { - t.Errorf("Header+Trailer mismatch.\n got: %#v\nwant: %#v", st.rw.HeaderMap, wantHeader) - } -} - -func TestHandlerTransport_HandleStreams_Timeout(t *testing.T) { - bodyr, bodyw := io.Pipe() - req := &http.Request{ - ProtoMajor: 2, - Method: "POST", - Header: http.Header{ - "Content-Type": {"application/grpc"}, - "Grpc-Timeout": {"200m"}, - }, - URL: &url.URL{ - Path: "/service/foo.bar", - }, - RequestURI: "/service/foo.bar", - Body: bodyr, - } - rw := newTestHandlerResponseWriter().(testHandlerResponseWriter) - ht, err := NewServerHandlerTransport(rw, req) - if err != nil { - t.Fatal(err) - } - runStream := func(s *Stream) { - defer bodyw.Close() - select { - case <-s.ctx.Done(): - case <-time.After(5 * time.Second): - t.Errorf("timeout waiting for ctx.Done") - return - } - err := s.ctx.Err() - if err != context.DeadlineExceeded { - t.Errorf("ctx.Err = %v; want %v", err, context.DeadlineExceeded) - return - } - ht.WriteStatus(s, status.New(codes.DeadlineExceeded, "too slow")) - } - ht.HandleStreams( - func(s *Stream) { go runStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) - wantHeader := http.Header{ - "Date": nil, - "Content-Type": {"application/grpc"}, - "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, - "Grpc-Status": {"4"}, - "Grpc-Message": {encodeGrpcMessage("too slow")}, - } - if !reflect.DeepEqual(rw.HeaderMap, wantHeader) { - t.Errorf("Header+Trailer Map mismatch.\n got: %#v\nwant: %#v", rw.HeaderMap, wantHeader) - } -} - -// TestHandlerTransport_HandleStreams_MultiWriteStatus ensures that -// concurrent "WriteStatus"s do not panic writing to closed "writes" channel. -func TestHandlerTransport_HandleStreams_MultiWriteStatus(t *testing.T) { - testHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) { - if want := "/service/foo.bar"; s.method != want { - t.Errorf("stream method = %q; want %q", s.method, want) - } - st.bodyw.Close() // no body - - var wg sync.WaitGroup - wg.Add(5) - for i := 0; i < 5; i++ { - go func() { - defer wg.Done() - st.ht.WriteStatus(s, status.New(codes.OK, "")) - }() - } - wg.Wait() - }) -} - -// TestHandlerTransport_HandleStreams_WriteStatusWrite ensures that "Write" -// following "WriteStatus" does not panic writing to closed "writes" channel. -func TestHandlerTransport_HandleStreams_WriteStatusWrite(t *testing.T) { - testHandlerTransportHandleStreams(t, func(st *handleStreamTest, s *Stream) { - if want := "/service/foo.bar"; s.method != want { - t.Errorf("stream method = %q; want %q", s.method, want) - } - st.bodyw.Close() // no body - - st.ht.WriteStatus(s, status.New(codes.OK, "")) - st.ht.Write(s, []byte("hdr"), []byte("data"), &Options{}) - }) -} - -func testHandlerTransportHandleStreams(t *testing.T, handleStream func(st *handleStreamTest, s *Stream)) { - st := newHandleStreamTest(t) - st.ht.HandleStreams( - func(s *Stream) { go handleStream(st, s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) -} - -func TestHandlerTransport_HandleStreams_ErrDetails(t *testing.T) { - errDetails := []proto.Message{ - &epb.RetryInfo{ - RetryDelay: &dpb.Duration{Seconds: 60}, - }, - &epb.ResourceInfo{ - ResourceType: "foo bar", - ResourceName: "service.foo.bar", - Owner: "User", - }, - } - - statusCode := codes.ResourceExhausted - msg := "you are being throttled" - st, err := status.New(statusCode, msg).WithDetails(errDetails...) - if err != nil { - t.Fatal(err) - } - - stBytes, err := proto.Marshal(st.Proto()) - if err != nil { - t.Fatal(err) - } - - hst := newHandleStreamTest(t) - handleStream := func(s *Stream) { - hst.ht.WriteStatus(s, st) - } - hst.ht.HandleStreams( - func(s *Stream) { go handleStream(s) }, - func(ctx context.Context, method string) context.Context { return ctx }, - ) - wantHeader := http.Header{ - "Date": nil, - "Content-Type": {"application/grpc"}, - "Trailer": {"Grpc-Status", "Grpc-Message", "Grpc-Status-Details-Bin"}, - "Grpc-Status": {fmt.Sprint(uint32(statusCode))}, - "Grpc-Message": {encodeGrpcMessage(msg)}, - "Grpc-Status-Details-Bin": {encodeBinHeader(stBytes)}, - } - - if !reflect.DeepEqual(hst.rw.HeaderMap, wantHeader) { - t.Errorf("Header+Trailer mismatch.\n got: %#v\nwant: %#v", hst.rw.HeaderMap, wantHeader) - } -} diff --git a/vendor/google.golang.org/grpc/transport/http2_client.go b/vendor/google.golang.org/grpc/transport/http2_client.go deleted file mode 100644 index b7f1f54..0000000 --- a/vendor/google.golang.org/grpc/transport/http2_client.go +++ /dev/null @@ -1,1379 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "bytes" - "fmt" - "io" - "math" - "net" - "strings" - "sync" - "sync/atomic" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" -) - -// http2Client implements the ClientTransport interface with HTTP2. -type http2Client struct { - ctx context.Context - cancel context.CancelFunc - userAgent string - md interface{} - conn net.Conn // underlying communication channel - remoteAddr net.Addr - localAddr net.Addr - authInfo credentials.AuthInfo // auth info about the connection - nextID uint32 // the next stream ID to be used - - // goAway is closed to notify the upper layer (i.e., addrConn.transportMonitor) - // that the server sent GoAway on this transport. - goAway chan struct{} - // awakenKeepalive is used to wake up keepalive when after it has gone dormant. - awakenKeepalive chan struct{} - - framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder - - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *controlBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - // localSendQuota limits the amount of data that can be scheduled - // for writing before it is actually written out. - localSendQuota *quotaPool - // streamsQuota limits the max number of concurrent streams. - streamsQuota *quotaPool - - // The scheme used: https if TLS is on, http otherwise. - scheme string - - isSecure bool - - creds []credentials.PerRPCCredentials - - // Boolean to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - kp keepalive.ClientParameters - - statsHandler stats.Handler - - initialWindowSize int32 - - bdpEst *bdpEstimator - outQuotaVersion uint32 - - // onSuccess is a callback that client transport calls upon - // receiving server preface to signal that a succefull HTTP2 - // connection was established. - onSuccess func() - - mu sync.Mutex // guard the following variables - state transportState // the state of underlying connection - activeStreams map[uint32]*Stream - // The max number of concurrent streams - maxStreams int - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 - // prevGoAway ID records the Last-Stream-ID in the previous GOAway frame. - prevGoAwayID uint32 - // goAwayReason records the http2.ErrCode and debug data received with the - // GoAway frame. - goAwayReason GoAwayReason -} - -func dial(ctx context.Context, fn func(context.Context, string) (net.Conn, error), addr string) (net.Conn, error) { - if fn != nil { - return fn(ctx, addr) - } - return dialContext(ctx, "tcp", addr) -} - -func isTemporary(err error) bool { - switch err { - case io.EOF: - // Connection closures may be resolved upon retry, and are thus - // treated as temporary. - return true - case context.DeadlineExceeded: - // In Go 1.7, context.DeadlineExceeded implements Timeout(), and this - // special case is not needed. Until then, we need to keep this - // clause. - return true - } - - switch err := err.(type) { - case interface { - Temporary() bool - }: - return err.Temporary() - case interface { - Timeout() bool - }: - // Timeouts may be resolved upon retry, and are thus treated as - // temporary. - return err.Timeout() - } - return false -} - -// newHTTP2Client constructs a connected ClientTransport to addr based on HTTP2 -// and starts to receive messages on it. Non-nil error returns if construction -// fails. -func newHTTP2Client(connectCtx, ctx context.Context, addr TargetInfo, opts ConnectOptions, onSuccess func()) (_ ClientTransport, err error) { - scheme := "http" - ctx, cancel := context.WithCancel(ctx) - defer func() { - if err != nil { - cancel() - } - }() - - conn, err := dial(connectCtx, opts.Dialer, addr.Addr) - if err != nil { - if opts.FailOnNonTempDialError { - return nil, connectionErrorf(isTemporary(err), err, "transport: error while dialing: %v", err) - } - return nil, connectionErrorf(true, err, "transport: Error while dialing %v", err) - } - // Any further errors will close the underlying connection - defer func(conn net.Conn) { - if err != nil { - conn.Close() - } - }(conn) - var ( - isSecure bool - authInfo credentials.AuthInfo - ) - if creds := opts.TransportCredentials; creds != nil { - scheme = "https" - conn, authInfo, err = creds.ClientHandshake(connectCtx, addr.Authority, conn) - if err != nil { - // Credentials handshake errors are typically considered permanent - // to avoid retrying on e.g. bad certificates. - temp := isTemporary(err) - return nil, connectionErrorf(temp, err, "transport: authentication handshake failed: %v", err) - } - isSecure = true - } - kp := opts.KeepaliveParams - // Validate keepalive parameters. - if kp.Time == 0 { - kp.Time = defaultClientKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultClientKeepaliveTimeout - } - dynamicWindow := true - icwz := int32(initialWindowSize) - if opts.InitialConnWindowSize >= defaultWindowSize { - icwz = opts.InitialConnWindowSize - dynamicWindow = false - } - var buf bytes.Buffer - writeBufSize := defaultWriteBufSize - if opts.WriteBufferSize > 0 { - writeBufSize = opts.WriteBufferSize - } - readBufSize := defaultReadBufSize - if opts.ReadBufferSize > 0 { - readBufSize = opts.ReadBufferSize - } - t := &http2Client{ - ctx: ctx, - cancel: cancel, - userAgent: opts.UserAgent, - md: addr.Metadata, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: authInfo, - // The client initiated stream id is odd starting from 1. - nextID: 1, - goAway: make(chan struct{}), - awakenKeepalive: make(chan struct{}, 1), - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - framer: newFramer(conn, writeBufSize, readBufSize), - controlBuf: newControlBuffer(), - fc: &inFlow{limit: uint32(icwz)}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - localSendQuota: newQuotaPool(defaultLocalSendQuota), - scheme: scheme, - state: reachable, - activeStreams: make(map[uint32]*Stream), - isSecure: isSecure, - creds: opts.PerRPCCredentials, - maxStreams: defaultMaxStreamsClient, - streamsQuota: newQuotaPool(defaultMaxStreamsClient), - streamSendQuota: defaultWindowSize, - kp: kp, - statsHandler: opts.StatsHandler, - initialWindowSize: initialWindowSize, - onSuccess: onSuccess, - } - if opts.InitialWindowSize >= defaultWindowSize { - t.initialWindowSize = opts.InitialWindowSize - dynamicWindow = false - } - if dynamicWindow { - t.bdpEst = &bdpEstimator{ - bdp: initialWindowSize, - updateFlowControl: t.updateFlowControl, - } - } - // Make sure awakenKeepalive can't be written upon. - // keepalive routine will make it writable, if need be. - t.awakenKeepalive <- struct{}{} - if t.statsHandler != nil { - t.ctx = t.statsHandler.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connBegin) - } - // Start the reader goroutine for incoming message. Each transport has - // a dedicated goroutine which reads HTTP2 frame from network. Then it - // dispatches the frame to the corresponding stream entity. - go t.reader() - // Send connection preface to server. - n, err := t.conn.Write(clientPreface) - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write client preface: %v", err) - } - if n != len(clientPreface) { - t.Close() - return nil, connectionErrorf(true, err, "transport: preface mismatch, wrote %d bytes; want %d", n, len(clientPreface)) - } - if t.initialWindowSize != defaultWindowSize { - err = t.framer.fr.WriteSettings(http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(t.initialWindowSize), - }) - } else { - err = t.framer.fr.WriteSettings() - } - if err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write initial settings frame: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(icwz - defaultWindowSize); delta > 0 { - if err := t.framer.fr.WriteWindowUpdate(0, delta); err != nil { - t.Close() - return nil, connectionErrorf(true, err, "transport: failed to write window update: %v", err) - } - } - t.framer.writer.Flush() - go func() { - loopyWriter(t.ctx, t.controlBuf, t.itemHandler) - t.conn.Close() - }() - if t.kp.Time != infinity { - go t.keepalive() - } - return t, nil -} - -func (t *http2Client) newStream(ctx context.Context, callHdr *CallHdr) *Stream { - // TODO(zhaoq): Handle uint32 overflow of Stream.id. - s := &Stream{ - id: t.nextID, - done: make(chan struct{}), - goAway: make(chan struct{}), - method: callHdr.Method, - sendCompress: callHdr.SendCompress, - buf: newRecvBuffer(), - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - sendQuotaPool: newQuotaPool(int(t.streamSendQuota)), - headerChan: make(chan struct{}), - } - t.nextID += 2 - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } - // The client side stream context should have exactly the same life cycle with the user provided context. - // That means, s.ctx should be read-only. And s.ctx is done iff ctx is done. - // So we use the original context here instead of creating a copy. - s.ctx = ctx - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - goAway: s.goAway, - recv: s.buf, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) - }, - } - s.waiters = waiters{ - ctx: s.ctx, - tctx: t.ctx, - done: s.done, - goAway: s.goAway, - } - return s -} - -// NewStream creates a stream and registers it into the transport as "active" -// streams. -func (t *http2Client) NewStream(ctx context.Context, callHdr *CallHdr) (_ *Stream, err error) { - pr := &peer.Peer{ - Addr: t.remoteAddr, - } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - ctx = peer.NewContext(ctx, pr) - var ( - authData = make(map[string]string) - audience string - ) - // Create an audience string only if needed. - if len(t.creds) > 0 || callHdr.Creds != nil { - // Construct URI required to get auth request metadata. - // Omit port if it is the default one. - host := strings.TrimSuffix(callHdr.Host, ":443") - pos := strings.LastIndex(callHdr.Method, "/") - if pos == -1 { - pos = len(callHdr.Method) - } - audience = "https://" + host + callHdr.Method[:pos] - } - for _, c := range t.creds { - data, err := c.GetRequestMetadata(ctx, audience) - if err != nil { - return nil, streamErrorf(codes.Internal, "transport: %v", err) - } - for k, v := range data { - // Capital header names are illegal in HTTP/2. - k = strings.ToLower(k) - authData[k] = v - } - } - callAuthData := map[string]string{} - // Check if credentials.PerRPCCredentials were provided via call options. - // Note: if these credentials are provided both via dial options and call - // options, then both sets of credentials will be applied. - if callCreds := callHdr.Creds; callCreds != nil { - if !t.isSecure && callCreds.RequireTransportSecurity() { - return nil, streamErrorf(codes.Unauthenticated, "transport: cannot send secure credentials on an insecure connection") - } - data, err := callCreds.GetRequestMetadata(ctx, audience) - if err != nil { - return nil, streamErrorf(codes.Internal, "transport: %v", err) - } - for k, v := range data { - // Capital header names are illegal in HTTP/2 - k = strings.ToLower(k) - callAuthData[k] = v - } - } - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return nil, ErrConnClosing - } - if t.state == draining { - t.mu.Unlock() - return nil, errStreamDrain - } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing - } - t.mu.Unlock() - // Get a quota of 1 from streamsQuota. - if _, _, err := t.streamsQuota.get(1, waiters{ctx: ctx, tctx: t.ctx}); err != nil { - return nil, err - } - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - // Make the slice of certain predictable size to reduce allocations made by append. - hfLen := 7 // :method, :scheme, :path, :authority, content-type, user-agent, te - hfLen += len(authData) + len(callAuthData) - headerFields := make([]hpack.HeaderField, 0, hfLen) - headerFields = append(headerFields, hpack.HeaderField{Name: ":method", Value: "POST"}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":scheme", Value: t.scheme}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":path", Value: callHdr.Method}) - headerFields = append(headerFields, hpack.HeaderField{Name: ":authority", Value: callHdr.Host}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "user-agent", Value: t.userAgent}) - headerFields = append(headerFields, hpack.HeaderField{Name: "te", Value: "trailers"}) - - if callHdr.SendCompress != "" { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: callHdr.SendCompress}) - } - if dl, ok := ctx.Deadline(); ok { - // Send out timeout regardless its value. The server can detect timeout context by itself. - // TODO(mmukhi): Perhaps this field should be updated when actually writing out to the wire. - timeout := dl.Sub(time.Now()) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-timeout", Value: encodeTimeout(timeout)}) - } - for k, v := range authData { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - for k, v := range callAuthData { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - if b := stats.OutgoingTags(ctx); b != nil { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-tags-bin", Value: encodeBinHeader(b)}) - } - if b := stats.OutgoingTrace(ctx); b != nil { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-trace-bin", Value: encodeBinHeader(b)}) - } - if md, ok := metadata.FromOutgoingContext(ctx); ok { - for k, vv := range md { - // HTTP doesn't allow you to set pseudoheaders after non pseudoheaders were set. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - } - if md, ok := t.md.(*metadata.MD); ok { - for k, vv := range *md { - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - } - t.mu.Lock() - if t.state == draining { - t.mu.Unlock() - t.streamsQuota.add(1) - return nil, errStreamDrain - } - if t.state != reachable { - t.mu.Unlock() - return nil, ErrConnClosing - } - s := t.newStream(ctx, callHdr) - t.activeStreams[s.id] = s - // If the number of active streams change from 0 to 1, then check if keepalive - // has gone dormant. If so, wake it up. - if len(t.activeStreams) == 1 { - select { - case t.awakenKeepalive <- struct{}{}: - t.controlBuf.put(&ping{data: [8]byte{}}) - // Fill the awakenKeepalive channel again as this channel must be - // kept non-writable except at the point that the keepalive() - // goroutine is waiting either to be awaken or shutdown. - t.awakenKeepalive <- struct{}{} - default: - } - } - t.controlBuf.put(&headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: false, - }) - t.mu.Unlock() - - if t.statsHandler != nil { - outHeader := &stats.OutHeader{ - Client: true, - FullMethod: callHdr.Method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: callHdr.SendCompress, - } - t.statsHandler.HandleRPC(s.ctx, outHeader) - } - return s, nil -} - -// CloseStream clears the footprint of a stream when the stream is not needed any more. -// This must not be executed in reader's goroutine. -func (t *http2Client) CloseStream(s *Stream, err error) { - t.mu.Lock() - if t.activeStreams == nil { - t.mu.Unlock() - return - } - if err != nil { - // notify in-flight streams, before the deletion - s.write(recvMsg{err: err}) - } - delete(t.activeStreams, s.id) - if t.state == draining && len(t.activeStreams) == 0 { - // The transport is draining and s is the last live stream on t. - t.mu.Unlock() - t.Close() - return - } - t.mu.Unlock() - // rstStream is true in case the stream is being closed at the client-side - // and the server needs to be intimated about it by sending a RST_STREAM - // frame. - // To make sure this frame is written to the wire before the headers of the - // next stream waiting for streamsQuota, we add to streamsQuota pool only - // after having acquired the writableChan to send RST_STREAM out (look at - // the controller() routine). - var rstStream bool - var rstError http2.ErrCode - defer func() { - // In case, the client doesn't have to send RST_STREAM to server - // we can safely add back to streamsQuota pool now. - if !rstStream { - t.streamsQuota.add(1) - return - } - t.controlBuf.put(&resetStream{s.id, rstError}) - }() - s.mu.Lock() - rstStream = s.rstStream - rstError = s.rstError - if s.state == streamDone { - s.mu.Unlock() - return - } - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.state = streamDone - s.mu.Unlock() - if _, ok := err.(StreamError); ok { - rstStream = true - rstError = http2.ErrCodeCancel - } -} - -// Close kicks off the shutdown process of the transport. This should be called -// only once on a transport. Once it is called, the transport should not be -// accessed any more. -func (t *http2Client) Close() error { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return nil - } - t.state = closing - t.mu.Unlock() - t.cancel() - err := t.conn.Close() - t.mu.Lock() - streams := t.activeStreams - t.activeStreams = nil - t.mu.Unlock() - // Notify all active streams. - for _, s := range streams { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: ErrConnClosing}) - } - if t.statsHandler != nil { - connEnd := &stats.ConnEnd{ - Client: true, - } - t.statsHandler.HandleConn(t.ctx, connEnd) - } - return err -} - -// GracefulClose sets the state to draining, which prevents new streams from -// being created and causes the transport to be closed when the last active -// stream is closed. If there are no active streams, the transport is closed -// immediately. This does nothing if the transport is already draining or -// closing. -func (t *http2Client) GracefulClose() error { - t.mu.Lock() - switch t.state { - case closing, draining: - t.mu.Unlock() - return nil - } - t.state = draining - active := len(t.activeStreams) - t.mu.Unlock() - if active == 0 { - return t.Close() - } - return nil -} - -// Write formats the data into HTTP2 data frame(s) and sends it out. The caller -// should proceed only if Write returns nil. -func (t *http2Client) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-s.done: - return io.EOF - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - if hdr == nil && data == nil && opts.Last { - // stream.CloseSend uses this to send an empty frame with endStream=True - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: true, f: func() {}}) - return nil - } - // Add data to header frame so that we can equally distribute data across frames. - emptyLen := http2MaxFrameLen - len(hdr) - if emptyLen > len(data) { - emptyLen = len(data) - } - hdr = append(hdr, data[:emptyLen]...) - data = data[emptyLen:] - var ( - streamQuota int - streamQuotaVer uint32 - err error - ) - for idx, r := range [][]byte{hdr, data} { - for len(r) > 0 { - size := http2MaxFrameLen - if size > len(r) { - size = len(r) - } - if streamQuota == 0 { // Used up all the locally cached stream quota. - // Get all the stream quota there is. - streamQuota, streamQuotaVer, err = s.sendQuotaPool.get(math.MaxInt32, s.waiters) - if err != nil { - return err - } - } - if size > streamQuota { - size = streamQuota - } - - // Get size worth quota from transport. - tq, _, err := t.sendQuotaPool.get(size, s.waiters) - if err != nil { - return err - } - if tq < size { - size = tq - } - ltq, _, err := t.localSendQuota.get(size, s.waiters) - if err != nil { - return err - } - // even if ltq is smaller than size we don't adjust size since - // ltq is only a soft limit. - streamQuota -= size - p := r[:size] - var endStream bool - // See if this is the last frame to be written. - if opts.Last { - if len(r)-size == 0 { // No more data in r after this iteration. - if idx == 0 { // We're writing data header. - if len(data) == 0 { // There's no data to follow. - endStream = true - } - } else { // We're writing data. - endStream = true - } - } - } - success := func() { - ltq := ltq - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: endStream, d: p, f: func() { t.localSendQuota.add(ltq) }}) - r = r[size:] - } - failure := func() { // The stream quota version must have changed. - // Our streamQuota cache is invalidated now, so give it back. - s.sendQuotaPool.lockedAdd(streamQuota + size) - } - if !s.sendQuotaPool.compareAndExecute(streamQuotaVer, success, failure) { - // Couldn't send this chunk out. - t.sendQuotaPool.add(size) - t.localSendQuota.add(ltq) - streamQuota = 0 - } - } - } - if streamQuota > 0 { // Add the left over quota back to stream. - s.sendQuotaPool.add(streamQuota) - } - if !opts.Last { - return nil - } - s.mu.Lock() - if s.state != streamDone { - s.state = streamWriteDone - } - s.mu.Unlock() - return nil -} - -func (t *http2Client) getStream(f http2.Frame) (*Stream, bool) { - t.mu.Lock() - defer t.mu.Unlock() - s, ok := t.activeStreams[f.Header().StreamID] - return s, ok -} - -// adjustWindow sends out extra window update over the initial window size -// of stream if the application is requesting data larger in size than -// the window. -func (t *http2Client) adjustWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := s.fc.maybeAdjust(n); w > 0 { - // Piggyback connection's window update along. - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. -func (t *http2Client) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := s.fc.onRead(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -// updateFlowControl updates the incoming flow control windows -// for the transport and the stream based on the current bdp -// estimation. -func (t *http2Client) updateFlowControl(n uint32) { - t.mu.Lock() - for _, s := range t.activeStreams { - s.fc.newLimit(n) - } - t.initialWindowSize = int32(n) - t.mu.Unlock() - t.controlBuf.put(&windowUpdate{0, t.fc.newLimit(n)}) - t.controlBuf.put(&settings{ - ss: []http2.Setting{ - { - ID: http2.SettingInitialWindowSize, - Val: uint32(n), - }, - }, - }) -} - -func (t *http2Client) handleData(f *http2.DataFrame) { - size := f.Header().Length - var sendBDPPing bool - if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(uint32(size)) - } - // Decouple connection's flow control from application's read. - // An update on connection's flow control should not depend on - // whether user application has read the data or not. Such a - // restriction is already imposed on the stream's flow control, - // and therefore the sender will be blocked anyways. - // Decoupling the connection flow control will prevent other - // active(fast) streams from starving in presence of slow or - // inactive streams. - // - // Furthermore, if a bdpPing is being sent out we can piggyback - // connection's window update for the bytes we just received. - if sendBDPPing { - if size != 0 { // Could've been an empty data frame. - t.controlBuf.put(&windowUpdate{0, uint32(size)}) - } - t.controlBuf.put(bdpPing) - } else { - if err := t.fc.onData(uint32(size)); err != nil { - t.Close() - return - } - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } - // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { - return - } - if size > 0 { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.rstStream = true - s.rstError = http2.ErrCodeFlowControl - s.finish(status.New(codes.Internal, err.Error())) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } - s.mu.Unlock() - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } - } - // The server has closed the stream without sending trailers. Record that - // the read direction is closed, and set the status appropriately. - if f.FrameHeader.Flags.Has(http2.FlagDataEndStream) { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - s.finish(status.New(codes.Internal, "server closed the stream without sending trailers")) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - } -} - -func (t *http2Client) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { - return - } - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - - code := http2.ErrCode(f.ErrCode) - if code == http2.ErrCodeRefusedStream { - // The stream was unprocessed by the server. - s.unprocessed = true - } - statusCode, ok := http2ErrConvTab[code] - if !ok { - warningf("transport: http2Client.handleRSTStream found no mapped gRPC status for the received http2 error %v", f.ErrCode) - statusCode = codes.Unknown - } - s.finish(status.Newf(statusCode, "stream terminated by RST_STREAM with error code: %v", f.ErrCode)) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) -} - -func (t *http2Client) handleSettings(f *http2.SettingsFrame, isFirst bool) { - if f.IsAck() { - return - } - var rs []http2.Setting - var ps []http2.Setting - isMaxConcurrentStreamsMissing := true - f.ForeachSetting(func(s http2.Setting) error { - if s.ID == http2.SettingMaxConcurrentStreams { - isMaxConcurrentStreamsMissing = false - } - if t.isRestrictive(s) { - rs = append(rs, s) - } else { - ps = append(ps, s) - } - return nil - }) - if isFirst && isMaxConcurrentStreamsMissing { - // This means server is imposing no limits on - // maximum number of concurrent streams initiated by client. - // So we must remove our self-imposed limit. - ps = append(ps, http2.Setting{ - ID: http2.SettingMaxConcurrentStreams, - Val: math.MaxUint32, - }) - } - t.applySettings(rs) - t.controlBuf.put(&settingsAck{}) - t.applySettings(ps) -} - -func (t *http2Client) isRestrictive(s http2.Setting) bool { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - return int(s.Val) < t.maxStreams - case http2.SettingInitialWindowSize: - // Note: we don't acquire a lock here to read streamSendQuota - // because the same goroutine updates it later. - return s.Val < t.streamSendQuota - } - return false -} - -func (t *http2Client) handlePing(f *http2.PingFrame) { - if f.IsAck() { - // Maybe it's a BDP ping. - if t.bdpEst != nil { - t.bdpEst.calculate(f.Data) - } - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) -} - -func (t *http2Client) handleGoAway(f *http2.GoAwayFrame) { - t.mu.Lock() - if t.state != reachable && t.state != draining { - t.mu.Unlock() - return - } - if f.ErrCode == http2.ErrCodeEnhanceYourCalm { - infof("Client received GoAway with http2.ErrCodeEnhanceYourCalm.") - } - id := f.LastStreamID - if id > 0 && id%2 != 1 { - t.mu.Unlock() - t.Close() - return - } - // A client can receive multiple GoAways from the server (see - // https://github.com/grpc/grpc-go/issues/1387). The idea is that the first - // GoAway will be sent with an ID of MaxInt32 and the second GoAway will be - // sent after an RTT delay with the ID of the last stream the server will - // process. - // - // Therefore, when we get the first GoAway we don't necessarily close any - // streams. While in case of second GoAway we close all streams created after - // the GoAwayId. This way streams that were in-flight while the GoAway from - // server was being sent don't get killed. - select { - case <-t.goAway: // t.goAway has been closed (i.e.,multiple GoAways). - // If there are multiple GoAways the first one should always have an ID greater than the following ones. - if id > t.prevGoAwayID { - t.mu.Unlock() - t.Close() - return - } - default: - t.setGoAwayReason(f) - close(t.goAway) - t.state = draining - } - // All streams with IDs greater than the GoAwayId - // and smaller than the previous GoAway ID should be killed. - upperLimit := t.prevGoAwayID - if upperLimit == 0 { // This is the first GoAway Frame. - upperLimit = math.MaxUint32 // Kill all streams after the GoAway ID. - } - for streamID, stream := range t.activeStreams { - if streamID > id && streamID <= upperLimit { - // The stream was unprocessed by the server. - stream.mu.Lock() - stream.unprocessed = true - stream.finish(statusGoAway) - stream.mu.Unlock() - close(stream.goAway) - } - } - t.prevGoAwayID = id - active := len(t.activeStreams) - t.mu.Unlock() - if active == 0 { - t.Close() - } -} - -// setGoAwayReason sets the value of t.goAwayReason based -// on the GoAway frame received. -// It expects a lock on transport's mutext to be held by -// the caller. -func (t *http2Client) setGoAwayReason(f *http2.GoAwayFrame) { - t.goAwayReason = GoAwayNoReason - switch f.ErrCode { - case http2.ErrCodeEnhanceYourCalm: - if string(f.DebugData()) == "too_many_pings" { - t.goAwayReason = GoAwayTooManyPings - } - } -} - -func (t *http2Client) GetGoAwayReason() GoAwayReason { - t.mu.Lock() - defer t.mu.Unlock() - return t.goAwayReason -} - -func (t *http2Client) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return - } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) - } -} - -// operateHeaders takes action on the decoded headers. -func (t *http2Client) operateHeaders(frame *http2.MetaHeadersFrame) { - s, ok := t.getStream(frame) - if !ok { - return - } - s.mu.Lock() - s.bytesReceived = true - s.mu.Unlock() - var state decodeState - if err := state.decodeResponseHeader(frame); err != nil { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: err}) - // Something wrong. Stops reading even when there is remaining. - return - } - - endStream := frame.StreamEnded() - var isHeader bool - defer func() { - if t.statsHandler != nil { - if isHeader { - inHeader := &stats.InHeader{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.ctx, inHeader) - } else { - inTrailer := &stats.InTrailer{ - Client: true, - WireLength: int(frame.Header().Length), - } - t.statsHandler.HandleRPC(s.ctx, inTrailer) - } - } - }() - - s.mu.Lock() - if !s.headerDone { - // Headers frame is not actually a trailers-only frame. - if !endStream { - s.recvCompress = state.encoding - if len(state.mdata) > 0 { - s.header = state.mdata - } - } - close(s.headerChan) - s.headerDone = true - isHeader = true - } - if !endStream || s.state == streamDone { - s.mu.Unlock() - return - } - if len(state.mdata) > 0 { - s.trailer = state.mdata - } - s.finish(state.status()) - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) -} - -func handleMalformedHTTP2(s *Stream, err error) { - s.mu.Lock() - if !s.headerDone { - close(s.headerChan) - s.headerDone = true - } - s.mu.Unlock() - s.write(recvMsg{err: err}) -} - -// reader runs as a separate goroutine in charge of reading data from network -// connection. -// -// TODO(zhaoq): currently one reader per transport. Investigate whether this is -// optimal. -// TODO(zhaoq): Check the validity of the incoming frame sequence. -func (t *http2Client) reader() { - // Check the validity of server preface. - frame, err := t.framer.fr.ReadFrame() - if err != nil { - t.Close() - return - } - atomic.CompareAndSwapUint32(&t.activity, 0, 1) - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - t.Close() - return - } - t.onSuccess() - t.handleSettings(sf, true) - - // loop to keep reading incoming messages on this transport. - for { - frame, err := t.framer.fr.ReadFrame() - atomic.CompareAndSwapUint32(&t.activity, 0, 1) - if err != nil { - // Abort an active stream if the http2.Framer returns a - // http2.StreamError. This can happen only if the server's response - // is malformed http2. - if se, ok := err.(http2.StreamError); ok { - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - // use error detail to provide better err message - handleMalformedHTTP2(s, streamErrorf(http2ErrConvTab[se.Code], "%v", t.framer.fr.ErrorDetail())) - } - continue - } else { - // Transport error. - t.Close() - return - } - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - t.operateHeaders(frame) - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame, false) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.GoAwayFrame: - t.handleGoAway(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - default: - errorf("transport: http2Client.reader got unhandled frame type %v.", frame) - } - } -} - -func (t *http2Client) applySettings(ss []http2.Setting) { - for _, s := range ss { - switch s.ID { - case http2.SettingMaxConcurrentStreams: - // TODO(zhaoq): This is a hack to avoid significant refactoring of the - // code to deal with the unrealistic int32 overflow. Probably will try - // to find a better way to handle this later. - if s.Val > math.MaxInt32 { - s.Val = math.MaxInt32 - } - ms := t.maxStreams - t.maxStreams = int(s.Val) - t.streamsQuota.add(int(s.Val) - ms) - case http2.SettingInitialWindowSize: - t.mu.Lock() - for _, stream := range t.activeStreams { - // Adjust the sending quota for each stream. - stream.sendQuotaPool.addAndUpdate(int(s.Val) - int(t.streamSendQuota)) - } - t.streamSendQuota = s.Val - t.mu.Unlock() - } - } -} - -// TODO(mmukhi): A lot of this code(and code in other places in the tranpsort layer) -// is duplicated between the client and the server. -// The transport layer needs to be refactored to take care of this. -func (t *http2Client) itemHandler(i item) (err error) { - defer func() { - if err != nil { - errorf(" error in itemHandler: %v", err) - } - }() - switch i := i.(type) { - case *dataFrame: - if err := t.framer.fr.WriteData(i.streamID, i.endStream, i.d); err != nil { - return err - } - i.f() - return nil - case *headerFrame: - t.hBuf.Reset() - for _, f := range i.hf { - t.hEnc.WriteField(f) - } - endHeaders := false - first := true - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - if first { - first = false - err = t.framer.fr.WriteHeaders(http2.HeadersFrameParam{ - StreamID: i.streamID, - BlockFragment: t.hBuf.Next(size), - EndStream: i.endStream, - EndHeaders: endHeaders, - }) - } else { - err = t.framer.fr.WriteContinuation( - i.streamID, - endHeaders, - t.hBuf.Next(size), - ) - } - if err != nil { - return err - } - } - return nil - case *windowUpdate: - return t.framer.fr.WriteWindowUpdate(i.streamID, i.increment) - case *settings: - return t.framer.fr.WriteSettings(i.ss...) - case *settingsAck: - return t.framer.fr.WriteSettingsAck() - case *resetStream: - // If the server needs to be to intimated about stream closing, - // then we need to make sure the RST_STREAM frame is written to - // the wire before the headers of the next stream waiting on - // streamQuota. We ensure this by adding to the streamsQuota pool - // only after having acquired the writableChan to send RST_STREAM. - err := t.framer.fr.WriteRSTStream(i.streamID, i.code) - t.streamsQuota.add(1) - return err - case *flushIO: - return t.framer.writer.Flush() - case *ping: - if !i.ack { - t.bdpEst.timesnap(i.data) - } - return t.framer.fr.WritePing(i.ack, i.data) - default: - errorf("transport: http2Client.controller got unexpected item type %v", i) - return fmt.Errorf("transport: http2Client.controller got unexpected item type %v", i) - } -} - -// keepalive running in a separate goroutune makes sure the connection is alive by sending pings. -func (t *http2Client) keepalive() { - p := &ping{data: [8]byte{}} - timer := time.NewTimer(t.kp.Time) - for { - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - // Check if keepalive should go dormant. - t.mu.Lock() - if len(t.activeStreams) < 1 && !t.kp.PermitWithoutStream { - // Make awakenKeepalive writable. - <-t.awakenKeepalive - t.mu.Unlock() - select { - case <-t.awakenKeepalive: - // If the control gets here a ping has been sent - // need to reset the timer with keepalive.Timeout. - case <-t.ctx.Done(): - return - } - } else { - t.mu.Unlock() - // Send ping. - t.controlBuf.put(p) - } - - // By the time control gets here a ping has been sent one way or the other. - timer.Reset(t.kp.Timeout) - select { - case <-timer.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - timer.Reset(t.kp.Time) - continue - } - t.Close() - return - case <-t.ctx.Done(): - if !timer.Stop() { - <-timer.C - } - return - } - case <-t.ctx.Done(): - if !timer.Stop() { - <-timer.C - } - return - } - } -} - -func (t *http2Client) Error() <-chan struct{} { - return t.ctx.Done() -} - -func (t *http2Client) GoAway() <-chan struct{} { - return t.goAway -} diff --git a/vendor/google.golang.org/grpc/transport/http2_server.go b/vendor/google.golang.org/grpc/transport/http2_server.go deleted file mode 100644 index 6d252c5..0000000 --- a/vendor/google.golang.org/grpc/transport/http2_server.go +++ /dev/null @@ -1,1215 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "bytes" - "errors" - "fmt" - "io" - "math" - "math/rand" - "net" - "strconv" - "sync" - "sync/atomic" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/peer" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/tap" -) - -// ErrIllegalHeaderWrite indicates that setting header is illegal because of -// the stream's state. -var ErrIllegalHeaderWrite = errors.New("transport: the stream is done or WriteHeader was already called") - -// http2Server implements the ServerTransport interface with HTTP2. -type http2Server struct { - ctx context.Context - cancel context.CancelFunc - conn net.Conn - remoteAddr net.Addr - localAddr net.Addr - maxStreamID uint32 // max stream ID ever seen - authInfo credentials.AuthInfo // auth info about the connection - inTapHandle tap.ServerInHandle - framer *framer - hBuf *bytes.Buffer // the buffer for HPACK encoding - hEnc *hpack.Encoder // HPACK encoder - // The max number of concurrent streams. - maxStreams uint32 - // controlBuf delivers all the control related tasks (e.g., window - // updates, reset streams, and various settings) to the controller. - controlBuf *controlBuffer - fc *inFlow - // sendQuotaPool provides flow control to outbound message. - sendQuotaPool *quotaPool - // localSendQuota limits the amount of data that can be scheduled - // for writing before it is actually written out. - localSendQuota *quotaPool - stats stats.Handler - // Flag to keep track of reading activity on transport. - // 1 is true and 0 is false. - activity uint32 // Accessed atomically. - // Keepalive and max-age parameters for the server. - kp keepalive.ServerParameters - - // Keepalive enforcement policy. - kep keepalive.EnforcementPolicy - // The time instance last ping was received. - lastPingAt time.Time - // Number of times the client has violated keepalive ping policy so far. - pingStrikes uint8 - // Flag to signify that number of ping strikes should be reset to 0. - // This is set whenever data or header frames are sent. - // 1 means yes. - resetPingStrikes uint32 // Accessed atomically. - initialWindowSize int32 - bdpEst *bdpEstimator - - mu sync.Mutex // guard the following - - // drainChan is initialized when drain(...) is called the first time. - // After which the server writes out the first GoAway(with ID 2^31-1) frame. - // Then an independent goroutine will be launched to later send the second GoAway. - // During this time we don't want to write another first GoAway(with ID 2^31 -1) frame. - // Thus call to drain(...) will be a no-op if drainChan is already initialized since draining is - // already underway. - drainChan chan struct{} - state transportState - activeStreams map[uint32]*Stream - // the per-stream outbound flow control window size set by the peer. - streamSendQuota uint32 - // idle is the time instant when the connection went idle. - // This is either the beginning of the connection or when the number of - // RPCs go down to 0. - // When the connection is busy, this value is set to 0. - idle time.Time -} - -// newHTTP2Server constructs a ServerTransport based on HTTP2. ConnectionError is -// returned if something goes wrong. -func newHTTP2Server(conn net.Conn, config *ServerConfig) (_ ServerTransport, err error) { - writeBufSize := defaultWriteBufSize - if config.WriteBufferSize > 0 { - writeBufSize = config.WriteBufferSize - } - readBufSize := defaultReadBufSize - if config.ReadBufferSize > 0 { - readBufSize = config.ReadBufferSize - } - framer := newFramer(conn, writeBufSize, readBufSize) - // Send initial settings as connection preface to client. - var isettings []http2.Setting - // TODO(zhaoq): Have a better way to signal "no limit" because 0 is - // permitted in the HTTP2 spec. - maxStreams := config.MaxStreams - if maxStreams == 0 { - maxStreams = math.MaxUint32 - } else { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingMaxConcurrentStreams, - Val: maxStreams, - }) - } - dynamicWindow := true - iwz := int32(initialWindowSize) - if config.InitialWindowSize >= defaultWindowSize { - iwz = config.InitialWindowSize - dynamicWindow = false - } - icwz := int32(initialWindowSize) - if config.InitialConnWindowSize >= defaultWindowSize { - icwz = config.InitialConnWindowSize - dynamicWindow = false - } - if iwz != defaultWindowSize { - isettings = append(isettings, http2.Setting{ - ID: http2.SettingInitialWindowSize, - Val: uint32(iwz)}) - } - if err := framer.fr.WriteSettings(isettings...); err != nil { - return nil, connectionErrorf(false, err, "transport: %v", err) - } - // Adjust the connection flow control window if needed. - if delta := uint32(icwz - defaultWindowSize); delta > 0 { - if err := framer.fr.WriteWindowUpdate(0, delta); err != nil { - return nil, connectionErrorf(false, err, "transport: %v", err) - } - } - kp := config.KeepaliveParams - if kp.MaxConnectionIdle == 0 { - kp.MaxConnectionIdle = defaultMaxConnectionIdle - } - if kp.MaxConnectionAge == 0 { - kp.MaxConnectionAge = defaultMaxConnectionAge - } - // Add a jitter to MaxConnectionAge. - kp.MaxConnectionAge += getJitter(kp.MaxConnectionAge) - if kp.MaxConnectionAgeGrace == 0 { - kp.MaxConnectionAgeGrace = defaultMaxConnectionAgeGrace - } - if kp.Time == 0 { - kp.Time = defaultServerKeepaliveTime - } - if kp.Timeout == 0 { - kp.Timeout = defaultServerKeepaliveTimeout - } - kep := config.KeepalivePolicy - if kep.MinTime == 0 { - kep.MinTime = defaultKeepalivePolicyMinTime - } - var buf bytes.Buffer - ctx, cancel := context.WithCancel(context.Background()) - t := &http2Server{ - ctx: ctx, - cancel: cancel, - conn: conn, - remoteAddr: conn.RemoteAddr(), - localAddr: conn.LocalAddr(), - authInfo: config.AuthInfo, - framer: framer, - hBuf: &buf, - hEnc: hpack.NewEncoder(&buf), - maxStreams: maxStreams, - inTapHandle: config.InTapHandle, - controlBuf: newControlBuffer(), - fc: &inFlow{limit: uint32(icwz)}, - sendQuotaPool: newQuotaPool(defaultWindowSize), - localSendQuota: newQuotaPool(defaultLocalSendQuota), - state: reachable, - activeStreams: make(map[uint32]*Stream), - streamSendQuota: defaultWindowSize, - stats: config.StatsHandler, - kp: kp, - idle: time.Now(), - kep: kep, - initialWindowSize: iwz, - } - if dynamicWindow { - t.bdpEst = &bdpEstimator{ - bdp: initialWindowSize, - updateFlowControl: t.updateFlowControl, - } - } - if t.stats != nil { - t.ctx = t.stats.TagConn(t.ctx, &stats.ConnTagInfo{ - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - }) - connBegin := &stats.ConnBegin{} - t.stats.HandleConn(t.ctx, connBegin) - } - t.framer.writer.Flush() - - defer func() { - if err != nil { - t.Close() - } - }() - - // Check the validity of client preface. - preface := make([]byte, len(clientPreface)) - if _, err := io.ReadFull(t.conn, preface); err != nil { - return nil, connectionErrorf(false, err, "transport: http2Server.HandleStreams failed to receive the preface from client: %v", err) - } - if !bytes.Equal(preface, clientPreface) { - return nil, connectionErrorf(false, nil, "transport: http2Server.HandleStreams received bogus greeting from client: %q", preface) - } - - frame, err := t.framer.fr.ReadFrame() - if err == io.EOF || err == io.ErrUnexpectedEOF { - return nil, err - } - if err != nil { - return nil, connectionErrorf(false, err, "transport: http2Server.HandleStreams failed to read initial settings frame: %v", err) - } - atomic.StoreUint32(&t.activity, 1) - sf, ok := frame.(*http2.SettingsFrame) - if !ok { - return nil, connectionErrorf(false, nil, "transport: http2Server.HandleStreams saw invalid preface type %T from client", frame) - } - t.handleSettings(sf) - - go func() { - loopyWriter(t.ctx, t.controlBuf, t.itemHandler) - t.conn.Close() - }() - go t.keepalive() - return t, nil -} - -// operateHeader takes action on the decoded headers. -func (t *http2Server) operateHeaders(frame *http2.MetaHeadersFrame, handle func(*Stream), traceCtx func(context.Context, string) context.Context) (close bool) { - streamID := frame.Header().StreamID - - var state decodeState - for _, hf := range frame.Fields { - if err := state.processHeaderField(hf); err != nil { - if se, ok := err.(StreamError); ok { - t.controlBuf.put(&resetStream{streamID, statusCodeConvTab[se.Code]}) - } - return - } - } - - buf := newRecvBuffer() - s := &Stream{ - id: streamID, - st: t, - buf: buf, - fc: &inFlow{limit: uint32(t.initialWindowSize)}, - recvCompress: state.encoding, - method: state.method, - } - - if frame.StreamEnded() { - // s is just created by the caller. No lock needed. - s.state = streamReadDone - } - if state.timeoutSet { - s.ctx, s.cancel = context.WithTimeout(t.ctx, state.timeout) - } else { - s.ctx, s.cancel = context.WithCancel(t.ctx) - } - pr := &peer.Peer{ - Addr: t.remoteAddr, - } - // Attach Auth info if there is any. - if t.authInfo != nil { - pr.AuthInfo = t.authInfo - } - s.ctx = peer.NewContext(s.ctx, pr) - // Cache the current stream to the context so that the server application - // can find out. Required when the server wants to send some metadata - // back to the client (unary call only). - s.ctx = newContextWithStream(s.ctx, s) - // Attach the received metadata to the context. - if len(state.mdata) > 0 { - s.ctx = metadata.NewIncomingContext(s.ctx, state.mdata) - } - if state.statsTags != nil { - s.ctx = stats.SetIncomingTags(s.ctx, state.statsTags) - } - if state.statsTrace != nil { - s.ctx = stats.SetIncomingTrace(s.ctx, state.statsTrace) - } - if t.inTapHandle != nil { - var err error - info := &tap.Info{ - FullMethodName: state.method, - } - s.ctx, err = t.inTapHandle(s.ctx, info) - if err != nil { - warningf("transport: http2Server.operateHeaders got an error from InTapHandle: %v", err) - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeRefusedStream}) - return - } - } - t.mu.Lock() - if t.state != reachable { - t.mu.Unlock() - return - } - if uint32(len(t.activeStreams)) >= t.maxStreams { - t.mu.Unlock() - t.controlBuf.put(&resetStream{streamID, http2.ErrCodeRefusedStream}) - return - } - if streamID%2 != 1 || streamID <= t.maxStreamID { - t.mu.Unlock() - // illegal gRPC stream id. - errorf("transport: http2Server.HandleStreams received an illegal stream id: %v", streamID) - return true - } - t.maxStreamID = streamID - s.sendQuotaPool = newQuotaPool(int(t.streamSendQuota)) - t.activeStreams[streamID] = s - if len(t.activeStreams) == 1 { - t.idle = time.Time{} - } - t.mu.Unlock() - s.requestRead = func(n int) { - t.adjustWindow(s, uint32(n)) - } - s.ctx = traceCtx(s.ctx, s.method) - if t.stats != nil { - s.ctx = t.stats.TagRPC(s.ctx, &stats.RPCTagInfo{FullMethodName: s.method}) - inHeader := &stats.InHeader{ - FullMethod: s.method, - RemoteAddr: t.remoteAddr, - LocalAddr: t.localAddr, - Compression: s.recvCompress, - WireLength: int(frame.Header().Length), - } - t.stats.HandleRPC(s.ctx, inHeader) - } - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - recv: s.buf, - }, - windowHandler: func(n int) { - t.updateWindow(s, uint32(n)) - }, - } - s.waiters = waiters{ - ctx: s.ctx, - tctx: t.ctx, - } - handle(s) - return -} - -// HandleStreams receives incoming streams using the given handler. This is -// typically run in a separate goroutine. -// traceCtx attaches trace to ctx and returns the new context. -func (t *http2Server) HandleStreams(handle func(*Stream), traceCtx func(context.Context, string) context.Context) { - for { - frame, err := t.framer.fr.ReadFrame() - atomic.StoreUint32(&t.activity, 1) - if err != nil { - if se, ok := err.(http2.StreamError); ok { - t.mu.Lock() - s := t.activeStreams[se.StreamID] - t.mu.Unlock() - if s != nil { - t.closeStream(s) - } - t.controlBuf.put(&resetStream{se.StreamID, se.Code}) - continue - } - if err == io.EOF || err == io.ErrUnexpectedEOF { - t.Close() - return - } - warningf("transport: http2Server.HandleStreams failed to read frame: %v", err) - t.Close() - return - } - switch frame := frame.(type) { - case *http2.MetaHeadersFrame: - if t.operateHeaders(frame, handle, traceCtx) { - t.Close() - break - } - case *http2.DataFrame: - t.handleData(frame) - case *http2.RSTStreamFrame: - t.handleRSTStream(frame) - case *http2.SettingsFrame: - t.handleSettings(frame) - case *http2.PingFrame: - t.handlePing(frame) - case *http2.WindowUpdateFrame: - t.handleWindowUpdate(frame) - case *http2.GoAwayFrame: - // TODO: Handle GoAway from the client appropriately. - default: - errorf("transport: http2Server.HandleStreams found unhandled frame type %v.", frame) - } - } -} - -func (t *http2Server) getStream(f http2.Frame) (*Stream, bool) { - t.mu.Lock() - defer t.mu.Unlock() - if t.activeStreams == nil { - // The transport is closing. - return nil, false - } - s, ok := t.activeStreams[f.Header().StreamID] - if !ok { - // The stream is already done. - return nil, false - } - return s, true -} - -// adjustWindow sends out extra window update over the initial window size -// of stream if the application is requesting data larger in size than -// the window. -func (t *http2Server) adjustWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := s.fc.maybeAdjust(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -// updateWindow adjusts the inbound quota for the stream and the transport. -// Window updates will deliver to the controller for sending when -// the cumulative quota exceeds the corresponding threshold. -func (t *http2Server) updateWindow(s *Stream, n uint32) { - s.mu.Lock() - defer s.mu.Unlock() - if s.state == streamDone { - return - } - if w := s.fc.onRead(n); w > 0 { - if cw := t.fc.resetPendingUpdate(); cw > 0 { - t.controlBuf.put(&windowUpdate{0, cw}) - } - t.controlBuf.put(&windowUpdate{s.id, w}) - } -} - -// updateFlowControl updates the incoming flow control windows -// for the transport and the stream based on the current bdp -// estimation. -func (t *http2Server) updateFlowControl(n uint32) { - t.mu.Lock() - for _, s := range t.activeStreams { - s.fc.newLimit(n) - } - t.initialWindowSize = int32(n) - t.mu.Unlock() - t.controlBuf.put(&windowUpdate{0, t.fc.newLimit(n)}) - t.controlBuf.put(&settings{ - ss: []http2.Setting{ - { - ID: http2.SettingInitialWindowSize, - Val: uint32(n), - }, - }, - }) - -} - -func (t *http2Server) handleData(f *http2.DataFrame) { - size := f.Header().Length - var sendBDPPing bool - if t.bdpEst != nil { - sendBDPPing = t.bdpEst.add(uint32(size)) - } - // Decouple connection's flow control from application's read. - // An update on connection's flow control should not depend on - // whether user application has read the data or not. Such a - // restriction is already imposed on the stream's flow control, - // and therefore the sender will be blocked anyways. - // Decoupling the connection flow control will prevent other - // active(fast) streams from starving in presence of slow or - // inactive streams. - // - // Furthermore, if a bdpPing is being sent out we can piggyback - // connection's window update for the bytes we just received. - if sendBDPPing { - if size != 0 { // Could be an empty frame. - t.controlBuf.put(&windowUpdate{0, uint32(size)}) - } - t.controlBuf.put(bdpPing) - } else { - if err := t.fc.onData(uint32(size)); err != nil { - errorf("transport: http2Server %v", err) - t.Close() - return - } - if w := t.fc.onRead(uint32(size)); w > 0 { - t.controlBuf.put(&windowUpdate{0, w}) - } - } - // Select the right stream to dispatch. - s, ok := t.getStream(f) - if !ok { - return - } - if size > 0 { - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - if err := s.fc.onData(uint32(size)); err != nil { - s.mu.Unlock() - t.closeStream(s) - t.controlBuf.put(&resetStream{s.id, http2.ErrCodeFlowControl}) - return - } - if f.Header().Flags.Has(http2.FlagDataPadded) { - if w := s.fc.onRead(uint32(size) - uint32(len(f.Data()))); w > 0 { - t.controlBuf.put(&windowUpdate{s.id, w}) - } - } - s.mu.Unlock() - // TODO(bradfitz, zhaoq): A copy is required here because there is no - // guarantee f.Data() is consumed before the arrival of next frame. - // Can this copy be eliminated? - if len(f.Data()) > 0 { - data := make([]byte, len(f.Data())) - copy(data, f.Data()) - s.write(recvMsg{data: data}) - } - } - if f.Header().Flags.Has(http2.FlagDataEndStream) { - // Received the end of stream from the client. - s.mu.Lock() - if s.state != streamDone { - s.state = streamReadDone - } - s.mu.Unlock() - s.write(recvMsg{err: io.EOF}) - } -} - -func (t *http2Server) handleRSTStream(f *http2.RSTStreamFrame) { - s, ok := t.getStream(f) - if !ok { - return - } - t.closeStream(s) -} - -func (t *http2Server) handleSettings(f *http2.SettingsFrame) { - if f.IsAck() { - return - } - var rs []http2.Setting - var ps []http2.Setting - f.ForeachSetting(func(s http2.Setting) error { - if t.isRestrictive(s) { - rs = append(rs, s) - } else { - ps = append(ps, s) - } - return nil - }) - t.applySettings(rs) - t.controlBuf.put(&settingsAck{}) - t.applySettings(ps) -} - -func (t *http2Server) isRestrictive(s http2.Setting) bool { - switch s.ID { - case http2.SettingInitialWindowSize: - // Note: we don't acquire a lock here to read streamSendQuota - // because the same goroutine updates it later. - return s.Val < t.streamSendQuota - } - return false -} - -func (t *http2Server) applySettings(ss []http2.Setting) { - for _, s := range ss { - if s.ID == http2.SettingInitialWindowSize { - t.mu.Lock() - for _, stream := range t.activeStreams { - stream.sendQuotaPool.addAndUpdate(int(s.Val) - int(t.streamSendQuota)) - } - t.streamSendQuota = s.Val - t.mu.Unlock() - } - - } -} - -const ( - maxPingStrikes = 2 - defaultPingTimeout = 2 * time.Hour -) - -func (t *http2Server) handlePing(f *http2.PingFrame) { - if f.IsAck() { - if f.Data == goAwayPing.data && t.drainChan != nil { - close(t.drainChan) - return - } - // Maybe it's a BDP ping. - if t.bdpEst != nil { - t.bdpEst.calculate(f.Data) - } - return - } - pingAck := &ping{ack: true} - copy(pingAck.data[:], f.Data[:]) - t.controlBuf.put(pingAck) - - now := time.Now() - defer func() { - t.lastPingAt = now - }() - // A reset ping strikes means that we don't need to check for policy - // violation for this ping and the pingStrikes counter should be set - // to 0. - if atomic.CompareAndSwapUint32(&t.resetPingStrikes, 1, 0) { - t.pingStrikes = 0 - return - } - t.mu.Lock() - ns := len(t.activeStreams) - t.mu.Unlock() - if ns < 1 && !t.kep.PermitWithoutStream { - // Keepalive shouldn't be active thus, this new ping should - // have come after at least defaultPingTimeout. - if t.lastPingAt.Add(defaultPingTimeout).After(now) { - t.pingStrikes++ - } - } else { - // Check if keepalive policy is respected. - if t.lastPingAt.Add(t.kep.MinTime).After(now) { - t.pingStrikes++ - } - } - - if t.pingStrikes > maxPingStrikes { - // Send goaway and close the connection. - errorf("transport: Got too many pings from the client, closing the connection.") - t.controlBuf.put(&goAway{code: http2.ErrCodeEnhanceYourCalm, debugData: []byte("too_many_pings"), closeConn: true}) - } -} - -func (t *http2Server) handleWindowUpdate(f *http2.WindowUpdateFrame) { - id := f.Header().StreamID - incr := f.Increment - if id == 0 { - t.sendQuotaPool.add(int(incr)) - return - } - if s, ok := t.getStream(f); ok { - s.sendQuotaPool.add(int(incr)) - } -} - -// WriteHeader sends the header metedata md back to the client. -func (t *http2Server) WriteHeader(s *Stream, md metadata.MD) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - s.mu.Lock() - if s.headerOk || s.state == streamDone { - s.mu.Unlock() - return ErrIllegalHeaderWrite - } - s.headerOk = true - if md.Len() > 0 { - if s.header.Len() > 0 { - s.header = metadata.Join(s.header, md) - } else { - s.header = md - } - } - md = s.header - s.mu.Unlock() - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - headerFields := make([]hpack.HeaderField, 0, 2) // at least :status, content-type will be there if none else. - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - if s.sendCompress != "" { - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-encoding", Value: s.sendCompress}) - } - for k, vv := range md { - if isReservedHeader(k) { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - t.controlBuf.put(&headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: false, - }) - if t.stats != nil { - outHeader := &stats.OutHeader{ - //WireLength: // TODO(mmukhi): Revisit this later, if needed. - } - t.stats.HandleRPC(s.Context(), outHeader) - } - return nil -} - -// WriteStatus sends stream status to the client and terminates the stream. -// There is no further I/O operations being able to perform on this stream. -// TODO(zhaoq): Now it indicates the end of entire stream. Revisit if early -// OK is adopted. -func (t *http2Server) WriteStatus(s *Stream, st *status.Status) error { - select { - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - var headersSent, hasHeader bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return nil - } - if s.headerOk { - headersSent = true - } - if s.header.Len() > 0 { - hasHeader = true - } - s.mu.Unlock() - - if !headersSent && hasHeader { - t.WriteHeader(s, nil) - headersSent = true - } - - // TODO(mmukhi): Benchmark if the performance gets better if count the metadata and other header fields - // first and create a slice of that exact size. - headerFields := make([]hpack.HeaderField, 0, 2) // grpc-status and grpc-message will be there if none else. - if !headersSent { - headerFields = append(headerFields, hpack.HeaderField{Name: ":status", Value: "200"}) - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: "application/grpc"}) - } - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status", Value: strconv.Itoa(int(st.Code()))}) - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-message", Value: encodeGrpcMessage(st.Message())}) - - if p := st.Proto(); p != nil && len(p.Details) > 0 { - stBytes, err := proto.Marshal(p) - if err != nil { - // TODO: return error instead, when callers are able to handle it. - panic(err) - } - - headerFields = append(headerFields, hpack.HeaderField{Name: "grpc-status-details-bin", Value: encodeBinHeader(stBytes)}) - } - - // Attach the trailer metadata. - for k, vv := range s.trailer { - // Clients don't tolerate reading restricted headers after some non restricted ones were sent. - if isReservedHeader(k) { - continue - } - for _, v := range vv { - headerFields = append(headerFields, hpack.HeaderField{Name: k, Value: encodeMetadataHeader(k, v)}) - } - } - t.controlBuf.put(&headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: true, - }) - if t.stats != nil { - t.stats.HandleRPC(s.Context(), &stats.OutTrailer{}) - } - t.closeStream(s) - return nil -} - -// Write converts the data into HTTP2 data frame and sends it out. Non-nil error -// is returns if it fails (e.g., framing error, transport error). -func (t *http2Server) Write(s *Stream, hdr []byte, data []byte, opts *Options) error { - select { - case <-s.ctx.Done(): - return ContextErr(s.ctx.Err()) - case <-t.ctx.Done(): - return ErrConnClosing - default: - } - - var writeHeaderFrame bool - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return streamErrorf(codes.Unknown, "the stream has been done") - } - if !s.headerOk { - writeHeaderFrame = true - } - s.mu.Unlock() - if writeHeaderFrame { - t.WriteHeader(s, nil) - } - // Add data to header frame so that we can equally distribute data across frames. - emptyLen := http2MaxFrameLen - len(hdr) - if emptyLen > len(data) { - emptyLen = len(data) - } - hdr = append(hdr, data[:emptyLen]...) - data = data[emptyLen:] - var ( - streamQuota int - streamQuotaVer uint32 - err error - ) - for _, r := range [][]byte{hdr, data} { - for len(r) > 0 { - size := http2MaxFrameLen - if size > len(r) { - size = len(r) - } - if streamQuota == 0 { // Used up all the locally cached stream quota. - // Get all the stream quota there is. - streamQuota, streamQuotaVer, err = s.sendQuotaPool.get(math.MaxInt32, s.waiters) - if err != nil { - return err - } - } - if size > streamQuota { - size = streamQuota - } - // Get size worth quota from transport. - tq, _, err := t.sendQuotaPool.get(size, s.waiters) - if err != nil { - return err - } - if tq < size { - size = tq - } - ltq, _, err := t.localSendQuota.get(size, s.waiters) - if err != nil { - return err - } - // even if ltq is smaller than size we don't adjust size since, - // ltq is only a soft limit. - streamQuota -= size - p := r[:size] - // Reset ping strikes when sending data since this might cause - // the peer to send ping. - atomic.StoreUint32(&t.resetPingStrikes, 1) - success := func() { - ltq := ltq - t.controlBuf.put(&dataFrame{streamID: s.id, endStream: false, d: p, f: func() { - t.localSendQuota.add(ltq) - }}) - r = r[size:] - } - failure := func() { // The stream quota version must have changed. - // Our streamQuota cache is invalidated now, so give it back. - s.sendQuotaPool.lockedAdd(streamQuota + size) - } - if !s.sendQuotaPool.compareAndExecute(streamQuotaVer, success, failure) { - // Couldn't send this chunk out. - t.sendQuotaPool.add(size) - t.localSendQuota.add(ltq) - streamQuota = 0 - } - } - } - if streamQuota > 0 { - // ADd the left over quota back to stream. - s.sendQuotaPool.add(streamQuota) - } - return nil -} - -// keepalive running in a separate goroutine does the following: -// 1. Gracefully closes an idle connection after a duration of keepalive.MaxConnectionIdle. -// 2. Gracefully closes any connection after a duration of keepalive.MaxConnectionAge. -// 3. Forcibly closes a connection after an additive period of keepalive.MaxConnectionAgeGrace over keepalive.MaxConnectionAge. -// 4. Makes sure a connection is alive by sending pings with a frequency of keepalive.Time and closes a non-responsive connection -// after an additional duration of keepalive.Timeout. -func (t *http2Server) keepalive() { - p := &ping{} - var pingSent bool - maxIdle := time.NewTimer(t.kp.MaxConnectionIdle) - maxAge := time.NewTimer(t.kp.MaxConnectionAge) - keepalive := time.NewTimer(t.kp.Time) - // NOTE: All exit paths of this function should reset their - // respective timers. A failure to do so will cause the - // following clean-up to deadlock and eventually leak. - defer func() { - if !maxIdle.Stop() { - <-maxIdle.C - } - if !maxAge.Stop() { - <-maxAge.C - } - if !keepalive.Stop() { - <-keepalive.C - } - }() - for { - select { - case <-maxIdle.C: - t.mu.Lock() - idle := t.idle - if idle.IsZero() { // The connection is non-idle. - t.mu.Unlock() - maxIdle.Reset(t.kp.MaxConnectionIdle) - continue - } - val := t.kp.MaxConnectionIdle - time.Since(idle) - t.mu.Unlock() - if val <= 0 { - // The connection has been idle for a duration of keepalive.MaxConnectionIdle or more. - // Gracefully close the connection. - t.drain(http2.ErrCodeNo, []byte{}) - // Reseting the timer so that the clean-up doesn't deadlock. - maxIdle.Reset(infinity) - return - } - maxIdle.Reset(val) - case <-maxAge.C: - t.drain(http2.ErrCodeNo, []byte{}) - maxAge.Reset(t.kp.MaxConnectionAgeGrace) - select { - case <-maxAge.C: - // Close the connection after grace period. - t.Close() - // Reseting the timer so that the clean-up doesn't deadlock. - maxAge.Reset(infinity) - case <-t.ctx.Done(): - } - return - case <-keepalive.C: - if atomic.CompareAndSwapUint32(&t.activity, 1, 0) { - pingSent = false - keepalive.Reset(t.kp.Time) - continue - } - if pingSent { - t.Close() - // Reseting the timer so that the clean-up doesn't deadlock. - keepalive.Reset(infinity) - return - } - pingSent = true - t.controlBuf.put(p) - keepalive.Reset(t.kp.Timeout) - case <-t.ctx.Done(): - return - } - } -} - -var goAwayPing = &ping{data: [8]byte{1, 6, 1, 8, 0, 3, 3, 9}} - -// TODO(mmukhi): A lot of this code(and code in other places in the tranpsort layer) -// is duplicated between the client and the server. -// The transport layer needs to be refactored to take care of this. -func (t *http2Server) itemHandler(i item) error { - switch i := i.(type) { - case *dataFrame: - if err := t.framer.fr.WriteData(i.streamID, i.endStream, i.d); err != nil { - return err - } - i.f() - return nil - case *headerFrame: - t.hBuf.Reset() - for _, f := range i.hf { - t.hEnc.WriteField(f) - } - first := true - endHeaders := false - for !endHeaders { - size := t.hBuf.Len() - if size > http2MaxFrameLen { - size = http2MaxFrameLen - } else { - endHeaders = true - } - var err error - if first { - first = false - err = t.framer.fr.WriteHeaders(http2.HeadersFrameParam{ - StreamID: i.streamID, - BlockFragment: t.hBuf.Next(size), - EndStream: i.endStream, - EndHeaders: endHeaders, - }) - } else { - err = t.framer.fr.WriteContinuation( - i.streamID, - endHeaders, - t.hBuf.Next(size), - ) - } - if err != nil { - return err - } - } - atomic.StoreUint32(&t.resetPingStrikes, 1) - return nil - case *windowUpdate: - return t.framer.fr.WriteWindowUpdate(i.streamID, i.increment) - case *settings: - return t.framer.fr.WriteSettings(i.ss...) - case *settingsAck: - return t.framer.fr.WriteSettingsAck() - case *resetStream: - return t.framer.fr.WriteRSTStream(i.streamID, i.code) - case *goAway: - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - // The transport is closing. - return fmt.Errorf("transport: Connection closing") - } - sid := t.maxStreamID - if !i.headsUp { - // Stop accepting more streams now. - t.state = draining - if len(t.activeStreams) == 0 { - i.closeConn = true - } - t.mu.Unlock() - if err := t.framer.fr.WriteGoAway(sid, i.code, i.debugData); err != nil { - return err - } - if i.closeConn { - // Abruptly close the connection following the GoAway (via - // loopywriter). But flush out what's inside the buffer first. - t.controlBuf.put(&flushIO{closeTr: true}) - } - return nil - } - t.mu.Unlock() - // For a graceful close, send out a GoAway with stream ID of MaxUInt32, - // Follow that with a ping and wait for the ack to come back or a timer - // to expire. During this time accept new streams since they might have - // originated before the GoAway reaches the client. - // After getting the ack or timer expiration send out another GoAway this - // time with an ID of the max stream server intends to process. - if err := t.framer.fr.WriteGoAway(math.MaxUint32, http2.ErrCodeNo, []byte{}); err != nil { - return err - } - if err := t.framer.fr.WritePing(false, goAwayPing.data); err != nil { - return err - } - go func() { - timer := time.NewTimer(time.Minute) - defer timer.Stop() - select { - case <-t.drainChan: - case <-timer.C: - case <-t.ctx.Done(): - return - } - t.controlBuf.put(&goAway{code: i.code, debugData: i.debugData}) - }() - return nil - case *flushIO: - if err := t.framer.writer.Flush(); err != nil { - return err - } - if i.closeTr { - return ErrConnClosing - } - return nil - case *ping: - if !i.ack { - t.bdpEst.timesnap(i.data) - } - return t.framer.fr.WritePing(i.ack, i.data) - default: - err := status.Errorf(codes.Internal, "transport: http2Server.controller got unexpected item type %t", i) - errorf("%v", err) - return err - } -} - -// Close starts shutting down the http2Server transport. -// TODO(zhaoq): Now the destruction is not blocked on any pending streams. This -// could cause some resource issue. Revisit this later. -func (t *http2Server) Close() error { - t.mu.Lock() - if t.state == closing { - t.mu.Unlock() - return errors.New("transport: Close() was already called") - } - t.state = closing - streams := t.activeStreams - t.activeStreams = nil - t.mu.Unlock() - t.cancel() - err := t.conn.Close() - // Cancel all active streams. - for _, s := range streams { - s.cancel() - } - if t.stats != nil { - connEnd := &stats.ConnEnd{} - t.stats.HandleConn(t.ctx, connEnd) - } - return err -} - -// closeStream clears the footprint of a stream when the stream is not needed -// any more. -func (t *http2Server) closeStream(s *Stream) { - t.mu.Lock() - delete(t.activeStreams, s.id) - if len(t.activeStreams) == 0 { - t.idle = time.Now() - } - if t.state == draining && len(t.activeStreams) == 0 { - defer t.controlBuf.put(&flushIO{closeTr: true}) - } - t.mu.Unlock() - // In case stream sending and receiving are invoked in separate - // goroutines (e.g., bi-directional streaming), cancel needs to be - // called to interrupt the potential blocking on other goroutines. - s.cancel() - s.mu.Lock() - if s.state == streamDone { - s.mu.Unlock() - return - } - s.state = streamDone - s.mu.Unlock() -} - -func (t *http2Server) RemoteAddr() net.Addr { - return t.remoteAddr -} - -func (t *http2Server) Drain() { - t.drain(http2.ErrCodeNo, []byte{}) -} - -func (t *http2Server) drain(code http2.ErrCode, debugData []byte) { - t.mu.Lock() - defer t.mu.Unlock() - if t.drainChan != nil { - return - } - t.drainChan = make(chan struct{}) - t.controlBuf.put(&goAway{code: code, debugData: debugData, headsUp: true}) -} - -var rgen = rand.New(rand.NewSource(time.Now().UnixNano())) - -func getJitter(v time.Duration) time.Duration { - if v == infinity { - return 0 - } - // Generate a jitter between +/- 10% of the value. - r := int64(v / 10) - j := rgen.Int63n(2*r) - r - return time.Duration(j) -} diff --git a/vendor/google.golang.org/grpc/transport/http_util.go b/vendor/google.golang.org/grpc/transport/http_util.go deleted file mode 100644 index 39f878c..0000000 --- a/vendor/google.golang.org/grpc/transport/http_util.go +++ /dev/null @@ -1,489 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "bufio" - "bytes" - "encoding/base64" - "fmt" - "io" - "net" - "net/http" - "strconv" - "strings" - "time" - - "github.com/golang/protobuf/proto" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - spb "google.golang.org/genproto/googleapis/rpc/status" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -const ( - // http2MaxFrameLen specifies the max length of a HTTP2 frame. - http2MaxFrameLen = 16384 // 16KB frame - // http://http2.github.io/http2-spec/#SettingValues - http2InitHeaderTableSize = 4096 - // http2IOBufSize specifies the buffer size for sending frames. - defaultWriteBufSize = 32 * 1024 - defaultReadBufSize = 32 * 1024 -) - -var ( - clientPreface = []byte(http2.ClientPreface) - http2ErrConvTab = map[http2.ErrCode]codes.Code{ - http2.ErrCodeNo: codes.Internal, - http2.ErrCodeProtocol: codes.Internal, - http2.ErrCodeInternal: codes.Internal, - http2.ErrCodeFlowControl: codes.ResourceExhausted, - http2.ErrCodeSettingsTimeout: codes.Internal, - http2.ErrCodeStreamClosed: codes.Internal, - http2.ErrCodeFrameSize: codes.Internal, - http2.ErrCodeRefusedStream: codes.Unavailable, - http2.ErrCodeCancel: codes.Canceled, - http2.ErrCodeCompression: codes.Internal, - http2.ErrCodeConnect: codes.Internal, - http2.ErrCodeEnhanceYourCalm: codes.ResourceExhausted, - http2.ErrCodeInadequateSecurity: codes.PermissionDenied, - http2.ErrCodeHTTP11Required: codes.FailedPrecondition, - } - statusCodeConvTab = map[codes.Code]http2.ErrCode{ - codes.Internal: http2.ErrCodeInternal, - codes.Canceled: http2.ErrCodeCancel, - codes.Unavailable: http2.ErrCodeRefusedStream, - codes.ResourceExhausted: http2.ErrCodeEnhanceYourCalm, - codes.PermissionDenied: http2.ErrCodeInadequateSecurity, - } - httpStatusConvTab = map[int]codes.Code{ - // 400 Bad Request - INTERNAL. - http.StatusBadRequest: codes.Internal, - // 401 Unauthorized - UNAUTHENTICATED. - http.StatusUnauthorized: codes.Unauthenticated, - // 403 Forbidden - PERMISSION_DENIED. - http.StatusForbidden: codes.PermissionDenied, - // 404 Not Found - UNIMPLEMENTED. - http.StatusNotFound: codes.Unimplemented, - // 429 Too Many Requests - UNAVAILABLE. - http.StatusTooManyRequests: codes.Unavailable, - // 502 Bad Gateway - UNAVAILABLE. - http.StatusBadGateway: codes.Unavailable, - // 503 Service Unavailable - UNAVAILABLE. - http.StatusServiceUnavailable: codes.Unavailable, - // 504 Gateway timeout - UNAVAILABLE. - http.StatusGatewayTimeout: codes.Unavailable, - } -) - -// Records the states during HPACK decoding. Must be reset once the -// decoding of the entire headers are finished. -type decodeState struct { - encoding string - // statusGen caches the stream status received from the trailer the server - // sent. Client side only. Do not access directly. After all trailers are - // parsed, use the status method to retrieve the status. - statusGen *status.Status - // rawStatusCode and rawStatusMsg are set from the raw trailer fields and are not - // intended for direct access outside of parsing. - rawStatusCode *int - rawStatusMsg string - httpStatus *int - // Server side only fields. - timeoutSet bool - timeout time.Duration - method string - // key-value metadata map from the peer. - mdata map[string][]string - statsTags []byte - statsTrace []byte -} - -// isReservedHeader checks whether hdr belongs to HTTP2 headers -// reserved by gRPC protocol. Any other headers are classified as the -// user-specified metadata. -func isReservedHeader(hdr string) bool { - if hdr != "" && hdr[0] == ':' { - return true - } - switch hdr { - case "content-type", - "grpc-message-type", - "grpc-encoding", - "grpc-message", - "grpc-status", - "grpc-timeout", - "grpc-status-details-bin", - "te": - return true - default: - return false - } -} - -// isWhitelistedPseudoHeader checks whether hdr belongs to HTTP2 pseudoheaders -// that should be propagated into metadata visible to users. -func isWhitelistedPseudoHeader(hdr string) bool { - switch hdr { - case ":authority": - return true - default: - return false - } -} - -func validContentType(t string) bool { - e := "application/grpc" - if !strings.HasPrefix(t, e) { - return false - } - // Support variations on the content-type - // (e.g. "application/grpc+blah", "application/grpc;blah"). - if len(t) > len(e) && t[len(e)] != '+' && t[len(e)] != ';' { - return false - } - return true -} - -func (d *decodeState) status() *status.Status { - if d.statusGen == nil { - // No status-details were provided; generate status using code/msg. - d.statusGen = status.New(codes.Code(int32(*(d.rawStatusCode))), d.rawStatusMsg) - } - return d.statusGen -} - -const binHdrSuffix = "-bin" - -func encodeBinHeader(v []byte) string { - return base64.RawStdEncoding.EncodeToString(v) -} - -func decodeBinHeader(v string) ([]byte, error) { - if len(v)%4 == 0 { - // Input was padded, or padding was not necessary. - return base64.StdEncoding.DecodeString(v) - } - return base64.RawStdEncoding.DecodeString(v) -} - -func encodeMetadataHeader(k, v string) string { - if strings.HasSuffix(k, binHdrSuffix) { - return encodeBinHeader(([]byte)(v)) - } - return v -} - -func decodeMetadataHeader(k, v string) (string, error) { - if strings.HasSuffix(k, binHdrSuffix) { - b, err := decodeBinHeader(v) - return string(b), err - } - return v, nil -} - -func (d *decodeState) decodeResponseHeader(frame *http2.MetaHeadersFrame) error { - for _, hf := range frame.Fields { - if err := d.processHeaderField(hf); err != nil { - return err - } - } - - // If grpc status exists, no need to check further. - if d.rawStatusCode != nil || d.statusGen != nil { - return nil - } - - // If grpc status doesn't exist and http status doesn't exist, - // then it's a malformed header. - if d.httpStatus == nil { - return streamErrorf(codes.Internal, "malformed header: doesn't contain status(gRPC or HTTP)") - } - - if *(d.httpStatus) != http.StatusOK { - code, ok := httpStatusConvTab[*(d.httpStatus)] - if !ok { - code = codes.Unknown - } - return streamErrorf(code, http.StatusText(*(d.httpStatus))) - } - - // gRPC status doesn't exist and http status is OK. - // Set rawStatusCode to be unknown and return nil error. - // So that, if the stream has ended this Unknown status - // will be propogated to the user. - // Otherwise, it will be ignored. In which case, status from - // a later trailer, that has StreamEnded flag set, is propogated. - code := int(codes.Unknown) - d.rawStatusCode = &code - return nil - -} - -func (d *decodeState) addMetadata(k, v string) { - if d.mdata == nil { - d.mdata = make(map[string][]string) - } - d.mdata[k] = append(d.mdata[k], v) -} - -func (d *decodeState) processHeaderField(f hpack.HeaderField) error { - switch f.Name { - case "content-type": - if !validContentType(f.Value) { - return streamErrorf(codes.FailedPrecondition, "transport: received the unexpected content-type %q", f.Value) - } - case "grpc-encoding": - d.encoding = f.Value - case "grpc-status": - code, err := strconv.Atoi(f.Value) - if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status: %v", err) - } - d.rawStatusCode = &code - case "grpc-message": - d.rawStatusMsg = decodeGrpcMessage(f.Value) - case "grpc-status-details-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) - } - s := &spb.Status{} - if err := proto.Unmarshal(v, s); err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-status-details-bin: %v", err) - } - d.statusGen = status.FromProto(s) - case "grpc-timeout": - d.timeoutSet = true - var err error - if d.timeout, err = decodeTimeout(f.Value); err != nil { - return streamErrorf(codes.Internal, "transport: malformed time-out: %v", err) - } - case ":path": - d.method = f.Value - case ":status": - code, err := strconv.Atoi(f.Value) - if err != nil { - return streamErrorf(codes.Internal, "transport: malformed http-status: %v", err) - } - d.httpStatus = &code - case "grpc-tags-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-tags-bin: %v", err) - } - d.statsTags = v - d.addMetadata(f.Name, string(v)) - case "grpc-trace-bin": - v, err := decodeBinHeader(f.Value) - if err != nil { - return streamErrorf(codes.Internal, "transport: malformed grpc-trace-bin: %v", err) - } - d.statsTrace = v - d.addMetadata(f.Name, string(v)) - default: - if isReservedHeader(f.Name) && !isWhitelistedPseudoHeader(f.Name) { - break - } - v, err := decodeMetadataHeader(f.Name, f.Value) - if err != nil { - errorf("Failed to decode metadata header (%q, %q): %v", f.Name, f.Value, err) - return nil - } - d.addMetadata(f.Name, string(v)) - } - return nil -} - -type timeoutUnit uint8 - -const ( - hour timeoutUnit = 'H' - minute timeoutUnit = 'M' - second timeoutUnit = 'S' - millisecond timeoutUnit = 'm' - microsecond timeoutUnit = 'u' - nanosecond timeoutUnit = 'n' -) - -func timeoutUnitToDuration(u timeoutUnit) (d time.Duration, ok bool) { - switch u { - case hour: - return time.Hour, true - case minute: - return time.Minute, true - case second: - return time.Second, true - case millisecond: - return time.Millisecond, true - case microsecond: - return time.Microsecond, true - case nanosecond: - return time.Nanosecond, true - default: - } - return -} - -const maxTimeoutValue int64 = 100000000 - 1 - -// div does integer division and round-up the result. Note that this is -// equivalent to (d+r-1)/r but has less chance to overflow. -func div(d, r time.Duration) int64 { - if m := d % r; m > 0 { - return int64(d/r + 1) - } - return int64(d / r) -} - -// TODO(zhaoq): It is the simplistic and not bandwidth efficient. Improve it. -func encodeTimeout(t time.Duration) string { - if t <= 0 { - return "0n" - } - if d := div(t, time.Nanosecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "n" - } - if d := div(t, time.Microsecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "u" - } - if d := div(t, time.Millisecond); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "m" - } - if d := div(t, time.Second); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "S" - } - if d := div(t, time.Minute); d <= maxTimeoutValue { - return strconv.FormatInt(d, 10) + "M" - } - // Note that maxTimeoutValue * time.Hour > MaxInt64. - return strconv.FormatInt(div(t, time.Hour), 10) + "H" -} - -func decodeTimeout(s string) (time.Duration, error) { - size := len(s) - if size < 2 { - return 0, fmt.Errorf("transport: timeout string is too short: %q", s) - } - unit := timeoutUnit(s[size-1]) - d, ok := timeoutUnitToDuration(unit) - if !ok { - return 0, fmt.Errorf("transport: timeout unit is not recognized: %q", s) - } - t, err := strconv.ParseInt(s[:size-1], 10, 64) - if err != nil { - return 0, err - } - return d * time.Duration(t), nil -} - -const ( - spaceByte = ' ' - tildaByte = '~' - percentByte = '%' -) - -// encodeGrpcMessage is used to encode status code in header field -// "grpc-message". -// It checks to see if each individual byte in msg is an -// allowable byte, and then either percent encoding or passing it through. -// When percent encoding, the byte is converted into hexadecimal notation -// with a '%' prepended. -func encodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if !(c >= spaceByte && c < tildaByte && c != percentByte) { - return encodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func encodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c >= spaceByte && c < tildaByte && c != percentByte { - buf.WriteByte(c) - } else { - buf.WriteString(fmt.Sprintf("%%%02X", c)) - } - } - return buf.String() -} - -// decodeGrpcMessage decodes the msg encoded by encodeGrpcMessage. -func decodeGrpcMessage(msg string) string { - if msg == "" { - return "" - } - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - if msg[i] == percentByte && i+2 < lenMsg { - return decodeGrpcMessageUnchecked(msg) - } - } - return msg -} - -func decodeGrpcMessageUnchecked(msg string) string { - var buf bytes.Buffer - lenMsg := len(msg) - for i := 0; i < lenMsg; i++ { - c := msg[i] - if c == percentByte && i+2 < lenMsg { - parsed, err := strconv.ParseUint(msg[i+1:i+3], 16, 8) - if err != nil { - buf.WriteByte(c) - } else { - buf.WriteByte(byte(parsed)) - i += 2 - } - } else { - buf.WriteByte(c) - } - } - return buf.String() -} - -type framer struct { - numWriters int32 - reader io.Reader - writer *bufio.Writer - fr *http2.Framer -} - -func newFramer(conn net.Conn, writeBufferSize, readBufferSize int) *framer { - f := &framer{ - reader: bufio.NewReaderSize(conn, readBufferSize), - writer: bufio.NewWriterSize(conn, writeBufferSize), - } - f.fr = http2.NewFramer(f.writer, f.reader) - // Opt-in to Frame reuse API on framer to reduce garbage. - // Frames aren't safe to read from after a subsequent call to ReadFrame. - f.fr.SetReuseFrames() - f.fr.ReadMetaHeaders = hpack.NewDecoder(http2InitHeaderTableSize, nil) - return f -} diff --git a/vendor/google.golang.org/grpc/transport/http_util_test.go b/vendor/google.golang.org/grpc/transport/http_util_test.go deleted file mode 100644 index 4ebb239..0000000 --- a/vendor/google.golang.org/grpc/transport/http_util_test.go +++ /dev/null @@ -1,175 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "fmt" - "reflect" - "testing" - "time" -) - -func TestTimeoutEncode(t *testing.T) { - for _, test := range []struct { - in string - out string - }{ - {"12345678ns", "12345678n"}, - {"123456789ns", "123457u"}, - {"12345678us", "12345678u"}, - {"123456789us", "123457m"}, - {"12345678ms", "12345678m"}, - {"123456789ms", "123457S"}, - {"12345678s", "12345678S"}, - {"123456789s", "2057614M"}, - {"12345678m", "12345678M"}, - {"123456789m", "2057614H"}, - } { - d, err := time.ParseDuration(test.in) - if err != nil { - t.Fatalf("failed to parse duration string %s: %v", test.in, err) - } - out := encodeTimeout(d) - if out != test.out { - t.Fatalf("timeoutEncode(%s) = %s, want %s", test.in, out, test.out) - } - } -} - -func TestTimeoutDecode(t *testing.T) { - for _, test := range []struct { - // input - s string - // output - d time.Duration - err error - }{ - {"1234S", time.Second * 1234, nil}, - {"1234x", 0, fmt.Errorf("transport: timeout unit is not recognized: %q", "1234x")}, - {"1", 0, fmt.Errorf("transport: timeout string is too short: %q", "1")}, - {"", 0, fmt.Errorf("transport: timeout string is too short: %q", "")}, - } { - d, err := decodeTimeout(test.s) - if d != test.d || fmt.Sprint(err) != fmt.Sprint(test.err) { - t.Fatalf("timeoutDecode(%q) = %d, %v, want %d, %v", test.s, int64(d), err, int64(test.d), test.err) - } - } -} - -func TestValidContentType(t *testing.T) { - tests := []struct { - h string - want bool - }{ - {"application/grpc", true}, - {"application/grpc+", true}, - {"application/grpc+blah", true}, - {"application/grpc;", true}, - {"application/grpc;blah", true}, - {"application/grpcd", false}, - {"application/grpd", false}, - {"application/grp", false}, - } - for _, tt := range tests { - got := validContentType(tt.h) - if got != tt.want { - t.Errorf("validContentType(%q) = %v; want %v", tt.h, got, tt.want) - } - } -} - -func TestEncodeGrpcMessage(t *testing.T) { - for _, tt := range []struct { - input string - expected string - }{ - {"", ""}, - {"Hello", "Hello"}, - {"my favorite character is \u0000", "my favorite character is %00"}, - {"my favorite character is %", "my favorite character is %25"}, - } { - actual := encodeGrpcMessage(tt.input) - if tt.expected != actual { - t.Errorf("encodeGrpcMessage(%v) = %v, want %v", tt.input, actual, tt.expected) - } - } -} - -func TestDecodeGrpcMessage(t *testing.T) { - for _, tt := range []struct { - input string - expected string - }{ - {"", ""}, - {"Hello", "Hello"}, - {"H%61o", "Hao"}, - {"H%6", "H%6"}, - {"%G0", "%G0"}, - {"%E7%B3%BB%E7%BB%9F", "系统"}, - } { - actual := decodeGrpcMessage(tt.input) - if tt.expected != actual { - t.Errorf("dncodeGrpcMessage(%v) = %v, want %v", tt.input, actual, tt.expected) - } - } -} - -const binaryValue = string(128) - -func TestEncodeMetadataHeader(t *testing.T) { - for _, test := range []struct { - // input - kin string - vin string - // output - vout string - }{ - {"key", "abc", "abc"}, - {"KEY", "abc", "abc"}, - {"key-bin", "abc", "YWJj"}, - {"key-bin", binaryValue, "woA"}, - } { - v := encodeMetadataHeader(test.kin, test.vin) - if !reflect.DeepEqual(v, test.vout) { - t.Fatalf("encodeMetadataHeader(%q, %q) = %q, want %q", test.kin, test.vin, v, test.vout) - } - } -} - -func TestDecodeMetadataHeader(t *testing.T) { - for _, test := range []struct { - // input - kin string - vin string - // output - vout string - err error - }{ - {"a", "abc", "abc", nil}, - {"key-bin", "Zm9vAGJhcg==", "foo\x00bar", nil}, - {"key-bin", "Zm9vAGJhcg", "foo\x00bar", nil}, - {"key-bin", "woA=", binaryValue, nil}, - {"a", "abc,efg", "abc,efg", nil}, - } { - v, err := decodeMetadataHeader(test.kin, test.vin) - if !reflect.DeepEqual(v, test.vout) || !reflect.DeepEqual(err, test.err) { - t.Fatalf("decodeMetadataHeader(%q, %q) = %q, %v, want %q, %v", test.kin, test.vin, v, err, test.vout, test.err) - } - } -} diff --git a/vendor/google.golang.org/grpc/transport/log.go b/vendor/google.golang.org/grpc/transport/log.go deleted file mode 100644 index ac8e358..0000000 --- a/vendor/google.golang.org/grpc/transport/log.go +++ /dev/null @@ -1,50 +0,0 @@ -/* - * - * Copyright 2017 gRPC authors. - * - * 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. - * - */ - -// This file contains wrappers for grpclog functions. -// The transport package only logs to verbose level 2 by default. - -package transport - -import "google.golang.org/grpc/grpclog" - -const logLevel = 2 - -func infof(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Infof(format, args...) - } -} - -func warningf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Warningf(format, args...) - } -} - -func errorf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Errorf(format, args...) - } -} - -func fatalf(format string, args ...interface{}) { - if grpclog.V(logLevel) { - grpclog.Fatalf(format, args...) - } -} diff --git a/vendor/google.golang.org/grpc/transport/transport.go b/vendor/google.golang.org/grpc/transport/transport.go deleted file mode 100644 index 2e7bcae..0000000 --- a/vendor/google.golang.org/grpc/transport/transport.go +++ /dev/null @@ -1,757 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport defines and implements message oriented communication -// channel to complete various transactions (e.g., an RPC). It is meant for -// grpc-internal usage and is not intended to be imported directly by users. -package transport // import "google.golang.org/grpc/transport" - -import ( - "fmt" - "io" - "net" - "sync" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/credentials" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/metadata" - "google.golang.org/grpc/stats" - "google.golang.org/grpc/status" - "google.golang.org/grpc/tap" -) - -// recvMsg represents the received msg from the transport. All transport -// protocol specific info has been removed. -type recvMsg struct { - data []byte - // nil: received some data - // io.EOF: stream is completed. data is nil. - // other non-nil error: transport failure. data is nil. - err error -} - -// recvBuffer is an unbounded channel of recvMsg structs. -// Note recvBuffer differs from controlBuffer only in that recvBuffer -// holds a channel of only recvMsg structs instead of objects implementing "item" interface. -// recvBuffer is written to much more often than -// controlBuffer and using strict recvMsg structs helps avoid allocation in "recvBuffer.put" -type recvBuffer struct { - c chan recvMsg - mu sync.Mutex - backlog []recvMsg -} - -func newRecvBuffer() *recvBuffer { - b := &recvBuffer{ - c: make(chan recvMsg, 1), - } - return b -} - -func (b *recvBuffer) put(r recvMsg) { - b.mu.Lock() - if len(b.backlog) == 0 { - select { - case b.c <- r: - b.mu.Unlock() - return - default: - } - } - b.backlog = append(b.backlog, r) - b.mu.Unlock() -} - -func (b *recvBuffer) load() { - b.mu.Lock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog[0] = recvMsg{} - b.backlog = b.backlog[1:] - default: - } - } - b.mu.Unlock() -} - -// get returns the channel that receives a recvMsg in the buffer. -// -// Upon receipt of a recvMsg, the caller should call load to send another -// recvMsg onto the channel if there is any. -func (b *recvBuffer) get() <-chan recvMsg { - return b.c -} - -// recvBufferReader implements io.Reader interface to read the data from -// recvBuffer. -type recvBufferReader struct { - ctx context.Context - goAway chan struct{} - recv *recvBuffer - last []byte // Stores the remaining data in the previous calls. - err error -} - -// Read reads the next len(p) bytes from last. If last is drained, it tries to -// read additional data from recv. It blocks if there no additional data available -// in recv. If Read returns any non-nil error, it will continue to return that error. -func (r *recvBufferReader) Read(p []byte) (n int, err error) { - if r.err != nil { - return 0, r.err - } - n, r.err = r.read(p) - return n, r.err -} - -func (r *recvBufferReader) read(p []byte) (n int, err error) { - if r.last != nil && len(r.last) > 0 { - // Read remaining data left in last call. - copied := copy(p, r.last) - r.last = r.last[copied:] - return copied, nil - } - select { - case <-r.ctx.Done(): - return 0, ContextErr(r.ctx.Err()) - case <-r.goAway: - return 0, errStreamDrain - case m := <-r.recv.get(): - r.recv.load() - if m.err != nil { - return 0, m.err - } - copied := copy(p, m.data) - r.last = m.data[copied:] - return copied, nil - } -} - -// All items in an out of a controlBuffer should be the same type. -type item interface { - item() -} - -// controlBuffer is an unbounded channel of item. -type controlBuffer struct { - c chan item - mu sync.Mutex - backlog []item -} - -func newControlBuffer() *controlBuffer { - b := &controlBuffer{ - c: make(chan item, 1), - } - return b -} - -func (b *controlBuffer) put(r item) { - b.mu.Lock() - if len(b.backlog) == 0 { - select { - case b.c <- r: - b.mu.Unlock() - return - default: - } - } - b.backlog = append(b.backlog, r) - b.mu.Unlock() -} - -func (b *controlBuffer) load() { - b.mu.Lock() - if len(b.backlog) > 0 { - select { - case b.c <- b.backlog[0]: - b.backlog[0] = nil - b.backlog = b.backlog[1:] - default: - } - } - b.mu.Unlock() -} - -// get returns the channel that receives an item in the buffer. -// -// Upon receipt of an item, the caller should call load to send another -// item onto the channel if there is any. -func (b *controlBuffer) get() <-chan item { - return b.c -} - -type streamState uint8 - -const ( - streamActive streamState = iota - streamWriteDone // EndStream sent - streamReadDone // EndStream received - streamDone // the entire stream is finished. -) - -// Stream represents an RPC in the transport layer. -type Stream struct { - id uint32 - st ServerTransport // nil for client side Stream - ctx context.Context // the associated context of the stream - cancel context.CancelFunc // always nil for client side Stream - done chan struct{} // closed when the final status arrives - goAway chan struct{} // closed when a GOAWAY control message is received - method string // the associated RPC method of the stream - recvCompress string - sendCompress string - buf *recvBuffer - trReader io.Reader - fc *inFlow - recvQuota uint32 - waiters waiters - - // Callback to state application's intentions to read data. This - // is used to adjust flow control, if needed. - requestRead func(int) - - sendQuotaPool *quotaPool - headerChan chan struct{} // closed to indicate the end of header metadata. - headerDone bool // set when headerChan is closed. Used to avoid closing headerChan multiple times. - header metadata.MD // the received header metadata. - trailer metadata.MD // the key-value map of trailer metadata. - - mu sync.RWMutex // guard the following - headerOk bool // becomes true from the first header is about to send - state streamState - - status *status.Status // the status error received from the server - - rstStream bool // indicates whether a RST_STREAM frame needs to be sent - rstError http2.ErrCode // the error that needs to be sent along with the RST_STREAM frame - - bytesReceived bool // indicates whether any bytes have been received on this stream - unprocessed bool // set if the server sends a refused stream or GOAWAY including this stream -} - -func (s *Stream) waitOnHeader() error { - if s.headerChan == nil { - // On the server headerChan is always nil since a stream originates - // only after having received headers. - return nil - } - wc := s.waiters - select { - case <-wc.ctx.Done(): - return ContextErr(wc.ctx.Err()) - case <-wc.goAway: - return errStreamDrain - case <-s.headerChan: - return nil - } -} - -// RecvCompress returns the compression algorithm applied to the inbound -// message. It is empty string if there is no compression applied. -func (s *Stream) RecvCompress() string { - if err := s.waitOnHeader(); err != nil { - return "" - } - return s.recvCompress -} - -// SetSendCompress sets the compression algorithm to the stream. -func (s *Stream) SetSendCompress(str string) { - s.sendCompress = str -} - -// Done returns a chanel which is closed when it receives the final status -// from the server. -func (s *Stream) Done() <-chan struct{} { - return s.done -} - -// GoAway returns a channel which is closed when the server sent GoAways signal -// before this stream was initiated. -func (s *Stream) GoAway() <-chan struct{} { - return s.goAway -} - -// Header acquires the key-value pairs of header metadata once it -// is available. It blocks until i) the metadata is ready or ii) there is no -// header metadata or iii) the stream is canceled/expired. -func (s *Stream) Header() (metadata.MD, error) { - err := s.waitOnHeader() - // Even if the stream is closed, header is returned if available. - select { - case <-s.headerChan: - return s.header.Copy(), nil - default: - } - return nil, err -} - -// Trailer returns the cached trailer metedata. Note that if it is not called -// after the entire stream is done, it could return an empty MD. Client -// side only. -func (s *Stream) Trailer() metadata.MD { - s.mu.RLock() - c := s.trailer.Copy() - s.mu.RUnlock() - return c -} - -// ServerTransport returns the underlying ServerTransport for the stream. -// The client side stream always returns nil. -func (s *Stream) ServerTransport() ServerTransport { - return s.st -} - -// Context returns the context of the stream. -func (s *Stream) Context() context.Context { - return s.ctx -} - -// Method returns the method for the stream. -func (s *Stream) Method() string { - return s.method -} - -// Status returns the status received from the server. -func (s *Stream) Status() *status.Status { - return s.status -} - -// SetHeader sets the header metadata. This can be called multiple times. -// Server side only. -func (s *Stream) SetHeader(md metadata.MD) error { - s.mu.Lock() - if s.headerOk || s.state == streamDone { - s.mu.Unlock() - return ErrIllegalHeaderWrite - } - if md.Len() == 0 { - s.mu.Unlock() - return nil - } - s.header = metadata.Join(s.header, md) - s.mu.Unlock() - return nil -} - -// SetTrailer sets the trailer metadata which will be sent with the RPC status -// by the server. This can be called multiple times. Server side only. -func (s *Stream) SetTrailer(md metadata.MD) error { - if md.Len() == 0 { - return nil - } - s.mu.Lock() - s.trailer = metadata.Join(s.trailer, md) - s.mu.Unlock() - return nil -} - -func (s *Stream) write(m recvMsg) { - s.buf.put(m) -} - -// Read reads all p bytes from the wire for this stream. -func (s *Stream) Read(p []byte) (n int, err error) { - // Don't request a read if there was an error earlier - if er := s.trReader.(*transportReader).er; er != nil { - return 0, er - } - s.requestRead(len(p)) - return io.ReadFull(s.trReader, p) -} - -// tranportReader reads all the data available for this Stream from the transport and -// passes them into the decoder, which converts them into a gRPC message stream. -// The error is io.EOF when the stream is done or another non-nil error if -// the stream broke. -type transportReader struct { - reader io.Reader - // The handler to control the window update procedure for both this - // particular stream and the associated transport. - windowHandler func(int) - er error -} - -func (t *transportReader) Read(p []byte) (n int, err error) { - n, err = t.reader.Read(p) - if err != nil { - t.er = err - return - } - t.windowHandler(n) - return -} - -// finish sets the stream's state and status, and closes the done channel. -// s.mu must be held by the caller. st must always be non-nil. -func (s *Stream) finish(st *status.Status) { - s.status = st - s.state = streamDone - close(s.done) -} - -// BytesReceived indicates whether any bytes have been received on this stream. -func (s *Stream) BytesReceived() bool { - s.mu.Lock() - br := s.bytesReceived - s.mu.Unlock() - return br -} - -// Unprocessed indicates whether the server did not process this stream -- -// i.e. it sent a refused stream or GOAWAY including this stream ID. -func (s *Stream) Unprocessed() bool { - s.mu.Lock() - br := s.unprocessed - s.mu.Unlock() - return br -} - -// GoString is implemented by Stream so context.String() won't -// race when printing %#v. -func (s *Stream) GoString() string { - return fmt.Sprintf("", s, s.method) -} - -// The key to save transport.Stream in the context. -type streamKey struct{} - -// newContextWithStream creates a new context from ctx and attaches stream -// to it. -func newContextWithStream(ctx context.Context, stream *Stream) context.Context { - return context.WithValue(ctx, streamKey{}, stream) -} - -// StreamFromContext returns the stream saved in ctx. -func StreamFromContext(ctx context.Context) (s *Stream, ok bool) { - s, ok = ctx.Value(streamKey{}).(*Stream) - return -} - -// state of transport -type transportState int - -const ( - reachable transportState = iota - closing - draining -) - -// ServerConfig consists of all the configurations to establish a server transport. -type ServerConfig struct { - MaxStreams uint32 - AuthInfo credentials.AuthInfo - InTapHandle tap.ServerInHandle - StatsHandler stats.Handler - KeepaliveParams keepalive.ServerParameters - KeepalivePolicy keepalive.EnforcementPolicy - InitialWindowSize int32 - InitialConnWindowSize int32 - WriteBufferSize int - ReadBufferSize int -} - -// NewServerTransport creates a ServerTransport with conn or non-nil error -// if it fails. -func NewServerTransport(protocol string, conn net.Conn, config *ServerConfig) (ServerTransport, error) { - return newHTTP2Server(conn, config) -} - -// ConnectOptions covers all relevant options for communicating with the server. -type ConnectOptions struct { - // UserAgent is the application user agent. - UserAgent string - // Authority is the :authority pseudo-header to use. This field has no effect if - // TransportCredentials is set. - Authority string - // Dialer specifies how to dial a network address. - Dialer func(context.Context, string) (net.Conn, error) - // FailOnNonTempDialError specifies if gRPC fails on non-temporary dial errors. - FailOnNonTempDialError bool - // PerRPCCredentials stores the PerRPCCredentials required to issue RPCs. - PerRPCCredentials []credentials.PerRPCCredentials - // TransportCredentials stores the Authenticator required to setup a client connection. - TransportCredentials credentials.TransportCredentials - // KeepaliveParams stores the keepalive parameters. - KeepaliveParams keepalive.ClientParameters - // StatsHandler stores the handler for stats. - StatsHandler stats.Handler - // InitialWindowSize sets the initial window size for a stream. - InitialWindowSize int32 - // InitialConnWindowSize sets the initial window size for a connection. - InitialConnWindowSize int32 - // WriteBufferSize sets the size of write buffer which in turn determines how much data can be batched before it's written on the wire. - WriteBufferSize int - // ReadBufferSize sets the size of read buffer, which in turn determines how much data can be read at most for one read syscall. - ReadBufferSize int -} - -// TargetInfo contains the information of the target such as network address and metadata. -type TargetInfo struct { - Addr string - Metadata interface{} - Authority string -} - -// NewClientTransport establishes the transport with the required ConnectOptions -// and returns it to the caller. -func NewClientTransport(connectCtx, ctx context.Context, target TargetInfo, opts ConnectOptions, onSuccess func()) (ClientTransport, error) { - return newHTTP2Client(connectCtx, ctx, target, opts, onSuccess) -} - -// Options provides additional hints and information for message -// transmission. -type Options struct { - // Last indicates whether this write is the last piece for - // this stream. - Last bool - - // Delay is a hint to the transport implementation for whether - // the data could be buffered for a batching write. The - // transport implementation may ignore the hint. - Delay bool -} - -// CallHdr carries the information of a particular RPC. -type CallHdr struct { - // Host specifies the peer's host. - Host string - - // Method specifies the operation to perform. - Method string - - // SendCompress specifies the compression algorithm applied on - // outbound message. - SendCompress string - - // Creds specifies credentials.PerRPCCredentials for a call. - Creds credentials.PerRPCCredentials - - // Flush indicates whether a new stream command should be sent - // to the peer without waiting for the first data. This is - // only a hint. - // If it's true, the transport may modify the flush decision - // for performance purposes. - // If it's false, new stream will never be flushed. - Flush bool -} - -// ClientTransport is the common interface for all gRPC client-side transport -// implementations. -type ClientTransport interface { - // Close tears down this transport. Once it returns, the transport - // should not be accessed any more. The caller must make sure this - // is called only once. - Close() error - - // GracefulClose starts to tear down the transport. It stops accepting - // new RPCs and wait the completion of the pending RPCs. - GracefulClose() error - - // Write sends the data for the given stream. A nil stream indicates - // the write is to be performed on the transport as a whole. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error - - // NewStream creates a Stream for an RPC. - NewStream(ctx context.Context, callHdr *CallHdr) (*Stream, error) - - // CloseStream clears the footprint of a stream when the stream is - // not needed any more. The err indicates the error incurred when - // CloseStream is called. Must be called when a stream is finished - // unless the associated transport is closing. - CloseStream(stream *Stream, err error) - - // Error returns a channel that is closed when some I/O error - // happens. Typically the caller should have a goroutine to monitor - // this in order to take action (e.g., close the current transport - // and create a new one) in error case. It should not return nil - // once the transport is initiated. - Error() <-chan struct{} - - // GoAway returns a channel that is closed when ClientTransport - // receives the draining signal from the server (e.g., GOAWAY frame in - // HTTP/2). - GoAway() <-chan struct{} - - // GetGoAwayReason returns the reason why GoAway frame was received. - GetGoAwayReason() GoAwayReason -} - -// ServerTransport is the common interface for all gRPC server-side transport -// implementations. -// -// Methods may be called concurrently from multiple goroutines, but -// Write methods for a given Stream will be called serially. -type ServerTransport interface { - // HandleStreams receives incoming streams using the given handler. - HandleStreams(func(*Stream), func(context.Context, string) context.Context) - - // WriteHeader sends the header metadata for the given stream. - // WriteHeader may not be called on all streams. - WriteHeader(s *Stream, md metadata.MD) error - - // Write sends the data for the given stream. - // Write may not be called on all streams. - Write(s *Stream, hdr []byte, data []byte, opts *Options) error - - // WriteStatus sends the status of a stream to the client. WriteStatus is - // the final call made on a stream and always occurs. - WriteStatus(s *Stream, st *status.Status) error - - // Close tears down the transport. Once it is called, the transport - // should not be accessed any more. All the pending streams and their - // handlers will be terminated asynchronously. - Close() error - - // RemoteAddr returns the remote network address. - RemoteAddr() net.Addr - - // Drain notifies the client this ServerTransport stops accepting new RPCs. - Drain() -} - -// streamErrorf creates an StreamError with the specified error code and description. -func streamErrorf(c codes.Code, format string, a ...interface{}) StreamError { - return StreamError{ - Code: c, - Desc: fmt.Sprintf(format, a...), - } -} - -// connectionErrorf creates an ConnectionError with the specified error description. -func connectionErrorf(temp bool, e error, format string, a ...interface{}) ConnectionError { - return ConnectionError{ - Desc: fmt.Sprintf(format, a...), - temp: temp, - err: e, - } -} - -// ConnectionError is an error that results in the termination of the -// entire connection and the retry of all the active streams. -type ConnectionError struct { - Desc string - temp bool - err error -} - -func (e ConnectionError) Error() string { - return fmt.Sprintf("connection error: desc = %q", e.Desc) -} - -// Temporary indicates if this connection error is temporary or fatal. -func (e ConnectionError) Temporary() bool { - return e.temp -} - -// Origin returns the original error of this connection error. -func (e ConnectionError) Origin() error { - // Never return nil error here. - // If the original error is nil, return itself. - if e.err == nil { - return e - } - return e.err -} - -var ( - // ErrConnClosing indicates that the transport is closing. - ErrConnClosing = connectionErrorf(true, nil, "transport is closing") - // errStreamDrain indicates that the stream is rejected by the server because - // the server stops accepting new RPCs. - // TODO: delete this error; it is no longer necessary. - errStreamDrain = streamErrorf(codes.Unavailable, "the server stops accepting new RPCs") - // StatusGoAway indicates that the server sent a GOAWAY that included this - // stream's ID in unprocessed RPCs. - statusGoAway = status.New(codes.Unavailable, "the server stopped accepting new RPCs") -) - -// TODO: See if we can replace StreamError with status package errors. - -// StreamError is an error that only affects one stream within a connection. -type StreamError struct { - Code codes.Code - Desc string -} - -func (e StreamError) Error() string { - return fmt.Sprintf("stream error: code = %s desc = %q", e.Code, e.Desc) -} - -// waiters are passed to quotaPool get methods to -// wait on in addition to waiting on quota. -type waiters struct { - ctx context.Context - tctx context.Context - done chan struct{} - goAway chan struct{} -} - -// GoAwayReason contains the reason for the GoAway frame received. -type GoAwayReason uint8 - -const ( - // GoAwayInvalid indicates that no GoAway frame is received. - GoAwayInvalid GoAwayReason = 0 - // GoAwayNoReason is the default value when GoAway frame is received. - GoAwayNoReason GoAwayReason = 1 - // GoAwayTooManyPings indicates that a GoAway frame with - // ErrCodeEnhanceYourCalm was received and that the debug data said - // "too_many_pings". - GoAwayTooManyPings GoAwayReason = 2 -) - -// loopyWriter is run in a separate go routine. It is the single code path that will -// write data on wire. -func loopyWriter(ctx context.Context, cbuf *controlBuffer, handler func(item) error) { - for { - select { - case i := <-cbuf.get(): - cbuf.load() - if err := handler(i); err != nil { - errorf("transport: Error while handling item. Err: %v", err) - return - } - case <-ctx.Done(): - return - } - hasData: - for { - select { - case i := <-cbuf.get(): - cbuf.load() - if err := handler(i); err != nil { - errorf("transport: Error while handling item. Err: %v", err) - return - } - case <-ctx.Done(): - return - default: - if err := handler(&flushIO{}); err != nil { - errorf("transport: Error while flushing. Err: %v", err) - return - } - break hasData - } - } - } -} diff --git a/vendor/google.golang.org/grpc/transport/transport_test.go b/vendor/google.golang.org/grpc/transport/transport_test.go deleted file mode 100644 index 8c004ec..0000000 --- a/vendor/google.golang.org/grpc/transport/transport_test.go +++ /dev/null @@ -1,2278 +0,0 @@ -/* - * - * Copyright 2014 gRPC authors. - * - * 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 transport - -import ( - "bufio" - "bytes" - "encoding/binary" - "errors" - "fmt" - "io" - "math" - "net" - "net/http" - "reflect" - "strconv" - "strings" - "sync" - "testing" - "time" - - "golang.org/x/net/context" - "golang.org/x/net/http2" - "golang.org/x/net/http2/hpack" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/keepalive" - "google.golang.org/grpc/status" -) - -type server struct { - lis net.Listener - port string - startedErr chan error // error (or nil) with server start value - mu sync.Mutex - conns map[ServerTransport]bool - h *testStreamHandler -} - -var ( - expectedRequest = []byte("ping") - expectedResponse = []byte("pong") - expectedRequestLarge = make([]byte, initialWindowSize*2) - expectedResponseLarge = make([]byte, initialWindowSize*2) - expectedInvalidHeaderField = "invalid/content-type" -) - -type testStreamHandler struct { - t *http2Server - notify chan struct{} -} - -type hType int - -const ( - normal hType = iota - suspended - notifyCall - misbehaved - encodingRequiredStatus - invalidHeaderField - delayRead - delayWrite - pingpong -) - -func (h *testStreamHandler) handleStreamAndNotify(s *Stream) { - if h.notify == nil { - return - } - go func() { - select { - case <-h.notify: - default: - close(h.notify) - } - }() -} - -func (h *testStreamHandler) handleStream(t *testing.T, s *Stream) { - req := expectedRequest - resp := expectedResponse - if s.Method() == "foo.Large" { - req = expectedRequestLarge - resp = expectedResponseLarge - } - p := make([]byte, len(req)) - _, err := s.Read(p) - if err != nil { - return - } - if !bytes.Equal(p, req) { - t.Fatalf("handleStream got %v, want %v", p, req) - } - // send a response back to the client. - h.t.Write(s, nil, resp, &Options{}) - // send the trailer to end the stream. - h.t.WriteStatus(s, status.New(codes.OK, "")) -} - -func (h *testStreamHandler) handleStreamPingPong(t *testing.T, s *Stream) { - header := make([]byte, 5) - for { - if _, err := s.Read(header); err != nil { - if err == io.EOF { - h.t.WriteStatus(s, status.New(codes.OK, "")) - return - } - t.Fatalf("Error on server while reading data header: %v", err) - } - sz := binary.BigEndian.Uint32(header[1:]) - msg := make([]byte, int(sz)) - if _, err := s.Read(msg); err != nil { - t.Fatalf("Error on server while reading message: %v", err) - } - buf := make([]byte, sz+5) - buf[0] = byte(0) - binary.BigEndian.PutUint32(buf[1:], uint32(sz)) - copy(buf[5:], msg) - h.t.Write(s, nil, buf, &Options{}) - } -} - -func (h *testStreamHandler) handleStreamMisbehave(t *testing.T, s *Stream) { - conn, ok := s.ServerTransport().(*http2Server) - if !ok { - t.Fatalf("Failed to convert %v to *http2Server", s.ServerTransport()) - } - var sent int - p := make([]byte, http2MaxFrameLen) - for sent < initialWindowSize { - n := initialWindowSize - sent - // The last message may be smaller than http2MaxFrameLen - if n <= http2MaxFrameLen { - if s.Method() == "foo.Connection" { - // Violate connection level flow control window of client but do not - // violate any stream level windows. - p = make([]byte, n) - } else { - // Violate stream level flow control window of client. - p = make([]byte, n+1) - } - } - conn.controlBuf.put(&dataFrame{s.id, false, p, func() {}}) - sent += len(p) - } -} - -func (h *testStreamHandler) handleStreamEncodingRequiredStatus(t *testing.T, s *Stream) { - // raw newline is not accepted by http2 framer so it must be encoded. - h.t.WriteStatus(s, encodingTestStatus) -} - -func (h *testStreamHandler) handleStreamInvalidHeaderField(t *testing.T, s *Stream) { - headerFields := []hpack.HeaderField{} - headerFields = append(headerFields, hpack.HeaderField{Name: "content-type", Value: expectedInvalidHeaderField}) - h.t.controlBuf.put(&headerFrame{ - streamID: s.id, - hf: headerFields, - endStream: false, - }) -} - -func (h *testStreamHandler) handleStreamDelayRead(t *testing.T, s *Stream) { - req := expectedRequest - resp := expectedResponse - if s.Method() == "foo.Large" { - req = expectedRequestLarge - resp = expectedResponseLarge - } - p := make([]byte, len(req)) - - // Wait before reading. Give time to client to start sending - // before server starts reading. - time.Sleep(2 * time.Second) - _, err := s.Read(p) - if err != nil { - t.Fatalf("s.Read(_) = _, %v, want _, ", err) - return - } - - if !bytes.Equal(p, req) { - t.Fatalf("handleStream got %v, want %v", p, req) - } - // send a response back to the client. - h.t.Write(s, nil, resp, &Options{}) - // send the trailer to end the stream. - h.t.WriteStatus(s, status.New(codes.OK, "")) -} - -func (h *testStreamHandler) handleStreamDelayWrite(t *testing.T, s *Stream) { - req := expectedRequest - resp := expectedResponse - if s.Method() == "foo.Large" { - req = expectedRequestLarge - resp = expectedResponseLarge - } - p := make([]byte, len(req)) - _, err := s.Read(p) - if err != nil { - t.Fatalf("s.Read(_) = _, %v, want _, ", err) - return - } - if !bytes.Equal(p, req) { - t.Fatalf("handleStream got %v, want %v", p, req) - } - - // Wait before sending. Give time to client to start reading - // before server starts sending. - time.Sleep(2 * time.Second) - h.t.Write(s, nil, resp, &Options{}) - // send the trailer to end the stream. - h.t.WriteStatus(s, status.New(codes.OK, "")) -} - -// start starts server. Other goroutines should block on s.readyChan for further operations. -func (s *server) start(t *testing.T, port int, serverConfig *ServerConfig, ht hType) { - var err error - if port == 0 { - s.lis, err = net.Listen("tcp", "localhost:0") - } else { - s.lis, err = net.Listen("tcp", "localhost:"+strconv.Itoa(port)) - } - if err != nil { - s.startedErr <- fmt.Errorf("failed to listen: %v", err) - return - } - _, p, err := net.SplitHostPort(s.lis.Addr().String()) - if err != nil { - s.startedErr <- fmt.Errorf("failed to parse listener address: %v", err) - return - } - s.port = p - s.conns = make(map[ServerTransport]bool) - s.startedErr <- nil - for { - conn, err := s.lis.Accept() - if err != nil { - return - } - transport, err := NewServerTransport("http2", conn, serverConfig) - if err != nil { - return - } - s.mu.Lock() - if s.conns == nil { - s.mu.Unlock() - transport.Close() - return - } - s.conns[transport] = true - h := &testStreamHandler{t: transport.(*http2Server)} - s.h = h - s.mu.Unlock() - switch ht { - case notifyCall: - go transport.HandleStreams(h.handleStreamAndNotify, - func(ctx context.Context, _ string) context.Context { - return ctx - }) - case suspended: - go transport.HandleStreams(func(*Stream) {}, // Do nothing to handle the stream. - func(ctx context.Context, method string) context.Context { - return ctx - }) - case misbehaved: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamMisbehave(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - case encodingRequiredStatus: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamEncodingRequiredStatus(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - case invalidHeaderField: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamInvalidHeaderField(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - case delayRead: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamDelayRead(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - case delayWrite: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamDelayWrite(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - case pingpong: - go transport.HandleStreams(func(s *Stream) { - go h.handleStreamPingPong(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - default: - go transport.HandleStreams(func(s *Stream) { - go h.handleStream(t, s) - }, func(ctx context.Context, method string) context.Context { - return ctx - }) - } - } -} - -func (s *server) wait(t *testing.T, timeout time.Duration) { - select { - case err := <-s.startedErr: - if err != nil { - t.Fatal(err) - } - case <-time.After(timeout): - t.Fatalf("Timed out after %v waiting for server to be ready", timeout) - } -} - -func (s *server) stop() { - s.lis.Close() - s.mu.Lock() - for c := range s.conns { - c.Close() - } - s.conns = nil - s.mu.Unlock() -} - -func setUp(t *testing.T, port int, maxStreams uint32, ht hType) (*server, ClientTransport) { - return setUpWithOptions(t, port, &ServerConfig{MaxStreams: maxStreams}, ht, ConnectOptions{}) -} - -func setUpWithOptions(t *testing.T, port int, serverConfig *ServerConfig, ht hType, copts ConnectOptions) (*server, ClientTransport) { - server := &server{startedErr: make(chan error, 1)} - go server.start(t, port, serverConfig, ht) - server.wait(t, 2*time.Second) - addr := "localhost:" + server.port - var ( - ct ClientTransport - connErr error - ) - target := TargetInfo{ - Addr: addr, - } - connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second)) - ct, connErr = NewClientTransport(connectCtx, context.Background(), target, copts, func() {}) - if connErr != nil { - cancel() // Do not cancel in success path. - t.Fatalf("failed to create transport: %v", connErr) - } - return server, ct -} - -func setUpWithNoPingServer(t *testing.T, copts ConnectOptions, done chan net.Conn) ClientTransport { - lis, err := net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen: %v", err) - } - // Launch a non responsive server. - go func() { - defer lis.Close() - conn, err := lis.Accept() - if err != nil { - t.Errorf("Error at server-side while accepting: %v", err) - close(done) - return - } - done <- conn - }() - connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second)) - tr, err := NewClientTransport(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, copts, func() {}) - if err != nil { - cancel() // Do not cancel in success path. - // Server clean-up. - lis.Close() - if conn, ok := <-done; ok { - conn.Close() - } - t.Fatalf("Failed to dial: %v", err) - } - return tr -} - -// TestInflightStreamClosing ensures that closing in-flight stream -// sends StreamError to concurrent stream reader. -func TestInflightStreamClosing(t *testing.T) { - serverConfig := &ServerConfig{} - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - - stream, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - - donec := make(chan struct{}) - serr := StreamError{Desc: "client connection is closing"} - go func() { - defer close(donec) - if _, err := stream.Read(make([]byte, defaultWindowSize)); err != serr { - t.Errorf("unexpected Stream error %v, expected %v", err, serr) - } - }() - - // should unblock concurrent stream.Read - client.CloseStream(stream, serr) - - // wait for stream.Read error - timeout := time.NewTimer(5 * time.Second) - select { - case <-donec: - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test timed out, expected a StreamError.") - } -} - -// TestMaxConnectionIdle tests that a server will send GoAway to a idle client. -// An idle client is one who doesn't make any RPC calls for a duration of -// MaxConnectionIdle time. -func TestMaxConnectionIdle(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionIdle: 2 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - stream, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - stream.mu.Lock() - stream.rstStream = true - stream.mu.Unlock() - client.CloseStream(stream, nil) - // wait for server to see that closed stream and max-age logic to send goaway after no new RPCs are mode - timeout := time.NewTimer(time.Second * 4) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test timed out, expected a GoAway from the server.") - } -} - -// TestMaxConenctionIdleNegative tests that a server will not send GoAway to a non-idle(busy) client. -func TestMaxConnectionIdleNegative(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionIdle: 2 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - _, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Client failed to create RPC request: %v", err) - } - timeout := time.NewTimer(time.Second * 4) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - t.Fatalf("A non-idle client received a GoAway.") - case <-timeout.C: - } - -} - -// TestMaxConnectionAge tests that a server will send GoAway after a duration of MaxConnectionAge. -func TestMaxConnectionAge(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - MaxConnectionAge: 2 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - _, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Client failed to create stream: %v", err) - } - // Wait for max-age logic to send GoAway. - timeout := time.NewTimer(4 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test timer out, expected a GoAway from the server.") - } -} - -// TestKeepaliveServer tests that a server closes connection with a client that doesn't respond to keepalive pings. -func TestKeepaliveServer(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - Time: 2 * time.Second, - Timeout: 1 * time.Second, - }, - } - server, c := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer c.Close() - client, err := net.Dial("tcp", server.lis.Addr().String()) - if err != nil { - t.Fatalf("Failed to dial: %v", err) - } - defer client.Close() - - // Set read deadline on client conn so that it doesn't block forever in errorsome cases. - client.SetDeadline(time.Now().Add(10 * time.Second)) - - if n, err := client.Write(clientPreface); err != nil || n != len(clientPreface) { - t.Fatalf("Error writing client preface; n=%v, err=%v", n, err) - } - framer := newFramer(client, defaultWriteBufSize, defaultReadBufSize) - if err := framer.fr.WriteSettings(http2.Setting{}); err != nil { - t.Fatal("Error writing settings frame:", err) - } - framer.writer.Flush() - // Wait for keepalive logic to close the connection. - time.Sleep(4 * time.Second) - b := make([]byte, 24) - for { - _, err = client.Read(b) - if err == nil { - continue - } - if err != io.EOF { - t.Fatalf("client.Read(_) = _,%v, want io.EOF", err) - } - break - } -} - -// TestKeepaliveServerNegative tests that a server doesn't close connection with a client that responds to keepalive pings. -func TestKeepaliveServerNegative(t *testing.T) { - serverConfig := &ServerConfig{ - KeepaliveParams: keepalive.ServerParameters{ - Time: 2 * time.Second, - Timeout: 1 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - // Give keepalive logic some time by sleeping. - time.Sleep(4 * time.Second) - // Assert that client is still active. - clientTr := client.(*http2Client) - clientTr.mu.Lock() - defer clientTr.mu.Unlock() - if clientTr.state != reachable { - t.Fatalf("Test failed: Expected server-client connection to be healthy.") - } -} - -func TestKeepaliveClientClosesIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Sleep for keepalive to close the connection. - time.Sleep(4 * time.Second) - // Assert that the connection was closed. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test Failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyOnIdleTransport(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("server didn't reutrn connection object") - } - defer conn.Close() - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that connections is still healthy. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - -func TestKeepaliveClientClosesWithActiveStreams(t *testing.T) { - done := make(chan net.Conn, 1) - tr := setUpWithNoPingServer(t, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - }}, done) - defer tr.Close() - conn, ok := <-done - if !ok { - t.Fatalf("Server didn't return connection object") - } - defer conn.Close() - // Create a stream. - _, err := tr.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Failed to create a new stream: %v", err) - } - // Give keepalive some time. - time.Sleep(4 * time.Second) - // Assert that transport was closed. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test failed: Expected client transport to have closed.") - } -} - -func TestKeepaliveClientStaysHealthyWithResponsiveServer(t *testing.T) { - s, tr := setUpWithOptions(t, 0, &ServerConfig{MaxStreams: math.MaxUint32}, normal, ConnectOptions{KeepaliveParams: keepalive.ClientParameters{ - Time: 2 * time.Second, // Keepalive time = 2 sec. - Timeout: 1 * time.Second, // Keepalive timeout = 1 sec. - PermitWithoutStream: true, // Run keepalive even with no RPCs. - }}) - defer s.stop() - defer tr.Close() - // Give keep alive some time. - time.Sleep(4 * time.Second) - // Assert that transport is healthy. - ct := tr.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected client transport to be healthy.") - } -} - -func TestKeepaliveServerEnforcementWithAbusiveClientNoRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 2 * time.Second, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 50 * time.Millisecond, - Timeout: 1 * time.Second, - PermitWithoutStream: true, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) - defer server.stop() - defer client.Close() - - timeout := time.NewTimer(10 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test failed: Expected a GoAway from server.") - } - time.Sleep(500 * time.Millisecond) - ct := client.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test failed: Expected the connection to be closed.") - } -} - -func TestKeepaliveServerEnforcementWithAbusiveClientWithRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 2 * time.Second, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 50 * time.Millisecond, - Timeout: 1 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) - defer server.stop() - defer client.Close() - - if _, err := client.NewStream(context.Background(), &CallHdr{Flush: true}); err != nil { - t.Fatalf("Client failed to create stream.") - } - timeout := time.NewTimer(10 * time.Second) - select { - case <-client.GoAway(): - if !timeout.Stop() { - <-timeout.C - } - case <-timeout.C: - t.Fatalf("Test failed: Expected a GoAway from server.") - } - time.Sleep(500 * time.Millisecond) - ct := client.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state == reachable { - t.Fatalf("Test failed: Expected the connection to be closed.") - } -} - -func TestKeepaliveServerEnforcementWithObeyingClientNoRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 100 * time.Millisecond, - PermitWithoutStream: true, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 101 * time.Millisecond, - Timeout: 1 * time.Second, - PermitWithoutStream: true, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, normal, clientOptions) - defer server.stop() - defer client.Close() - - // Give keepalive enough time. - time.Sleep(3 * time.Second) - // Assert that connection is healthy. - ct := client.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected connection to be healthy.") - } -} - -func TestKeepaliveServerEnforcementWithObeyingClientWithRPC(t *testing.T) { - serverConfig := &ServerConfig{ - KeepalivePolicy: keepalive.EnforcementPolicy{ - MinTime: 100 * time.Millisecond, - }, - } - clientOptions := ConnectOptions{ - KeepaliveParams: keepalive.ClientParameters{ - Time: 101 * time.Millisecond, - Timeout: 1 * time.Second, - }, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, clientOptions) - defer server.stop() - defer client.Close() - - if _, err := client.NewStream(context.Background(), &CallHdr{Flush: true}); err != nil { - t.Fatalf("Client failed to create stream.") - } - - // Give keepalive enough time. - time.Sleep(3 * time.Second) - // Assert that connection is healthy. - ct := client.(*http2Client) - ct.mu.Lock() - defer ct.mu.Unlock() - if ct.state != reachable { - t.Fatalf("Test failed: Expected connection to be healthy.") - } -} - -func TestClientSendAndReceive(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, normal) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Small", - } - s1, err1 := ct.NewStream(context.Background(), callHdr) - if err1 != nil { - t.Fatalf("failed to open stream: %v", err1) - } - if s1.id != 1 { - t.Fatalf("wrong stream id: %d", s1.id) - } - s2, err2 := ct.NewStream(context.Background(), callHdr) - if err2 != nil { - t.Fatalf("failed to open stream: %v", err2) - } - if s2.id != 3 { - t.Fatalf("wrong stream id: %d", s2.id) - } - opts := Options{ - Last: true, - Delay: false, - } - if err := ct.Write(s1, nil, expectedRequest, &opts); err != nil && err != io.EOF { - t.Fatalf("failed to send data: %v", err) - } - p := make([]byte, len(expectedResponse)) - _, recvErr := s1.Read(p) - if recvErr != nil || !bytes.Equal(p, expectedResponse) { - t.Fatalf("Error: %v, want ; Result: %v, want %v", recvErr, p, expectedResponse) - } - _, recvErr = s1.Read(p) - if recvErr != io.EOF { - t.Fatalf("Error: %v; want ", recvErr) - } - ct.Close() - server.stop() -} - -func TestClientErrorNotify(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, normal) - go server.stop() - // ct.reader should detect the error and activate ct.Error(). - <-ct.Error() - ct.Close() -} - -func performOneRPC(ct ClientTransport) { - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Small", - } - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - return - } - opts := Options{ - Last: true, - Delay: false, - } - if err := ct.Write(s, []byte{}, expectedRequest, &opts); err == nil || err == io.EOF { - time.Sleep(5 * time.Millisecond) - // The following s.Recv()'s could error out because the - // underlying transport is gone. - // - // Read response - p := make([]byte, len(expectedResponse)) - s.Read(p) - // Read io.EOF - s.Read(p) - } -} - -func TestClientMix(t *testing.T) { - s, ct := setUp(t, 0, math.MaxUint32, normal) - go func(s *server) { - time.Sleep(5 * time.Second) - s.stop() - }(s) - go func(ct ClientTransport) { - <-ct.Error() - ct.Close() - }(ct) - for i := 0; i < 1000; i++ { - time.Sleep(10 * time.Millisecond) - go performOneRPC(ct) - } -} - -func TestLargeMessage(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, normal) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Large", - } - var wg sync.WaitGroup - for i := 0; i < 2; i++ { - wg.Add(1) - go func() { - defer wg.Done() - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Errorf("%v.NewStream(_, _) = _, %v, want _, ", ct, err) - } - if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{Last: true, Delay: false}); err != nil && err != io.EOF { - t.Errorf("%v.Write(_, _, _) = %v, want ", ct, err) - } - p := make([]byte, len(expectedResponseLarge)) - if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponseLarge) { - t.Errorf("s.Read(%v) = _, %v, want %v, ", err, p, expectedResponse) - } - if _, err = s.Read(p); err != io.EOF { - t.Errorf("Failed to complete the stream %v; want ", err) - } - }() - } - wg.Wait() - ct.Close() - server.stop() -} - -func TestLargeMessageWithDelayRead(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, delayRead) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Large", - } - var wg sync.WaitGroup - for i := 0; i < 2; i++ { - wg.Add(1) - go func() { - defer wg.Done() - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Errorf("%v.NewStream(_, _) = _, %v, want _, ", ct, err) - } - if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{Last: true, Delay: false}); err != nil && err != io.EOF { - t.Errorf("%v.Write(_, _, _) = %v, want ", ct, err) - } - p := make([]byte, len(expectedResponseLarge)) - - // Give time to server to begin sending before client starts reading. - time.Sleep(2 * time.Second) - if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponseLarge) { - t.Errorf("s.Read(_) = _, %v, want _, ", err) - } - if _, err = s.Read(p); err != io.EOF { - t.Errorf("Failed to complete the stream %v; want ", err) - } - }() - } - wg.Wait() - ct.Close() - server.stop() -} - -func TestLargeMessageDelayWrite(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, delayWrite) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Large", - } - var wg sync.WaitGroup - for i := 0; i < 2; i++ { - wg.Add(1) - go func() { - defer wg.Done() - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Errorf("%v.NewStream(_, _) = _, %v, want _, ", ct, err) - } - - // Give time to server to start reading before client starts sending. - time.Sleep(2 * time.Second) - if err := ct.Write(s, []byte{}, expectedRequestLarge, &Options{Last: true, Delay: false}); err != nil && err != io.EOF { - t.Errorf("%v.Write(_, _, _) = %v, want ", ct, err) - } - p := make([]byte, len(expectedResponseLarge)) - if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponseLarge) { - t.Errorf("io.ReadFull(%v) = _, %v, want %v, ", err, p, expectedResponse) - } - if _, err = s.Read(p); err != io.EOF { - t.Errorf("Failed to complete the stream %v; want ", err) - } - }() - } - wg.Wait() - ct.Close() - server.stop() -} - -func TestGracefulClose(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, normal) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Small", - } - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Fatalf("%v.NewStream(_, _) = _, %v, want _, ", ct, err) - } - if err = ct.GracefulClose(); err != nil { - t.Fatalf("%v.GracefulClose() = %v, want ", ct, err) - } - var wg sync.WaitGroup - // Expect the failure for all the follow-up streams because ct has been closed gracefully. - for i := 0; i < 100; i++ { - wg.Add(1) - go func() { - defer wg.Done() - if _, err := ct.NewStream(context.Background(), callHdr); err != errStreamDrain { - t.Errorf("%v.NewStream(_, _) = _, %v, want _, %v", ct, err, errStreamDrain) - } - }() - } - opts := Options{ - Last: true, - Delay: false, - } - // The stream which was created before graceful close can still proceed. - if err := ct.Write(s, nil, expectedRequest, &opts); err != nil && err != io.EOF { - t.Fatalf("%v.Write(_, _, _) = %v, want ", ct, err) - } - p := make([]byte, len(expectedResponse)) - if _, err := s.Read(p); err != nil || !bytes.Equal(p, expectedResponse) { - t.Fatalf("s.Read(%v) = _, %v, want %v, ", err, p, expectedResponse) - } - if _, err = s.Read(p); err != io.EOF { - t.Fatalf("Failed to complete the stream %v; want ", err) - } - wg.Wait() - ct.Close() - server.stop() -} - -func TestLargeMessageSuspension(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, suspended) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Large", - } - // Set a long enough timeout for writing a large message out. - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - defer cancel() - s, err := ct.NewStream(ctx, callHdr) - if err != nil { - t.Fatalf("failed to open stream: %v", err) - } - // Write should not be done successfully due to flow control. - msg := make([]byte, initialWindowSize*8) - err = ct.Write(s, nil, msg, &Options{Last: true, Delay: false}) - expectedErr := streamErrorf(codes.DeadlineExceeded, "%v", context.DeadlineExceeded) - if err != expectedErr { - t.Fatalf("Write got %v, want %v", err, expectedErr) - } - ct.Close() - server.stop() -} - -func TestMaxStreams(t *testing.T) { - server, ct := setUp(t, 0, 1, suspended) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Large", - } - // Have a pending stream which takes all streams quota. - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Fatalf("Failed to open stream: %v", err) - } - cc, ok := ct.(*http2Client) - if !ok { - t.Fatalf("Failed to convert %v to *http2Client", ct) - } - done := make(chan struct{}) - ch := make(chan int) - ready := make(chan struct{}) - go func() { - for { - select { - case <-time.After(5 * time.Millisecond): - select { - case ch <- 0: - case <-ready: - return - } - case <-time.After(5 * time.Second): - close(done) - return - case <-ready: - return - } - } - }() - // Test these conditions until they pass or - // we reach the deadline (failure case). - for { - select { - case <-ch: - case <-done: - t.Fatalf("streamsQuota.quota shouldn't be non-zero.") - } - cc.streamsQuota.mu.Lock() - sq := cc.streamsQuota.quota - cc.streamsQuota.mu.Unlock() - if sq == 0 { - break - } - } - close(ready) - // Close the pending stream so that the streams quota becomes available for the next new stream. - ct.CloseStream(s, nil) - cc.streamsQuota.mu.Lock() - i := cc.streamsQuota.quota - cc.streamsQuota.mu.Unlock() - if i != 1 { - t.Fatalf("streamsQuota is %d, want 1.", i) - } - if _, err := ct.NewStream(context.Background(), callHdr); err != nil { - t.Fatalf("Failed to open stream: %v", err) - } - ct.Close() - server.stop() -} - -func TestServerContextCanceledOnClosedConnection(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, suspended) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo", - } - var sc *http2Server - // Wait until the server transport is setup. - for { - server.mu.Lock() - if len(server.conns) == 0 { - server.mu.Unlock() - time.Sleep(time.Millisecond) - continue - } - for k := range server.conns { - var ok bool - sc, ok = k.(*http2Server) - if !ok { - t.Fatalf("Failed to convert %v to *http2Server", k) - } - } - server.mu.Unlock() - break - } - cc, ok := ct.(*http2Client) - if !ok { - t.Fatalf("Failed to convert %v to *http2Client", ct) - } - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Fatalf("Failed to open stream: %v", err) - } - cc.controlBuf.put(&dataFrame{s.id, false, make([]byte, http2MaxFrameLen), func() {}}) - // Loop until the server side stream is created. - var ss *Stream - for { - time.Sleep(time.Second) - sc.mu.Lock() - if len(sc.activeStreams) == 0 { - sc.mu.Unlock() - continue - } - ss = sc.activeStreams[s.id] - sc.mu.Unlock() - break - } - cc.Close() - select { - case <-ss.Context().Done(): - if ss.Context().Err() != context.Canceled { - t.Fatalf("ss.Context().Err() got %v, want %v", ss.Context().Err(), context.Canceled) - } - case <-time.After(5 * time.Second): - t.Fatalf("Failed to cancel the context of the sever side stream.") - } - server.stop() -} - -func TestClientConnDecoupledFromApplicationRead(t *testing.T) { - connectOptions := ConnectOptions{ - InitialWindowSize: defaultWindowSize, - InitialConnWindowSize: defaultWindowSize, - } - server, client := setUpWithOptions(t, 0, &ServerConfig{}, notifyCall, connectOptions) - defer server.stop() - defer client.Close() - - waitWhileTrue(t, func() (bool, error) { - server.mu.Lock() - defer server.mu.Unlock() - - if len(server.conns) == 0 { - return true, fmt.Errorf("timed-out while waiting for connection to be created on the server") - } - return false, nil - }) - - var st *http2Server - server.mu.Lock() - for k := range server.conns { - st = k.(*http2Server) - } - notifyChan := make(chan struct{}) - server.h.notify = notifyChan - server.mu.Unlock() - cstream1, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Client failed to create first stream. Err: %v", err) - } - - <-notifyChan - var sstream1 *Stream - // Access stream on the server. - st.mu.Lock() - for _, v := range st.activeStreams { - if v.id == cstream1.id { - sstream1 = v - } - } - st.mu.Unlock() - if sstream1 == nil { - t.Fatalf("Didn't find stream corresponding to client cstream.id: %v on the server", cstream1.id) - } - // Exhaust client's connection window. - if err := st.Write(sstream1, []byte{}, make([]byte, defaultWindowSize), &Options{}); err != nil { - t.Fatalf("Server failed to write data. Err: %v", err) - } - notifyChan = make(chan struct{}) - server.mu.Lock() - server.h.notify = notifyChan - server.mu.Unlock() - // Create another stream on client. - cstream2, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Client failed to create second stream. Err: %v", err) - } - <-notifyChan - var sstream2 *Stream - st.mu.Lock() - for _, v := range st.activeStreams { - if v.id == cstream2.id { - sstream2 = v - } - } - st.mu.Unlock() - if sstream2 == nil { - t.Fatalf("Didn't find stream corresponding to client cstream.id: %v on the server", cstream2.id) - } - // Server should be able to send data on the new stream, even though the client hasn't read anything on the first stream. - if err := st.Write(sstream2, []byte{}, make([]byte, defaultWindowSize), &Options{}); err != nil { - t.Fatalf("Server failed to write data. Err: %v", err) - } - - // Client should be able to read data on second stream. - if _, err := cstream2.Read(make([]byte, defaultWindowSize)); err != nil { - t.Fatalf("_.Read(_) = _, %v, want _, ", err) - } - - // Client should be able to read data on first stream. - if _, err := cstream1.Read(make([]byte, defaultWindowSize)); err != nil { - t.Fatalf("_.Read(_) = _, %v, want _, ", err) - } -} - -func TestServerConnDecoupledFromApplicationRead(t *testing.T) { - serverConfig := &ServerConfig{ - InitialWindowSize: defaultWindowSize, - InitialConnWindowSize: defaultWindowSize, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, ConnectOptions{}) - defer server.stop() - defer client.Close() - waitWhileTrue(t, func() (bool, error) { - server.mu.Lock() - defer server.mu.Unlock() - - if len(server.conns) == 0 { - return true, fmt.Errorf("timed-out while waiting for connection to be created on the server") - } - return false, nil - }) - var st *http2Server - server.mu.Lock() - for k := range server.conns { - st = k.(*http2Server) - } - server.mu.Unlock() - cstream1, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Failed to create 1st stream. Err: %v", err) - } - // Exhaust server's connection window. - if err := client.Write(cstream1, nil, make([]byte, defaultWindowSize), &Options{Last: true}); err != nil { - t.Fatalf("Client failed to write data. Err: %v", err) - } - //Client should be able to create another stream and send data on it. - cstream2, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Failed to create 2nd stream. Err: %v", err) - } - if err := client.Write(cstream2, nil, make([]byte, defaultWindowSize), &Options{}); err != nil { - t.Fatalf("Client failed to write data. Err: %v", err) - } - // Get the streams on server. - waitWhileTrue(t, func() (bool, error) { - st.mu.Lock() - defer st.mu.Unlock() - - if len(st.activeStreams) != 2 { - return true, fmt.Errorf("timed-out while waiting for server to have created the streams") - } - return false, nil - }) - var sstream1 *Stream - st.mu.Lock() - for _, v := range st.activeStreams { - if v.id == 1 { - sstream1 = v - } - } - st.mu.Unlock() - // Trying to write more on a max-ed out stream should result in a RST_STREAM from the server. - ct := client.(*http2Client) - ct.controlBuf.put(&dataFrame{cstream2.id, true, make([]byte, 1), func() {}}) - code := http2ErrConvTab[http2.ErrCodeFlowControl] - waitWhileTrue(t, func() (bool, error) { - cstream2.mu.Lock() - defer cstream2.mu.Unlock() - if cstream2.status.Code() != code { - return true, fmt.Errorf("want code = %v, got %v", code, cstream2.status.Code()) - } - return false, nil - }) - // Reading from the stream on server should succeed. - if _, err := sstream1.Read(make([]byte, defaultWindowSize)); err != nil { - t.Fatalf("_.Read(_) = %v, want ", err) - } - - if _, err := sstream1.Read(make([]byte, 1)); err != io.EOF { - t.Fatalf("_.Read(_) = %v, want io.EOF", err) - } - -} - -func TestServerWithMisbehavedClient(t *testing.T) { - serverConfig := &ServerConfig{ - InitialWindowSize: defaultWindowSize, - InitialConnWindowSize: defaultWindowSize, - } - connectOptions := ConnectOptions{ - InitialWindowSize: defaultWindowSize, - InitialConnWindowSize: defaultWindowSize, - } - server, ct := setUpWithOptions(t, 0, serverConfig, suspended, connectOptions) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo", - } - var sc *http2Server - // Wait until the server transport is setup. - for { - server.mu.Lock() - if len(server.conns) == 0 { - server.mu.Unlock() - time.Sleep(time.Millisecond) - continue - } - for k := range server.conns { - var ok bool - sc, ok = k.(*http2Server) - if !ok { - t.Fatalf("Failed to convert %v to *http2Server", k) - } - } - server.mu.Unlock() - break - } - cc, ok := ct.(*http2Client) - if !ok { - t.Fatalf("Failed to convert %v to *http2Client", ct) - } - // Test server behavior for violation of stream flow control window size restriction. - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Fatalf("Failed to open stream: %v", err) - } - var sent int - // Drain the stream flow control window - cc.controlBuf.put(&dataFrame{s.id, false, make([]byte, http2MaxFrameLen), func() {}}) - sent += http2MaxFrameLen - // Wait until the server creates the corresponding stream and receive some data. - var ss *Stream - for { - time.Sleep(time.Millisecond) - sc.mu.Lock() - if len(sc.activeStreams) == 0 { - sc.mu.Unlock() - continue - } - ss = sc.activeStreams[s.id] - sc.mu.Unlock() - ss.fc.mu.Lock() - if ss.fc.pendingData > 0 { - ss.fc.mu.Unlock() - break - } - ss.fc.mu.Unlock() - } - if ss.fc.pendingData != http2MaxFrameLen || ss.fc.pendingUpdate != 0 || sc.fc.pendingData != 0 || sc.fc.pendingUpdate != 0 { - t.Fatalf("Server mistakenly updates inbound flow control params: got %d, %d, %d, %d; want %d, %d, %d, %d", ss.fc.pendingData, ss.fc.pendingUpdate, sc.fc.pendingData, sc.fc.pendingUpdate, http2MaxFrameLen, 0, 0, 0) - } - // Keep sending until the server inbound window is drained for that stream. - for sent <= initialWindowSize { - cc.controlBuf.put(&dataFrame{s.id, false, make([]byte, 1), func() {}}) - sent++ - } - // Server sent a resetStream for s already. - code := http2ErrConvTab[http2.ErrCodeFlowControl] - if _, err := s.Read(make([]byte, 1)); err != io.EOF { - t.Fatalf("%v got err %v want ", s, err) - } - if s.status.Code() != code { - t.Fatalf("%v got status %v; want Code=%v", s, s.status, code) - } - - ct.CloseStream(s, nil) - ct.Close() - server.stop() -} - -func TestClientWithMisbehavedServer(t *testing.T) { - // Turn off BDP estimation so that the server can - // violate stream window. - connectOptions := ConnectOptions{ - InitialWindowSize: initialWindowSize, - } - server, ct := setUpWithOptions(t, 0, &ServerConfig{}, misbehaved, connectOptions) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo.Stream", - } - conn, ok := ct.(*http2Client) - if !ok { - t.Fatalf("Failed to convert %v to *http2Client", ct) - } - // Test the logic for the violation of stream flow control window size restriction. - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - t.Fatalf("Failed to open stream: %v", err) - } - d := make([]byte, 1) - if err := ct.Write(s, nil, d, &Options{Last: true, Delay: false}); err != nil && err != io.EOF { - t.Fatalf("Failed to write: %v", err) - } - // Read without window update. - for { - p := make([]byte, http2MaxFrameLen) - if _, err = s.trReader.(*transportReader).reader.Read(p); err != nil { - break - } - } - if s.fc.pendingData <= initialWindowSize || s.fc.pendingUpdate != 0 || conn.fc.pendingData != 0 || conn.fc.pendingUpdate != 0 { - t.Fatalf("Client mistakenly updates inbound flow control params: got %d, %d, %d, %d; want >%d, %d, %d, >%d", s.fc.pendingData, s.fc.pendingUpdate, conn.fc.pendingData, conn.fc.pendingUpdate, initialWindowSize, 0, 0, 0) - } - - if err != io.EOF { - t.Fatalf("Got err %v, want ", err) - } - if s.status.Code() != codes.Internal { - t.Fatalf("Got s.status %v, want s.status.Code()=Internal", s.status) - } - - conn.CloseStream(s, err) - ct.Close() - server.stop() -} - -var encodingTestStatus = status.New(codes.Internal, "\n") - -func TestEncodingRequiredStatus(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, encodingRequiredStatus) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo", - } - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - return - } - opts := Options{ - Last: true, - Delay: false, - } - if err := ct.Write(s, nil, expectedRequest, &opts); err != nil && err != io.EOF { - t.Fatalf("Failed to write the request: %v", err) - } - p := make([]byte, http2MaxFrameLen) - if _, err := s.trReader.(*transportReader).Read(p); err != io.EOF { - t.Fatalf("Read got error %v, want %v", err, io.EOF) - } - if !reflect.DeepEqual(s.Status(), encodingTestStatus) { - t.Fatalf("stream with status %v, want %v", s.Status(), encodingTestStatus) - } - ct.Close() - server.stop() -} - -func TestInvalidHeaderField(t *testing.T) { - server, ct := setUp(t, 0, math.MaxUint32, invalidHeaderField) - callHdr := &CallHdr{ - Host: "localhost", - Method: "foo", - } - s, err := ct.NewStream(context.Background(), callHdr) - if err != nil { - return - } - opts := Options{ - Last: true, - Delay: false, - } - if err := ct.Write(s, nil, expectedRequest, &opts); err != nil && err != io.EOF { - t.Fatalf("Failed to write the request: %v", err) - } - p := make([]byte, http2MaxFrameLen) - _, err = s.trReader.(*transportReader).Read(p) - if se, ok := err.(StreamError); !ok || se.Code != codes.FailedPrecondition || !strings.Contains(err.Error(), expectedInvalidHeaderField) { - t.Fatalf("Read got error %v, want error with code %s and contains %q", err, codes.FailedPrecondition, expectedInvalidHeaderField) - } - ct.Close() - server.stop() -} - -func TestStreamContext(t *testing.T) { - expectedStream := &Stream{} - ctx := newContextWithStream(context.Background(), expectedStream) - s, ok := StreamFromContext(ctx) - if !ok || expectedStream != s { - t.Fatalf("GetStreamFromContext(%v) = %v, %t, want: %v, true", ctx, s, ok, expectedStream) - } -} - -func TestIsReservedHeader(t *testing.T) { - tests := []struct { - h string - want bool - }{ - {"", false}, // but should be rejected earlier - {"foo", false}, - {"content-type", true}, - {"grpc-message-type", true}, - {"grpc-encoding", true}, - {"grpc-message", true}, - {"grpc-status", true}, - {"grpc-timeout", true}, - {"te", true}, - } - for _, tt := range tests { - got := isReservedHeader(tt.h) - if got != tt.want { - t.Errorf("isReservedHeader(%q) = %v; want %v", tt.h, got, tt.want) - } - } -} - -func TestContextErr(t *testing.T) { - for _, test := range []struct { - // input - errIn error - // outputs - errOut StreamError - }{ - {context.DeadlineExceeded, StreamError{codes.DeadlineExceeded, context.DeadlineExceeded.Error()}}, - {context.Canceled, StreamError{codes.Canceled, context.Canceled.Error()}}, - } { - err := ContextErr(test.errIn) - if err != test.errOut { - t.Fatalf("ContextErr{%v} = %v \nwant %v", test.errIn, err, test.errOut) - } - } -} - -func max(a, b int32) int32 { - if a > b { - return a - } - return b -} - -type windowSizeConfig struct { - serverStream int32 - serverConn int32 - clientStream int32 - clientConn int32 -} - -func TestAccountCheckWindowSizeWithLargeWindow(t *testing.T) { - wc := windowSizeConfig{ - serverStream: 10 * 1024 * 1024, - serverConn: 12 * 1024 * 1024, - clientStream: 6 * 1024 * 1024, - clientConn: 8 * 1024 * 1024, - } - testAccountCheckWindowSize(t, wc) -} - -func TestAccountCheckWindowSizeWithSmallWindow(t *testing.T) { - wc := windowSizeConfig{ - serverStream: defaultWindowSize, - // Note this is smaller than initialConnWindowSize which is the current default. - serverConn: defaultWindowSize, - clientStream: defaultWindowSize, - clientConn: defaultWindowSize, - } - testAccountCheckWindowSize(t, wc) -} - -func testAccountCheckWindowSize(t *testing.T, wc windowSizeConfig) { - serverConfig := &ServerConfig{ - InitialWindowSize: wc.serverStream, - InitialConnWindowSize: wc.serverConn, - } - connectOptions := ConnectOptions{ - InitialWindowSize: wc.clientStream, - InitialConnWindowSize: wc.clientConn, - } - server, client := setUpWithOptions(t, 0, serverConfig, suspended, connectOptions) - defer server.stop() - defer client.Close() - - // Wait for server conns to be populated with new server transport. - waitWhileTrue(t, func() (bool, error) { - server.mu.Lock() - defer server.mu.Unlock() - if len(server.conns) == 0 { - return true, fmt.Errorf("timed out waiting for server transport to be created") - } - return false, nil - }) - var st *http2Server - server.mu.Lock() - for k := range server.conns { - st = k.(*http2Server) - } - server.mu.Unlock() - ct := client.(*http2Client) - cstream, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Failed to create stream. Err: %v", err) - } - // Wait for server to receive headers. - waitWhileTrue(t, func() (bool, error) { - st.mu.Lock() - defer st.mu.Unlock() - if len(st.activeStreams) == 0 { - return true, fmt.Errorf("timed out waiting for server to receive headers") - } - return false, nil - }) - // Sleeping to make sure the settings are applied in case of negative test. - time.Sleep(time.Second) - - waitWhileTrue(t, func() (bool, error) { - st.fc.mu.Lock() - lim := st.fc.limit - st.fc.mu.Unlock() - if lim != uint32(serverConfig.InitialConnWindowSize) { - return true, fmt.Errorf("Server transport flow control window size: got %v, want %v", lim, serverConfig.InitialConnWindowSize) - } - return false, nil - }) - - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - serverSendQuota, _, err := st.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: st.ctx, - done: nil, - goAway: nil, - }) - if err != nil { - t.Fatalf("Error while acquiring sendQuota on server. Err: %v", err) - } - cancel() - st.sendQuotaPool.add(serverSendQuota) - if serverSendQuota != int(connectOptions.InitialConnWindowSize) { - t.Fatalf("Server send quota(%v) not equal to client's window size(%v) on conn.", serverSendQuota, connectOptions.InitialConnWindowSize) - } - st.mu.Lock() - ssq := st.streamSendQuota - st.mu.Unlock() - if ssq != uint32(connectOptions.InitialWindowSize) { - t.Fatalf("Server stream send quota(%v) not equal to client's window size(%v) on stream.", ssq, connectOptions.InitialWindowSize) - } - ct.fc.mu.Lock() - limit := ct.fc.limit - ct.fc.mu.Unlock() - if limit != uint32(connectOptions.InitialConnWindowSize) { - t.Fatalf("Client transport flow control window size is %v, want %v", limit, connectOptions.InitialConnWindowSize) - } - ctx, cancel = context.WithTimeout(context.Background(), time.Second) - clientSendQuota, _, err := ct.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: ct.ctx, - done: nil, - goAway: nil, - }) - if err != nil { - t.Fatalf("Error while acquiring sendQuota on client. Err: %v", err) - } - cancel() - ct.sendQuotaPool.add(clientSendQuota) - if clientSendQuota != int(serverConfig.InitialConnWindowSize) { - t.Fatalf("Client send quota(%v) not equal to server's window size(%v) on conn.", clientSendQuota, serverConfig.InitialConnWindowSize) - } - ct.mu.Lock() - ssq = ct.streamSendQuota - ct.mu.Unlock() - if ssq != uint32(serverConfig.InitialWindowSize) { - t.Fatalf("Client stream send quota(%v) not equal to server's window size(%v) on stream.", ssq, serverConfig.InitialWindowSize) - } - cstream.fc.mu.Lock() - limit = cstream.fc.limit - cstream.fc.mu.Unlock() - if limit != uint32(connectOptions.InitialWindowSize) { - t.Fatalf("Client stream flow control window size is %v, want %v", limit, connectOptions.InitialWindowSize) - } - var sstream *Stream - st.mu.Lock() - for _, v := range st.activeStreams { - sstream = v - } - st.mu.Unlock() - sstream.fc.mu.Lock() - limit = sstream.fc.limit - sstream.fc.mu.Unlock() - if limit != uint32(serverConfig.InitialWindowSize) { - t.Fatalf("Server stream flow control window size is %v, want %v", limit, serverConfig.InitialWindowSize) - } -} - -// Check accounting on both sides after sending and receiving large messages. -func TestAccountCheckExpandingWindow(t *testing.T) { - server, client := setUp(t, 0, 0, pingpong) - defer server.stop() - defer client.Close() - waitWhileTrue(t, func() (bool, error) { - server.mu.Lock() - defer server.mu.Unlock() - if len(server.conns) == 0 { - return true, fmt.Errorf("timed out while waiting for server transport to be created") - } - return false, nil - }) - var st *http2Server - server.mu.Lock() - for k := range server.conns { - st = k.(*http2Server) - } - server.mu.Unlock() - ct := client.(*http2Client) - cstream, err := client.NewStream(context.Background(), &CallHdr{Flush: true}) - if err != nil { - t.Fatalf("Failed to create stream. Err: %v", err) - } - - msgSize := 65535 * 16 * 2 - msg := make([]byte, msgSize) - buf := make([]byte, msgSize+5) - buf[0] = byte(0) - binary.BigEndian.PutUint32(buf[1:], uint32(msgSize)) - copy(buf[5:], msg) - opts := Options{} - header := make([]byte, 5) - for i := 1; i <= 10; i++ { - if err := ct.Write(cstream, nil, buf, &opts); err != nil { - t.Fatalf("Error on client while writing message: %v", err) - } - if _, err := cstream.Read(header); err != nil { - t.Fatalf("Error on client while reading data frame header: %v", err) - } - sz := binary.BigEndian.Uint32(header[1:]) - recvMsg := make([]byte, int(sz)) - if _, err := cstream.Read(recvMsg); err != nil { - t.Fatalf("Error on client while reading data: %v", err) - } - if len(recvMsg) != len(msg) { - t.Fatalf("Length of message received by client: %v, want: %v", len(recvMsg), len(msg)) - } - } - defer func() { - ct.Write(cstream, nil, nil, &Options{Last: true}) // Close the stream. - if _, err := cstream.Read(header); err != io.EOF { - t.Fatalf("Client expected an EOF from the server. Got: %v", err) - } - }() - var sstream *Stream - st.mu.Lock() - for _, v := range st.activeStreams { - sstream = v - } - st.mu.Unlock() - - waitWhileTrue(t, func() (bool, error) { - // Check that pendingData and delta on flow control windows on both sides are 0. - cstream.fc.mu.Lock() - if cstream.fc.delta != 0 { - cstream.fc.mu.Unlock() - return true, fmt.Errorf("delta on flow control window of client stream is non-zero") - } - if cstream.fc.pendingData != 0 { - cstream.fc.mu.Unlock() - return true, fmt.Errorf("pendingData on flow control window of client stream is non-zero") - } - cstream.fc.mu.Unlock() - sstream.fc.mu.Lock() - if sstream.fc.delta != 0 { - sstream.fc.mu.Unlock() - return true, fmt.Errorf("delta on flow control window of server stream is non-zero") - } - if sstream.fc.pendingData != 0 { - sstream.fc.mu.Unlock() - return true, fmt.Errorf("pendingData on flow control window of sercer stream is non-zero") - } - sstream.fc.mu.Unlock() - ct.fc.mu.Lock() - if ct.fc.delta != 0 { - ct.fc.mu.Unlock() - return true, fmt.Errorf("delta on flow control window of client transport is non-zero") - } - if ct.fc.pendingData != 0 { - ct.fc.mu.Unlock() - return true, fmt.Errorf("pendingData on flow control window of client transport is non-zero") - } - ct.fc.mu.Unlock() - st.fc.mu.Lock() - if st.fc.delta != 0 { - st.fc.mu.Unlock() - return true, fmt.Errorf("delta on flow control window of server transport is non-zero") - } - if st.fc.pendingData != 0 { - st.fc.mu.Unlock() - return true, fmt.Errorf("pendingData on flow control window of server transport is non-zero") - } - st.fc.mu.Unlock() - - // Check flow conrtrol window on client stream is equal to out flow on server stream. - ctx, cancel := context.WithTimeout(context.Background(), time.Second) - serverStreamSendQuota, _, err := sstream.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: context.Background(), - done: nil, - goAway: nil, - }) - cancel() - if err != nil { - return true, fmt.Errorf("error while acquiring server stream send quota. Err: %v", err) - } - sstream.sendQuotaPool.add(serverStreamSendQuota) - cstream.fc.mu.Lock() - clientEst := cstream.fc.limit - cstream.fc.pendingUpdate - cstream.fc.mu.Unlock() - if uint32(serverStreamSendQuota) != clientEst { - return true, fmt.Errorf("server stream outflow: %v, estimated by client: %v", serverStreamSendQuota, clientEst) - } - - // Check flow control window on server stream is equal to out flow on client stream. - ctx, cancel = context.WithTimeout(context.Background(), time.Second) - clientStreamSendQuota, _, err := cstream.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: context.Background(), - done: nil, - goAway: nil, - }) - cancel() - if err != nil { - return true, fmt.Errorf("error while acquiring client stream send quota. Err: %v", err) - } - cstream.sendQuotaPool.add(clientStreamSendQuota) - sstream.fc.mu.Lock() - serverEst := sstream.fc.limit - sstream.fc.pendingUpdate - sstream.fc.mu.Unlock() - if uint32(clientStreamSendQuota) != serverEst { - return true, fmt.Errorf("client stream outflow: %v. estimated by server: %v", clientStreamSendQuota, serverEst) - } - - // Check flow control window on client transport is equal to out flow of server transport. - ctx, cancel = context.WithTimeout(context.Background(), time.Second) - serverTrSendQuota, _, err := st.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: st.ctx, - done: nil, - goAway: nil, - }) - cancel() - if err != nil { - return true, fmt.Errorf("error while acquring server transport send quota. Err: %v", err) - } - st.sendQuotaPool.add(serverTrSendQuota) - ct.fc.mu.Lock() - clientEst = ct.fc.limit - ct.fc.pendingUpdate - ct.fc.mu.Unlock() - if uint32(serverTrSendQuota) != clientEst { - return true, fmt.Errorf("server transport outflow: %v, estimated by client: %v", serverTrSendQuota, clientEst) - } - - // Check flow control window on server transport is equal to out flow of client transport. - ctx, cancel = context.WithTimeout(context.Background(), time.Second) - clientTrSendQuota, _, err := ct.sendQuotaPool.get(math.MaxInt32, waiters{ - ctx: ctx, - tctx: ct.ctx, - done: nil, - goAway: nil, - }) - cancel() - if err != nil { - return true, fmt.Errorf("error while acquiring client transport send quota. Err: %v", err) - } - ct.sendQuotaPool.add(clientTrSendQuota) - st.fc.mu.Lock() - serverEst = st.fc.limit - st.fc.pendingUpdate - st.fc.mu.Unlock() - if uint32(clientTrSendQuota) != serverEst { - return true, fmt.Errorf("client transport outflow: %v, estimated by client: %v", clientTrSendQuota, serverEst) - } - - return false, nil - }) - -} - -func waitWhileTrue(t *testing.T, condition func() (bool, error)) { - var ( - wait bool - err error - ) - timer := time.NewTimer(time.Second * 5) - for { - wait, err = condition() - if wait { - select { - case <-timer.C: - t.Fatalf(err.Error()) - default: - time.Sleep(50 * time.Millisecond) - continue - } - } - if !timer.Stop() { - <-timer.C - } - break - } -} - -// A function of type writeHeaders writes out -// http status with the given stream ID using the given framer. -type writeHeaders func(*http2.Framer, uint32, int) error - -func writeOneHeader(framer *http2.Framer, sid uint32, httpStatus int) error { - var buf bytes.Buffer - henc := hpack.NewEncoder(&buf) - henc.WriteField(hpack.HeaderField{Name: ":status", Value: fmt.Sprint(httpStatus)}) - return framer.WriteHeaders(http2.HeadersFrameParam{ - StreamID: sid, - BlockFragment: buf.Bytes(), - EndStream: true, - EndHeaders: true, - }) -} - -func writeTwoHeaders(framer *http2.Framer, sid uint32, httpStatus int) error { - var buf bytes.Buffer - henc := hpack.NewEncoder(&buf) - henc.WriteField(hpack.HeaderField{ - Name: ":status", - Value: fmt.Sprint(http.StatusOK), - }) - if err := framer.WriteHeaders(http2.HeadersFrameParam{ - StreamID: sid, - BlockFragment: buf.Bytes(), - EndHeaders: true, - }); err != nil { - return err - } - buf.Reset() - henc.WriteField(hpack.HeaderField{ - Name: ":status", - Value: fmt.Sprint(httpStatus), - }) - return framer.WriteHeaders(http2.HeadersFrameParam{ - StreamID: sid, - BlockFragment: buf.Bytes(), - EndStream: true, - EndHeaders: true, - }) -} - -type httpServer struct { - conn net.Conn - httpStatus int - wh writeHeaders -} - -func (s *httpServer) start(t *testing.T, lis net.Listener) { - // Launch an HTTP server to send back header with httpStatus. - go func() { - var err error - s.conn, err = lis.Accept() - if err != nil { - t.Errorf("Error accepting connection: %v", err) - return - } - defer s.conn.Close() - // Read preface sent by client. - if _, err = io.ReadFull(s.conn, make([]byte, len(http2.ClientPreface))); err != nil { - t.Errorf("Error at server-side while reading preface from cleint. Err: %v", err) - return - } - reader := bufio.NewReaderSize(s.conn, defaultWriteBufSize) - writer := bufio.NewWriterSize(s.conn, defaultReadBufSize) - framer := http2.NewFramer(writer, reader) - if err = framer.WriteSettingsAck(); err != nil { - t.Errorf("Error at server-side while sending Settings ack. Err: %v", err) - return - } - var sid uint32 - // Read frames until a header is received. - for { - frame, err := framer.ReadFrame() - if err != nil { - t.Errorf("Error at server-side while reading frame. Err: %v", err) - return - } - if hframe, ok := frame.(*http2.HeadersFrame); ok { - sid = hframe.Header().StreamID - break - } - } - if err = s.wh(framer, sid, s.httpStatus); err != nil { - t.Errorf("Error at server-side while writing headers. Err: %v", err) - return - } - writer.Flush() - }() -} - -func (s *httpServer) cleanUp() { - if s.conn != nil { - s.conn.Close() - } -} - -func setUpHTTPStatusTest(t *testing.T, httpStatus int, wh writeHeaders) (stream *Stream, cleanUp func()) { - var ( - err error - lis net.Listener - server *httpServer - client ClientTransport - ) - cleanUp = func() { - if lis != nil { - lis.Close() - } - if server != nil { - server.cleanUp() - } - if client != nil { - client.Close() - } - } - defer func() { - if err != nil { - cleanUp() - } - }() - lis, err = net.Listen("tcp", "localhost:0") - if err != nil { - t.Fatalf("Failed to listen. Err: %v", err) - } - server = &httpServer{ - httpStatus: httpStatus, - wh: wh, - } - server.start(t, lis) - connectCtx, cancel := context.WithDeadline(context.Background(), time.Now().Add(2*time.Second)) - client, err = newHTTP2Client(connectCtx, context.Background(), TargetInfo{Addr: lis.Addr().String()}, ConnectOptions{}, func() {}) - if err != nil { - cancel() // Do not cancel in success path. - t.Fatalf("Error creating client. Err: %v", err) - } - stream, err = client.NewStream(context.Background(), &CallHdr{Method: "bogus/method", Flush: true}) - if err != nil { - t.Fatalf("Error creating stream at client-side. Err: %v", err) - } - return -} - -func TestHTTPToGRPCStatusMapping(t *testing.T) { - for k := range httpStatusConvTab { - testHTTPToGRPCStatusMapping(t, k, writeOneHeader) - } -} - -func testHTTPToGRPCStatusMapping(t *testing.T, httpStatus int, wh writeHeaders) { - stream, cleanUp := setUpHTTPStatusTest(t, httpStatus, wh) - defer cleanUp() - want := httpStatusConvTab[httpStatus] - buf := make([]byte, 8) - _, err := stream.Read(buf) - if err == nil { - t.Fatalf("Stream.Read(_) unexpectedly returned no error. Expected stream error with code %v", want) - } - serr, ok := err.(StreamError) - if !ok { - t.Fatalf("err.(Type) = %T, want StreamError", err) - } - if want != serr.Code { - t.Fatalf("Want error code: %v, got: %v", want, serr.Code) - } -} - -func TestHTTPStatusOKAndMissingGRPCStatus(t *testing.T) { - stream, cleanUp := setUpHTTPStatusTest(t, http.StatusOK, writeOneHeader) - defer cleanUp() - buf := make([]byte, 8) - _, err := stream.Read(buf) - if err != io.EOF { - t.Fatalf("stream.Read(_) = _, %v, want _, io.EOF", err) - } - want := codes.Unknown - stream.mu.Lock() - defer stream.mu.Unlock() - if stream.status.Code() != want { - t.Fatalf("Status code of stream: %v, want: %v", stream.status.Code(), want) - } -} - -func TestHTTPStatusNottOKAndMissingGRPCStatusInSecondHeader(t *testing.T) { - testHTTPToGRPCStatusMapping(t, http.StatusUnauthorized, writeTwoHeaders) -} - -// If any error occurs on a call to Stream.Read, future calls -// should continue to return that same error. -func TestReadGivesSameErrorAfterAnyErrorOccurs(t *testing.T) { - testRecvBuffer := newRecvBuffer() - s := &Stream{ - ctx: context.Background(), - goAway: make(chan struct{}), - buf: testRecvBuffer, - requestRead: func(int) {}, - } - s.trReader = &transportReader{ - reader: &recvBufferReader{ - ctx: s.ctx, - goAway: s.goAway, - recv: s.buf, - }, - windowHandler: func(int) {}, - } - testData := make([]byte, 1) - testData[0] = 5 - testErr := errors.New("test error") - s.write(recvMsg{data: testData, err: testErr}) - - inBuf := make([]byte, 1) - actualCount, actualErr := s.Read(inBuf) - if actualCount != 0 { - t.Errorf("actualCount, _ := s.Read(_) differs; want 0; got %v", actualCount) - } - if actualErr.Error() != testErr.Error() { - t.Errorf("_ , actualErr := s.Read(_) differs; want actualErr.Error() to be %v; got %v", testErr.Error(), actualErr.Error()) - } - - s.write(recvMsg{data: testData, err: nil}) - s.write(recvMsg{data: testData, err: errors.New("different error from first")}) - - for i := 0; i < 2; i++ { - inBuf := make([]byte, 1) - actualCount, actualErr := s.Read(inBuf) - if actualCount != 0 { - t.Errorf("actualCount, _ := s.Read(_) differs; want %v; got %v", 0, actualCount) - } - if actualErr.Error() != testErr.Error() { - t.Errorf("_ , actualErr := s.Read(_) differs; want actualErr.Error() to be %v; got %v", testErr.Error(), actualErr.Error()) - } - } -} - -func TestPingPong1B(t *testing.T) { - runPingPongTest(t, 1) -} - -func TestPingPong1KB(t *testing.T) { - runPingPongTest(t, 1024) -} - -func TestPingPong64KB(t *testing.T) { - runPingPongTest(t, 65536) -} - -func TestPingPong1MB(t *testing.T) { - runPingPongTest(t, 1048576) -} - -//This is a stress-test of flow control logic. -func runPingPongTest(t *testing.T, msgSize int) { - server, client := setUp(t, 0, 0, pingpong) - defer server.stop() - defer client.Close() - waitWhileTrue(t, func() (bool, error) { - server.mu.Lock() - defer server.mu.Unlock() - if len(server.conns) == 0 { - return true, fmt.Errorf("timed out while waiting for server transport to be created") - } - return false, nil - }) - ct := client.(*http2Client) - stream, err := client.NewStream(context.Background(), &CallHdr{}) - if err != nil { - t.Fatalf("Failed to create stream. Err: %v", err) - } - msg := make([]byte, msgSize) - outgoingHeader := make([]byte, 5) - outgoingHeader[0] = byte(0) - binary.BigEndian.PutUint32(outgoingHeader[1:], uint32(msgSize)) - opts := &Options{} - incomingHeader := make([]byte, 5) - done := make(chan struct{}) - go func() { - timer := time.NewTimer(time.Second * 5) - <-timer.C - close(done) - }() - for { - select { - case <-done: - ct.Write(stream, nil, nil, &Options{Last: true}) - if _, err := stream.Read(incomingHeader); err != io.EOF { - t.Fatalf("Client expected EOF from the server. Got: %v", err) - } - return - default: - if err := ct.Write(stream, outgoingHeader, msg, opts); err != nil { - t.Fatalf("Error on client while writing message. Err: %v", err) - } - if _, err := stream.Read(incomingHeader); err != nil { - t.Fatalf("Error on client while reading data header. Err: %v", err) - } - sz := binary.BigEndian.Uint32(incomingHeader[1:]) - recvMsg := make([]byte, int(sz)) - if _, err := stream.Read(recvMsg); err != nil { - t.Fatalf("Error on client while reading data. Err: %v", err) - } - } - } -} diff --git a/vendor/gopkg.in/xmlpath.v2/LICENSE b/vendor/gopkg.in/xmlpath.v2/LICENSE deleted file mode 100644 index 4ccd784..0000000 --- a/vendor/gopkg.in/xmlpath.v2/LICENSE +++ /dev/null @@ -1,187 +0,0 @@ -Copyright (c) 2013-2014 Canonical Inc. - -This software is licensed under the LGPLv3, included below. - -As a special exception to the GNU Lesser General Public License version 3 -("LGPL3"), the copyright holders of this Library give you permission to -convey to a third party a Combined Work that links statically or dynamically -to this Library without providing any Minimal Corresponding Source or -Minimal Application Code as set out in 4d or providing the installation -information set out in section 4e, provided that you comply with the other -provisions of LGPL3 and provided that you meet, for the Application the -terms and conditions of the license(s) which apply to the Application. - -Except as stated in this special exception, the provisions of LGPL3 will -continue to comply in full to this Library. If you modify this Library, you -may apply this exception to your version of this Library, but you are not -obliged to do so. If you do not wish to do so, delete this exception -statement from your version. This exception does not (and cannot) modify any -license terms which apply to the Application, with which you must still -comply. - - - GNU LESSER GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - - This version of the GNU Lesser General Public License incorporates -the terms and conditions of version 3 of the GNU General Public -License, supplemented by the additional permissions listed below. - - 0. Additional Definitions. - - As used herein, "this License" refers to version 3 of the GNU Lesser -General Public License, and the "GNU GPL" refers to version 3 of the GNU -General Public License. - - "The Library" refers to a covered work governed by this License, -other than an Application or a Combined Work as defined below. - - An "Application" is any work that makes use of an interface provided -by the Library, but which is not otherwise based on the Library. -Defining a subclass of a class defined by the Library is deemed a mode -of using an interface provided by the Library. - - A "Combined Work" is a work produced by combining or linking an -Application with the Library. The particular version of the Library -with which the Combined Work was made is also called the "Linked -Version". - - The "Minimal Corresponding Source" for a Combined Work means the -Corresponding Source for the Combined Work, excluding any source code -for portions of the Combined Work that, considered in isolation, are -based on the Application, and not on the Linked Version. - - The "Corresponding Application Code" for a Combined Work means the -object code and/or source code for the Application, including any data -and utility programs needed for reproducing the Combined Work from the -Application, but excluding the System Libraries of the Combined Work. - - 1. Exception to Section 3 of the GNU GPL. - - You may convey a covered work under sections 3 and 4 of this License -without being bound by section 3 of the GNU GPL. - - 2. Conveying Modified Versions. - - If you modify a copy of the Library, and, in your modifications, a -facility refers to a function or data to be supplied by an Application -that uses the facility (other than as an argument passed when the -facility is invoked), then you may convey a copy of the modified -version: - - a) under this License, provided that you make a good faith effort to - ensure that, in the event an Application does not supply the - function or data, the facility still operates, and performs - whatever part of its purpose remains meaningful, or - - b) under the GNU GPL, with none of the additional permissions of - this License applicable to that copy. - - 3. Object Code Incorporating Material from Library Header Files. - - The object code form of an Application may incorporate material from -a header file that is part of the Library. You may convey such object -code under terms of your choice, provided that, if the incorporated -material is not limited to numerical parameters, data structure -layouts and accessors, or small macros, inline functions and templates -(ten or fewer lines in length), you do both of the following: - - a) Give prominent notice with each copy of the object code that the - Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the object code with a copy of the GNU GPL and this license - document. - - 4. Combined Works. - - You may convey a Combined Work under terms of your choice that, -taken together, effectively do not restrict modification of the -portions of the Library contained in the Combined Work and reverse -engineering for debugging such modifications, if you also do each of -the following: - - a) Give prominent notice with each copy of the Combined Work that - the Library is used in it and that the Library and its use are - covered by this License. - - b) Accompany the Combined Work with a copy of the GNU GPL and this license - document. - - c) For a Combined Work that displays copyright notices during - execution, include the copyright notice for the Library among - these notices, as well as a reference directing the user to the - copies of the GNU GPL and this license document. - - d) Do one of the following: - - 0) Convey the Minimal Corresponding Source under the terms of this - License, and the Corresponding Application Code in a form - suitable for, and under terms that permit, the user to - recombine or relink the Application with a modified version of - the Linked Version to produce a modified Combined Work, in the - manner specified by section 6 of the GNU GPL for conveying - Corresponding Source. - - 1) Use a suitable shared library mechanism for linking with the - Library. A suitable mechanism is one that (a) uses at run time - a copy of the Library already present on the user's computer - system, and (b) will operate properly with a modified version - of the Library that is interface-compatible with the Linked - Version. - - e) Provide Installation Information, but only if you would otherwise - be required to provide such information under section 6 of the - GNU GPL, and only to the extent that such information is - necessary to install and execute a modified version of the - Combined Work produced by recombining or relinking the - Application with a modified version of the Linked Version. (If - you use option 4d0, the Installation Information must accompany - the Minimal Corresponding Source and Corresponding Application - Code. If you use option 4d1, you must provide the Installation - Information in the manner specified by section 6 of the GNU GPL - for conveying Corresponding Source.) - - 5. Combined Libraries. - - You may place library facilities that are a work based on the -Library side by side in a single library together with other library -facilities that are not Applications and are not covered by this -License, and convey such a combined library under terms of your -choice, if you do both of the following: - - a) Accompany the combined library with a copy of the same work based - on the Library, uncombined with any other library facilities, - conveyed under the terms of this License. - - b) Give prominent notice with the combined library that part of it - is a work based on the Library, and explaining where to find the - accompanying uncombined form of the same work. - - 6. Revised Versions of the GNU Lesser General Public License. - - The Free Software Foundation may publish revised and/or new versions -of the GNU Lesser General Public License from time to time. Such new -versions will be similar in spirit to the present version, but may -differ in detail to address new problems or concerns. - - Each version is given a distinguishing version number. If the -Library as you received it specifies that a certain numbered version -of the GNU Lesser General Public License "or any later version" -applies to it, you have the option of following the terms and -conditions either of that published version or of any later version -published by the Free Software Foundation. If the Library as you -received it does not specify a version number of the GNU Lesser -General Public License, you may choose any version of the GNU Lesser -General Public License ever published by the Free Software Foundation. - - If the Library as you received it specifies that a proxy can decide -whether future versions of the GNU Lesser General Public License shall -apply, that proxy's public statement of acceptance of any version is -permanent authorization for you to choose that version for the -Library. diff --git a/vendor/gopkg.in/xmlpath.v2/README.md b/vendor/gopkg.in/xmlpath.v2/README.md deleted file mode 100644 index 4d10f69..0000000 --- a/vendor/gopkg.in/xmlpath.v2/README.md +++ /dev/null @@ -1,4 +0,0 @@ -Installation and usage ----------------------- - -See [gopkg.in/xmlpath.v2](https://gopkg.in/xmlpath.v2) for documentation and usage details. diff --git a/vendor/gopkg.in/xmlpath.v2/all_test.go b/vendor/gopkg.in/xmlpath.v2/all_test.go deleted file mode 100644 index dd8ae18..0000000 --- a/vendor/gopkg.in/xmlpath.v2/all_test.go +++ /dev/null @@ -1,506 +0,0 @@ -package xmlpath_test - -import ( - "bytes" - "encoding/xml" - "testing" - - . "gopkg.in/check.v1" - "gopkg.in/xmlpath.v2" - "strings" -) - -func Test(t *testing.T) { - TestingT(t) -} - -var _ = Suite(&BasicSuite{}) - -type BasicSuite struct{} - -var trivialXml = []byte(`abcdefg`) - -func (s *BasicSuite) TestRootText(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(trivialXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/") - result, ok := path.String(node) - c.Assert(ok, Equals, true) - c.Assert(result, Equals, "abcdefg") -} - -var htmlTable = []struct { - html string - path string - result interface{} -}{ - {"
  • a
  • b", "/html/body/li", "a"}, - {"
  • a
  • b", "/html/body/li", "a"}, - {"<a>", "/html/body", ""}, - {"", "/html/head/script", "if(1<2||2>1){}"}, - {"\ntext", "/html/body", "text"}, -} - -func (s *BasicSuite) TestHTML(c *C) { - for _, test := range htmlTable { - c.Logf("Running test: %v", test) - node, err := xmlpath.ParseHTML(bytes.NewBuffer([]byte(test.html))) - c.Assert(err, IsNil) - path, err := xmlpath.Compile(test.path) - c.Assert(err, IsNil) - result, ok := path.String(node) - c.Assert(ok, Equals, true) - c.Assert(result, Equals, test.result) - } -} - -func (s *BasicSuite) TestLibraryTable(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(libraryXml)) - c.Assert(err, IsNil) - for _, test := range libraryTable { - cmt := Commentf("xml path: %s", test.path) - path, err := xmlpath.Compile(test.path) - if want, ok := test.result.(cerror); ok { - if !strings.Contains(err.Error(), string(want)) { - c.Fatalf("error should contain `%s` but got `%s`", want, err.Error()) - } - c.Assert(path, IsNil, cmt) - continue - } - c.Assert(err, IsNil) - switch want := test.result.(type) { - case string: - got, ok := path.String(node) - c.Assert(ok, Equals, true, cmt) - c.Assert(got, Equals, want, cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - iter := path.Iter(node) - iter.Next() - node := iter.Node() - c.Assert(node.String(), Equals, want, cmt) - c.Assert(string(node.Bytes()), Equals, want, cmt) - case []string: - var alls []string - var allb []string - iter := path.Iter(node) - for iter.Next() { - alls = append(alls, iter.Node().String()) - allb = append(allb, string(iter.Node().Bytes())) - } - c.Assert(alls, DeepEquals, want, cmt) - c.Assert(allb, DeepEquals, want, cmt) - s, sok := path.String(node) - b, bok := path.Bytes(node) - if len(want) == 0 { - c.Assert(sok, Equals, false, cmt) - c.Assert(bok, Equals, false, cmt) - c.Assert(s, Equals, "") - c.Assert(b, IsNil) - } else { - c.Assert(sok, Equals, true, cmt) - c.Assert(bok, Equals, true, cmt) - c.Assert(s, Equals, alls[0], cmt) - c.Assert(string(b), Equals, alls[0], cmt) - c.Assert(path.Exists(node), Equals, true, cmt) - } - case exists: - wantb := bool(want) - ok := path.Exists(node) - c.Assert(ok, Equals, wantb, cmt) - _, ok = path.String(node) - c.Assert(ok, Equals, wantb, cmt) - } - } -} - -type cerror string -type exists bool - -var libraryTable = []struct { - path string - result interface{} -}{ - // These are the examples in the package documentation: - {"/library/book/isbn", "0836217462"}, - {"library/*/isbn", "0836217462"}, - {"/library/book/../book/./isbn", "0836217462"}, - {"/library/book/character[2]/name", "Snoopy"}, - {"/library/book/character[born='1950-10-04']/name", "Snoopy"}, - {"/library/book//node()[@id='PP']/name", "Peppermint Patty"}, - {"//book[author/@id='CMS']/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/preceding::comment()", " Great book. "}, - {"//*[contains(born,'1922')]/name", "Charles M Schulz"}, - {"//*[@id='PP' or @id='Snoopy']/born", []string{"1966-08-22", "1950-10-04"}}, - - // A few simple - {"/library/book/isbn", exists(true)}, - {"/library/isbn", exists(false)}, - {"/library/book/isbn/bad", exists(false)}, - {"/library/book/bad", exists(false)}, - {"/library/bad/isbn", exists(false)}, - {"/bad/book/isbn", exists(false)}, - - // Simple paths. - {"/library/book/isbn", "0836217462"}, - {"/library/book/author/name", "Charles M Schulz"}, - {"/library/book/author/born", "1922-11-26"}, - {"/library/book/character/name", "Peppermint Patty"}, - {"/library/book/character/qualification", "bold, brash and tomboyish"}, - - // Unrooted path with root node as context. - {"library/book/isbn", "0836217462"}, - - // Multiple entries from simple paths. - {"/library/book/isbn", []string{"0836217462", "0883556316"}}, - {"/library/book/character/name", []string{"Peppermint Patty", "Snoopy", "Schroeder", "Lucy", "Barney Google", "Spark Plug", "Snuffy Smith"}}, - - // Handling of wildcards. - {"/library/book/author/*", []string{"Charles M Schulz", "1922-11-26", "2000-02-12", "Charles M Schulz", "1922-11-26", "2000-02-12"}}, - - // Unsupported axis and note test. - {"/foo()", cerror(`compiling xml path "/foo()":5: unsupported expression: foo()`)}, - {"/node(", cerror(`compiling xml path "/node(":6: node() missing ')'`)}, - {"/foo::node()", cerror(`compiling xml path "/foo::node()":6: unsupported axis: "foo"`)}, - - // The attribute axis. - {"/library/book/title/attribute::lang", "en"}, - {"/library/book/title/@lang", "en"}, - {"/library/book/@available/parent::node()/@id", "b0836217462"}, - {"/library/book/attribute::*", []string{"b0836217462", "true", "b0883556316", "true"}}, - {"/library/book/attribute::text()", cerror(`: text() cannot succeed on axis "attribute"`)}, - - // The self axis. - {"/library/book/isbn/./self::node()", "0836217462"}, - - // The descendant axis. - {"/library/book/isbn/descendant::isbn", exists(false)}, - {"/library/descendant::isbn", []string{"0836217462", "0883556316"}}, - {"/descendant::*/isbn", []string{"0836217462", "0883556316"}}, - {"/descendant::isbn", []string{"0836217462", "0883556316"}}, - - // The descendant-or-self axis. - {"/library/book/isbn/descendant-or-self::isbn", "0836217462"}, - {"/library//isbn", []string{"0836217462", "0883556316"}}, - {"//isbn", []string{"0836217462", "0883556316"}}, - {"/descendant-or-self::node()/child::book/child::*", "0836217462"}, - - // The parent axis. - {"/library/book/isbn/../isbn/parent::node()//title", "Being a Dog Is a Full-Time Job"}, - - // The ancestor axis. - {"/library/book/isbn/ancestor::book/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/ancestor::book/title", exists(false)}, - - // The ancestor-or-self axis. - {"/library/book/isbn/ancestor-or-self::book/title", "Being a Dog Is a Full-Time Job"}, - {"/library/book/ancestor-or-self::book/title", "Being a Dog Is a Full-Time Job"}, - - // The following axis. - // The first author name must not be included, as it's within the context - // node (author) rather than following it. These queries exercise de-duping - // of nodes, since the following axis runs to the end multiple times. - {"/library/book/author/following::name", []string{"Peppermint Patty", "Snoopy", "Schroeder", "Lucy", "Charles M Schulz", "Barney Google", "Spark Plug", "Snuffy Smith"}}, - {"//following::book/author/name", []string{"Charles M Schulz", "Charles M Schulz"}}, - - // The following-sibling axis. - {"/library/book/quote/following-sibling::node()/name", []string{"Charles M Schulz", "Peppermint Patty", "Snoopy", "Schroeder", "Lucy"}}, - - // The preceding axis. - {"/library/book/author/born/preceding::name", []string{"Charles M Schulz", "Charles M Schulz", "Lucy", "Schroeder", "Snoopy", "Peppermint Patty"}}, - {"/library/book/author/born/preceding::author/name", []string{"Charles M Schulz"}}, - {"/library/book/author/born/preceding::library", exists(false)}, - - // The preceding-sibling axis. - {"/library/book/author/born/preceding-sibling::name", []string{"Charles M Schulz", "Charles M Schulz"}}, - {"/library/book/author/born/preceding::author/name", []string{"Charles M Schulz"}}, - - // Comments. - {"/library/comment()", []string{" Great book. ", " Another great book. "}}, - {"//self::comment()", []string{" Great book. ", " Another great book. "}}, - {`comment("")`, cerror(`: comment() has no arguments`)}, - - // Processing instructions. - {`/library/book/author/processing-instruction()`, `"go rocks"`}, - {`/library/book/author/processing-instruction("echo")`, `"go rocks"`}, - {`/library//processing-instruction("echo")`, `"go rocks"`}, - {`/library/book/author/processing-instruction("foo")`, exists(false)}, - {`/library/book/author/processing-instruction(")`, cerror(`: missing '"'`)}, - - // Predicates. - {"library/book[@id='b0883556316']/isbn", []string{"0883556316"}}, - {"library/book[ @id = 'b0883556316' ]/isbn", []string{"0883556316"}}, - {"library/book[isbn='0836217462']/character[born='1950-10-04']/name", []string{"Snoopy"}}, - {"library/book[quote]/@id", []string{"b0836217462"}}, - {"library/book[./character/born='1922-07-17']/@id", []string{"b0883556316"}}, - {"library/book[2]/isbn", []string{"0883556316"}}, - {"library/book[0]/isbn", cerror(": positions start at 1")}, - {"library/book[-1]/isbn", cerror(": positions must be positive")}, - {"//title[contains(.,'ney Google and')]", "Barney Google and Snuffy Smith"}, - {"//@id[contains(.,'0836')]", "b0836217462"}, - {"//*[contains(born,'1922')]/name", "Charles M Schulz"}, - {"library/book[not(@id)]", exists(false)}, - {"library/book[not(@foo) and @id='b0883556316']/isbn", []string{"0883556316"}}, - - // Multiple predicates. - {"library/book/character[@id='Snoopy' and ./born='1950-10-04']/born", []string{"1950-10-04"}}, - {"library/book/character[@id='Snoopy' or @id='Lucy']/born", []string{"1950-10-04", "1952-03-03"}}, - {"library/book/character[@id='Snoopy' and ./born='1950-10-04' or @id='Lucy' and ./born='1952-03-03']/born", []string{"1950-10-04", "1952-03-03"}}, - {"library/book/character[@id='Snoopy' or @id='Lucy' and @id='NOPE']/born", []string{"1950-10-04"}}, - {"library/book/character[@id='Snoopy' and @id='NOPE' or @id='Lucy']/born", []string{"1952-03-03"}}, - {"library/book/character[(@id='Snoopy' or @id='Lucy') and (./born='1950-10-04' or ./born='1952-03-03')]/born", []string{"1950-10-04", "1952-03-03"}}, - - // Bogus expressions. - {"/foo)", cerror(`compiling xml path "/foo)":4: unexpected ')'`)}, - {"/foo[", cerror(`compiling xml path "/foo[":5: missing name`)}, - {"/foo[@id)]", cerror(`compiling xml path "/foo[@id)]":9: unexpected ')'`)}, - {"/foo[(@id]", cerror(`compiling xml path "/foo[(@id]":9: expected ')'`)}, - - // Whitespace handling. - {" / descendant-or-self :: node() // child :: book / child :: * [ contains( . , '083' ) ] ", "0836217462"}, -} - -var libraryXml = []byte(` - - - - - 0836217462 - Being a Dog Is a Full-Time Job - I'd dog paddle the deepest ocean. - - - Charles M Schulz - 1922-11-26 - 2000-02-12 - - - Peppermint Patty - 1966-08-22 - bold, brash and tomboyish - - - Snoopy - 1950-10-04 - extroverted beagle - - - Schroeder - 1951-05-30 - brought classical music to the Peanuts strip - - - Lucy - 1952-03-03 - bossy, crabby and selfish - - - - - 0883556316 - Barney <i>Google</i> and Snuffy Smith - - Charles M Schulz - 1922-11-26 - 2000-02-12 - - - Barney Google - 1919-01-01 - goggle-eyed, moustached, gloved and top-hatted, bulbous-nosed, cigar-chomping shrimp - - - Spark Plug - 1922-07-17 - brown-eyed, bow-legged nag, seldom races, patched blanket - - - Snuffy Smith - 1934-01-01 - volatile and diminutive moonshiner, ornery little cuss, sawed-off and shiftless - - - -`) - -func (s *BasicSuite) BenchmarkParse(c *C) { - for i := 0; i < c.N; i++ { - _, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - } -} - -func (s *BasicSuite) BenchmarkSimplePathCompile(c *C) { - var err error - c.ResetTimer() - for i := 0; i < c.N; i++ { - _, err = xmlpath.Compile("/DescribeInstancesResponse/reservationSet/item/groupSet/item/groupId") - } - c.StopTimer() - c.Assert(err, IsNil) -} - -func (s *BasicSuite) BenchmarkSimplePathString(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/DescribeInstancesResponse/reservationSet/item/instancesSet/item/instanceType") - var str string - c.ResetTimer() - for i := 0; i < c.N; i++ { - str, _ = path.String(node) - } - c.StopTimer() - c.Assert(str, Equals, "m1.small") -} - -func (s *BasicSuite) BenchmarkSimplePathStringUnmarshal(c *C) { - // For a vague comparison. - var result struct { - Str string `xml:"reservationSet>item>instancesSet>item>instanceType"` - } - for i := 0; i < c.N; i++ { - xml.Unmarshal(instancesXml, &result) - } - c.StopTimer() - c.Assert(result.Str, Equals, "m1.large") -} - -func (s *BasicSuite) BenchmarkSimplePathExists(c *C) { - node, err := xmlpath.Parse(bytes.NewBuffer(instancesXml)) - c.Assert(err, IsNil) - path := xmlpath.MustCompile("/DescribeInstancesResponse/reservationSet/item/instancesSet/item/instanceType") - var exists bool - c.ResetTimer() - for i := 0; i < c.N; i++ { - exists = path.Exists(node) - } - c.StopTimer() - c.Assert(exists, Equals, true) -} - -var instancesXml = []byte(` - - 98e3c9a4-848c-4d6d-8e8a-b1bdEXAMPLE - - - r-b27e30d9 - 999988887777 - - - sg-67ad940e - default - - - - - i-c5cd56af - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-56-34.compute-1.internal - ec2-174-129-165-232.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.small - 2010-08-17T01:15:18.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.85.190 - 174.129.165.232 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a082c1c9 - attached - 2010-08-17T01:15:21.000Z - false - - - - spot - sir-7a688402 - paravirtual - - - xen - - - 854251627541 - - - r-b67e30dd - 999988887777 - - - sg-67ad940e - default - - - - - i-d9cd56b3 - ami-1a2b3c4d - - 16 - running - - domU-12-31-39-10-54-E5.compute-1.internal - ec2-184-73-58-78.compute-1.amazonaws.com - - GSG_Keypair - 0 - - m1.large - 2010-08-17T01:15:19.000Z - - us-east-1b - - - aki-94c527fd - ari-96c527ff - - disabled - - 10.198.87.19 - 184.73.58.78 - i386 - ebs - /dev/sda1 - - - /dev/sda1 - - vol-a282c1cb - attached - 2010-08-17T01:15:23.000Z - false - - - - spot - sir-55a3aa02 - paravirtual - - - xen - - - 854251627541 - - - -`) diff --git a/vendor/gopkg.in/xmlpath.v2/doc.go b/vendor/gopkg.in/xmlpath.v2/doc.go deleted file mode 100644 index e81d737..0000000 --- a/vendor/gopkg.in/xmlpath.v2/doc.go +++ /dev/null @@ -1,75 +0,0 @@ -// Package xmlpath implements a strict subset of the XPath specification for the Go language. -// -// The XPath specification is available at: -// -// http://www.w3.org/TR/xpath -// -// Path expressions supported by this package are in the following format, -// with all components being optional: -// -// /axis-name::node-test[predicate]/axis-name::node-test[predicate] -// -// At the moment, xmlpath is compatible with the XPath specification -// to the following extent: -// -// - All axes are supported ("child", "following-sibling", etc) -// - All abbreviated forms are supported (".", "//", etc) -// - All node types except for namespace are supported -// - Predicates may be [N], [path], [not(path)], [path=literal] or [contains(path, literal)] -// - Predicates may be joined with "or", "and", and parenthesis -// - Richer expressions and namespaces are not supported -// -// For example, assuming the following document: -// -// -// -// -// 0836217462 -// Being a Dog Is a Full-Time Job -// I'd dog paddle the deepest ocean. -// -// -// Charles M Schulz -// 1922-11-26 -// 2000-02-12 -// -// -// Peppermint Patty -// 1966-08-22 -// bold, brash and tomboyish -// -// -// Snoopy -// 1950-10-04 -// extroverted beagle -// -// -// -// -// The following examples are valid path expressions, and the first -// match has the indicated value: -// -// /library/book/isbn => "0836217462" -// library/*/isbn => "0836217462" -// /library/book/../book/./isbn => "0836217462" -// /library/book/character[2]/name => "Snoopy" -// /library/book/character[born='1950-10-04']/name => "Snoopy" -// /library/book//node()[@id='PP']/name => "Peppermint Patty" -// //book[author/@id='CMS']/title => "Being a Dog Is a Full-Time Job", -// /library/book/preceding::comment() => " Great book. " -// //*[contains(born,'1922')]/name => "Charles M Schulz" -// //*[@id='PP' or @id='Snoopy']/born => {"1966-08-22", "1950-10-04"} -// -// To run an expression, compile it, and then apply the compiled path to any -// number of context nodes, from one or more parsed xml documents: -// -// path := xmlpath.MustCompile("/library/book/isbn") -// root, err := xmlpath.Parse(file) -// if err != nil { -// log.Fatal(err) -// } -// if value, ok := path.String(root); ok { -// fmt.Println("Found:", value) -// } -// -package xmlpath diff --git a/vendor/gopkg.in/xmlpath.v2/parser.go b/vendor/gopkg.in/xmlpath.v2/parser.go deleted file mode 100644 index 64267aa..0000000 --- a/vendor/gopkg.in/xmlpath.v2/parser.go +++ /dev/null @@ -1,396 +0,0 @@ -package xmlpath - -import ( - "golang.org/x/net/html" - "encoding/xml" - "io" - "strings" -) - -// Node is an item in an xml tree that was compiled to -// be processed via xml paths. A node may represent: -// -// - An element in the xml document () -// - An attribute of an element in the xml document (href="...") -// - A comment in the xml document () -// - A processing instruction in the xml document () -// - Some text within the xml document -// -type Node struct { - kind nodeKind - name xml.Name - attr string - text []byte - - nodes []Node - pos int - end int - - up *Node - down []*Node -} - -type nodeKind int - -const ( - anyNode nodeKind = iota - startNode - endNode - attrNode - textNode - commentNode - procInstNode -) - -// String returns the string value of node. -// -// The string value of a node is: -// -// - For element nodes, the concatenation of all text nodes within the element. -// - For text nodes, the text itself. -// - For attribute nodes, the attribute value. -// - For comment nodes, the text within the comment delimiters. -// - For processing instruction nodes, the content of the instruction. -// -func (node *Node) String() string { - if node.kind == attrNode { - return node.attr - } - return string(node.Bytes()) -} - -// Bytes returns the string value of node as a byte slice. -// See Node.String for a description of what the string value of a node is. -func (node *Node) Bytes() []byte { - if node.kind == attrNode { - return []byte(node.attr) - } - if node.kind != startNode { - return node.text - } - size := 0 - for i := node.pos; i < node.end; i++ { - if node.nodes[i].kind == textNode { - size += len(node.nodes[i].text) - } - } - text := make([]byte, 0, size) - for i := node.pos; i < node.end; i++ { - if node.nodes[i].kind == textNode { - text = append(text, node.nodes[i].text...) - } - } - return text -} - -// equals returns whether the string value of node is equal to s, -// without allocating memory. -func (node *Node) equals(s string) bool { - if node.kind == attrNode { - return s == node.attr - } - if node.kind != startNode { - if len(s) != len(node.text) { - return false - } - for i := range s { - if s[i] != node.text[i] { - return false - } - } - return true - } - si := 0 - for i := node.pos; i < node.end; i++ { - if node.nodes[i].kind == textNode { - for _, c := range node.nodes[i].text { - if si > len(s) { - return false - } - if s[si] != c { - return false - } - si++ - } - } - } - return si == len(s) -} - -// contains returns whether the string value of node contains s, -// without allocating memory. -func (node *Node) contains(s string) (ok bool) { - if len(s) == 0 { - return true - } - if node.kind == attrNode { - return strings.Contains(node.attr, s) - } - s0 := s[0] - for i := node.pos; i < node.end; i++ { - if node.nodes[i].kind == textNode { - text := node.nodes[i].text - NextTry: - for ci, c := range text { - if c != s0 { - continue - } - si := 1 - for ci++; ci < len(text) && si < len(s); ci++ { - if s[si] != text[ci] { - continue NextTry - } - si++ - } - if si == len(s) { - return true - } - for j := i + 1; j < node.end; j++ { - if node.nodes[j].kind == textNode { - for _, c := range node.nodes[j].text { - if s[si] != c { - continue NextTry - } - si++ - if si == len(s) { - return true - } - } - } - } - } - } - } - return false -} - -// Parse reads an xml document from r, parses it, and returns its root node. -func Parse(r io.Reader) (*Node, error) { - return ParseDecoder(xml.NewDecoder(r)) -} - -// ParseDecoder parses the xml document being decoded by d and returns -// its root node. -func ParseDecoder(d *xml.Decoder) (*Node, error) { - var nodes []Node - var text []byte - - // The root node. - nodes = append(nodes, Node{kind: startNode}) - - for { - t, err := d.Token() - if err == io.EOF { - break - } - if err != nil { - return nil, err - } - switch t := t.(type) { - case xml.EndElement: - nodes = append(nodes, Node{ - kind: endNode, - }) - case xml.StartElement: - nodes = append(nodes, Node{ - kind: startNode, - name: t.Name, - }) - for _, attr := range t.Attr { - nodes = append(nodes, Node{ - kind: attrNode, - name: attr.Name, - attr: attr.Value, - }) - } - case xml.CharData: - texti := len(text) - text = append(text, t...) - nodes = append(nodes, Node{ - kind: textNode, - text: text[texti : texti+len(t)], - }) - case xml.Comment: - texti := len(text) - text = append(text, t...) - nodes = append(nodes, Node{ - kind: commentNode, - text: text[texti : texti+len(t)], - }) - case xml.ProcInst: - texti := len(text) - text = append(text, t.Inst...) - nodes = append(nodes, Node{ - kind: procInstNode, - name: xml.Name{Local: t.Target}, - text: text[texti : texti+len(t.Inst)], - }) - } - } - - // Close the root node. - nodes = append(nodes, Node{kind: endNode}) - - stack := make([]*Node, 0, len(nodes)) - downs := make([]*Node, len(nodes)) - downCount := 0 - - for pos := range nodes { - - switch nodes[pos].kind { - - case startNode, attrNode, textNode, commentNode, procInstNode: - node := &nodes[pos] - node.nodes = nodes - node.pos = pos - if len(stack) > 0 { - node.up = stack[len(stack)-1] - } - if node.kind == startNode { - stack = append(stack, node) - } else { - node.end = pos + 1 - } - - case endNode: - node := stack[len(stack)-1] - node.end = pos - stack = stack[:len(stack)-1] - - // Compute downs. Doing that here is what enables the - // use of a slice of a contiguous pre-allocated block. - node.down = downs[downCount:downCount] - for i := node.pos + 1; i < node.end; i++ { - if nodes[i].up == node { - switch nodes[i].kind { - case startNode, textNode, commentNode, procInstNode: - node.down = append(node.down, &nodes[i]) - downCount++ - } - } - } - if len(stack) == 0 { - return node, nil - } - } - } - return nil, io.EOF -} - -// ParseHTML reads an HTML document from r, parses it using a proper HTML -// parser, and returns its root node. -// -// The document will be processed as a properly structured HTML document, -// emulating the behavior of a browser when processing it. This includes -// putting the content inside proper and tags, if the -// provided text misses them. -func ParseHTML(r io.Reader) (*Node, error) { - ns, err := html.ParseFragment(r, nil) - if err != nil { - return nil, err - } - - var nodes []Node - var text []byte - - n := ns[0] - - // The root node. - nodes = append(nodes, Node{kind: startNode}) - - for n != nil { - switch n.Type { - case html.DocumentNode: - case html.ElementNode: - nodes = append(nodes, Node{ - kind: startNode, - name: xml.Name{Local: n.Data, Space: n.Namespace}, - }) - for _, attr := range n.Attr { - nodes = append(nodes, Node{ - kind: attrNode, - name: xml.Name{Local: attr.Key, Space: attr.Namespace}, - attr: attr.Val, - }) - } - case html.TextNode: - texti := len(text) - text = append(text, n.Data...) - nodes = append(nodes, Node{ - kind: textNode, - text: text[texti : texti+len(n.Data)], - }) - case html.CommentNode: - texti := len(text) - text = append(text, n.Data...) - nodes = append(nodes, Node{ - kind: commentNode, - text: text[texti : texti+len(n.Data)], - }) - } - - if n.FirstChild != nil { - n = n.FirstChild - continue - } - - for n != nil { - if n.Type == html.ElementNode { - nodes = append(nodes, Node{kind: endNode}) - } - if n.NextSibling != nil { - n = n.NextSibling - break - } - n = n.Parent - } - } - - // Close the root node. - nodes = append(nodes, Node{kind: endNode}) - - stack := make([]*Node, 0, len(nodes)) - downs := make([]*Node, len(nodes)) - downCount := 0 - - for pos := range nodes { - - switch nodes[pos].kind { - - case startNode, attrNode, textNode, commentNode, procInstNode: - node := &nodes[pos] - node.nodes = nodes - node.pos = pos - if len(stack) > 0 { - node.up = stack[len(stack)-1] - } - if node.kind == startNode { - stack = append(stack, node) - } else { - node.end = pos + 1 - } - - case endNode: - node := stack[len(stack)-1] - node.end = pos - stack = stack[:len(stack)-1] - - // Compute downs. Doing that here is what enables the - // use of a slice of a contiguous pre-allocated block. - node.down = downs[downCount:downCount] - for i := node.pos + 1; i < node.end; i++ { - if nodes[i].up == node { - switch nodes[i].kind { - case startNode, textNode, commentNode, procInstNode: - node.down = append(node.down, &nodes[i]) - downCount++ - } - } - } - if len(stack) == 0 { - return node, nil - } - } - } - return nil, io.EOF -} diff --git a/vendor/gopkg.in/xmlpath.v2/path.go b/vendor/gopkg.in/xmlpath.v2/path.go deleted file mode 100644 index db38ed5..0000000 --- a/vendor/gopkg.in/xmlpath.v2/path.go +++ /dev/null @@ -1,790 +0,0 @@ -package xmlpath - -import ( - "fmt" - "strconv" - "unicode/utf8" -) - -// Path is a compiled path that can be applied to a context -// node to obtain a matching node set. -// A single Path can be applied concurrently to any number -// of context nodes. -type Path struct { - path string - steps []pathStep -} - -// Iter returns an iterator that goes over the list of nodes -// that p matches on the given context. -func (p *Path) Iter(context *Node) *Iter { - iter := Iter{ - make([]pathStepState, len(p.steps)), - make([]bool, len(context.nodes)), - } - for i := range p.steps { - iter.state[i].step = &p.steps[i] - } - iter.state[0].init(context) - return &iter -} - -// Exists returns whether any nodes match p on the given context. -func (p *Path) Exists(context *Node) bool { - return p.Iter(context).Next() -} - -// String returns the string value of the first node matched -// by p on the given context. -// -// See the documentation of Node.String. -func (p *Path) String(context *Node) (s string, ok bool) { - iter := p.Iter(context) - if iter.Next() { - return iter.Node().String(), true - } - return "", false -} - -// Bytes returns as a byte slice the string value of the first -// node matched by p on the given context. -// -// See the documentation of Node.String. -func (p *Path) Bytes(node *Node) (b []byte, ok bool) { - iter := p.Iter(node) - if iter.Next() { - return iter.Node().Bytes(), true - } - return nil, false -} - -// Iter iterates over node sets. -type Iter struct { - state []pathStepState - seen []bool -} - -// Node returns the current node. -// Must only be called after Iter.Next returns true. -func (iter *Iter) Node() *Node { - state := iter.state[len(iter.state)-1] - if state.pos == 0 { - panic("Iter.Node called before Iter.Next") - } - if state.node == nil { - panic("Iter.Node called after Iter.Next false") - } - return state.node -} - -// Next iterates to the next node in the set, if any, and -// returns whether there is a node available. -func (iter *Iter) Next() bool { - tip := len(iter.state) - 1 -outer: - for { - for !iter.state[tip].next() { - tip-- - if tip == -1 { - return false - } - } - for tip < len(iter.state)-1 { - tip++ - iter.state[tip].init(iter.state[tip-1].node) - if !iter.state[tip].next() { - tip-- - continue outer - } - } - if iter.seen[iter.state[tip].node.pos] { - continue - } - iter.seen[iter.state[tip].node.pos] = true - return true - } - panic("unreachable") -} - -type pathStepState struct { - step *pathStep - node *Node - pos int - idx int - aux int -} - -func (s *pathStepState) init(node *Node) { - s.node = node - s.pos = 0 - s.idx = 0 - s.aux = 0 -} - -func (s *pathStepState) next() bool { - for s._next() { - s.pos++ - if s.step.pred == nil || s.test(s.step.pred) { - return true - } - } - return false -} - -func (s *pathStepState) test(pred predicate) bool { - switch pred := pred.(type) { - case positionPredicate: - if pred.pos == s.pos { - return true - } - case existsPredicate: - if pred.path.Exists(s.node) { - return true - } - case equalsPredicate: - iter := pred.path.Iter(s.node) - for iter.Next() { - if iter.Node().equals(pred.value) { - return true - } - } - case containsPredicate: - iter := pred.path.Iter(s.node) - for iter.Next() { - if iter.Node().contains(pred.value) { - return true - } - } - case notPredicate: - iter := pred.path.Iter(s.node) - if !iter.Next() { - return true - } - case andPredicate: - for _, sub := range pred.sub { - if !s.test(sub) { - return false - } - } - return true - case orPredicate: - for _, sub := range pred.sub { - if s.test(sub) { - return true - } - } - default: - panic(fmt.Sprintf("internal error: unknown predicate type: %#v", s.step.pred)) - } - return false -} - -func (s *pathStepState) _next() bool { - if s.node == nil { - return false - } - if s.step.root && s.idx == 0 { - for s.node.up != nil { - s.node = s.node.up - } - } - - switch s.step.axis { - - case "self": - if s.idx == 0 && s.step.match(s.node) { - s.idx++ - return true - } - - case "parent": - if s.idx == 0 && s.node.up != nil && s.step.match(s.node.up) { - s.idx++ - s.node = s.node.up - return true - } - - case "ancestor", "ancestor-or-self": - if s.idx == 0 && s.step.axis == "ancestor-or-self" { - s.idx++ - if s.step.match(s.node) { - return true - } - } - for s.node.up != nil { - s.node = s.node.up - s.idx++ - if s.step.match(s.node) { - return true - } - } - - case "child": - var down []*Node - if s.idx == 0 { - down = s.node.down - } else { - down = s.node.up.down - } - for s.idx < len(down) { - node := down[s.idx] - s.idx++ - if s.step.match(node) { - s.node = node - return true - } - } - - case "descendant", "descendant-or-self": - if s.idx == 0 { - s.idx = s.node.pos - s.aux = s.node.end - if s.step.axis == "descendant" { - s.idx++ - } - } - for s.idx < s.aux { - node := &s.node.nodes[s.idx] - s.idx++ - if node.kind == attrNode { - continue - } - if s.step.match(node) { - s.node = node - return true - } - } - - case "following": - if s.idx == 0 { - s.idx = s.node.end - } - for s.idx < len(s.node.nodes) { - node := &s.node.nodes[s.idx] - s.idx++ - if node.kind == attrNode { - continue - } - if s.step.match(node) { - s.node = node - return true - } - } - - case "following-sibling": - var down []*Node - if s.node.up != nil { - down = s.node.up.down - if s.idx == 0 { - for s.idx < len(down) { - node := down[s.idx] - s.idx++ - if node == s.node { - break - } - } - } - } - for s.idx < len(down) { - node := down[s.idx] - s.idx++ - if s.step.match(node) { - s.node = node - return true - } - } - - case "preceding": - if s.idx == 0 { - s.aux = s.node.pos // Detect ancestors. - s.idx = s.node.pos - 1 - } - for s.idx >= 0 { - node := &s.node.nodes[s.idx] - s.idx-- - if node.kind == attrNode { - continue - } - if node == s.node.nodes[s.aux].up { - s.aux = s.node.nodes[s.aux].up.pos - continue - } - if s.step.match(node) { - s.node = node - return true - } - } - - case "preceding-sibling": - var down []*Node - if s.node.up != nil { - down = s.node.up.down - if s.aux == 0 { - s.aux = 1 - for s.idx < len(down) { - node := down[s.idx] - s.idx++ - if node == s.node { - s.idx-- - break - } - } - } - } - for s.idx >= 0 { - node := down[s.idx] - s.idx-- - if s.step.match(node) { - s.node = node - return true - } - } - - case "attribute": - if s.idx == 0 { - s.idx = s.node.pos + 1 - s.aux = s.node.end - } - for s.idx < s.aux { - node := &s.node.nodes[s.idx] - s.idx++ - if node.kind != attrNode { - break - } - if s.step.match(node) { - s.node = node - return true - } - } - - } - - s.node = nil - return false -} - -type positionPredicate struct { - pos int -} - -type existsPredicate struct { - path *Path -} - -type equalsPredicate struct { - path *Path - value string -} - -type containsPredicate struct { - path *Path - value string -} - -type notPredicate struct { - path *Path -} - -type andPredicate struct { - sub []predicate -} - -type orPredicate struct { - sub []predicate -} - -// predicate is a marker interface for predicate types. -type predicate interface { - predicate() -} - -func (positionPredicate) predicate() {} -func (existsPredicate) predicate() {} -func (equalsPredicate) predicate() {} -func (containsPredicate) predicate() {} -func (notPredicate) predicate() {} -func (andPredicate) predicate() {} -func (orPredicate) predicate() {} - -type pathStep struct { - root bool - axis string - name string - kind nodeKind - pred predicate -} - -func (step *pathStep) match(node *Node) bool { - return node.kind != endNode && - (step.kind == anyNode || step.kind == node.kind) && - (step.name == "*" || node.name.Local == step.name) -} - -// MustCompile returns the compiled path, and panics if -// there are any errors. -func MustCompile(path string) *Path { - e, err := Compile(path) - if err != nil { - panic(err) - } - return e -} - -// Compile returns the compiled path. -func Compile(path string) (*Path, error) { - c := pathCompiler{path, 0} - if path == "" { - return nil, c.errorf("empty path") - } - p, err := c.parsePath() - if err != nil { - return nil, err - } - return p, nil -} - -type pathCompiler struct { - path string - i int -} - -func (c *pathCompiler) errorf(format string, args ...interface{}) error { - return fmt.Errorf("compiling xml path %q:%d: %s", c.path, c.i, fmt.Sprintf(format, args...)) -} - -func (c *pathCompiler) parsePath() (path *Path, err error) { - var steps []pathStep - var start = c.i - for { - step := pathStep{axis: "child"} - - c.skipSpaces() - if c.i == 0 && c.skipByte('/') { - c.skipSpaces() - step.root = true - if len(c.path) == 1 { - step.name = "*" - } - } - if c.peekByte('/') { - step.axis = "descendant-or-self" - step.name = "*" - } else if c.skipByte('@') { - mark := c.i - if !c.skipName() { - return nil, c.errorf("missing name after @") - } - step.axis = "attribute" - step.name = c.path[mark:c.i] - step.kind = attrNode - } else { - mark := c.i - if c.skipName() { - step.name = c.path[mark:c.i] - c.skipSpaces() - } - if step.name == "" { - return nil, c.errorf("missing name") - } else if step.name == "*" { - step.kind = startNode - } else if step.name == "." { - step.axis = "self" - step.name = "*" - } else if step.name == ".." { - step.axis = "parent" - step.name = "*" - } else { - if c.skipByte(':') { - if !c.skipByte(':') { - return nil, c.errorf("missing ':'") - } - c.skipSpaces() - switch step.name { - case "attribute": - step.kind = attrNode - case "self", "child", "parent": - case "descendant", "descendant-or-self": - case "ancestor", "ancestor-or-self": - case "following", "following-sibling": - case "preceding", "preceding-sibling": - default: - return nil, c.errorf("unsupported axis: %q", step.name) - } - step.axis = step.name - - mark = c.i - if !c.skipName() { - return nil, c.errorf("missing name") - } - step.name = c.path[mark:c.i] - - c.skipSpaces() - } - if c.skipByte('(') { - c.skipSpaces() - conflict := step.kind != anyNode - switch step.name { - case "node": - // must be anyNode - case "text": - step.kind = textNode - case "comment": - step.kind = commentNode - case "processing-instruction": - step.kind = procInstNode - default: - return nil, c.errorf("unsupported expression: %s()", step.name) - } - if conflict { - return nil, c.errorf("%s() cannot succeed on axis %q", step.name, step.axis) - } - - name := step.name - literal, err := c.parseLiteral() - if err == errNoLiteral { - step.name = "*" - } else if err != nil { - return nil, c.errorf("%v", err) - } else if step.kind == procInstNode { - c.skipSpaces() - step.name = literal - } else { - return nil, c.errorf("%s() has no arguments", name) - } - if !c.skipByte(')') { - return nil, c.errorf("%s() missing ')'", name) - } - c.skipSpaces() - } else if step.name == "*" && step.kind == anyNode { - step.kind = startNode - } - } - } - if c.skipByte('[') { - c.skipSpaces() - type state struct { - sub []predicate - and bool - } - var stack []state - var sub []predicate - var and bool - NextPred: - if c.skipByte('(') { - stack = append(stack, state{sub, and}) - sub = nil - and = false - } - var next predicate - if pos, ok := c.parseInt(); ok { - if pos == 0 { - return nil, c.errorf("positions start at 1") - } - next = positionPredicate{pos} - } else if c.skipString("contains(") { - path, err := c.parsePath() - if err != nil { - return nil, err - } - c.skipSpaces() - if !c.skipByte(',') { - return nil, c.errorf("contains() expected ',' followed by a literal string") - } - c.skipSpaces() - value, err := c.parseLiteral() - if err != nil { - return nil, err - } - c.skipSpaces() - if !c.skipByte(')') { - return nil, c.errorf("contains() missing ')'") - } - next = containsPredicate{path, value} - } else if c.skipString("not(") { - // TODO Generalize to handle any predicate expression. - path, err := c.parsePath() - if err != nil { - return nil, err - } - c.skipSpaces() - if !c.skipByte(')') { - return nil, c.errorf("not() missing ')'") - } - next = notPredicate{path} - } else { - path, err := c.parsePath() - if err != nil { - return nil, err - } - if path.path[0] == '-' { - if _, err = strconv.Atoi(path.path); err == nil { - return nil, c.errorf("positions must be positive") - } - } - c.skipSpaces() - if c.skipByte('=') { - c.skipSpaces() - value, err := c.parseLiteral() - if err != nil { - return nil, c.errorf("%v", err) - } - next = equalsPredicate{path, value} - } else { - next = existsPredicate{path} - } - } - HandleNext: - if and { - p := sub[len(sub)-1].(andPredicate) - p.sub = append(p.sub, next) - sub[len(sub)-1] = p - } else { - sub = append(sub, next) - } - if c.skipSpaces() { - mark := c.i - if c.skipString("and") && c.skipSpaces() { - if !and { - and = true - sub[len(sub)-1] = andPredicate{[]predicate{sub[len(sub)-1]}} - } - goto NextPred - } else if c.skipString("or") && c.skipSpaces() { - and = false - goto NextPred - } else { - c.i = mark - } - } - if c.skipByte(')') { - if len(stack) == 0 { - return nil, c.errorf("unexpected ')'") - } - if len(sub) == 1 { - next = sub[0] - } else { - next = orPredicate{sub} - } - s := stack[len(stack)-1] - stack = stack[:len(stack)-1] - sub = s.sub - and = s.and - goto HandleNext - } - if len(stack) > 0 { - return nil, c.errorf("expected ')'") - } - if len(sub) == 1 { - step.pred = sub[0] - } else { - step.pred = orPredicate{sub} - } - if !c.skipByte(']') { - return nil, c.errorf("expected ']'") - } - c.skipSpaces() - } - steps = append(steps, step) - //fmt.Printf("step: %#v\n", step) - if !c.skipByte('/') { - if (start == 0 || start == c.i) && c.i < len(c.path) { - return nil, c.errorf("unexpected %q", c.path[c.i]) - } - return &Path{steps: steps, path: c.path[start:c.i]}, nil - } - } - panic("unreachable") -} - -var errNoLiteral = fmt.Errorf("expected a literal string") - -func (c *pathCompiler) parseLiteral() (string, error) { - if c.skipByte('"') { - mark := c.i - if !c.skipByteFind('"') { - return "", fmt.Errorf(`missing '"'`) - } - return c.path[mark : c.i-1], nil - } - if c.skipByte('\'') { - mark := c.i - if !c.skipByteFind('\'') { - return "", fmt.Errorf(`missing "'"`) - } - return c.path[mark : c.i-1], nil - } - return "", errNoLiteral -} - -func (c *pathCompiler) parseInt() (v int, ok bool) { - mark := c.i - for c.i < len(c.path) && c.path[c.i] >= '0' && c.path[c.i] <= '9' { - v *= 10 - v += int(c.path[c.i]) - '0' - c.i++ - } - if c.i == mark { - return 0, false - } - return v, true -} - -func (c *pathCompiler) skipByte(b byte) bool { - if c.i < len(c.path) && c.path[c.i] == b { - c.i++ - return true - } - return false -} - -func (c *pathCompiler) skipByteFind(b byte) bool { - for i := c.i; i < len(c.path); i++ { - if c.path[i] == b { - c.i = i + 1 - return true - } - } - return false -} - -func (c *pathCompiler) peekByte(b byte) bool { - return c.i < len(c.path) && c.path[c.i] == b -} - -func (c *pathCompiler) skipSpaces() bool { - mark := c.i - for c.i < len(c.path) { - if c.path[c.i] != ' ' { - break - } - c.i++ - } - return c.i != mark -} - -func (c *pathCompiler) skipString(s string) bool { - if c.i+len(s) <= len(c.path) && c.path[c.i:c.i+len(s)] == s { - c.i += len(s) - return true - } - return false -} - -func (c *pathCompiler) skipName() bool { - if c.i >= len(c.path) { - return false - } - if c.path[c.i] == '*' { - c.i++ - return true - } - start := c.i - for c.i < len(c.path) && (c.path[c.i] >= utf8.RuneSelf || isNameByte(c.path[c.i])) { - c.i++ - } - return c.i > start -} - -func isNameByte(c byte) bool { - return 'A' <= c && c <= 'Z' || 'a' <= c && c <= 'z' || '0' <= c && c <= '9' || c == '_' || c == '.' || c == '-' -} diff --git a/vendor/gopkg.in/yaml.v2/.travis.yml b/vendor/gopkg.in/yaml.v2/.travis.yml deleted file mode 100644 index 004172a..0000000 --- a/vendor/gopkg.in/yaml.v2/.travis.yml +++ /dev/null @@ -1,9 +0,0 @@ -language: go - -go: - - 1.4 - - 1.5 - - 1.6 - - tip - -go_import_path: gopkg.in/yaml.v2 diff --git a/vendor/gopkg.in/yaml.v2/LICENSE b/vendor/gopkg.in/yaml.v2/LICENSE deleted file mode 100644 index 8dada3e..0000000 --- a/vendor/gopkg.in/yaml.v2/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 {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/gopkg.in/yaml.v2/LICENSE.libyaml b/vendor/gopkg.in/yaml.v2/LICENSE.libyaml deleted file mode 100644 index 8da58fb..0000000 --- a/vendor/gopkg.in/yaml.v2/LICENSE.libyaml +++ /dev/null @@ -1,31 +0,0 @@ -The following files were ported to Go from C files of libyaml, and thus -are still covered by their original copyright and license: - - apic.go - emitterc.go - parserc.go - readerc.go - scannerc.go - writerc.go - yamlh.go - yamlprivateh.go - -Copyright (c) 2006 Kirill Simonov - -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/gopkg.in/yaml.v2/README.md b/vendor/gopkg.in/yaml.v2/README.md deleted file mode 100644 index 2ed3314..0000000 --- a/vendor/gopkg.in/yaml.v2/README.md +++ /dev/null @@ -1,135 +0,0 @@ -# YAML support for the Go language - -Introduction ------------- - -The yaml package enables Go programs to comfortably encode and decode YAML -values. It was developed within [Canonical](https://www.canonical.com) as -part of the [juju](https://juju.ubuntu.com) project, and is based on a -pure Go port of the well-known [libyaml](http://pyyaml.org/wiki/LibYAML) -C library to parse and generate YAML data quickly and reliably. - -Compatibility -------------- - -The yaml package supports most of YAML 1.1 and 1.2, including support for -anchors, tags, map merging, etc. Multi-document unmarshalling is not yet -implemented, and base-60 floats from YAML 1.1 are purposefully not -supported since they're a poor design and are gone in YAML 1.2. - -Installation and usage ----------------------- - -The import path for the package is *gopkg.in/yaml.v2*. - -To install it, run: - - go get gopkg.in/yaml.v2 - -API documentation ------------------ - -If opened in a browser, the import path itself leads to the API documentation: - - * [https://gopkg.in/yaml.v2](https://gopkg.in/yaml.v2) - -API stability -------------- - -The package API for yaml v2 will remain stable as described in [gopkg.in](https://gopkg.in). - - -License -------- - -The yaml package is licensed under the Apache License 2.0. Please see the LICENSE file for details. - - -Example -------- - -Some more examples can be found in the "examples" folder. - -```Go -package main - -import ( - "fmt" - "log" - - "gopkg.in/yaml.v2" -) - -var data = ` -a: Easy! -b: - c: 2 - d: [3, 4] -` - -// Note: struct fields must be public in order for unmarshal to -// correctly populate the data. -type T struct { - A string - B struct { - RenamedC int `yaml:"c"` - D []int `yaml:",flow"` - } -} - -func main() { - t := T{} - - err := yaml.Unmarshal([]byte(data), &t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t:\n%v\n\n", t) - - d, err := yaml.Marshal(&t) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- t dump:\n%s\n\n", string(d)) - - m := make(map[interface{}]interface{}) - - err = yaml.Unmarshal([]byte(data), &m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m:\n%v\n\n", m) - - d, err = yaml.Marshal(&m) - if err != nil { - log.Fatalf("error: %v", err) - } - fmt.Printf("--- m dump:\n%s\n\n", string(d)) -} -``` - -This example will generate the following output: - -``` ---- t: -{Easy! {2 [3 4]}} - ---- t dump: -a: Easy! -b: - c: 2 - d: [3, 4] - - ---- m: -map[a:Easy! b:map[c:2 d:[3 4]]] - ---- m dump: -a: Easy! -b: - c: 2 - d: - - 3 - - 4 -``` - diff --git a/vendor/gopkg.in/yaml.v2/apic.go b/vendor/gopkg.in/yaml.v2/apic.go deleted file mode 100644 index 95ec014..0000000 --- a/vendor/gopkg.in/yaml.v2/apic.go +++ /dev/null @@ -1,742 +0,0 @@ -package yaml - -import ( - "io" - "os" -) - -func yaml_insert_token(parser *yaml_parser_t, pos int, token *yaml_token_t) { - //fmt.Println("yaml_insert_token", "pos:", pos, "typ:", token.typ, "head:", parser.tokens_head, "len:", len(parser.tokens)) - - // Check if we can move the queue at the beginning of the buffer. - if parser.tokens_head > 0 && len(parser.tokens) == cap(parser.tokens) { - if parser.tokens_head != len(parser.tokens) { - copy(parser.tokens, parser.tokens[parser.tokens_head:]) - } - parser.tokens = parser.tokens[:len(parser.tokens)-parser.tokens_head] - parser.tokens_head = 0 - } - parser.tokens = append(parser.tokens, *token) - if pos < 0 { - return - } - copy(parser.tokens[parser.tokens_head+pos+1:], parser.tokens[parser.tokens_head+pos:]) - parser.tokens[parser.tokens_head+pos] = *token -} - -// Create a new parser object. -func yaml_parser_initialize(parser *yaml_parser_t) bool { - *parser = yaml_parser_t{ - raw_buffer: make([]byte, 0, input_raw_buffer_size), - buffer: make([]byte, 0, input_buffer_size), - } - return true -} - -// Destroy a parser object. -func yaml_parser_delete(parser *yaml_parser_t) { - *parser = yaml_parser_t{} -} - -// String read handler. -func yaml_string_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - if parser.input_pos == len(parser.input) { - return 0, io.EOF - } - n = copy(buffer, parser.input[parser.input_pos:]) - parser.input_pos += n - return n, nil -} - -// File read handler. -func yaml_file_read_handler(parser *yaml_parser_t, buffer []byte) (n int, err error) { - return parser.input_file.Read(buffer) -} - -// Set a string input. -func yaml_parser_set_input_string(parser *yaml_parser_t, input []byte) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_string_read_handler - parser.input = input - parser.input_pos = 0 -} - -// Set a file input. -func yaml_parser_set_input_file(parser *yaml_parser_t, file *os.File) { - if parser.read_handler != nil { - panic("must set the input source only once") - } - parser.read_handler = yaml_file_read_handler - parser.input_file = file -} - -// Set the source encoding. -func yaml_parser_set_encoding(parser *yaml_parser_t, encoding yaml_encoding_t) { - if parser.encoding != yaml_ANY_ENCODING { - panic("must set the encoding only once") - } - parser.encoding = encoding -} - -// Create a new emitter object. -func yaml_emitter_initialize(emitter *yaml_emitter_t) bool { - *emitter = yaml_emitter_t{ - buffer: make([]byte, output_buffer_size), - raw_buffer: make([]byte, 0, output_raw_buffer_size), - states: make([]yaml_emitter_state_t, 0, initial_stack_size), - events: make([]yaml_event_t, 0, initial_queue_size), - } - return true -} - -// Destroy an emitter object. -func yaml_emitter_delete(emitter *yaml_emitter_t) { - *emitter = yaml_emitter_t{} -} - -// String write handler. -func yaml_string_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - *emitter.output_buffer = append(*emitter.output_buffer, buffer...) - return nil -} - -// File write handler. -func yaml_file_write_handler(emitter *yaml_emitter_t, buffer []byte) error { - _, err := emitter.output_file.Write(buffer) - return err -} - -// Set a string output. -func yaml_emitter_set_output_string(emitter *yaml_emitter_t, output_buffer *[]byte) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_string_write_handler - emitter.output_buffer = output_buffer -} - -// Set a file output. -func yaml_emitter_set_output_file(emitter *yaml_emitter_t, file io.Writer) { - if emitter.write_handler != nil { - panic("must set the output target only once") - } - emitter.write_handler = yaml_file_write_handler - emitter.output_file = file -} - -// Set the output encoding. -func yaml_emitter_set_encoding(emitter *yaml_emitter_t, encoding yaml_encoding_t) { - if emitter.encoding != yaml_ANY_ENCODING { - panic("must set the output encoding only once") - } - emitter.encoding = encoding -} - -// Set the canonical output style. -func yaml_emitter_set_canonical(emitter *yaml_emitter_t, canonical bool) { - emitter.canonical = canonical -} - -//// Set the indentation increment. -func yaml_emitter_set_indent(emitter *yaml_emitter_t, indent int) { - if indent < 2 || indent > 9 { - indent = 2 - } - emitter.best_indent = indent -} - -// Set the preferred line width. -func yaml_emitter_set_width(emitter *yaml_emitter_t, width int) { - if width < 0 { - width = -1 - } - emitter.best_width = width -} - -// Set if unescaped non-ASCII characters are allowed. -func yaml_emitter_set_unicode(emitter *yaml_emitter_t, unicode bool) { - emitter.unicode = unicode -} - -// Set the preferred line break character. -func yaml_emitter_set_break(emitter *yaml_emitter_t, line_break yaml_break_t) { - emitter.line_break = line_break -} - -///* -// * Destroy a token object. -// */ -// -//YAML_DECLARE(void) -//yaml_token_delete(yaml_token_t *token) -//{ -// assert(token); // Non-NULL token object expected. -// -// switch (token.type) -// { -// case YAML_TAG_DIRECTIVE_TOKEN: -// yaml_free(token.data.tag_directive.handle); -// yaml_free(token.data.tag_directive.prefix); -// break; -// -// case YAML_ALIAS_TOKEN: -// yaml_free(token.data.alias.value); -// break; -// -// case YAML_ANCHOR_TOKEN: -// yaml_free(token.data.anchor.value); -// break; -// -// case YAML_TAG_TOKEN: -// yaml_free(token.data.tag.handle); -// yaml_free(token.data.tag.suffix); -// break; -// -// case YAML_SCALAR_TOKEN: -// yaml_free(token.data.scalar.value); -// break; -// -// default: -// break; -// } -// -// memset(token, 0, sizeof(yaml_token_t)); -//} -// -///* -// * Check if a string is a valid UTF-8 sequence. -// * -// * Check 'reader.c' for more details on UTF-8 encoding. -// */ -// -//static int -//yaml_check_utf8(yaml_char_t *start, size_t length) -//{ -// yaml_char_t *end = start+length; -// yaml_char_t *pointer = start; -// -// while (pointer < end) { -// unsigned char octet; -// unsigned int width; -// unsigned int value; -// size_t k; -// -// octet = pointer[0]; -// width = (octet & 0x80) == 0x00 ? 1 : -// (octet & 0xE0) == 0xC0 ? 2 : -// (octet & 0xF0) == 0xE0 ? 3 : -// (octet & 0xF8) == 0xF0 ? 4 : 0; -// value = (octet & 0x80) == 0x00 ? octet & 0x7F : -// (octet & 0xE0) == 0xC0 ? octet & 0x1F : -// (octet & 0xF0) == 0xE0 ? octet & 0x0F : -// (octet & 0xF8) == 0xF0 ? octet & 0x07 : 0; -// if (!width) return 0; -// if (pointer+width > end) return 0; -// for (k = 1; k < width; k ++) { -// octet = pointer[k]; -// if ((octet & 0xC0) != 0x80) return 0; -// value = (value << 6) + (octet & 0x3F); -// } -// if (!((width == 1) || -// (width == 2 && value >= 0x80) || -// (width == 3 && value >= 0x800) || -// (width == 4 && value >= 0x10000))) return 0; -// -// pointer += width; -// } -// -// return 1; -//} -// - -// Create STREAM-START. -func yaml_stream_start_event_initialize(event *yaml_event_t, encoding yaml_encoding_t) bool { - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - encoding: encoding, - } - return true -} - -// Create STREAM-END. -func yaml_stream_end_event_initialize(event *yaml_event_t) bool { - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - } - return true -} - -// Create DOCUMENT-START. -func yaml_document_start_event_initialize(event *yaml_event_t, version_directive *yaml_version_directive_t, - tag_directives []yaml_tag_directive_t, implicit bool) bool { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: implicit, - } - return true -} - -// Create DOCUMENT-END. -func yaml_document_end_event_initialize(event *yaml_event_t, implicit bool) bool { - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - implicit: implicit, - } - return true -} - -///* -// * Create ALIAS. -// */ -// -//YAML_DECLARE(int) -//yaml_alias_event_initialize(event *yaml_event_t, anchor *yaml_char_t) -//{ -// mark yaml_mark_t = { 0, 0, 0 } -// anchor_copy *yaml_char_t = NULL -// -// assert(event) // Non-NULL event object is expected. -// assert(anchor) // Non-NULL anchor is expected. -// -// if (!yaml_check_utf8(anchor, strlen((char *)anchor))) return 0 -// -// anchor_copy = yaml_strdup(anchor) -// if (!anchor_copy) -// return 0 -// -// ALIAS_EVENT_INIT(*event, anchor_copy, mark, mark) -// -// return 1 -//} - -// Create SCALAR. -func yaml_scalar_event_initialize(event *yaml_event_t, anchor, tag, value []byte, plain_implicit, quoted_implicit bool, style yaml_scalar_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - anchor: anchor, - tag: tag, - value: value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-START. -func yaml_sequence_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_sequence_style_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } - return true -} - -// Create SEQUENCE-END. -func yaml_sequence_end_event_initialize(event *yaml_event_t) bool { - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - } - return true -} - -// Create MAPPING-START. -func yaml_mapping_start_event_initialize(event *yaml_event_t, anchor, tag []byte, implicit bool, style yaml_mapping_style_t) bool { - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(style), - } - return true -} - -// Create MAPPING-END. -func yaml_mapping_end_event_initialize(event *yaml_event_t) bool { - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - } - return true -} - -// Destroy an event object. -func yaml_event_delete(event *yaml_event_t) { - *event = yaml_event_t{} -} - -///* -// * Create a document object. -// */ -// -//YAML_DECLARE(int) -//yaml_document_initialize(document *yaml_document_t, -// version_directive *yaml_version_directive_t, -// tag_directives_start *yaml_tag_directive_t, -// tag_directives_end *yaml_tag_directive_t, -// start_implicit int, end_implicit int) -//{ -// struct { -// error yaml_error_type_t -// } context -// struct { -// start *yaml_node_t -// end *yaml_node_t -// top *yaml_node_t -// } nodes = { NULL, NULL, NULL } -// version_directive_copy *yaml_version_directive_t = NULL -// struct { -// start *yaml_tag_directive_t -// end *yaml_tag_directive_t -// top *yaml_tag_directive_t -// } tag_directives_copy = { NULL, NULL, NULL } -// value yaml_tag_directive_t = { NULL, NULL } -// mark yaml_mark_t = { 0, 0, 0 } -// -// assert(document) // Non-NULL document object is expected. -// assert((tag_directives_start && tag_directives_end) || -// (tag_directives_start == tag_directives_end)) -// // Valid tag directives are expected. -// -// if (!STACK_INIT(&context, nodes, INITIAL_STACK_SIZE)) goto error -// -// if (version_directive) { -// version_directive_copy = yaml_malloc(sizeof(yaml_version_directive_t)) -// if (!version_directive_copy) goto error -// version_directive_copy.major = version_directive.major -// version_directive_copy.minor = version_directive.minor -// } -// -// if (tag_directives_start != tag_directives_end) { -// tag_directive *yaml_tag_directive_t -// if (!STACK_INIT(&context, tag_directives_copy, INITIAL_STACK_SIZE)) -// goto error -// for (tag_directive = tag_directives_start -// tag_directive != tag_directives_end; tag_directive ++) { -// assert(tag_directive.handle) -// assert(tag_directive.prefix) -// if (!yaml_check_utf8(tag_directive.handle, -// strlen((char *)tag_directive.handle))) -// goto error -// if (!yaml_check_utf8(tag_directive.prefix, -// strlen((char *)tag_directive.prefix))) -// goto error -// value.handle = yaml_strdup(tag_directive.handle) -// value.prefix = yaml_strdup(tag_directive.prefix) -// if (!value.handle || !value.prefix) goto error -// if (!PUSH(&context, tag_directives_copy, value)) -// goto error -// value.handle = NULL -// value.prefix = NULL -// } -// } -// -// DOCUMENT_INIT(*document, nodes.start, nodes.end, version_directive_copy, -// tag_directives_copy.start, tag_directives_copy.top, -// start_implicit, end_implicit, mark, mark) -// -// return 1 -// -//error: -// STACK_DEL(&context, nodes) -// yaml_free(version_directive_copy) -// while (!STACK_EMPTY(&context, tag_directives_copy)) { -// value yaml_tag_directive_t = POP(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// } -// STACK_DEL(&context, tag_directives_copy) -// yaml_free(value.handle) -// yaml_free(value.prefix) -// -// return 0 -//} -// -///* -// * Destroy a document object. -// */ -// -//YAML_DECLARE(void) -//yaml_document_delete(document *yaml_document_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// tag_directive *yaml_tag_directive_t -// -// context.error = YAML_NO_ERROR // Eliminate a compliler warning. -// -// assert(document) // Non-NULL document object is expected. -// -// while (!STACK_EMPTY(&context, document.nodes)) { -// node yaml_node_t = POP(&context, document.nodes) -// yaml_free(node.tag) -// switch (node.type) { -// case YAML_SCALAR_NODE: -// yaml_free(node.data.scalar.value) -// break -// case YAML_SEQUENCE_NODE: -// STACK_DEL(&context, node.data.sequence.items) -// break -// case YAML_MAPPING_NODE: -// STACK_DEL(&context, node.data.mapping.pairs) -// break -// default: -// assert(0) // Should not happen. -// } -// } -// STACK_DEL(&context, document.nodes) -// -// yaml_free(document.version_directive) -// for (tag_directive = document.tag_directives.start -// tag_directive != document.tag_directives.end -// tag_directive++) { -// yaml_free(tag_directive.handle) -// yaml_free(tag_directive.prefix) -// } -// yaml_free(document.tag_directives.start) -// -// memset(document, 0, sizeof(yaml_document_t)) -//} -// -///** -// * Get a document node. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_node(document *yaml_document_t, index int) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (index > 0 && document.nodes.start + index <= document.nodes.top) { -// return document.nodes.start + index - 1 -// } -// return NULL -//} -// -///** -// * Get the root object. -// */ -// -//YAML_DECLARE(yaml_node_t *) -//yaml_document_get_root_node(document *yaml_document_t) -//{ -// assert(document) // Non-NULL document object is expected. -// -// if (document.nodes.top != document.nodes.start) { -// return document.nodes.start -// } -// return NULL -//} -// -///* -// * Add a scalar node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_scalar(document *yaml_document_t, -// tag *yaml_char_t, value *yaml_char_t, length int, -// style yaml_scalar_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// value_copy *yaml_char_t = NULL -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// assert(value) // Non-NULL value is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SCALAR_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (length < 0) { -// length = strlen((char *)value) -// } -// -// if (!yaml_check_utf8(value, length)) goto error -// value_copy = yaml_malloc(length+1) -// if (!value_copy) goto error -// memcpy(value_copy, value, length) -// value_copy[length] = '\0' -// -// SCALAR_NODE_INIT(node, tag_copy, value_copy, length, style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// yaml_free(tag_copy) -// yaml_free(value_copy) -// -// return 0 -//} -// -///* -// * Add a sequence node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_sequence(document *yaml_document_t, -// tag *yaml_char_t, style yaml_sequence_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_item_t -// end *yaml_node_item_t -// top *yaml_node_item_t -// } items = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_SEQUENCE_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, items, INITIAL_STACK_SIZE)) goto error -// -// SEQUENCE_NODE_INIT(node, tag_copy, items.start, items.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, items) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Add a mapping node to a document. -// */ -// -//YAML_DECLARE(int) -//yaml_document_add_mapping(document *yaml_document_t, -// tag *yaml_char_t, style yaml_mapping_style_t) -//{ -// struct { -// error yaml_error_type_t -// } context -// mark yaml_mark_t = { 0, 0, 0 } -// tag_copy *yaml_char_t = NULL -// struct { -// start *yaml_node_pair_t -// end *yaml_node_pair_t -// top *yaml_node_pair_t -// } pairs = { NULL, NULL, NULL } -// node yaml_node_t -// -// assert(document) // Non-NULL document object is expected. -// -// if (!tag) { -// tag = (yaml_char_t *)YAML_DEFAULT_MAPPING_TAG -// } -// -// if (!yaml_check_utf8(tag, strlen((char *)tag))) goto error -// tag_copy = yaml_strdup(tag) -// if (!tag_copy) goto error -// -// if (!STACK_INIT(&context, pairs, INITIAL_STACK_SIZE)) goto error -// -// MAPPING_NODE_INIT(node, tag_copy, pairs.start, pairs.end, -// style, mark, mark) -// if (!PUSH(&context, document.nodes, node)) goto error -// -// return document.nodes.top - document.nodes.start -// -//error: -// STACK_DEL(&context, pairs) -// yaml_free(tag_copy) -// -// return 0 -//} -// -///* -// * Append an item to a sequence node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_sequence_item(document *yaml_document_t, -// sequence int, item int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// assert(document) // Non-NULL document is required. -// assert(sequence > 0 -// && document.nodes.start + sequence <= document.nodes.top) -// // Valid sequence id is required. -// assert(document.nodes.start[sequence-1].type == YAML_SEQUENCE_NODE) -// // A sequence node is required. -// assert(item > 0 && document.nodes.start + item <= document.nodes.top) -// // Valid item id is required. -// -// if (!PUSH(&context, -// document.nodes.start[sequence-1].data.sequence.items, item)) -// return 0 -// -// return 1 -//} -// -///* -// * Append a pair of a key and a value to a mapping node. -// */ -// -//YAML_DECLARE(int) -//yaml_document_append_mapping_pair(document *yaml_document_t, -// mapping int, key int, value int) -//{ -// struct { -// error yaml_error_type_t -// } context -// -// pair yaml_node_pair_t -// -// assert(document) // Non-NULL document is required. -// assert(mapping > 0 -// && document.nodes.start + mapping <= document.nodes.top) -// // Valid mapping id is required. -// assert(document.nodes.start[mapping-1].type == YAML_MAPPING_NODE) -// // A mapping node is required. -// assert(key > 0 && document.nodes.start + key <= document.nodes.top) -// // Valid key id is required. -// assert(value > 0 && document.nodes.start + value <= document.nodes.top) -// // Valid value id is required. -// -// pair.key = key -// pair.value = value -// -// if (!PUSH(&context, -// document.nodes.start[mapping-1].data.mapping.pairs, pair)) -// return 0 -// -// return 1 -//} -// -// diff --git a/vendor/gopkg.in/yaml.v2/decode.go b/vendor/gopkg.in/yaml.v2/decode.go deleted file mode 100644 index e85eb2e..0000000 --- a/vendor/gopkg.in/yaml.v2/decode.go +++ /dev/null @@ -1,685 +0,0 @@ -package yaml - -import ( - "encoding" - "encoding/base64" - "fmt" - "math" - "reflect" - "strconv" - "time" -) - -const ( - documentNode = 1 << iota - mappingNode - sequenceNode - scalarNode - aliasNode -) - -type node struct { - kind int - line, column int - tag string - value string - implicit bool - children []*node - anchors map[string]*node -} - -// ---------------------------------------------------------------------------- -// Parser, produces a node tree out of a libyaml event stream. - -type parser struct { - parser yaml_parser_t - event yaml_event_t - doc *node -} - -func newParser(b []byte) *parser { - p := parser{} - if !yaml_parser_initialize(&p.parser) { - panic("failed to initialize YAML emitter") - } - - if len(b) == 0 { - b = []byte{'\n'} - } - - yaml_parser_set_input_string(&p.parser, b) - - p.skip() - if p.event.typ != yaml_STREAM_START_EVENT { - panic("expected stream start event, got " + strconv.Itoa(int(p.event.typ))) - } - p.skip() - return &p -} - -func (p *parser) destroy() { - if p.event.typ != yaml_NO_EVENT { - yaml_event_delete(&p.event) - } - yaml_parser_delete(&p.parser) -} - -func (p *parser) skip() { - if p.event.typ != yaml_NO_EVENT { - if p.event.typ == yaml_STREAM_END_EVENT { - failf("attempted to go past the end of stream; corrupted value?") - } - yaml_event_delete(&p.event) - } - if !yaml_parser_parse(&p.parser, &p.event) { - p.fail() - } -} - -func (p *parser) fail() { - var where string - var line int - if p.parser.problem_mark.line != 0 { - line = p.parser.problem_mark.line - } else if p.parser.context_mark.line != 0 { - line = p.parser.context_mark.line - } - if line != 0 { - where = "line " + strconv.Itoa(line) + ": " - } - var msg string - if len(p.parser.problem) > 0 { - msg = p.parser.problem - } else { - msg = "unknown problem parsing YAML content" - } - failf("%s%s", where, msg) -} - -func (p *parser) anchor(n *node, anchor []byte) { - if anchor != nil { - p.doc.anchors[string(anchor)] = n - } -} - -func (p *parser) parse() *node { - switch p.event.typ { - case yaml_SCALAR_EVENT: - return p.scalar() - case yaml_ALIAS_EVENT: - return p.alias() - case yaml_MAPPING_START_EVENT: - return p.mapping() - case yaml_SEQUENCE_START_EVENT: - return p.sequence() - case yaml_DOCUMENT_START_EVENT: - return p.document() - case yaml_STREAM_END_EVENT: - // Happens when attempting to decode an empty buffer. - return nil - default: - panic("attempted to parse unknown event: " + strconv.Itoa(int(p.event.typ))) - } -} - -func (p *parser) node(kind int) *node { - return &node{ - kind: kind, - line: p.event.start_mark.line, - column: p.event.start_mark.column, - } -} - -func (p *parser) document() *node { - n := p.node(documentNode) - n.anchors = make(map[string]*node) - p.doc = n - p.skip() - n.children = append(n.children, p.parse()) - if p.event.typ != yaml_DOCUMENT_END_EVENT { - panic("expected end of document event but got " + strconv.Itoa(int(p.event.typ))) - } - p.skip() - return n -} - -func (p *parser) alias() *node { - n := p.node(aliasNode) - n.value = string(p.event.anchor) - p.skip() - return n -} - -func (p *parser) scalar() *node { - n := p.node(scalarNode) - n.value = string(p.event.value) - n.tag = string(p.event.tag) - n.implicit = p.event.implicit - p.anchor(n, p.event.anchor) - p.skip() - return n -} - -func (p *parser) sequence() *node { - n := p.node(sequenceNode) - p.anchor(n, p.event.anchor) - p.skip() - for p.event.typ != yaml_SEQUENCE_END_EVENT { - n.children = append(n.children, p.parse()) - } - p.skip() - return n -} - -func (p *parser) mapping() *node { - n := p.node(mappingNode) - p.anchor(n, p.event.anchor) - p.skip() - for p.event.typ != yaml_MAPPING_END_EVENT { - n.children = append(n.children, p.parse(), p.parse()) - } - p.skip() - return n -} - -// ---------------------------------------------------------------------------- -// Decoder, unmarshals a node into a provided value. - -type decoder struct { - doc *node - aliases map[string]bool - mapType reflect.Type - terrors []string - strict bool -} - -var ( - mapItemType = reflect.TypeOf(MapItem{}) - durationType = reflect.TypeOf(time.Duration(0)) - defaultMapType = reflect.TypeOf(map[interface{}]interface{}{}) - ifaceType = defaultMapType.Elem() -) - -func newDecoder(strict bool) *decoder { - d := &decoder{mapType: defaultMapType, strict: strict} - d.aliases = make(map[string]bool) - return d -} - -func (d *decoder) terror(n *node, tag string, out reflect.Value) { - if n.tag != "" { - tag = n.tag - } - value := n.value - if tag != yaml_SEQ_TAG && tag != yaml_MAP_TAG { - if len(value) > 10 { - value = " `" + value[:7] + "...`" - } else { - value = " `" + value + "`" - } - } - d.terrors = append(d.terrors, fmt.Sprintf("line %d: cannot unmarshal %s%s into %s", n.line+1, shortTag(tag), value, out.Type())) -} - -func (d *decoder) callUnmarshaler(n *node, u Unmarshaler) (good bool) { - terrlen := len(d.terrors) - err := u.UnmarshalYAML(func(v interface{}) (err error) { - defer handleErr(&err) - d.unmarshal(n, reflect.ValueOf(v)) - if len(d.terrors) > terrlen { - issues := d.terrors[terrlen:] - d.terrors = d.terrors[:terrlen] - return &TypeError{issues} - } - return nil - }) - if e, ok := err.(*TypeError); ok { - d.terrors = append(d.terrors, e.Errors...) - return false - } - if err != nil { - fail(err) - } - return true -} - -// d.prepare initializes and dereferences pointers and calls UnmarshalYAML -// if a value is found to implement it. -// It returns the initialized and dereferenced out value, whether -// unmarshalling was already done by UnmarshalYAML, and if so whether -// its types unmarshalled appropriately. -// -// If n holds a null value, prepare returns before doing anything. -func (d *decoder) prepare(n *node, out reflect.Value) (newout reflect.Value, unmarshaled, good bool) { - if n.tag == yaml_NULL_TAG || n.kind == scalarNode && n.tag == "" && (n.value == "null" || n.value == "~" || n.value == "" && n.implicit) { - return out, false, false - } - again := true - for again { - again = false - if out.Kind() == reflect.Ptr { - if out.IsNil() { - out.Set(reflect.New(out.Type().Elem())) - } - out = out.Elem() - again = true - } - if out.CanAddr() { - if u, ok := out.Addr().Interface().(Unmarshaler); ok { - good = d.callUnmarshaler(n, u) - return out, true, good - } - } - } - return out, false, false -} - -func (d *decoder) unmarshal(n *node, out reflect.Value) (good bool) { - switch n.kind { - case documentNode: - return d.document(n, out) - case aliasNode: - return d.alias(n, out) - } - out, unmarshaled, good := d.prepare(n, out) - if unmarshaled { - return good - } - switch n.kind { - case scalarNode: - good = d.scalar(n, out) - case mappingNode: - good = d.mapping(n, out) - case sequenceNode: - good = d.sequence(n, out) - default: - panic("internal error: unknown node kind: " + strconv.Itoa(n.kind)) - } - return good -} - -func (d *decoder) document(n *node, out reflect.Value) (good bool) { - if len(n.children) == 1 { - d.doc = n - d.unmarshal(n.children[0], out) - return true - } - return false -} - -func (d *decoder) alias(n *node, out reflect.Value) (good bool) { - an, ok := d.doc.anchors[n.value] - if !ok { - failf("unknown anchor '%s' referenced", n.value) - } - if d.aliases[n.value] { - failf("anchor '%s' value contains itself", n.value) - } - d.aliases[n.value] = true - good = d.unmarshal(an, out) - delete(d.aliases, n.value) - return good -} - -var zeroValue reflect.Value - -func resetMap(out reflect.Value) { - for _, k := range out.MapKeys() { - out.SetMapIndex(k, zeroValue) - } -} - -func (d *decoder) scalar(n *node, out reflect.Value) (good bool) { - var tag string - var resolved interface{} - if n.tag == "" && !n.implicit { - tag = yaml_STR_TAG - resolved = n.value - } else { - tag, resolved = resolve(n.tag, n.value) - if tag == yaml_BINARY_TAG { - data, err := base64.StdEncoding.DecodeString(resolved.(string)) - if err != nil { - failf("!!binary value contains invalid base64 data") - } - resolved = string(data) - } - } - if resolved == nil { - if out.Kind() == reflect.Map && !out.CanAddr() { - resetMap(out) - } else { - out.Set(reflect.Zero(out.Type())) - } - return true - } - if s, ok := resolved.(string); ok && out.CanAddr() { - if u, ok := out.Addr().Interface().(encoding.TextUnmarshaler); ok { - err := u.UnmarshalText([]byte(s)) - if err != nil { - fail(err) - } - return true - } - } - switch out.Kind() { - case reflect.String: - if tag == yaml_BINARY_TAG { - out.SetString(resolved.(string)) - good = true - } else if resolved != nil { - out.SetString(n.value) - good = true - } - case reflect.Interface: - if resolved == nil { - out.Set(reflect.Zero(out.Type())) - } else { - out.Set(reflect.ValueOf(resolved)) - } - good = true - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - switch resolved := resolved.(type) { - case int: - if !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - good = true - } - case int64: - if !out.OverflowInt(resolved) { - out.SetInt(resolved) - good = true - } - case uint64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - good = true - } - case float64: - if resolved <= math.MaxInt64 && !out.OverflowInt(int64(resolved)) { - out.SetInt(int64(resolved)) - good = true - } - case string: - if out.Type() == durationType { - d, err := time.ParseDuration(resolved) - if err == nil { - out.SetInt(int64(d)) - good = true - } - } - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - switch resolved := resolved.(type) { - case int: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - good = true - } - case int64: - if resolved >= 0 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - good = true - } - case uint64: - if !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - good = true - } - case float64: - if resolved <= math.MaxUint64 && !out.OverflowUint(uint64(resolved)) { - out.SetUint(uint64(resolved)) - good = true - } - } - case reflect.Bool: - switch resolved := resolved.(type) { - case bool: - out.SetBool(resolved) - good = true - } - case reflect.Float32, reflect.Float64: - switch resolved := resolved.(type) { - case int: - out.SetFloat(float64(resolved)) - good = true - case int64: - out.SetFloat(float64(resolved)) - good = true - case uint64: - out.SetFloat(float64(resolved)) - good = true - case float64: - out.SetFloat(resolved) - good = true - } - case reflect.Ptr: - if out.Type().Elem() == reflect.TypeOf(resolved) { - // TODO DOes this make sense? When is out a Ptr except when decoding a nil value? - elem := reflect.New(out.Type().Elem()) - elem.Elem().Set(reflect.ValueOf(resolved)) - out.Set(elem) - good = true - } - } - if !good { - d.terror(n, tag, out) - } - return good -} - -func settableValueOf(i interface{}) reflect.Value { - v := reflect.ValueOf(i) - sv := reflect.New(v.Type()).Elem() - sv.Set(v) - return sv -} - -func (d *decoder) sequence(n *node, out reflect.Value) (good bool) { - l := len(n.children) - - var iface reflect.Value - switch out.Kind() { - case reflect.Slice: - out.Set(reflect.MakeSlice(out.Type(), l, l)) - case reflect.Interface: - // No type hints. Will have to use a generic sequence. - iface = out - out = settableValueOf(make([]interface{}, l)) - default: - d.terror(n, yaml_SEQ_TAG, out) - return false - } - et := out.Type().Elem() - - j := 0 - for i := 0; i < l; i++ { - e := reflect.New(et).Elem() - if ok := d.unmarshal(n.children[i], e); ok { - out.Index(j).Set(e) - j++ - } - } - out.Set(out.Slice(0, j)) - if iface.IsValid() { - iface.Set(out) - } - return true -} - -func (d *decoder) mapping(n *node, out reflect.Value) (good bool) { - switch out.Kind() { - case reflect.Struct: - return d.mappingStruct(n, out) - case reflect.Slice: - return d.mappingSlice(n, out) - case reflect.Map: - // okay - case reflect.Interface: - if d.mapType.Kind() == reflect.Map { - iface := out - out = reflect.MakeMap(d.mapType) - iface.Set(out) - } else { - slicev := reflect.New(d.mapType).Elem() - if !d.mappingSlice(n, slicev) { - return false - } - out.Set(slicev) - return true - } - default: - d.terror(n, yaml_MAP_TAG, out) - return false - } - outt := out.Type() - kt := outt.Key() - et := outt.Elem() - - mapType := d.mapType - if outt.Key() == ifaceType && outt.Elem() == ifaceType { - d.mapType = outt - } - - if out.IsNil() { - out.Set(reflect.MakeMap(outt)) - } - l := len(n.children) - for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) - continue - } - k := reflect.New(kt).Elem() - if d.unmarshal(n.children[i], k) { - kkind := k.Kind() - if kkind == reflect.Interface { - kkind = k.Elem().Kind() - } - if kkind == reflect.Map || kkind == reflect.Slice { - failf("invalid map key: %#v", k.Interface()) - } - e := reflect.New(et).Elem() - if d.unmarshal(n.children[i+1], e) { - out.SetMapIndex(k, e) - } - } - } - d.mapType = mapType - return true -} - -func (d *decoder) mappingSlice(n *node, out reflect.Value) (good bool) { - outt := out.Type() - if outt.Elem() != mapItemType { - d.terror(n, yaml_MAP_TAG, out) - return false - } - - mapType := d.mapType - d.mapType = outt - - var slice []MapItem - var l = len(n.children) - for i := 0; i < l; i += 2 { - if isMerge(n.children[i]) { - d.merge(n.children[i+1], out) - continue - } - item := MapItem{} - k := reflect.ValueOf(&item.Key).Elem() - if d.unmarshal(n.children[i], k) { - v := reflect.ValueOf(&item.Value).Elem() - if d.unmarshal(n.children[i+1], v) { - slice = append(slice, item) - } - } - } - out.Set(reflect.ValueOf(slice)) - d.mapType = mapType - return true -} - -func (d *decoder) mappingStruct(n *node, out reflect.Value) (good bool) { - sinfo, err := getStructInfo(out.Type()) - if err != nil { - panic(err) - } - name := settableValueOf("") - l := len(n.children) - - var inlineMap reflect.Value - var elemType reflect.Type - if sinfo.InlineMap != -1 { - inlineMap = out.Field(sinfo.InlineMap) - inlineMap.Set(reflect.New(inlineMap.Type()).Elem()) - elemType = inlineMap.Type().Elem() - } - - for i := 0; i < l; i += 2 { - ni := n.children[i] - if isMerge(ni) { - d.merge(n.children[i+1], out) - continue - } - if !d.unmarshal(ni, name) { - continue - } - if info, ok := sinfo.FieldsMap[name.String()]; ok { - var field reflect.Value - if info.Inline == nil { - field = out.Field(info.Num) - } else { - field = out.FieldByIndex(info.Inline) - } - d.unmarshal(n.children[i+1], field) - } else if sinfo.InlineMap != -1 { - if inlineMap.IsNil() { - inlineMap.Set(reflect.MakeMap(inlineMap.Type())) - } - value := reflect.New(elemType).Elem() - d.unmarshal(n.children[i+1], value) - inlineMap.SetMapIndex(name, value) - } else if d.strict { - d.terrors = append(d.terrors, fmt.Sprintf("line %d: field %s not found in struct %s", ni.line+1, name.String(), out.Type())) - } - } - return true -} - -func failWantMap() { - failf("map merge requires map or sequence of maps as the value") -} - -func (d *decoder) merge(n *node, out reflect.Value) { - switch n.kind { - case mappingNode: - d.unmarshal(n, out) - case aliasNode: - an, ok := d.doc.anchors[n.value] - if ok && an.kind != mappingNode { - failWantMap() - } - d.unmarshal(n, out) - case sequenceNode: - // Step backwards as earlier nodes take precedence. - for i := len(n.children) - 1; i >= 0; i-- { - ni := n.children[i] - if ni.kind == aliasNode { - an, ok := d.doc.anchors[ni.value] - if ok && an.kind != mappingNode { - failWantMap() - } - } else if ni.kind != mappingNode { - failWantMap() - } - d.unmarshal(ni, out) - } - default: - failWantMap() - } -} - -func isMerge(n *node) bool { - return n.kind == scalarNode && n.value == "<<" && (n.implicit == true || n.tag == yaml_MERGE_TAG) -} diff --git a/vendor/gopkg.in/yaml.v2/decode_test.go b/vendor/gopkg.in/yaml.v2/decode_test.go deleted file mode 100644 index e5366c2..0000000 --- a/vendor/gopkg.in/yaml.v2/decode_test.go +++ /dev/null @@ -1,1032 +0,0 @@ -package yaml_test - -import ( - "errors" - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" - "math" - "net" - "reflect" - "strings" - "time" -) - -var unmarshalIntTest = 123 - -var unmarshalTests = []struct { - data string - value interface{} -}{ - { - "", - &struct{}{}, - }, { - "{}", &struct{}{}, - }, { - "v: hi", - map[string]string{"v": "hi"}, - }, { - "v: hi", map[string]interface{}{"v": "hi"}, - }, { - "v: true", - map[string]string{"v": "true"}, - }, { - "v: true", - map[string]interface{}{"v": true}, - }, { - "v: 10", - map[string]interface{}{"v": 10}, - }, { - "v: 0b10", - map[string]interface{}{"v": 2}, - }, { - "v: 0xA", - map[string]interface{}{"v": 10}, - }, { - "v: 4294967296", - map[string]int64{"v": 4294967296}, - }, { - "v: 0.1", - map[string]interface{}{"v": 0.1}, - }, { - "v: .1", - map[string]interface{}{"v": 0.1}, - }, { - "v: .Inf", - map[string]interface{}{"v": math.Inf(+1)}, - }, { - "v: -.Inf", - map[string]interface{}{"v": math.Inf(-1)}, - }, { - "v: -10", - map[string]interface{}{"v": -10}, - }, { - "v: -.1", - map[string]interface{}{"v": -0.1}, - }, - - // Simple values. - { - "123", - &unmarshalIntTest, - }, - - // Floats from spec - { - "canonical: 6.8523e+5", - map[string]interface{}{"canonical": 6.8523e+5}, - }, { - "expo: 685.230_15e+03", - map[string]interface{}{"expo": 685.23015e+03}, - }, { - "fixed: 685_230.15", - map[string]interface{}{"fixed": 685230.15}, - }, { - "neginf: -.inf", - map[string]interface{}{"neginf": math.Inf(-1)}, - }, { - "fixed: 685_230.15", - map[string]float64{"fixed": 685230.15}, - }, - //{"sexa: 190:20:30.15", map[string]interface{}{"sexa": 0}}, // Unsupported - //{"notanum: .NaN", map[string]interface{}{"notanum": math.NaN()}}, // Equality of NaN fails. - - // Bools from spec - { - "canonical: y", - map[string]interface{}{"canonical": true}, - }, { - "answer: NO", - map[string]interface{}{"answer": false}, - }, { - "logical: True", - map[string]interface{}{"logical": true}, - }, { - "option: on", - map[string]interface{}{"option": true}, - }, { - "option: on", - map[string]bool{"option": true}, - }, - // Ints from spec - { - "canonical: 685230", - map[string]interface{}{"canonical": 685230}, - }, { - "decimal: +685_230", - map[string]interface{}{"decimal": 685230}, - }, { - "octal: 02472256", - map[string]interface{}{"octal": 685230}, - }, { - "hexa: 0x_0A_74_AE", - map[string]interface{}{"hexa": 685230}, - }, { - "bin: 0b1010_0111_0100_1010_1110", - map[string]interface{}{"bin": 685230}, - }, { - "bin: -0b101010", - map[string]interface{}{"bin": -42}, - }, { - "decimal: +685_230", - map[string]int{"decimal": 685230}, - }, - - //{"sexa: 190:20:30", map[string]interface{}{"sexa": 0}}, // Unsupported - - // Nulls from spec - { - "empty:", - map[string]interface{}{"empty": nil}, - }, { - "canonical: ~", - map[string]interface{}{"canonical": nil}, - }, { - "english: null", - map[string]interface{}{"english": nil}, - }, { - "~: null key", - map[interface{}]string{nil: "null key"}, - }, { - "empty:", - map[string]*bool{"empty": nil}, - }, - - // Flow sequence - { - "seq: [A,B]", - map[string]interface{}{"seq": []interface{}{"A", "B"}}, - }, { - "seq: [A,B,C,]", - map[string][]string{"seq": []string{"A", "B", "C"}}, - }, { - "seq: [A,1,C]", - map[string][]string{"seq": []string{"A", "1", "C"}}, - }, { - "seq: [A,1,C]", - map[string][]int{"seq": []int{1}}, - }, { - "seq: [A,1,C]", - map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, - }, - // Block sequence - { - "seq:\n - A\n - B", - map[string]interface{}{"seq": []interface{}{"A", "B"}}, - }, { - "seq:\n - A\n - B\n - C", - map[string][]string{"seq": []string{"A", "B", "C"}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string][]string{"seq": []string{"A", "1", "C"}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string][]int{"seq": []int{1}}, - }, { - "seq:\n - A\n - 1\n - C", - map[string]interface{}{"seq": []interface{}{"A", 1, "C"}}, - }, - - // Literal block scalar - { - "scalar: | # Comment\n\n literal\n\n \ttext\n\n", - map[string]string{"scalar": "\nliteral\n\n\ttext\n"}, - }, - - // Folded block scalar - { - "scalar: > # Comment\n\n folded\n line\n \n next\n line\n * one\n * two\n\n last\n line\n\n", - map[string]string{"scalar": "\nfolded line\nnext line\n * one\n * two\n\nlast line\n"}, - }, - - // Map inside interface with no type hints. - { - "a: {b: c}", - map[interface{}]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, - }, - - // Structs and type conversions. - { - "hello: world", - &struct{ Hello string }{"world"}, - }, { - "a: {b: c}", - &struct{ A struct{ B string } }{struct{ B string }{"c"}}, - }, { - "a: {b: c}", - &struct{ A *struct{ B string } }{&struct{ B string }{"c"}}, - }, { - "a: {b: c}", - &struct{ A map[string]string }{map[string]string{"b": "c"}}, - }, { - "a: {b: c}", - &struct{ A *map[string]string }{&map[string]string{"b": "c"}}, - }, { - "a:", - &struct{ A map[string]string }{}, - }, { - "a: 1", - &struct{ A int }{1}, - }, { - "a: 1", - &struct{ A float64 }{1}, - }, { - "a: 1.0", - &struct{ A int }{1}, - }, { - "a: 1.0", - &struct{ A uint }{1}, - }, { - "a: [1, 2]", - &struct{ A []int }{[]int{1, 2}}, - }, { - "a: 1", - &struct{ B int }{0}, - }, { - "a: 1", - &struct { - B int "a" - }{1}, - }, { - "a: y", - &struct{ A bool }{true}, - }, - - // Some cross type conversions - { - "v: 42", - map[string]uint{"v": 42}, - }, { - "v: -42", - map[string]uint{}, - }, { - "v: 4294967296", - map[string]uint64{"v": 4294967296}, - }, { - "v: -4294967296", - map[string]uint64{}, - }, - - // int - { - "int_max: 2147483647", - map[string]int{"int_max": math.MaxInt32}, - }, - { - "int_min: -2147483648", - map[string]int{"int_min": math.MinInt32}, - }, - { - "int_overflow: 9223372036854775808", // math.MaxInt64 + 1 - map[string]int{}, - }, - - // int64 - { - "int64_max: 9223372036854775807", - map[string]int64{"int64_max": math.MaxInt64}, - }, - { - "int64_max_base2: 0b111111111111111111111111111111111111111111111111111111111111111", - map[string]int64{"int64_max_base2": math.MaxInt64}, - }, - { - "int64_min: -9223372036854775808", - map[string]int64{"int64_min": math.MinInt64}, - }, - { - "int64_neg_base2: -0b111111111111111111111111111111111111111111111111111111111111111", - map[string]int64{"int64_neg_base2": -math.MaxInt64}, - }, - { - "int64_overflow: 9223372036854775808", // math.MaxInt64 + 1 - map[string]int64{}, - }, - - // uint - { - "uint_min: 0", - map[string]uint{"uint_min": 0}, - }, - { - "uint_max: 4294967295", - map[string]uint{"uint_max": math.MaxUint32}, - }, - { - "uint_underflow: -1", - map[string]uint{}, - }, - - // uint64 - { - "uint64_min: 0", - map[string]uint{"uint64_min": 0}, - }, - { - "uint64_max: 18446744073709551615", - map[string]uint64{"uint64_max": math.MaxUint64}, - }, - { - "uint64_max_base2: 0b1111111111111111111111111111111111111111111111111111111111111111", - map[string]uint64{"uint64_max_base2": math.MaxUint64}, - }, - { - "uint64_maxint64: 9223372036854775807", - map[string]uint64{"uint64_maxint64": math.MaxInt64}, - }, - { - "uint64_underflow: -1", - map[string]uint64{}, - }, - - // float32 - { - "float32_max: 3.40282346638528859811704183484516925440e+38", - map[string]float32{"float32_max": math.MaxFloat32}, - }, - { - "float32_nonzero: 1.401298464324817070923729583289916131280e-45", - map[string]float32{"float32_nonzero": math.SmallestNonzeroFloat32}, - }, - { - "float32_maxuint64: 18446744073709551615", - map[string]float32{"float32_maxuint64": float32(math.MaxUint64)}, - }, - { - "float32_maxuint64+1: 18446744073709551616", - map[string]float32{"float32_maxuint64+1": float32(math.MaxUint64 + 1)}, - }, - - // float64 - { - "float64_max: 1.797693134862315708145274237317043567981e+308", - map[string]float64{"float64_max": math.MaxFloat64}, - }, - { - "float64_nonzero: 4.940656458412465441765687928682213723651e-324", - map[string]float64{"float64_nonzero": math.SmallestNonzeroFloat64}, - }, - { - "float64_maxuint64: 18446744073709551615", - map[string]float64{"float64_maxuint64": float64(math.MaxUint64)}, - }, - { - "float64_maxuint64+1: 18446744073709551616", - map[string]float64{"float64_maxuint64+1": float64(math.MaxUint64 + 1)}, - }, - - // Overflow cases. - { - "v: 4294967297", - map[string]int32{}, - }, { - "v: 128", - map[string]int8{}, - }, - - // Quoted values. - { - "'1': '\"2\"'", - map[interface{}]interface{}{"1": "\"2\""}, - }, { - "v:\n- A\n- 'B\n\n C'\n", - map[string][]string{"v": []string{"A", "B\nC"}}, - }, - - // Explicit tags. - { - "v: !!float '1.1'", - map[string]interface{}{"v": 1.1}, - }, { - "v: !!null ''", - map[string]interface{}{"v": nil}, - }, { - "%TAG !y! tag:yaml.org,2002:\n---\nv: !y!int '1'", - map[string]interface{}{"v": 1}, - }, - - // Non-specific tag (Issue #75) - { - "v: ! test", - map[string]interface{}{"v": "test"}, - }, - - // Anchors and aliases. - { - "a: &x 1\nb: &y 2\nc: *x\nd: *y\n", - &struct{ A, B, C, D int }{1, 2, 1, 2}, - }, { - "a: &a {c: 1}\nb: *a", - &struct { - A, B struct { - C int - } - }{struct{ C int }{1}, struct{ C int }{1}}, - }, { - "a: &a [1, 2]\nb: *a", - &struct{ B []int }{[]int{1, 2}}, - }, { - "b: *a\na: &a {c: 1}", - &struct { - A, B struct { - C int - } - }{struct{ C int }{1}, struct{ C int }{1}}, - }, - - // Bug #1133337 - { - "foo: ''", - map[string]*string{"foo": new(string)}, - }, { - "foo: null", - map[string]*string{"foo": nil}, - }, { - "foo: null", - map[string]string{"foo": ""}, - }, { - "foo: null", - map[string]interface{}{"foo": nil}, - }, - - // Support for ~ - { - "foo: ~", - map[string]*string{"foo": nil}, - }, { - "foo: ~", - map[string]string{"foo": ""}, - }, { - "foo: ~", - map[string]interface{}{"foo": nil}, - }, - - // Ignored field - { - "a: 1\nb: 2\n", - &struct { - A int - B int "-" - }{1, 0}, - }, - - // Bug #1191981 - { - "" + - "%YAML 1.1\n" + - "--- !!str\n" + - `"Generic line break (no glyph)\n\` + "\n" + - ` Generic line break (glyphed)\n\` + "\n" + - ` Line separator\u2028\` + "\n" + - ` Paragraph separator\u2029"` + "\n", - "" + - "Generic line break (no glyph)\n" + - "Generic line break (glyphed)\n" + - "Line separator\u2028Paragraph separator\u2029", - }, - - // Struct inlining - { - "a: 1\nb: 2\nc: 3\n", - &struct { - A int - C inlineB `yaml:",inline"` - }{1, inlineB{2, inlineC{3}}}, - }, - - // Map inlining - { - "a: 1\nb: 2\nc: 3\n", - &struct { - A int - C map[string]int `yaml:",inline"` - }{1, map[string]int{"b": 2, "c": 3}}, - }, - - // bug 1243827 - { - "a: -b_c", - map[string]interface{}{"a": "-b_c"}, - }, - { - "a: +b_c", - map[string]interface{}{"a": "+b_c"}, - }, - { - "a: 50cent_of_dollar", - map[string]interface{}{"a": "50cent_of_dollar"}, - }, - - // Duration - { - "a: 3s", - map[string]time.Duration{"a": 3 * time.Second}, - }, - - // Issue #24. - { - "a: ", - map[string]string{"a": ""}, - }, - - // Base 60 floats are obsolete and unsupported. - { - "a: 1:1\n", - map[string]string{"a": "1:1"}, - }, - - // Binary data. - { - "a: !!binary gIGC\n", - map[string]string{"a": "\x80\x81\x82"}, - }, { - "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", - map[string]string{"a": strings.Repeat("\x90", 54)}, - }, { - "a: !!binary |\n " + strings.Repeat("A", 70) + "\n ==\n", - map[string]string{"a": strings.Repeat("\x00", 52)}, - }, - - // Ordered maps. - { - "{b: 2, a: 1, d: 4, c: 3, sub: {e: 5}}", - &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, - }, - - // Issue #39. - { - "a:\n b:\n c: d\n", - map[string]struct{ B interface{} }{"a": {map[interface{}]interface{}{"c": "d"}}}, - }, - - // Custom map type. - { - "a: {b: c}", - M{"a": M{"b": "c"}}, - }, - - // Support encoding.TextUnmarshaler. - { - "a: 1.2.3.4\n", - map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, - }, - { - "a: 2015-02-24T18:19:39Z\n", - map[string]time.Time{"a": time.Unix(1424801979, 0).In(time.UTC)}, - }, - - // Encode empty lists as zero-length slices. - { - "a: []", - &struct{ A []int }{[]int{}}, - }, - - // UTF-16-LE - { - "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n\x00", - M{"ñoño": "very yes"}, - }, - // UTF-16-LE with surrogate. - { - "\xff\xfe\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \x00=\xd8\xd4\xdf\n\x00", - M{"ñoño": "very yes 🟔"}, - }, - - // UTF-16-BE - { - "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00\n", - M{"ñoño": "very yes"}, - }, - // UTF-16-BE with surrogate. - { - "\xfe\xff\x00\xf1\x00o\x00\xf1\x00o\x00:\x00 \x00v\x00e\x00r\x00y\x00 \x00y\x00e\x00s\x00 \xd8=\xdf\xd4\x00\n", - M{"ñoño": "very yes 🟔"}, - }, - - // YAML Float regex shouldn't match this - { - "a: 123456e1\n", - M{"a": "123456e1"}, - }, { - "a: 123456E1\n", - M{"a": "123456E1"}, - }, -} - -type M map[interface{}]interface{} - -type inlineB struct { - B int - inlineC `yaml:",inline"` -} - -type inlineC struct { - C int -} - -func (s *S) TestUnmarshal(c *C) { - for i, item := range unmarshalTests { - c.Logf("test %d: %q", i, item.data) - t := reflect.ValueOf(item.value).Type() - var value interface{} - switch t.Kind() { - case reflect.Map: - value = reflect.MakeMap(t).Interface() - case reflect.String: - value = reflect.New(t).Interface() - case reflect.Ptr: - value = reflect.New(t.Elem()).Interface() - default: - c.Fatalf("missing case for %s", t) - } - err := yaml.Unmarshal([]byte(item.data), value) - if _, ok := err.(*yaml.TypeError); !ok { - c.Assert(err, IsNil) - } - if t.Kind() == reflect.String { - c.Assert(*value.(*string), Equals, item.value) - } else { - c.Assert(value, DeepEquals, item.value) - } - } -} - -func (s *S) TestUnmarshalNaN(c *C) { - value := map[string]interface{}{} - err := yaml.Unmarshal([]byte("notanum: .NaN"), &value) - c.Assert(err, IsNil) - c.Assert(math.IsNaN(value["notanum"].(float64)), Equals, true) -} - -var unmarshalErrorTests = []struct { - data, error string -}{ - {"v: !!float 'error'", "yaml: cannot decode !!str `error` as a !!float"}, - {"v: [A,", "yaml: line 1: did not find expected node content"}, - {"v:\n- [A,", "yaml: line 2: did not find expected node content"}, - {"a: *b\n", "yaml: unknown anchor 'b' referenced"}, - {"a: &a\n b: *a\n", "yaml: anchor 'a' value contains itself"}, - {"value: -", "yaml: block sequence entries are not allowed in this context"}, - {"a: !!binary ==", "yaml: !!binary value contains invalid base64 data"}, - {"{[.]}", `yaml: invalid map key: \[\]interface \{\}\{"\."\}`}, - {"{{.}}", `yaml: invalid map key: map\[interface\ \{\}\]interface \{\}\{".":interface \{\}\(nil\)\}`}, - {"%TAG !%79! tag:yaml.org,2002:\n---\nv: !%79!int '1'", "yaml: did not find expected whitespace"}, -} - -func (s *S) TestUnmarshalErrors(c *C) { - for _, item := range unmarshalErrorTests { - var value interface{} - err := yaml.Unmarshal([]byte(item.data), &value) - c.Assert(err, ErrorMatches, item.error, Commentf("Partial unmarshal: %#v", value)) - } -} - -var unmarshalerTests = []struct { - data, tag string - value interface{} -}{ - {"_: {hi: there}", "!!map", map[interface{}]interface{}{"hi": "there"}}, - {"_: [1,A]", "!!seq", []interface{}{1, "A"}}, - {"_: 10", "!!int", 10}, - {"_: null", "!!null", nil}, - {`_: BAR!`, "!!str", "BAR!"}, - {`_: "BAR!"`, "!!str", "BAR!"}, - {"_: !!foo 'BAR!'", "!!foo", "BAR!"}, - {`_: ""`, "!!str", ""}, -} - -var unmarshalerResult = map[int]error{} - -type unmarshalerType struct { - value interface{} -} - -func (o *unmarshalerType) UnmarshalYAML(unmarshal func(v interface{}) error) error { - if err := unmarshal(&o.value); err != nil { - return err - } - if i, ok := o.value.(int); ok { - if result, ok := unmarshalerResult[i]; ok { - return result - } - } - return nil -} - -type unmarshalerPointer struct { - Field *unmarshalerType "_" -} - -type unmarshalerValue struct { - Field unmarshalerType "_" -} - -func (s *S) TestUnmarshalerPointerField(c *C) { - for _, item := range unmarshalerTests { - obj := &unmarshalerPointer{} - err := yaml.Unmarshal([]byte(item.data), obj) - c.Assert(err, IsNil) - if item.value == nil { - c.Assert(obj.Field, IsNil) - } else { - c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) - c.Assert(obj.Field.value, DeepEquals, item.value) - } - } -} - -func (s *S) TestUnmarshalerValueField(c *C) { - for _, item := range unmarshalerTests { - obj := &unmarshalerValue{} - err := yaml.Unmarshal([]byte(item.data), obj) - c.Assert(err, IsNil) - c.Assert(obj.Field, NotNil, Commentf("Pointer not initialized (%#v)", item.value)) - c.Assert(obj.Field.value, DeepEquals, item.value) - } -} - -func (s *S) TestUnmarshalerWholeDocument(c *C) { - obj := &unmarshalerType{} - err := yaml.Unmarshal([]byte(unmarshalerTests[0].data), obj) - c.Assert(err, IsNil) - value, ok := obj.value.(map[interface{}]interface{}) - c.Assert(ok, Equals, true, Commentf("value: %#v", obj.value)) - c.Assert(value["_"], DeepEquals, unmarshalerTests[0].value) -} - -func (s *S) TestUnmarshalerTypeError(c *C) { - unmarshalerResult[2] = &yaml.TypeError{[]string{"foo"}} - unmarshalerResult[4] = &yaml.TypeError{[]string{"bar"}} - defer func() { - delete(unmarshalerResult, 2) - delete(unmarshalerResult, 4) - }() - - type T struct { - Before int - After int - M map[string]*unmarshalerType - } - var v T - data := `{before: A, m: {abc: 1, def: 2, ghi: 3, jkl: 4}, after: B}` - err := yaml.Unmarshal([]byte(data), &v) - c.Assert(err, ErrorMatches, ""+ - "yaml: unmarshal errors:\n"+ - " line 1: cannot unmarshal !!str `A` into int\n"+ - " foo\n"+ - " bar\n"+ - " line 1: cannot unmarshal !!str `B` into int") - c.Assert(v.M["abc"], NotNil) - c.Assert(v.M["def"], IsNil) - c.Assert(v.M["ghi"], NotNil) - c.Assert(v.M["jkl"], IsNil) - - c.Assert(v.M["abc"].value, Equals, 1) - c.Assert(v.M["ghi"].value, Equals, 3) -} - -type proxyTypeError struct{} - -func (v *proxyTypeError) UnmarshalYAML(unmarshal func(interface{}) error) error { - var s string - var a int32 - var b int64 - if err := unmarshal(&s); err != nil { - panic(err) - } - if s == "a" { - if err := unmarshal(&b); err == nil { - panic("should have failed") - } - return unmarshal(&a) - } - if err := unmarshal(&a); err == nil { - panic("should have failed") - } - return unmarshal(&b) -} - -func (s *S) TestUnmarshalerTypeErrorProxying(c *C) { - type T struct { - Before int - After int - M map[string]*proxyTypeError - } - var v T - data := `{before: A, m: {abc: a, def: b}, after: B}` - err := yaml.Unmarshal([]byte(data), &v) - c.Assert(err, ErrorMatches, ""+ - "yaml: unmarshal errors:\n"+ - " line 1: cannot unmarshal !!str `A` into int\n"+ - " line 1: cannot unmarshal !!str `a` into int32\n"+ - " line 1: cannot unmarshal !!str `b` into int64\n"+ - " line 1: cannot unmarshal !!str `B` into int") -} - -type failingUnmarshaler struct{} - -var failingErr = errors.New("failingErr") - -func (ft *failingUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { - return failingErr -} - -func (s *S) TestUnmarshalerError(c *C) { - err := yaml.Unmarshal([]byte("a: b"), &failingUnmarshaler{}) - c.Assert(err, Equals, failingErr) -} - -type sliceUnmarshaler []int - -func (su *sliceUnmarshaler) UnmarshalYAML(unmarshal func(interface{}) error) error { - var slice []int - err := unmarshal(&slice) - if err == nil { - *su = slice - return nil - } - - var intVal int - err = unmarshal(&intVal) - if err == nil { - *su = []int{intVal} - return nil - } - - return err -} - -func (s *S) TestUnmarshalerRetry(c *C) { - var su sliceUnmarshaler - err := yaml.Unmarshal([]byte("[1, 2, 3]"), &su) - c.Assert(err, IsNil) - c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1, 2, 3})) - - err = yaml.Unmarshal([]byte("1"), &su) - c.Assert(err, IsNil) - c.Assert(su, DeepEquals, sliceUnmarshaler([]int{1})) -} - -// From http://yaml.org/type/merge.html -var mergeTests = ` -anchors: - list: - - &CENTER { "x": 1, "y": 2 } - - &LEFT { "x": 0, "y": 2 } - - &BIG { "r": 10 } - - &SMALL { "r": 1 } - -# All the following maps are equal: - -plain: - # Explicit keys - "x": 1 - "y": 2 - "r": 10 - label: center/big - -mergeOne: - # Merge one map - << : *CENTER - "r": 10 - label: center/big - -mergeMultiple: - # Merge multiple maps - << : [ *CENTER, *BIG ] - label: center/big - -override: - # Override - << : [ *BIG, *LEFT, *SMALL ] - "x": 1 - label: center/big - -shortTag: - # Explicit short merge tag - !!merge "<<" : [ *CENTER, *BIG ] - label: center/big - -longTag: - # Explicit merge long tag - ! "<<" : [ *CENTER, *BIG ] - label: center/big - -inlineMap: - # Inlined map - << : {"x": 1, "y": 2, "r": 10} - label: center/big - -inlineSequenceMap: - # Inlined map in sequence - << : [ *CENTER, {"r": 10} ] - label: center/big -` - -func (s *S) TestMerge(c *C) { - var want = map[interface{}]interface{}{ - "x": 1, - "y": 2, - "r": 10, - "label": "center/big", - } - - var m map[interface{}]interface{} - err := yaml.Unmarshal([]byte(mergeTests), &m) - c.Assert(err, IsNil) - for name, test := range m { - if name == "anchors" { - continue - } - c.Assert(test, DeepEquals, want, Commentf("test %q failed", name)) - } -} - -func (s *S) TestMergeStruct(c *C) { - type Data struct { - X, Y, R int - Label string - } - want := Data{1, 2, 10, "center/big"} - - var m map[string]Data - err := yaml.Unmarshal([]byte(mergeTests), &m) - c.Assert(err, IsNil) - for name, test := range m { - if name == "anchors" { - continue - } - c.Assert(test, Equals, want, Commentf("test %q failed", name)) - } -} - -var unmarshalNullTests = []func() interface{}{ - func() interface{} { var v interface{}; v = "v"; return &v }, - func() interface{} { var s = "s"; return &s }, - func() interface{} { var s = "s"; sptr := &s; return &sptr }, - func() interface{} { var i = 1; return &i }, - func() interface{} { var i = 1; iptr := &i; return &iptr }, - func() interface{} { m := map[string]int{"s": 1}; return &m }, - func() interface{} { m := map[string]int{"s": 1}; return m }, -} - -func (s *S) TestUnmarshalNull(c *C) { - for _, test := range unmarshalNullTests { - item := test() - zero := reflect.Zero(reflect.TypeOf(item).Elem()).Interface() - err := yaml.Unmarshal([]byte("null"), item) - c.Assert(err, IsNil) - if reflect.TypeOf(item).Kind() == reflect.Map { - c.Assert(reflect.ValueOf(item).Interface(), DeepEquals, reflect.MakeMap(reflect.TypeOf(item)).Interface()) - } else { - c.Assert(reflect.ValueOf(item).Elem().Interface(), DeepEquals, zero) - } - } -} - -func (s *S) TestUnmarshalSliceOnPreset(c *C) { - // Issue #48. - v := struct{ A []int }{[]int{1}} - yaml.Unmarshal([]byte("a: [2]"), &v) - c.Assert(v.A, DeepEquals, []int{2}) -} - -func (s *S) TestUnmarshalStrict(c *C) { - v := struct{ A, B int }{} - - err := yaml.UnmarshalStrict([]byte("a: 1\nb: 2"), &v) - c.Check(err, IsNil) - err = yaml.Unmarshal([]byte("a: 1\nb: 2\nc: 3"), &v) - c.Check(err, IsNil) - err = yaml.UnmarshalStrict([]byte("a: 1\nb: 2\nc: 3"), &v) - c.Check(err, ErrorMatches, "yaml: unmarshal errors:\n line 3: field c not found in struct struct { A int; B int }") -} - -//var data []byte -//func init() { -// var err error -// data, err = ioutil.ReadFile("/tmp/file.yaml") -// if err != nil { -// panic(err) -// } -//} -// -//func (s *S) BenchmarkUnmarshal(c *C) { -// var err error -// for i := 0; i < c.N; i++ { -// var v map[string]interface{} -// err = yaml.Unmarshal(data, &v) -// } -// if err != nil { -// panic(err) -// } -//} -// -//func (s *S) BenchmarkMarshal(c *C) { -// var v map[string]interface{} -// yaml.Unmarshal(data, &v) -// c.ResetTimer() -// for i := 0; i < c.N; i++ { -// yaml.Marshal(&v) -// } -//} diff --git a/vendor/gopkg.in/yaml.v2/emitterc.go b/vendor/gopkg.in/yaml.v2/emitterc.go deleted file mode 100644 index dcaf502..0000000 --- a/vendor/gopkg.in/yaml.v2/emitterc.go +++ /dev/null @@ -1,1684 +0,0 @@ -package yaml - -import ( - "bytes" -) - -// Flush the buffer if needed. -func flush(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) { - return yaml_emitter_flush(emitter) - } - return true -} - -// Put a character to the output buffer. -func put(emitter *yaml_emitter_t, value byte) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - emitter.buffer[emitter.buffer_pos] = value - emitter.buffer_pos++ - emitter.column++ - return true -} - -// Put a line break to the output buffer. -func put_break(emitter *yaml_emitter_t) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - switch emitter.line_break { - case yaml_CR_BREAK: - emitter.buffer[emitter.buffer_pos] = '\r' - emitter.buffer_pos += 1 - case yaml_LN_BREAK: - emitter.buffer[emitter.buffer_pos] = '\n' - emitter.buffer_pos += 1 - case yaml_CRLN_BREAK: - emitter.buffer[emitter.buffer_pos+0] = '\r' - emitter.buffer[emitter.buffer_pos+1] = '\n' - emitter.buffer_pos += 2 - default: - panic("unknown line break setting") - } - emitter.column = 0 - emitter.line++ - return true -} - -// Copy a character from a string into buffer. -func write(emitter *yaml_emitter_t, s []byte, i *int) bool { - if emitter.buffer_pos+5 >= len(emitter.buffer) && !yaml_emitter_flush(emitter) { - return false - } - p := emitter.buffer_pos - w := width(s[*i]) - switch w { - case 4: - emitter.buffer[p+3] = s[*i+3] - fallthrough - case 3: - emitter.buffer[p+2] = s[*i+2] - fallthrough - case 2: - emitter.buffer[p+1] = s[*i+1] - fallthrough - case 1: - emitter.buffer[p+0] = s[*i+0] - default: - panic("unknown character width") - } - emitter.column++ - emitter.buffer_pos += w - *i += w - return true -} - -// Write a whole string into buffer. -func write_all(emitter *yaml_emitter_t, s []byte) bool { - for i := 0; i < len(s); { - if !write(emitter, s, &i) { - return false - } - } - return true -} - -// Copy a line break character from a string into buffer. -func write_break(emitter *yaml_emitter_t, s []byte, i *int) bool { - if s[*i] == '\n' { - if !put_break(emitter) { - return false - } - *i++ - } else { - if !write(emitter, s, i) { - return false - } - emitter.column = 0 - emitter.line++ - } - return true -} - -// Set an emitter error and return false. -func yaml_emitter_set_emitter_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_EMITTER_ERROR - emitter.problem = problem - return false -} - -// Emit an event. -func yaml_emitter_emit(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.events = append(emitter.events, *event) - for !yaml_emitter_need_more_events(emitter) { - event := &emitter.events[emitter.events_head] - if !yaml_emitter_analyze_event(emitter, event) { - return false - } - if !yaml_emitter_state_machine(emitter, event) { - return false - } - yaml_event_delete(event) - emitter.events_head++ - } - return true -} - -// Check if we need to accumulate more events before emitting. -// -// We accumulate extra -// - 1 event for DOCUMENT-START -// - 2 events for SEQUENCE-START -// - 3 events for MAPPING-START -// -func yaml_emitter_need_more_events(emitter *yaml_emitter_t) bool { - if emitter.events_head == len(emitter.events) { - return true - } - var accumulate int - switch emitter.events[emitter.events_head].typ { - case yaml_DOCUMENT_START_EVENT: - accumulate = 1 - break - case yaml_SEQUENCE_START_EVENT: - accumulate = 2 - break - case yaml_MAPPING_START_EVENT: - accumulate = 3 - break - default: - return false - } - if len(emitter.events)-emitter.events_head > accumulate { - return false - } - var level int - for i := emitter.events_head; i < len(emitter.events); i++ { - switch emitter.events[i].typ { - case yaml_STREAM_START_EVENT, yaml_DOCUMENT_START_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT: - level++ - case yaml_STREAM_END_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_END_EVENT, yaml_MAPPING_END_EVENT: - level-- - } - if level == 0 { - return false - } - } - return true -} - -// Append a directive to the directives stack. -func yaml_emitter_append_tag_directive(emitter *yaml_emitter_t, value *yaml_tag_directive_t, allow_duplicates bool) bool { - for i := 0; i < len(emitter.tag_directives); i++ { - if bytes.Equal(value.handle, emitter.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_emitter_set_emitter_error(emitter, "duplicate %TAG directive") - } - } - - // [Go] Do we actually need to copy this given garbage collection - // and the lack of deallocating destructors? - tag_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(tag_copy.handle, value.handle) - copy(tag_copy.prefix, value.prefix) - emitter.tag_directives = append(emitter.tag_directives, tag_copy) - return true -} - -// Increase the indentation level. -func yaml_emitter_increase_indent(emitter *yaml_emitter_t, flow, indentless bool) bool { - emitter.indents = append(emitter.indents, emitter.indent) - if emitter.indent < 0 { - if flow { - emitter.indent = emitter.best_indent - } else { - emitter.indent = 0 - } - } else if !indentless { - emitter.indent += emitter.best_indent - } - return true -} - -// State dispatcher. -func yaml_emitter_state_machine(emitter *yaml_emitter_t, event *yaml_event_t) bool { - switch emitter.state { - default: - case yaml_EMIT_STREAM_START_STATE: - return yaml_emitter_emit_stream_start(emitter, event) - - case yaml_EMIT_FIRST_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, true) - - case yaml_EMIT_DOCUMENT_START_STATE: - return yaml_emitter_emit_document_start(emitter, event, false) - - case yaml_EMIT_DOCUMENT_CONTENT_STATE: - return yaml_emitter_emit_document_content(emitter, event) - - case yaml_EMIT_DOCUMENT_END_STATE: - return yaml_emitter_emit_document_end(emitter, event) - - case yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, true) - - case yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_flow_sequence_item(emitter, event, false) - - case yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, true) - - case yaml_EMIT_FLOW_MAPPING_KEY_STATE: - return yaml_emitter_emit_flow_mapping_key(emitter, event, false) - - case yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, true) - - case yaml_EMIT_FLOW_MAPPING_VALUE_STATE: - return yaml_emitter_emit_flow_mapping_value(emitter, event, false) - - case yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, true) - - case yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE: - return yaml_emitter_emit_block_sequence_item(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_KEY_STATE: - return yaml_emitter_emit_block_mapping_key(emitter, event, false) - - case yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, true) - - case yaml_EMIT_BLOCK_MAPPING_VALUE_STATE: - return yaml_emitter_emit_block_mapping_value(emitter, event, false) - - case yaml_EMIT_END_STATE: - return yaml_emitter_set_emitter_error(emitter, "expected nothing after STREAM-END") - } - panic("invalid emitter state") -} - -// Expect STREAM-START. -func yaml_emitter_emit_stream_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_STREAM_START_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected STREAM-START") - } - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = event.encoding - if emitter.encoding == yaml_ANY_ENCODING { - emitter.encoding = yaml_UTF8_ENCODING - } - } - if emitter.best_indent < 2 || emitter.best_indent > 9 { - emitter.best_indent = 2 - } - if emitter.best_width >= 0 && emitter.best_width <= emitter.best_indent*2 { - emitter.best_width = 80 - } - if emitter.best_width < 0 { - emitter.best_width = 1<<31 - 1 - } - if emitter.line_break == yaml_ANY_BREAK { - emitter.line_break = yaml_LN_BREAK - } - - emitter.indent = -1 - emitter.line = 0 - emitter.column = 0 - emitter.whitespace = true - emitter.indention = true - - if emitter.encoding != yaml_UTF8_ENCODING { - if !yaml_emitter_write_bom(emitter) { - return false - } - } - emitter.state = yaml_EMIT_FIRST_DOCUMENT_START_STATE - return true -} - -// Expect DOCUMENT-START or STREAM-END. -func yaml_emitter_emit_document_start(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - - if event.typ == yaml_DOCUMENT_START_EVENT { - - if event.version_directive != nil { - if !yaml_emitter_analyze_version_directive(emitter, event.version_directive) { - return false - } - } - - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_analyze_tag_directive(emitter, tag_directive) { - return false - } - if !yaml_emitter_append_tag_directive(emitter, tag_directive, false) { - return false - } - } - - for i := 0; i < len(default_tag_directives); i++ { - tag_directive := &default_tag_directives[i] - if !yaml_emitter_append_tag_directive(emitter, tag_directive, true) { - return false - } - } - - implicit := event.implicit - if !first || emitter.canonical { - implicit = false - } - - if emitter.open_ended && (event.version_directive != nil || len(event.tag_directives) > 0) { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if event.version_directive != nil { - implicit = false - if !yaml_emitter_write_indicator(emitter, []byte("%YAML"), true, false, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("1.1"), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if len(event.tag_directives) > 0 { - implicit = false - for i := 0; i < len(event.tag_directives); i++ { - tag_directive := &event.tag_directives[i] - if !yaml_emitter_write_indicator(emitter, []byte("%TAG"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_handle(emitter, tag_directive.handle) { - return false - } - if !yaml_emitter_write_tag_content(emitter, tag_directive.prefix, true) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - if yaml_emitter_check_empty_document(emitter) { - implicit = false - } - if !implicit { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte("---"), true, false, false) { - return false - } - if emitter.canonical { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - } - - emitter.state = yaml_EMIT_DOCUMENT_CONTENT_STATE - return true - } - - if event.typ == yaml_STREAM_END_EVENT { - if emitter.open_ended { - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_END_STATE - return true - } - - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-START or STREAM-END") -} - -// Expect the root node. -func yaml_emitter_emit_document_content(emitter *yaml_emitter_t, event *yaml_event_t) bool { - emitter.states = append(emitter.states, yaml_EMIT_DOCUMENT_END_STATE) - return yaml_emitter_emit_node(emitter, event, true, false, false, false) -} - -// Expect DOCUMENT-END. -func yaml_emitter_emit_document_end(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if event.typ != yaml_DOCUMENT_END_EVENT { - return yaml_emitter_set_emitter_error(emitter, "expected DOCUMENT-END") - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !event.implicit { - // [Go] Allocate the slice elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("..."), true, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_flush(emitter) { - return false - } - emitter.state = yaml_EMIT_DOCUMENT_START_STATE - emitter.tag_directives = emitter.tag_directives[:0] - return true -} - -// Expect a flow item node. -func yaml_emitter_emit_flow_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'['}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{']'}, false, false, false) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - - return true - } - - if !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) -} - -// Expect a flow key node. -func yaml_emitter_emit_flow_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_write_indicator(emitter, []byte{'{'}, true, true, false) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - emitter.flow_level++ - } - - if event.typ == yaml_MAPPING_END_EVENT { - emitter.flow_level-- - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - if emitter.canonical && !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'}'}, false, false, false) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - - if !first { - if !yaml_emitter_write_indicator(emitter, []byte{','}, false, false, false) { - return false - } - } - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - - if !emitter.canonical && yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, false) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a flow value node. -func yaml_emitter_emit_flow_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if emitter.canonical || emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, false) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_FLOW_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a block item node. -func yaml_emitter_emit_block_sequence_item(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, emitter.mapping_context && !emitter.indention) { - return false - } - } - if event.typ == yaml_SEQUENCE_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'-'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE) - return yaml_emitter_emit_node(emitter, event, false, true, false, false) -} - -// Expect a block key node. -func yaml_emitter_emit_block_mapping_key(emitter *yaml_emitter_t, event *yaml_event_t, first bool) bool { - if first { - if !yaml_emitter_increase_indent(emitter, false, false) { - return false - } - } - if event.typ == yaml_MAPPING_END_EVENT { - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true - } - if !yaml_emitter_write_indent(emitter) { - return false - } - if yaml_emitter_check_simple_key(emitter) { - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, true) - } - if !yaml_emitter_write_indicator(emitter, []byte{'?'}, true, false, true) { - return false - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_VALUE_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a block value node. -func yaml_emitter_emit_block_mapping_value(emitter *yaml_emitter_t, event *yaml_event_t, simple bool) bool { - if simple { - if !yaml_emitter_write_indicator(emitter, []byte{':'}, false, false, false) { - return false - } - } else { - if !yaml_emitter_write_indent(emitter) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{':'}, true, false, true) { - return false - } - } - emitter.states = append(emitter.states, yaml_EMIT_BLOCK_MAPPING_KEY_STATE) - return yaml_emitter_emit_node(emitter, event, false, false, true, false) -} - -// Expect a node. -func yaml_emitter_emit_node(emitter *yaml_emitter_t, event *yaml_event_t, - root bool, sequence bool, mapping bool, simple_key bool) bool { - - emitter.root_context = root - emitter.sequence_context = sequence - emitter.mapping_context = mapping - emitter.simple_key_context = simple_key - - switch event.typ { - case yaml_ALIAS_EVENT: - return yaml_emitter_emit_alias(emitter, event) - case yaml_SCALAR_EVENT: - return yaml_emitter_emit_scalar(emitter, event) - case yaml_SEQUENCE_START_EVENT: - return yaml_emitter_emit_sequence_start(emitter, event) - case yaml_MAPPING_START_EVENT: - return yaml_emitter_emit_mapping_start(emitter, event) - default: - return yaml_emitter_set_emitter_error(emitter, - "expected SCALAR, SEQUENCE-START, MAPPING-START, or ALIAS") - } -} - -// Expect ALIAS. -func yaml_emitter_emit_alias(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SCALAR. -func yaml_emitter_emit_scalar(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_select_scalar_style(emitter, event) { - return false - } - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if !yaml_emitter_increase_indent(emitter, true, false) { - return false - } - if !yaml_emitter_process_scalar(emitter) { - return false - } - emitter.indent = emitter.indents[len(emitter.indents)-1] - emitter.indents = emitter.indents[:len(emitter.indents)-1] - emitter.state = emitter.states[len(emitter.states)-1] - emitter.states = emitter.states[:len(emitter.states)-1] - return true -} - -// Expect SEQUENCE-START. -func yaml_emitter_emit_sequence_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.sequence_style() == yaml_FLOW_SEQUENCE_STYLE || - yaml_emitter_check_empty_sequence(emitter) { - emitter.state = yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE - } - return true -} - -// Expect MAPPING-START. -func yaml_emitter_emit_mapping_start(emitter *yaml_emitter_t, event *yaml_event_t) bool { - if !yaml_emitter_process_anchor(emitter) { - return false - } - if !yaml_emitter_process_tag(emitter) { - return false - } - if emitter.flow_level > 0 || emitter.canonical || event.mapping_style() == yaml_FLOW_MAPPING_STYLE || - yaml_emitter_check_empty_mapping(emitter) { - emitter.state = yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE - } else { - emitter.state = yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE - } - return true -} - -// Check if the document content is an empty scalar. -func yaml_emitter_check_empty_document(emitter *yaml_emitter_t) bool { - return false // [Go] Huh? -} - -// Check if the next events represent an empty sequence. -func yaml_emitter_check_empty_sequence(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_SEQUENCE_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_SEQUENCE_END_EVENT -} - -// Check if the next events represent an empty mapping. -func yaml_emitter_check_empty_mapping(emitter *yaml_emitter_t) bool { - if len(emitter.events)-emitter.events_head < 2 { - return false - } - return emitter.events[emitter.events_head].typ == yaml_MAPPING_START_EVENT && - emitter.events[emitter.events_head+1].typ == yaml_MAPPING_END_EVENT -} - -// Check if the next node can be expressed as a simple key. -func yaml_emitter_check_simple_key(emitter *yaml_emitter_t) bool { - length := 0 - switch emitter.events[emitter.events_head].typ { - case yaml_ALIAS_EVENT: - length += len(emitter.anchor_data.anchor) - case yaml_SCALAR_EVENT: - if emitter.scalar_data.multiline { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) + - len(emitter.scalar_data.value) - case yaml_SEQUENCE_START_EVENT: - if !yaml_emitter_check_empty_sequence(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - case yaml_MAPPING_START_EVENT: - if !yaml_emitter_check_empty_mapping(emitter) { - return false - } - length += len(emitter.anchor_data.anchor) + - len(emitter.tag_data.handle) + - len(emitter.tag_data.suffix) - default: - return false - } - return length <= 128 -} - -// Determine an acceptable scalar style. -func yaml_emitter_select_scalar_style(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - no_tag := len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 - if no_tag && !event.implicit && !event.quoted_implicit { - return yaml_emitter_set_emitter_error(emitter, "neither tag nor implicit flags are specified") - } - - style := event.scalar_style() - if style == yaml_ANY_SCALAR_STYLE { - style = yaml_PLAIN_SCALAR_STYLE - } - if emitter.canonical { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - if emitter.simple_key_context && emitter.scalar_data.multiline { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - - if style == yaml_PLAIN_SCALAR_STYLE { - if emitter.flow_level > 0 && !emitter.scalar_data.flow_plain_allowed || - emitter.flow_level == 0 && !emitter.scalar_data.block_plain_allowed { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if len(emitter.scalar_data.value) == 0 && (emitter.flow_level > 0 || emitter.simple_key_context) { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - if no_tag && !event.implicit { - style = yaml_SINGLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_SINGLE_QUOTED_SCALAR_STYLE { - if !emitter.scalar_data.single_quoted_allowed { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - if style == yaml_LITERAL_SCALAR_STYLE || style == yaml_FOLDED_SCALAR_STYLE { - if !emitter.scalar_data.block_allowed || emitter.flow_level > 0 || emitter.simple_key_context { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - } - - if no_tag && !event.quoted_implicit && style != yaml_PLAIN_SCALAR_STYLE { - emitter.tag_data.handle = []byte{'!'} - } - emitter.scalar_data.style = style - return true -} - -// Write an achor. -func yaml_emitter_process_anchor(emitter *yaml_emitter_t) bool { - if emitter.anchor_data.anchor == nil { - return true - } - c := []byte{'&'} - if emitter.anchor_data.alias { - c[0] = '*' - } - if !yaml_emitter_write_indicator(emitter, c, true, false, false) { - return false - } - return yaml_emitter_write_anchor(emitter, emitter.anchor_data.anchor) -} - -// Write a tag. -func yaml_emitter_process_tag(emitter *yaml_emitter_t) bool { - if len(emitter.tag_data.handle) == 0 && len(emitter.tag_data.suffix) == 0 { - return true - } - if len(emitter.tag_data.handle) > 0 { - if !yaml_emitter_write_tag_handle(emitter, emitter.tag_data.handle) { - return false - } - if len(emitter.tag_data.suffix) > 0 { - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - } - } else { - // [Go] Allocate these slices elsewhere. - if !yaml_emitter_write_indicator(emitter, []byte("!<"), true, false, false) { - return false - } - if !yaml_emitter_write_tag_content(emitter, emitter.tag_data.suffix, false) { - return false - } - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, false, false, false) { - return false - } - } - return true -} - -// Write a scalar. -func yaml_emitter_process_scalar(emitter *yaml_emitter_t) bool { - switch emitter.scalar_data.style { - case yaml_PLAIN_SCALAR_STYLE: - return yaml_emitter_write_plain_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_SINGLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_single_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_DOUBLE_QUOTED_SCALAR_STYLE: - return yaml_emitter_write_double_quoted_scalar(emitter, emitter.scalar_data.value, !emitter.simple_key_context) - - case yaml_LITERAL_SCALAR_STYLE: - return yaml_emitter_write_literal_scalar(emitter, emitter.scalar_data.value) - - case yaml_FOLDED_SCALAR_STYLE: - return yaml_emitter_write_folded_scalar(emitter, emitter.scalar_data.value) - } - panic("unknown scalar style") -} - -// Check if a %YAML directive is valid. -func yaml_emitter_analyze_version_directive(emitter *yaml_emitter_t, version_directive *yaml_version_directive_t) bool { - if version_directive.major != 1 || version_directive.minor != 1 { - return yaml_emitter_set_emitter_error(emitter, "incompatible %YAML directive") - } - return true -} - -// Check if a %TAG directive is valid. -func yaml_emitter_analyze_tag_directive(emitter *yaml_emitter_t, tag_directive *yaml_tag_directive_t) bool { - handle := tag_directive.handle - prefix := tag_directive.prefix - if len(handle) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag handle must not be empty") - } - if handle[0] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must start with '!'") - } - if handle[len(handle)-1] != '!' { - return yaml_emitter_set_emitter_error(emitter, "tag handle must end with '!'") - } - for i := 1; i < len(handle)-1; i += width(handle[i]) { - if !is_alpha(handle, i) { - return yaml_emitter_set_emitter_error(emitter, "tag handle must contain alphanumerical characters only") - } - } - if len(prefix) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag prefix must not be empty") - } - return true -} - -// Check if an anchor is valid. -func yaml_emitter_analyze_anchor(emitter *yaml_emitter_t, anchor []byte, alias bool) bool { - if len(anchor) == 0 { - problem := "anchor value must not be empty" - if alias { - problem = "alias value must not be empty" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - for i := 0; i < len(anchor); i += width(anchor[i]) { - if !is_alpha(anchor, i) { - problem := "anchor value must contain alphanumerical characters only" - if alias { - problem = "alias value must contain alphanumerical characters only" - } - return yaml_emitter_set_emitter_error(emitter, problem) - } - } - emitter.anchor_data.anchor = anchor - emitter.anchor_data.alias = alias - return true -} - -// Check if a tag is valid. -func yaml_emitter_analyze_tag(emitter *yaml_emitter_t, tag []byte) bool { - if len(tag) == 0 { - return yaml_emitter_set_emitter_error(emitter, "tag value must not be empty") - } - for i := 0; i < len(emitter.tag_directives); i++ { - tag_directive := &emitter.tag_directives[i] - if bytes.HasPrefix(tag, tag_directive.prefix) { - emitter.tag_data.handle = tag_directive.handle - emitter.tag_data.suffix = tag[len(tag_directive.prefix):] - return true - } - } - emitter.tag_data.suffix = tag - return true -} - -// Check if a scalar is valid. -func yaml_emitter_analyze_scalar(emitter *yaml_emitter_t, value []byte) bool { - var ( - block_indicators = false - flow_indicators = false - line_breaks = false - special_characters = false - - leading_space = false - leading_break = false - trailing_space = false - trailing_break = false - break_space = false - space_break = false - - preceded_by_whitespace = false - followed_by_whitespace = false - previous_space = false - previous_break = false - ) - - emitter.scalar_data.value = value - - if len(value) == 0 { - emitter.scalar_data.multiline = false - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = false - return true - } - - if len(value) >= 3 && ((value[0] == '-' && value[1] == '-' && value[2] == '-') || (value[0] == '.' && value[1] == '.' && value[2] == '.')) { - block_indicators = true - flow_indicators = true - } - - preceded_by_whitespace = true - for i, w := 0, 0; i < len(value); i += w { - w = width(value[i]) - followed_by_whitespace = i+w >= len(value) || is_blank(value, i+w) - - if i == 0 { - switch value[i] { - case '#', ',', '[', ']', '{', '}', '&', '*', '!', '|', '>', '\'', '"', '%', '@', '`': - flow_indicators = true - block_indicators = true - case '?', ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '-': - if followed_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } else { - switch value[i] { - case ',', '?', '[', ']', '{', '}': - flow_indicators = true - case ':': - flow_indicators = true - if followed_by_whitespace { - block_indicators = true - } - case '#': - if preceded_by_whitespace { - flow_indicators = true - block_indicators = true - } - } - } - - if !is_printable(value, i) || !is_ascii(value, i) && !emitter.unicode { - special_characters = true - } - if is_space(value, i) { - if i == 0 { - leading_space = true - } - if i+width(value[i]) == len(value) { - trailing_space = true - } - if previous_break { - break_space = true - } - previous_space = true - previous_break = false - } else if is_break(value, i) { - line_breaks = true - if i == 0 { - leading_break = true - } - if i+width(value[i]) == len(value) { - trailing_break = true - } - if previous_space { - space_break = true - } - previous_space = false - previous_break = true - } else { - previous_space = false - previous_break = false - } - - // [Go]: Why 'z'? Couldn't be the end of the string as that's the loop condition. - preceded_by_whitespace = is_blankz(value, i) - } - - emitter.scalar_data.multiline = line_breaks - emitter.scalar_data.flow_plain_allowed = true - emitter.scalar_data.block_plain_allowed = true - emitter.scalar_data.single_quoted_allowed = true - emitter.scalar_data.block_allowed = true - - if leading_space || leading_break || trailing_space || trailing_break { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if trailing_space { - emitter.scalar_data.block_allowed = false - } - if break_space { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - } - if space_break || special_characters { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - emitter.scalar_data.single_quoted_allowed = false - emitter.scalar_data.block_allowed = false - } - if line_breaks { - emitter.scalar_data.flow_plain_allowed = false - emitter.scalar_data.block_plain_allowed = false - } - if flow_indicators { - emitter.scalar_data.flow_plain_allowed = false - } - if block_indicators { - emitter.scalar_data.block_plain_allowed = false - } - return true -} - -// Check if the event data is valid. -func yaml_emitter_analyze_event(emitter *yaml_emitter_t, event *yaml_event_t) bool { - - emitter.anchor_data.anchor = nil - emitter.tag_data.handle = nil - emitter.tag_data.suffix = nil - emitter.scalar_data.value = nil - - switch event.typ { - case yaml_ALIAS_EVENT: - if !yaml_emitter_analyze_anchor(emitter, event.anchor, true) { - return false - } - - case yaml_SCALAR_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || (!event.implicit && !event.quoted_implicit)) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - if !yaml_emitter_analyze_scalar(emitter, event.value) { - return false - } - - case yaml_SEQUENCE_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - - case yaml_MAPPING_START_EVENT: - if len(event.anchor) > 0 { - if !yaml_emitter_analyze_anchor(emitter, event.anchor, false) { - return false - } - } - if len(event.tag) > 0 && (emitter.canonical || !event.implicit) { - if !yaml_emitter_analyze_tag(emitter, event.tag) { - return false - } - } - } - return true -} - -// Write the BOM character. -func yaml_emitter_write_bom(emitter *yaml_emitter_t) bool { - if !flush(emitter) { - return false - } - pos := emitter.buffer_pos - emitter.buffer[pos+0] = '\xEF' - emitter.buffer[pos+1] = '\xBB' - emitter.buffer[pos+2] = '\xBF' - emitter.buffer_pos += 3 - return true -} - -func yaml_emitter_write_indent(emitter *yaml_emitter_t) bool { - indent := emitter.indent - if indent < 0 { - indent = 0 - } - if !emitter.indention || emitter.column > indent || (emitter.column == indent && !emitter.whitespace) { - if !put_break(emitter) { - return false - } - } - for emitter.column < indent { - if !put(emitter, ' ') { - return false - } - } - emitter.whitespace = true - emitter.indention = true - return true -} - -func yaml_emitter_write_indicator(emitter *yaml_emitter_t, indicator []byte, need_whitespace, is_whitespace, is_indention bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, indicator) { - return false - } - emitter.whitespace = is_whitespace - emitter.indention = (emitter.indention && is_indention) - emitter.open_ended = false - return true -} - -func yaml_emitter_write_anchor(emitter *yaml_emitter_t, value []byte) bool { - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_handle(emitter *yaml_emitter_t, value []byte) bool { - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - if !write_all(emitter, value) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_tag_content(emitter *yaml_emitter_t, value []byte, need_whitespace bool) bool { - if need_whitespace && !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - for i := 0; i < len(value); { - var must_write bool - switch value[i] { - case ';', '/', '?', ':', '@', '&', '=', '+', '$', ',', '_', '.', '~', '*', '\'', '(', ')', '[', ']': - must_write = true - default: - must_write = is_alpha(value, i) - } - if must_write { - if !write(emitter, value, &i) { - return false - } - } else { - w := width(value[i]) - for k := 0; k < w; k++ { - octet := value[i] - i++ - if !put(emitter, '%') { - return false - } - - c := octet >> 4 - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - - c = octet & 0x0f - if c < 10 { - c += '0' - } else { - c += 'A' - 10 - } - if !put(emitter, c) { - return false - } - } - } - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_plain_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - if !emitter.whitespace { - if !put(emitter, ' ') { - return false - } - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - - emitter.whitespace = false - emitter.indention = false - if emitter.root_context { - emitter.open_ended = true - } - - return true -} - -func yaml_emitter_write_single_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, true, false, false) { - return false - } - - spaces := false - breaks := false - for i := 0; i < len(value); { - if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 && !is_space(value, i+1) { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - spaces = true - } else if is_break(value, i) { - if !breaks && value[i] == '\n' { - if !put_break(emitter) { - return false - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if value[i] == '\'' { - if !put(emitter, '\'') { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - spaces = false - breaks = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'\''}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_double_quoted_scalar(emitter *yaml_emitter_t, value []byte, allow_breaks bool) bool { - spaces := false - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, true, false, false) { - return false - } - - for i := 0; i < len(value); { - if !is_printable(value, i) || (!emitter.unicode && !is_ascii(value, i)) || - is_bom(value, i) || is_break(value, i) || - value[i] == '"' || value[i] == '\\' { - - octet := value[i] - - var w int - var v rune - switch { - case octet&0x80 == 0x00: - w, v = 1, rune(octet&0x7F) - case octet&0xE0 == 0xC0: - w, v = 2, rune(octet&0x1F) - case octet&0xF0 == 0xE0: - w, v = 3, rune(octet&0x0F) - case octet&0xF8 == 0xF0: - w, v = 4, rune(octet&0x07) - } - for k := 1; k < w; k++ { - octet = value[i+k] - v = (v << 6) + (rune(octet) & 0x3F) - } - i += w - - if !put(emitter, '\\') { - return false - } - - var ok bool - switch v { - case 0x00: - ok = put(emitter, '0') - case 0x07: - ok = put(emitter, 'a') - case 0x08: - ok = put(emitter, 'b') - case 0x09: - ok = put(emitter, 't') - case 0x0A: - ok = put(emitter, 'n') - case 0x0b: - ok = put(emitter, 'v') - case 0x0c: - ok = put(emitter, 'f') - case 0x0d: - ok = put(emitter, 'r') - case 0x1b: - ok = put(emitter, 'e') - case 0x22: - ok = put(emitter, '"') - case 0x5c: - ok = put(emitter, '\\') - case 0x85: - ok = put(emitter, 'N') - case 0xA0: - ok = put(emitter, '_') - case 0x2028: - ok = put(emitter, 'L') - case 0x2029: - ok = put(emitter, 'P') - default: - if v <= 0xFF { - ok = put(emitter, 'x') - w = 2 - } else if v <= 0xFFFF { - ok = put(emitter, 'u') - w = 4 - } else { - ok = put(emitter, 'U') - w = 8 - } - for k := (w - 1) * 4; ok && k >= 0; k -= 4 { - digit := byte((v >> uint(k)) & 0x0F) - if digit < 10 { - ok = put(emitter, digit+'0') - } else { - ok = put(emitter, digit+'A'-10) - } - } - } - if !ok { - return false - } - spaces = false - } else if is_space(value, i) { - if allow_breaks && !spaces && emitter.column > emitter.best_width && i > 0 && i < len(value)-1 { - if !yaml_emitter_write_indent(emitter) { - return false - } - if is_space(value, i+1) { - if !put(emitter, '\\') { - return false - } - } - i += width(value[i]) - } else if !write(emitter, value, &i) { - return false - } - spaces = true - } else { - if !write(emitter, value, &i) { - return false - } - spaces = false - } - } - if !yaml_emitter_write_indicator(emitter, []byte{'"'}, false, false, false) { - return false - } - emitter.whitespace = false - emitter.indention = false - return true -} - -func yaml_emitter_write_block_scalar_hints(emitter *yaml_emitter_t, value []byte) bool { - if is_space(value, 0) || is_break(value, 0) { - indent_hint := []byte{'0' + byte(emitter.best_indent)} - if !yaml_emitter_write_indicator(emitter, indent_hint, false, false, false) { - return false - } - } - - emitter.open_ended = false - - var chomp_hint [1]byte - if len(value) == 0 { - chomp_hint[0] = '-' - } else { - i := len(value) - 1 - for value[i]&0xC0 == 0x80 { - i-- - } - if !is_break(value, i) { - chomp_hint[0] = '-' - } else if i == 0 { - chomp_hint[0] = '+' - emitter.open_ended = true - } else { - i-- - for value[i]&0xC0 == 0x80 { - i-- - } - if is_break(value, i) { - chomp_hint[0] = '+' - emitter.open_ended = true - } - } - } - if chomp_hint[0] != 0 { - if !yaml_emitter_write_indicator(emitter, chomp_hint[:], false, false, false) { - return false - } - } - return true -} - -func yaml_emitter_write_literal_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'|'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - if !put_break(emitter) { - return false - } - emitter.indention = true - emitter.whitespace = true - breaks := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - } - if !write(emitter, value, &i) { - return false - } - emitter.indention = false - breaks = false - } - } - - return true -} - -func yaml_emitter_write_folded_scalar(emitter *yaml_emitter_t, value []byte) bool { - if !yaml_emitter_write_indicator(emitter, []byte{'>'}, true, false, false) { - return false - } - if !yaml_emitter_write_block_scalar_hints(emitter, value) { - return false - } - - if !put_break(emitter) { - return false - } - emitter.indention = true - emitter.whitespace = true - - breaks := true - leading_spaces := true - for i := 0; i < len(value); { - if is_break(value, i) { - if !breaks && !leading_spaces && value[i] == '\n' { - k := 0 - for is_break(value, k) { - k += width(value[k]) - } - if !is_blankz(value, k) { - if !put_break(emitter) { - return false - } - } - } - if !write_break(emitter, value, &i) { - return false - } - emitter.indention = true - breaks = true - } else { - if breaks { - if !yaml_emitter_write_indent(emitter) { - return false - } - leading_spaces = is_blank(value, i) - } - if !breaks && is_space(value, i) && !is_space(value, i+1) && emitter.column > emitter.best_width { - if !yaml_emitter_write_indent(emitter) { - return false - } - i += width(value[i]) - } else { - if !write(emitter, value, &i) { - return false - } - } - emitter.indention = false - breaks = false - } - } - return true -} diff --git a/vendor/gopkg.in/yaml.v2/encode.go b/vendor/gopkg.in/yaml.v2/encode.go deleted file mode 100644 index 84f8499..0000000 --- a/vendor/gopkg.in/yaml.v2/encode.go +++ /dev/null @@ -1,306 +0,0 @@ -package yaml - -import ( - "encoding" - "fmt" - "reflect" - "regexp" - "sort" - "strconv" - "strings" - "time" -) - -type encoder struct { - emitter yaml_emitter_t - event yaml_event_t - out []byte - flow bool -} - -func newEncoder() (e *encoder) { - e = &encoder{} - e.must(yaml_emitter_initialize(&e.emitter)) - yaml_emitter_set_output_string(&e.emitter, &e.out) - yaml_emitter_set_unicode(&e.emitter, true) - e.must(yaml_stream_start_event_initialize(&e.event, yaml_UTF8_ENCODING)) - e.emit() - e.must(yaml_document_start_event_initialize(&e.event, nil, nil, true)) - e.emit() - return e -} - -func (e *encoder) finish() { - e.must(yaml_document_end_event_initialize(&e.event, true)) - e.emit() - e.emitter.open_ended = false - e.must(yaml_stream_end_event_initialize(&e.event)) - e.emit() -} - -func (e *encoder) destroy() { - yaml_emitter_delete(&e.emitter) -} - -func (e *encoder) emit() { - // This will internally delete the e.event value. - if !yaml_emitter_emit(&e.emitter, &e.event) && e.event.typ != yaml_DOCUMENT_END_EVENT && e.event.typ != yaml_STREAM_END_EVENT { - e.must(false) - } -} - -func (e *encoder) must(ok bool) { - if !ok { - msg := e.emitter.problem - if msg == "" { - msg = "unknown problem generating YAML content" - } - failf("%s", msg) - } -} - -func (e *encoder) marshal(tag string, in reflect.Value) { - if !in.IsValid() { - e.nilv() - return - } - iface := in.Interface() - if m, ok := iface.(Marshaler); ok { - v, err := m.MarshalYAML() - if err != nil { - fail(err) - } - if v == nil { - e.nilv() - return - } - in = reflect.ValueOf(v) - } else if m, ok := iface.(encoding.TextMarshaler); ok { - text, err := m.MarshalText() - if err != nil { - fail(err) - } - in = reflect.ValueOf(string(text)) - } - switch in.Kind() { - case reflect.Interface: - if in.IsNil() { - e.nilv() - } else { - e.marshal(tag, in.Elem()) - } - case reflect.Map: - e.mapv(tag, in) - case reflect.Ptr: - if in.IsNil() { - e.nilv() - } else { - e.marshal(tag, in.Elem()) - } - case reflect.Struct: - e.structv(tag, in) - case reflect.Slice: - if in.Type().Elem() == mapItemType { - e.itemsv(tag, in) - } else { - e.slicev(tag, in) - } - case reflect.String: - e.stringv(tag, in) - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - if in.Type() == durationType { - e.stringv(tag, reflect.ValueOf(iface.(time.Duration).String())) - } else { - e.intv(tag, in) - } - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - e.uintv(tag, in) - case reflect.Float32, reflect.Float64: - e.floatv(tag, in) - case reflect.Bool: - e.boolv(tag, in) - default: - panic("cannot marshal type: " + in.Type().String()) - } -} - -func (e *encoder) mapv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - keys := keyList(in.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - e.marshal("", k) - e.marshal("", in.MapIndex(k)) - } - }) -} - -func (e *encoder) itemsv(tag string, in reflect.Value) { - e.mappingv(tag, func() { - slice := in.Convert(reflect.TypeOf([]MapItem{})).Interface().([]MapItem) - for _, item := range slice { - e.marshal("", reflect.ValueOf(item.Key)) - e.marshal("", reflect.ValueOf(item.Value)) - } - }) -} - -func (e *encoder) structv(tag string, in reflect.Value) { - sinfo, err := getStructInfo(in.Type()) - if err != nil { - panic(err) - } - e.mappingv(tag, func() { - for _, info := range sinfo.FieldsList { - var value reflect.Value - if info.Inline == nil { - value = in.Field(info.Num) - } else { - value = in.FieldByIndex(info.Inline) - } - if info.OmitEmpty && isZero(value) { - continue - } - e.marshal("", reflect.ValueOf(info.Key)) - e.flow = info.Flow - e.marshal("", value) - } - if sinfo.InlineMap >= 0 { - m := in.Field(sinfo.InlineMap) - if m.Len() > 0 { - e.flow = false - keys := keyList(m.MapKeys()) - sort.Sort(keys) - for _, k := range keys { - if _, found := sinfo.FieldsMap[k.String()]; found { - panic(fmt.Sprintf("Can't have key %q in inlined map; conflicts with struct field", k.String())) - } - e.marshal("", k) - e.flow = false - e.marshal("", m.MapIndex(k)) - } - } - } - }) -} - -func (e *encoder) mappingv(tag string, f func()) { - implicit := tag == "" - style := yaml_BLOCK_MAPPING_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_MAPPING_STYLE - } - e.must(yaml_mapping_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) - e.emit() - f() - e.must(yaml_mapping_end_event_initialize(&e.event)) - e.emit() -} - -func (e *encoder) slicev(tag string, in reflect.Value) { - implicit := tag == "" - style := yaml_BLOCK_SEQUENCE_STYLE - if e.flow { - e.flow = false - style = yaml_FLOW_SEQUENCE_STYLE - } - e.must(yaml_sequence_start_event_initialize(&e.event, nil, []byte(tag), implicit, style)) - e.emit() - n := in.Len() - for i := 0; i < n; i++ { - e.marshal("", in.Index(i)) - } - e.must(yaml_sequence_end_event_initialize(&e.event)) - e.emit() -} - -// isBase60 returns whether s is in base 60 notation as defined in YAML 1.1. -// -// The base 60 float notation in YAML 1.1 is a terrible idea and is unsupported -// in YAML 1.2 and by this package, but these should be marshalled quoted for -// the time being for compatibility with other parsers. -func isBase60Float(s string) (result bool) { - // Fast path. - if s == "" { - return false - } - c := s[0] - if !(c == '+' || c == '-' || c >= '0' && c <= '9') || strings.IndexByte(s, ':') < 0 { - return false - } - // Do the full match. - return base60float.MatchString(s) -} - -// From http://yaml.org/type/float.html, except the regular expression there -// is bogus. In practice parsers do not enforce the "\.[0-9_]*" suffix. -var base60float = regexp.MustCompile(`^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+(?:\.[0-9_]*)?$`) - -func (e *encoder) stringv(tag string, in reflect.Value) { - var style yaml_scalar_style_t - s := in.String() - rtag, rs := resolve("", s) - if rtag == yaml_BINARY_TAG { - if tag == "" || tag == yaml_STR_TAG { - tag = rtag - s = rs.(string) - } else if tag == yaml_BINARY_TAG { - failf("explicitly tagged !!binary data must be base64-encoded") - } else { - failf("cannot marshal invalid UTF-8 data as %s", shortTag(tag)) - } - } - if tag == "" && (rtag != yaml_STR_TAG || isBase60Float(s)) { - style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } else if strings.Contains(s, "\n") { - style = yaml_LITERAL_SCALAR_STYLE - } else { - style = yaml_PLAIN_SCALAR_STYLE - } - e.emitScalar(s, "", tag, style) -} - -func (e *encoder) boolv(tag string, in reflect.Value) { - var s string - if in.Bool() { - s = "true" - } else { - s = "false" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) intv(tag string, in reflect.Value) { - s := strconv.FormatInt(in.Int(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) uintv(tag string, in reflect.Value) { - s := strconv.FormatUint(in.Uint(), 10) - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) floatv(tag string, in reflect.Value) { - // FIXME: Handle 64 bits here. - s := strconv.FormatFloat(float64(in.Float()), 'g', -1, 32) - switch s { - case "+Inf": - s = ".inf" - case "-Inf": - s = "-.inf" - case "NaN": - s = ".nan" - } - e.emitScalar(s, "", tag, yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) nilv() { - e.emitScalar("null", "", "", yaml_PLAIN_SCALAR_STYLE) -} - -func (e *encoder) emitScalar(value, anchor, tag string, style yaml_scalar_style_t) { - implicit := tag == "" - e.must(yaml_scalar_event_initialize(&e.event, []byte(anchor), []byte(tag), []byte(value), implicit, implicit, style)) - e.emit() -} diff --git a/vendor/gopkg.in/yaml.v2/encode_test.go b/vendor/gopkg.in/yaml.v2/encode_test.go deleted file mode 100644 index 84099bd..0000000 --- a/vendor/gopkg.in/yaml.v2/encode_test.go +++ /dev/null @@ -1,501 +0,0 @@ -package yaml_test - -import ( - "fmt" - "math" - "strconv" - "strings" - "time" - - . "gopkg.in/check.v1" - "gopkg.in/yaml.v2" - "net" - "os" -) - -var marshalIntTest = 123 - -var marshalTests = []struct { - value interface{} - data string -}{ - { - nil, - "null\n", - }, { - &struct{}{}, - "{}\n", - }, { - map[string]string{"v": "hi"}, - "v: hi\n", - }, { - map[string]interface{}{"v": "hi"}, - "v: hi\n", - }, { - map[string]string{"v": "true"}, - "v: \"true\"\n", - }, { - map[string]string{"v": "false"}, - "v: \"false\"\n", - }, { - map[string]interface{}{"v": true}, - "v: true\n", - }, { - map[string]interface{}{"v": false}, - "v: false\n", - }, { - map[string]interface{}{"v": 10}, - "v: 10\n", - }, { - map[string]interface{}{"v": -10}, - "v: -10\n", - }, { - map[string]uint{"v": 42}, - "v: 42\n", - }, { - map[string]interface{}{"v": int64(4294967296)}, - "v: 4294967296\n", - }, { - map[string]int64{"v": int64(4294967296)}, - "v: 4294967296\n", - }, { - map[string]uint64{"v": 4294967296}, - "v: 4294967296\n", - }, { - map[string]interface{}{"v": "10"}, - "v: \"10\"\n", - }, { - map[string]interface{}{"v": 0.1}, - "v: 0.1\n", - }, { - map[string]interface{}{"v": float64(0.1)}, - "v: 0.1\n", - }, { - map[string]interface{}{"v": -0.1}, - "v: -0.1\n", - }, { - map[string]interface{}{"v": math.Inf(+1)}, - "v: .inf\n", - }, { - map[string]interface{}{"v": math.Inf(-1)}, - "v: -.inf\n", - }, { - map[string]interface{}{"v": math.NaN()}, - "v: .nan\n", - }, { - map[string]interface{}{"v": nil}, - "v: null\n", - }, { - map[string]interface{}{"v": ""}, - "v: \"\"\n", - }, { - map[string][]string{"v": []string{"A", "B"}}, - "v:\n- A\n- B\n", - }, { - map[string][]string{"v": []string{"A", "B\nC"}}, - "v:\n- A\n- |-\n B\n C\n", - }, { - map[string][]interface{}{"v": []interface{}{"A", 1, map[string][]int{"B": []int{2, 3}}}}, - "v:\n- A\n- 1\n- B:\n - 2\n - 3\n", - }, { - map[string]interface{}{"a": map[interface{}]interface{}{"b": "c"}}, - "a:\n b: c\n", - }, { - map[string]interface{}{"a": "-"}, - "a: '-'\n", - }, - - // Simple values. - { - &marshalIntTest, - "123\n", - }, - - // Structures - { - &struct{ Hello string }{"world"}, - "hello: world\n", - }, { - &struct { - A struct { - B string - } - }{struct{ B string }{"c"}}, - "a:\n b: c\n", - }, { - &struct { - A *struct { - B string - } - }{&struct{ B string }{"c"}}, - "a:\n b: c\n", - }, { - &struct { - A *struct { - B string - } - }{}, - "a: null\n", - }, { - &struct{ A int }{1}, - "a: 1\n", - }, { - &struct{ A []int }{[]int{1, 2}}, - "a:\n- 1\n- 2\n", - }, { - &struct { - B int "a" - }{1}, - "a: 1\n", - }, { - &struct{ A bool }{true}, - "a: true\n", - }, - - // Conditional flag - { - &struct { - A int "a,omitempty" - B int "b,omitempty" - }{1, 0}, - "a: 1\n", - }, { - &struct { - A int "a,omitempty" - B int "b,omitempty" - }{0, 0}, - "{}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{&struct{ X, y int }{1, 2}}, - "a: {x: 1}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{nil}, - "{}\n", - }, { - &struct { - A *struct{ X, y int } "a,omitempty,flow" - }{&struct{ X, y int }{}}, - "a: {x: 0}\n", - }, { - &struct { - A struct{ X, y int } "a,omitempty,flow" - }{struct{ X, y int }{1, 2}}, - "a: {x: 1}\n", - }, { - &struct { - A struct{ X, y int } "a,omitempty,flow" - }{struct{ X, y int }{0, 1}}, - "{}\n", - }, { - &struct { - A float64 "a,omitempty" - B float64 "b,omitempty" - }{1, 0}, - "a: 1\n", - }, - - // Flow flag - { - &struct { - A []int "a,flow" - }{[]int{1, 2}}, - "a: [1, 2]\n", - }, { - &struct { - A map[string]string "a,flow" - }{map[string]string{"b": "c", "d": "e"}}, - "a: {b: c, d: e}\n", - }, { - &struct { - A struct { - B, D string - } "a,flow" - }{struct{ B, D string }{"c", "e"}}, - "a: {b: c, d: e}\n", - }, - - // Unexported field - { - &struct { - u int - A int - }{0, 1}, - "a: 1\n", - }, - - // Ignored field - { - &struct { - A int - B int "-" - }{1, 2}, - "a: 1\n", - }, - - // Struct inlining - { - &struct { - A int - C inlineB `yaml:",inline"` - }{1, inlineB{2, inlineC{3}}}, - "a: 1\nb: 2\nc: 3\n", - }, - - // Map inlining - { - &struct { - A int - C map[string]int `yaml:",inline"` - }{1, map[string]int{"b": 2, "c": 3}}, - "a: 1\nb: 2\nc: 3\n", - }, - - // Duration - { - map[string]time.Duration{"a": 3 * time.Second}, - "a: 3s\n", - }, - - // Issue #24: bug in map merging logic. - { - map[string]string{"a": ""}, - "a: \n", - }, - - // Issue #34: marshal unsupported base 60 floats quoted for compatibility - // with old YAML 1.1 parsers. - { - map[string]string{"a": "1:1"}, - "a: \"1:1\"\n", - }, - - // Binary data. - { - map[string]string{"a": "\x00"}, - "a: \"\\0\"\n", - }, { - map[string]string{"a": "\x80\x81\x82"}, - "a: !!binary gIGC\n", - }, { - map[string]string{"a": strings.Repeat("\x90", 54)}, - "a: !!binary |\n " + strings.Repeat("kJCQ", 17) + "kJ\n CQ\n", - }, - - // Ordered maps. - { - &yaml.MapSlice{{"b", 2}, {"a", 1}, {"d", 4}, {"c", 3}, {"sub", yaml.MapSlice{{"e", 5}}}}, - "b: 2\na: 1\nd: 4\nc: 3\nsub:\n e: 5\n", - }, - - // Encode unicode as utf-8 rather than in escaped form. - { - map[string]string{"a": "你好"}, - "a: 你好\n", - }, - - // Support encoding.TextMarshaler. - { - map[string]net.IP{"a": net.IPv4(1, 2, 3, 4)}, - "a: 1.2.3.4\n", - }, - { - map[string]time.Time{"a": time.Unix(1424801979, 0)}, - "a: 2015-02-24T18:19:39Z\n", - }, - - // Ensure strings containing ": " are quoted (reported as PR #43, but not reproducible). - { - map[string]string{"a": "b: c"}, - "a: 'b: c'\n", - }, - - // Containing hash mark ('#') in string should be quoted - { - map[string]string{"a": "Hello #comment"}, - "a: 'Hello #comment'\n", - }, - { - map[string]string{"a": "你好 #comment"}, - "a: '你好 #comment'\n", - }, -} - -func (s *S) TestMarshal(c *C) { - defer os.Setenv("TZ", os.Getenv("TZ")) - os.Setenv("TZ", "UTC") - for _, item := range marshalTests { - data, err := yaml.Marshal(item.value) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, item.data) - } -} - -var marshalErrorTests = []struct { - value interface{} - error string - panic string -}{{ - value: &struct { - B int - inlineB ",inline" - }{1, inlineB{2, inlineC{3}}}, - panic: `Duplicated key 'b' in struct struct \{ B int; .*`, -}, { - value: &struct { - A int - B map[string]int ",inline" - }{1, map[string]int{"a": 2}}, - panic: `Can't have key "a" in inlined map; conflicts with struct field`, -}} - -func (s *S) TestMarshalErrors(c *C) { - for _, item := range marshalErrorTests { - if item.panic != "" { - c.Assert(func() { yaml.Marshal(item.value) }, PanicMatches, item.panic) - } else { - _, err := yaml.Marshal(item.value) - c.Assert(err, ErrorMatches, item.error) - } - } -} - -func (s *S) TestMarshalTypeCache(c *C) { - var data []byte - var err error - func() { - type T struct{ A int } - data, err = yaml.Marshal(&T{}) - c.Assert(err, IsNil) - }() - func() { - type T struct{ B int } - data, err = yaml.Marshal(&T{}) - c.Assert(err, IsNil) - }() - c.Assert(string(data), Equals, "b: 0\n") -} - -var marshalerTests = []struct { - data string - value interface{} -}{ - {"_:\n hi: there\n", map[interface{}]interface{}{"hi": "there"}}, - {"_:\n- 1\n- A\n", []interface{}{1, "A"}}, - {"_: 10\n", 10}, - {"_: null\n", nil}, - {"_: BAR!\n", "BAR!"}, -} - -type marshalerType struct { - value interface{} -} - -func (o marshalerType) MarshalText() ([]byte, error) { - panic("MarshalText called on type with MarshalYAML") -} - -func (o marshalerType) MarshalYAML() (interface{}, error) { - return o.value, nil -} - -type marshalerValue struct { - Field marshalerType "_" -} - -func (s *S) TestMarshaler(c *C) { - for _, item := range marshalerTests { - obj := &marshalerValue{} - obj.Field.value = item.value - data, err := yaml.Marshal(obj) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, string(item.data)) - } -} - -func (s *S) TestMarshalerWholeDocument(c *C) { - obj := &marshalerType{} - obj.value = map[string]string{"hello": "world!"} - data, err := yaml.Marshal(obj) - c.Assert(err, IsNil) - c.Assert(string(data), Equals, "hello: world!\n") -} - -type failingMarshaler struct{} - -func (ft *failingMarshaler) MarshalYAML() (interface{}, error) { - return nil, failingErr -} - -func (s *S) TestMarshalerError(c *C) { - _, err := yaml.Marshal(&failingMarshaler{}) - c.Assert(err, Equals, failingErr) -} - -func (s *S) TestSortedOutput(c *C) { - order := []interface{}{ - false, - true, - 1, - uint(1), - 1.0, - 1.1, - 1.2, - 2, - uint(2), - 2.0, - 2.1, - "", - ".1", - ".2", - ".a", - "1", - "2", - "a!10", - "a/2", - "a/10", - "a~10", - "ab/1", - "b/1", - "b/01", - "b/2", - "b/02", - "b/3", - "b/03", - "b1", - "b01", - "b3", - "c2.10", - "c10.2", - "d1", - "d12", - "d12a", - } - m := make(map[interface{}]int) - for _, k := range order { - m[k] = 1 - } - data, err := yaml.Marshal(m) - c.Assert(err, IsNil) - out := "\n" + string(data) - last := 0 - for i, k := range order { - repr := fmt.Sprint(k) - if s, ok := k.(string); ok { - if _, err = strconv.ParseFloat(repr, 32); s == "" || err == nil { - repr = `"` + repr + `"` - } - } - index := strings.Index(out, "\n"+repr+":") - if index == -1 { - c.Fatalf("%#v is not in the output: %#v", k, out) - } - if index < last { - c.Fatalf("%#v was generated before %#v: %q", k, order[i-1], out) - } - last = index - } -} diff --git a/vendor/gopkg.in/yaml.v2/example_embedded_test.go b/vendor/gopkg.in/yaml.v2/example_embedded_test.go deleted file mode 100644 index 171c093..0000000 --- a/vendor/gopkg.in/yaml.v2/example_embedded_test.go +++ /dev/null @@ -1,41 +0,0 @@ -package yaml_test - -import ( - "fmt" - "log" - - "gopkg.in/yaml.v2" -) - -// An example showing how to unmarshal embedded -// structs from YAML. - -type StructA struct { - A string `yaml:"a"` -} - -type StructB struct { - // Embedded structs are not treated as embedded in YAML by default. To do that, - // add the ",inline" annotation below - StructA `yaml:",inline"` - B string `yaml:"b"` -} - -var data = ` -a: a string from struct A -b: a string from struct B -` - -func ExampleUnmarshal_embedded() { - var b StructB - - err := yaml.Unmarshal([]byte(data), &b) - if err != nil { - log.Fatalf("cannot unmarshal data: %v", err) - } - fmt.Println(b.A) - fmt.Println(b.B) - // Output: - // a string from struct A - // a string from struct B -} diff --git a/vendor/gopkg.in/yaml.v2/parserc.go b/vendor/gopkg.in/yaml.v2/parserc.go deleted file mode 100644 index 81d05df..0000000 --- a/vendor/gopkg.in/yaml.v2/parserc.go +++ /dev/null @@ -1,1095 +0,0 @@ -package yaml - -import ( - "bytes" -) - -// The parser implements the following grammar: -// -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// implicit_document ::= block_node DOCUMENT-END* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// block_node_or_indentless_sequence ::= -// ALIAS -// | properties (block_content | indentless_block_sequence)? -// | block_content -// | indentless_block_sequence -// block_node ::= ALIAS -// | properties block_content? -// | block_content -// flow_node ::= ALIAS -// | properties flow_content? -// | flow_content -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// block_content ::= block_collection | flow_collection | SCALAR -// flow_content ::= flow_collection | SCALAR -// block_collection ::= block_sequence | block_mapping -// flow_collection ::= flow_sequence | flow_mapping -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// block_mapping ::= BLOCK-MAPPING_START -// ((KEY block_node_or_indentless_sequence?)? -// (VALUE block_node_or_indentless_sequence?)?)* -// BLOCK-END -// flow_sequence ::= FLOW-SEQUENCE-START -// (flow_sequence_entry FLOW-ENTRY)* -// flow_sequence_entry? -// FLOW-SEQUENCE-END -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// flow_mapping ::= FLOW-MAPPING-START -// (flow_mapping_entry FLOW-ENTRY)* -// flow_mapping_entry? -// FLOW-MAPPING-END -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? - -// Peek the next token in the token queue. -func peek_token(parser *yaml_parser_t) *yaml_token_t { - if parser.token_available || yaml_parser_fetch_more_tokens(parser) { - return &parser.tokens[parser.tokens_head] - } - return nil -} - -// Remove the next token from the queue (must be called after peek_token). -func skip_token(parser *yaml_parser_t) { - parser.token_available = false - parser.tokens_parsed++ - parser.stream_end_produced = parser.tokens[parser.tokens_head].typ == yaml_STREAM_END_TOKEN - parser.tokens_head++ -} - -// Get the next event. -func yaml_parser_parse(parser *yaml_parser_t, event *yaml_event_t) bool { - // Erase the event object. - *event = yaml_event_t{} - - // No events after the end of the stream or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR || parser.state == yaml_PARSE_END_STATE { - return true - } - - // Generate the next event. - return yaml_parser_state_machine(parser, event) -} - -// Set parser error. -func yaml_parser_set_parser_error(parser *yaml_parser_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -func yaml_parser_set_parser_error_context(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string, problem_mark yaml_mark_t) bool { - parser.error = yaml_PARSER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = problem_mark - return false -} - -// State dispatcher. -func yaml_parser_state_machine(parser *yaml_parser_t, event *yaml_event_t) bool { - //trace("yaml_parser_state_machine", "state:", parser.state.String()) - - switch parser.state { - case yaml_PARSE_STREAM_START_STATE: - return yaml_parser_parse_stream_start(parser, event) - - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, true) - - case yaml_PARSE_DOCUMENT_START_STATE: - return yaml_parser_parse_document_start(parser, event, false) - - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return yaml_parser_parse_document_content(parser, event) - - case yaml_PARSE_DOCUMENT_END_STATE: - return yaml_parser_parse_document_end(parser, event) - - case yaml_PARSE_BLOCK_NODE_STATE: - return yaml_parser_parse_node(parser, event, true, false) - - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return yaml_parser_parse_node(parser, event, true, true) - - case yaml_PARSE_FLOW_NODE_STATE: - return yaml_parser_parse_node(parser, event, false, false) - - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, true) - - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_block_sequence_entry(parser, event, false) - - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_indentless_sequence_entry(parser, event) - - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, true) - - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return yaml_parser_parse_block_mapping_key(parser, event, false) - - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return yaml_parser_parse_block_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, true) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return yaml_parser_parse_flow_sequence_entry(parser, event, false) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_key(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_value(parser, event) - - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return yaml_parser_parse_flow_sequence_entry_mapping_end(parser, event) - - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, true) - - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return yaml_parser_parse_flow_mapping_key(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, false) - - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return yaml_parser_parse_flow_mapping_value(parser, event, true) - - default: - panic("invalid parser state") - } -} - -// Parse the production: -// stream ::= STREAM-START implicit_document? explicit_document* STREAM-END -// ************ -func yaml_parser_parse_stream_start(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_STREAM_START_TOKEN { - return yaml_parser_set_parser_error(parser, "did not find expected ", token.start_mark) - } - parser.state = yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - encoding: token.encoding, - } - skip_token(parser) - return true -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// * -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// ************************* -func yaml_parser_parse_document_start(parser *yaml_parser_t, event *yaml_event_t, implicit bool) bool { - - token := peek_token(parser) - if token == nil { - return false - } - - // Parse extra document end indicators. - if !implicit { - for token.typ == yaml_DOCUMENT_END_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - if implicit && token.typ != yaml_VERSION_DIRECTIVE_TOKEN && - token.typ != yaml_TAG_DIRECTIVE_TOKEN && - token.typ != yaml_DOCUMENT_START_TOKEN && - token.typ != yaml_STREAM_END_TOKEN { - // Parse an implicit document. - if !yaml_parser_process_directives(parser, nil, nil) { - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_BLOCK_NODE_STATE - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - } else if token.typ != yaml_STREAM_END_TOKEN { - // Parse an explicit document. - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - start_mark := token.start_mark - if !yaml_parser_process_directives(parser, &version_directive, &tag_directives) { - return false - } - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_DOCUMENT_START_TOKEN { - yaml_parser_set_parser_error(parser, - "did not find expected ", token.start_mark) - return false - } - parser.states = append(parser.states, yaml_PARSE_DOCUMENT_END_STATE) - parser.state = yaml_PARSE_DOCUMENT_CONTENT_STATE - end_mark := token.end_mark - - *event = yaml_event_t{ - typ: yaml_DOCUMENT_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - version_directive: version_directive, - tag_directives: tag_directives, - implicit: false, - } - skip_token(parser) - - } else { - // Parse the stream end. - parser.state = yaml_PARSE_END_STATE - *event = yaml_event_t{ - typ: yaml_STREAM_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - } - - return true -} - -// Parse the productions: -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// *********** -// -func yaml_parser_parse_document_content(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN || - token.typ == yaml_TAG_DIRECTIVE_TOKEN || - token.typ == yaml_DOCUMENT_START_TOKEN || - token.typ == yaml_DOCUMENT_END_TOKEN || - token.typ == yaml_STREAM_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - return yaml_parser_process_empty_scalar(parser, event, - token.start_mark) - } - return yaml_parser_parse_node(parser, event, true, false) -} - -// Parse the productions: -// implicit_document ::= block_node DOCUMENT-END* -// ************* -// explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END* -// -func yaml_parser_parse_document_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - start_mark := token.start_mark - end_mark := token.start_mark - - implicit := true - if token.typ == yaml_DOCUMENT_END_TOKEN { - end_mark = token.end_mark - skip_token(parser) - implicit = false - } - - parser.tag_directives = parser.tag_directives[:0] - - parser.state = yaml_PARSE_DOCUMENT_START_STATE - *event = yaml_event_t{ - typ: yaml_DOCUMENT_END_EVENT, - start_mark: start_mark, - end_mark: end_mark, - implicit: implicit, - } - return true -} - -// Parse the productions: -// block_node_or_indentless_sequence ::= -// ALIAS -// ***** -// | properties (block_content | indentless_block_sequence)? -// ********** * -// | block_content | indentless_block_sequence -// * -// block_node ::= ALIAS -// ***** -// | properties block_content? -// ********** * -// | block_content -// * -// flow_node ::= ALIAS -// ***** -// | properties flow_content? -// ********** * -// | flow_content -// * -// properties ::= TAG ANCHOR? | ANCHOR TAG? -// ************************* -// block_content ::= block_collection | flow_collection | SCALAR -// ****** -// flow_content ::= flow_collection | SCALAR -// ****** -func yaml_parser_parse_node(parser *yaml_parser_t, event *yaml_event_t, block, indentless_sequence bool) bool { - //defer trace("yaml_parser_parse_node", "block:", block, "indentless_sequence:", indentless_sequence)() - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_ALIAS_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - *event = yaml_event_t{ - typ: yaml_ALIAS_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - anchor: token.value, - } - skip_token(parser) - return true - } - - start_mark := token.start_mark - end_mark := token.start_mark - - var tag_token bool - var tag_handle, tag_suffix, anchor []byte - var tag_mark yaml_mark_t - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - start_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } else if token.typ == yaml_TAG_TOKEN { - tag_token = true - tag_handle = token.value - tag_suffix = token.suffix - start_mark = token.start_mark - tag_mark = token.start_mark - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_ANCHOR_TOKEN { - anchor = token.value - end_mark = token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - } - - var tag []byte - if tag_token { - if len(tag_handle) == 0 { - tag = tag_suffix - tag_suffix = nil - } else { - for i := range parser.tag_directives { - if bytes.Equal(parser.tag_directives[i].handle, tag_handle) { - tag = append([]byte(nil), parser.tag_directives[i].prefix...) - tag = append(tag, tag_suffix...) - break - } - } - if len(tag) == 0 { - yaml_parser_set_parser_error_context(parser, - "while parsing a node", start_mark, - "found undefined tag handle", tag_mark) - return false - } - } - } - - implicit := len(tag) == 0 - if indentless_sequence && token.typ == yaml_BLOCK_ENTRY_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - return true - } - if token.typ == yaml_SCALAR_TOKEN { - var plain_implicit, quoted_implicit bool - end_mark = token.end_mark - if (len(tag) == 0 && token.style == yaml_PLAIN_SCALAR_STYLE) || (len(tag) == 1 && tag[0] == '!') { - plain_implicit = true - } else if len(tag) == 0 { - quoted_implicit = true - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - value: token.value, - implicit: plain_implicit, - quoted_implicit: quoted_implicit, - style: yaml_style_t(token.style), - } - skip_token(parser) - return true - } - if token.typ == yaml_FLOW_SEQUENCE_START_TOKEN { - // [Go] Some of the events below can be merged as they differ only on style. - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_SEQUENCE_STYLE), - } - return true - } - if token.typ == yaml_FLOW_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - return true - } - if block && token.typ == yaml_BLOCK_SEQUENCE_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_SEQUENCE_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_SEQUENCE_STYLE), - } - return true - } - if block && token.typ == yaml_BLOCK_MAPPING_START_TOKEN { - end_mark = token.end_mark - parser.state = yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - style: yaml_style_t(yaml_BLOCK_MAPPING_STYLE), - } - return true - } - if len(anchor) > 0 || len(tag) > 0 { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: start_mark, - end_mark: end_mark, - anchor: anchor, - tag: tag, - implicit: implicit, - quoted_implicit: false, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true - } - - context := "while parsing a flow node" - if block { - context = "while parsing a block node" - } - yaml_parser_set_parser_error_context(parser, context, start_mark, - "did not find expected node content", token.start_mark) - return false -} - -// Parse the productions: -// block_sequence ::= BLOCK-SEQUENCE-START (BLOCK-ENTRY block_node?)* BLOCK-END -// ******************** *********** * ********* -// -func yaml_parser_parse_block_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } else { - parser.state = yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } - if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block collection", context_mark, - "did not find expected '-' indicator", token.start_mark) -} - -// Parse the productions: -// indentless_sequence ::= (BLOCK-ENTRY block_node?)+ -// *********** * -func yaml_parser_parse_indentless_sequence_entry(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_BLOCK_ENTRY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_BLOCK_ENTRY_TOKEN && - token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, true, false) - } - parser.state = yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be token.end_mark? - } - return true -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// ******************* -// ((KEY block_node_or_indentless_sequence?)? -// *** * -// (VALUE block_node_or_indentless_sequence?)?)* -// -// BLOCK-END -// ********* -// -func yaml_parser_parse_block_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ == yaml_KEY_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } else { - parser.state = yaml_PARSE_BLOCK_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - } else if token.typ == yaml_BLOCK_END_TOKEN { - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - return true - } - - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a block mapping", context_mark, - "did not find expected key", token.start_mark) -} - -// Parse the productions: -// block_mapping ::= BLOCK-MAPPING_START -// -// ((KEY block_node_or_indentless_sequence?)? -// -// (VALUE block_node_or_indentless_sequence?)?)* -// ***** * -// BLOCK-END -// -// -func yaml_parser_parse_block_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - mark := token.end_mark - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_KEY_TOKEN && - token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_BLOCK_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_BLOCK_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, true, true) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) - } - parser.state = yaml_PARSE_BLOCK_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence ::= FLOW-SEQUENCE-START -// ******************* -// (flow_sequence_entry FLOW-ENTRY)* -// * ********** -// flow_sequence_entry? -// * -// FLOW-SEQUENCE-END -// ***************** -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow sequence", context_mark, - "did not find expected ',' or ']'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_START_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - implicit: true, - style: yaml_style_t(yaml_FLOW_MAPPING_STYLE), - } - skip_token(parser) - return true - } else if token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - - *event = yaml_event_t{ - typ: yaml_SEQUENCE_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - - skip_token(parser) - return true -} - -// -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// *** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_key(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - mark := token.end_mark - skip_token(parser) - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// ***** * -// -func yaml_parser_parse_flow_sequence_entry_mapping_value(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token := peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_SEQUENCE_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Parse the productions: -// flow_sequence_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * -// -func yaml_parser_parse_flow_sequence_entry_mapping_end(parser *yaml_parser_t, event *yaml_event_t) bool { - token := peek_token(parser) - if token == nil { - return false - } - parser.state = yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.start_mark, // [Go] Shouldn't this be end_mark? - } - return true -} - -// Parse the productions: -// flow_mapping ::= FLOW-MAPPING-START -// ****************** -// (flow_mapping_entry FLOW-ENTRY)* -// * ********** -// flow_mapping_entry? -// ****************** -// FLOW-MAPPING-END -// **************** -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * *** * -// -func yaml_parser_parse_flow_mapping_key(parser *yaml_parser_t, event *yaml_event_t, first bool) bool { - if first { - token := peek_token(parser) - parser.marks = append(parser.marks, token.start_mark) - skip_token(parser) - } - - token := peek_token(parser) - if token == nil { - return false - } - - if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - if !first { - if token.typ == yaml_FLOW_ENTRY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } else { - context_mark := parser.marks[len(parser.marks)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - return yaml_parser_set_parser_error_context(parser, - "while parsing a flow mapping", context_mark, - "did not find expected ',' or '}'", token.start_mark) - } - } - - if token.typ == yaml_KEY_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_VALUE_TOKEN && - token.typ != yaml_FLOW_ENTRY_TOKEN && - token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } else { - parser.state = yaml_PARSE_FLOW_MAPPING_VALUE_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - } else if token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - - parser.state = parser.states[len(parser.states)-1] - parser.states = parser.states[:len(parser.states)-1] - parser.marks = parser.marks[:len(parser.marks)-1] - *event = yaml_event_t{ - typ: yaml_MAPPING_END_EVENT, - start_mark: token.start_mark, - end_mark: token.end_mark, - } - skip_token(parser) - return true -} - -// Parse the productions: -// flow_mapping_entry ::= flow_node | KEY flow_node? (VALUE flow_node?)? -// * ***** * -// -func yaml_parser_parse_flow_mapping_value(parser *yaml_parser_t, event *yaml_event_t, empty bool) bool { - token := peek_token(parser) - if token == nil { - return false - } - if empty { - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) - } - if token.typ == yaml_VALUE_TOKEN { - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - if token.typ != yaml_FLOW_ENTRY_TOKEN && token.typ != yaml_FLOW_MAPPING_END_TOKEN { - parser.states = append(parser.states, yaml_PARSE_FLOW_MAPPING_KEY_STATE) - return yaml_parser_parse_node(parser, event, false, false) - } - } - parser.state = yaml_PARSE_FLOW_MAPPING_KEY_STATE - return yaml_parser_process_empty_scalar(parser, event, token.start_mark) -} - -// Generate an empty scalar event. -func yaml_parser_process_empty_scalar(parser *yaml_parser_t, event *yaml_event_t, mark yaml_mark_t) bool { - *event = yaml_event_t{ - typ: yaml_SCALAR_EVENT, - start_mark: mark, - end_mark: mark, - value: nil, // Empty - implicit: true, - style: yaml_style_t(yaml_PLAIN_SCALAR_STYLE), - } - return true -} - -var default_tag_directives = []yaml_tag_directive_t{ - {[]byte("!"), []byte("!")}, - {[]byte("!!"), []byte("tag:yaml.org,2002:")}, -} - -// Parse directives. -func yaml_parser_process_directives(parser *yaml_parser_t, - version_directive_ref **yaml_version_directive_t, - tag_directives_ref *[]yaml_tag_directive_t) bool { - - var version_directive *yaml_version_directive_t - var tag_directives []yaml_tag_directive_t - - token := peek_token(parser) - if token == nil { - return false - } - - for token.typ == yaml_VERSION_DIRECTIVE_TOKEN || token.typ == yaml_TAG_DIRECTIVE_TOKEN { - if token.typ == yaml_VERSION_DIRECTIVE_TOKEN { - if version_directive != nil { - yaml_parser_set_parser_error(parser, - "found duplicate %YAML directive", token.start_mark) - return false - } - if token.major != 1 || token.minor != 1 { - yaml_parser_set_parser_error(parser, - "found incompatible YAML document", token.start_mark) - return false - } - version_directive = &yaml_version_directive_t{ - major: token.major, - minor: token.minor, - } - } else if token.typ == yaml_TAG_DIRECTIVE_TOKEN { - value := yaml_tag_directive_t{ - handle: token.value, - prefix: token.prefix, - } - if !yaml_parser_append_tag_directive(parser, value, false, token.start_mark) { - return false - } - tag_directives = append(tag_directives, value) - } - - skip_token(parser) - token = peek_token(parser) - if token == nil { - return false - } - } - - for i := range default_tag_directives { - if !yaml_parser_append_tag_directive(parser, default_tag_directives[i], true, token.start_mark) { - return false - } - } - - if version_directive_ref != nil { - *version_directive_ref = version_directive - } - if tag_directives_ref != nil { - *tag_directives_ref = tag_directives - } - return true -} - -// Append a tag directive to the directives stack. -func yaml_parser_append_tag_directive(parser *yaml_parser_t, value yaml_tag_directive_t, allow_duplicates bool, mark yaml_mark_t) bool { - for i := range parser.tag_directives { - if bytes.Equal(value.handle, parser.tag_directives[i].handle) { - if allow_duplicates { - return true - } - return yaml_parser_set_parser_error(parser, "found duplicate %TAG directive", mark) - } - } - - // [Go] I suspect the copy is unnecessary. This was likely done - // because there was no way to track ownership of the data. - value_copy := yaml_tag_directive_t{ - handle: make([]byte, len(value.handle)), - prefix: make([]byte, len(value.prefix)), - } - copy(value_copy.handle, value.handle) - copy(value_copy.prefix, value.prefix) - parser.tag_directives = append(parser.tag_directives, value_copy) - return true -} diff --git a/vendor/gopkg.in/yaml.v2/readerc.go b/vendor/gopkg.in/yaml.v2/readerc.go deleted file mode 100644 index f450791..0000000 --- a/vendor/gopkg.in/yaml.v2/readerc.go +++ /dev/null @@ -1,394 +0,0 @@ -package yaml - -import ( - "io" -) - -// Set the reader error and return 0. -func yaml_parser_set_reader_error(parser *yaml_parser_t, problem string, offset int, value int) bool { - parser.error = yaml_READER_ERROR - parser.problem = problem - parser.problem_offset = offset - parser.problem_value = value - return false -} - -// Byte order marks. -const ( - bom_UTF8 = "\xef\xbb\xbf" - bom_UTF16LE = "\xff\xfe" - bom_UTF16BE = "\xfe\xff" -) - -// Determine the input stream encoding by checking the BOM symbol. If no BOM is -// found, the UTF-8 encoding is assumed. Return 1 on success, 0 on failure. -func yaml_parser_determine_encoding(parser *yaml_parser_t) bool { - // Ensure that we had enough bytes in the raw buffer. - for !parser.eof && len(parser.raw_buffer)-parser.raw_buffer_pos < 3 { - if !yaml_parser_update_raw_buffer(parser) { - return false - } - } - - // Determine the encoding. - buf := parser.raw_buffer - pos := parser.raw_buffer_pos - avail := len(buf) - pos - if avail >= 2 && buf[pos] == bom_UTF16LE[0] && buf[pos+1] == bom_UTF16LE[1] { - parser.encoding = yaml_UTF16LE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 2 && buf[pos] == bom_UTF16BE[0] && buf[pos+1] == bom_UTF16BE[1] { - parser.encoding = yaml_UTF16BE_ENCODING - parser.raw_buffer_pos += 2 - parser.offset += 2 - } else if avail >= 3 && buf[pos] == bom_UTF8[0] && buf[pos+1] == bom_UTF8[1] && buf[pos+2] == bom_UTF8[2] { - parser.encoding = yaml_UTF8_ENCODING - parser.raw_buffer_pos += 3 - parser.offset += 3 - } else { - parser.encoding = yaml_UTF8_ENCODING - } - return true -} - -// Update the raw buffer. -func yaml_parser_update_raw_buffer(parser *yaml_parser_t) bool { - size_read := 0 - - // Return if the raw buffer is full. - if parser.raw_buffer_pos == 0 && len(parser.raw_buffer) == cap(parser.raw_buffer) { - return true - } - - // Return on EOF. - if parser.eof { - return true - } - - // Move the remaining bytes in the raw buffer to the beginning. - if parser.raw_buffer_pos > 0 && parser.raw_buffer_pos < len(parser.raw_buffer) { - copy(parser.raw_buffer, parser.raw_buffer[parser.raw_buffer_pos:]) - } - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)-parser.raw_buffer_pos] - parser.raw_buffer_pos = 0 - - // Call the read handler to fill the buffer. - size_read, err := parser.read_handler(parser, parser.raw_buffer[len(parser.raw_buffer):cap(parser.raw_buffer)]) - parser.raw_buffer = parser.raw_buffer[:len(parser.raw_buffer)+size_read] - if err == io.EOF { - parser.eof = true - } else if err != nil { - return yaml_parser_set_reader_error(parser, "input error: "+err.Error(), parser.offset, -1) - } - return true -} - -// Ensure that the buffer contains at least `length` characters. -// Return true on success, false on failure. -// -// The length is supposed to be significantly less that the buffer size. -func yaml_parser_update_buffer(parser *yaml_parser_t, length int) bool { - if parser.read_handler == nil { - panic("read handler must be set") - } - - // If the EOF flag is set and the raw buffer is empty, do nothing. - if parser.eof && parser.raw_buffer_pos == len(parser.raw_buffer) { - return true - } - - // Return if the buffer contains enough characters. - if parser.unread >= length { - return true - } - - // Determine the input encoding if it is not known yet. - if parser.encoding == yaml_ANY_ENCODING { - if !yaml_parser_determine_encoding(parser) { - return false - } - } - - // Move the unread characters to the beginning of the buffer. - buffer_len := len(parser.buffer) - if parser.buffer_pos > 0 && parser.buffer_pos < buffer_len { - copy(parser.buffer, parser.buffer[parser.buffer_pos:]) - buffer_len -= parser.buffer_pos - parser.buffer_pos = 0 - } else if parser.buffer_pos == buffer_len { - buffer_len = 0 - parser.buffer_pos = 0 - } - - // Open the whole buffer for writing, and cut it before returning. - parser.buffer = parser.buffer[:cap(parser.buffer)] - - // Fill the buffer until it has enough characters. - first := true - for parser.unread < length { - - // Fill the raw buffer if necessary. - if !first || parser.raw_buffer_pos == len(parser.raw_buffer) { - if !yaml_parser_update_raw_buffer(parser) { - parser.buffer = parser.buffer[:buffer_len] - return false - } - } - first = false - - // Decode the raw buffer. - inner: - for parser.raw_buffer_pos != len(parser.raw_buffer) { - var value rune - var width int - - raw_unread := len(parser.raw_buffer) - parser.raw_buffer_pos - - // Decode the next character. - switch parser.encoding { - case yaml_UTF8_ENCODING: - // Decode a UTF-8 character. Check RFC 3629 - // (http://www.ietf.org/rfc/rfc3629.txt) for more details. - // - // The following table (taken from the RFC) is used for - // decoding. - // - // Char. number range | UTF-8 octet sequence - // (hexadecimal) | (binary) - // --------------------+------------------------------------ - // 0000 0000-0000 007F | 0xxxxxxx - // 0000 0080-0000 07FF | 110xxxxx 10xxxxxx - // 0000 0800-0000 FFFF | 1110xxxx 10xxxxxx 10xxxxxx - // 0001 0000-0010 FFFF | 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - // - // Additionally, the characters in the range 0xD800-0xDFFF - // are prohibited as they are reserved for use with UTF-16 - // surrogate pairs. - - // Determine the length of the UTF-8 sequence. - octet := parser.raw_buffer[parser.raw_buffer_pos] - switch { - case octet&0x80 == 0x00: - width = 1 - case octet&0xE0 == 0xC0: - width = 2 - case octet&0xF0 == 0xE0: - width = 3 - case octet&0xF8 == 0xF0: - width = 4 - default: - // The leading octet is invalid. - return yaml_parser_set_reader_error(parser, - "invalid leading UTF-8 octet", - parser.offset, int(octet)) - } - - // Check if the raw buffer contains an incomplete character. - if width > raw_unread { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-8 octet sequence", - parser.offset, -1) - } - break inner - } - - // Decode the leading octet. - switch { - case octet&0x80 == 0x00: - value = rune(octet & 0x7F) - case octet&0xE0 == 0xC0: - value = rune(octet & 0x1F) - case octet&0xF0 == 0xE0: - value = rune(octet & 0x0F) - case octet&0xF8 == 0xF0: - value = rune(octet & 0x07) - default: - value = 0 - } - - // Check and decode the trailing octets. - for k := 1; k < width; k++ { - octet = parser.raw_buffer[parser.raw_buffer_pos+k] - - // Check if the octet is valid. - if (octet & 0xC0) != 0x80 { - return yaml_parser_set_reader_error(parser, - "invalid trailing UTF-8 octet", - parser.offset+k, int(octet)) - } - - // Decode the octet. - value = (value << 6) + rune(octet&0x3F) - } - - // Check the length of the sequence against the value. - switch { - case width == 1: - case width == 2 && value >= 0x80: - case width == 3 && value >= 0x800: - case width == 4 && value >= 0x10000: - default: - return yaml_parser_set_reader_error(parser, - "invalid length of a UTF-8 sequence", - parser.offset, -1) - } - - // Check the range of the value. - if value >= 0xD800 && value <= 0xDFFF || value > 0x10FFFF { - return yaml_parser_set_reader_error(parser, - "invalid Unicode character", - parser.offset, int(value)) - } - - case yaml_UTF16LE_ENCODING, yaml_UTF16BE_ENCODING: - var low, high int - if parser.encoding == yaml_UTF16LE_ENCODING { - low, high = 0, 1 - } else { - low, high = 1, 0 - } - - // The UTF-16 encoding is not as simple as one might - // naively think. Check RFC 2781 - // (http://www.ietf.org/rfc/rfc2781.txt). - // - // Normally, two subsequent bytes describe a Unicode - // character. However a special technique (called a - // surrogate pair) is used for specifying character - // values larger than 0xFFFF. - // - // A surrogate pair consists of two pseudo-characters: - // high surrogate area (0xD800-0xDBFF) - // low surrogate area (0xDC00-0xDFFF) - // - // The following formulas are used for decoding - // and encoding characters using surrogate pairs: - // - // U = U' + 0x10000 (0x01 00 00 <= U <= 0x10 FF FF) - // U' = yyyyyyyyyyxxxxxxxxxx (0 <= U' <= 0x0F FF FF) - // W1 = 110110yyyyyyyyyy - // W2 = 110111xxxxxxxxxx - // - // where U is the character value, W1 is the high surrogate - // area, W2 is the low surrogate area. - - // Check for incomplete UTF-16 character. - if raw_unread < 2 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 character", - parser.offset, -1) - } - break inner - } - - // Get the character. - value = rune(parser.raw_buffer[parser.raw_buffer_pos+low]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high]) << 8) - - // Check for unexpected low surrogate area. - if value&0xFC00 == 0xDC00 { - return yaml_parser_set_reader_error(parser, - "unexpected low surrogate area", - parser.offset, int(value)) - } - - // Check for a high surrogate area. - if value&0xFC00 == 0xD800 { - width = 4 - - // Check for incomplete surrogate pair. - if raw_unread < 4 { - if parser.eof { - return yaml_parser_set_reader_error(parser, - "incomplete UTF-16 surrogate pair", - parser.offset, -1) - } - break inner - } - - // Get the next character. - value2 := rune(parser.raw_buffer[parser.raw_buffer_pos+low+2]) + - (rune(parser.raw_buffer[parser.raw_buffer_pos+high+2]) << 8) - - // Check for a low surrogate area. - if value2&0xFC00 != 0xDC00 { - return yaml_parser_set_reader_error(parser, - "expected low surrogate area", - parser.offset+2, int(value2)) - } - - // Generate the value of the surrogate pair. - value = 0x10000 + ((value & 0x3FF) << 10) + (value2 & 0x3FF) - } else { - width = 2 - } - - default: - panic("impossible") - } - - // Check if the character is in the allowed range: - // #x9 | #xA | #xD | [#x20-#x7E] (8 bit) - // | #x85 | [#xA0-#xD7FF] | [#xE000-#xFFFD] (16 bit) - // | [#x10000-#x10FFFF] (32 bit) - switch { - case value == 0x09: - case value == 0x0A: - case value == 0x0D: - case value >= 0x20 && value <= 0x7E: - case value == 0x85: - case value >= 0xA0 && value <= 0xD7FF: - case value >= 0xE000 && value <= 0xFFFD: - case value >= 0x10000 && value <= 0x10FFFF: - default: - return yaml_parser_set_reader_error(parser, - "control characters are not allowed", - parser.offset, int(value)) - } - - // Move the raw pointers. - parser.raw_buffer_pos += width - parser.offset += width - - // Finally put the character into the buffer. - if value <= 0x7F { - // 0000 0000-0000 007F . 0xxxxxxx - parser.buffer[buffer_len+0] = byte(value) - buffer_len += 1 - } else if value <= 0x7FF { - // 0000 0080-0000 07FF . 110xxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xC0 + (value >> 6)) - parser.buffer[buffer_len+1] = byte(0x80 + (value & 0x3F)) - buffer_len += 2 - } else if value <= 0xFFFF { - // 0000 0800-0000 FFFF . 1110xxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xE0 + (value >> 12)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + (value & 0x3F)) - buffer_len += 3 - } else { - // 0001 0000-0010 FFFF . 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - parser.buffer[buffer_len+0] = byte(0xF0 + (value >> 18)) - parser.buffer[buffer_len+1] = byte(0x80 + ((value >> 12) & 0x3F)) - parser.buffer[buffer_len+2] = byte(0x80 + ((value >> 6) & 0x3F)) - parser.buffer[buffer_len+3] = byte(0x80 + (value & 0x3F)) - buffer_len += 4 - } - - parser.unread++ - } - - // On EOF, put NUL into the buffer and return. - if parser.eof { - parser.buffer[buffer_len] = 0 - buffer_len++ - parser.unread++ - break - } - } - parser.buffer = parser.buffer[:buffer_len] - return true -} diff --git a/vendor/gopkg.in/yaml.v2/resolve.go b/vendor/gopkg.in/yaml.v2/resolve.go deleted file mode 100644 index 232313c..0000000 --- a/vendor/gopkg.in/yaml.v2/resolve.go +++ /dev/null @@ -1,208 +0,0 @@ -package yaml - -import ( - "encoding/base64" - "math" - "regexp" - "strconv" - "strings" - "unicode/utf8" -) - -type resolveMapItem struct { - value interface{} - tag string -} - -var resolveTable = make([]byte, 256) -var resolveMap = make(map[string]resolveMapItem) - -func init() { - t := resolveTable - t[int('+')] = 'S' // Sign - t[int('-')] = 'S' - for _, c := range "0123456789" { - t[int(c)] = 'D' // Digit - } - for _, c := range "yYnNtTfFoO~" { - t[int(c)] = 'M' // In map - } - t[int('.')] = '.' // Float (potentially in map) - - var resolveMapList = []struct { - v interface{} - tag string - l []string - }{ - {true, yaml_BOOL_TAG, []string{"y", "Y", "yes", "Yes", "YES"}}, - {true, yaml_BOOL_TAG, []string{"true", "True", "TRUE"}}, - {true, yaml_BOOL_TAG, []string{"on", "On", "ON"}}, - {false, yaml_BOOL_TAG, []string{"n", "N", "no", "No", "NO"}}, - {false, yaml_BOOL_TAG, []string{"false", "False", "FALSE"}}, - {false, yaml_BOOL_TAG, []string{"off", "Off", "OFF"}}, - {nil, yaml_NULL_TAG, []string{"", "~", "null", "Null", "NULL"}}, - {math.NaN(), yaml_FLOAT_TAG, []string{".nan", ".NaN", ".NAN"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{".inf", ".Inf", ".INF"}}, - {math.Inf(+1), yaml_FLOAT_TAG, []string{"+.inf", "+.Inf", "+.INF"}}, - {math.Inf(-1), yaml_FLOAT_TAG, []string{"-.inf", "-.Inf", "-.INF"}}, - {"<<", yaml_MERGE_TAG, []string{"<<"}}, - } - - m := resolveMap - for _, item := range resolveMapList { - for _, s := range item.l { - m[s] = resolveMapItem{item.v, item.tag} - } - } -} - -const longTagPrefix = "tag:yaml.org,2002:" - -func shortTag(tag string) string { - // TODO This can easily be made faster and produce less garbage. - if strings.HasPrefix(tag, longTagPrefix) { - return "!!" + tag[len(longTagPrefix):] - } - return tag -} - -func longTag(tag string) string { - if strings.HasPrefix(tag, "!!") { - return longTagPrefix + tag[2:] - } - return tag -} - -func resolvableTag(tag string) bool { - switch tag { - case "", yaml_STR_TAG, yaml_BOOL_TAG, yaml_INT_TAG, yaml_FLOAT_TAG, yaml_NULL_TAG: - return true - } - return false -} - -var yamlStyleFloat = regexp.MustCompile(`^[-+]?[0-9]*\.?[0-9]+([eE][-+][0-9]+)?$`) - -func resolve(tag string, in string) (rtag string, out interface{}) { - if !resolvableTag(tag) { - return tag, in - } - - defer func() { - switch tag { - case "", rtag, yaml_STR_TAG, yaml_BINARY_TAG: - return - } - failf("cannot decode %s `%s` as a %s", shortTag(rtag), in, shortTag(tag)) - }() - - // Any data is accepted as a !!str or !!binary. - // Otherwise, the prefix is enough of a hint about what it might be. - hint := byte('N') - if in != "" { - hint = resolveTable[in[0]] - } - if hint != 0 && tag != yaml_STR_TAG && tag != yaml_BINARY_TAG { - // Handle things we can lookup in a map. - if item, ok := resolveMap[in]; ok { - return item.tag, item.value - } - - // Base 60 floats are a bad idea, were dropped in YAML 1.2, and - // are purposefully unsupported here. They're still quoted on - // the way out for compatibility with other parser, though. - - switch hint { - case 'M': - // We've already checked the map above. - - case '.': - // Not in the map, so maybe a normal float. - floatv, err := strconv.ParseFloat(in, 64) - if err == nil { - return yaml_FLOAT_TAG, floatv - } - - case 'D', 'S': - // Int, float, or timestamp. - plain := strings.Replace(in, "_", "", -1) - intv, err := strconv.ParseInt(plain, 0, 64) - if err == nil { - if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) - } else { - return yaml_INT_TAG, intv - } - } - uintv, err := strconv.ParseUint(plain, 0, 64) - if err == nil { - return yaml_INT_TAG, uintv - } - if yamlStyleFloat.MatchString(plain) { - floatv, err := strconv.ParseFloat(plain, 64) - if err == nil { - return yaml_FLOAT_TAG, floatv - } - } - if strings.HasPrefix(plain, "0b") { - intv, err := strconv.ParseInt(plain[2:], 2, 64) - if err == nil { - if intv == int64(int(intv)) { - return yaml_INT_TAG, int(intv) - } else { - return yaml_INT_TAG, intv - } - } - uintv, err := strconv.ParseUint(plain[2:], 2, 64) - if err == nil { - return yaml_INT_TAG, uintv - } - } else if strings.HasPrefix(plain, "-0b") { - intv, err := strconv.ParseInt(plain[3:], 2, 64) - if err == nil { - if intv == int64(int(intv)) { - return yaml_INT_TAG, -int(intv) - } else { - return yaml_INT_TAG, -intv - } - } - } - // XXX Handle timestamps here. - - default: - panic("resolveTable item not yet handled: " + string(rune(hint)) + " (with " + in + ")") - } - } - if tag == yaml_BINARY_TAG { - return yaml_BINARY_TAG, in - } - if utf8.ValidString(in) { - return yaml_STR_TAG, in - } - return yaml_BINARY_TAG, encodeBase64(in) -} - -// encodeBase64 encodes s as base64 that is broken up into multiple lines -// as appropriate for the resulting length. -func encodeBase64(s string) string { - const lineLen = 70 - encLen := base64.StdEncoding.EncodedLen(len(s)) - lines := encLen/lineLen + 1 - buf := make([]byte, encLen*2+lines) - in := buf[0:encLen] - out := buf[encLen:] - base64.StdEncoding.Encode(in, []byte(s)) - k := 0 - for i := 0; i < len(in); i += lineLen { - j := i + lineLen - if j > len(in) { - j = len(in) - } - k += copy(out[k:], in[i:j]) - if lines > 1 { - out[k] = '\n' - k++ - } - } - return string(out[:k]) -} diff --git a/vendor/gopkg.in/yaml.v2/scannerc.go b/vendor/gopkg.in/yaml.v2/scannerc.go deleted file mode 100644 index 0744844..0000000 --- a/vendor/gopkg.in/yaml.v2/scannerc.go +++ /dev/null @@ -1,2711 +0,0 @@ -package yaml - -import ( - "bytes" - "fmt" -) - -// Introduction -// ************ -// -// The following notes assume that you are familiar with the YAML specification -// (http://yaml.org/spec/1.2/spec.html). We mostly follow it, although in -// some cases we are less restrictive that it requires. -// -// The process of transforming a YAML stream into a sequence of events is -// divided on two steps: Scanning and Parsing. -// -// The Scanner transforms the input stream into a sequence of tokens, while the -// parser transform the sequence of tokens produced by the Scanner into a -// sequence of parsing events. -// -// The Scanner is rather clever and complicated. The Parser, on the contrary, -// is a straightforward implementation of a recursive-descendant parser (or, -// LL(1) parser, as it is usually called). -// -// Actually there are two issues of Scanning that might be called "clever", the -// rest is quite straightforward. The issues are "block collection start" and -// "simple keys". Both issues are explained below in details. -// -// Here the Scanning step is explained and implemented. We start with the list -// of all the tokens produced by the Scanner together with short descriptions. -// -// Now, tokens: -// -// STREAM-START(encoding) # The stream start. -// STREAM-END # The stream end. -// VERSION-DIRECTIVE(major,minor) # The '%YAML' directive. -// TAG-DIRECTIVE(handle,prefix) # The '%TAG' directive. -// DOCUMENT-START # '---' -// DOCUMENT-END # '...' -// BLOCK-SEQUENCE-START # Indentation increase denoting a block -// BLOCK-MAPPING-START # sequence or a block mapping. -// BLOCK-END # Indentation decrease. -// FLOW-SEQUENCE-START # '[' -// FLOW-SEQUENCE-END # ']' -// BLOCK-SEQUENCE-START # '{' -// BLOCK-SEQUENCE-END # '}' -// BLOCK-ENTRY # '-' -// FLOW-ENTRY # ',' -// KEY # '?' or nothing (simple keys). -// VALUE # ':' -// ALIAS(anchor) # '*anchor' -// ANCHOR(anchor) # '&anchor' -// TAG(handle,suffix) # '!handle!suffix' -// SCALAR(value,style) # A scalar. -// -// The following two tokens are "virtual" tokens denoting the beginning and the -// end of the stream: -// -// STREAM-START(encoding) -// STREAM-END -// -// We pass the information about the input stream encoding with the -// STREAM-START token. -// -// The next two tokens are responsible for tags: -// -// VERSION-DIRECTIVE(major,minor) -// TAG-DIRECTIVE(handle,prefix) -// -// Example: -// -// %YAML 1.1 -// %TAG ! !foo -// %TAG !yaml! tag:yaml.org,2002: -// --- -// -// The correspoding sequence of tokens: -// -// STREAM-START(utf-8) -// VERSION-DIRECTIVE(1,1) -// TAG-DIRECTIVE("!","!foo") -// TAG-DIRECTIVE("!yaml","tag:yaml.org,2002:") -// DOCUMENT-START -// STREAM-END -// -// Note that the VERSION-DIRECTIVE and TAG-DIRECTIVE tokens occupy a whole -// line. -// -// The document start and end indicators are represented by: -// -// DOCUMENT-START -// DOCUMENT-END -// -// Note that if a YAML stream contains an implicit document (without '---' -// and '...' indicators), no DOCUMENT-START and DOCUMENT-END tokens will be -// produced. -// -// In the following examples, we present whole documents together with the -// produced tokens. -// -// 1. An implicit document: -// -// 'a scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// STREAM-END -// -// 2. An explicit document: -// -// --- -// 'a scalar' -// ... -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// SCALAR("a scalar",single-quoted) -// DOCUMENT-END -// STREAM-END -// -// 3. Several documents in a stream: -// -// 'a scalar' -// --- -// 'another scalar' -// --- -// 'yet another scalar' -// -// Tokens: -// -// STREAM-START(utf-8) -// SCALAR("a scalar",single-quoted) -// DOCUMENT-START -// SCALAR("another scalar",single-quoted) -// DOCUMENT-START -// SCALAR("yet another scalar",single-quoted) -// STREAM-END -// -// We have already introduced the SCALAR token above. The following tokens are -// used to describe aliases, anchors, tag, and scalars: -// -// ALIAS(anchor) -// ANCHOR(anchor) -// TAG(handle,suffix) -// SCALAR(value,style) -// -// The following series of examples illustrate the usage of these tokens: -// -// 1. A recursive sequence: -// -// &A [ *A ] -// -// Tokens: -// -// STREAM-START(utf-8) -// ANCHOR("A") -// FLOW-SEQUENCE-START -// ALIAS("A") -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A tagged scalar: -// -// !!float "3.14" # A good approximation. -// -// Tokens: -// -// STREAM-START(utf-8) -// TAG("!!","float") -// SCALAR("3.14",double-quoted) -// STREAM-END -// -// 3. Various scalar styles: -// -// --- # Implicit empty plain scalars do not produce tokens. -// --- a plain scalar -// --- 'a single-quoted scalar' -// --- "a double-quoted scalar" -// --- |- -// a literal scalar -// --- >- -// a folded -// scalar -// -// Tokens: -// -// STREAM-START(utf-8) -// DOCUMENT-START -// DOCUMENT-START -// SCALAR("a plain scalar",plain) -// DOCUMENT-START -// SCALAR("a single-quoted scalar",single-quoted) -// DOCUMENT-START -// SCALAR("a double-quoted scalar",double-quoted) -// DOCUMENT-START -// SCALAR("a literal scalar",literal) -// DOCUMENT-START -// SCALAR("a folded scalar",folded) -// STREAM-END -// -// Now it's time to review collection-related tokens. We will start with -// flow collections: -// -// FLOW-SEQUENCE-START -// FLOW-SEQUENCE-END -// FLOW-MAPPING-START -// FLOW-MAPPING-END -// FLOW-ENTRY -// KEY -// VALUE -// -// The tokens FLOW-SEQUENCE-START, FLOW-SEQUENCE-END, FLOW-MAPPING-START, and -// FLOW-MAPPING-END represent the indicators '[', ']', '{', and '}' -// correspondingly. FLOW-ENTRY represent the ',' indicator. Finally the -// indicators '?' and ':', which are used for denoting mapping keys and values, -// are represented by the KEY and VALUE tokens. -// -// The following examples show flow collections: -// -// 1. A flow sequence: -// -// [item 1, item 2, item 3] -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-SEQUENCE-START -// SCALAR("item 1",plain) -// FLOW-ENTRY -// SCALAR("item 2",plain) -// FLOW-ENTRY -// SCALAR("item 3",plain) -// FLOW-SEQUENCE-END -// STREAM-END -// -// 2. A flow mapping: -// -// { -// a simple key: a value, # Note that the KEY token is produced. -// ? a complex key: another value, -// } -// -// Tokens: -// -// STREAM-START(utf-8) -// FLOW-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// FLOW-ENTRY -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// FLOW-ENTRY -// FLOW-MAPPING-END -// STREAM-END -// -// A simple key is a key which is not denoted by the '?' indicator. Note that -// the Scanner still produce the KEY token whenever it encounters a simple key. -// -// For scanning block collections, the following tokens are used (note that we -// repeat KEY and VALUE here): -// -// BLOCK-SEQUENCE-START -// BLOCK-MAPPING-START -// BLOCK-END -// BLOCK-ENTRY -// KEY -// VALUE -// -// The tokens BLOCK-SEQUENCE-START and BLOCK-MAPPING-START denote indentation -// increase that precedes a block collection (cf. the INDENT token in Python). -// The token BLOCK-END denote indentation decrease that ends a block collection -// (cf. the DEDENT token in Python). However YAML has some syntax pecularities -// that makes detections of these tokens more complex. -// -// The tokens BLOCK-ENTRY, KEY, and VALUE are used to represent the indicators -// '-', '?', and ':' correspondingly. -// -// The following examples show how the tokens BLOCK-SEQUENCE-START, -// BLOCK-MAPPING-START, and BLOCK-END are emitted by the Scanner: -// -// 1. Block sequences: -// -// - item 1 -// - item 2 -// - -// - item 3.1 -// - item 3.2 -// - -// key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 3.1",plain) -// BLOCK-ENTRY -// SCALAR("item 3.2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Block mappings: -// -// a simple key: a value # The KEY token is produced here. -// ? a complex key -// : another value -// a mapping: -// key 1: value 1 -// key 2: value 2 -// a sequence: -// - item 1 -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a simple key",plain) -// VALUE -// SCALAR("a value",plain) -// KEY -// SCALAR("a complex key",plain) -// VALUE -// SCALAR("another value",plain) -// KEY -// SCALAR("a mapping",plain) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML does not always require to start a new block collection from a new -// line. If the current line contains only '-', '?', and ':' indicators, a new -// block collection may start at the current line. The following examples -// illustrate this case: -// -// 1. Collections in a sequence: -// -// - - item 1 -// - item 2 -// - key 1: value 1 -// key 2: value 2 -// - ? complex key -// : complex value -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-ENTRY -// BLOCK-MAPPING-START -// KEY -// SCALAR("complex key") -// VALUE -// SCALAR("complex value") -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// 2. Collections in a mapping: -// -// ? a sequence -// : - item 1 -// - item 2 -// ? a mapping -// : key 1: value 1 -// key 2: value 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("a sequence",plain) -// VALUE -// BLOCK-SEQUENCE-START -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// KEY -// SCALAR("a mapping",plain) -// VALUE -// BLOCK-MAPPING-START -// KEY -// SCALAR("key 1",plain) -// VALUE -// SCALAR("value 1",plain) -// KEY -// SCALAR("key 2",plain) -// VALUE -// SCALAR("value 2",plain) -// BLOCK-END -// BLOCK-END -// STREAM-END -// -// YAML also permits non-indented sequences if they are included into a block -// mapping. In this case, the token BLOCK-SEQUENCE-START is not produced: -// -// key: -// - item 1 # BLOCK-SEQUENCE-START is NOT produced here. -// - item 2 -// -// Tokens: -// -// STREAM-START(utf-8) -// BLOCK-MAPPING-START -// KEY -// SCALAR("key",plain) -// VALUE -// BLOCK-ENTRY -// SCALAR("item 1",plain) -// BLOCK-ENTRY -// SCALAR("item 2",plain) -// BLOCK-END -// - -// Ensure that the buffer contains the required number of characters. -// Return true on success, false on failure (reader error or memory error). -func cache(parser *yaml_parser_t, length int) bool { - // [Go] This was inlined: !cache(A, B) -> unread < B && !update(A, B) - return parser.unread >= length || yaml_parser_update_buffer(parser, length) -} - -// Advance the buffer pointer. -func skip(parser *yaml_parser_t) { - parser.mark.index++ - parser.mark.column++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) -} - -func skip_line(parser *yaml_parser_t) { - if is_crlf(parser.buffer, parser.buffer_pos) { - parser.mark.index += 2 - parser.mark.column = 0 - parser.mark.line++ - parser.unread -= 2 - parser.buffer_pos += 2 - } else if is_break(parser.buffer, parser.buffer_pos) { - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - parser.buffer_pos += width(parser.buffer[parser.buffer_pos]) - } -} - -// Copy a character to a string buffer and advance pointers. -func read(parser *yaml_parser_t, s []byte) []byte { - w := width(parser.buffer[parser.buffer_pos]) - if w == 0 { - panic("invalid character sequence") - } - if len(s) == 0 { - s = make([]byte, 0, 32) - } - if w == 1 && len(s)+w <= cap(s) { - s = s[:len(s)+1] - s[len(s)-1] = parser.buffer[parser.buffer_pos] - parser.buffer_pos++ - } else { - s = append(s, parser.buffer[parser.buffer_pos:parser.buffer_pos+w]...) - parser.buffer_pos += w - } - parser.mark.index++ - parser.mark.column++ - parser.unread-- - return s -} - -// Copy a line break character to a string buffer and advance pointers. -func read_line(parser *yaml_parser_t, s []byte) []byte { - buf := parser.buffer - pos := parser.buffer_pos - switch { - case buf[pos] == '\r' && buf[pos+1] == '\n': - // CR LF . LF - s = append(s, '\n') - parser.buffer_pos += 2 - parser.mark.index++ - parser.unread-- - case buf[pos] == '\r' || buf[pos] == '\n': - // CR|LF . LF - s = append(s, '\n') - parser.buffer_pos += 1 - case buf[pos] == '\xC2' && buf[pos+1] == '\x85': - // NEL . LF - s = append(s, '\n') - parser.buffer_pos += 2 - case buf[pos] == '\xE2' && buf[pos+1] == '\x80' && (buf[pos+2] == '\xA8' || buf[pos+2] == '\xA9'): - // LS|PS . LS|PS - s = append(s, buf[parser.buffer_pos:pos+3]...) - parser.buffer_pos += 3 - default: - return s - } - parser.mark.index++ - parser.mark.column = 0 - parser.mark.line++ - parser.unread-- - return s -} - -// Get the next token. -func yaml_parser_scan(parser *yaml_parser_t, token *yaml_token_t) bool { - // Erase the token object. - *token = yaml_token_t{} // [Go] Is this necessary? - - // No tokens after STREAM-END or error. - if parser.stream_end_produced || parser.error != yaml_NO_ERROR { - return true - } - - // Ensure that the tokens queue contains enough tokens. - if !parser.token_available { - if !yaml_parser_fetch_more_tokens(parser) { - return false - } - } - - // Fetch the next token from the queue. - *token = parser.tokens[parser.tokens_head] - parser.tokens_head++ - parser.tokens_parsed++ - parser.token_available = false - - if token.typ == yaml_STREAM_END_TOKEN { - parser.stream_end_produced = true - } - return true -} - -// Set the scanner error and return false. -func yaml_parser_set_scanner_error(parser *yaml_parser_t, context string, context_mark yaml_mark_t, problem string) bool { - parser.error = yaml_SCANNER_ERROR - parser.context = context - parser.context_mark = context_mark - parser.problem = problem - parser.problem_mark = parser.mark - return false -} - -func yaml_parser_set_scanner_tag_error(parser *yaml_parser_t, directive bool, context_mark yaml_mark_t, problem string) bool { - context := "while parsing a tag" - if directive { - context = "while parsing a %TAG directive" - } - return yaml_parser_set_scanner_error(parser, context, context_mark, problem) -} - -func trace(args ...interface{}) func() { - pargs := append([]interface{}{"+++"}, args...) - fmt.Println(pargs...) - pargs = append([]interface{}{"---"}, args...) - return func() { fmt.Println(pargs...) } -} - -// Ensure that the tokens queue contains at least one token which can be -// returned to the Parser. -func yaml_parser_fetch_more_tokens(parser *yaml_parser_t) bool { - // While we need more tokens to fetch, do it. - for { - // Check if we really need to fetch more tokens. - need_more_tokens := false - - if parser.tokens_head == len(parser.tokens) { - // Queue is empty. - need_more_tokens = true - } else { - // Check if any potential simple key may occupy the head position. - if !yaml_parser_stale_simple_keys(parser) { - return false - } - - for i := range parser.simple_keys { - simple_key := &parser.simple_keys[i] - if simple_key.possible && simple_key.token_number == parser.tokens_parsed { - need_more_tokens = true - break - } - } - } - - // We are finished. - if !need_more_tokens { - break - } - // Fetch the next token. - if !yaml_parser_fetch_next_token(parser) { - return false - } - } - - parser.token_available = true - return true -} - -// The dispatcher for token fetchers. -func yaml_parser_fetch_next_token(parser *yaml_parser_t) bool { - // Ensure that the buffer is initialized. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check if we just started scanning. Fetch STREAM-START then. - if !parser.stream_start_produced { - return yaml_parser_fetch_stream_start(parser) - } - - // Eat whitespaces and comments until we reach the next token. - if !yaml_parser_scan_to_next_token(parser) { - return false - } - - // Remove obsolete potential simple keys. - if !yaml_parser_stale_simple_keys(parser) { - return false - } - - // Check the indentation level against the current column. - if !yaml_parser_unroll_indent(parser, parser.mark.column) { - return false - } - - // Ensure that the buffer contains at least 4 characters. 4 is the length - // of the longest indicators ('--- ' and '... '). - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - // Is it the end of the stream? - if is_z(parser.buffer, parser.buffer_pos) { - return yaml_parser_fetch_stream_end(parser) - } - - // Is it a directive? - if parser.mark.column == 0 && parser.buffer[parser.buffer_pos] == '%' { - return yaml_parser_fetch_directive(parser) - } - - buf := parser.buffer - pos := parser.buffer_pos - - // Is it the document start indicator? - if parser.mark.column == 0 && buf[pos] == '-' && buf[pos+1] == '-' && buf[pos+2] == '-' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_START_TOKEN) - } - - // Is it the document end indicator? - if parser.mark.column == 0 && buf[pos] == '.' && buf[pos+1] == '.' && buf[pos+2] == '.' && is_blankz(buf, pos+3) { - return yaml_parser_fetch_document_indicator(parser, yaml_DOCUMENT_END_TOKEN) - } - - // Is it the flow sequence start indicator? - if buf[pos] == '[' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_SEQUENCE_START_TOKEN) - } - - // Is it the flow mapping start indicator? - if parser.buffer[parser.buffer_pos] == '{' { - return yaml_parser_fetch_flow_collection_start(parser, yaml_FLOW_MAPPING_START_TOKEN) - } - - // Is it the flow sequence end indicator? - if parser.buffer[parser.buffer_pos] == ']' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_SEQUENCE_END_TOKEN) - } - - // Is it the flow mapping end indicator? - if parser.buffer[parser.buffer_pos] == '}' { - return yaml_parser_fetch_flow_collection_end(parser, - yaml_FLOW_MAPPING_END_TOKEN) - } - - // Is it the flow entry indicator? - if parser.buffer[parser.buffer_pos] == ',' { - return yaml_parser_fetch_flow_entry(parser) - } - - // Is it the block entry indicator? - if parser.buffer[parser.buffer_pos] == '-' && is_blankz(parser.buffer, parser.buffer_pos+1) { - return yaml_parser_fetch_block_entry(parser) - } - - // Is it the key indicator? - if parser.buffer[parser.buffer_pos] == '?' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_key(parser) - } - - // Is it the value indicator? - if parser.buffer[parser.buffer_pos] == ':' && (parser.flow_level > 0 || is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_value(parser) - } - - // Is it an alias? - if parser.buffer[parser.buffer_pos] == '*' { - return yaml_parser_fetch_anchor(parser, yaml_ALIAS_TOKEN) - } - - // Is it an anchor? - if parser.buffer[parser.buffer_pos] == '&' { - return yaml_parser_fetch_anchor(parser, yaml_ANCHOR_TOKEN) - } - - // Is it a tag? - if parser.buffer[parser.buffer_pos] == '!' { - return yaml_parser_fetch_tag(parser) - } - - // Is it a literal scalar? - if parser.buffer[parser.buffer_pos] == '|' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, true) - } - - // Is it a folded scalar? - if parser.buffer[parser.buffer_pos] == '>' && parser.flow_level == 0 { - return yaml_parser_fetch_block_scalar(parser, false) - } - - // Is it a single-quoted scalar? - if parser.buffer[parser.buffer_pos] == '\'' { - return yaml_parser_fetch_flow_scalar(parser, true) - } - - // Is it a double-quoted scalar? - if parser.buffer[parser.buffer_pos] == '"' { - return yaml_parser_fetch_flow_scalar(parser, false) - } - - // Is it a plain scalar? - // - // A plain scalar may start with any non-blank characters except - // - // '-', '?', ':', ',', '[', ']', '{', '}', - // '#', '&', '*', '!', '|', '>', '\'', '\"', - // '%', '@', '`'. - // - // In the block context (and, for the '-' indicator, in the flow context - // too), it may also start with the characters - // - // '-', '?', ':' - // - // if it is followed by a non-space character. - // - // The last rule is more restrictive than the specification requires. - // [Go] Make this logic more reasonable. - //switch parser.buffer[parser.buffer_pos] { - //case '-', '?', ':', ',', '?', '-', ',', ':', ']', '[', '}', '{', '&', '#', '!', '*', '>', '|', '"', '\'', '@', '%', '-', '`': - //} - if !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '-' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}' || parser.buffer[parser.buffer_pos] == '#' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '*' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '|' || - parser.buffer[parser.buffer_pos] == '>' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '"' || parser.buffer[parser.buffer_pos] == '%' || - parser.buffer[parser.buffer_pos] == '@' || parser.buffer[parser.buffer_pos] == '`') || - (parser.buffer[parser.buffer_pos] == '-' && !is_blank(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level == 0 && - (parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == ':') && - !is_blankz(parser.buffer, parser.buffer_pos+1)) { - return yaml_parser_fetch_plain_scalar(parser) - } - - // If we don't determine the token type so far, it is an error. - return yaml_parser_set_scanner_error(parser, - "while scanning for the next token", parser.mark, - "found character that cannot start any token") -} - -// Check the list of potential simple keys and remove the positions that -// cannot contain simple keys anymore. -func yaml_parser_stale_simple_keys(parser *yaml_parser_t) bool { - // Check for a potential simple key for each flow level. - for i := range parser.simple_keys { - simple_key := &parser.simple_keys[i] - - // The specification requires that a simple key - // - // - is limited to a single line, - // - is shorter than 1024 characters. - if simple_key.possible && (simple_key.mark.line < parser.mark.line || simple_key.mark.index+1024 < parser.mark.index) { - - // Check if the potential simple key to be removed is required. - if simple_key.required { - return yaml_parser_set_scanner_error(parser, - "while scanning a simple key", simple_key.mark, - "could not find expected ':'") - } - simple_key.possible = false - } - } - return true -} - -// Check if a simple key may start at the current position and add it if -// needed. -func yaml_parser_save_simple_key(parser *yaml_parser_t) bool { - // A simple key is required at the current position if the scanner is in - // the block context and the current column coincides with the indentation - // level. - - required := parser.flow_level == 0 && parser.indent == parser.mark.column - - // A simple key is required only when it is the first token in the current - // line. Therefore it is always allowed. But we add a check anyway. - if required && !parser.simple_key_allowed { - panic("should not happen") - } - - // - // If the current position may start a simple key, save it. - // - if parser.simple_key_allowed { - simple_key := yaml_simple_key_t{ - possible: true, - required: required, - token_number: parser.tokens_parsed + (len(parser.tokens) - parser.tokens_head), - } - simple_key.mark = parser.mark - - if !yaml_parser_remove_simple_key(parser) { - return false - } - parser.simple_keys[len(parser.simple_keys)-1] = simple_key - } - return true -} - -// Remove a potential simple key at the current flow level. -func yaml_parser_remove_simple_key(parser *yaml_parser_t) bool { - i := len(parser.simple_keys) - 1 - if parser.simple_keys[i].possible { - // If the key is required, it is an error. - if parser.simple_keys[i].required { - return yaml_parser_set_scanner_error(parser, - "while scanning a simple key", parser.simple_keys[i].mark, - "could not find expected ':'") - } - } - // Remove the key from the stack. - parser.simple_keys[i].possible = false - return true -} - -// Increase the flow level and resize the simple key list if needed. -func yaml_parser_increase_flow_level(parser *yaml_parser_t) bool { - // Reset the simple key on the next level. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) - - // Increase the flow level. - parser.flow_level++ - return true -} - -// Decrease the flow level. -func yaml_parser_decrease_flow_level(parser *yaml_parser_t) bool { - if parser.flow_level > 0 { - parser.flow_level-- - parser.simple_keys = parser.simple_keys[:len(parser.simple_keys)-1] - } - return true -} - -// Push the current indentation level to the stack and set the new level -// the current column is greater than the indentation level. In this case, -// append or insert the specified token into the token queue. -func yaml_parser_roll_indent(parser *yaml_parser_t, column, number int, typ yaml_token_type_t, mark yaml_mark_t) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - if parser.indent < column { - // Push the current indentation level to the stack and set the new - // indentation level. - parser.indents = append(parser.indents, parser.indent) - parser.indent = column - - // Create a token and insert it into the queue. - token := yaml_token_t{ - typ: typ, - start_mark: mark, - end_mark: mark, - } - if number > -1 { - number -= parser.tokens_parsed - } - yaml_insert_token(parser, number, &token) - } - return true -} - -// Pop indentation levels from the indents stack until the current level -// becomes less or equal to the column. For each indentation level, append -// the BLOCK-END token. -func yaml_parser_unroll_indent(parser *yaml_parser_t, column int) bool { - // In the flow context, do nothing. - if parser.flow_level > 0 { - return true - } - - // Loop through the indentation levels in the stack. - for parser.indent > column { - // Create a token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - } - yaml_insert_token(parser, -1, &token) - - // Pop the indentation level. - parser.indent = parser.indents[len(parser.indents)-1] - parser.indents = parser.indents[:len(parser.indents)-1] - } - return true -} - -// Initialize the scanner and produce the STREAM-START token. -func yaml_parser_fetch_stream_start(parser *yaml_parser_t) bool { - - // Set the initial indentation. - parser.indent = -1 - - // Initialize the simple key stack. - parser.simple_keys = append(parser.simple_keys, yaml_simple_key_t{}) - - // A simple key is allowed at the beginning of the stream. - parser.simple_key_allowed = true - - // We have started. - parser.stream_start_produced = true - - // Create the STREAM-START token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_START_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - encoding: parser.encoding, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the STREAM-END token and shut down the scanner. -func yaml_parser_fetch_stream_end(parser *yaml_parser_t) bool { - - // Force new line. - if parser.mark.column != 0 { - parser.mark.column = 0 - parser.mark.line++ - } - - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the STREAM-END token and append it to the queue. - token := yaml_token_t{ - typ: yaml_STREAM_END_TOKEN, - start_mark: parser.mark, - end_mark: parser.mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce a VERSION-DIRECTIVE or TAG-DIRECTIVE token. -func yaml_parser_fetch_directive(parser *yaml_parser_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Create the YAML-DIRECTIVE or TAG-DIRECTIVE token. - token := yaml_token_t{} - if !yaml_parser_scan_directive(parser, &token) { - return false - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the DOCUMENT-START or DOCUMENT-END token. -func yaml_parser_fetch_document_indicator(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset the indentation level. - if !yaml_parser_unroll_indent(parser, -1) { - return false - } - - // Reset simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - parser.simple_key_allowed = false - - // Consume the token. - start_mark := parser.mark - - skip(parser) - skip(parser) - skip(parser) - - end_mark := parser.mark - - // Create the DOCUMENT-START or DOCUMENT-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-START or FLOW-MAPPING-START token. -func yaml_parser_fetch_flow_collection_start(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // The indicators '[' and '{' may start a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // Increase the flow level. - if !yaml_parser_increase_flow_level(parser) { - return false - } - - // A simple key may follow the indicators '[' and '{'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-START of FLOW-MAPPING-START token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-SEQUENCE-END or FLOW-MAPPING-END token. -func yaml_parser_fetch_flow_collection_end(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // Reset any potential simple key on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Decrease the flow level. - if !yaml_parser_decrease_flow_level(parser) { - return false - } - - // No simple keys after the indicators ']' and '}'. - parser.simple_key_allowed = false - - // Consume the token. - - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-SEQUENCE-END of FLOW-MAPPING-END token. - token := yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - } - // Append the token to the queue. - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the FLOW-ENTRY token. -func yaml_parser_fetch_flow_entry(parser *yaml_parser_t) bool { - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after ','. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the FLOW-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_FLOW_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the BLOCK-ENTRY token. -func yaml_parser_fetch_block_entry(parser *yaml_parser_t) bool { - // Check if the scanner is in the block context. - if parser.flow_level == 0 { - // Check if we are allowed to start a new entry. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "block sequence entries are not allowed in this context") - } - // Add the BLOCK-SEQUENCE-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_SEQUENCE_START_TOKEN, parser.mark) { - return false - } - } else { - // It is an error for the '-' indicator to occur in the flow context, - // but we let the Parser detect and report about it because the Parser - // is able to point to the context. - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '-'. - parser.simple_key_allowed = true - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the BLOCK-ENTRY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_BLOCK_ENTRY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the KEY token. -func yaml_parser_fetch_key(parser *yaml_parser_t) bool { - - // In the block context, additional checks are required. - if parser.flow_level == 0 { - // Check if we are allowed to start a new key (not nessesary simple). - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping keys are not allowed in this context") - } - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Reset any potential simple keys on the current flow level. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // Simple keys are allowed after '?' in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the KEY token and append it to the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the VALUE token. -func yaml_parser_fetch_value(parser *yaml_parser_t) bool { - - simple_key := &parser.simple_keys[len(parser.simple_keys)-1] - - // Have we found a simple key? - if simple_key.possible { - // Create the KEY token and insert it into the queue. - token := yaml_token_t{ - typ: yaml_KEY_TOKEN, - start_mark: simple_key.mark, - end_mark: simple_key.mark, - } - yaml_insert_token(parser, simple_key.token_number-parser.tokens_parsed, &token) - - // In the block context, we may need to add the BLOCK-MAPPING-START token. - if !yaml_parser_roll_indent(parser, simple_key.mark.column, - simple_key.token_number, - yaml_BLOCK_MAPPING_START_TOKEN, simple_key.mark) { - return false - } - - // Remove the simple key. - simple_key.possible = false - - // A simple key cannot follow another simple key. - parser.simple_key_allowed = false - - } else { - // The ':' indicator follows a complex key. - - // In the block context, extra checks are required. - if parser.flow_level == 0 { - - // Check if we are allowed to start a complex value. - if !parser.simple_key_allowed { - return yaml_parser_set_scanner_error(parser, "", parser.mark, - "mapping values are not allowed in this context") - } - - // Add the BLOCK-MAPPING-START token if needed. - if !yaml_parser_roll_indent(parser, parser.mark.column, -1, yaml_BLOCK_MAPPING_START_TOKEN, parser.mark) { - return false - } - } - - // Simple keys after ':' are allowed in the block context. - parser.simple_key_allowed = parser.flow_level == 0 - } - - // Consume the token. - start_mark := parser.mark - skip(parser) - end_mark := parser.mark - - // Create the VALUE token and append it to the queue. - token := yaml_token_t{ - typ: yaml_VALUE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the ALIAS or ANCHOR token. -func yaml_parser_fetch_anchor(parser *yaml_parser_t, typ yaml_token_type_t) bool { - // An anchor or an alias could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow an anchor or an alias. - parser.simple_key_allowed = false - - // Create the ALIAS or ANCHOR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_anchor(parser, &token, typ) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the TAG token. -func yaml_parser_fetch_tag(parser *yaml_parser_t) bool { - // A tag could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a tag. - parser.simple_key_allowed = false - - // Create the TAG token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_tag(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,literal) or SCALAR(...,folded) tokens. -func yaml_parser_fetch_block_scalar(parser *yaml_parser_t, literal bool) bool { - // Remove any potential simple keys. - if !yaml_parser_remove_simple_key(parser) { - return false - } - - // A simple key may follow a block scalar. - parser.simple_key_allowed = true - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_block_scalar(parser, &token, literal) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,single-quoted) or SCALAR(...,double-quoted) tokens. -func yaml_parser_fetch_flow_scalar(parser *yaml_parser_t, single bool) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_flow_scalar(parser, &token, single) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Produce the SCALAR(...,plain) token. -func yaml_parser_fetch_plain_scalar(parser *yaml_parser_t) bool { - // A plain scalar could be a simple key. - if !yaml_parser_save_simple_key(parser) { - return false - } - - // A simple key cannot follow a flow scalar. - parser.simple_key_allowed = false - - // Create the SCALAR token and append it to the queue. - var token yaml_token_t - if !yaml_parser_scan_plain_scalar(parser, &token) { - return false - } - yaml_insert_token(parser, -1, &token) - return true -} - -// Eat whitespaces and comments until the next token is found. -func yaml_parser_scan_to_next_token(parser *yaml_parser_t) bool { - - // Until the next token is not found. - for { - // Allow the BOM mark to start a line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.mark.column == 0 && is_bom(parser.buffer, parser.buffer_pos) { - skip(parser) - } - - // Eat whitespaces. - // Tabs are allowed: - // - in the flow context - // - in the block context, but not at the beginning of the line or - // after '-', '?', or ':' (complex value). - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for parser.buffer[parser.buffer_pos] == ' ' || ((parser.flow_level > 0 || !parser.simple_key_allowed) && parser.buffer[parser.buffer_pos] == '\t') { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Eat a comment until a line break. - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // If it is a line break, eat it. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - - // In the block context, a new line may start a simple key. - if parser.flow_level == 0 { - parser.simple_key_allowed = true - } - } else { - break // We have found a token. - } - } - - return true -} - -// Scan a YAML-DIRECTIVE or TAG-DIRECTIVE token. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_directive(parser *yaml_parser_t, token *yaml_token_t) bool { - // Eat '%'. - start_mark := parser.mark - skip(parser) - - // Scan the directive name. - var name []byte - if !yaml_parser_scan_directive_name(parser, start_mark, &name) { - return false - } - - // Is it a YAML directive? - if bytes.Equal(name, []byte("YAML")) { - // Scan the VERSION directive value. - var major, minor int8 - if !yaml_parser_scan_version_directive_value(parser, start_mark, &major, &minor) { - return false - } - end_mark := parser.mark - - // Create a VERSION-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_VERSION_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - major: major, - minor: minor, - } - - // Is it a TAG directive? - } else if bytes.Equal(name, []byte("TAG")) { - // Scan the TAG directive value. - var handle, prefix []byte - if !yaml_parser_scan_tag_directive_value(parser, start_mark, &handle, &prefix) { - return false - } - end_mark := parser.mark - - // Create a TAG-DIRECTIVE token. - *token = yaml_token_t{ - typ: yaml_TAG_DIRECTIVE_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - prefix: prefix, - } - - // Unknown directive. - } else { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unknown directive name") - return false - } - - // Eat the rest of the line including any comments. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - return true -} - -// Scan the directive name. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^ -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^ -// -func yaml_parser_scan_directive_name(parser *yaml_parser_t, start_mark yaml_mark_t, name *[]byte) bool { - // Consume the directive name. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - var s []byte - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the name is empty. - if len(s) == 0 { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "could not find expected directive name") - return false - } - - // Check for an blank character after the name. - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a directive", - start_mark, "found unexpected non-alphabetical character") - return false - } - *name = s - return true -} - -// Scan the value of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^^^^^^ -func yaml_parser_scan_version_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, major, minor *int8) bool { - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the major version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, major) { - return false - } - - // Eat '.'. - if parser.buffer[parser.buffer_pos] != '.' { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected digit or '.' character") - } - - skip(parser) - - // Consume the minor version number. - if !yaml_parser_scan_version_directive_number(parser, start_mark, minor) { - return false - } - return true -} - -const max_number_length = 2 - -// Scan the version number of VERSION-DIRECTIVE. -// -// Scope: -// %YAML 1.1 # a comment \n -// ^ -// %YAML 1.1 # a comment \n -// ^ -func yaml_parser_scan_version_directive_number(parser *yaml_parser_t, start_mark yaml_mark_t, number *int8) bool { - - // Repeat while the next character is digit. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var value, length int8 - for is_digit(parser.buffer, parser.buffer_pos) { - // Check if the number is too long. - length++ - if length > max_number_length { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "found extremely long version number") - } - value = value*10 + int8(as_digit(parser.buffer, parser.buffer_pos)) - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the number was present. - if length == 0 { - return yaml_parser_set_scanner_error(parser, "while scanning a %YAML directive", - start_mark, "did not find expected version number") - } - *number = value - return true -} - -// Scan the value of a TAG-DIRECTIVE token. -// -// Scope: -// %TAG !yaml! tag:yaml.org,2002: \n -// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -// -func yaml_parser_scan_tag_directive_value(parser *yaml_parser_t, start_mark yaml_mark_t, handle, prefix *[]byte) bool { - var handle_value, prefix_value []byte - - // Eat whitespaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a handle. - if !yaml_parser_scan_tag_handle(parser, true, start_mark, &handle_value) { - return false - } - - // Expect a whitespace. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blank(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace") - return false - } - - // Eat whitespaces. - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Scan a prefix. - if !yaml_parser_scan_tag_uri(parser, true, nil, start_mark, &prefix_value) { - return false - } - - // Expect a whitespace or line break. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a %TAG directive", - start_mark, "did not find expected whitespace or line break") - return false - } - - *handle = handle_value - *prefix = prefix_value - return true -} - -func yaml_parser_scan_anchor(parser *yaml_parser_t, token *yaml_token_t, typ yaml_token_type_t) bool { - var s []byte - - // Eat the indicator character. - start_mark := parser.mark - skip(parser) - - // Consume the value. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - end_mark := parser.mark - - /* - * Check if length of the anchor is greater than 0 and it is followed by - * a whitespace character or one of the indicators: - * - * '?', ':', ',', ']', '}', '%', '@', '`'. - */ - - if len(s) == 0 || - !(is_blankz(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == ',' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '}' || - parser.buffer[parser.buffer_pos] == '%' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '`') { - context := "while scanning an alias" - if typ == yaml_ANCHOR_TOKEN { - context = "while scanning an anchor" - } - yaml_parser_set_scanner_error(parser, context, start_mark, - "did not find expected alphabetic or numeric character") - return false - } - - // Create a token. - *token = yaml_token_t{ - typ: typ, - start_mark: start_mark, - end_mark: end_mark, - value: s, - } - - return true -} - -/* - * Scan a TAG token. - */ - -func yaml_parser_scan_tag(parser *yaml_parser_t, token *yaml_token_t) bool { - var handle, suffix []byte - - start_mark := parser.mark - - // Check if the tag is in the canonical form. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - if parser.buffer[parser.buffer_pos+1] == '<' { - // Keep the handle as '' - - // Eat '!<' - skip(parser) - skip(parser) - - // Consume the tag value. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - - // Check for '>' and eat it. - if parser.buffer[parser.buffer_pos] != '>' { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find the expected '>'") - return false - } - - skip(parser) - } else { - // The tag has either the '!suffix' or the '!handle!suffix' form. - - // First, try to scan a handle. - if !yaml_parser_scan_tag_handle(parser, false, start_mark, &handle) { - return false - } - - // Check if it is, indeed, handle. - if handle[0] == '!' && len(handle) > 1 && handle[len(handle)-1] == '!' { - // Scan the suffix now. - if !yaml_parser_scan_tag_uri(parser, false, nil, start_mark, &suffix) { - return false - } - } else { - // It wasn't a handle after all. Scan the rest of the tag. - if !yaml_parser_scan_tag_uri(parser, false, handle, start_mark, &suffix) { - return false - } - - // Set the handle to '!'. - handle = []byte{'!'} - - // A special case: the '!' tag. Set the handle to '' and the - // suffix to '!'. - if len(suffix) == 0 { - handle, suffix = suffix, handle - } - } - } - - // Check the character which ends the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if !is_blankz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a tag", - start_mark, "did not find expected whitespace or line break") - return false - } - - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_TAG_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: handle, - suffix: suffix, - } - return true -} - -// Scan a tag handle. -func yaml_parser_scan_tag_handle(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, handle *[]byte) bool { - // Check the initial '!' character. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] != '!' { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - - var s []byte - - // Copy the '!' character. - s = read(parser, s) - - // Copy all subsequent alphabetical and numerical characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_alpha(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check if the trailing character is '!' and copy it. - if parser.buffer[parser.buffer_pos] == '!' { - s = read(parser, s) - } else { - // It's either the '!' tag or not really a tag handle. If it's a %TAG - // directive, it's an error. If it's a tag token, it must be a part of URI. - if directive && string(s) != "!" { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected '!'") - return false - } - } - - *handle = s - return true -} - -// Scan a tag. -func yaml_parser_scan_tag_uri(parser *yaml_parser_t, directive bool, head []byte, start_mark yaml_mark_t, uri *[]byte) bool { - //size_t length = head ? strlen((char *)head) : 0 - var s []byte - hasTag := len(head) > 0 - - // Copy the head if needed. - // - // Note that we don't copy the leading '!' character. - if len(head) > 1 { - s = append(s, head[1:]...) - } - - // Scan the tag. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // The set of characters that may appear in URI is as follows: - // - // '0'-'9', 'A'-'Z', 'a'-'z', '_', '-', ';', '/', '?', ':', '@', '&', - // '=', '+', '$', ',', '.', '!', '~', '*', '\'', '(', ')', '[', ']', - // '%'. - // [Go] Convert this into more reasonable logic. - for is_alpha(parser.buffer, parser.buffer_pos) || parser.buffer[parser.buffer_pos] == ';' || - parser.buffer[parser.buffer_pos] == '/' || parser.buffer[parser.buffer_pos] == '?' || - parser.buffer[parser.buffer_pos] == ':' || parser.buffer[parser.buffer_pos] == '@' || - parser.buffer[parser.buffer_pos] == '&' || parser.buffer[parser.buffer_pos] == '=' || - parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '$' || - parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == '.' || - parser.buffer[parser.buffer_pos] == '!' || parser.buffer[parser.buffer_pos] == '~' || - parser.buffer[parser.buffer_pos] == '*' || parser.buffer[parser.buffer_pos] == '\'' || - parser.buffer[parser.buffer_pos] == '(' || parser.buffer[parser.buffer_pos] == ')' || - parser.buffer[parser.buffer_pos] == '[' || parser.buffer[parser.buffer_pos] == ']' || - parser.buffer[parser.buffer_pos] == '%' { - // Check if it is a URI-escape sequence. - if parser.buffer[parser.buffer_pos] == '%' { - if !yaml_parser_scan_uri_escapes(parser, directive, start_mark, &s) { - return false - } - } else { - s = read(parser, s) - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - hasTag = true - } - - if !hasTag { - yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find expected tag URI") - return false - } - *uri = s - return true -} - -// Decode an URI-escape sequence corresponding to a single UTF-8 character. -func yaml_parser_scan_uri_escapes(parser *yaml_parser_t, directive bool, start_mark yaml_mark_t, s *[]byte) bool { - - // Decode the required number of characters. - w := 1024 - for w > 0 { - // Check for a URI-escaped octet. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - - if !(parser.buffer[parser.buffer_pos] == '%' && - is_hex(parser.buffer, parser.buffer_pos+1) && - is_hex(parser.buffer, parser.buffer_pos+2)) { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "did not find URI escaped octet") - } - - // Get the octet. - octet := byte((as_hex(parser.buffer, parser.buffer_pos+1) << 4) + as_hex(parser.buffer, parser.buffer_pos+2)) - - // If it is the leading octet, determine the length of the UTF-8 sequence. - if w == 1024 { - w = width(octet) - if w == 0 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect leading UTF-8 octet") - } - } else { - // Check if the trailing octet is correct. - if octet&0xC0 != 0x80 { - return yaml_parser_set_scanner_tag_error(parser, directive, - start_mark, "found an incorrect trailing UTF-8 octet") - } - } - - // Copy the octet and move the pointers. - *s = append(*s, octet) - skip(parser) - skip(parser) - skip(parser) - w-- - } - return true -} - -// Scan a block scalar. -func yaml_parser_scan_block_scalar(parser *yaml_parser_t, token *yaml_token_t, literal bool) bool { - // Eat the indicator '|' or '>'. - start_mark := parser.mark - skip(parser) - - // Scan the additional block scalar indicators. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - // Check for a chomping indicator. - var chomping, increment int - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - // Set the chomping method and eat the indicator. - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - - // Check for an indentation indicator. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if is_digit(parser.buffer, parser.buffer_pos) { - // Check that the indentation is greater than 0. - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - - // Get the indentation level and eat the indicator. - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - } - - } else if is_digit(parser.buffer, parser.buffer_pos) { - // Do the same as above, but in the opposite order. - - if parser.buffer[parser.buffer_pos] == '0' { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found an indentation indicator equal to 0") - return false - } - increment = as_digit(parser.buffer, parser.buffer_pos) - skip(parser) - - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - if parser.buffer[parser.buffer_pos] == '+' || parser.buffer[parser.buffer_pos] == '-' { - if parser.buffer[parser.buffer_pos] == '+' { - chomping = +1 - } else { - chomping = -1 - } - skip(parser) - } - } - - // Eat whitespaces and comments to the end of the line. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for is_blank(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.buffer[parser.buffer_pos] == '#' { - for !is_breakz(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - } - - // Check if we are at the end of the line. - if !is_breakz(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "did not find expected comment or line break") - return false - } - - // Eat a line break. - if is_break(parser.buffer, parser.buffer_pos) { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - skip_line(parser) - } - - end_mark := parser.mark - - // Set the indentation level if it was specified. - var indent int - if increment > 0 { - if parser.indent >= 0 { - indent = parser.indent + increment - } else { - indent = increment - } - } - - // Scan the leading line breaks and determine the indentation level if needed. - var s, leading_break, trailing_breaks []byte - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - - // Scan the block scalar content. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - var leading_blank, trailing_blank bool - for parser.mark.column == indent && !is_z(parser.buffer, parser.buffer_pos) { - // We are at the beginning of a non-empty line. - - // Is it a trailing whitespace? - trailing_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Check if we need to fold the leading line break. - if !literal && !leading_blank && !trailing_blank && len(leading_break) > 0 && leading_break[0] == '\n' { - // Do we need to join the lines by space? - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } - } else { - s = append(s, leading_break...) - } - leading_break = leading_break[:0] - - // Append the remaining line breaks. - s = append(s, trailing_breaks...) - trailing_breaks = trailing_breaks[:0] - - // Is it a leading whitespace? - leading_blank = is_blank(parser.buffer, parser.buffer_pos) - - // Consume the current line. - for !is_breakz(parser.buffer, parser.buffer_pos) { - s = read(parser, s) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - leading_break = read_line(parser, leading_break) - - // Eat the following indentation spaces and line breaks. - if !yaml_parser_scan_block_scalar_breaks(parser, &indent, &trailing_breaks, start_mark, &end_mark) { - return false - } - } - - // Chomp the tail. - if chomping != -1 { - s = append(s, leading_break...) - } - if chomping == 1 { - s = append(s, trailing_breaks...) - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_LITERAL_SCALAR_STYLE, - } - if !literal { - token.style = yaml_FOLDED_SCALAR_STYLE - } - return true -} - -// Scan indentation spaces and line breaks for a block scalar. Determine the -// indentation level if needed. -func yaml_parser_scan_block_scalar_breaks(parser *yaml_parser_t, indent *int, breaks *[]byte, start_mark yaml_mark_t, end_mark *yaml_mark_t) bool { - *end_mark = parser.mark - - // Eat the indentation spaces and line breaks. - max_indent := 0 - for { - // Eat the indentation spaces. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - for (*indent == 0 || parser.mark.column < *indent) && is_space(parser.buffer, parser.buffer_pos) { - skip(parser) - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - if parser.mark.column > max_indent { - max_indent = parser.mark.column - } - - // Check for a tab character messing the indentation. - if (*indent == 0 || parser.mark.column < *indent) && is_tab(parser.buffer, parser.buffer_pos) { - return yaml_parser_set_scanner_error(parser, "while scanning a block scalar", - start_mark, "found a tab character where an indentation space is expected") - } - - // Have we found a non-empty line? - if !is_break(parser.buffer, parser.buffer_pos) { - break - } - - // Consume the line break. - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - // [Go] Should really be returning breaks instead. - *breaks = read_line(parser, *breaks) - *end_mark = parser.mark - } - - // Determine the indentation level if needed. - if *indent == 0 { - *indent = max_indent - if *indent < parser.indent+1 { - *indent = parser.indent + 1 - } - if *indent < 1 { - *indent = 1 - } - } - return true -} - -// Scan a quoted scalar. -func yaml_parser_scan_flow_scalar(parser *yaml_parser_t, token *yaml_token_t, single bool) bool { - // Eat the left quote. - start_mark := parser.mark - skip(parser) - - // Consume the content of the quoted scalar. - var s, leading_break, trailing_breaks, whitespaces []byte - for { - // Check that there are no document indicators at the beginning of the line. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected document indicator") - return false - } - - // Check for EOF. - if is_z(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a quoted scalar", - start_mark, "found unexpected end of stream") - return false - } - - // Consume non-blank characters. - leading_blanks := false - for !is_blankz(parser.buffer, parser.buffer_pos) { - if single && parser.buffer[parser.buffer_pos] == '\'' && parser.buffer[parser.buffer_pos+1] == '\'' { - // Is is an escaped single quote. - s = append(s, '\'') - skip(parser) - skip(parser) - - } else if single && parser.buffer[parser.buffer_pos] == '\'' { - // It is a right single quote. - break - } else if !single && parser.buffer[parser.buffer_pos] == '"' { - // It is a right double quote. - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' && is_break(parser.buffer, parser.buffer_pos+1) { - // It is an escaped line break. - if parser.unread < 3 && !yaml_parser_update_buffer(parser, 3) { - return false - } - skip(parser) - skip_line(parser) - leading_blanks = true - break - - } else if !single && parser.buffer[parser.buffer_pos] == '\\' { - // It is an escape sequence. - code_length := 0 - - // Check the escape character. - switch parser.buffer[parser.buffer_pos+1] { - case '0': - s = append(s, 0) - case 'a': - s = append(s, '\x07') - case 'b': - s = append(s, '\x08') - case 't', '\t': - s = append(s, '\x09') - case 'n': - s = append(s, '\x0A') - case 'v': - s = append(s, '\x0B') - case 'f': - s = append(s, '\x0C') - case 'r': - s = append(s, '\x0D') - case 'e': - s = append(s, '\x1B') - case ' ': - s = append(s, '\x20') - case '"': - s = append(s, '"') - case '\'': - s = append(s, '\'') - case '\\': - s = append(s, '\\') - case 'N': // NEL (#x85) - s = append(s, '\xC2') - s = append(s, '\x85') - case '_': // #xA0 - s = append(s, '\xC2') - s = append(s, '\xA0') - case 'L': // LS (#x2028) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA8') - case 'P': // PS (#x2029) - s = append(s, '\xE2') - s = append(s, '\x80') - s = append(s, '\xA9') - case 'x': - code_length = 2 - case 'u': - code_length = 4 - case 'U': - code_length = 8 - default: - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found unknown escape character") - return false - } - - skip(parser) - skip(parser) - - // Consume an arbitrary escape code. - if code_length > 0 { - var value int - - // Scan the character value. - if parser.unread < code_length && !yaml_parser_update_buffer(parser, code_length) { - return false - } - for k := 0; k < code_length; k++ { - if !is_hex(parser.buffer, parser.buffer_pos+k) { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "did not find expected hexdecimal number") - return false - } - value = (value << 4) + as_hex(parser.buffer, parser.buffer_pos+k) - } - - // Check the value and write the character. - if (value >= 0xD800 && value <= 0xDFFF) || value > 0x10FFFF { - yaml_parser_set_scanner_error(parser, "while parsing a quoted scalar", - start_mark, "found invalid Unicode character escape code") - return false - } - if value <= 0x7F { - s = append(s, byte(value)) - } else if value <= 0x7FF { - s = append(s, byte(0xC0+(value>>6))) - s = append(s, byte(0x80+(value&0x3F))) - } else if value <= 0xFFFF { - s = append(s, byte(0xE0+(value>>12))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } else { - s = append(s, byte(0xF0+(value>>18))) - s = append(s, byte(0x80+((value>>12)&0x3F))) - s = append(s, byte(0x80+((value>>6)&0x3F))) - s = append(s, byte(0x80+(value&0x3F))) - } - - // Advance the pointer. - for k := 0; k < code_length; k++ { - skip(parser) - } - } - } else { - // It is a non-escaped non-blank character. - s = read(parser, s) - } - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - // Check if we are at the end of the scalar. - if single { - if parser.buffer[parser.buffer_pos] == '\'' { - break - } - } else { - if parser.buffer[parser.buffer_pos] == '"' { - break - } - } - - // Consume blank characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Join the whitespaces or fold line breaks. - if leading_blanks { - // Do we need to fold line breaks? - if len(leading_break) > 0 && leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Eat the right quote. - skip(parser) - end_mark := parser.mark - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_SINGLE_QUOTED_SCALAR_STYLE, - } - if !single { - token.style = yaml_DOUBLE_QUOTED_SCALAR_STYLE - } - return true -} - -// Scan a plain scalar. -func yaml_parser_scan_plain_scalar(parser *yaml_parser_t, token *yaml_token_t) bool { - - var s, leading_break, trailing_breaks, whitespaces []byte - var leading_blanks bool - var indent = parser.indent + 1 - - start_mark := parser.mark - end_mark := parser.mark - - // Consume the content of the plain scalar. - for { - // Check for a document indicator. - if parser.unread < 4 && !yaml_parser_update_buffer(parser, 4) { - return false - } - if parser.mark.column == 0 && - ((parser.buffer[parser.buffer_pos+0] == '-' && - parser.buffer[parser.buffer_pos+1] == '-' && - parser.buffer[parser.buffer_pos+2] == '-') || - (parser.buffer[parser.buffer_pos+0] == '.' && - parser.buffer[parser.buffer_pos+1] == '.' && - parser.buffer[parser.buffer_pos+2] == '.')) && - is_blankz(parser.buffer, parser.buffer_pos+3) { - break - } - - // Check for a comment. - if parser.buffer[parser.buffer_pos] == '#' { - break - } - - // Consume non-blank characters. - for !is_blankz(parser.buffer, parser.buffer_pos) { - - // Check for 'x:x' in the flow context. TODO: Fix the test "spec-08-13". - if parser.flow_level > 0 && - parser.buffer[parser.buffer_pos] == ':' && - !is_blankz(parser.buffer, parser.buffer_pos+1) { - yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", - start_mark, "found unexpected ':'") - return false - } - - // Check for indicators that may end a plain scalar. - if (parser.buffer[parser.buffer_pos] == ':' && is_blankz(parser.buffer, parser.buffer_pos+1)) || - (parser.flow_level > 0 && - (parser.buffer[parser.buffer_pos] == ',' || parser.buffer[parser.buffer_pos] == ':' || - parser.buffer[parser.buffer_pos] == '?' || parser.buffer[parser.buffer_pos] == '[' || - parser.buffer[parser.buffer_pos] == ']' || parser.buffer[parser.buffer_pos] == '{' || - parser.buffer[parser.buffer_pos] == '}')) { - break - } - - // Check if we need to join whitespaces and breaks. - if leading_blanks || len(whitespaces) > 0 { - if leading_blanks { - // Do we need to fold line breaks? - if leading_break[0] == '\n' { - if len(trailing_breaks) == 0 { - s = append(s, ' ') - } else { - s = append(s, trailing_breaks...) - } - } else { - s = append(s, leading_break...) - s = append(s, trailing_breaks...) - } - trailing_breaks = trailing_breaks[:0] - leading_break = leading_break[:0] - leading_blanks = false - } else { - s = append(s, whitespaces...) - whitespaces = whitespaces[:0] - } - } - - // Copy the character. - s = read(parser, s) - - end_mark = parser.mark - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - } - - // Is it the end? - if !(is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos)) { - break - } - - // Consume blank characters. - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - - for is_blank(parser.buffer, parser.buffer_pos) || is_break(parser.buffer, parser.buffer_pos) { - if is_blank(parser.buffer, parser.buffer_pos) { - - // Check for tab character that abuse indentation. - if leading_blanks && parser.mark.column < indent && is_tab(parser.buffer, parser.buffer_pos) { - yaml_parser_set_scanner_error(parser, "while scanning a plain scalar", - start_mark, "found a tab character that violate indentation") - return false - } - - // Consume a space or a tab character. - if !leading_blanks { - whitespaces = read(parser, whitespaces) - } else { - skip(parser) - } - } else { - if parser.unread < 2 && !yaml_parser_update_buffer(parser, 2) { - return false - } - - // Check if it is a first line break. - if !leading_blanks { - whitespaces = whitespaces[:0] - leading_break = read_line(parser, leading_break) - leading_blanks = true - } else { - trailing_breaks = read_line(parser, trailing_breaks) - } - } - if parser.unread < 1 && !yaml_parser_update_buffer(parser, 1) { - return false - } - } - - // Check indentation level. - if parser.flow_level == 0 && parser.mark.column < indent { - break - } - } - - // Create a token. - *token = yaml_token_t{ - typ: yaml_SCALAR_TOKEN, - start_mark: start_mark, - end_mark: end_mark, - value: s, - style: yaml_PLAIN_SCALAR_STYLE, - } - - // Note that we change the 'simple_key_allowed' flag. - if leading_blanks { - parser.simple_key_allowed = true - } - return true -} diff --git a/vendor/gopkg.in/yaml.v2/sorter.go b/vendor/gopkg.in/yaml.v2/sorter.go deleted file mode 100644 index 5958822..0000000 --- a/vendor/gopkg.in/yaml.v2/sorter.go +++ /dev/null @@ -1,104 +0,0 @@ -package yaml - -import ( - "reflect" - "unicode" -) - -type keyList []reflect.Value - -func (l keyList) Len() int { return len(l) } -func (l keyList) Swap(i, j int) { l[i], l[j] = l[j], l[i] } -func (l keyList) Less(i, j int) bool { - a := l[i] - b := l[j] - ak := a.Kind() - bk := b.Kind() - for (ak == reflect.Interface || ak == reflect.Ptr) && !a.IsNil() { - a = a.Elem() - ak = a.Kind() - } - for (bk == reflect.Interface || bk == reflect.Ptr) && !b.IsNil() { - b = b.Elem() - bk = b.Kind() - } - af, aok := keyFloat(a) - bf, bok := keyFloat(b) - if aok && bok { - if af != bf { - return af < bf - } - if ak != bk { - return ak < bk - } - return numLess(a, b) - } - if ak != reflect.String || bk != reflect.String { - return ak < bk - } - ar, br := []rune(a.String()), []rune(b.String()) - for i := 0; i < len(ar) && i < len(br); i++ { - if ar[i] == br[i] { - continue - } - al := unicode.IsLetter(ar[i]) - bl := unicode.IsLetter(br[i]) - if al && bl { - return ar[i] < br[i] - } - if al || bl { - return bl - } - var ai, bi int - var an, bn int64 - for ai = i; ai < len(ar) && unicode.IsDigit(ar[ai]); ai++ { - an = an*10 + int64(ar[ai]-'0') - } - for bi = i; bi < len(br) && unicode.IsDigit(br[bi]); bi++ { - bn = bn*10 + int64(br[bi]-'0') - } - if an != bn { - return an < bn - } - if ai != bi { - return ai < bi - } - return ar[i] < br[i] - } - return len(ar) < len(br) -} - -// keyFloat returns a float value for v if it is a number/bool -// and whether it is a number/bool or not. -func keyFloat(v reflect.Value) (f float64, ok bool) { - switch v.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return float64(v.Int()), true - case reflect.Float32, reflect.Float64: - return v.Float(), true - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return float64(v.Uint()), true - case reflect.Bool: - if v.Bool() { - return 1, true - } - return 0, true - } - return 0, false -} - -// numLess returns whether a < b. -// a and b must necessarily have the same kind. -func numLess(a, b reflect.Value) bool { - switch a.Kind() { - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return a.Int() < b.Int() - case reflect.Float32, reflect.Float64: - return a.Float() < b.Float() - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return a.Uint() < b.Uint() - case reflect.Bool: - return !a.Bool() && b.Bool() - } - panic("not a number") -} diff --git a/vendor/gopkg.in/yaml.v2/suite_test.go b/vendor/gopkg.in/yaml.v2/suite_test.go deleted file mode 100644 index c5cf1ed..0000000 --- a/vendor/gopkg.in/yaml.v2/suite_test.go +++ /dev/null @@ -1,12 +0,0 @@ -package yaml_test - -import ( - . "gopkg.in/check.v1" - "testing" -) - -func Test(t *testing.T) { TestingT(t) } - -type S struct{} - -var _ = Suite(&S{}) diff --git a/vendor/gopkg.in/yaml.v2/writerc.go b/vendor/gopkg.in/yaml.v2/writerc.go deleted file mode 100644 index 190362f..0000000 --- a/vendor/gopkg.in/yaml.v2/writerc.go +++ /dev/null @@ -1,89 +0,0 @@ -package yaml - -// Set the writer error and return false. -func yaml_emitter_set_writer_error(emitter *yaml_emitter_t, problem string) bool { - emitter.error = yaml_WRITER_ERROR - emitter.problem = problem - return false -} - -// Flush the output buffer. -func yaml_emitter_flush(emitter *yaml_emitter_t) bool { - if emitter.write_handler == nil { - panic("write handler not set") - } - - // Check if the buffer is empty. - if emitter.buffer_pos == 0 { - return true - } - - // If the output encoding is UTF-8, we don't need to recode the buffer. - if emitter.encoding == yaml_UTF8_ENCODING { - if err := emitter.write_handler(emitter, emitter.buffer[:emitter.buffer_pos]); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - return true - } - - // Recode the buffer into the raw buffer. - var low, high int - if emitter.encoding == yaml_UTF16LE_ENCODING { - low, high = 0, 1 - } else { - high, low = 1, 0 - } - - pos := 0 - for pos < emitter.buffer_pos { - // See the "reader.c" code for more details on UTF-8 encoding. Note - // that we assume that the buffer contains a valid UTF-8 sequence. - - // Read the next UTF-8 character. - octet := emitter.buffer[pos] - - var w int - var value rune - switch { - case octet&0x80 == 0x00: - w, value = 1, rune(octet&0x7F) - case octet&0xE0 == 0xC0: - w, value = 2, rune(octet&0x1F) - case octet&0xF0 == 0xE0: - w, value = 3, rune(octet&0x0F) - case octet&0xF8 == 0xF0: - w, value = 4, rune(octet&0x07) - } - for k := 1; k < w; k++ { - octet = emitter.buffer[pos+k] - value = (value << 6) + (rune(octet) & 0x3F) - } - pos += w - - // Write the character. - if value < 0x10000 { - var b [2]byte - b[high] = byte(value >> 8) - b[low] = byte(value & 0xFF) - emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1]) - } else { - // Write the character using a surrogate pair (check "reader.c"). - var b [4]byte - value -= 0x10000 - b[high] = byte(0xD8 + (value >> 18)) - b[low] = byte((value >> 10) & 0xFF) - b[high+2] = byte(0xDC + ((value >> 8) & 0xFF)) - b[low+2] = byte(value & 0xFF) - emitter.raw_buffer = append(emitter.raw_buffer, b[0], b[1], b[2], b[3]) - } - } - - // Write the raw buffer. - if err := emitter.write_handler(emitter, emitter.raw_buffer); err != nil { - return yaml_emitter_set_writer_error(emitter, "write error: "+err.Error()) - } - emitter.buffer_pos = 0 - emitter.raw_buffer = emitter.raw_buffer[:0] - return true -} diff --git a/vendor/gopkg.in/yaml.v2/yaml.go b/vendor/gopkg.in/yaml.v2/yaml.go deleted file mode 100644 index 5e3c2da..0000000 --- a/vendor/gopkg.in/yaml.v2/yaml.go +++ /dev/null @@ -1,357 +0,0 @@ -// Package yaml implements YAML support for the Go language. -// -// Source code and other details for the project are available at GitHub: -// -// https://github.com/go-yaml/yaml -// -package yaml - -import ( - "errors" - "fmt" - "reflect" - "strings" - "sync" -) - -// MapSlice encodes and decodes as a YAML map. -// The order of keys is preserved when encoding and decoding. -type MapSlice []MapItem - -// MapItem is an item in a MapSlice. -type MapItem struct { - Key, Value interface{} -} - -// The Unmarshaler interface may be implemented by types to customize their -// behavior when being unmarshaled from a YAML document. The UnmarshalYAML -// method receives a function that may be called to unmarshal the original -// YAML value into a field or variable. It is safe to call the unmarshal -// function parameter more than once if necessary. -type Unmarshaler interface { - UnmarshalYAML(unmarshal func(interface{}) error) error -} - -// The Marshaler interface may be implemented by types to customize their -// behavior when being marshaled into a YAML document. The returned value -// is marshaled in place of the original value implementing Marshaler. -// -// If an error is returned by MarshalYAML, the marshaling procedure stops -// and returns with the provided error. -type Marshaler interface { - MarshalYAML() (interface{}, error) -} - -// Unmarshal decodes the first document found within the in byte slice -// and assigns decoded values into the out value. -// -// Maps and pointers (to a struct, string, int, etc) are accepted as out -// values. If an internal pointer within a struct is not initialized, -// the yaml package will initialize it if necessary for unmarshalling -// the provided data. The out parameter must not be nil. -// -// The type of the decoded values should be compatible with the respective -// values in out. If one or more values cannot be decoded due to a type -// mismatches, decoding continues partially until the end of the YAML -// content, and a *yaml.TypeError is returned with details for all -// missed values. -// -// Struct fields are only unmarshalled if they are exported (have an -// upper case first letter), and are unmarshalled using the field name -// lowercased as the default key. Custom keys may be defined via the -// "yaml" name in the field tag: the content preceding the first comma -// is used as the key, and the following comma-separated options are -// used to tweak the marshalling process (see Marshal). -// Conflicting names result in a runtime error. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// var t T -// yaml.Unmarshal([]byte("a: 1\nb: 2"), &t) -// -// See the documentation of Marshal for the format of tags and a list of -// supported tag options. -// -func Unmarshal(in []byte, out interface{}) (err error) { - return unmarshal(in, out, false) -} - -// UnmarshalStrict is like Unmarshal except that any fields that are found -// in the data that do not have corresponding struct members will result in -// an error. -func UnmarshalStrict(in []byte, out interface{}) (err error) { - return unmarshal(in, out, true) -} - -func unmarshal(in []byte, out interface{}, strict bool) (err error) { - defer handleErr(&err) - d := newDecoder(strict) - p := newParser(in) - defer p.destroy() - node := p.parse() - if node != nil { - v := reflect.ValueOf(out) - if v.Kind() == reflect.Ptr && !v.IsNil() { - v = v.Elem() - } - d.unmarshal(node, v) - } - if len(d.terrors) > 0 { - return &TypeError{d.terrors} - } - return nil -} - -// Marshal serializes the value provided into a YAML document. The structure -// of the generated document will reflect the structure of the value itself. -// Maps and pointers (to struct, string, int, etc) are accepted as the in value. -// -// Struct fields are only unmarshalled if they are exported (have an upper case -// first letter), and are unmarshalled using the field name lowercased as the -// default key. Custom keys may be defined via the "yaml" name in the field -// tag: the content preceding the first comma is used as the key, and the -// following comma-separated options are used to tweak the marshalling process. -// Conflicting names result in a runtime error. -// -// The field tag format accepted is: -// -// `(...) yaml:"[][,[,]]" (...)` -// -// The following flags are currently supported: -// -// omitempty Only include the field if it's not set to the zero -// value for the type or to empty slices or maps. -// Does not apply to zero valued structs. -// -// flow Marshal using a flow style (useful for structs, -// sequences and maps). -// -// inline Inline the field, which must be a struct or a map, -// causing all of its fields or keys to be processed as if -// they were part of the outer struct. For maps, keys must -// not conflict with the yaml keys of other struct fields. -// -// In addition, if the key is "-", the field is ignored. -// -// For example: -// -// type T struct { -// F int `yaml:"a,omitempty"` -// B int -// } -// yaml.Marshal(&T{B: 2}) // Returns "b: 2\n" -// yaml.Marshal(&T{F: 1}} // Returns "a: 1\nb: 0\n" -// -func Marshal(in interface{}) (out []byte, err error) { - defer handleErr(&err) - e := newEncoder() - defer e.destroy() - e.marshal("", reflect.ValueOf(in)) - e.finish() - out = e.out - return -} - -func handleErr(err *error) { - if v := recover(); v != nil { - if e, ok := v.(yamlError); ok { - *err = e.err - } else { - panic(v) - } - } -} - -type yamlError struct { - err error -} - -func fail(err error) { - panic(yamlError{err}) -} - -func failf(format string, args ...interface{}) { - panic(yamlError{fmt.Errorf("yaml: "+format, args...)}) -} - -// A TypeError is returned by Unmarshal when one or more fields in -// the YAML document cannot be properly decoded into the requested -// types. When this error is returned, the value is still -// unmarshaled partially. -type TypeError struct { - Errors []string -} - -func (e *TypeError) Error() string { - return fmt.Sprintf("yaml: unmarshal errors:\n %s", strings.Join(e.Errors, "\n ")) -} - -// -------------------------------------------------------------------------- -// Maintain a mapping of keys to structure field indexes - -// The code in this section was copied from mgo/bson. - -// structInfo holds details for the serialization of fields of -// a given struct. -type structInfo struct { - FieldsMap map[string]fieldInfo - FieldsList []fieldInfo - - // InlineMap is the number of the field in the struct that - // contains an ,inline map, or -1 if there's none. - InlineMap int -} - -type fieldInfo struct { - Key string - Num int - OmitEmpty bool - Flow bool - - // Inline holds the field index if the field is part of an inlined struct. - Inline []int -} - -var structMap = make(map[reflect.Type]*structInfo) -var fieldMapMutex sync.RWMutex - -func getStructInfo(st reflect.Type) (*structInfo, error) { - fieldMapMutex.RLock() - sinfo, found := structMap[st] - fieldMapMutex.RUnlock() - if found { - return sinfo, nil - } - - n := st.NumField() - fieldsMap := make(map[string]fieldInfo) - fieldsList := make([]fieldInfo, 0, n) - inlineMap := -1 - for i := 0; i != n; i++ { - field := st.Field(i) - if field.PkgPath != "" && !field.Anonymous { - continue // Private field - } - - info := fieldInfo{Num: i} - - tag := field.Tag.Get("yaml") - if tag == "" && strings.Index(string(field.Tag), ":") < 0 { - tag = string(field.Tag) - } - if tag == "-" { - continue - } - - inline := false - fields := strings.Split(tag, ",") - if len(fields) > 1 { - for _, flag := range fields[1:] { - switch flag { - case "omitempty": - info.OmitEmpty = true - case "flow": - info.Flow = true - case "inline": - inline = true - default: - return nil, errors.New(fmt.Sprintf("Unsupported flag %q in tag %q of type %s", flag, tag, st)) - } - } - tag = fields[0] - } - - if inline { - switch field.Type.Kind() { - case reflect.Map: - if inlineMap >= 0 { - return nil, errors.New("Multiple ,inline maps in struct " + st.String()) - } - if field.Type.Key() != reflect.TypeOf("") { - return nil, errors.New("Option ,inline needs a map with string keys in struct " + st.String()) - } - inlineMap = info.Num - case reflect.Struct: - sinfo, err := getStructInfo(field.Type) - if err != nil { - return nil, err - } - for _, finfo := range sinfo.FieldsList { - if _, found := fieldsMap[finfo.Key]; found { - msg := "Duplicated key '" + finfo.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - if finfo.Inline == nil { - finfo.Inline = []int{i, finfo.Num} - } else { - finfo.Inline = append([]int{i}, finfo.Inline...) - } - fieldsMap[finfo.Key] = finfo - fieldsList = append(fieldsList, finfo) - } - default: - //return nil, errors.New("Option ,inline needs a struct value or map field") - return nil, errors.New("Option ,inline needs a struct value field") - } - continue - } - - if tag != "" { - info.Key = tag - } else { - info.Key = strings.ToLower(field.Name) - } - - if _, found = fieldsMap[info.Key]; found { - msg := "Duplicated key '" + info.Key + "' in struct " + st.String() - return nil, errors.New(msg) - } - - fieldsList = append(fieldsList, info) - fieldsMap[info.Key] = info - } - - sinfo = &structInfo{fieldsMap, fieldsList, inlineMap} - - fieldMapMutex.Lock() - structMap[st] = sinfo - fieldMapMutex.Unlock() - return sinfo, nil -} - -func isZero(v reflect.Value) bool { - switch v.Kind() { - case reflect.String: - return len(v.String()) == 0 - case reflect.Interface, reflect.Ptr: - return v.IsNil() - case reflect.Slice: - return v.Len() == 0 - case reflect.Map: - return v.Len() == 0 - case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: - return v.Int() == 0 - case reflect.Float32, reflect.Float64: - return v.Float() == 0 - case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uintptr: - return v.Uint() == 0 - case reflect.Bool: - return !v.Bool() - case reflect.Struct: - vt := v.Type() - for i := v.NumField() - 1; i >= 0; i-- { - if vt.Field(i).PkgPath != "" { - continue // Private field - } - if !isZero(v.Field(i)) { - return false - } - } - return true - } - return false -} diff --git a/vendor/gopkg.in/yaml.v2/yamlh.go b/vendor/gopkg.in/yaml.v2/yamlh.go deleted file mode 100644 index 3caeca0..0000000 --- a/vendor/gopkg.in/yaml.v2/yamlh.go +++ /dev/null @@ -1,716 +0,0 @@ -package yaml - -import ( - "io" -) - -// The version directive data. -type yaml_version_directive_t struct { - major int8 // The major version number. - minor int8 // The minor version number. -} - -// The tag directive data. -type yaml_tag_directive_t struct { - handle []byte // The tag handle. - prefix []byte // The tag prefix. -} - -type yaml_encoding_t int - -// The stream encoding. -const ( - // Let the parser choose the encoding. - yaml_ANY_ENCODING yaml_encoding_t = iota - - yaml_UTF8_ENCODING // The default UTF-8 encoding. - yaml_UTF16LE_ENCODING // The UTF-16-LE encoding with BOM. - yaml_UTF16BE_ENCODING // The UTF-16-BE encoding with BOM. -) - -type yaml_break_t int - -// Line break types. -const ( - // Let the parser choose the break type. - yaml_ANY_BREAK yaml_break_t = iota - - yaml_CR_BREAK // Use CR for line breaks (Mac style). - yaml_LN_BREAK // Use LN for line breaks (Unix style). - yaml_CRLN_BREAK // Use CR LN for line breaks (DOS style). -) - -type yaml_error_type_t int - -// Many bad things could happen with the parser and emitter. -const ( - // No error is produced. - yaml_NO_ERROR yaml_error_type_t = iota - - yaml_MEMORY_ERROR // Cannot allocate or reallocate a block of memory. - yaml_READER_ERROR // Cannot read or decode the input stream. - yaml_SCANNER_ERROR // Cannot scan the input stream. - yaml_PARSER_ERROR // Cannot parse the input stream. - yaml_COMPOSER_ERROR // Cannot compose a YAML document. - yaml_WRITER_ERROR // Cannot write to the output stream. - yaml_EMITTER_ERROR // Cannot emit a YAML stream. -) - -// The pointer position. -type yaml_mark_t struct { - index int // The position index. - line int // The position line. - column int // The position column. -} - -// Node Styles - -type yaml_style_t int8 - -type yaml_scalar_style_t yaml_style_t - -// Scalar styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SCALAR_STYLE yaml_scalar_style_t = iota - - yaml_PLAIN_SCALAR_STYLE // The plain scalar style. - yaml_SINGLE_QUOTED_SCALAR_STYLE // The single-quoted scalar style. - yaml_DOUBLE_QUOTED_SCALAR_STYLE // The double-quoted scalar style. - yaml_LITERAL_SCALAR_STYLE // The literal scalar style. - yaml_FOLDED_SCALAR_STYLE // The folded scalar style. -) - -type yaml_sequence_style_t yaml_style_t - -// Sequence styles. -const ( - // Let the emitter choose the style. - yaml_ANY_SEQUENCE_STYLE yaml_sequence_style_t = iota - - yaml_BLOCK_SEQUENCE_STYLE // The block sequence style. - yaml_FLOW_SEQUENCE_STYLE // The flow sequence style. -) - -type yaml_mapping_style_t yaml_style_t - -// Mapping styles. -const ( - // Let the emitter choose the style. - yaml_ANY_MAPPING_STYLE yaml_mapping_style_t = iota - - yaml_BLOCK_MAPPING_STYLE // The block mapping style. - yaml_FLOW_MAPPING_STYLE // The flow mapping style. -) - -// Tokens - -type yaml_token_type_t int - -// Token types. -const ( - // An empty token. - yaml_NO_TOKEN yaml_token_type_t = iota - - yaml_STREAM_START_TOKEN // A STREAM-START token. - yaml_STREAM_END_TOKEN // A STREAM-END token. - - yaml_VERSION_DIRECTIVE_TOKEN // A VERSION-DIRECTIVE token. - yaml_TAG_DIRECTIVE_TOKEN // A TAG-DIRECTIVE token. - yaml_DOCUMENT_START_TOKEN // A DOCUMENT-START token. - yaml_DOCUMENT_END_TOKEN // A DOCUMENT-END token. - - yaml_BLOCK_SEQUENCE_START_TOKEN // A BLOCK-SEQUENCE-START token. - yaml_BLOCK_MAPPING_START_TOKEN // A BLOCK-SEQUENCE-END token. - yaml_BLOCK_END_TOKEN // A BLOCK-END token. - - yaml_FLOW_SEQUENCE_START_TOKEN // A FLOW-SEQUENCE-START token. - yaml_FLOW_SEQUENCE_END_TOKEN // A FLOW-SEQUENCE-END token. - yaml_FLOW_MAPPING_START_TOKEN // A FLOW-MAPPING-START token. - yaml_FLOW_MAPPING_END_TOKEN // A FLOW-MAPPING-END token. - - yaml_BLOCK_ENTRY_TOKEN // A BLOCK-ENTRY token. - yaml_FLOW_ENTRY_TOKEN // A FLOW-ENTRY token. - yaml_KEY_TOKEN // A KEY token. - yaml_VALUE_TOKEN // A VALUE token. - - yaml_ALIAS_TOKEN // An ALIAS token. - yaml_ANCHOR_TOKEN // An ANCHOR token. - yaml_TAG_TOKEN // A TAG token. - yaml_SCALAR_TOKEN // A SCALAR token. -) - -func (tt yaml_token_type_t) String() string { - switch tt { - case yaml_NO_TOKEN: - return "yaml_NO_TOKEN" - case yaml_STREAM_START_TOKEN: - return "yaml_STREAM_START_TOKEN" - case yaml_STREAM_END_TOKEN: - return "yaml_STREAM_END_TOKEN" - case yaml_VERSION_DIRECTIVE_TOKEN: - return "yaml_VERSION_DIRECTIVE_TOKEN" - case yaml_TAG_DIRECTIVE_TOKEN: - return "yaml_TAG_DIRECTIVE_TOKEN" - case yaml_DOCUMENT_START_TOKEN: - return "yaml_DOCUMENT_START_TOKEN" - case yaml_DOCUMENT_END_TOKEN: - return "yaml_DOCUMENT_END_TOKEN" - case yaml_BLOCK_SEQUENCE_START_TOKEN: - return "yaml_BLOCK_SEQUENCE_START_TOKEN" - case yaml_BLOCK_MAPPING_START_TOKEN: - return "yaml_BLOCK_MAPPING_START_TOKEN" - case yaml_BLOCK_END_TOKEN: - return "yaml_BLOCK_END_TOKEN" - case yaml_FLOW_SEQUENCE_START_TOKEN: - return "yaml_FLOW_SEQUENCE_START_TOKEN" - case yaml_FLOW_SEQUENCE_END_TOKEN: - return "yaml_FLOW_SEQUENCE_END_TOKEN" - case yaml_FLOW_MAPPING_START_TOKEN: - return "yaml_FLOW_MAPPING_START_TOKEN" - case yaml_FLOW_MAPPING_END_TOKEN: - return "yaml_FLOW_MAPPING_END_TOKEN" - case yaml_BLOCK_ENTRY_TOKEN: - return "yaml_BLOCK_ENTRY_TOKEN" - case yaml_FLOW_ENTRY_TOKEN: - return "yaml_FLOW_ENTRY_TOKEN" - case yaml_KEY_TOKEN: - return "yaml_KEY_TOKEN" - case yaml_VALUE_TOKEN: - return "yaml_VALUE_TOKEN" - case yaml_ALIAS_TOKEN: - return "yaml_ALIAS_TOKEN" - case yaml_ANCHOR_TOKEN: - return "yaml_ANCHOR_TOKEN" - case yaml_TAG_TOKEN: - return "yaml_TAG_TOKEN" - case yaml_SCALAR_TOKEN: - return "yaml_SCALAR_TOKEN" - } - return "" -} - -// The token structure. -type yaml_token_t struct { - // The token type. - typ yaml_token_type_t - - // The start/end of the token. - start_mark, end_mark yaml_mark_t - - // The stream encoding (for yaml_STREAM_START_TOKEN). - encoding yaml_encoding_t - - // The alias/anchor/scalar value or tag/tag directive handle - // (for yaml_ALIAS_TOKEN, yaml_ANCHOR_TOKEN, yaml_SCALAR_TOKEN, yaml_TAG_TOKEN, yaml_TAG_DIRECTIVE_TOKEN). - value []byte - - // The tag suffix (for yaml_TAG_TOKEN). - suffix []byte - - // The tag directive prefix (for yaml_TAG_DIRECTIVE_TOKEN). - prefix []byte - - // The scalar style (for yaml_SCALAR_TOKEN). - style yaml_scalar_style_t - - // The version directive major/minor (for yaml_VERSION_DIRECTIVE_TOKEN). - major, minor int8 -} - -// Events - -type yaml_event_type_t int8 - -// Event types. -const ( - // An empty event. - yaml_NO_EVENT yaml_event_type_t = iota - - yaml_STREAM_START_EVENT // A STREAM-START event. - yaml_STREAM_END_EVENT // A STREAM-END event. - yaml_DOCUMENT_START_EVENT // A DOCUMENT-START event. - yaml_DOCUMENT_END_EVENT // A DOCUMENT-END event. - yaml_ALIAS_EVENT // An ALIAS event. - yaml_SCALAR_EVENT // A SCALAR event. - yaml_SEQUENCE_START_EVENT // A SEQUENCE-START event. - yaml_SEQUENCE_END_EVENT // A SEQUENCE-END event. - yaml_MAPPING_START_EVENT // A MAPPING-START event. - yaml_MAPPING_END_EVENT // A MAPPING-END event. -) - -// The event structure. -type yaml_event_t struct { - - // The event type. - typ yaml_event_type_t - - // The start and end of the event. - start_mark, end_mark yaml_mark_t - - // The document encoding (for yaml_STREAM_START_EVENT). - encoding yaml_encoding_t - - // The version directive (for yaml_DOCUMENT_START_EVENT). - version_directive *yaml_version_directive_t - - // The list of tag directives (for yaml_DOCUMENT_START_EVENT). - tag_directives []yaml_tag_directive_t - - // The anchor (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_ALIAS_EVENT). - anchor []byte - - // The tag (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - tag []byte - - // The scalar value (for yaml_SCALAR_EVENT). - value []byte - - // Is the document start/end indicator implicit, or the tag optional? - // (for yaml_DOCUMENT_START_EVENT, yaml_DOCUMENT_END_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT, yaml_SCALAR_EVENT). - implicit bool - - // Is the tag optional for any non-plain style? (for yaml_SCALAR_EVENT). - quoted_implicit bool - - // The style (for yaml_SCALAR_EVENT, yaml_SEQUENCE_START_EVENT, yaml_MAPPING_START_EVENT). - style yaml_style_t -} - -func (e *yaml_event_t) scalar_style() yaml_scalar_style_t { return yaml_scalar_style_t(e.style) } -func (e *yaml_event_t) sequence_style() yaml_sequence_style_t { return yaml_sequence_style_t(e.style) } -func (e *yaml_event_t) mapping_style() yaml_mapping_style_t { return yaml_mapping_style_t(e.style) } - -// Nodes - -const ( - yaml_NULL_TAG = "tag:yaml.org,2002:null" // The tag !!null with the only possible value: null. - yaml_BOOL_TAG = "tag:yaml.org,2002:bool" // The tag !!bool with the values: true and false. - yaml_STR_TAG = "tag:yaml.org,2002:str" // The tag !!str for string values. - yaml_INT_TAG = "tag:yaml.org,2002:int" // The tag !!int for integer values. - yaml_FLOAT_TAG = "tag:yaml.org,2002:float" // The tag !!float for float values. - yaml_TIMESTAMP_TAG = "tag:yaml.org,2002:timestamp" // The tag !!timestamp for date and time values. - - yaml_SEQ_TAG = "tag:yaml.org,2002:seq" // The tag !!seq is used to denote sequences. - yaml_MAP_TAG = "tag:yaml.org,2002:map" // The tag !!map is used to denote mapping. - - // Not in original libyaml. - yaml_BINARY_TAG = "tag:yaml.org,2002:binary" - yaml_MERGE_TAG = "tag:yaml.org,2002:merge" - - yaml_DEFAULT_SCALAR_TAG = yaml_STR_TAG // The default scalar tag is !!str. - yaml_DEFAULT_SEQUENCE_TAG = yaml_SEQ_TAG // The default sequence tag is !!seq. - yaml_DEFAULT_MAPPING_TAG = yaml_MAP_TAG // The default mapping tag is !!map. -) - -type yaml_node_type_t int - -// Node types. -const ( - // An empty node. - yaml_NO_NODE yaml_node_type_t = iota - - yaml_SCALAR_NODE // A scalar node. - yaml_SEQUENCE_NODE // A sequence node. - yaml_MAPPING_NODE // A mapping node. -) - -// An element of a sequence node. -type yaml_node_item_t int - -// An element of a mapping node. -type yaml_node_pair_t struct { - key int // The key of the element. - value int // The value of the element. -} - -// The node structure. -type yaml_node_t struct { - typ yaml_node_type_t // The node type. - tag []byte // The node tag. - - // The node data. - - // The scalar parameters (for yaml_SCALAR_NODE). - scalar struct { - value []byte // The scalar value. - length int // The length of the scalar value. - style yaml_scalar_style_t // The scalar style. - } - - // The sequence parameters (for YAML_SEQUENCE_NODE). - sequence struct { - items_data []yaml_node_item_t // The stack of sequence items. - style yaml_sequence_style_t // The sequence style. - } - - // The mapping parameters (for yaml_MAPPING_NODE). - mapping struct { - pairs_data []yaml_node_pair_t // The stack of mapping pairs (key, value). - pairs_start *yaml_node_pair_t // The beginning of the stack. - pairs_end *yaml_node_pair_t // The end of the stack. - pairs_top *yaml_node_pair_t // The top of the stack. - style yaml_mapping_style_t // The mapping style. - } - - start_mark yaml_mark_t // The beginning of the node. - end_mark yaml_mark_t // The end of the node. - -} - -// The document structure. -type yaml_document_t struct { - - // The document nodes. - nodes []yaml_node_t - - // The version directive. - version_directive *yaml_version_directive_t - - // The list of tag directives. - tag_directives_data []yaml_tag_directive_t - tag_directives_start int // The beginning of the tag directives list. - tag_directives_end int // The end of the tag directives list. - - start_implicit int // Is the document start indicator implicit? - end_implicit int // Is the document end indicator implicit? - - // The start/end of the document. - start_mark, end_mark yaml_mark_t -} - -// The prototype of a read handler. -// -// The read handler is called when the parser needs to read more bytes from the -// source. The handler should write not more than size bytes to the buffer. -// The number of written bytes should be set to the size_read variable. -// -// [in,out] data A pointer to an application data specified by -// yaml_parser_set_input(). -// [out] buffer The buffer to write the data from the source. -// [in] size The size of the buffer. -// [out] size_read The actual number of bytes read from the source. -// -// On success, the handler should return 1. If the handler failed, -// the returned value should be 0. On EOF, the handler should set the -// size_read to 0 and return 1. -type yaml_read_handler_t func(parser *yaml_parser_t, buffer []byte) (n int, err error) - -// This structure holds information about a potential simple key. -type yaml_simple_key_t struct { - possible bool // Is a simple key possible? - required bool // Is a simple key required? - token_number int // The number of the token. - mark yaml_mark_t // The position mark. -} - -// The states of the parser. -type yaml_parser_state_t int - -const ( - yaml_PARSE_STREAM_START_STATE yaml_parser_state_t = iota - - yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE // Expect the beginning of an implicit document. - yaml_PARSE_DOCUMENT_START_STATE // Expect DOCUMENT-START. - yaml_PARSE_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_PARSE_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_PARSE_BLOCK_NODE_STATE // Expect a block node. - yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE // Expect a block node or indentless sequence. - yaml_PARSE_FLOW_NODE_STATE // Expect a flow node. - yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a block sequence. - yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE // Expect an entry of a block sequence. - yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE // Expect an entry of an indentless sequence. - yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_PARSE_BLOCK_MAPPING_KEY_STATE // Expect a block mapping key. - yaml_PARSE_BLOCK_MAPPING_VALUE_STATE // Expect a block mapping value. - yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE // Expect the first entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE // Expect an entry of a flow sequence. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE // Expect a key of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE // Expect a value of an ordered mapping. - yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE // Expect the and of an ordered mapping entry. - yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_PARSE_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE // Expect an empty value of a flow mapping. - yaml_PARSE_END_STATE // Expect nothing. -) - -func (ps yaml_parser_state_t) String() string { - switch ps { - case yaml_PARSE_STREAM_START_STATE: - return "yaml_PARSE_STREAM_START_STATE" - case yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE: - return "yaml_PARSE_IMPLICIT_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_START_STATE: - return "yaml_PARSE_DOCUMENT_START_STATE" - case yaml_PARSE_DOCUMENT_CONTENT_STATE: - return "yaml_PARSE_DOCUMENT_CONTENT_STATE" - case yaml_PARSE_DOCUMENT_END_STATE: - return "yaml_PARSE_DOCUMENT_END_STATE" - case yaml_PARSE_BLOCK_NODE_STATE: - return "yaml_PARSE_BLOCK_NODE_STATE" - case yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE: - return "yaml_PARSE_BLOCK_NODE_OR_INDENTLESS_SEQUENCE_STATE" - case yaml_PARSE_FLOW_NODE_STATE: - return "yaml_PARSE_FLOW_NODE_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_BLOCK_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_INDENTLESS_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_KEY_STATE: - return "yaml_PARSE_BLOCK_MAPPING_KEY_STATE" - case yaml_PARSE_BLOCK_MAPPING_VALUE_STATE: - return "yaml_PARSE_BLOCK_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_FIRST_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE: - return "yaml_PARSE_FLOW_SEQUENCE_ENTRY_MAPPING_END_STATE" - case yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_FIRST_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_KEY_STATE: - return "yaml_PARSE_FLOW_MAPPING_KEY_STATE" - case yaml_PARSE_FLOW_MAPPING_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_VALUE_STATE" - case yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE: - return "yaml_PARSE_FLOW_MAPPING_EMPTY_VALUE_STATE" - case yaml_PARSE_END_STATE: - return "yaml_PARSE_END_STATE" - } - return "" -} - -// This structure holds aliases data. -type yaml_alias_data_t struct { - anchor []byte // The anchor. - index int // The node id. - mark yaml_mark_t // The anchor mark. -} - -// The parser structure. -// -// All members are internal. Manage the structure using the -// yaml_parser_ family of functions. -type yaml_parser_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - - problem string // Error description. - - // The byte about which the problem occurred. - problem_offset int - problem_value int - problem_mark yaml_mark_t - - // The error context. - context string - context_mark yaml_mark_t - - // Reader stuff - - read_handler yaml_read_handler_t // Read handler. - - input_file io.Reader // File input data. - input []byte // String input data. - input_pos int - - eof bool // EOF flag - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - unread int // The number of unread characters in the buffer. - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The input encoding. - - offset int // The offset of the current position (in bytes). - mark yaml_mark_t // The mark of the current position. - - // Scanner stuff - - stream_start_produced bool // Have we started to scan the input stream? - stream_end_produced bool // Have we reached the end of the input stream? - - flow_level int // The number of unclosed '[' and '{' indicators. - - tokens []yaml_token_t // The tokens queue. - tokens_head int // The head of the tokens queue. - tokens_parsed int // The number of tokens fetched from the queue. - token_available bool // Does the tokens queue contain a token ready for dequeueing. - - indent int // The current indentation level. - indents []int // The indentation levels stack. - - simple_key_allowed bool // May a simple key occur at the current position? - simple_keys []yaml_simple_key_t // The stack of simple keys. - - // Parser stuff - - state yaml_parser_state_t // The current parser state. - states []yaml_parser_state_t // The parser states stack. - marks []yaml_mark_t // The stack of marks. - tag_directives []yaml_tag_directive_t // The list of TAG directives. - - // Dumper stuff - - aliases []yaml_alias_data_t // The alias data. - - document *yaml_document_t // The currently parsed document. -} - -// Emitter Definitions - -// The prototype of a write handler. -// -// The write handler is called when the emitter needs to flush the accumulated -// characters to the output. The handler should write @a size bytes of the -// @a buffer to the output. -// -// @param[in,out] data A pointer to an application data specified by -// yaml_emitter_set_output(). -// @param[in] buffer The buffer with bytes to be written. -// @param[in] size The size of the buffer. -// -// @returns On success, the handler should return @c 1. If the handler failed, -// the returned value should be @c 0. -// -type yaml_write_handler_t func(emitter *yaml_emitter_t, buffer []byte) error - -type yaml_emitter_state_t int - -// The emitter states. -const ( - // Expect STREAM-START. - yaml_EMIT_STREAM_START_STATE yaml_emitter_state_t = iota - - yaml_EMIT_FIRST_DOCUMENT_START_STATE // Expect the first DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_START_STATE // Expect DOCUMENT-START or STREAM-END. - yaml_EMIT_DOCUMENT_CONTENT_STATE // Expect the content of a document. - yaml_EMIT_DOCUMENT_END_STATE // Expect DOCUMENT-END. - yaml_EMIT_FLOW_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a flow sequence. - yaml_EMIT_FLOW_SEQUENCE_ITEM_STATE // Expect an item of a flow sequence. - yaml_EMIT_FLOW_MAPPING_FIRST_KEY_STATE // Expect the first key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_KEY_STATE // Expect a key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a flow mapping. - yaml_EMIT_FLOW_MAPPING_VALUE_STATE // Expect a value of a flow mapping. - yaml_EMIT_BLOCK_SEQUENCE_FIRST_ITEM_STATE // Expect the first item of a block sequence. - yaml_EMIT_BLOCK_SEQUENCE_ITEM_STATE // Expect an item of a block sequence. - yaml_EMIT_BLOCK_MAPPING_FIRST_KEY_STATE // Expect the first key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_KEY_STATE // Expect the key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_SIMPLE_VALUE_STATE // Expect a value for a simple key of a block mapping. - yaml_EMIT_BLOCK_MAPPING_VALUE_STATE // Expect a value of a block mapping. - yaml_EMIT_END_STATE // Expect nothing. -) - -// The emitter structure. -// -// All members are internal. Manage the structure using the @c yaml_emitter_ -// family of functions. -type yaml_emitter_t struct { - - // Error handling - - error yaml_error_type_t // Error type. - problem string // Error description. - - // Writer stuff - - write_handler yaml_write_handler_t // Write handler. - - output_buffer *[]byte // String output data. - output_file io.Writer // File output data. - - buffer []byte // The working buffer. - buffer_pos int // The current position of the buffer. - - raw_buffer []byte // The raw buffer. - raw_buffer_pos int // The current position of the buffer. - - encoding yaml_encoding_t // The stream encoding. - - // Emitter stuff - - canonical bool // If the output is in the canonical style? - best_indent int // The number of indentation spaces. - best_width int // The preferred width of the output lines. - unicode bool // Allow unescaped non-ASCII characters? - line_break yaml_break_t // The preferred line break. - - state yaml_emitter_state_t // The current emitter state. - states []yaml_emitter_state_t // The stack of states. - - events []yaml_event_t // The event queue. - events_head int // The head of the event queue. - - indents []int // The stack of indentation levels. - - tag_directives []yaml_tag_directive_t // The list of tag directives. - - indent int // The current indentation level. - - flow_level int // The current flow level. - - root_context bool // Is it the document root context? - sequence_context bool // Is it a sequence context? - mapping_context bool // Is it a mapping context? - simple_key_context bool // Is it a simple mapping key context? - - line int // The current line. - column int // The current column. - whitespace bool // If the last character was a whitespace? - indention bool // If the last character was an indentation character (' ', '-', '?', ':')? - open_ended bool // If an explicit document end is required? - - // Anchor analysis. - anchor_data struct { - anchor []byte // The anchor value. - alias bool // Is it an alias? - } - - // Tag analysis. - tag_data struct { - handle []byte // The tag handle. - suffix []byte // The tag suffix. - } - - // Scalar analysis. - scalar_data struct { - value []byte // The scalar value. - multiline bool // Does the scalar contain line breaks? - flow_plain_allowed bool // Can the scalar be expessed in the flow plain style? - block_plain_allowed bool // Can the scalar be expressed in the block plain style? - single_quoted_allowed bool // Can the scalar be expressed in the single quoted style? - block_allowed bool // Can the scalar be expressed in the literal or folded styles? - style yaml_scalar_style_t // The output style. - } - - // Dumper stuff - - opened bool // If the stream was already opened? - closed bool // If the stream was already closed? - - // The information associated with the document nodes. - anchors *struct { - references int // The number of references. - anchor int // The anchor id. - serialized bool // If the node has been emitted? - } - - last_anchor_id int // The last assigned anchor id. - - document *yaml_document_t // The currently emitted document. -} diff --git a/vendor/gopkg.in/yaml.v2/yamlprivateh.go b/vendor/gopkg.in/yaml.v2/yamlprivateh.go deleted file mode 100644 index 8110ce3..0000000 --- a/vendor/gopkg.in/yaml.v2/yamlprivateh.go +++ /dev/null @@ -1,173 +0,0 @@ -package yaml - -const ( - // The size of the input raw buffer. - input_raw_buffer_size = 512 - - // The size of the input buffer. - // It should be possible to decode the whole raw buffer. - input_buffer_size = input_raw_buffer_size * 3 - - // The size of the output buffer. - output_buffer_size = 128 - - // The size of the output raw buffer. - // It should be possible to encode the whole output buffer. - output_raw_buffer_size = (output_buffer_size*2 + 2) - - // The size of other stacks and queues. - initial_stack_size = 16 - initial_queue_size = 16 - initial_string_size = 16 -) - -// Check if the character at the specified position is an alphabetical -// character, a digit, '_', or '-'. -func is_alpha(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'Z' || b[i] >= 'a' && b[i] <= 'z' || b[i] == '_' || b[i] == '-' -} - -// Check if the character at the specified position is a digit. -func is_digit(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' -} - -// Get the value of a digit. -func as_digit(b []byte, i int) int { - return int(b[i]) - '0' -} - -// Check if the character at the specified position is a hex-digit. -func is_hex(b []byte, i int) bool { - return b[i] >= '0' && b[i] <= '9' || b[i] >= 'A' && b[i] <= 'F' || b[i] >= 'a' && b[i] <= 'f' -} - -// Get the value of a hex-digit. -func as_hex(b []byte, i int) int { - bi := b[i] - if bi >= 'A' && bi <= 'F' { - return int(bi) - 'A' + 10 - } - if bi >= 'a' && bi <= 'f' { - return int(bi) - 'a' + 10 - } - return int(bi) - '0' -} - -// Check if the character is ASCII. -func is_ascii(b []byte, i int) bool { - return b[i] <= 0x7F -} - -// Check if the character at the start of the buffer can be printed unescaped. -func is_printable(b []byte, i int) bool { - return ((b[i] == 0x0A) || // . == #x0A - (b[i] >= 0x20 && b[i] <= 0x7E) || // #x20 <= . <= #x7E - (b[i] == 0xC2 && b[i+1] >= 0xA0) || // #0xA0 <= . <= #xD7FF - (b[i] > 0xC2 && b[i] < 0xED) || - (b[i] == 0xED && b[i+1] < 0xA0) || - (b[i] == 0xEE) || - (b[i] == 0xEF && // #xE000 <= . <= #xFFFD - !(b[i+1] == 0xBB && b[i+2] == 0xBF) && // && . != #xFEFF - !(b[i+1] == 0xBF && (b[i+2] == 0xBE || b[i+2] == 0xBF)))) -} - -// Check if the character at the specified position is NUL. -func is_z(b []byte, i int) bool { - return b[i] == 0x00 -} - -// Check if the beginning of the buffer is a BOM. -func is_bom(b []byte, i int) bool { - return b[0] == 0xEF && b[1] == 0xBB && b[2] == 0xBF -} - -// Check if the character at the specified position is space. -func is_space(b []byte, i int) bool { - return b[i] == ' ' -} - -// Check if the character at the specified position is tab. -func is_tab(b []byte, i int) bool { - return b[i] == '\t' -} - -// Check if the character at the specified position is blank (space or tab). -func is_blank(b []byte, i int) bool { - //return is_space(b, i) || is_tab(b, i) - return b[i] == ' ' || b[i] == '\t' -} - -// Check if the character at the specified position is a line break. -func is_break(b []byte, i int) bool { - return (b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9) // PS (#x2029) -} - -func is_crlf(b []byte, i int) bool { - return b[i] == '\r' && b[i+1] == '\n' -} - -// Check if the character is a line break or NUL. -func is_breakz(b []byte, i int) bool { - //return is_break(b, i) || is_z(b, i) - return ( // is_break: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - // is_z: - b[i] == 0) -} - -// Check if the character is a line break, space, or NUL. -func is_spacez(b []byte, i int) bool { - //return is_space(b, i) || is_breakz(b, i) - return ( // is_space: - b[i] == ' ' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Check if the character is a line break, space, tab, or NUL. -func is_blankz(b []byte, i int) bool { - //return is_blank(b, i) || is_breakz(b, i) - return ( // is_blank: - b[i] == ' ' || b[i] == '\t' || - // is_breakz: - b[i] == '\r' || // CR (#xD) - b[i] == '\n' || // LF (#xA) - b[i] == 0xC2 && b[i+1] == 0x85 || // NEL (#x85) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA8 || // LS (#x2028) - b[i] == 0xE2 && b[i+1] == 0x80 && b[i+2] == 0xA9 || // PS (#x2029) - b[i] == 0) -} - -// Determine the width of the character. -func width(b byte) int { - // Don't replace these by a switch without first - // confirming that it is being inlined. - if b&0x80 == 0x00 { - return 1 - } - if b&0xE0 == 0xC0 { - return 2 - } - if b&0xF0 == 0xE0 { - return 3 - } - if b&0xF8 == 0xF0 { - return 4 - } - return 0 - -} diff --git a/vendor/layeh.com/gopher-json/LICENSE b/vendor/layeh.com/gopher-json/LICENSE deleted file mode 100644 index b3dbff0..0000000 --- a/vendor/layeh.com/gopher-json/LICENSE +++ /dev/null @@ -1,22 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -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 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/layeh.com/gopher-json/README.md b/vendor/layeh.com/gopher-json/README.md deleted file mode 100644 index a0e7c34..0000000 --- a/vendor/layeh.com/gopher-json/README.md +++ /dev/null @@ -1,7 +0,0 @@ -# gopher-json [![GoDoc](https://godoc.org/layeh.com/gopher-json?status.svg)](https://godoc.org/layeh.com/gopher-json) - -Package json is a simple JSON encoder/decoder for [gopher-lua](https://github.com/yuin/gopher-lua). - -## License - -Public domain. diff --git a/vendor/layeh.com/gopher-json/doc.go b/vendor/layeh.com/gopher-json/doc.go deleted file mode 100644 index d50b2da..0000000 --- a/vendor/layeh.com/gopher-json/doc.go +++ /dev/null @@ -1,20 +0,0 @@ -// Package json is a simple JSON encoder/decoder for gopher-lua. -// -// Documentation -// -// The following functions are exposed by the library: -// decode(string): Decodes a JSON string. Returns nil and an error string if -// the string could not be decoded. -// encode(value): Encodes a value into a JSON string. Returns nil and an error -// string if the value could not be encoded. -// -// Example -// -// Below is an example usage of the library: -// import ( -// luajson "layeh.com/gopher-json" -// ) -// -// L := lua.NewState() -// luajson.Preload(s) -package json // import "layeh.com/gopher-json" diff --git a/vendor/layeh.com/gopher-json/json.go b/vendor/layeh.com/gopher-json/json.go deleted file mode 100644 index e876be8..0000000 --- a/vendor/layeh.com/gopher-json/json.go +++ /dev/null @@ -1,173 +0,0 @@ -package json - -import ( - "encoding/json" - "errors" - "strconv" - - "github.com/yuin/gopher-lua" -) - -// Preload adds json to the given Lua state's package.preload table. After it -// has been preloaded, it can be loaded using require: -// -// local json = require("json") -func Preload(L *lua.LState) { - L.PreloadModule("json", Loader) -} - -// Loader is the module loader function. -func Loader(L *lua.LState) int { - t := L.NewTable() - L.SetFuncs(t, api) - L.Push(t) - return 1 -} - -var api = map[string]lua.LGFunction{ - "decode": apiDecode, - "encode": apiEncode, -} - -func apiDecode(L *lua.LState) int { - str := L.CheckString(1) - - value, err := Decode(L, []byte(str)) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - L.Push(value) - return 1 -} - -func apiEncode(L *lua.LState) int { - value := L.CheckAny(1) - - data, err := Encode(value) - if err != nil { - L.Push(lua.LNil) - L.Push(lua.LString(err.Error())) - return 2 - } - L.Push(lua.LString(string(data))) - return 1 -} - -var ( - errFunction = errors.New("cannot encode function to JSON") - errChannel = errors.New("cannot encode channel to JSON") - errState = errors.New("cannot encode state to JSON") - errUserData = errors.New("cannot encode userdata to JSON") - errNested = errors.New("cannot encode recursively nested tables to JSON") -) - -type jsonValue struct { - lua.LValue - visited map[*lua.LTable]bool -} - -func (j jsonValue) MarshalJSON() ([]byte, error) { - return encode(j.LValue, j.visited) -} - -// Encode returns the JSON encoding of value. -func Encode(value lua.LValue) ([]byte, error) { - return encode(value, make(map[*lua.LTable]bool)) -} - -func encode(value lua.LValue, visited map[*lua.LTable]bool) (data []byte, err error) { - switch converted := value.(type) { - case lua.LBool: - data, err = json.Marshal(converted) - case lua.LChannel: - err = errChannel - case lua.LNumber: - data, err = json.Marshal(converted) - case *lua.LFunction: - err = errFunction - case *lua.LNilType: - data, err = json.Marshal(converted) - case *lua.LState: - err = errState - case lua.LString: - data, err = json.Marshal(converted) - case *lua.LTable: - var arr []jsonValue - var obj map[string]jsonValue - - if visited[converted] { - panic(errNested) - } - visited[converted] = true - - converted.ForEach(func(k lua.LValue, v lua.LValue) { - i, numberKey := k.(lua.LNumber) - if numberKey && obj == nil { - index := int(i) - 1 - if index != len(arr) { - // map out of order; convert to map - obj = make(map[string]jsonValue) - for i, value := range arr { - obj[strconv.Itoa(i+1)] = value - } - obj[strconv.Itoa(index+1)] = jsonValue{v, visited} - return - } - arr = append(arr, jsonValue{v, visited}) - return - } - if obj == nil { - obj = make(map[string]jsonValue) - for i, value := range arr { - obj[strconv.Itoa(i+1)] = value - } - } - obj[k.String()] = jsonValue{v, visited} - }) - if obj != nil { - data, err = json.Marshal(obj) - } else { - data, err = json.Marshal(arr) - } - case *lua.LUserData: - // TODO: call metatable __tostring? - err = errUserData - } - return -} - -// Decode converts the JSON encoded data to Lua values. -func Decode(L *lua.LState, data []byte) (lua.LValue, error) { - var value interface{} - err := json.Unmarshal(data, &value) - if err != nil { - return nil, err - } - return decode(L, value), nil -} - -func decode(L *lua.LState, value interface{}) lua.LValue { - switch converted := value.(type) { - case bool: - return lua.LBool(converted) - case float64: - return lua.LNumber(converted) - case string: - return lua.LString(converted) - case []interface{}: - arr := L.CreateTable(len(converted), 0) - for _, item := range converted { - arr.Append(decode(L, item)) - } - return arr - case map[string]interface{}: - tbl := L.CreateTable(0, len(converted)) - for key, item := range converted { - tbl.RawSetH(lua.LString(key), decode(L, item)) - } - return tbl - } - return lua.LNil -} diff --git a/vendor/layeh.com/gopher-json/json_test.go b/vendor/layeh.com/gopher-json/json_test.go deleted file mode 100644 index 8f5a167..0000000 --- a/vendor/layeh.com/gopher-json/json_test.go +++ /dev/null @@ -1,75 +0,0 @@ -package json - -import ( - "testing" - - "github.com/yuin/gopher-lua" -) - -func TestSimple(t *testing.T) { - const str = ` - local json = require("json") - assert(type(json) == "table") - assert(type(json.decode) == "function") - assert(type(json.encode) == "function") - - assert(json.encode(true) == "true") - assert(json.encode(1) == "1") - assert(json.encode(-10) == "-10") - assert(json.encode(nil) == "{}") - - local obj = {"a",1,"b",2,"c",3} - local jsonStr = json.encode(obj) - local jsonObj = json.decode(jsonStr) - for i = 1, #obj do - assert(obj[i] == jsonObj[i]) - end - - local obj = {name="Tim",number=12345} - local jsonStr = json.encode(obj) - local jsonObj = json.decode(jsonStr) - assert(obj.name == jsonObj.name) - assert(obj.number == jsonObj.number) - - local obj = {"a","b",what="c",[5]="asd"} - local jsonStr = json.encode(obj) - local jsonObj = json.decode(jsonStr) - assert(obj[1] == jsonObj["1"]) - assert(obj[2] == jsonObj["2"]) - assert(obj.what == jsonObj["what"]) - assert(obj[5] == jsonObj["5"]) - - assert(json.decode("null") == nil) - - assert(json.decode(json.encode({person={name = "tim",}})).person.name == "tim") - - local obj = { - abc = 123, - def = nil, - } - local obj2 = { - obj = obj, - } - obj.obj2 = obj2 - assert(json.encode(obj) == nil) - ` - s := lua.NewState() - Preload(s) - if err := s.DoString(str); err != nil { - t.Error(err) - } -} - -func TestCustomRequire(t *testing.T) { - const str = ` - local j = require("JSON") - assert(type(j) == "table") - assert(type(j.decode) == "function") - assert(type(j.encode) == "function") - ` - s := lua.NewState() - s.PreloadModule("JSON", Loader) - if err := s.DoString(str); err != nil { - t.Error(err) - } -}