diff --git a/Gopkg.lock b/Gopkg.lock index 8a847c23..bbf1f362 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -10,33 +10,42 @@ version = "v0.26.0" [[projects]] - digest = "1:e589e863ce0d0500bb806c716877c2f8caffe2a2b6c2f6c148d535d8eeb92d00" + digest = "1:3fb854fc35fafced21615a93db3c0e324c8cb1d5a89f39dd1e72db0c4200345a" + name = "contrib.go.opencensus.io/exporter/ocagent" + packages = ["."] + pruneopts = "NUT" + revision = "dcb33c7f3b7cfe67e8a2cea10207ede1b7c40764" + version = "v0.4.12" + +[[projects]] + digest = "1:387c36a55aa52170ad77c92b1f9a77a2718ecb41c2fdf0a910a5ed2b940b6149" name = "github.com/Azure/azure-sdk-for-go" packages = [ "services/dns/mgmt/2017-09-01/dns", "version", ] pruneopts = "NUT" - revision = "4e8cbbfb1aeab140cd0fa97fd16b64ee18c3ca6a" - version = "v19.1.0" + revision = "66cf3bc60d4d086e8e566d505b1cd30f5f506639" + version = "v31.0.0" [[projects]] - digest = "1:0b2163d4a757420217d4e0461128bf5c96be6d1614513b31d35029872a07ad40" + digest = "1:902fe8d968778bd0c0150408f658b56c9951fb6fd677ab0c148eeac3fc053340" name = "github.com/Azure/go-autorest" packages = [ "autorest", "autorest/adal", "autorest/azure", "autorest/azure/auth", + "autorest/azure/cli", "autorest/date", "autorest/to", "autorest/validation", "logger", - "version", + "tracing", ] pruneopts = "NUT" - revision = "39013ecb48eaf6ced3f4e3e1d95515140ce6b3cf" - version = "v10.15.2" + revision = "09205e8f6711a776499a14cf8adc6bd380db5d81" + version = "v12.2.0" [[projects]] digest = "1:5d72bbcc9c8667b11c3dc3cbe681c5a6f71e5096744c0bf7726ab5c6425d5dc4" @@ -76,12 +85,13 @@ version = "v0.7.4" [[projects]] - digest = "1:823e87ae25170339e2bfd1d6f7c2e27554c6bb5655f91c67b37bd5be45bb6b32" + digest = "1:328d829ec0e36017fc18c65b8eaf258021b90e7ff294412b3dc9a315ee04b68a" name = "github.com/aliyun/alibaba-cloud-sdk-go" packages = [ "sdk", "sdk/auth", "sdk/auth/credentials", + "sdk/auth/credentials/provider", "sdk/auth/signers", "sdk/endpoints", "sdk/errors", @@ -91,11 +101,11 @@ "services/alidns", ] pruneopts = "NUT" - revision = "cad214d7d71fba7883fcf3b7e550ba782c15b400" - version = "1.27.7" + revision = "133cfe6c309b3d61b38d7076a852f155619d48ff" + version = "1.60.57" [[projects]] - digest = "1:1634c57333a07adf7d7e206d3329340f1c36e82bca9e61e2cff08c064ab85046" + digest = "1:2103f1d7935e7569064e90e59b071dd7bc65a1aeb2014688a23465eaf30848c7" name = "github.com/aws/aws-sdk-go" packages = [ "aws", @@ -107,6 +117,7 @@ "aws/credentials", "aws/credentials/ec2rolecreds", "aws/credentials/endpointcreds", + "aws/credentials/processcreds", "aws/credentials/stscreds", "aws/csm", "aws/defaults", @@ -115,6 +126,7 @@ "aws/request", "aws/session", "aws/signer/v4", + "internal/ini", "internal/sdkio", "internal/sdkrand", "internal/sdkuri", @@ -132,8 +144,8 @@ "service/sts", ] pruneopts = "NUT" - revision = "8b15f938ed215522a37275106e847f6f0be85fe8" - version = "v1.15.23" + revision = "06512ecac9db8f44189277d87f426e6dc53cc86b" + version = "v1.20.14" [[projects]] digest = "1:cdee563173093e5ae7ab2a19c298e0904129719e1919a3c532b7bb0c3398b818" @@ -144,12 +156,27 @@ version = "v2.1.1" [[projects]] - digest = "1:03cfacdc6bfd46007c15786c1ece3fa074f89e5193a292f0f26d9e98c99c7cc2" + digest = "1:fdb4ed936abeecb46a8c27dcac83f75c05c87a46d9ec7711411eb785c213fa02" + name = "github.com/census-instrumentation/opencensus-proto" + packages = [ + "gen-go/agent/common/v1", + "gen-go/agent/metrics/v1", + "gen-go/agent/trace/v1", + "gen-go/metrics/v1", + "gen-go/resource/v1", + "gen-go/trace/v1", + ] + pruneopts = "NUT" + revision = "a105b96453fe85139acc07b68de48f2cbdd71249" + version = "v0.2.0" + +[[projects]] + digest = "1:967f24bdc4ffbea9c4cca556caa446805257e64f6a2b1a5f4b69b32a7e888129" name = "github.com/cloudflare/cloudflare-go" packages = ["."] pruneopts = "NUT" - revision = "1f9007fbecae20711133c60519338c41cef1ffb4" - version = "v0.8.5" + revision = "33ef9f42e17f33f6088dfe8c0dc95b916d1edfc6" + version = "v0.9.2" [[projects]] branch = "master" @@ -184,28 +211,28 @@ version = "v3.2.0" [[projects]] - branch = "master" - digest = "1:ec6271918b59b872a2d25e374569a4f75f1839d91e4191470c297b7eaaaf7641" + digest = "1:f9adc21a937e5da643ea14a3488cb7506788876737a5e205394e508627a6eec8" name = "github.com/dimchansky/utfbom" packages = ["."] pruneopts = "NUT" - revision = "5448fe645cb1964ba70ac8f9f2ffe975e61a536c" + revision = "d2133a1ce379ef6fa992b0514a77146c60db9d1c" + version = "v1.1.0" [[projects]] - digest = "1:5ec1feea329f68f736c43e81a218c18e4e83779fb96d118becb97a9f2f7d6fc4" + digest = "1:d9688055094edd046a71ee85204ea97090ecce6f316b739be3a50f5ca6403ebb" name = "github.com/dnsimple/dnsimple-go" packages = ["dnsimple"] pruneopts = "NUT" - revision = "8f70b647443816578a776f6c6d3e84deb11e1731" - version = "v0.23.0" + revision = "7e193cc468a07cdf74d76de1e6736c709c5a3872" + version = "v0.30.0" [[projects]] - digest = "1:e73fd806b49d0e5c5d81776f8b33e1c35918cdd6c02dea4f1c2d91e70c8aa378" + digest = "1:efcc176c5cfbe8421dd3eb2562be91c3272e80f61b181e31d5745b7fee29a669" name = "github.com/exoscale/egoscale" packages = ["."] pruneopts = "NUT" - revision = "4e527724b8225e8315d580accd1c4e860202d41b" - version = "v0.17.1" + revision = "8f608c40ae891e0240bb6e696a72437be7069d83" + version = "v0.18.1" [[projects]] digest = "1:aa3ed0a71c4e66e4ae6486bf97a3f4cab28edc78df2e50c5ad01dc7d91604b88" @@ -240,18 +267,25 @@ version = "v3.2.0" [[projects]] - digest = "1:63ccdfbd20f7ccd2399d0647a7d100b122f79c13bb83da9660b1598396fd9f62" + digest = "1:27d8aff388ac8ea2d4057097ef4aad2f98a6a8796477213096160b72b6c87cf2" name = "github.com/golang/protobuf" packages = [ + "jsonpb", "proto", + "protoc-gen-go/descriptor", + "protoc-gen-go/generator", + "protoc-gen-go/generator/internal/remap", + "protoc-gen-go/plugin", "ptypes", "ptypes/any", "ptypes/duration", + "ptypes/struct", "ptypes/timestamp", + "ptypes/wrappers", ] pruneopts = "NUT" - revision = "aa810b61a9c79d51363740d207bb46cf8e620ed5" - version = "v1.2.0" + revision = "b5d812f8a3706043e23a9cd5babf2e5423744d30" + version = "v1.3.1" [[projects]] branch = "master" @@ -287,6 +321,18 @@ pruneopts = "NUT" revision = "a2b0ad6ce68c8302027db1a5f9dbb03b0c8ab072" +[[projects]] + digest = "1:960e8004095e3be6cff988becc8cc9ec1dc0e06887144ed46ff2da86e7c0efea" + name = "github.com/grpc-ecosystem/grpc-gateway" + packages = [ + "internal", + "runtime", + "utilities", + ] + pruneopts = "NUT" + revision = "d54b3615f714b03edde6d9206fa0476a9169c966" + version = "v1.9.3" + [[projects]] digest = "1:67474f760e9ac3799f740db2c489e6423a4cde45520673ec123ac831ad849cb8" name = "github.com/hashicorp/golang-lru" @@ -307,11 +353,11 @@ revision = "8803795a9b7b938fa88ddbd63a77893beee14cd8" [[projects]] - digest = "1:ac6d01547ec4f7f673311b4663909269bfb8249952de3279799289467837c3cc" + digest = "1:1f2aebae7e7c856562355ec0198d8ca2fa222fb05e5b1b66632a1fce39631885" name = "github.com/jmespath/go-jmespath" packages = ["."] pruneopts = "NUT" - revision = "0b12d6b5" + revision = "c2b33e84" [[projects]] digest = "1:8e36686e8b139f8fe240c1d5cf3a145bc675c22ff8e707857cdd3ae17b00d728" @@ -357,20 +403,20 @@ revision = "8b16b4848295edda07b9a828e5a3b285c25c2b9c" [[projects]] - digest = "1:a0181b662584429828ccdd68d4dbe09ba7ba7414ef01d54b96f152002802ed72" + digest = "1:7981caf0d67995c0acbd352785f45b177a2d089ed40f2005794c0772d0fbfff9" name = "github.com/linode/linodego" packages = ["."] pruneopts = "NUT" - revision = "42d84d42f3f28fe1fe1823c58c11715241eda24e" - version = "v0.7.1" + revision = "7adba57685c129bcd29a9edc7008ec3b05680240" + version = "v0.10.0" [[projects]] - digest = "1:bcc0ec1552cdcd95ee76052a01273eb35917df74825420b3e3df12c3b8d5e6ed" + digest = "1:7894d93b1bbb3ab412c9b4f2573accc5becbcce2516e1fe5a4d2da1825b2e369" name = "github.com/miekg/dns" packages = ["."] pruneopts = "NUT" - revision = "8aa92d4e02c501ba21e26fb92cf2fb9f23f56917" - version = "v1.1.9" + revision = "b13675009d59c97f3721247d9efa8914e1866a5b" + version = "v1.1.15" [[projects]] digest = "1:a4df73029d2c42fabcb6b41e327d2f87e685284ec03edf76921c267d9cfc9c23" @@ -429,15 +475,15 @@ version = "v0.6.0" [[projects]] - digest = "1:50ba4638005d50396250b601811becb6b11ab13b0b7fa8ccbe119e21ce08a4fa" + digest = "1:482e6a8662dcfd8dc7ebf28b8a1a293b6d453f71bda13e370b3949cb487e6dd6" name = "github.com/oracle/oci-go-sdk" packages = [ "common", "dns", ] pruneopts = "NUT" - revision = "9ed9700756ebdedc96eaefcccf9322afbd4009ef" - version = "v5.4.0" + revision = "481415e15d394fa0817faedceabb7c59e21133b8" + version = "v5.13.0" [[projects]] branch = "master" @@ -472,7 +518,7 @@ revision = "1031fa0ce2f20c1c0e1e1b51951d8ea02c84fa05" [[projects]] - digest = "1:253f275bd72c42f8d234712d1574c8b222fe9b72838bfaca11b21ace9c0e3d0a" + digest = "1:7ddc1fdd49e0e59eb618fd4af9b5802358178392d7dfefc18f7dd691e81f979f" name = "github.com/sacloud/libsacloud" packages = [ ".", @@ -482,16 +528,8 @@ "utils/mutexkv", ] pruneopts = "NUT" - revision = "41c392dee98a83260abbe0fcd5c13beb7c75d103" - version = "v1.21.1" - -[[projects]] - digest = "1:6bc0652ea6e39e22ccd522458b8bdd8665bf23bdc5a20eec90056e4dc7e273ca" - name = "github.com/satori/go.uuid" - packages = ["."] - pruneopts = "NUT" - revision = "f58768cc1a7a7e77a3bd49e98cdd21419399b6a3" - version = "v1.2.0" + revision = "6fb0c01c45716a08d5438f6d85a2a8984cc8a0a8" + version = "v1.25.1" [[projects]] digest = "1:b2339e83ce9b5c4f79405f949429a7f68a9a904fed903c672aac1e7ceb7f5f02" @@ -534,7 +572,7 @@ revision = "37e84520dcf74488f67654f9c775b9752c232dc1" [[projects]] - digest = "1:21ef4b12d6b6c6dfe389caa82f859d1e35eeb24ce61c60d09db57addb6a95781" + digest = "1:4da573eeacb95c9452ae7ddc14b06148a99b29bf98522abb221ef9799426187c" name = "github.com/transip/gotransip" packages = [ ".", @@ -542,8 +580,8 @@ "util", ] pruneopts = "NUT" - revision = "c6e2ce0bbb4a601a909e3b7a773358d6b503e663" - version = "v5.8.2" + revision = "efb64632cab7701ec33f1eaeaa738e2207efe68e" + version = "v5.14" [[projects]] digest = "1:5dba68a1600a235630e208cb7196b24e58fcbb77bb7a6bec08fcd23f081b0a58" @@ -554,7 +592,7 @@ version = "v1.20.0" [[projects]] - digest = "1:045bc0ab96bb83bdffd2606f019003da03d1c139d3cb8aad13596863e4dd37d6" + digest = "1:58f2854b50ff8862eb6a347f20dedaac83e1166f4040472e17bc37736841a12f" name = "go.opencensus.io" packages = [ ".", @@ -562,8 +600,10 @@ "internal/tagencoding", "metric/metricdata", "metric/metricproducer", + "plugin/ocgrpc", "plugin/ochttp", "plugin/ochttp/propagation/b3", + "plugin/ochttp/propagation/tracecontext", "resource", "stats", "stats/internal", @@ -575,8 +615,8 @@ "trace/tracestate", ] pruneopts = "NUT" - revision = "8930459677fde1e11e3e1b50bbed1acc850b5665" - version = "v0.20.1" + revision = "43463a80402d8447b7fce0d2c58edf1687ff0b58" + version = "v0.19.3" [[projects]] branch = "master" @@ -643,6 +683,14 @@ pruneopts = "NUT" revision = "d2e6202438beef2727060aa7cabdd924d92ebfd9" +[[projects]] + branch = "master" + digest = "1:382bb5a7fb4034db3b6a2d19e5a4a6bcf52f4750530603c01ca18a172fa3089b" + name = "golang.org/x/sync" + packages = ["semaphore"] + pruneopts = "NUT" + revision = "112230192c580c3556b8cee6403af37a4fc5f28c" + [[projects]] branch = "master" digest = "1:e1498a6884b2564efe2a4c4aefce64eb4bc6a4666acfd42db044cf581db4d9cb" @@ -687,7 +735,7 @@ [[projects]] branch = "master" - digest = "1:887c07769ee52c81222ea1112b11a3947c703da529d1643d85c216b9537d87b8" + digest = "1:867c0e5fbb22d5ae76c8255aa8f4ac3c27eede02d29baa804faa590d42ae44e6" name = "google.golang.org/api" packages = [ "dns/v1", @@ -697,6 +745,7 @@ "googleapi/transport", "internal", "option", + "support/bundler", "transport/http", "transport/http/internal/propagation", ] @@ -724,9 +773,13 @@ [[projects]] branch = "master" - digest = "1:c3076e7defee87de1236f1814beb588f40a75544c60121e6eb38b3b3721783e2" + digest = "1:5dc13cd8c0b417e12d187938d2ccb2348dda90f6d3d4a3d8402a40677a5ac982" name = "google.golang.org/genproto" - packages = ["googleapis/rpc/status"] + packages = [ + "googleapis/api/httpbody", + "googleapis/rpc/status", + "protobuf/field_mask", + ] pruneopts = "NUT" revision = "64821d5d210748c883cd2b809589555ae4654203" @@ -802,7 +855,7 @@ version = "v1.12.0" [[projects]] - digest = "1:a50fabe7a46692dc7c656310add3d517abe7914df02afd151ef84da884605dc8" + digest = "1:a56dc1133e9c449d41d22ffabd6c2343cd25ab31c9cad0e74a144006810d1544" name = "gopkg.in/square/go-jose.v2" packages = [ ".", @@ -810,8 +863,8 @@ "json", ] pruneopts = "NUT" - revision = "ef984e69dd356202fd4e4910d4d9c24468bdf0b8" - version = "v2.1.9" + revision = "730df5f748271903322feb182be83b43ebbbe27d" + version = "v2.3.1" [solve-meta] analyzer-name = "dep" diff --git a/Gopkg.toml b/Gopkg.toml index ad955e83..a0c06adc 100644 --- a/Gopkg.toml +++ b/Gopkg.toml @@ -30,81 +30,101 @@ unused-packages = true [[constraint]] - branch = "master" - name = "golang.org/x/crypto" - -[[constraint]] - branch = "master" - name = "golang.org/x/net" - -[[constraint]] - branch = "master" - name = "golang.org/x/oauth2" - -[[constraint]] - branch = "master" - name = "google.golang.org/api" - -[[constraint]] - version = "v1.1.9" name = "github.com/miekg/dns" + version = "1.1.15" [[constraint]] + name = "gopkg.in/square/go-jose.v2" + version = "2.3.1" + +[[constraint]] + name = "golang.org/x/crypto" branch = "master" + +[[constraint]] + name = "golang.org/x/net" + branch = "master" + +[[constraint]] + name = "golang.org/x/oauth2" + branch = "master" + +[[constraint]] + name = "google.golang.org/api" + branch = "master" + +[[constraint]] name = "github.com/rainycape/memcache" + branch = "master" [[constraint]] - version = "0.2.0" name = "github.com/decker502/dnspod-go" + version = "0.2.0" [[constraint]] - version = "0.23.0" name = "github.com/dnsimple/dnsimple-go" + version = "0.30.0" [[constraint]] - branch = "master" name = "github.com/namedotcom/go" + branch = "master" [[constraint]] - branch = "master" name = "github.com/ovh/go-ovh" - -[[constraint]] branch = "master" + +[[constraint]] name = "github.com/timewasted/linode" + branch = "master" [[constraint]] - version = "0.6.0" name = "github.com/nrdcg/goinwx" + version = "0.6.0" [[constraint]] - version = "0.7.1" name = "github.com/linode/linodego" + version = "0.10.0" [[constraint]] - branch = "v2" name = "gopkg.in/ns1/ns1-go.v2" + branch = "v2" [[constraint]] - version = "1.21.1" name = "github.com/sacloud/libsacloud" + version = "1.25.1" [[constraint]] - version = "v5.8.2" name = "github.com/transip/gotransip" + version = "5.14" [[constraint]] - version = "0.17.1" name = "github.com/exoscale/egoscale" + version = "0.18.1" [[constraint]] - version = "v0.7.4" name = "github.com/akamai/AkamaiOPEN-edgegrid-golang" + version = "0.7.4" [[constraint]] - version = "5.4.0" name = "github.com/oracle/oci-go-sdk" + version = "5.13.0" [[constraint]] name = "github.com/labbsr0x/bindman-dns-webhook" version = "1.0.0" + +[[constraint]] + name = "github.com/Azure/azure-sdk-for-go" + version = "31.0.0" + +[[constraint]] + name = "github.com/aliyun/alibaba-cloud-sdk-go" + version = "1.60.57" + +[[constraint]] + name = "github.com/cloudflare/cloudflare-go" + version = "0.9.2" + +[[constraint]] + name = "github.com/cpu/goacmedns" + branch = "master" diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE b/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/LICENSE @@ -0,0 +1,201 @@ + 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/contrib.go.opencensus.io/exporter/ocagent/common.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/common.go new file mode 100644 index 00000000..297e44b6 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/common.go @@ -0,0 +1,38 @@ +// Copyright 2018, OpenCensus 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 ocagent + +import ( + "math/rand" + "time" +) + +var randSrc = rand.New(rand.NewSource(time.Now().UnixNano())) + +// retries function fn upto n times, if fn returns an error lest it returns nil early. +// It applies exponential backoff in units of (1< 0 { + ctx = metadata.NewOutgoingContext(ctx, metadata.New(ae.headers)) + } + traceExporter, err := traceSvcClient.Export(ctx) + if err != nil { + return fmt.Errorf("Exporter.Start:: TraceServiceClient: %v", err) + } + + firstTraceMessage := &agenttracepb.ExportTraceServiceRequest{ + Node: node, + Resource: ae.resource, + } + if err := traceExporter.Send(firstTraceMessage); err != nil { + return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err) + } + + ae.mu.Lock() + ae.traceExporter = traceExporter + ae.mu.Unlock() + + // Initiate the config service by sending over node identifier info. + configStream, err := traceSvcClient.Config(context.Background()) + if err != nil { + return fmt.Errorf("Exporter.Start:: ConfigStream: %v", err) + } + firstCfgMessage := &agenttracepb.CurrentLibraryConfig{Node: node} + if err := configStream.Send(firstCfgMessage); err != nil { + return fmt.Errorf("Exporter.Start:: Failed to initiate the Config service: %v", err) + } + + // In the background, handle trace configurations that are beamed down + // by the agent, but also reply to it with the applied configuration. + go ae.handleConfigStreaming(configStream) + + return nil +} + +func (ae *Exporter) createMetricsServiceConnection(cc *grpc.ClientConn, node *commonpb.Node) error { + metricsSvcClient := agentmetricspb.NewMetricsServiceClient(cc) + metricsExporter, err := metricsSvcClient.Export(context.Background()) + if err != nil { + return fmt.Errorf("MetricsExporter: failed to start the service client: %v", err) + } + // Initiate the metrics service by sending over the first message just containing the Node and Resource. + firstMetricsMessage := &agentmetricspb.ExportMetricsServiceRequest{ + Node: node, + Resource: ae.resource, + } + if err := metricsExporter.Send(firstMetricsMessage); err != nil { + return fmt.Errorf("MetricsExporter:: failed to send the first message: %v", err) + } + + ae.mu.Lock() + ae.metricsExporter = metricsExporter + ae.mu.Unlock() + + // With that we are good to go and can start sending metrics + return nil +} + +func (ae *Exporter) dialToAgent() (*grpc.ClientConn, error) { + addr := ae.prepareAgentAddress() + var dialOpts []grpc.DialOption + if ae.clientTransportCredentials != nil { + dialOpts = append(dialOpts, grpc.WithTransportCredentials(ae.clientTransportCredentials)) + } else if ae.canDialInsecure { + dialOpts = append(dialOpts, grpc.WithInsecure()) + } + if ae.compressor != "" { + dialOpts = append(dialOpts, grpc.WithDefaultCallOptions(grpc.UseCompressor(ae.compressor))) + } + dialOpts = append(dialOpts, grpc.WithStatsHandler(&ocgrpc.ClientHandler{})) + + ctx := context.Background() + if len(ae.headers) > 0 { + ctx = metadata.NewOutgoingContext(ctx, metadata.New(ae.headers)) + } + return grpc.DialContext(ctx, addr, dialOpts...) +} + +func (ae *Exporter) handleConfigStreaming(configStream agenttracepb.TraceService_ConfigClient) error { + // Note: We haven't yet implemented configuration sending so we + // should NOT be changing connection states within this function for now. + for { + recv, err := configStream.Recv() + if err != nil { + // TODO: Check if this is a transient error or exponential backoff-able. + return err + } + cfg := recv.Config + if cfg == nil { + continue + } + + // Otherwise now apply the trace configuration sent down from the agent + if psamp := cfg.GetProbabilitySampler(); psamp != nil { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.ProbabilitySampler(psamp.SamplingProbability)}) + } else if csamp := cfg.GetConstantSampler(); csamp != nil { + alwaysSample := csamp.Decision == tracepb.ConstantSampler_ALWAYS_ON + if alwaysSample { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.AlwaysSample()}) + } else { + trace.ApplyConfig(trace.Config{DefaultSampler: trace.NeverSample()}) + } + } else { // TODO: Add the rate limiting sampler here + } + + // Then finally send back to upstream the newly applied configuration + err = configStream.Send(&agenttracepb.CurrentLibraryConfig{Config: &tracepb.TraceConfig{Sampler: cfg.Sampler}}) + if err != nil { + return err + } + } +} + +// Stop shuts down all the connections and resources +// related to the exporter. +func (ae *Exporter) Stop() error { + ae.mu.RLock() + cc := ae.grpcClientConn + started := ae.started + stopped := ae.stopped + ae.mu.RUnlock() + + if !started { + return errNotStarted + } + if stopped { + // TODO: tell the user that we've already stopped, so perhaps a sentinel error? + return nil + } + + ae.Flush() + + // Now close the underlying gRPC connection. + var err error + if cc != nil { + err = cc.Close() + } + + // At this point we can change the state variables: started and stopped + ae.mu.Lock() + ae.started = false + ae.stopped = true + ae.mu.Unlock() + close(ae.stopCh) + + // Ensure that the backgroundConnector returns + <-ae.backgroundConnectionDoneCh + + return err +} + +func (ae *Exporter) ExportSpan(sd *trace.SpanData) { + if sd == nil { + return + } + _ = ae.traceBundler.Add(sd, 1) +} + +func (ae *Exporter) ExportTraceServiceRequest(batch *agenttracepb.ExportTraceServiceRequest) error { + if batch == nil || len(batch.Spans) == 0 { + return nil + } + + select { + case <-ae.stopCh: + return errStopped + + default: + if !ae.connected() { + return errNoConnection + } + + ae.senderMu.Lock() + err := ae.traceExporter.Send(batch) + ae.senderMu.Unlock() + if err != nil { + ae.setStateDisconnected() + return err + } + return nil + } +} + +func (ae *Exporter) ExportView(vd *view.Data) { + if vd == nil { + return + } + _ = ae.viewDataBundler.Add(vd, 1) +} + +func ocSpanDataToPbSpans(sdl []*trace.SpanData) []*tracepb.Span { + if len(sdl) == 0 { + return nil + } + protoSpans := make([]*tracepb.Span, 0, len(sdl)) + for _, sd := range sdl { + if sd != nil { + protoSpans = append(protoSpans, ocSpanToProtoSpan(sd)) + } + } + return protoSpans +} + +func (ae *Exporter) uploadTraces(sdl []*trace.SpanData) { + select { + case <-ae.stopCh: + return + + default: + if !ae.connected() { + return + } + + protoSpans := ocSpanDataToPbSpans(sdl) + if len(protoSpans) == 0 { + return + } + ae.senderMu.Lock() + err := ae.traceExporter.Send(&agenttracepb.ExportTraceServiceRequest{ + Spans: protoSpans, + }) + ae.senderMu.Unlock() + if err != nil { + ae.setStateDisconnected() + } + } +} + +func ocViewDataToPbMetrics(vdl []*view.Data) []*metricspb.Metric { + if len(vdl) == 0 { + return nil + } + metrics := make([]*metricspb.Metric, 0, len(vdl)) + for _, vd := range vdl { + if vd != nil { + vmetric, err := viewDataToMetric(vd) + // TODO: (@odeke-em) somehow report this error, if it is non-nil. + if err == nil && vmetric != nil { + metrics = append(metrics, vmetric) + } + } + } + return metrics +} + +func (ae *Exporter) uploadViewData(vdl []*view.Data) { + select { + case <-ae.stopCh: + return + + default: + if !ae.connected() { + return + } + + protoMetrics := ocViewDataToPbMetrics(vdl) + if len(protoMetrics) == 0 { + return + } + err := ae.metricsExporter.Send(&agentmetricspb.ExportMetricsServiceRequest{ + Metrics: protoMetrics, + // TODO:(@odeke-em) + // a) Figure out how to derive a Node from the environment + // b) Figure out how to derive a Resource from the environment + // or better letting users of the exporter configure it. + }) + if err != nil { + ae.setStateDisconnected() + } + } +} + +func (ae *Exporter) Flush() { + ae.traceBundler.Flush() + ae.viewDataBundler.Flush() +} + +func resourceProtoFromEnv() *resourcepb.Resource { + rs, _ := resource.FromEnv(context.Background()) + if rs == nil { + return nil + } + + rprs := &resourcepb.Resource{ + Type: rs.Type, + } + if rs.Labels != nil { + rprs.Labels = make(map[string]string) + for k, v := range rs.Labels { + rprs.Labels[k] = v + } + } + return rprs +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go new file mode 100644 index 00000000..3e05ae8b --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/options.go @@ -0,0 +1,128 @@ +// Copyright 2018, OpenCensus 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 ocagent + +import ( + "time" + + "google.golang.org/grpc/credentials" +) + +const ( + DefaultAgentPort uint16 = 55678 + DefaultAgentHost string = "localhost" +) + +type ExporterOption interface { + withExporter(e *Exporter) +} + +type insecureGrpcConnection int + +var _ ExporterOption = (*insecureGrpcConnection)(nil) + +func (igc *insecureGrpcConnection) withExporter(e *Exporter) { + e.canDialInsecure = true +} + +// WithInsecure disables client transport security for the exporter's gRPC connection +// just like grpc.WithInsecure() https://godoc.org/google.golang.org/grpc#WithInsecure +// does. Note, by default, client security is required unless WithInsecure is used. +func WithInsecure() ExporterOption { return new(insecureGrpcConnection) } + +type addressSetter string + +func (as addressSetter) withExporter(e *Exporter) { + e.agentAddress = string(as) +} + +var _ ExporterOption = (*addressSetter)(nil) + +// WithAddress allows one to set the address that the exporter will +// connect to the agent on. If unset, it will instead try to use +// connect to DefaultAgentHost:DefaultAgentPort +func WithAddress(addr string) ExporterOption { + return addressSetter(addr) +} + +type serviceNameSetter string + +func (sns serviceNameSetter) withExporter(e *Exporter) { + e.serviceName = string(sns) +} + +var _ ExporterOption = (*serviceNameSetter)(nil) + +// WithServiceName allows one to set/override the service name +// that the exporter will report to the agent. +func WithServiceName(serviceName string) ExporterOption { + return serviceNameSetter(serviceName) +} + +type reconnectionPeriod time.Duration + +func (rp reconnectionPeriod) withExporter(e *Exporter) { + e.reconnectionPeriod = time.Duration(rp) +} + +func WithReconnectionPeriod(rp time.Duration) ExporterOption { + return reconnectionPeriod(rp) +} + +type compressorSetter string + +func (c compressorSetter) withExporter(e *Exporter) { + e.compressor = string(c) +} + +// UseCompressor will set the compressor for the gRPC client to use when sending requests. +// It is the responsibility of the caller to ensure that the compressor set has been registered +// with google.golang.org/grpc/encoding. This can be done by encoding.RegisterCompressor. Some +// compressors auto-register on import, such as gzip, which can be registered by calling +// `import _ "google.golang.org/grpc/encoding/gzip"` +func UseCompressor(compressorName string) ExporterOption { + return compressorSetter(compressorName) +} + +type headerSetter map[string]string + +func (h headerSetter) withExporter(e *Exporter) { + e.headers = map[string]string(h) +} + +// WithHeaders will send the provided headers when the gRPC stream connection +// is instantiated +func WithHeaders(headers map[string]string) ExporterOption { + return headerSetter(headers) +} + +type clientCredentials struct { + credentials.TransportCredentials +} + +var _ ExporterOption = (*clientCredentials)(nil) + +// WithTLSCredentials allows the connection to use TLS credentials +// when talking to the server. It takes in grpc.TransportCredentials instead +// of say a Certificate file or a tls.Certificate, because the retrieving +// these credentials can be done in many ways e.g. plain file, in code tls.Config +// or by certificate rotation, so it is up to the caller to decide what to use. +func WithTLSCredentials(creds credentials.TransportCredentials) ExporterOption { + return &clientCredentials{TransportCredentials: creds} +} + +func (cc *clientCredentials) withExporter(e *Exporter) { + e.clientTransportCredentials = cc.TransportCredentials +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go new file mode 100644 index 00000000..983ebe7b --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_spans.go @@ -0,0 +1,248 @@ +// Copyright 2018, OpenCensus 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 ocagent + +import ( + "math" + "time" + + "go.opencensus.io/trace" + "go.opencensus.io/trace/tracestate" + + tracepb "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1" + "github.com/golang/protobuf/ptypes/timestamp" +) + +const ( + maxAnnotationEventsPerSpan = 32 + maxMessageEventsPerSpan = 128 +) + +func ocSpanToProtoSpan(sd *trace.SpanData) *tracepb.Span { + if sd == nil { + return nil + } + var namePtr *tracepb.TruncatableString + if sd.Name != "" { + namePtr = &tracepb.TruncatableString{Value: sd.Name} + } + return &tracepb.Span{ + TraceId: sd.TraceID[:], + SpanId: sd.SpanID[:], + ParentSpanId: sd.ParentSpanID[:], + Status: ocStatusToProtoStatus(sd.Status), + StartTime: timeToTimestamp(sd.StartTime), + EndTime: timeToTimestamp(sd.EndTime), + Links: ocLinksToProtoLinks(sd.Links), + Kind: ocSpanKindToProtoSpanKind(sd.SpanKind), + Name: namePtr, + Attributes: ocAttributesToProtoAttributes(sd.Attributes), + TimeEvents: ocTimeEventsToProtoTimeEvents(sd.Annotations, sd.MessageEvents), + Tracestate: ocTracestateToProtoTracestate(sd.Tracestate), + } +} + +var blankStatus trace.Status + +func ocStatusToProtoStatus(status trace.Status) *tracepb.Status { + if status == blankStatus { + return nil + } + return &tracepb.Status{ + Code: status.Code, + Message: status.Message, + } +} + +func ocLinksToProtoLinks(links []trace.Link) *tracepb.Span_Links { + if len(links) == 0 { + return nil + } + + sl := make([]*tracepb.Span_Link, 0, len(links)) + for _, ocLink := range links { + // This redefinition is necessary to prevent ocLink.*ID[:] copies + // being reused -- in short we need a new ocLink per iteration. + ocLink := ocLink + + sl = append(sl, &tracepb.Span_Link{ + TraceId: ocLink.TraceID[:], + SpanId: ocLink.SpanID[:], + Type: ocLinkTypeToProtoLinkType(ocLink.Type), + }) + } + + return &tracepb.Span_Links{ + Link: sl, + } +} + +func ocLinkTypeToProtoLinkType(oct trace.LinkType) tracepb.Span_Link_Type { + switch oct { + case trace.LinkTypeChild: + return tracepb.Span_Link_CHILD_LINKED_SPAN + case trace.LinkTypeParent: + return tracepb.Span_Link_PARENT_LINKED_SPAN + default: + return tracepb.Span_Link_TYPE_UNSPECIFIED + } +} + +func ocAttributesToProtoAttributes(attrs map[string]interface{}) *tracepb.Span_Attributes { + if len(attrs) == 0 { + return nil + } + outMap := make(map[string]*tracepb.AttributeValue) + for k, v := range attrs { + switch v := v.(type) { + case bool: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_BoolValue{BoolValue: v}} + + case int: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: int64(v)}} + + case int64: + outMap[k] = &tracepb.AttributeValue{Value: &tracepb.AttributeValue_IntValue{IntValue: v}} + + case string: + outMap[k] = &tracepb.AttributeValue{ + Value: &tracepb.AttributeValue_StringValue{ + StringValue: &tracepb.TruncatableString{Value: v}, + }, + } + } + } + return &tracepb.Span_Attributes{ + AttributeMap: outMap, + } +} + +// This code is mostly copied from +// https://github.com/census-ecosystem/opencensus-go-exporter-stackdriver/blob/master/trace_proto.go#L46 +func ocTimeEventsToProtoTimeEvents(as []trace.Annotation, es []trace.MessageEvent) *tracepb.Span_TimeEvents { + if len(as) == 0 && len(es) == 0 { + return nil + } + + timeEvents := &tracepb.Span_TimeEvents{} + var annotations, droppedAnnotationsCount int + var messageEvents, droppedMessageEventsCount int + + // Transform annotations + for i, a := range as { + if annotations >= maxAnnotationEventsPerSpan { + droppedAnnotationsCount = len(as) - i + break + } + annotations++ + timeEvents.TimeEvent = append(timeEvents.TimeEvent, + &tracepb.Span_TimeEvent{ + Time: timeToTimestamp(a.Time), + Value: transformAnnotationToTimeEvent(&a), + }, + ) + } + + // Transform message events + for i, e := range es { + if messageEvents >= maxMessageEventsPerSpan { + droppedMessageEventsCount = len(es) - i + break + } + messageEvents++ + timeEvents.TimeEvent = append(timeEvents.TimeEvent, + &tracepb.Span_TimeEvent{ + Time: timeToTimestamp(e.Time), + Value: transformMessageEventToTimeEvent(&e), + }, + ) + } + + // Process dropped counter + timeEvents.DroppedAnnotationsCount = clip32(droppedAnnotationsCount) + timeEvents.DroppedMessageEventsCount = clip32(droppedMessageEventsCount) + + return timeEvents +} + +func transformAnnotationToTimeEvent(a *trace.Annotation) *tracepb.Span_TimeEvent_Annotation_ { + return &tracepb.Span_TimeEvent_Annotation_{ + Annotation: &tracepb.Span_TimeEvent_Annotation{ + Description: &tracepb.TruncatableString{Value: a.Message}, + Attributes: ocAttributesToProtoAttributes(a.Attributes), + }, + } +} + +func transformMessageEventToTimeEvent(e *trace.MessageEvent) *tracepb.Span_TimeEvent_MessageEvent_ { + return &tracepb.Span_TimeEvent_MessageEvent_{ + MessageEvent: &tracepb.Span_TimeEvent_MessageEvent{ + Type: tracepb.Span_TimeEvent_MessageEvent_Type(e.EventType), + Id: uint64(e.MessageID), + UncompressedSize: uint64(e.UncompressedByteSize), + CompressedSize: uint64(e.CompressedByteSize), + }, + } +} + +// clip32 clips an int to the range of an int32. +func clip32(x int) int32 { + if x < math.MinInt32 { + return math.MinInt32 + } + if x > math.MaxInt32 { + return math.MaxInt32 + } + return int32(x) +} + +func timeToTimestamp(t time.Time) *timestamp.Timestamp { + nanoTime := t.UnixNano() + return ×tamp.Timestamp{ + Seconds: nanoTime / 1e9, + Nanos: int32(nanoTime % 1e9), + } +} + +func ocSpanKindToProtoSpanKind(kind int) tracepb.Span_SpanKind { + switch kind { + case trace.SpanKindClient: + return tracepb.Span_CLIENT + case trace.SpanKindServer: + return tracepb.Span_SERVER + default: + return tracepb.Span_SPAN_KIND_UNSPECIFIED + } +} + +func ocTracestateToProtoTracestate(ts *tracestate.Tracestate) *tracepb.Span_Tracestate { + if ts == nil { + return nil + } + return &tracepb.Span_Tracestate{ + Entries: ocTracestateEntriesToProtoTracestateEntries(ts.Entries()), + } +} + +func ocTracestateEntriesToProtoTracestateEntries(entries []tracestate.Entry) []*tracepb.Span_Tracestate_Entry { + protoEntries := make([]*tracepb.Span_Tracestate_Entry, 0, len(entries)) + for _, entry := range entries { + protoEntries = append(protoEntries, &tracepb.Span_Tracestate_Entry{ + Key: entry.Key, + Value: entry.Value, + }) + } + return protoEntries +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go new file mode 100644 index 00000000..43f18dec --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/transform_stats_to_metrics.go @@ -0,0 +1,274 @@ +// Copyright 2018, OpenCensus 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 ocagent + +import ( + "errors" + "time" + + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" + + "github.com/golang/protobuf/ptypes/timestamp" + + metricspb "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" +) + +var ( + errNilMeasure = errors.New("expecting a non-nil stats.Measure") + errNilView = errors.New("expecting a non-nil view.View") + errNilViewData = errors.New("expecting a non-nil view.Data") +) + +func viewDataToMetric(vd *view.Data) (*metricspb.Metric, error) { + if vd == nil { + return nil, errNilViewData + } + + descriptor, err := viewToMetricDescriptor(vd.View) + if err != nil { + return nil, err + } + + timeseries, err := viewDataToTimeseries(vd) + if err != nil { + return nil, err + } + + metric := &metricspb.Metric{ + MetricDescriptor: descriptor, + Timeseries: timeseries, + } + return metric, nil +} + +func viewToMetricDescriptor(v *view.View) (*metricspb.MetricDescriptor, error) { + if v == nil { + return nil, errNilView + } + if v.Measure == nil { + return nil, errNilMeasure + } + + desc := &metricspb.MetricDescriptor{ + Name: stringOrCall(v.Name, v.Measure.Name), + Description: stringOrCall(v.Description, v.Measure.Description), + Unit: v.Measure.Unit(), + Type: aggregationToMetricDescriptorType(v), + LabelKeys: tagKeysToLabelKeys(v.TagKeys), + } + return desc, nil +} + +func stringOrCall(first string, call func() string) string { + if first != "" { + return first + } + return call() +} + +type measureType uint + +const ( + measureUnknown measureType = iota + measureInt64 + measureFloat64 +) + +func measureTypeFromMeasure(m stats.Measure) measureType { + switch m.(type) { + default: + return measureUnknown + case *stats.Float64Measure: + return measureFloat64 + case *stats.Int64Measure: + return measureInt64 + } +} + +func aggregationToMetricDescriptorType(v *view.View) metricspb.MetricDescriptor_Type { + if v == nil || v.Aggregation == nil { + return metricspb.MetricDescriptor_UNSPECIFIED + } + if v.Measure == nil { + return metricspb.MetricDescriptor_UNSPECIFIED + } + + switch v.Aggregation.Type { + case view.AggTypeCount: + // Cumulative on int64 + return metricspb.MetricDescriptor_CUMULATIVE_INT64 + + case view.AggTypeDistribution: + // Cumulative types + return metricspb.MetricDescriptor_CUMULATIVE_DISTRIBUTION + + case view.AggTypeLastValue: + // Gauge types + switch measureTypeFromMeasure(v.Measure) { + case measureFloat64: + return metricspb.MetricDescriptor_GAUGE_DOUBLE + case measureInt64: + return metricspb.MetricDescriptor_GAUGE_INT64 + } + + case view.AggTypeSum: + // Cumulative types + switch measureTypeFromMeasure(v.Measure) { + case measureFloat64: + return metricspb.MetricDescriptor_CUMULATIVE_DOUBLE + case measureInt64: + return metricspb.MetricDescriptor_CUMULATIVE_INT64 + } + } + + // For all other cases, return unspecified. + return metricspb.MetricDescriptor_UNSPECIFIED +} + +func tagKeysToLabelKeys(tagKeys []tag.Key) []*metricspb.LabelKey { + labelKeys := make([]*metricspb.LabelKey, 0, len(tagKeys)) + for _, tagKey := range tagKeys { + labelKeys = append(labelKeys, &metricspb.LabelKey{ + Key: tagKey.Name(), + }) + } + return labelKeys +} + +func viewDataToTimeseries(vd *view.Data) ([]*metricspb.TimeSeries, error) { + if vd == nil || len(vd.Rows) == 0 { + return nil, nil + } + + // Given that view.Data only contains Start, End + // the timestamps for all the row data will be the exact same + // per aggregation. However, the values will differ. + // Each row has its own tags. + startTimestamp := timeToProtoTimestamp(vd.Start) + endTimestamp := timeToProtoTimestamp(vd.End) + + mType := measureTypeFromMeasure(vd.View.Measure) + timeseries := make([]*metricspb.TimeSeries, 0, len(vd.Rows)) + // It is imperative that the ordering of "LabelValues" matches those + // of the Label keys in the metric descriptor. + for _, row := range vd.Rows { + labelValues := labelValuesFromTags(row.Tags) + point := rowToPoint(vd.View, row, endTimestamp, mType) + timeseries = append(timeseries, &metricspb.TimeSeries{ + StartTimestamp: startTimestamp, + LabelValues: labelValues, + Points: []*metricspb.Point{point}, + }) + } + + if len(timeseries) == 0 { + return nil, nil + } + + return timeseries, nil +} + +func timeToProtoTimestamp(t time.Time) *timestamp.Timestamp { + unixNano := t.UnixNano() + return ×tamp.Timestamp{ + Seconds: int64(unixNano / 1e9), + Nanos: int32(unixNano % 1e9), + } +} + +func rowToPoint(v *view.View, row *view.Row, endTimestamp *timestamp.Timestamp, mType measureType) *metricspb.Point { + pt := &metricspb.Point{ + Timestamp: endTimestamp, + } + + switch data := row.Data.(type) { + case *view.CountData: + pt.Value = &metricspb.Point_Int64Value{Int64Value: data.Value} + + case *view.DistributionData: + pt.Value = &metricspb.Point_DistributionValue{ + DistributionValue: &metricspb.DistributionValue{ + Count: data.Count, + Sum: float64(data.Count) * data.Mean, // because Mean := Sum/Count + // TODO: Add Exemplar + Buckets: bucketsToProtoBuckets(data.CountPerBucket), + BucketOptions: &metricspb.DistributionValue_BucketOptions{ + Type: &metricspb.DistributionValue_BucketOptions_Explicit_{ + Explicit: &metricspb.DistributionValue_BucketOptions_Explicit{ + Bounds: v.Aggregation.Buckets, + }, + }, + }, + SumOfSquaredDeviation: data.SumOfSquaredDev, + }} + + case *view.LastValueData: + setPointValue(pt, data.Value, mType) + + case *view.SumData: + setPointValue(pt, data.Value, mType) + } + + return pt +} + +// Not returning anything from this function because metricspb.Point.is_Value is an unexported +// interface hence we just have to set its value by pointer. +func setPointValue(pt *metricspb.Point, value float64, mType measureType) { + if mType == measureInt64 { + pt.Value = &metricspb.Point_Int64Value{Int64Value: int64(value)} + } else { + pt.Value = &metricspb.Point_DoubleValue{DoubleValue: value} + } +} + +func bucketsToProtoBuckets(countPerBucket []int64) []*metricspb.DistributionValue_Bucket { + distBuckets := make([]*metricspb.DistributionValue_Bucket, len(countPerBucket)) + for i := 0; i < len(countPerBucket); i++ { + count := countPerBucket[i] + + distBuckets[i] = &metricspb.DistributionValue_Bucket{ + Count: count, + } + } + + return distBuckets +} + +func labelValuesFromTags(tags []tag.Tag) []*metricspb.LabelValue { + if len(tags) == 0 { + return nil + } + + labelValues := make([]*metricspb.LabelValue, 0, len(tags)) + for _, tag_ := range tags { + labelValues = append(labelValues, &metricspb.LabelValue{ + Value: tag_.Value, + + // It is imperative that we set the "HasValue" attribute, + // in order to distinguish missing a label from the empty string. + // https://godoc.org/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1#LabelValue.HasValue + // + // OpenCensus-Go uses non-pointers for tags as seen by this function's arguments, + // so the best case that we can use to distinguish missing labels/tags from the + // empty string is by checking if the Tag.Key.Name() != "" to indicate that we have + // a value. + HasValue: tag_.Key.Name() != "", + }) + } + return labelValues +} diff --git a/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go b/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go new file mode 100644 index 00000000..68be4c75 --- /dev/null +++ b/vendor/contrib.go.opencensus.io/exporter/ocagent/version.go @@ -0,0 +1,17 @@ +// Copyright 2018, OpenCensus 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 ocagent + +const Version = "0.0.1" diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go index ccdb50b9..e21c526c 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/models.go @@ -18,13 +18,18 @@ package dns // Changes may cause incorrect behavior and will be lost if the code is regenerated. import ( + "context" "encoding/json" "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/to" + "github.com/Azure/go-autorest/tracing" "net/http" ) +// The package's fully qualified name. +const fqdn = "github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns" + // RecordType enumerates the values for record type. type RecordType string @@ -68,6 +73,18 @@ type ARecord struct { Ipv4Address *string `json:"ipv4Address,omitempty"` } +// AzureEntityResource the resource model definition for a Azure Resource Manager resource with an etag. +type AzureEntityResource struct { + // Etag - READ-ONLY; Resource Etag. + Etag *string `json:"etag,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + // CaaRecord a CAA record. type CaaRecord struct { // Flags - The flags for this CAA record as an integer between 0 and 255. @@ -116,6 +133,17 @@ type NsRecord struct { Nsdname *string `json:"nsdname,omitempty"` } +// ProxyResource the resource model definition for a ARM proxy resource. It will have everything other than +// required location and tags +type ProxyResource struct { + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + // PtrRecord a PTR record. type PtrRecord struct { // Ptrdname - The PTR target domain name for this PTR record. @@ -125,11 +153,11 @@ type PtrRecord struct { // RecordSet describes a DNS record set (a collection of DNS records with the same name and type). type RecordSet struct { autorest.Response `json:"-"` - // ID - The ID of the record set. + // ID - READ-ONLY; The ID of the record set. ID *string `json:"id,omitempty"` - // Name - The name of the record set. + // Name - READ-ONLY; The name of the record set. Name *string `json:"name,omitempty"` - // Type - The type of the record set. + // Type - READ-ONLY; The type of the record set. Type *string `json:"type,omitempty"` // Etag - The etag of the record set. Etag *string `json:"etag,omitempty"` @@ -140,15 +168,6 @@ type RecordSet struct { // MarshalJSON is the custom marshaler for RecordSet. func (rs RecordSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - if rs.ID != nil { - objectMap["id"] = rs.ID - } - if rs.Name != nil { - objectMap["name"] = rs.Name - } - if rs.Type != nil { - objectMap["type"] = rs.Type - } if rs.Etag != nil { objectMap["etag"] = rs.Etag } @@ -223,7 +242,7 @@ type RecordSetListResult struct { autorest.Response `json:"-"` // Value - Information about the record sets in the response. Value *[]RecordSet `json:"value,omitempty"` - // NextLink - The continuation token for the next page of results. + // NextLink - READ-ONLY; The continuation token for the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -233,14 +252,24 @@ type RecordSetListResultIterator struct { page RecordSetListResultPage } -// Next advances to the next value. If there was an error making +// NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *RecordSetListResultIterator) Next() error { +func (iter *RecordSetListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } iter.i++ if iter.i < len(iter.page.Values()) { return nil } - err := iter.page.Next() + err = iter.page.NextWithContext(ctx) if err != nil { iter.i-- return err @@ -249,6 +278,13 @@ func (iter *RecordSetListResultIterator) Next() error { return nil } +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *RecordSetListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + // NotDone returns true if the enumeration should be started or is not yet complete. func (iter RecordSetListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) @@ -268,6 +304,11 @@ func (iter RecordSetListResultIterator) Value() RecordSet { return iter.page.Values()[iter.i] } +// Creates a new instance of the RecordSetListResultIterator type. +func NewRecordSetListResultIterator(page RecordSetListResultPage) RecordSetListResultIterator { + return RecordSetListResultIterator{page: page} +} + // IsEmpty returns true if the ListResult contains no values. func (rslr RecordSetListResult) IsEmpty() bool { return rslr.Value == nil || len(*rslr.Value) == 0 @@ -275,11 +316,11 @@ func (rslr RecordSetListResult) IsEmpty() bool { // recordSetListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (rslr RecordSetListResult) recordSetListResultPreparer() (*http.Request, error) { +func (rslr RecordSetListResult) recordSetListResultPreparer(ctx context.Context) (*http.Request, error) { if rslr.NextLink == nil || len(to.String(rslr.NextLink)) < 1 { return nil, nil } - return autorest.Prepare(&http.Request{}, + return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), autorest.WithBaseURL(to.String(rslr.NextLink))) @@ -287,14 +328,24 @@ func (rslr RecordSetListResult) recordSetListResultPreparer() (*http.Request, er // RecordSetListResultPage contains a page of RecordSet values. type RecordSetListResultPage struct { - fn func(RecordSetListResult) (RecordSetListResult, error) + fn func(context.Context, RecordSetListResult) (RecordSetListResult, error) rslr RecordSetListResult } -// Next advances to the next page of values. If there was an error making +// NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *RecordSetListResultPage) Next() error { - next, err := page.fn(page.rslr) +func (page *RecordSetListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.rslr) if err != nil { return err } @@ -302,6 +353,13 @@ func (page *RecordSetListResultPage) Next() error { return nil } +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *RecordSetListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + // NotDone returns true if the page enumeration should be started or is not yet complete. func (page RecordSetListResultPage) NotDone() bool { return !page.rslr.IsEmpty() @@ -320,13 +378,18 @@ func (page RecordSetListResultPage) Values() []RecordSet { return *page.rslr.Value } +// Creates a new instance of the RecordSetListResultPage type. +func NewRecordSetListResultPage(getNextPage func(context.Context, RecordSetListResult) (RecordSetListResult, error)) RecordSetListResultPage { + return RecordSetListResultPage{fn: getNextPage} +} + // RecordSetProperties represents the properties of the records in the record set. type RecordSetProperties struct { // Metadata - The metadata attached to the record set. Metadata map[string]*string `json:"metadata"` // TTL - The TTL (time-to-live) of the records in the record set. TTL *int64 `json:"TTL,omitempty"` - // Fqdn - Fully qualified domain name of the record set. + // Fqdn - READ-ONLY; Fully qualified domain name of the record set. Fqdn *string `json:"fqdn,omitempty"` // ARecords - The list of A records in the record set. ARecords *[]ARecord `json:"ARecords,omitempty"` @@ -359,9 +422,6 @@ func (rsp RecordSetProperties) MarshalJSON() ([]byte, error) { if rsp.TTL != nil { objectMap["TTL"] = rsp.TTL } - if rsp.Fqdn != nil { - objectMap["fqdn"] = rsp.Fqdn - } if rsp.ARecords != nil { objectMap["ARecords"] = rsp.ARecords } @@ -401,39 +461,14 @@ type RecordSetUpdateParameters struct { RecordSet *RecordSet `json:"RecordSet,omitempty"` } -// Resource common properties of an Azure Resource Manager resource +// Resource ... type Resource struct { - // ID - Resource ID. + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty"` - // Name - Resource name. + // Name - READ-ONLY; The name of the resource Name *string `json:"name,omitempty"` - // Type - Resource type. + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` - // Tags - Resource tags. - Tags map[string]*string `json:"tags"` -} - -// MarshalJSON is the custom marshaler for Resource. -func (r Resource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - if r.ID != nil { - objectMap["id"] = r.ID - } - if r.Name != nil { - objectMap["name"] = r.Name - } - if r.Type != nil { - objectMap["type"] = r.Type - } - if r.Location != nil { - objectMap["location"] = r.Location - } - if r.Tags != nil { - objectMap["tags"] = r.Tags - } - return json.Marshal(objectMap) } // SoaRecord an SOA record. @@ -472,6 +507,32 @@ type SubResource struct { ID *string `json:"id,omitempty"` } +// TrackedResource the resource model definition for a ARM tracked top level resource +type TrackedResource struct { + // Tags - Resource tags. + Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` +} + +// MarshalJSON is the custom marshaler for TrackedResource. +func (tr TrackedResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + if tr.Tags != nil { + objectMap["tags"] = tr.Tags + } + if tr.Location != nil { + objectMap["location"] = tr.Location + } + return json.Marshal(objectMap) +} + // TxtRecord a TXT record. type TxtRecord struct { // Value - The text value of this TXT record. @@ -485,16 +546,16 @@ type Zone struct { Etag *string `json:"etag,omitempty"` // ZoneProperties - The properties of the zone. *ZoneProperties `json:"properties,omitempty"` - // ID - Resource ID. - ID *string `json:"id,omitempty"` - // Name - Resource name. - Name *string `json:"name,omitempty"` - // Type - Resource type. - Type *string `json:"type,omitempty"` - // Location - Resource location. - Location *string `json:"location,omitempty"` // Tags - Resource tags. Tags map[string]*string `json:"tags"` + // Location - The geo-location where the resource lives + Location *string `json:"location,omitempty"` + // ID - READ-ONLY; Fully qualified resource Id for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty"` + // Name - READ-ONLY; The name of the resource + Name *string `json:"name,omitempty"` + // Type - READ-ONLY; The type of the resource. Ex- Microsoft.Compute/virtualMachines or Microsoft.Storage/storageAccounts. + Type *string `json:"type,omitempty"` } // MarshalJSON is the custom marshaler for Zone. @@ -506,21 +567,12 @@ func (z Zone) MarshalJSON() ([]byte, error) { if z.ZoneProperties != nil { objectMap["properties"] = z.ZoneProperties } - if z.ID != nil { - objectMap["id"] = z.ID - } - if z.Name != nil { - objectMap["name"] = z.Name - } - if z.Type != nil { - objectMap["type"] = z.Type + if z.Tags != nil { + objectMap["tags"] = z.Tags } if z.Location != nil { objectMap["location"] = z.Location } - if z.Tags != nil { - objectMap["tags"] = z.Tags - } return json.Marshal(objectMap) } @@ -551,6 +603,24 @@ func (z *Zone) UnmarshalJSON(body []byte) error { } z.ZoneProperties = &zoneProperties } + case "tags": + if v != nil { + var tags map[string]*string + err = json.Unmarshal(*v, &tags) + if err != nil { + return err + } + z.Tags = tags + } + case "location": + if v != nil { + var location string + err = json.Unmarshal(*v, &location) + if err != nil { + return err + } + z.Location = &location + } case "id": if v != nil { var ID string @@ -578,24 +648,6 @@ func (z *Zone) UnmarshalJSON(body []byte) error { } z.Type = &typeVar } - case "location": - if v != nil { - var location string - err = json.Unmarshal(*v, &location) - if err != nil { - return err - } - z.Location = &location - } - case "tags": - if v != nil { - var tags map[string]*string - err = json.Unmarshal(*v, &tags) - if err != nil { - return err - } - z.Tags = tags - } } } @@ -607,7 +659,7 @@ type ZoneListResult struct { autorest.Response `json:"-"` // Value - Information about the DNS zones. Value *[]Zone `json:"value,omitempty"` - // NextLink - The continuation token for the next page of results. + // NextLink - READ-ONLY; The continuation token for the next page of results. NextLink *string `json:"nextLink,omitempty"` } @@ -617,14 +669,24 @@ type ZoneListResultIterator struct { page ZoneListResultPage } -// Next advances to the next value. If there was an error making +// NextWithContext advances to the next value. If there was an error making // the request the iterator does not advance and the error is returned. -func (iter *ZoneListResultIterator) Next() error { +func (iter *ZoneListResultIterator) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZoneListResultIterator.NextWithContext") + defer func() { + sc := -1 + if iter.Response().Response.Response != nil { + sc = iter.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } iter.i++ if iter.i < len(iter.page.Values()) { return nil } - err := iter.page.Next() + err = iter.page.NextWithContext(ctx) if err != nil { iter.i-- return err @@ -633,6 +695,13 @@ func (iter *ZoneListResultIterator) Next() error { return nil } +// Next advances to the next value. If there was an error making +// the request the iterator does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (iter *ZoneListResultIterator) Next() error { + return iter.NextWithContext(context.Background()) +} + // NotDone returns true if the enumeration should be started or is not yet complete. func (iter ZoneListResultIterator) NotDone() bool { return iter.page.NotDone() && iter.i < len(iter.page.Values()) @@ -652,6 +721,11 @@ func (iter ZoneListResultIterator) Value() Zone { return iter.page.Values()[iter.i] } +// Creates a new instance of the ZoneListResultIterator type. +func NewZoneListResultIterator(page ZoneListResultPage) ZoneListResultIterator { + return ZoneListResultIterator{page: page} +} + // IsEmpty returns true if the ListResult contains no values. func (zlr ZoneListResult) IsEmpty() bool { return zlr.Value == nil || len(*zlr.Value) == 0 @@ -659,11 +733,11 @@ func (zlr ZoneListResult) IsEmpty() bool { // zoneListResultPreparer prepares a request to retrieve the next set of results. // It returns nil if no more results exist. -func (zlr ZoneListResult) zoneListResultPreparer() (*http.Request, error) { +func (zlr ZoneListResult) zoneListResultPreparer(ctx context.Context) (*http.Request, error) { if zlr.NextLink == nil || len(to.String(zlr.NextLink)) < 1 { return nil, nil } - return autorest.Prepare(&http.Request{}, + return autorest.Prepare((&http.Request{}).WithContext(ctx), autorest.AsJSON(), autorest.AsGet(), autorest.WithBaseURL(to.String(zlr.NextLink))) @@ -671,14 +745,24 @@ func (zlr ZoneListResult) zoneListResultPreparer() (*http.Request, error) { // ZoneListResultPage contains a page of Zone values. type ZoneListResultPage struct { - fn func(ZoneListResult) (ZoneListResult, error) + fn func(context.Context, ZoneListResult) (ZoneListResult, error) zlr ZoneListResult } -// Next advances to the next page of values. If there was an error making +// NextWithContext advances to the next page of values. If there was an error making // the request the page does not advance and the error is returned. -func (page *ZoneListResultPage) Next() error { - next, err := page.fn(page.zlr) +func (page *ZoneListResultPage) NextWithContext(ctx context.Context) (err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZoneListResultPage.NextWithContext") + defer func() { + sc := -1 + if page.Response().Response.Response != nil { + sc = page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + next, err := page.fn(ctx, page.zlr) if err != nil { return err } @@ -686,6 +770,13 @@ func (page *ZoneListResultPage) Next() error { return nil } +// Next advances to the next page of values. If there was an error making +// the request the page does not advance and the error is returned. +// Deprecated: Use NextWithContext() instead. +func (page *ZoneListResultPage) Next() error { + return page.NextWithContext(context.Background()) +} + // NotDone returns true if the page enumeration should be started or is not yet complete. func (page ZoneListResultPage) NotDone() bool { return !page.zlr.IsEmpty() @@ -704,13 +795,18 @@ func (page ZoneListResultPage) Values() []Zone { return *page.zlr.Value } +// Creates a new instance of the ZoneListResultPage type. +func NewZoneListResultPage(getNextPage func(context.Context, ZoneListResult) (ZoneListResult, error)) ZoneListResultPage { + return ZoneListResultPage{fn: getNextPage} +} + // ZoneProperties represents the properties of the zone. type ZoneProperties struct { - // MaxNumberOfRecordSets - The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + // MaxNumberOfRecordSets - READ-ONLY; The maximum number of record sets that can be created in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. MaxNumberOfRecordSets *int64 `json:"maxNumberOfRecordSets,omitempty"` - // NumberOfRecordSets - The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + // NumberOfRecordSets - READ-ONLY; The current number of record sets in this DNS zone. This is a read-only property and any attempt to set this value will be ignored. NumberOfRecordSets *int64 `json:"numberOfRecordSets,omitempty"` - // NameServers - The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. + // NameServers - READ-ONLY; The name servers for this DNS zone. This is a read-only property and any attempt to set this value will be ignored. NameServers *[]string `json:"nameServers,omitempty"` } @@ -723,7 +819,7 @@ type ZonesDeleteFuture struct { // If the operation has not completed it will return an error. func (future *ZonesDeleteFuture) Result(client ZonesClient) (ar autorest.Response, err error) { var done bool - done, err = future.Done(client) + done, err = future.DoneWithContext(context.Background(), client) if err != nil { err = autorest.NewErrorWithError(err, "dns.ZonesDeleteFuture", "Result", future.Response(), "Polling failure") return diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go index 1bd1875d..d26c5e40 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/recordsets.go @@ -22,6 +22,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -49,15 +50,27 @@ func NewRecordSetsClientWithBaseURI(baseURI string, subscriptionID string) Recor // created (they are created when the DNS zone is created). // parameters - parameters supplied to the CreateOrUpdate operation. // ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify -// the last-seen etag value to prevent accidentally overwritting any concurrent changes. +// the last-seen etag value to prevent accidentally overwriting any concurrent changes. // ifNoneMatch - set to '*' to allow a new record set to be created, but to prevent updating an existing record // set. Other values will be ignored. func (client RecordSetsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string, ifNoneMatch string) (result RecordSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "CreateOrUpdate", err.Error()) } @@ -97,6 +110,9 @@ func (client RecordSetsClient) CreateOrUpdatePreparer(ctx context.Context, resou "api-version": APIVersion, } + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPut(), @@ -145,11 +161,23 @@ func (client RecordSetsClient) CreateOrUpdateResponder(resp *http.Response) (res // ifMatch - the etag of the record set. Omit this value to always delete the current record set. Specify the // last-seen etag value to prevent accidentally deleting any concurrent changes. func (client RecordSetsClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, ifMatch string) (result autorest.Response, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Delete") + defer func() { + sc := -1 + if result.Response != nil { + sc = result.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "Delete", err.Error()) } @@ -227,11 +255,23 @@ func (client RecordSetsClient) DeleteResponder(resp *http.Response) (result auto // relativeRecordSetName - the name of the record set, relative to the name of the zone. // recordType - the type of DNS record in this record set. func (client RecordSetsClient) Get(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType) (result RecordSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "Get", err.Error()) } @@ -308,11 +348,23 @@ func (client RecordSetsClient) GetResponder(resp *http.Response) (result RecordS // enumerations. If this parameter is specified, Enumeration will return only records that end with // . func (client RecordSetsClient) ListByDNSZone(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByDNSZone") + defer func() { + sc := -1 + if result.rslr.Response.Response != nil { + sc = result.rslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "ListByDNSZone", err.Error()) } @@ -386,8 +438,8 @@ func (client RecordSetsClient) ListByDNSZoneResponder(resp *http.Response) (resu } // listByDNSZoneNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) listByDNSZoneNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.recordSetListResultPreparer() +func (client RecordSetsClient) listByDNSZoneNextResults(ctx context.Context, lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByDNSZoneNextResults", nil, "Failure preparing next results request") } @@ -408,6 +460,16 @@ func (client RecordSetsClient) listByDNSZoneNextResults(lastResults RecordSetLis // ListByDNSZoneComplete enumerates all values, automatically crossing page boundaries as required. func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resourceGroupName string, zoneName string, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByDNSZone") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } result.page, err = client.ListByDNSZone(ctx, resourceGroupName, zoneName, top, recordsetnamesuffix) return } @@ -422,11 +484,23 @@ func (client RecordSetsClient) ListByDNSZoneComplete(ctx context.Context, resour // enumerations. If this parameter is specified, Enumeration will return only records that end with // . func (client RecordSetsClient) ListByType(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByType") + defer func() { + sc := -1 + if result.rslr.Response.Response != nil { + sc = result.rslr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "ListByType", err.Error()) } @@ -501,8 +575,8 @@ func (client RecordSetsClient) ListByTypeResponder(resp *http.Response) (result } // listByTypeNextResults retrieves the next set of results, if any. -func (client RecordSetsClient) listByTypeNextResults(lastResults RecordSetListResult) (result RecordSetListResult, err error) { - req, err := lastResults.recordSetListResultPreparer() +func (client RecordSetsClient) listByTypeNextResults(ctx context.Context, lastResults RecordSetListResult) (result RecordSetListResult, err error) { + req, err := lastResults.recordSetListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "dns.RecordSetsClient", "listByTypeNextResults", nil, "Failure preparing next results request") } @@ -523,6 +597,16 @@ func (client RecordSetsClient) listByTypeNextResults(lastResults RecordSetListRe // ListByTypeComplete enumerates all values, automatically crossing page boundaries as required. func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceGroupName string, zoneName string, recordType RecordType, top *int32, recordsetnamesuffix string) (result RecordSetListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.ListByType") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } result.page, err = client.ListByType(ctx, resourceGroupName, zoneName, recordType, top, recordsetnamesuffix) return } @@ -535,13 +619,25 @@ func (client RecordSetsClient) ListByTypeComplete(ctx context.Context, resourceG // recordType - the type of DNS record in this record set. // parameters - parameters supplied to the Update operation. // ifMatch - the etag of the record set. Omit this value to always overwrite the current record set. Specify -// the last-seen etag value to prevent accidentally overwritting concurrent changes. +// the last-seen etag value to prevent accidentally overwriting concurrent changes. func (client RecordSetsClient) Update(ctx context.Context, resourceGroupName string, zoneName string, relativeRecordSetName string, recordType RecordType, parameters RecordSet, ifMatch string) (result RecordSet, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/RecordSetsClient.Update") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.RecordSetsClient", "Update", err.Error()) } @@ -581,6 +677,9 @@ func (client RecordSetsClient) UpdatePreparer(ctx context.Context, resourceGroup "api-version": APIVersion, } + parameters.ID = nil + parameters.Name = nil + parameters.Type = nil preparer := autorest.CreatePreparer( autorest.AsContentType("application/json; charset=utf-8"), autorest.AsPatch(), diff --git a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go index 4a0be76e..588d478e 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/services/dns/mgmt/2017-09-01/dns/zones.go @@ -22,6 +22,7 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/azure" "github.com/Azure/go-autorest/autorest/validation" + "github.com/Azure/go-autorest/tracing" "net/http" ) @@ -46,15 +47,27 @@ func NewZonesClientWithBaseURI(baseURI string, subscriptionID string) ZonesClien // zoneName - the name of the DNS zone (without a terminating dot). // parameters - parameters supplied to the CreateOrUpdate operation. // ifMatch - the etag of the DNS zone. Omit this value to always overwrite the current zone. Specify the -// last-seen etag value to prevent accidentally overwritting any concurrent changes. +// last-seen etag value to prevent accidentally overwriting any concurrent changes. // ifNoneMatch - set to '*' to allow a new DNS zone to be created, but to prevent updating an existing zone. // Other values will be ignored. func (client ZonesClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, zoneName string, parameters Zone, ifMatch string, ifNoneMatch string) (result Zone, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.CreateOrUpdate") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.ZonesClient", "CreateOrUpdate", err.Error()) } @@ -138,11 +151,23 @@ func (client ZonesClient) CreateOrUpdateResponder(resp *http.Response) (result Z // ifMatch - the etag of the DNS zone. Omit this value to always delete the current zone. Specify the last-seen // etag value to prevent accidentally deleting any concurrent changes. func (client ZonesClient) Delete(ctx context.Context, resourceGroupName string, zoneName string, ifMatch string) (result ZonesDeleteFuture, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.Delete") + defer func() { + sc := -1 + if result.Response() != nil { + sc = result.Response().StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.ZonesClient", "Delete", err.Error()) } @@ -195,10 +220,6 @@ func (client ZonesClient) DeleteSender(req *http.Request) (future ZonesDeleteFut if err != nil { return } - err = autorest.Respond(resp, azure.WithErrorUnlessStatusCode(http.StatusOK, http.StatusAccepted, http.StatusNoContent)) - if err != nil { - return - } future.Future, err = azure.NewFutureFromResponse(resp) return } @@ -220,11 +241,23 @@ func (client ZonesClient) DeleteResponder(resp *http.Response) (result autorest. // resourceGroupName - the name of the resource group. The name is case insensitive. // zoneName - the name of the DNS zone (without a terminating dot). func (client ZonesClient) Get(ctx context.Context, resourceGroupName string, zoneName string) (result Zone, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.Get") + defer func() { + sc := -1 + if result.Response.Response != nil { + sc = result.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.ZonesClient", "Get", err.Error()) } @@ -294,6 +327,22 @@ func (client ZonesClient) GetResponder(resp *http.Response) (result Zone, err er // Parameters: // top - the maximum number of DNS zones to return. If not specified, returns up to 100 zones. func (client ZonesClient) List(ctx context.Context, top *int32) (result ZoneListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.List") + defer func() { + sc := -1 + if result.zlr.Response.Response != nil { + sc = result.zlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } + if err := validation.Validate([]validation.Validation{ + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { + return result, validation.NewError("dns.ZonesClient", "List", err.Error()) + } + result.fn = client.listNextResults req, err := client.ListPreparer(ctx, top) if err != nil { @@ -359,8 +408,8 @@ func (client ZonesClient) ListResponder(resp *http.Response) (result ZoneListRes } // listNextResults retrieves the next set of results, if any. -func (client ZonesClient) listNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.zoneListResultPreparer() +func (client ZonesClient) listNextResults(ctx context.Context, lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listNextResults", nil, "Failure preparing next results request") } @@ -381,6 +430,16 @@ func (client ZonesClient) listNextResults(lastResults ZoneListResult) (result Zo // ListComplete enumerates all values, automatically crossing page boundaries as required. func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result ZoneListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.List") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } result.page, err = client.List(ctx, top) return } @@ -390,11 +449,23 @@ func (client ZonesClient) ListComplete(ctx context.Context, top *int32) (result // resourceGroupName - the name of the resource group. The name is case insensitive. // top - the maximum number of record sets to return. If not specified, returns up to 100 record sets. func (client ZonesClient) ListByResourceGroup(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultPage, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.zlr.Response.Response != nil { + sc = result.zlr.Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } if err := validation.Validate([]validation.Validation{ {TargetValue: resourceGroupName, Constraints: []validation.Constraint{{Target: "resourceGroupName", Name: validation.MaxLength, Rule: 90, Chain: nil}, {Target: "resourceGroupName", Name: validation.MinLength, Rule: 1, Chain: nil}, - {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}}); err != nil { + {Target: "resourceGroupName", Name: validation.Pattern, Rule: `^[-\w\._\(\)]+$`, Chain: nil}}}, + {TargetValue: client.SubscriptionID, + Constraints: []validation.Constraint{{Target: "client.SubscriptionID", Name: validation.MinLength, Rule: 1, Chain: nil}}}}); err != nil { return result, validation.NewError("dns.ZonesClient", "ListByResourceGroup", err.Error()) } @@ -464,8 +535,8 @@ func (client ZonesClient) ListByResourceGroupResponder(resp *http.Response) (res } // listByResourceGroupNextResults retrieves the next set of results, if any. -func (client ZonesClient) listByResourceGroupNextResults(lastResults ZoneListResult) (result ZoneListResult, err error) { - req, err := lastResults.zoneListResultPreparer() +func (client ZonesClient) listByResourceGroupNextResults(ctx context.Context, lastResults ZoneListResult) (result ZoneListResult, err error) { + req, err := lastResults.zoneListResultPreparer(ctx) if err != nil { return result, autorest.NewErrorWithError(err, "dns.ZonesClient", "listByResourceGroupNextResults", nil, "Failure preparing next results request") } @@ -486,6 +557,16 @@ func (client ZonesClient) listByResourceGroupNextResults(lastResults ZoneListRes // ListByResourceGroupComplete enumerates all values, automatically crossing page boundaries as required. func (client ZonesClient) ListByResourceGroupComplete(ctx context.Context, resourceGroupName string, top *int32) (result ZoneListResultIterator, err error) { + if tracing.IsEnabled() { + ctx = tracing.StartSpan(ctx, fqdn+"/ZonesClient.ListByResourceGroup") + defer func() { + sc := -1 + if result.Response().Response.Response != nil { + sc = result.page.Response().Response.Response.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + } result.page, err = client.ListByResourceGroup(ctx, resourceGroupName, top) return } diff --git a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go index 31530438..760244ab 100644 --- a/vendor/github.com/Azure/azure-sdk-for-go/version/version.go +++ b/vendor/github.com/Azure/azure-sdk-for-go/version/version.go @@ -18,4 +18,4 @@ package version // Changes may cause incorrect behavior and will be lost if the code is regenerated. // Number contains the semantic version of this SDK. -const Number = "v19.1.0" +const Number = "v31.0.0" diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go index bee5e61d..8c83a917 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/config.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/config.go @@ -19,10 +19,6 @@ import ( "net/url" ) -const ( - activeDirectoryAPIVersion = "1.0" -) - // OAuthConfig represents the endpoints needed // in OAuth operations type OAuthConfig struct { @@ -46,11 +42,25 @@ func validateStringParam(param, name string) error { // NewOAuthConfig returns an OAuthConfig with tenant specific urls func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, error) { + apiVer := "1.0" + return NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID, &apiVer) +} + +// NewOAuthConfigWithAPIVersion returns an OAuthConfig with tenant specific urls. +// If apiVersion is not nil the "api-version" query parameter will be appended to the endpoint URLs with the specified value. +func NewOAuthConfigWithAPIVersion(activeDirectoryEndpoint, tenantID string, apiVersion *string) (*OAuthConfig, error) { if err := validateStringParam(activeDirectoryEndpoint, "activeDirectoryEndpoint"); err != nil { return nil, err } + api := "" // it's legal for tenantID to be empty so don't validate it - const activeDirectoryEndpointTemplate = "%s/oauth2/%s?api-version=%s" + if apiVersion != nil { + if err := validateStringParam(*apiVersion, "apiVersion"); err != nil { + return nil, err + } + api = fmt.Sprintf("?api-version=%s", *apiVersion) + } + const activeDirectoryEndpointTemplate = "%s/oauth2/%s%s" u, err := url.Parse(activeDirectoryEndpoint) if err != nil { return nil, err @@ -59,15 +69,15 @@ func NewOAuthConfig(activeDirectoryEndpoint, tenantID string) (*OAuthConfig, err if err != nil { return nil, err } - authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", activeDirectoryAPIVersion)) + authorizeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "authorize", api)) if err != nil { return nil, err } - tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", activeDirectoryAPIVersion)) + tokenURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "token", api)) if err != nil { return nil, err } - deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", activeDirectoryAPIVersion)) + deviceCodeURL, err := u.Parse(fmt.Sprintf(activeDirectoryEndpointTemplate, tenantID, "devicecode", api)) if err != nil { return nil, err } diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go index 0e5ad14d..834401e0 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/sender.go @@ -38,7 +38,7 @@ func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { return sf(r) } -// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the +// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the // http.Request and pass it along or, first, pass the http.Request along then react to the // http.Response result. type SendDecorator func(Sender) Sender diff --git a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go index 32aea838..effa87ab 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/adal/token.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/token.go @@ -29,13 +29,12 @@ import ( "net" "net/http" "net/url" - "strconv" "strings" "sync" "time" "github.com/Azure/go-autorest/autorest/date" - "github.com/Azure/go-autorest/version" + "github.com/Azure/go-autorest/tracing" "github.com/dgrijalva/jwt-go" ) @@ -97,18 +96,27 @@ type RefresherWithContext interface { type TokenRefreshCallback func(Token) error // Token encapsulates the access token used to authorize Azure requests. +// https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-oauth2-client-creds-grant-flow#service-to-service-access-token-response type Token struct { AccessToken string `json:"access_token"` RefreshToken string `json:"refresh_token"` - ExpiresIn string `json:"expires_in"` - ExpiresOn string `json:"expires_on"` - NotBefore string `json:"not_before"` + ExpiresIn json.Number `json:"expires_in"` + ExpiresOn json.Number `json:"expires_on"` + NotBefore json.Number `json:"not_before"` Resource string `json:"resource"` Type string `json:"token_type"` } +func newToken() Token { + return Token{ + ExpiresIn: "0", + ExpiresOn: "0", + NotBefore: "0", + } +} + // IsZero returns true if the token object is zero-initialized. func (t Token) IsZero() bool { return t == Token{} @@ -116,12 +124,12 @@ func (t Token) IsZero() bool { // Expires returns the time.Time when the Token expires. func (t Token) Expires() time.Time { - s, err := strconv.Atoi(t.ExpiresOn) + s, err := t.ExpiresOn.Float64() if err != nil { s = -3600 } - expiration := date.NewUnixTimeFromSeconds(float64(s)) + expiration := date.NewUnixTimeFromSeconds(s) return time.Time(expiration).UTC() } @@ -218,6 +226,8 @@ func (secret *ServicePrincipalCertificateSecret) SignJwt(spt *ServicePrincipalTo token := jwt.New(jwt.SigningMethodRS256) token.Header["x5t"] = thumbprint + x5c := []string{base64.StdEncoding.EncodeToString(secret.Certificate.Raw)} + token.Header["x5c"] = x5c token.Claims = jwt.MapClaims{ "aud": spt.inner.OauthConfig.TokenEndpoint.String(), "iss": spt.inner.ClientID, @@ -375,8 +385,13 @@ func (spt *ServicePrincipalToken) UnmarshalJSON(data []byte) error { if err != nil { return err } - spt.refreshLock = &sync.RWMutex{} - spt.sender = &http.Client{} + // Don't override the refreshLock or the sender if those have been already set. + if spt.refreshLock == nil { + spt.refreshLock = &sync.RWMutex{} + } + if spt.sender == nil { + spt.sender = &http.Client{Transport: tracing.Transport} + } return nil } @@ -414,6 +429,7 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso } spt := &ServicePrincipalToken{ inner: servicePrincipalToken{ + Token: newToken(), OauthConfig: oauthConfig, Secret: secret, ClientID: id, @@ -422,7 +438,7 @@ func NewServicePrincipalTokenWithSecret(oauthConfig OAuthConfig, id string, reso RefreshWithin: defaultRefresh, }, refreshLock: &sync.RWMutex{}, - sender: &http.Client{}, + sender: &http.Client{Transport: tracing.Transport}, refreshCallbacks: callbacks, } return spt, nil @@ -653,6 +669,7 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI spt := &ServicePrincipalToken{ inner: servicePrincipalToken{ + Token: newToken(), OauthConfig: OAuthConfig{ TokenEndpoint: *msiEndpointURL, }, @@ -662,7 +679,7 @@ func newServicePrincipalTokenFromMSI(msiEndpoint, resource string, userAssignedI RefreshWithin: defaultRefresh, }, refreshLock: &sync.RWMutex{}, - sender: &http.Client{}, + sender: &http.Client{Transport: tracing.Transport}, refreshCallbacks: callbacks, MaxMSIRefreshAttempts: defaultMaxMSIRefreshAttempts, } @@ -779,7 +796,7 @@ func (spt *ServicePrincipalToken) refreshInternal(ctx context.Context, resource if err != nil { return fmt.Errorf("adal: Failed to build the refresh request. Error = '%v'", err) } - req.Header.Add("User-Agent", version.UserAgent()) + req.Header.Add("User-Agent", UserAgent()) req = req.WithContext(ctx) if !isIMDS(spt.inner.OauthConfig.TokenEndpoint) { v := url.Values{} diff --git a/vendor/github.com/Azure/go-autorest/version/version.go b/vendor/github.com/Azure/go-autorest/autorest/adal/version.go similarity index 65% rename from vendor/github.com/Azure/go-autorest/version/version.go rename to vendor/github.com/Azure/go-autorest/autorest/adal/version.go index 8e1e7e1e..c867b348 100644 --- a/vendor/github.com/Azure/go-autorest/version/version.go +++ b/vendor/github.com/Azure/go-autorest/autorest/adal/version.go @@ -1,4 +1,9 @@ -package version +package adal + +import ( + "fmt" + "runtime" +) // Copyright 2017 Microsoft Corporation // @@ -14,24 +19,27 @@ package version // See the License for the specific language governing permissions and // limitations under the License. -import ( - "fmt" - "runtime" -) - -// Number contains the semantic version of this SDK. -const Number = "v10.15.2" +const number = "v1.0.0" var ( - userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s", + ua = fmt.Sprintf("Go/%s (%s-%s) go-autorest/adal/%s", runtime.Version(), runtime.GOARCH, runtime.GOOS, - Number, + number, ) ) -// UserAgent returns a string containing the Go version, system archityecture and OS, and the go-autorest version. +// UserAgent returns a string containing the Go version, system architecture and OS, and the adal version. func UserAgent() string { - return userAgent + return ua +} + +// AddToUserAgent adds an extension to the current user agent +func AddToUserAgent(extension string) error { + if extension != "" { + ua = fmt.Sprintf("%s %s", ua, extension) + return nil + } + return fmt.Errorf("Extension was empty, User Agent remained as '%s'", ua) } diff --git a/vendor/github.com/Azure/go-autorest/autorest/authorization.go b/vendor/github.com/Azure/go-autorest/autorest/authorization.go index 77eff45b..2e24b4b3 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/authorization.go +++ b/vendor/github.com/Azure/go-autorest/autorest/authorization.go @@ -15,12 +15,14 @@ package autorest // limitations under the License. import ( + "encoding/base64" "fmt" "net/http" "net/url" "strings" "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/tracing" ) const ( @@ -30,6 +32,8 @@ const ( apiKeyAuthorizerHeader = "Ocp-Apim-Subscription-Key" bingAPISdkHeader = "X-BingApis-SDK-Client" golangBingAPISdkHeaderValue = "Go-SDK" + authorization = "Authorization" + basic = "Basic" ) // Authorizer is the interface that provides a PrepareDecorator used to supply request @@ -68,7 +72,7 @@ func NewAPIKeyAuthorizer(headers map[string]interface{}, queryParameters map[str return &APIKeyAuthorizer{headers: headers, queryParameters: queryParameters} } -// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Paramaters +// WithAuthorization returns a PrepareDecorator that adds an HTTP headers and Query Parameters. func (aka *APIKeyAuthorizer) WithAuthorization() PrepareDecorator { return func(p Preparer) Preparer { return DecoratePreparer(p, WithHeaders(aka.headers), WithQueryParameters(aka.queryParameters)) @@ -147,7 +151,7 @@ type BearerAuthorizerCallback struct { // is invoked when the HTTP request is submitted. func NewBearerAuthorizerCallback(sender Sender, callback BearerAuthorizerCallbackFunc) *BearerAuthorizerCallback { if sender == nil { - sender = &http.Client{} + sender = &http.Client{Transport: tracing.Transport} } return &BearerAuthorizerCallback{sender: sender, callback: callback} } @@ -257,3 +261,27 @@ func (egta EventGridKeyAuthorizer) WithAuthorization() PrepareDecorator { } return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() } + +// BasicAuthorizer implements basic HTTP authorization by adding the Authorization HTTP header +// with the value "Basic " where is a base64-encoded username:password tuple. +type BasicAuthorizer struct { + userName string + password string +} + +// NewBasicAuthorizer creates a new BasicAuthorizer with the specified username and password. +func NewBasicAuthorizer(userName, password string) *BasicAuthorizer { + return &BasicAuthorizer{ + userName: userName, + password: password, + } +} + +// WithAuthorization returns a PrepareDecorator that adds an HTTP Authorization header whose +// value is "Basic " followed by the base64-encoded username:password tuple. +func (ba *BasicAuthorizer) WithAuthorization() PrepareDecorator { + headers := make(map[string]interface{}) + headers[authorization] = basic + " " + base64.StdEncoding.EncodeToString([]byte(fmt.Sprintf("%s:%s", ba.userName, ba.password))) + + return NewAPIKeyAuthorizerWithHeaders(headers).WithAuthorization() +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go index cfd981a3..02d01196 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/async.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/async.go @@ -26,6 +26,7 @@ import ( "time" "github.com/Azure/go-autorest/autorest" + "github.com/Azure/go-autorest/tracing" ) const ( @@ -44,24 +45,14 @@ var pollingCodes = [...]int{http.StatusNoContent, http.StatusAccepted, http.Stat // Future provides a mechanism to access the status and results of an asynchronous request. // Since futures are stateful they should be passed by value to avoid race conditions. type Future struct { - req *http.Request // legacy - pt pollingTracker -} - -// NewFuture returns a new Future object initialized with the specified request. -// Deprecated: Please use NewFutureFromResponse instead. -func NewFuture(req *http.Request) Future { - return Future{req: req} + pt pollingTracker } // NewFutureFromResponse returns a new Future object initialized // with the initial response from an asynchronous operation. func NewFutureFromResponse(resp *http.Response) (Future, error) { pt, err := createPollingTracker(resp) - if err != nil { - return Future{}, err - } - return Future{pt: pt}, nil + return Future{pt: pt}, err } // Response returns the last HTTP response. @@ -88,29 +79,25 @@ func (f Future) PollingMethod() PollingMethodType { return f.pt.pollingMethod() } -// Done queries the service to see if the operation has completed. -func (f *Future) Done(sender autorest.Sender) (bool, error) { - // support for legacy Future implementation - if f.req != nil { - resp, err := sender.Do(f.req) - if err != nil { - return false, err +// DoneWithContext queries the service to see if the operation has completed. +func (f *Future) DoneWithContext(ctx context.Context, sender autorest.Sender) (done bool, err error) { + ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.DoneWithContext") + defer func() { + sc := -1 + resp := f.Response() + if resp != nil { + sc = resp.StatusCode } - pt, err := createPollingTracker(resp) - if err != nil { - return false, err - } - f.pt = pt - f.req = nil - } - // end legacy + tracing.EndSpan(ctx, sc, err) + }() + if f.pt == nil { return false, autorest.NewError("Future", "Done", "future is not initialized") } if f.pt.hasTerminated() { return true, f.pt.pollingError() } - if err := f.pt.pollForStatus(sender); err != nil { + if err := f.pt.pollForStatus(ctx, sender); err != nil { return false, err } if err := f.pt.checkForErrors(); err != nil { @@ -119,7 +106,10 @@ func (f *Future) Done(sender autorest.Sender) (bool, error) { if err := f.pt.updatePollingState(f.pt.provisioningStateApplicable()); err != nil { return false, err } - if err := f.pt.updateHeaders(); err != nil { + if err := f.pt.initPollingMethod(); err != nil { + return false, err + } + if err := f.pt.updatePollingMethod(); err != nil { return false, err } return f.pt.hasTerminated(), f.pt.pollingError() @@ -151,24 +141,35 @@ func (f Future) GetPollingDelay() (time.Duration, bool) { return d, true } -// WaitForCompletion will return when one of the following conditions is met: the long -// running operation has completed, the provided context is cancelled, or the client's -// polling duration has been exceeded. It will retry failed polling attempts based on -// the retry value defined in the client up to the maximum retry attempts. -// Deprecated: Please use WaitForCompletionRef() instead. -func (f Future) WaitForCompletion(ctx context.Context, client autorest.Client) error { - return f.WaitForCompletionRef(ctx, client) -} - // WaitForCompletionRef will return when one of the following conditions is met: the long // running operation has completed, the provided context is cancelled, or the client's // polling duration has been exceeded. It will retry failed polling attempts based on // the retry value defined in the client up to the maximum retry attempts. -func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) error { - ctx, cancel := context.WithTimeout(ctx, client.PollingDuration) - defer cancel() - done, err := f.Done(client) - for attempts := 0; !done; done, err = f.Done(client) { +// If no deadline is specified in the context then the client.PollingDuration will be +// used to determine if a default deadline should be used. +// If PollingDuration is greater than zero the value will be used as the context's timeout. +// If PollingDuration is zero then no default deadline will be used. +func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Client) (err error) { + ctx = tracing.StartSpan(ctx, "github.com/Azure/go-autorest/autorest/azure/async.WaitForCompletionRef") + defer func() { + sc := -1 + resp := f.Response() + if resp != nil { + sc = resp.StatusCode + } + tracing.EndSpan(ctx, sc, err) + }() + cancelCtx := ctx + // if the provided context already has a deadline don't override it + _, hasDeadline := ctx.Deadline() + if d := client.PollingDuration; !hasDeadline && d != 0 { + var cancel context.CancelFunc + cancelCtx, cancel = context.WithTimeout(ctx, d) + defer cancel() + } + + done, err := f.DoneWithContext(ctx, client) + for attempts := 0; !done; done, err = f.DoneWithContext(ctx, client) { if attempts >= client.RetryAttempts { return autorest.NewErrorWithError(err, "Future", "WaitForCompletion", f.pt.latestResponse(), "the number of retries has been exceeded") } @@ -192,12 +193,12 @@ func (f *Future) WaitForCompletionRef(ctx context.Context, client autorest.Clien attempts++ } // wait until the delay elapses or the context is cancelled - delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, ctx.Done()) + delayElapsed := autorest.DelayForBackoff(delay, delayAttempt, cancelCtx.Done()) if !delayElapsed { - return autorest.NewErrorWithError(ctx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled") + return autorest.NewErrorWithError(cancelCtx.Err(), "Future", "WaitForCompletion", f.pt.latestResponse(), "context has been cancelled") } } - return err + return } // MarshalJSON implements the json.Marshaler interface. @@ -264,7 +265,7 @@ type pollingTracker interface { // these methods can differ per tracker // checks the response headers and status code to determine the polling mechanism - updateHeaders() error + updatePollingMethod() error // checks the response for tracker-specific error conditions checkForErrors() error @@ -274,11 +275,15 @@ type pollingTracker interface { // methods common to all trackers + // initializes a tracker's polling URL and method, called for each iteration. + // these values can be overridden by each polling tracker as required. + initPollingMethod() error + // initializes the tracker's internal state, call this when the tracker is created initializeState() error // makes an HTTP request to check the status of the LRO - pollForStatus(sender autorest.Sender) error + pollForStatus(ctx context.Context, sender autorest.Sender) error // updates internal tracker state, call this after each call to pollForStatus updatePollingState(provStateApl bool) error @@ -370,7 +375,7 @@ func (pt *pollingTrackerBase) initializeState() error { pt.updateErrorFromResponse() return pt.pollingError() } - return nil + return pt.initPollingMethod() } func (pt pollingTrackerBase) getProvisioningState() *string { @@ -392,6 +397,10 @@ func (pt *pollingTrackerBase) updateRawBody() error { if err != nil { return autorest.NewErrorWithError(err, "pollingTrackerBase", "updateRawBody", nil, "failed to read response body") } + // observed in 204 responses over HTTP/2.0; the content length is -1 but body is empty + if len(b) == 0 { + return nil + } // put the body back so it's available to other callers pt.resp.Body = ioutil.NopCloser(bytes.NewReader(b)) if err = json.Unmarshal(b, &pt.rawBody); err != nil { @@ -401,15 +410,13 @@ func (pt *pollingTrackerBase) updateRawBody() error { return nil } -func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error { +func (pt *pollingTrackerBase) pollForStatus(ctx context.Context, sender autorest.Sender) error { req, err := http.NewRequest(http.MethodGet, pt.URI, nil) if err != nil { return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to create HTTP request") } - // attach the context from the original request if available (it will be absent for deserialized futures) - if pt.resp != nil { - req = req.WithContext(pt.resp.Request.Context()) - } + + req = req.WithContext(ctx) pt.resp, err = sender.Do(req) if err != nil { return autorest.NewErrorWithError(err, "pollingTrackerBase", "pollForStatus", nil, "failed to send HTTP request") @@ -421,6 +428,7 @@ func (pt *pollingTrackerBase) pollForStatus(sender autorest.Sender) error { } else { // check response body for error content pt.updateErrorFromResponse() + err = pt.pollingError() } return err } @@ -437,7 +445,7 @@ func (pt *pollingTrackerBase) updateErrorFromResponse() { re := respErr{} defer pt.resp.Body.Close() var b []byte - if b, err = ioutil.ReadAll(pt.resp.Body); err != nil { + if b, err = ioutil.ReadAll(pt.resp.Body); err != nil || len(b) == 0 { goto Default } if err = json.Unmarshal(b, &re); err != nil { @@ -552,13 +560,33 @@ func (pt pollingTrackerBase) baseCheckForErrors() error { return nil } +// default initialization of polling URL/method. each verb tracker will update this as required. +func (pt *pollingTrackerBase) initPollingMethod() error { + if ao, err := getURLFromAsyncOpHeader(pt.resp); err != nil { + return err + } else if ao != "" { + pt.URI = ao + pt.Pm = PollingAsyncOperation + return nil + } + if lh, err := getURLFromLocationHeader(pt.resp); err != nil { + return err + } else if lh != "" { + pt.URI = lh + pt.Pm = PollingLocation + return nil + } + // it's ok if we didn't find a polling header, this will be handled elsewhere + return nil +} + // DELETE type pollingTrackerDelete struct { pollingTrackerBase } -func (pt *pollingTrackerDelete) updateHeaders() error { +func (pt *pollingTrackerDelete) updatePollingMethod() error { // for 201 the Location header is required if pt.resp.StatusCode == http.StatusCreated { if lh, err := getURLFromLocationHeader(pt.resp); err != nil { @@ -614,7 +642,7 @@ type pollingTrackerPatch struct { pollingTrackerBase } -func (pt *pollingTrackerPatch) updateHeaders() error { +func (pt *pollingTrackerPatch) updatePollingMethod() error { // by default we can use the original URL for polling and final GET if pt.URI == "" { pt.URI = pt.resp.Request.URL.String() @@ -635,7 +663,7 @@ func (pt *pollingTrackerPatch) updateHeaders() error { } } // for 202 prefer the Azure-AsyncOperation header but fall back to Location if necessary - // note the absense of the "final GET" mechanism for PATCH + // note the absence of the "final GET" mechanism for PATCH if pt.resp.StatusCode == http.StatusAccepted { ao, err := getURLFromAsyncOpHeader(pt.resp) if err != nil { @@ -672,7 +700,7 @@ type pollingTrackerPost struct { pollingTrackerBase } -func (pt *pollingTrackerPost) updateHeaders() error { +func (pt *pollingTrackerPost) updatePollingMethod() error { // 201 requires Location header if pt.resp.StatusCode == http.StatusCreated { if lh, err := getURLFromLocationHeader(pt.resp); err != nil { @@ -728,7 +756,7 @@ type pollingTrackerPut struct { pollingTrackerBase } -func (pt *pollingTrackerPut) updateHeaders() error { +func (pt *pollingTrackerPut) updatePollingMethod() error { // by default we can use the original URL for polling and final GET if pt.URI == "" { pt.URI = pt.resp.Request.URL.String() @@ -766,8 +794,6 @@ func (pt *pollingTrackerPut) updateHeaders() error { pt.URI = lh pt.Pm = PollingLocation } - // when both headers are returned we use the value in the Location header for the final GET - pt.FinalGetURI = lh } // make sure a polling URL was found if pt.URI == "" { @@ -822,7 +848,7 @@ func createPollingTracker(resp *http.Response) (pollingTracker, error) { // this initializes the polling header values, we do this during creation in case the // initial response send us invalid values; this way the API call will return a non-nil // error (not doing this means the error shows up in Future.Done) - return pt, pt.updateHeaders() + return pt, pt.updatePollingMethod() } // gets the polling URL from the Azure-AsyncOperation header. @@ -857,43 +883,6 @@ func isValidURL(s string) bool { return err == nil && u.IsAbs() } -// DoPollForAsynchronous returns a SendDecorator that polls if the http.Response is for an Azure -// long-running operation. It will delay between requests for the duration specified in the -// RetryAfter header or, if the header is absent, the passed delay. Polling may be canceled via -// the context associated with the http.Request. -// Deprecated: Prefer using Futures to allow for non-blocking async operations. -func DoPollForAsynchronous(delay time.Duration) autorest.SendDecorator { - return func(s autorest.Sender) autorest.Sender { - return autorest.SenderFunc(func(r *http.Request) (*http.Response, error) { - resp, err := s.Do(r) - if err != nil { - return resp, err - } - if !autorest.ResponseHasStatusCode(resp, pollingCodes[:]...) { - return resp, nil - } - future, err := NewFutureFromResponse(resp) - if err != nil { - return resp, err - } - // retry until either the LRO completes or we receive an error - var done bool - for done, err = future.Done(s); !done && err == nil; done, err = future.Done(s) { - // check for Retry-After delay, if not present use the specified polling delay - if pd, ok := future.GetPollingDelay(); ok { - delay = pd - } - // wait until the delay elapses or the context is cancelled - if delayElapsed := autorest.DelayForBackoff(delay, 0, r.Context().Done()); !delayElapsed { - return future.Response(), - autorest.NewErrorWithError(r.Context().Err(), "azure", "DoPollForAsynchronous", future.Response(), "context has been cancelled") - } - } - return future.Response(), err - }) - } -} - // PollingMethodType defines a type used for enumerating polling mechanisms. type PollingMethodType string diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go index a14b8790..20855d4a 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/auth/auth.go @@ -31,26 +31,42 @@ import ( "github.com/Azure/go-autorest/autorest" "github.com/Azure/go-autorest/autorest/adal" "github.com/Azure/go-autorest/autorest/azure" + "github.com/Azure/go-autorest/autorest/azure/cli" "github.com/dimchansky/utfbom" "golang.org/x/crypto/pkcs12" ) +// The possible keys in the Values map. +const ( + SubscriptionID = "AZURE_SUBSCRIPTION_ID" + TenantID = "AZURE_TENANT_ID" + ClientID = "AZURE_CLIENT_ID" + ClientSecret = "AZURE_CLIENT_SECRET" + CertificatePath = "AZURE_CERTIFICATE_PATH" + CertificatePassword = "AZURE_CERTIFICATE_PASSWORD" + Username = "AZURE_USERNAME" + Password = "AZURE_PASSWORD" + EnvironmentName = "AZURE_ENVIRONMENT" + Resource = "AZURE_AD_RESOURCE" + ActiveDirectoryEndpoint = "ActiveDirectoryEndpoint" + ResourceManagerEndpoint = "ResourceManagerEndpoint" + GraphResourceID = "GraphResourceID" + SQLManagementEndpoint = "SQLManagementEndpoint" + GalleryEndpoint = "GalleryEndpoint" + ManagementEndpoint = "ManagementEndpoint" +) + // NewAuthorizerFromEnvironment creates an Authorizer configured from environment variables in the order: // 1. Client credentials // 2. Client certificate // 3. Username password // 4. MSI func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) { - settings, err := getAuthenticationSettings() + settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err } - - if settings.resource == "" { - settings.resource = settings.environment.ResourceManagerEndpoint - } - - return settings.getAuthorizer() + return settings.GetAuthorizer() } // NewAuthorizerFromEnvironmentWithResource creates an Authorizer configured from environment variables in the order: @@ -59,134 +75,364 @@ func NewAuthorizerFromEnvironment() (autorest.Authorizer, error) { // 3. Username password // 4. MSI func NewAuthorizerFromEnvironmentWithResource(resource string) (autorest.Authorizer, error) { - settings, err := getAuthenticationSettings() + settings, err := GetSettingsFromEnvironment() if err != nil { return nil, err } - settings.resource = resource - return settings.getAuthorizer() + settings.Values[Resource] = resource + return settings.GetAuthorizer() } -type settings struct { - tenantID string - clientID string - clientSecret string - certificatePath string - certificatePassword string - username string - password string - envName string - resource string - environment azure.Environment +// EnvironmentSettings contains the available authentication settings. +type EnvironmentSettings struct { + Values map[string]string + Environment azure.Environment } -func getAuthenticationSettings() (s settings, err error) { - s = settings{ - tenantID: os.Getenv("AZURE_TENANT_ID"), - clientID: os.Getenv("AZURE_CLIENT_ID"), - clientSecret: os.Getenv("AZURE_CLIENT_SECRET"), - certificatePath: os.Getenv("AZURE_CERTIFICATE_PATH"), - certificatePassword: os.Getenv("AZURE_CERTIFICATE_PASSWORD"), - username: os.Getenv("AZURE_USERNAME"), - password: os.Getenv("AZURE_PASSWORD"), - envName: os.Getenv("AZURE_ENVIRONMENT"), - resource: os.Getenv("AZURE_AD_RESOURCE"), +// GetSettingsFromEnvironment returns the available authentication settings from the environment. +func GetSettingsFromEnvironment() (s EnvironmentSettings, err error) { + s = EnvironmentSettings{ + Values: map[string]string{}, } - - if s.envName == "" { - s.environment = azure.PublicCloud + s.setValue(SubscriptionID) + s.setValue(TenantID) + s.setValue(ClientID) + s.setValue(ClientSecret) + s.setValue(CertificatePath) + s.setValue(CertificatePassword) + s.setValue(Username) + s.setValue(Password) + s.setValue(EnvironmentName) + s.setValue(Resource) + if v := s.Values[EnvironmentName]; v == "" { + s.Environment = azure.PublicCloud } else { - s.environment, err = azure.EnvironmentFromName(s.envName) + s.Environment, err = azure.EnvironmentFromName(v) + } + if s.Values[Resource] == "" { + s.Values[Resource] = s.Environment.ResourceManagerEndpoint } return } -func (settings settings) getAuthorizer() (autorest.Authorizer, error) { +// GetSubscriptionID returns the available subscription ID or an empty string. +func (settings EnvironmentSettings) GetSubscriptionID() string { + return settings.Values[SubscriptionID] +} + +// adds the specified environment variable value to the Values map if it exists +func (settings EnvironmentSettings) setValue(key string) { + if v := os.Getenv(key); v != "" { + settings.Values[key] = v + } +} + +// helper to return client and tenant IDs +func (settings EnvironmentSettings) getClientAndTenant() (string, string) { + clientID := settings.Values[ClientID] + tenantID := settings.Values[TenantID] + return clientID, tenantID +} + +// GetClientCredentials creates a config object from the available client credentials. +// An error is returned if no client credentials are available. +func (settings EnvironmentSettings) GetClientCredentials() (ClientCredentialsConfig, error) { + secret := settings.Values[ClientSecret] + if secret == "" { + return ClientCredentialsConfig{}, errors.New("missing client secret") + } + clientID, tenantID := settings.getClientAndTenant() + config := NewClientCredentialsConfig(clientID, secret, tenantID) + config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint + config.Resource = settings.Values[Resource] + return config, nil +} + +// GetClientCertificate creates a config object from the available certificate credentials. +// An error is returned if no certificate credentials are available. +func (settings EnvironmentSettings) GetClientCertificate() (ClientCertificateConfig, error) { + certPath := settings.Values[CertificatePath] + if certPath == "" { + return ClientCertificateConfig{}, errors.New("missing certificate path") + } + certPwd := settings.Values[CertificatePassword] + clientID, tenantID := settings.getClientAndTenant() + config := NewClientCertificateConfig(certPath, certPwd, clientID, tenantID) + config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint + config.Resource = settings.Values[Resource] + return config, nil +} + +// GetUsernamePassword creates a config object from the available username/password credentials. +// An error is returned if no username/password credentials are available. +func (settings EnvironmentSettings) GetUsernamePassword() (UsernamePasswordConfig, error) { + username := settings.Values[Username] + password := settings.Values[Password] + if username == "" || password == "" { + return UsernamePasswordConfig{}, errors.New("missing username/password") + } + clientID, tenantID := settings.getClientAndTenant() + config := NewUsernamePasswordConfig(username, password, clientID, tenantID) + config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint + config.Resource = settings.Values[Resource] + return config, nil +} + +// GetMSI creates a MSI config object from the available client ID. +func (settings EnvironmentSettings) GetMSI() MSIConfig { + config := NewMSIConfig() + config.Resource = settings.Values[Resource] + config.ClientID = settings.Values[ClientID] + return config +} + +// GetDeviceFlow creates a device-flow config object from the available client and tenant IDs. +func (settings EnvironmentSettings) GetDeviceFlow() DeviceFlowConfig { + clientID, tenantID := settings.getClientAndTenant() + config := NewDeviceFlowConfig(clientID, tenantID) + config.AADEndpoint = settings.Environment.ActiveDirectoryEndpoint + config.Resource = settings.Values[Resource] + return config +} + +// GetAuthorizer creates an Authorizer configured from environment variables in the order: +// 1. Client credentials +// 2. Client certificate +// 3. Username password +// 4. MSI +func (settings EnvironmentSettings) GetAuthorizer() (autorest.Authorizer, error) { //1.Client Credentials - if settings.clientSecret != "" { - config := NewClientCredentialsConfig(settings.clientID, settings.clientSecret, settings.tenantID) - config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint - config.Resource = settings.resource - return config.Authorizer() + if c, e := settings.GetClientCredentials(); e == nil { + return c.Authorizer() } //2. Client Certificate - if settings.certificatePath != "" { - config := NewClientCertificateConfig(settings.certificatePath, settings.certificatePassword, settings.clientID, settings.tenantID) - config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint - config.Resource = settings.resource - return config.Authorizer() + if c, e := settings.GetClientCertificate(); e == nil { + return c.Authorizer() } //3. Username Password - if settings.username != "" && settings.password != "" { - config := NewUsernamePasswordConfig(settings.username, settings.password, settings.clientID, settings.tenantID) - config.AADEndpoint = settings.environment.ActiveDirectoryEndpoint - config.Resource = settings.resource - return config.Authorizer() + if c, e := settings.GetUsernamePassword(); e == nil { + return c.Authorizer() } // 4. MSI - config := NewMSIConfig() - config.Resource = settings.resource - config.ClientID = settings.clientID - return config.Authorizer() + return settings.GetMSI().Authorizer() } -// NewAuthorizerFromFile creates an Authorizer configured from a configuration file. +// NewAuthorizerFromFile creates an Authorizer configured from a configuration file in the following order. +// 1. Client credentials +// 2. Client certificate func NewAuthorizerFromFile(baseURI string) (autorest.Authorizer, error) { + settings, err := GetSettingsFromFile() + if err != nil { + return nil, err + } + if a, err := settings.ClientCredentialsAuthorizer(baseURI); err == nil { + return a, err + } + if a, err := settings.ClientCertificateAuthorizer(baseURI); err == nil { + return a, err + } + return nil, errors.New("auth file missing client and certificate credentials") +} + +// NewAuthorizerFromFileWithResource creates an Authorizer configured from a configuration file in the following order. +// 1. Client credentials +// 2. Client certificate +func NewAuthorizerFromFileWithResource(resource string) (autorest.Authorizer, error) { + s, err := GetSettingsFromFile() + if err != nil { + return nil, err + } + if a, err := s.ClientCredentialsAuthorizerWithResource(resource); err == nil { + return a, err + } + if a, err := s.ClientCertificateAuthorizerWithResource(resource); err == nil { + return a, err + } + return nil, errors.New("auth file missing client and certificate credentials") +} + +// NewAuthorizerFromCLI creates an Authorizer configured from Azure CLI 2.0 for local development scenarios. +func NewAuthorizerFromCLI() (autorest.Authorizer, error) { + settings, err := GetSettingsFromEnvironment() + if err != nil { + return nil, err + } + + if settings.Values[Resource] == "" { + settings.Values[Resource] = settings.Environment.ResourceManagerEndpoint + } + + return NewAuthorizerFromCLIWithResource(settings.Values[Resource]) +} + +// NewAuthorizerFromCLIWithResource creates an Authorizer configured from Azure CLI 2.0 for local development scenarios. +func NewAuthorizerFromCLIWithResource(resource string) (autorest.Authorizer, error) { + token, err := cli.GetTokenFromCLI(resource) + if err != nil { + return nil, err + } + + adalToken, err := token.ToADALToken() + if err != nil { + return nil, err + } + + return autorest.NewBearerAuthorizer(&adalToken), nil +} + +// GetSettingsFromFile returns the available authentication settings from an Azure CLI authentication file. +func GetSettingsFromFile() (FileSettings, error) { + s := FileSettings{} fileLocation := os.Getenv("AZURE_AUTH_LOCATION") if fileLocation == "" { - return nil, errors.New("auth file not found. Environment variable AZURE_AUTH_LOCATION is not set") + return s, errors.New("environment variable AZURE_AUTH_LOCATION is not set") } contents, err := ioutil.ReadFile(fileLocation) if err != nil { - return nil, err + return s, err } // Auth file might be encoded decoded, err := decode(contents) if err != nil { - return nil, err + return s, err } - file := file{} - err = json.Unmarshal(decoded, &file) + authFile := map[string]interface{}{} + err = json.Unmarshal(decoded, &authFile) + if err != nil { + return s, err + } + + s.Values = map[string]string{} + s.setKeyValue(ClientID, authFile["clientId"]) + s.setKeyValue(ClientSecret, authFile["clientSecret"]) + s.setKeyValue(CertificatePath, authFile["clientCertificate"]) + s.setKeyValue(CertificatePassword, authFile["clientCertificatePassword"]) + s.setKeyValue(SubscriptionID, authFile["subscriptionId"]) + s.setKeyValue(TenantID, authFile["tenantId"]) + s.setKeyValue(ActiveDirectoryEndpoint, authFile["activeDirectoryEndpointUrl"]) + s.setKeyValue(ResourceManagerEndpoint, authFile["resourceManagerEndpointUrl"]) + s.setKeyValue(GraphResourceID, authFile["activeDirectoryGraphResourceId"]) + s.setKeyValue(SQLManagementEndpoint, authFile["sqlManagementEndpointUrl"]) + s.setKeyValue(GalleryEndpoint, authFile["galleryEndpointUrl"]) + s.setKeyValue(ManagementEndpoint, authFile["managementEndpointUrl"]) + return s, nil +} + +// FileSettings contains the available authentication settings. +type FileSettings struct { + Values map[string]string +} + +// GetSubscriptionID returns the available subscription ID or an empty string. +func (settings FileSettings) GetSubscriptionID() string { + return settings.Values[SubscriptionID] +} + +// adds the specified value to the Values map if it isn't nil +func (settings FileSettings) setKeyValue(key string, val interface{}) { + if val != nil { + settings.Values[key] = val.(string) + } +} + +// returns the specified AAD endpoint or the public cloud endpoint if unspecified +func (settings FileSettings) getAADEndpoint() string { + if v, ok := settings.Values[ActiveDirectoryEndpoint]; ok { + return v + } + return azure.PublicCloud.ActiveDirectoryEndpoint +} + +// ServicePrincipalTokenFromClientCredentials creates a ServicePrincipalToken from the available client credentials. +func (settings FileSettings) ServicePrincipalTokenFromClientCredentials(baseURI string) (*adal.ServicePrincipalToken, error) { + resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } + return settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) +} - resource, err := getResourceForToken(file, baseURI) +// ClientCredentialsAuthorizer creates an authorizer from the available client credentials. +func (settings FileSettings) ClientCredentialsAuthorizer(baseURI string) (autorest.Authorizer, error) { + resource, err := settings.getResourceForToken(baseURI) if err != nil { return nil, err } + return settings.ClientCredentialsAuthorizerWithResource(resource) +} - config, err := adal.NewOAuthConfig(file.ActiveDirectoryEndpoint, file.TenantID) +// ServicePrincipalTokenFromClientCredentialsWithResource creates a ServicePrincipalToken +// from the available client credentials and the specified resource. +func (settings FileSettings) ServicePrincipalTokenFromClientCredentialsWithResource(resource string) (*adal.ServicePrincipalToken, error) { + if _, ok := settings.Values[ClientSecret]; !ok { + return nil, errors.New("missing client secret") + } + config, err := adal.NewOAuthConfig(settings.getAADEndpoint(), settings.Values[TenantID]) if err != nil { return nil, err } + return adal.NewServicePrincipalToken(*config, settings.Values[ClientID], settings.Values[ClientSecret], resource) +} - spToken, err := adal.NewServicePrincipalToken(*config, file.ClientID, file.ClientSecret, resource) +func (settings FileSettings) clientCertificateConfigWithResource(resource string) (ClientCertificateConfig, error) { + if _, ok := settings.Values[CertificatePath]; !ok { + return ClientCertificateConfig{}, errors.New("missing certificate path") + } + cfg := NewClientCertificateConfig(settings.Values[CertificatePath], settings.Values[CertificatePassword], settings.Values[ClientID], settings.Values[TenantID]) + cfg.AADEndpoint = settings.getAADEndpoint() + cfg.Resource = resource + return cfg, nil +} + +// ClientCredentialsAuthorizerWithResource creates an authorizer from the available client credentials and the specified resource. +func (settings FileSettings) ClientCredentialsAuthorizerWithResource(resource string) (autorest.Authorizer, error) { + spToken, err := settings.ServicePrincipalTokenFromClientCredentialsWithResource(resource) if err != nil { return nil, err } - return autorest.NewBearerAuthorizer(spToken), nil } -// File represents the authentication file -type file struct { - ClientID string `json:"clientId,omitempty"` - ClientSecret string `json:"clientSecret,omitempty"` - SubscriptionID string `json:"subscriptionId,omitempty"` - TenantID string `json:"tenantId,omitempty"` - ActiveDirectoryEndpoint string `json:"activeDirectoryEndpointUrl,omitempty"` - ResourceManagerEndpoint string `json:"resourceManagerEndpointUrl,omitempty"` - GraphResourceID string `json:"activeDirectoryGraphResourceId,omitempty"` - SQLManagementEndpoint string `json:"sqlManagementEndpointUrl,omitempty"` - GalleryEndpoint string `json:"galleryEndpointUrl,omitempty"` - ManagementEndpoint string `json:"managementEndpointUrl,omitempty"` +// ServicePrincipalTokenFromClientCertificate creates a ServicePrincipalToken from the available certificate credentials. +func (settings FileSettings) ServicePrincipalTokenFromClientCertificate(baseURI string) (*adal.ServicePrincipalToken, error) { + resource, err := settings.getResourceForToken(baseURI) + if err != nil { + return nil, err + } + return settings.ServicePrincipalTokenFromClientCertificateWithResource(resource) +} + +// ClientCertificateAuthorizer creates an authorizer from the available certificate credentials. +func (settings FileSettings) ClientCertificateAuthorizer(baseURI string) (autorest.Authorizer, error) { + resource, err := settings.getResourceForToken(baseURI) + if err != nil { + return nil, err + } + return settings.ClientCertificateAuthorizerWithResource(resource) +} + +// ServicePrincipalTokenFromClientCertificateWithResource creates a ServicePrincipalToken from the available certificate credentials. +func (settings FileSettings) ServicePrincipalTokenFromClientCertificateWithResource(resource string) (*adal.ServicePrincipalToken, error) { + cfg, err := settings.clientCertificateConfigWithResource(resource) + if err != nil { + return nil, err + } + return cfg.ServicePrincipalToken() +} + +// ClientCertificateAuthorizerWithResource creates an authorizer from the available certificate credentials and the specified resource. +func (settings FileSettings) ClientCertificateAuthorizerWithResource(resource string) (autorest.Authorizer, error) { + cfg, err := settings.clientCertificateConfigWithResource(resource) + if err != nil { + return nil, err + } + return cfg.Authorizer() } func decode(b []byte) ([]byte, error) { @@ -211,7 +457,7 @@ func decode(b []byte) ([]byte, error) { return ioutil.ReadAll(reader) } -func getResourceForToken(f file, baseURI string) (string, error) { +func (settings FileSettings) getResourceForToken(baseURI string) (string, error) { // Compare dafault base URI from the SDK to the endpoints from the public cloud // Base URI and token resource are the same string. This func finds the authentication // file field that matches the SDK base URI. The SDK defines the public cloud @@ -221,15 +467,15 @@ func getResourceForToken(f file, baseURI string) (string, error) { } switch baseURI { case azure.PublicCloud.ServiceManagementEndpoint: - return f.ManagementEndpoint, nil + return settings.Values[ManagementEndpoint], nil case azure.PublicCloud.ResourceManagerEndpoint: - return f.ResourceManagerEndpoint, nil + return settings.Values[ResourceManagerEndpoint], nil case azure.PublicCloud.ActiveDirectoryEndpoint: - return f.ActiveDirectoryEndpoint, nil + return settings.Values[ActiveDirectoryEndpoint], nil case azure.PublicCloud.GalleryEndpoint: - return f.GalleryEndpoint, nil + return settings.Values[GalleryEndpoint], nil case azure.PublicCloud.GraphEndpoint: - return f.GraphResourceID, nil + return settings.Values[GraphResourceID], nil } return "", fmt.Errorf("auth: base URI not found in endpoints") } @@ -304,18 +550,21 @@ type ClientCredentialsConfig struct { Resource string } -// Authorizer gets the authorizer from client credentials. -func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) { +// ServicePrincipalToken creates a ServicePrincipalToken from client credentials. +func (ccc ClientCredentialsConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) if err != nil { return nil, err } + return adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) +} - spToken, err := adal.NewServicePrincipalToken(*oauthConfig, ccc.ClientID, ccc.ClientSecret, ccc.Resource) +// Authorizer gets the authorizer from client credentials. +func (ccc ClientCredentialsConfig) Authorizer() (autorest.Authorizer, error) { + spToken, err := ccc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from client credentials: %v", err) } - return autorest.NewBearerAuthorizer(spToken), nil } @@ -329,26 +578,29 @@ type ClientCertificateConfig struct { Resource string } -// Authorizer gets an authorizer object from client certificate. -func (ccc ClientCertificateConfig) Authorizer() (autorest.Authorizer, error) { +// ServicePrincipalToken creates a ServicePrincipalToken from client certificate. +func (ccc ClientCertificateConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(ccc.AADEndpoint, ccc.TenantID) - + if err != nil { + return nil, err + } certData, err := ioutil.ReadFile(ccc.CertificatePath) if err != nil { return nil, fmt.Errorf("failed to read the certificate file (%s): %v", ccc.CertificatePath, err) } - certificate, rsaPrivateKey, err := decodePkcs12(certData, ccc.CertificatePassword) if err != nil { return nil, fmt.Errorf("failed to decode pkcs12 certificate while creating spt: %v", err) } + return adal.NewServicePrincipalTokenFromCertificate(*oauthConfig, ccc.ClientID, certificate, rsaPrivateKey, ccc.Resource) +} - spToken, err := adal.NewServicePrincipalTokenFromCertificate(*oauthConfig, ccc.ClientID, certificate, rsaPrivateKey, ccc.Resource) - +// Authorizer gets an authorizer object from client certificate. +func (ccc ClientCertificateConfig) Authorizer() (autorest.Authorizer, error) { + spToken, err := ccc.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from certificate auth: %v", err) } - return autorest.NewBearerAuthorizer(spToken), nil } @@ -362,26 +614,30 @@ type DeviceFlowConfig struct { // Authorizer gets the authorizer from device flow. func (dfc DeviceFlowConfig) Authorizer() (autorest.Authorizer, error) { - oauthClient := &autorest.Client{} + spToken, err := dfc.ServicePrincipalToken() + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) + } + return autorest.NewBearerAuthorizer(spToken), nil +} + +// ServicePrincipalToken gets the service principal token from device flow. +func (dfc DeviceFlowConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { oauthConfig, err := adal.NewOAuthConfig(dfc.AADEndpoint, dfc.TenantID) + if err != nil { + return nil, err + } + oauthClient := &autorest.Client{} deviceCode, err := adal.InitiateDeviceAuth(oauthClient, *oauthConfig, dfc.ClientID, dfc.Resource) if err != nil { return nil, fmt.Errorf("failed to start device auth flow: %s", err) } - log.Println(*deviceCode.Message) - token, err := adal.WaitForUserCompletion(oauthClient, deviceCode) if err != nil { return nil, fmt.Errorf("failed to finish device auth flow: %s", err) } - - spToken, err := adal.NewServicePrincipalTokenFromManualToken(*oauthConfig, dfc.ClientID, dfc.Resource, *token) - if err != nil { - return nil, fmt.Errorf("failed to get oauth token from device flow: %v", err) - } - - return autorest.NewBearerAuthorizer(spToken), nil + return adal.NewServicePrincipalTokenFromManualToken(*oauthConfig, dfc.ClientID, dfc.Resource, *token) } func decodePkcs12(pkcs []byte, password string) (*x509.Certificate, *rsa.PrivateKey, error) { @@ -408,17 +664,21 @@ type UsernamePasswordConfig struct { Resource string } +// ServicePrincipalToken creates a ServicePrincipalToken from username and password. +func (ups UsernamePasswordConfig) ServicePrincipalToken() (*adal.ServicePrincipalToken, error) { + oauthConfig, err := adal.NewOAuthConfig(ups.AADEndpoint, ups.TenantID) + if err != nil { + return nil, err + } + return adal.NewServicePrincipalTokenFromUsernamePassword(*oauthConfig, ups.ClientID, ups.Username, ups.Password, ups.Resource) +} + // Authorizer gets the authorizer from a username and a password. func (ups UsernamePasswordConfig) Authorizer() (autorest.Authorizer, error) { - - oauthConfig, err := adal.NewOAuthConfig(ups.AADEndpoint, ups.TenantID) - - spToken, err := adal.NewServicePrincipalTokenFromUsernamePassword(*oauthConfig, ups.ClientID, ups.Username, ups.Password, ups.Resource) - + spToken, err := ups.ServicePrincipalToken() if err != nil { return nil, fmt.Errorf("failed to get oauth token from username and password auth: %v", err) } - return autorest.NewBearerAuthorizer(spToken), nil } @@ -435,9 +695,17 @@ func (mc MSIConfig) Authorizer() (autorest.Authorizer, error) { return nil, err } - spToken, err := adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource) - if err != nil { - return nil, fmt.Errorf("failed to get oauth token from MSI: %v", err) + var spToken *adal.ServicePrincipalToken + if mc.ClientID == "" { + spToken, err = adal.NewServicePrincipalTokenFromMSI(msiEndpoint, mc.Resource) + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from MSI: %v", err) + } + } else { + spToken, err = adal.NewServicePrincipalTokenFromMSIWithUserAssignedID(msiEndpoint, mc.Resource, mc.ClientID) + if err != nil { + return nil, fmt.Errorf("failed to get oauth token from MSI for user assigned identity: %v", err) + } } return autorest.NewBearerAuthorizer(spToken), nil diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go new file mode 100644 index 00000000..a336b958 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/profile.go @@ -0,0 +1,79 @@ +package cli + +// Copyright 2017 Microsoft Corporation +// +// 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. + +import ( + "bytes" + "encoding/json" + "fmt" + "io/ioutil" + "os" + "path/filepath" + + "github.com/dimchansky/utfbom" + "github.com/mitchellh/go-homedir" +) + +// Profile represents a Profile from the Azure CLI +type Profile struct { + InstallationID string `json:"installationId"` + Subscriptions []Subscription `json:"subscriptions"` +} + +// Subscription represents a Subscription from the Azure CLI +type Subscription struct { + EnvironmentName string `json:"environmentName"` + ID string `json:"id"` + IsDefault bool `json:"isDefault"` + Name string `json:"name"` + State string `json:"state"` + TenantID string `json:"tenantId"` + User *User `json:"user"` +} + +// User represents a User from the Azure CLI +type User struct { + Name string `json:"name"` + Type string `json:"type"` +} + +const azureProfileJSON = "azureProfile.json" + +// ProfilePath returns the path where the Azure Profile is stored from the Azure CLI +func ProfilePath() (string, error) { + if cfgDir := os.Getenv("AZURE_CONFIG_DIR"); cfgDir != "" { + return filepath.Join(cfgDir, azureProfileJSON), nil + } + return homedir.Expand("~/.azure/" + azureProfileJSON) +} + +// LoadProfile restores a Profile object from a file located at 'path'. +func LoadProfile(path string) (result Profile, err error) { + var contents []byte + contents, err = ioutil.ReadFile(path) + if err != nil { + err = fmt.Errorf("failed to open file (%s) while loading token: %v", path, err) + return + } + reader := utfbom.SkipOnly(bytes.NewReader(contents)) + + dec := json.NewDecoder(reader) + if err = dec.Decode(&result); err != nil { + err = fmt.Errorf("failed to decode contents of file (%s) into a Profile representation: %v", path, err) + return + } + + return +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go new file mode 100644 index 00000000..810075ba --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/cli/token.go @@ -0,0 +1,170 @@ +package cli + +// Copyright 2017 Microsoft Corporation +// +// 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. + +import ( + "bytes" + "encoding/json" + "fmt" + "os" + "os/exec" + "regexp" + "runtime" + "strconv" + "time" + + "github.com/Azure/go-autorest/autorest/adal" + "github.com/Azure/go-autorest/autorest/date" + "github.com/mitchellh/go-homedir" +) + +// Token represents an AccessToken from the Azure CLI +type Token struct { + AccessToken string `json:"accessToken"` + Authority string `json:"_authority"` + ClientID string `json:"_clientId"` + ExpiresOn string `json:"expiresOn"` + IdentityProvider string `json:"identityProvider"` + IsMRRT bool `json:"isMRRT"` + RefreshToken string `json:"refreshToken"` + Resource string `json:"resource"` + TokenType string `json:"tokenType"` + UserID string `json:"userId"` +} + +// ToADALToken converts an Azure CLI `Token`` to an `adal.Token`` +func (t Token) ToADALToken() (converted adal.Token, err error) { + tokenExpirationDate, err := ParseExpirationDate(t.ExpiresOn) + if err != nil { + err = fmt.Errorf("Error parsing Token Expiration Date %q: %+v", t.ExpiresOn, err) + return + } + + difference := tokenExpirationDate.Sub(date.UnixEpoch()) + + converted = adal.Token{ + AccessToken: t.AccessToken, + Type: t.TokenType, + ExpiresIn: "3600", + ExpiresOn: json.Number(strconv.Itoa(int(difference.Seconds()))), + RefreshToken: t.RefreshToken, + Resource: t.Resource, + } + return +} + +// AccessTokensPath returns the path where access tokens are stored from the Azure CLI +// TODO(#199): add unit test. +func AccessTokensPath() (string, error) { + // Azure-CLI allows user to customize the path of access tokens thorugh environment variable. + var accessTokenPath = os.Getenv("AZURE_ACCESS_TOKEN_FILE") + var err error + + // Fallback logic to default path on non-cloud-shell environment. + // TODO(#200): remove the dependency on hard-coding path. + if accessTokenPath == "" { + accessTokenPath, err = homedir.Expand("~/.azure/accessTokens.json") + } + + return accessTokenPath, err +} + +// ParseExpirationDate parses either a Azure CLI or CloudShell date into a time object +func ParseExpirationDate(input string) (*time.Time, error) { + // CloudShell (and potentially the Azure CLI in future) + expirationDate, cloudShellErr := time.Parse(time.RFC3339, input) + if cloudShellErr != nil { + // Azure CLI (Python) e.g. 2017-08-31 19:48:57.998857 (plus the local timezone) + const cliFormat = "2006-01-02 15:04:05.999999" + expirationDate, cliErr := time.ParseInLocation(cliFormat, input, time.Local) + if cliErr == nil { + return &expirationDate, nil + } + + return nil, fmt.Errorf("Error parsing expiration date %q.\n\nCloudShell Error: \n%+v\n\nCLI Error:\n%+v", input, cloudShellErr, cliErr) + } + + return &expirationDate, nil +} + +// LoadTokens restores a set of Token objects from a file located at 'path'. +func LoadTokens(path string) ([]Token, error) { + file, err := os.Open(path) + if err != nil { + return nil, fmt.Errorf("failed to open file (%s) while loading token: %v", path, err) + } + defer file.Close() + + var tokens []Token + + dec := json.NewDecoder(file) + if err = dec.Decode(&tokens); err != nil { + return nil, fmt.Errorf("failed to decode contents of file (%s) into a `cli.Token` representation: %v", path, err) + } + + return tokens, nil +} + +// GetTokenFromCLI gets a token using Azure CLI 2.0 for local development scenarios. +func GetTokenFromCLI(resource string) (*Token, error) { + // This is the path that a developer can set to tell this class what the install path for Azure CLI is. + const azureCLIPath = "AzureCLIPath" + + // The default install paths are used to find Azure CLI. This is for security, so that any path in the calling program's Path environment is not used to execute Azure CLI. + azureCLIDefaultPathWindows := fmt.Sprintf("%s\\Microsoft SDKs\\Azure\\CLI2\\wbin; %s\\Microsoft SDKs\\Azure\\CLI2\\wbin", os.Getenv("ProgramFiles(x86)"), os.Getenv("ProgramFiles")) + + // Default path for non-Windows. + const azureCLIDefaultPath = "/bin:/sbin:/usr/bin:/usr/local/bin" + + // Validate resource, since it gets sent as a command line argument to Azure CLI + const invalidResourceErrorTemplate = "Resource %s is not in expected format. Only alphanumeric characters, [dot], [colon], [hyphen], and [forward slash] are allowed." + match, err := regexp.MatchString("^[0-9a-zA-Z-.:/]+$", resource) + if err != nil { + return nil, err + } + if !match { + return nil, fmt.Errorf(invalidResourceErrorTemplate, resource) + } + + // Execute Azure CLI to get token + var cliCmd *exec.Cmd + if runtime.GOOS == "windows" { + cliCmd = exec.Command(fmt.Sprintf("%s\\system32\\cmd.exe", os.Getenv("windir"))) + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s;%s", os.Getenv(azureCLIPath), azureCLIDefaultPathWindows)) + cliCmd.Args = append(cliCmd.Args, "/c", "az") + } else { + cliCmd = exec.Command("az") + cliCmd.Env = os.Environ() + cliCmd.Env = append(cliCmd.Env, fmt.Sprintf("PATH=%s:%s", os.Getenv(azureCLIPath), azureCLIDefaultPath)) + } + cliCmd.Args = append(cliCmd.Args, "account", "get-access-token", "-o", "json", "--resource", resource) + + var stderr bytes.Buffer + cliCmd.Stderr = &stderr + + output, err := cliCmd.Output() + if err != nil { + return nil, fmt.Errorf("Invoking Azure CLI failed with the following error: %s", stderr.String()) + } + + tokenResponse := Token{} + err = json.Unmarshal(output, &tokenResponse) + if err != nil { + return nil, err + } + + return &tokenResponse, err +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go index 7e41f7fd..6c20b817 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/environments.go @@ -22,9 +22,14 @@ import ( "strings" ) -// EnvironmentFilepathName captures the name of the environment variable containing the path to the file -// to be used while populating the Azure Environment. -const EnvironmentFilepathName = "AZURE_ENVIRONMENT_FILEPATH" +const ( + // EnvironmentFilepathName captures the name of the environment variable containing the path to the file + // to be used while populating the Azure Environment. + EnvironmentFilepathName = "AZURE_ENVIRONMENT_FILEPATH" + + // NotAvailable is used for endpoints and resource IDs that are not available for a given cloud. + NotAvailable = "N/A" +) var environments = map[string]Environment{ "AZURECHINACLOUD": ChinaCloud, @@ -33,28 +38,40 @@ var environments = map[string]Environment{ "AZUREUSGOVERNMENTCLOUD": USGovernmentCloud, } +// ResourceIdentifier contains a set of Azure resource IDs. +type ResourceIdentifier struct { + Graph string `json:"graph"` + KeyVault string `json:"keyVault"` + Datalake string `json:"datalake"` + Batch string `json:"batch"` + OperationalInsights string `json:"operationalInsights"` + Storage string `json:"storage"` +} + // Environment represents a set of endpoints for each of Azure's Clouds. type Environment struct { - Name string `json:"name"` - ManagementPortalURL string `json:"managementPortalURL"` - PublishSettingsURL string `json:"publishSettingsURL"` - ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` - ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` - ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` - GalleryEndpoint string `json:"galleryEndpoint"` - KeyVaultEndpoint string `json:"keyVaultEndpoint"` - GraphEndpoint string `json:"graphEndpoint"` - ServiceBusEndpoint string `json:"serviceBusEndpoint"` - BatchManagementEndpoint string `json:"batchManagementEndpoint"` - StorageEndpointSuffix string `json:"storageEndpointSuffix"` - SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` - TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` - KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` - ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` - ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` - ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` - ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` - TokenAudience string `json:"tokenAudience"` + Name string `json:"name"` + ManagementPortalURL string `json:"managementPortalURL"` + PublishSettingsURL string `json:"publishSettingsURL"` + ServiceManagementEndpoint string `json:"serviceManagementEndpoint"` + ResourceManagerEndpoint string `json:"resourceManagerEndpoint"` + ActiveDirectoryEndpoint string `json:"activeDirectoryEndpoint"` + GalleryEndpoint string `json:"galleryEndpoint"` + KeyVaultEndpoint string `json:"keyVaultEndpoint"` + GraphEndpoint string `json:"graphEndpoint"` + ServiceBusEndpoint string `json:"serviceBusEndpoint"` + BatchManagementEndpoint string `json:"batchManagementEndpoint"` + StorageEndpointSuffix string `json:"storageEndpointSuffix"` + SQLDatabaseDNSSuffix string `json:"sqlDatabaseDNSSuffix"` + TrafficManagerDNSSuffix string `json:"trafficManagerDNSSuffix"` + KeyVaultDNSSuffix string `json:"keyVaultDNSSuffix"` + ServiceBusEndpointSuffix string `json:"serviceBusEndpointSuffix"` + ServiceManagementVMDNSSuffix string `json:"serviceManagementVMDNSSuffix"` + ResourceManagerVMDNSSuffix string `json:"resourceManagerVMDNSSuffix"` + ContainerRegistryDNSSuffix string `json:"containerRegistryDNSSuffix"` + CosmosDBDNSSuffix string `json:"cosmosDBDNSSuffix"` + TokenAudience string `json:"tokenAudience"` + ResourceIdentifiers ResourceIdentifier `json:"resourceIdentifiers"` } var ( @@ -79,7 +96,16 @@ var ( ServiceManagementVMDNSSuffix: "cloudapp.net", ResourceManagerVMDNSSuffix: "cloudapp.azure.com", ContainerRegistryDNSSuffix: "azurecr.io", + CosmosDBDNSSuffix: "documents.azure.com", TokenAudience: "https://management.azure.com/", + ResourceIdentifiers: ResourceIdentifier{ + Graph: "https://graph.windows.net/", + KeyVault: "https://vault.azure.net", + Datalake: "https://datalake.azure.net/", + Batch: "https://batch.core.windows.net/", + OperationalInsights: "https://api.loganalytics.io", + Storage: "https://storage.azure.com/", + }, } // USGovernmentCloud is the cloud environment for the US Government @@ -102,8 +128,17 @@ var ( ServiceBusEndpointSuffix: "servicebus.usgovcloudapi.net", ServiceManagementVMDNSSuffix: "usgovcloudapp.net", ResourceManagerVMDNSSuffix: "cloudapp.windowsazure.us", - ContainerRegistryDNSSuffix: "azurecr.io", + ContainerRegistryDNSSuffix: "azurecr.us", + CosmosDBDNSSuffix: "documents.azure.us", TokenAudience: "https://management.usgovcloudapi.net/", + ResourceIdentifiers: ResourceIdentifier{ + Graph: "https://graph.windows.net/", + KeyVault: "https://vault.usgovcloudapi.net", + Datalake: NotAvailable, + Batch: "https://batch.core.usgovcloudapi.net/", + OperationalInsights: "https://api.loganalytics.us", + Storage: "https://storage.azure.com/", + }, } // ChinaCloud is the cloud environment operated in China @@ -126,8 +161,17 @@ var ( ServiceBusEndpointSuffix: "servicebus.chinacloudapi.cn", ServiceManagementVMDNSSuffix: "chinacloudapp.cn", ResourceManagerVMDNSSuffix: "cloudapp.azure.cn", - ContainerRegistryDNSSuffix: "azurecr.io", + ContainerRegistryDNSSuffix: "azurecr.cn", + CosmosDBDNSSuffix: "documents.azure.cn", TokenAudience: "https://management.chinacloudapi.cn/", + ResourceIdentifiers: ResourceIdentifier{ + Graph: "https://graph.chinacloudapi.cn/", + KeyVault: "https://vault.azure.cn", + Datalake: NotAvailable, + Batch: "https://batch.chinacloudapi.cn/", + OperationalInsights: NotAvailable, + Storage: "https://storage.azure.com/", + }, } // GermanCloud is the cloud environment operated in Germany @@ -150,8 +194,17 @@ var ( ServiceBusEndpointSuffix: "servicebus.cloudapi.de", ServiceManagementVMDNSSuffix: "azurecloudapp.de", ResourceManagerVMDNSSuffix: "cloudapp.microsoftazure.de", - ContainerRegistryDNSSuffix: "azurecr.io", + ContainerRegistryDNSSuffix: NotAvailable, + CosmosDBDNSSuffix: "documents.microsoftazure.de", TokenAudience: "https://management.microsoftazure.de/", + ResourceIdentifiers: ResourceIdentifier{ + Graph: "https://graph.cloudapi.de/", + KeyVault: "https://vault.microsoftazure.de", + Datalake: NotAvailable, + Batch: "https://batch.cloudapi.de/", + OperationalInsights: NotAvailable, + Storage: "https://storage.azure.com/", + }, } ) diff --git a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go index bd34f0ed..86ce9f2b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go +++ b/vendor/github.com/Azure/go-autorest/autorest/azure/rp.go @@ -140,8 +140,8 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError } // poll for registered provisioning state - now := time.Now() - for err == nil && time.Since(now) < client.PollingDuration { + registrationStartTime := time.Now() + for err == nil && (client.PollingDuration == 0 || (client.PollingDuration != 0 && time.Since(registrationStartTime) < client.PollingDuration)) { // taken from the resources SDK // https://github.com/Azure/azure-sdk-for-go/blob/9f366792afa3e0ddaecdc860e793ba9d75e76c27/arm/resources/resources/providers.go#L45 preparer := autorest.CreatePreparer( @@ -183,7 +183,7 @@ func register(client autorest.Client, originalReq *http.Request, re RequestError return originalReq.Context().Err() } } - if !(time.Since(now) < client.PollingDuration) { + if client.PollingDuration != 0 && !(time.Since(registrationStartTime) < client.PollingDuration) { return errors.New("polling for resource provider registration has exceeded the polling duration") } return err diff --git a/vendor/github.com/Azure/go-autorest/autorest/client.go b/vendor/github.com/Azure/go-autorest/autorest/client.go index 5c558c83..92da6adb 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/client.go +++ b/vendor/github.com/Azure/go-autorest/autorest/client.go @@ -16,6 +16,7 @@ package autorest import ( "bytes" + "crypto/tls" "fmt" "io" "io/ioutil" @@ -26,7 +27,7 @@ import ( "time" "github.com/Azure/go-autorest/logger" - "github.com/Azure/go-autorest/version" + "github.com/Azure/go-autorest/tracing" ) const ( @@ -72,6 +73,22 @@ type Response struct { *http.Response `json:"-"` } +// IsHTTPStatus returns true if the returned HTTP status code matches the provided status code. +// If there was no response (i.e. the underlying http.Response is nil) the return value is false. +func (r Response) IsHTTPStatus(statusCode int) bool { + if r.Response == nil { + return false + } + return r.Response.StatusCode == statusCode +} + +// HasHTTPStatus returns true if the returned HTTP status code matches one of the provided status codes. +// If there was no response (i.e. the underlying http.Response is nil) or not status codes are provided +// the return value is false. +func (r Response) HasHTTPStatus(statusCodes ...int) bool { + return ResponseHasStatusCode(r.Response, statusCodes...) +} + // LoggingInspector implements request and response inspectors that log the full request and // response to a supplied log. type LoggingInspector struct { @@ -147,6 +164,7 @@ type Client struct { PollingDelay time.Duration // PollingDuration sets the maximum polling time after which an error is returned. + // Setting this to zero will use the provided context to control the duration. PollingDuration time.Duration // RetryAttempts sets the default number of retry attempts for client. @@ -168,14 +186,32 @@ type Client struct { // NewClientWithUserAgent returns an instance of a Client with the UserAgent set to the passed // string. func NewClientWithUserAgent(ua string) Client { + return newClient(ua, tls.RenegotiateNever) +} + +// ClientOptions contains various Client configuration options. +type ClientOptions struct { + // UserAgent is an optional user-agent string to append to the default user agent. + UserAgent string + + // Renegotiation is an optional setting to control client-side TLS renegotiation. + Renegotiation tls.RenegotiationSupport +} + +// NewClientWithOptions returns an instance of a Client with the specified values. +func NewClientWithOptions(options ClientOptions) Client { + return newClient(options.UserAgent, options.Renegotiation) +} + +func newClient(ua string, renegotiation tls.RenegotiationSupport) Client { c := Client{ PollingDelay: DefaultPollingDelay, PollingDuration: DefaultPollingDuration, RetryAttempts: DefaultRetryAttempts, RetryDuration: DefaultRetryDuration, - UserAgent: version.UserAgent(), + UserAgent: UserAgent(), } - c.Sender = c.sender() + c.Sender = c.sender(renegotiation) c.AddToUserAgent(ua) return c } @@ -219,18 +255,39 @@ func (c Client) Do(r *http.Request) (*http.Response, error) { return true, v }, }) - resp, err := SendWithSender(c.sender(), r) + resp, err := SendWithSender(c.sender(tls.RenegotiateNever), r) logger.Instance.WriteResponse(resp, logger.Filter{}) Respond(resp, c.ByInspecting()) return resp, err } // sender returns the Sender to which to send requests. -func (c Client) sender() Sender { +func (c Client) sender(renengotiation tls.RenegotiationSupport) Sender { if c.Sender == nil { + // Use behaviour compatible with DefaultTransport, but require TLS minimum version. + var defaultTransport = http.DefaultTransport.(*http.Transport) + transport := tracing.Transport + // for non-default values of TLS renegotiation create a new tracing transport. + // updating tracing.Transport affects all clients which is not what we want. + if renengotiation != tls.RenegotiateNever { + transport = tracing.NewTransport() + } + transport.Base = &http.Transport{ + Proxy: defaultTransport.Proxy, + DialContext: defaultTransport.DialContext, + MaxIdleConns: defaultTransport.MaxIdleConns, + IdleConnTimeout: defaultTransport.IdleConnTimeout, + TLSHandshakeTimeout: defaultTransport.TLSHandshakeTimeout, + ExpectContinueTimeout: defaultTransport.ExpectContinueTimeout, + TLSClientConfig: &tls.Config{ + MinVersion: tls.VersionTLS12, + Renegotiation: renengotiation, + }, + } j, _ := cookiejar.New(nil) - return &http.Client{Jar: j} + return &http.Client{Jar: j, Transport: transport} } + return c.Sender } diff --git a/vendor/github.com/Azure/go-autorest/autorest/preparer.go b/vendor/github.com/Azure/go-autorest/autorest/preparer.go index 6d67bd73..6e955a4b 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/preparer.go +++ b/vendor/github.com/Azure/go-autorest/autorest/preparer.go @@ -17,6 +17,7 @@ package autorest import ( "bytes" "encoding/json" + "encoding/xml" "fmt" "io" "io/ioutil" @@ -190,6 +191,9 @@ func AsGet() PrepareDecorator { return WithMethod("GET") } // AsHead returns a PrepareDecorator that sets the HTTP method to HEAD. func AsHead() PrepareDecorator { return WithMethod("HEAD") } +// AsMerge returns a PrepareDecorator that sets the HTTP method to MERGE. +func AsMerge() PrepareDecorator { return WithMethod("MERGE") } + // AsOptions returns a PrepareDecorator that sets the HTTP method to OPTIONS. func AsOptions() PrepareDecorator { return WithMethod("OPTIONS") } @@ -225,6 +229,25 @@ func WithBaseURL(baseURL string) PrepareDecorator { } } +// WithBytes returns a PrepareDecorator that takes a list of bytes +// which passes the bytes directly to the body +func WithBytes(input *[]byte) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + if input == nil { + return r, fmt.Errorf("Input Bytes was nil") + } + + r.ContentLength = int64(len(*input)) + r.Body = ioutil.NopCloser(bytes.NewReader(*input)) + } + return r, err + }) + } +} + // WithCustomBaseURL returns a PrepareDecorator that replaces brace-enclosed keys within the // request base URL (i.e., http.Request.URL) with the corresponding values from the passed map. func WithCustomBaseURL(baseURL string, urlParameters map[string]interface{}) PrepareDecorator { @@ -377,6 +400,28 @@ func WithJSON(v interface{}) PrepareDecorator { } } +// WithXML returns a PrepareDecorator that encodes the data passed as XML into the body of the +// request and sets the Content-Length header. +func WithXML(v interface{}) PrepareDecorator { + return func(p Preparer) Preparer { + return PreparerFunc(func(r *http.Request) (*http.Request, error) { + r, err := p.Prepare(r) + if err == nil { + b, err := xml.Marshal(v) + if err == nil { + // we have to tack on an XML header + withHeader := xml.Header + string(b) + bytesWithHeader := []byte(withHeader) + + r.ContentLength = int64(len(bytesWithHeader)) + r.Body = ioutil.NopCloser(bytes.NewReader(bytesWithHeader)) + } + } + return r, err + }) + } +} + // WithPath returns a PrepareDecorator that adds the supplied path to the request URL. If the path // is absolute (that is, it begins with a "/"), it replaces the existing path. func WithPath(path string) PrepareDecorator { diff --git a/vendor/github.com/Azure/go-autorest/autorest/responder.go b/vendor/github.com/Azure/go-autorest/autorest/responder.go index a908a0ad..349e1963 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/responder.go +++ b/vendor/github.com/Azure/go-autorest/autorest/responder.go @@ -153,6 +153,25 @@ func ByClosingIfError() RespondDecorator { } } +// ByUnmarshallingBytes returns a RespondDecorator that copies the Bytes returned in the +// response Body into the value pointed to by v. +func ByUnmarshallingBytes(v *[]byte) RespondDecorator { + return func(r Responder) Responder { + return ResponderFunc(func(resp *http.Response) error { + err := r.Respond(resp) + if err == nil { + bytes, errInner := ioutil.ReadAll(resp.Body) + if errInner != nil { + err = fmt.Errorf("Error occurred reading http.Response#Body - Error = '%v'", errInner) + } else { + *v = bytes + } + } + return err + }) + } +} + // ByUnmarshallingJSON returns a RespondDecorator that decodes a JSON document returned in the // response Body into the value pointed to by v. func ByUnmarshallingJSON(v interface{}) RespondDecorator { diff --git a/vendor/github.com/Azure/go-autorest/autorest/sender.go b/vendor/github.com/Azure/go-autorest/autorest/sender.go index cacbd815..2f4b0ddd 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/sender.go +++ b/vendor/github.com/Azure/go-autorest/autorest/sender.go @@ -21,6 +21,8 @@ import ( "net/http" "strconv" "time" + + "github.com/Azure/go-autorest/tracing" ) // Sender is the interface that wraps the Do method to send HTTP requests. @@ -38,7 +40,7 @@ func (sf SenderFunc) Do(r *http.Request) (*http.Response, error) { return sf(r) } -// SendDecorator takes and possibily decorates, by wrapping, a Sender. Decorators may affect the +// SendDecorator takes and possibly decorates, by wrapping, a Sender. Decorators may affect the // http.Request and pass it along or, first, pass the http.Request along then react to the // http.Response result. type SendDecorator func(Sender) Sender @@ -68,7 +70,7 @@ func DecorateSender(s Sender, decorators ...SendDecorator) Sender { // // Send will not poll or retry requests. func Send(r *http.Request, decorators ...SendDecorator) (*http.Response, error) { - return SendWithSender(&http.Client{}, r, decorators...) + return SendWithSender(&http.Client{Transport: tracing.Transport}, r, decorators...) } // SendWithSender sends the passed http.Request, through the provided Sender, returning the @@ -216,8 +218,7 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se return SenderFunc(func(r *http.Request) (resp *http.Response, err error) { rr := NewRetriableRequest(r) // Increment to add the first call (attempts denotes number of retries) - attempts++ - for attempt := 0; attempt < attempts; { + for attempt := 0; attempt < attempts+1; { err = rr.Prepare() if err != nil { return resp, err @@ -234,7 +235,7 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se } delayed := DelayWithRetryAfter(resp, r.Context().Done()) if !delayed && !DelayForBackoff(backoff, attempt, r.Context().Done()) { - return nil, r.Context().Err() + return resp, r.Context().Err() } // don't count a 429 against the number of attempts // so that we continue to retry until it succeeds @@ -247,16 +248,24 @@ func DoRetryForStatusCodes(attempts int, backoff time.Duration, codes ...int) Se } } -// DelayWithRetryAfter invokes time.After for the duration specified in the "Retry-After" header in -// responses with status code 429 +// DelayWithRetryAfter invokes time.After for the duration specified in the "Retry-After" header. +// The value of Retry-After can be either the number of seconds or a date in RFC1123 format. +// The function returns true after successfully waiting for the specified duration. If there is +// no Retry-After header or the wait is cancelled the return value is false. func DelayWithRetryAfter(resp *http.Response, cancel <-chan struct{}) bool { if resp == nil { return false } - retryAfter, _ := strconv.Atoi(resp.Header.Get("Retry-After")) - if resp.StatusCode == http.StatusTooManyRequests && retryAfter > 0 { + var dur time.Duration + ra := resp.Header.Get("Retry-After") + if retryAfter, _ := strconv.Atoi(ra); retryAfter > 0 { + dur = time.Duration(retryAfter) * time.Second + } else if t, err := time.Parse(time.RFC1123, ra); err == nil { + dur = t.Sub(time.Now()) + } + if dur > 0 { select { - case <-time.After(time.Duration(retryAfter) * time.Second): + case <-time.After(dur): return true case <-cancel: return false diff --git a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go index fdda2ce1..86694bd2 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/to/convert.go +++ b/vendor/github.com/Azure/go-autorest/autorest/to/convert.go @@ -145,3 +145,8 @@ func Float64(i *float64) float64 { func Float64Ptr(i float64) *float64 { return &i } + +// ByteSlicePtr returns a pointer to the passed byte slice. +func ByteSlicePtr(b []byte) *[]byte { + return &b +} diff --git a/vendor/github.com/Azure/go-autorest/autorest/utility.go b/vendor/github.com/Azure/go-autorest/autorest/utility.go index bfddd90b..08cf11c1 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/utility.go +++ b/vendor/github.com/Azure/go-autorest/autorest/utility.go @@ -157,7 +157,7 @@ func AsStringSlice(s interface{}) ([]string, error) { } // String method converts interface v to string. If interface is a list, it -// joins list elements using the seperator. Note that only sep[0] will be used for +// joins list elements using the separator. Note that only sep[0] will be used for // joining if any separator is specified. func String(v interface{}, sep ...string) string { if len(sep) == 0 { diff --git a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go index ae987f8f..65899b69 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go +++ b/vendor/github.com/Azure/go-autorest/autorest/validation/validation.go @@ -398,11 +398,3 @@ func toInt64(v interface{}) (int64, bool) { } return 0, false } - -// NewErrorWithValidationError appends package type and method name in -// validation error. -// -// Deprecated: Please use validation.NewError() instead. -func NewErrorWithValidationError(err error, packageType, method string) error { - return NewError(packageType, method, err.Error()) -} diff --git a/vendor/github.com/Azure/go-autorest/autorest/version.go b/vendor/github.com/Azure/go-autorest/autorest/version.go index 3c645154..8ba0f591 100644 --- a/vendor/github.com/Azure/go-autorest/autorest/version.go +++ b/vendor/github.com/Azure/go-autorest/autorest/version.go @@ -1,7 +1,5 @@ package autorest -import "github.com/Azure/go-autorest/version" - // Copyright 2017 Microsoft Corporation // // Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,7 +14,28 @@ import "github.com/Azure/go-autorest/version" // See the License for the specific language governing permissions and // limitations under the License. +import ( + "fmt" + "runtime" +) + +const number = "v12.2.0" + +var ( + userAgent = fmt.Sprintf("Go/%s (%s-%s) go-autorest/%s", + runtime.Version(), + runtime.GOARCH, + runtime.GOOS, + number, + ) +) + +// UserAgent returns a string containing the Go version, system architecture and OS, and the go-autorest version. +func UserAgent() string { + return userAgent +} + // Version returns the semantic version (see http://semver.org). func Version() string { - return version.Number + return number } diff --git a/vendor/github.com/Azure/go-autorest/logger/logger.go b/vendor/github.com/Azure/go-autorest/logger/logger.go index 756fd80c..da09f394 100644 --- a/vendor/github.com/Azure/go-autorest/logger/logger.go +++ b/vendor/github.com/Azure/go-autorest/logger/logger.go @@ -162,7 +162,7 @@ type Writer interface { // WriteResponse writes the specified HTTP response to the logger if the log level is greater than // or equal to LogInfo. The response body, if set, is logged at level LogDebug or higher. // Custom filters can be specified to exclude URL, header, and/or body content from the log. - // By default no respone content is excluded. + // By default no response content is excluded. WriteResponse(resp *http.Response, filter Filter) } @@ -318,7 +318,7 @@ func (fl fileLogger) WriteResponse(resp *http.Response, filter Filter) { // returns true if the provided body should be included in the log func (fl fileLogger) shouldLogBody(header http.Header, body io.ReadCloser) bool { ct := header.Get("Content-Type") - return fl.logLevel >= LogDebug && body != nil && strings.Index(ct, "application/octet-stream") == -1 + return fl.logLevel >= LogDebug && body != nil && !strings.Contains(ct, "application/octet-stream") } // creates standard header for log entries, it contains a timestamp and the log level diff --git a/vendor/github.com/Azure/go-autorest/tracing/tracing.go b/vendor/github.com/Azure/go-autorest/tracing/tracing.go new file mode 100644 index 00000000..28951c28 --- /dev/null +++ b/vendor/github.com/Azure/go-autorest/tracing/tracing.go @@ -0,0 +1,195 @@ +package tracing + +// Copyright 2018 Microsoft Corporation +// +// 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. + +import ( + "context" + "fmt" + "net/http" + "os" + + "contrib.go.opencensus.io/exporter/ocagent" + "go.opencensus.io/plugin/ochttp" + "go.opencensus.io/plugin/ochttp/propagation/tracecontext" + "go.opencensus.io/stats/view" + "go.opencensus.io/trace" +) + +var ( + // Transport is the default tracing RoundTripper. The custom options setter will control + // if traces are being emitted or not. + Transport = NewTransport() + + // enabled is the flag for marking if tracing is enabled. + enabled = false + + // Sampler is the tracing sampler. If tracing is disabled it will never sample. Otherwise + // it will be using the parent sampler or the default. + sampler = trace.NeverSample() + + // Views for metric instrumentation. + views = map[string]*view.View{} + + // the trace exporter + traceExporter trace.Exporter +) + +func init() { + enableFromEnv() +} + +func enableFromEnv() { + _, ok := os.LookupEnv("AZURE_SDK_TRACING_ENABLED") + _, legacyOk := os.LookupEnv("AZURE_SDK_TRACING_ENABELD") + if ok || legacyOk { + agentEndpoint, ok := os.LookupEnv("OCAGENT_TRACE_EXPORTER_ENDPOINT") + + if ok { + EnableWithAIForwarding(agentEndpoint) + } else { + Enable() + } + } +} + +// NewTransport returns a new instance of a tracing-aware RoundTripper. +func NewTransport() *ochttp.Transport { + return &ochttp.Transport{ + Propagation: &tracecontext.HTTPFormat{}, + GetStartOptions: getStartOptions, + } +} + +// IsEnabled returns true if monitoring is enabled for the sdk. +func IsEnabled() bool { + return enabled +} + +// Enable will start instrumentation for metrics and traces. +func Enable() error { + enabled = true + sampler = nil + + err := initStats() + return err +} + +// Disable will disable instrumentation for metrics and traces. +func Disable() { + disableStats() + sampler = trace.NeverSample() + if traceExporter != nil { + trace.UnregisterExporter(traceExporter) + } + enabled = false +} + +// EnableWithAIForwarding will start instrumentation and will connect to app insights forwarder +// exporter making the metrics and traces available in app insights. +func EnableWithAIForwarding(agentEndpoint string) (err error) { + err = Enable() + if err != nil { + return err + } + + traceExporter, err := ocagent.NewExporter(ocagent.WithInsecure(), ocagent.WithAddress(agentEndpoint)) + if err != nil { + return err + } + trace.RegisterExporter(traceExporter) + return +} + +// getStartOptions is the custom options setter for the ochttp package. +func getStartOptions(*http.Request) trace.StartOptions { + return trace.StartOptions{ + Sampler: sampler, + } +} + +// initStats registers the views for the http metrics +func initStats() (err error) { + clientViews := []*view.View{ + ochttp.ClientCompletedCount, + ochttp.ClientRoundtripLatencyDistribution, + ochttp.ClientReceivedBytesDistribution, + ochttp.ClientSentBytesDistribution, + } + for _, cv := range clientViews { + vn := fmt.Sprintf("Azure/go-autorest/tracing-%s", cv.Name) + views[vn] = cv.WithName(vn) + err = view.Register(views[vn]) + if err != nil { + return err + } + } + return +} + +// disableStats will unregister the previously registered metrics +func disableStats() { + for _, v := range views { + view.Unregister(v) + } +} + +// StartSpan starts a trace span +func StartSpan(ctx context.Context, name string) context.Context { + ctx, _ = trace.StartSpan(ctx, name, trace.WithSampler(sampler)) + return ctx +} + +// EndSpan ends a previously started span stored in the context +func EndSpan(ctx context.Context, httpStatusCode int, err error) { + span := trace.FromContext(ctx) + + if span == nil { + return + } + + if err != nil { + span.SetStatus(trace.Status{Message: err.Error(), Code: toTraceStatusCode(httpStatusCode)}) + } + span.End() +} + +// toTraceStatusCode converts HTTP Codes to OpenCensus codes as defined +// at https://github.com/census-instrumentation/opencensus-specs/blob/master/trace/HTTP.md#status +func toTraceStatusCode(httpStatusCode int) int32 { + switch { + case http.StatusOK <= httpStatusCode && httpStatusCode < http.StatusBadRequest: + return trace.StatusCodeOK + case httpStatusCode == http.StatusBadRequest: + return trace.StatusCodeInvalidArgument + case httpStatusCode == http.StatusUnauthorized: // 401 is actually unauthenticated. + return trace.StatusCodeUnauthenticated + case httpStatusCode == http.StatusForbidden: + return trace.StatusCodePermissionDenied + case httpStatusCode == http.StatusNotFound: + return trace.StatusCodeNotFound + case httpStatusCode == http.StatusTooManyRequests: + return trace.StatusCodeResourceExhausted + case httpStatusCode == 499: + return trace.StatusCodeCancelled + case httpStatusCode == http.StatusNotImplemented: + return trace.StatusCodeUnimplemented + case httpStatusCode == http.StatusServiceUnavailable: + return trace.StatusCodeUnavailable + case httpStatusCode == http.StatusGatewayTimeout: + return trace.StatusCodeDeadlineExceeded + default: + return trace.StatusCodeUnknown + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/bearer_token_credential.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/bearer_token_credential.go new file mode 100644 index 00000000..6d4763e6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/bearer_token_credential.go @@ -0,0 +1,12 @@ +package credentials + +type BearerTokenCredential struct { + BearerToken string +} + +// NewBearerTokenCredential return a BearerTokenCredential object +func NewBearerTokenCredential(token string) *BearerTokenCredential { + return &BearerTokenCredential{ + BearerToken: token, + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/ecs_ram_role.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/ecs_ram_role.go index 1e1f73ae..55a5c2da 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/ecs_ram_role.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/ecs_ram_role.go @@ -1,17 +1,5 @@ package credentials -// Deprecated: Use EcsRamRoleCredential in this package instead. -type StsRoleNameOnEcsCredential struct { - RoleName string -} - -// Deprecated: Use NewEcsRamRoleCredential in this package instead. -func NewStsRoleNameOnEcsCredential(roleName string) *StsRoleNameOnEcsCredential { - return &StsRoleNameOnEcsCredential{ - RoleName: roleName, - } -} - func (oldCred *StsRoleNameOnEcsCredential) ToEcsRamRoleCredential() *EcsRamRoleCredential { return &EcsRamRoleCredential{ RoleName: oldCred.RoleName, @@ -27,3 +15,15 @@ func NewEcsRamRoleCredential(roleName string) *EcsRamRoleCredential { RoleName: roleName, } } + +// Deprecated: Use EcsRamRoleCredential in this package instead. +type StsRoleNameOnEcsCredential struct { + RoleName string +} + +// Deprecated: Use NewEcsRamRoleCredential in this package instead. +func NewStsRoleNameOnEcsCredential(roleName string) *StsRoleNameOnEcsCredential { + return &StsRoleNameOnEcsCredential{ + RoleName: roleName, + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/env.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/env.go new file mode 100644 index 00000000..3cd0d020 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/env.go @@ -0,0 +1,30 @@ +package provider + +import ( + "errors" + "os" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" +) + +type EnvProvider struct{} + +var ProviderEnv = new(EnvProvider) + +func NewEnvProvider() Provider { + return &EnvProvider{} +} + +func (p *EnvProvider) Resolve() (auth.Credential, error) { + accessKeyID, ok1 := os.LookupEnv(ENVAccessKeyID) + accessKeySecret, ok2 := os.LookupEnv(ENVAccessKeySecret) + if !ok1 || !ok2 { + return nil, nil + } + if accessKeyID == "" || accessKeySecret == "" { + return nil, errors.New("Environmental variable (ALIBABACLOUD_ACCESS_KEY_ID or ALIBABACLOUD_ACCESS_KEY_SECRET) is empty") + } + return credentials.NewAccessKeyCredential(accessKeyID, accessKeySecret), nil +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/instance_credentials.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/instance_credentials.go new file mode 100644 index 00000000..1906d21f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/instance_credentials.go @@ -0,0 +1,92 @@ +package provider + +import ( + "encoding/json" + "errors" + "fmt" + "io/ioutil" + "net/http" + "os" + "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" +) + +var securityCredURL = "http://100.100.100.200/latest/meta-data/ram/security-credentials/" + +type InstanceCredentialsProvider struct{} + +var ProviderInstance = new(InstanceCredentialsProvider) + +var HookGet = func(fn func(string) (int, []byte, error)) func(string) (int, []byte, error) { + return fn +} + +func NewInstanceCredentialsProvider() Provider { + return &InstanceCredentialsProvider{} +} + +func (p *InstanceCredentialsProvider) Resolve() (auth.Credential, error) { + roleName, ok := os.LookupEnv(ENVEcsMetadata) + if !ok { + return nil, nil + } + if roleName == "" { + return nil, errors.New("Environmental variable 'ALIBABA_CLOUD_ECS_METADATA' are empty") + } + status, content, err := HookGet(get)(securityCredURL + roleName) + if err != nil { + return nil, err + } + if status != 200 { + if status == 404 { + return nil, fmt.Errorf("The role was not found in the instance") + } + return nil, fmt.Errorf("Received %d when getting security credentials for %s", status, roleName) + } + body := make(map[string]interface{}) + + if err := json.Unmarshal(content, &body); err != nil { + return nil, err + } + + accessKeyID, err := extractString(body, "AccessKeyId") + if err != nil { + return nil, err + } + accessKeySecret, err := extractString(body, "AccessKeySecret") + if err != nil { + return nil, err + } + securityToken, err := extractString(body, "SecurityToken") + if err != nil { + return nil, err + } + + return credentials.NewStsTokenCredential(accessKeyID, accessKeySecret, securityToken), nil +} + +func get(url string) (status int, content []byte, err error) { + httpClient := http.DefaultClient + httpClient.Timeout = time.Second * 1 + resp, err := httpClient.Get(url) + if err != nil { + return + } + defer resp.Body.Close() + content, err = ioutil.ReadAll(resp.Body) + return resp.StatusCode, content, err +} + +func extractString(m map[string]interface{}, key string) (string, error) { + raw, ok := m[key] + if !ok { + return "", fmt.Errorf("%s not in map", key) + } + str, ok := raw.(string) + if !ok { + return "", fmt.Errorf("%s is not a string in map", key) + } + return str, nil +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/profile_credentials.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/profile_credentials.go new file mode 100644 index 00000000..8d525c37 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/profile_credentials.go @@ -0,0 +1,158 @@ +package provider + +import ( + "bufio" + "errors" + "os" + "runtime" + "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" + + ini "gopkg.in/ini.v1" +) + +type ProfileProvider struct { + Profile string +} + +var ProviderProfile = NewProfileProvider() + +// NewProfileProvider receive zero or more parameters, +// when length of name is 0, the value of field Profile will be "default", +// and when there are multiple inputs, the function will take the +// first one and discard the other values. +func NewProfileProvider(name ...string) Provider { + p := new(ProfileProvider) + if len(name) == 0 { + p.Profile = "default" + } else { + p.Profile = name[0] + } + return p +} + +// Resolve implements the Provider interface +// when credential type is rsa_key_pair, the content of private_key file +// must be able to be parsed directly into the required string +// that NewRsaKeyPairCredential function needed +func (p *ProfileProvider) Resolve() (auth.Credential, error) { + path, ok := os.LookupEnv(ENVCredentialFile) + if !ok { + path, err := checkDefaultPath() + if err != nil { + return nil, err + } + if path == "" { + return nil, nil + } + } else if path == "" { + return nil, errors.New("Environment variable '" + ENVCredentialFile + "' cannot be empty") + } + + ini, err := ini.Load(path) + if err != nil { + return nil, errors.New("ERROR: Can not open file" + err.Error()) + } + + section, err := ini.GetSection(p.Profile) + if err != nil { + return nil, errors.New("ERROR: Can not load section" + err.Error()) + } + + value, err := section.GetKey("type") + if err != nil { + return nil, errors.New("ERROR: Can not find credential type" + err.Error()) + } + + switch value.String() { + case "access_key": + value1, err1 := section.GetKey("access_key_id") + value2, err2 := section.GetKey("access_key_secret") + if err1 != nil || err2 != nil { + return nil, errors.New("ERROR: Failed to get value") + } + if value1.String() == "" || value2.String() == "" { + return nil, errors.New("ERROR: Value can't be empty") + } + return credentials.NewAccessKeyCredential(value1.String(), value2.String()), nil + case "ecs_ram_role": + value1, err1 := section.GetKey("role_name") + if err1 != nil { + return nil, errors.New("ERROR: Failed to get value") + } + if value1.String() == "" { + return nil, errors.New("ERROR: Value can't be empty") + } + return credentials.NewEcsRamRoleCredential(value1.String()), nil + case "ram_role_arn": + value1, err1 := section.GetKey("access_key_id") + value2, err2 := section.GetKey("access_key_secret") + value3, err3 := section.GetKey("role_arn") + value4, err4 := section.GetKey("role_session_name") + if err1 != nil || err2 != nil || err3 != nil || err4 != nil { + return nil, errors.New("ERROR: Failed to get value") + } + if value1.String() == "" || value2.String() == "" || value3.String() == "" || value4.String() == "" { + return nil, errors.New("ERROR: Value can't be empty") + } + return credentials.NewRamRoleArnCredential(value1.String(), value2.String(), value3.String(), value4.String(), 3600), nil + case "rsa_key_pair": + value1, err1 := section.GetKey("public_key_id") + value2, err2 := section.GetKey("private_key_file") + if err1 != nil || err2 != nil { + return nil, errors.New("ERROR: Failed to get value") + } + if value1.String() == "" || value2.String() == "" { + return nil, errors.New("ERROR: Value can't be empty") + } + file, err := os.Open(value2.String()) + if err != nil { + return nil, errors.New("ERROR: Can not get private_key") + } + defer file.Close() + var privateKey string + scan := bufio.NewScanner(file) + var data string + for scan.Scan() { + if strings.HasPrefix(scan.Text(), "----") { + continue + } + data += scan.Text() + "\n" + } + return credentials.NewRsaKeyPairCredential(privateKey, value1.String(), 3600), nil + default: + return nil, errors.New("ERROR: Failed to get credential") + } +} + +// GetHomePath return home directory according to the system. +// if the environmental virables does not exist, will return empty +func GetHomePath() string { + if runtime.GOOS == "windows" { + path, ok := os.LookupEnv("USERPROFILE") + if !ok { + return "" + } + return path + } + path, ok := os.LookupEnv("HOME") + if !ok { + return "" + } + return path +} + +func checkDefaultPath() (path string, err error) { + path = GetHomePath() + if path == "" { + return "", errors.New("The default credential file path is invalid") + } + path = strings.Replace("~/.alibabacloud/credentials", "~", path, 1) + _, err = os.Stat(path) + if err != nil { + return "", nil + } + return path, nil +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider.go new file mode 100644 index 00000000..ae4e168e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider.go @@ -0,0 +1,19 @@ +package provider + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" +) + +//Environmental virables that may be used by the provider +const ( + ENVAccessKeyID = "ALIBABA_CLOUD_ACCESS_KEY_ID" + ENVAccessKeySecret = "ALIBABA_CLOUD_ACCESS_KEY_SECRET" + ENVCredentialFile = "ALIBABA_CLOUD_CREDENTIALS_FILE" + ENVEcsMetadata = "ALIBABA_CLOUD_ECS_METADATA" + PATHCredentialFile = "~/.alibabacloud/credentials" +) + +// When you want to customize the provider, you only need to implement the method of the interface. +type Provider interface { + Resolve() (auth.Credential, error) +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider_chain.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider_chain.go new file mode 100644 index 00000000..3f9315d1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider/provider_chain.go @@ -0,0 +1,34 @@ +package provider + +import ( + "errors" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" +) + +type ProviderChain struct { + Providers []Provider +} + +var defaultproviders = []Provider{ProviderEnv, ProviderProfile, ProviderInstance} +var DefaultChain = NewProviderChain(defaultproviders) + +func NewProviderChain(providers []Provider) Provider { + return &ProviderChain{ + Providers: providers, + } +} + +func (p *ProviderChain) Resolve() (auth.Credential, error) { + for _, provider := range p.Providers { + creds, err := provider.Resolve() + if err != nil { + return nil, err + } else if err == nil && creds == nil { + continue + } + return creds, err + } + return nil, errors.New("No credential found") + +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/sts_role_arn_credential.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/sts_role_arn_credential.go index 7a9db75d..27602fd7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/sts_role_arn_credential.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/sts_role_arn_credential.go @@ -15,6 +15,7 @@ type RamRoleArnCredential struct { RoleArn string RoleSessionName string RoleSessionExpiration int + Policy string } // Deprecated: Use RamRoleArnCredential in this package instead. @@ -47,3 +48,14 @@ func NewRamRoleArnCredential(accessKeyId, accessKeySecret, roleArn, roleSessionN RoleSessionExpiration: roleSessionExpiration, } } + +func NewRamRoleArnWithPolicyCredential(accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string, roleSessionExpiration int) *RamRoleArnCredential { + return &RamRoleArnCredential{ + AccessKeyId: accessKeyId, + AccessKeySecret: accessKeySecret, + RoleArn: roleArn, + RoleSessionName: roleSessionName, + RoleSessionExpiration: roleSessionExpiration, + Policy: policy, + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go index 8666dd06..8b4037a0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/roa_signature_composer.go @@ -16,22 +16,33 @@ package auth import ( "bytes" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" "sort" "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) +var debug utils.Debug + +var hookGetDate = func(fn func() string) string { + return fn() +} + +func init() { + debug = utils.Init("sdk") +} + func signRoaRequest(request requests.AcsRequest, signer Signer, regionId string) (err error) { completeROASignParams(request, signer, regionId) stringToSign := buildRoaStringToSign(request) request.SetStringToSign(stringToSign) - signature := signer.Sign(stringToSign, "") accessKeyId, err := signer.GetAccessKeyId() if err != nil { - return nil + return err } + signature := signer.Sign(stringToSign, "") request.GetHeaders()["Authorization"] = "acs " + accessKeyId + ":" + signature return @@ -51,13 +62,16 @@ func completeROASignParams(request requests.AcsRequest, signer Signer, regionId headerParams["x-acs-security-token"] = value continue } - + if key == "BearerToken" { + headerParams["x-acs-bearer-token"] = value + continue + } queryParams[key] = value } } // complete header params - headerParams["Date"] = utils.GetTimeInFormatRFC2616() + headerParams["Date"] = hookGetDate(utils.GetTimeInFormatRFC2616) headerParams["x-acs-signature-method"] = signer.GetName() headerParams["x-acs-signature-version"] = signer.GetVersion() if request.GetFormParams() != nil && len(request.GetFormParams()) > 0 { @@ -110,6 +124,7 @@ func buildRoaStringToSign(request requests.AcsRequest) (stringToSign string) { // append query params stringToSignBuilder.WriteString(request.BuildQueries()) stringToSign = stringToSignBuilder.String() + debug("stringToSign: %s", stringToSign) return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go index 0c6f6d11..33967b9e 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/rpc_signature_composer.go @@ -15,13 +15,17 @@ package auth import ( + "net/url" + "strings" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" - "net/url" - "sort" - "strings" ) +var hookGetNonce = func(fn func() string) string { + return fn() +} + func signRpcRequest(request requests.AcsRequest, signer Signer, regionId string) (err error) { err = completeRpcSignParams(request, signer, regionId) if err != nil { @@ -44,11 +48,11 @@ func completeRpcSignParams(request requests.AcsRequest, signer Signer, regionId queryParams["Version"] = request.GetVersion() queryParams["Action"] = request.GetActionName() queryParams["Format"] = request.GetAcceptFormat() - queryParams["Timestamp"] = utils.GetTimeInFormatISO8601() + queryParams["Timestamp"] = hookGetDate(utils.GetTimeInFormatISO8601) queryParams["SignatureMethod"] = signer.GetName() queryParams["SignatureType"] = signer.GetType() queryParams["SignatureVersion"] = signer.GetVersion() - queryParams["SignatureNonce"] = utils.GetUUIDV4() + queryParams["SignatureNonce"] = hookGetNonce(utils.GetUUID) queryParams["AccessKeyId"], err = signer.GetAccessKeyId() if err != nil { @@ -80,12 +84,6 @@ func buildRpcStringToSign(request requests.AcsRequest) (stringToSign string) { signParams[key] = value } - // sort params by key - var paramKeySlice []string - for key := range signParams { - paramKeySlice = append(paramKeySlice, key) - } - sort.Strings(paramKeySlice) stringToSign = utils.GetUrlFormedMap(signParams) stringToSign = strings.Replace(stringToSign, "+", "%20", -1) stringToSign = strings.Replace(stringToSign, "*", "%2A", -1) diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signer.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signer.go index ba946d0f..cbbc3cef 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signer.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signer.go @@ -16,12 +16,13 @@ package auth import ( "fmt" + "reflect" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "reflect" ) type Signer interface { @@ -31,20 +32,22 @@ type Signer interface { GetAccessKeyId() (string, error) GetExtraParam() map[string]string Sign(stringToSign, secretSuffix string) string - Shutdown() } func NewSignerWithCredential(credential Credential, commonApi func(request *requests.CommonRequest, signer interface{}) (response *responses.CommonResponse, err error)) (signer Signer, err error) { switch instance := credential.(type) { case *credentials.AccessKeyCredential: { - signer, err = signers.NewAccessKeySigner(instance) + signer = signers.NewAccessKeySigner(instance) } case *credentials.StsTokenCredential: { - signer, err = signers.NewStsTokenSigner(instance) + signer = signers.NewStsTokenSigner(instance) + } + case *credentials.BearerTokenCredential: + { + signer = signers.NewBearerTokenSigner(instance) } - case *credentials.RamRoleArnCredential: { signer, err = signers.NewRamRoleArnSigner(instance, commonApi) @@ -55,11 +58,11 @@ func NewSignerWithCredential(credential Credential, commonApi func(request *requ } case *credentials.EcsRamRoleCredential: { - signer, err = signers.NewEcsRamRoleSigner(instance, commonApi) + signer = signers.NewEcsRamRoleSigner(instance, commonApi) } case *credentials.BaseCredential: // deprecated user interface { - signer, err = signers.NewAccessKeySigner(instance.ToAccessKeyCredential()) + signer = signers.NewAccessKeySigner(instance.ToAccessKeyCredential()) } case *credentials.StsRoleArnCredential: // deprecated user interface { @@ -67,7 +70,7 @@ func NewSignerWithCredential(credential Credential, commonApi func(request *requ } case *credentials.StsRoleNameOnEcsCredential: // deprecated user interface { - signer, err = signers.NewEcsRamRoleSigner(instance.ToEcsRamRoleCredential(), commonApi) + signer = signers.NewEcsRamRoleSigner(instance.ToEcsRamRoleCredential(), commonApi) } default: message := fmt.Sprintf(errors.UnsupportedCredentialErrorMessage, reflect.TypeOf(credential)) @@ -80,7 +83,7 @@ func Sign(request requests.AcsRequest, signer Signer, regionId string) (err erro switch request.GetStyle() { case requests.ROA: { - signRoaRequest(request, signer, regionId) + err = signRoaRequest(request, signer, regionId) } case requests.RPC: { diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/algorithms.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/algorithms.go index 975e985b..887f5020 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/algorithms.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/algorithms.go @@ -22,11 +22,7 @@ import ( "crypto/sha1" "crypto/x509" "encoding/base64" - "fmt" - /*"encoding/pem" - "io/ioutil" - "os/user" - "crypto/sha256"*/) +) func ShaHmac1(source, secret string) string { key := []byte(secret) @@ -38,13 +34,14 @@ func ShaHmac1(source, secret string) string { } func Sha256WithRsa(source, secret string) string { + // block, _ := pem.Decode([]byte(secret)) decodeString, err := base64.StdEncoding.DecodeString(secret) if err != nil { - fmt.Println("DecodeString err", err) + panic(err) } private, err := x509.ParsePKCS8PrivateKey(decodeString) if err != nil { - fmt.Println("ParsePKCS8PrivateKey err", err) + panic(err) } h := crypto.Hash.New(crypto.SHA256) @@ -53,11 +50,8 @@ func Sha256WithRsa(source, secret string) string { signature, err := rsa.SignPKCS1v15(rand.Reader, private.(*rsa.PrivateKey), crypto.SHA256, hashed) if err != nil { - fmt.Println("Error from signing:", err) - return "" + panic(err) } - signedString := base64.StdEncoding.EncodeToString(signature) - //fmt.Printf("Encoded: %v\n", signedString) - return signedString + return base64.StdEncoding.EncodeToString(signature) } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/credential_updater.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/credential_updater.go index bb73d244..ba291a41 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/credential_updater.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/credential_updater.go @@ -15,12 +15,13 @@ package signers import ( + "time" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "time" ) -const defaultInAdvanceScale = 0.8 +const defaultInAdvanceScale = 0.95 type credentialUpdater struct { credentialExpiration int diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_access_key.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_access_key.go index 92466ea5..bc4f35b8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_access_key.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_access_key.go @@ -26,10 +26,10 @@ func (signer *AccessKeySigner) GetExtraParam() map[string]string { return nil } -func NewAccessKeySigner(credential *credentials.AccessKeyCredential) (*AccessKeySigner, error) { +func NewAccessKeySigner(credential *credentials.AccessKeyCredential) *AccessKeySigner { return &AccessKeySigner{ credential: credential, - }, nil + } } func (*AccessKeySigner) GetName() string { @@ -52,7 +52,3 @@ func (signer *AccessKeySigner) Sign(stringToSign, secretSuffix string) string { secret := signer.credential.AccessKeySecret + secretSuffix return ShaHmac1(stringToSign, secret) } - -func (signer *AccessKeySigner) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_bearer_token.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_bearer_token.go new file mode 100644 index 00000000..75b78433 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_bearer_token.go @@ -0,0 +1,35 @@ +package signers + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" +) + +type BearerTokenSigner struct { + credential *credentials.BearerTokenCredential +} + +func NewBearerTokenSigner(credential *credentials.BearerTokenCredential) *BearerTokenSigner { + return &BearerTokenSigner{ + credential: credential, + } +} + +func (signer *BearerTokenSigner) GetExtraParam() map[string]string { + return map[string]string{"BearerToken": signer.credential.BearerToken} +} + +func (*BearerTokenSigner) GetName() string { + return "" +} +func (*BearerTokenSigner) GetType() string { + return "BEARERTOKEN" +} +func (*BearerTokenSigner) GetVersion() string { + return "1.0" +} +func (signer *BearerTokenSigner) GetAccessKeyId() (accessKeyId string, err error) { + return "", nil +} +func (signer *BearerTokenSigner) Sign(stringToSign, secretSuffix string) string { + return "" +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ecs_ram_role.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ecs_ram_role.go index 6cacc140..73788429 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ecs_ram_role.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ecs_ram_role.go @@ -17,15 +17,18 @@ package signers import ( "encoding/json" "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "github.com/jmespath/go-jmespath" "net/http" "strings" "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" + jmespath "github.com/jmespath/go-jmespath" ) +var securityCredURL = "http://100.100.100.200/latest/meta-data/ram/security-credentials/" + type EcsRamRoleSigner struct { *credentialUpdater sessionCredential *SessionCredential @@ -33,7 +36,7 @@ type EcsRamRoleSigner struct { commonApi func(request *requests.CommonRequest, signer interface{}) (response *responses.CommonResponse, err error) } -func NewEcsRamRoleSigner(credential *credentials.EcsRamRoleCredential, commonApi func(*requests.CommonRequest, interface{}) (response *responses.CommonResponse, err error)) (signer *EcsRamRoleSigner, err error) { +func NewEcsRamRoleSigner(credential *credentials.EcsRamRoleCredential, commonApi func(*requests.CommonRequest, interface{}) (response *responses.CommonResponse, err error)) (signer *EcsRamRoleSigner) { signer = &EcsRamRoleSigner{ credential: credential, commonApi: commonApi, @@ -46,7 +49,7 @@ func NewEcsRamRoleSigner(credential *credentials.EcsRamRoleCredential, commonApi refreshApi: signer.refreshApi, } - return + return signer } func (*EcsRamRoleSigner) GetName() string { @@ -64,9 +67,12 @@ func (*EcsRamRoleSigner) GetVersion() string { func (signer *EcsRamRoleSigner) GetAccessKeyId() (accessKeyId string, err error) { if signer.sessionCredential == nil || signer.needUpdateCredential() { err = signer.updateCredential() + if err != nil { + return + } } - if err != nil && (signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0) { - return "", err + if signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0 { + return "", nil } return signer.sessionCredential.AccessKeyId, nil } @@ -82,76 +88,66 @@ func (signer *EcsRamRoleSigner) GetExtraParam() map[string]string { } func (signer *EcsRamRoleSigner) Sign(stringToSign, secretSuffix string) string { - secret := signer.sessionCredential.AccessKeyId + secretSuffix + secret := signer.sessionCredential.AccessKeySecret + secretSuffix return ShaHmac1(stringToSign, secret) } func (signer *EcsRamRoleSigner) buildCommonRequest() (request *requests.CommonRequest, err error) { - request = requests.NewCommonRequest() return } func (signer *EcsRamRoleSigner) refreshApi(request *requests.CommonRequest) (response *responses.CommonResponse, err error) { - requestUrl := "http://100.100.100.200/latest/meta-data/ram/security-credentials/" + signer.credential.RoleName + requestUrl := securityCredURL + signer.credential.RoleName httpRequest, err := http.NewRequest(requests.GET, requestUrl, strings.NewReader("")) if err != nil { - fmt.Println("refresh Ecs sts token err", err) + err = fmt.Errorf("refresh Ecs sts token err: %s", err.Error()) return } httpClient := &http.Client{} httpResponse, err := httpClient.Do(httpRequest) if err != nil { - fmt.Println("refresh Ecs sts token err", err) + err = fmt.Errorf("refresh Ecs sts token err: %s", err.Error()) return } response = responses.NewCommonResponse() err = responses.Unmarshal(response, httpResponse, "") - return } func (signer *EcsRamRoleSigner) refreshCredential(response *responses.CommonResponse) (err error) { if response.GetHttpStatus() != http.StatusOK { - fmt.Println("refresh Ecs sts token err, httpStatus: " + string(response.GetHttpStatus()) + ", message = " + response.GetHttpContentString()) - return + return fmt.Errorf("refresh Ecs sts token err, httpStatus: %d, message = %s", response.GetHttpStatus(), response.GetHttpContentString()) } var data interface{} err = json.Unmarshal(response.GetHttpContentBytes(), &data) if err != nil { - fmt.Println("refresh Ecs sts token err, json.Unmarshal fail", err) - return + return fmt.Errorf("refresh Ecs sts token err, json.Unmarshal fail: %s", err.Error()) } code, err := jmespath.Search("Code", data) if err != nil { - fmt.Println("refresh Ecs sts token err, fail to get Code", err) - return + return fmt.Errorf("refresh Ecs sts token err, fail to get Code: %s", err.Error()) } if code.(string) != "Success" { - fmt.Println("refresh Ecs sts token err, Code is not Success", err) - return + return fmt.Errorf("refresh Ecs sts token err, Code is not Success") } accessKeyId, err := jmespath.Search("AccessKeyId", data) if err != nil { - fmt.Println("refresh Ecs sts token err, fail to get AccessKeyId", err) - return + return fmt.Errorf("refresh Ecs sts token err, fail to get AccessKeyId: %s", err.Error()) } accessKeySecret, err := jmespath.Search("AccessKeySecret", data) if err != nil { - fmt.Println("refresh Ecs sts token err, fail to get AccessKeySecret", err) - return + return fmt.Errorf("refresh Ecs sts token err, fail to get AccessKeySecret: %s", err.Error()) } securityToken, err := jmespath.Search("SecurityToken", data) if err != nil { - fmt.Println("refresh Ecs sts token err, fail to get SecurityToken", err) - return + return fmt.Errorf("refresh Ecs sts token err, fail to get SecurityToken: %s", err.Error()) } expiration, err := jmespath.Search("Expiration", data) if err != nil { - fmt.Println("refresh Ecs sts token err, fail to get Expiration", err) - return + return fmt.Errorf("refresh Ecs sts token err, fail to get Expiration: %s", err.Error()) } - if accessKeyId == nil || accessKeySecret == nil || securityToken == nil { + if accessKeyId == nil || accessKeySecret == nil || securityToken == nil || expiration == nil { return } @@ -169,7 +165,3 @@ func (signer *EcsRamRoleSigner) refreshCredential(response *responses.CommonResp func (signer *EcsRamRoleSigner) GetSessionCredential() *SessionCredential { return signer.sessionCredential } - -func (signer *EcsRamRoleSigner) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_key_pair.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_key_pair.go index c5fe3945..19273d5a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_key_pair.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_key_pair.go @@ -17,13 +17,14 @@ package signers import ( "encoding/json" "fmt" + "net/http" + "strconv" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "github.com/jmespath/go-jmespath" - "net/http" - "strconv" + jmespath "github.com/jmespath/go-jmespath" ) type SignerKeyPair struct { @@ -70,28 +71,33 @@ func (*SignerKeyPair) GetVersion() string { return "1.0" } -func (signer *SignerKeyPair) GetAccessKeyId() (accessKeyId string, err error) { +func (signer *SignerKeyPair) ensureCredential() error { if signer.sessionCredential == nil || signer.needUpdateCredential() { - err = signer.updateCredential() + return signer.updateCredential() } - if err != nil && (signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0) { - return "", err + return nil +} + +func (signer *SignerKeyPair) GetAccessKeyId() (accessKeyId string, err error) { + err = signer.ensureCredential() + if err != nil { + return } - return signer.sessionCredential.AccessKeyId, err + if signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0 { + accessKeyId = "" + return + } + + accessKeyId = signer.sessionCredential.AccessKeyId + return } func (signer *SignerKeyPair) GetExtraParam() map[string]string { - if signer.sessionCredential == nil || signer.needUpdateCredential() { - signer.updateCredential() - } - if signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0 { - return make(map[string]string) - } return make(map[string]string) } func (signer *SignerKeyPair) Sign(stringToSign, secretSuffix string) string { - secret := signer.sessionCredential.AccessKeyId + secretSuffix + secret := signer.sessionCredential.AccessKeySecret + secretSuffix return ShaHmac1(stringToSign, secret) } @@ -101,14 +107,15 @@ func (signer *SignerKeyPair) buildCommonRequest() (request *requests.CommonReque request.Version = "2015-04-01" request.ApiName = "GenerateSessionAccessKey" request.Scheme = requests.HTTPS + request.SetDomain("sts.ap-northeast-1.aliyuncs.com") request.QueryParams["PublicKeyId"] = signer.credential.PublicKeyId request.QueryParams["DurationSeconds"] = strconv.Itoa(signer.credentialExpiration) return } -func (signerKeyPair *SignerKeyPair) refreshApi(request *requests.CommonRequest) (response *responses.CommonResponse, err error) { - signerV2, err := NewSignerV2(signerKeyPair.credential) - return signerKeyPair.commonApi(request, signerV2) +func (signer *SignerKeyPair) refreshApi(request *requests.CommonRequest) (response *responses.CommonResponse, err error) { + signerV2 := NewSignerV2(signer.credential) + return signer.commonApi(request, signerV2) } func (signer *SignerKeyPair) refreshCredential(response *responses.CommonResponse) (err error) { @@ -120,18 +127,15 @@ func (signer *SignerKeyPair) refreshCredential(response *responses.CommonRespons var data interface{} err = json.Unmarshal(response.GetHttpContentBytes(), &data) if err != nil { - fmt.Println("refresh KeyPair err, json.Unmarshal fail", err) - return + return fmt.Errorf("refresh KeyPair err, json.Unmarshal fail: %s", err.Error()) } accessKeyId, err := jmespath.Search("SessionAccessKey.SessionAccessKeyId", data) if err != nil { - fmt.Println("refresh KeyPair err, fail to get SessionAccessKeyId", err) - return + return fmt.Errorf("refresh KeyPair err, fail to get SessionAccessKeyId: %s", err.Error()) } accessKeySecret, err := jmespath.Search("SessionAccessKey.SessionAccessKeySecret", data) if err != nil { - fmt.Println("refresh KeyPair err, fail to get SessionAccessKeySecret", err) - return + return fmt.Errorf("refresh KeyPair err, fail to get SessionAccessKeySecret: %s", err.Error()) } if accessKeyId == nil || accessKeySecret == nil { return @@ -142,7 +146,3 @@ func (signer *SignerKeyPair) refreshCredential(response *responses.CommonRespons } return } - -func (signer *SignerKeyPair) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ram_role_arn.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ram_role_arn.go index bfcaa957..c945c8ae 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ram_role_arn.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_ram_role_arn.go @@ -17,14 +17,15 @@ package signers import ( "encoding/json" "fmt" + "net/http" + "strconv" + "time" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "github.com/jmespath/go-jmespath" - "net/http" - "strconv" - "time" + jmespath "github.com/jmespath/go-jmespath" ) const ( @@ -84,10 +85,15 @@ func (*RamRoleArnSigner) GetVersion() string { func (signer *RamRoleArnSigner) GetAccessKeyId() (accessKeyId string, err error) { if signer.sessionCredential == nil || signer.needUpdateCredential() { err = signer.updateCredential() + if err != nil { + return + } } - if err != nil && (signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0) { + + if signer.sessionCredential == nil || len(signer.sessionCredential.AccessKeyId) <= 0 { return "", err } + return signer.sessionCredential.AccessKeyId, nil } @@ -113,6 +119,9 @@ func (signer *RamRoleArnSigner) buildCommonRequest() (request *requests.CommonRe request.ApiName = "AssumeRole" request.Scheme = requests.HTTPS request.QueryParams["RoleArn"] = signer.credential.RoleArn + if signer.credential.Policy != "" { + request.QueryParams["Policy"] = signer.credential.Policy + } request.QueryParams["RoleSessionName"] = signer.credential.RoleSessionName request.QueryParams["DurationSeconds"] = strconv.Itoa(signer.credentialExpiration) return @@ -123,7 +132,7 @@ func (signer *RamRoleArnSigner) refreshApi(request *requests.CommonRequest) (res AccessKeyId: signer.credential.AccessKeyId, AccessKeySecret: signer.credential.AccessKeySecret, } - signerV1, err := NewAccessKeySigner(credential) + signerV1 := NewAccessKeySigner(credential) return signer.commonApi(request, signerV1) } @@ -136,23 +145,19 @@ func (signer *RamRoleArnSigner) refreshCredential(response *responses.CommonResp var data interface{} err = json.Unmarshal(response.GetHttpContentBytes(), &data) if err != nil { - fmt.Println("refresh RoleArn sts token err, json.Unmarshal fail", err) - return + return fmt.Errorf("refresh RoleArn sts token err, json.Unmarshal fail: %s", err.Error()) } accessKeyId, err := jmespath.Search("Credentials.AccessKeyId", data) if err != nil { - fmt.Println("refresh RoleArn sts token err, fail to get AccessKeyId", err) - return + return fmt.Errorf("refresh RoleArn sts token err, fail to get AccessKeyId: %s", err.Error()) } accessKeySecret, err := jmespath.Search("Credentials.AccessKeySecret", data) if err != nil { - fmt.Println("refresh RoleArn sts token err, fail to get AccessKeySecret", err) - return + return fmt.Errorf("refresh RoleArn sts token err, fail to get AccessKeySecret: %s", err.Error()) } securityToken, err := jmespath.Search("Credentials.SecurityToken", data) if err != nil { - fmt.Println("refresh RoleArn sts token err, fail to get SecurityToken", err) - return + return fmt.Errorf("refresh RoleArn sts token err, fail to get SecurityToken: %s", err.Error()) } if accessKeyId == nil || accessKeySecret == nil || securityToken == nil { return @@ -168,7 +173,3 @@ func (signer *RamRoleArnSigner) refreshCredential(response *responses.CommonResp func (signer *RamRoleArnSigner) GetSessionCredential() *SessionCredential { return signer.sessionCredential } - -func (signer *RamRoleArnSigner) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_sts_token.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_sts_token.go index 9e178d0f..d0ce36c3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_sts_token.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_sts_token.go @@ -22,10 +22,10 @@ type StsTokenSigner struct { credential *credentials.StsTokenCredential } -func NewStsTokenSigner(credential *credentials.StsTokenCredential) (*StsTokenSigner, error) { +func NewStsTokenSigner(credential *credentials.StsTokenCredential) *StsTokenSigner { return &StsTokenSigner{ credential: credential, - }, nil + } } func (*StsTokenSigner) GetName() string { @@ -52,7 +52,3 @@ func (signer *StsTokenSigner) Sign(stringToSign, secretSuffix string) string { secret := signer.credential.AccessKeySecret + secretSuffix return ShaHmac1(stringToSign, secret) } - -func (signer *StsTokenSigner) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_v2.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_v2.go index 1814fe7b..97348529 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_v2.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/signers/signer_v2.go @@ -26,10 +26,10 @@ func (signer *SignerV2) GetExtraParam() map[string]string { return nil } -func NewSignerV2(credential *credentials.RsaKeyPairCredential) (*SignerV2, error) { +func NewSignerV2(credential *credentials.RsaKeyPairCredential) *SignerV2 { return &SignerV2{ credential: credential, - }, nil + } } func (*SignerV2) GetName() string { @@ -52,7 +52,3 @@ func (signer *SignerV2) Sign(stringToSign, secretSuffix string) string { secret := signer.credential.PrivateKey return Sha256WithRsa(stringToSign, secret) } - -func (signer *SignerV2) Shutdown() { - -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go index e204676b..01c2f93b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/client.go @@ -15,28 +15,62 @@ package sdk import ( + "context" + "crypto/tls" "fmt" + "net" + "net/http" + "net/url" + "os" + "runtime" + "strconv" + "strings" + "sync" + "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials/provider" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/auth/credentials" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "net" - "net/http" - "strconv" - "sync" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) -// this value will be replaced while build: -ldflags="-X sdk.version=x.x.x" -var Version = "0.0.1" +var debug utils.Debug +func init() { + debug = utils.Init("sdk") +} + +// Version this value will be replaced while build: -ldflags="-X sdk.version=x.x.x" +var Version = "0.0.1" +var defaultConnectTimeout = 5 * time.Second +var defaultReadTimeout = 10 * time.Second + +var DefaultUserAgent = fmt.Sprintf("AlibabaCloud (%s; %s) Golang/%s Core/%s", runtime.GOOS, runtime.GOARCH, strings.Trim(runtime.Version(), "go"), Version) + +var hookDo = func(fn func(req *http.Request) (*http.Response, error)) func(req *http.Request) (*http.Response, error) { + return fn +} + +// Client the type Client type Client struct { + isInsecure bool regionId string config *Config + httpProxy string + httpsProxy string + noProxy string + logger *Logger + userAgent map[string]string signer auth.Signer httpClient *http.Client asyncTaskQueue chan func() + readTimeout time.Duration + connectTimeout time.Duration debug bool isRunning bool @@ -48,14 +82,56 @@ func (client *Client) Init() (err error) { panic("not support yet") } +func (client *Client) SetHTTPSInsecure(isInsecure bool) { + client.isInsecure = isInsecure +} + +func (client *Client) GetHTTPSInsecure() bool { + return client.isInsecure +} + +func (client *Client) SetHttpsProxy(httpsProxy string) { + client.httpsProxy = httpsProxy +} + +func (client *Client) GetHttpsProxy() string { + return client.httpsProxy +} + +func (client *Client) SetHttpProxy(httpProxy string) { + client.httpProxy = httpProxy +} + +func (client *Client) GetHttpProxy() string { + return client.httpProxy +} + +func (client *Client) SetNoProxy(noProxy string) { + client.noProxy = noProxy +} + +func (client *Client) GetNoProxy() string { + return client.noProxy +} + +// InitWithProviderChain will get credential from the providerChain, +// the RsaKeyPairCredential Only applicable to regionID `ap-northeast-1`, +// if your providerChain may return a credential type with RsaKeyPairCredential, +// please ensure your regionID is `ap-northeast-1`. +func (client *Client) InitWithProviderChain(regionId string, provider provider.Provider) (err error) { + config := client.InitClientConfig() + credential, err := provider.Resolve() + if err != nil { + return + } + return client.InitWithOptions(regionId, config, credential) +} + func (client *Client) InitWithOptions(regionId string, config *Config, credential auth.Credential) (err error) { client.isRunning = true client.asyncChanLock = new(sync.RWMutex) client.regionId = regionId client.config = config - if err != nil { - return - } client.httpClient = &http.Client{} if config.HttpTransport != nil { @@ -75,6 +151,58 @@ func (client *Client) InitWithOptions(regionId string, config *Config, credentia return } +func (client *Client) SetReadTimeout(readTimeout time.Duration) { + client.readTimeout = readTimeout +} + +func (client *Client) SetConnectTimeout(connectTimeout time.Duration) { + client.connectTimeout = connectTimeout +} + +func (client *Client) GetReadTimeout() time.Duration { + return client.readTimeout +} + +func (client *Client) GetConnectTimeout() time.Duration { + return client.connectTimeout +} + +func (client *Client) getHttpProxy(scheme string) (proxy *url.URL, err error) { + if scheme == "https" { + if client.GetHttpsProxy() != "" { + proxy, err = url.Parse(client.httpsProxy) + } else if rawurl := os.Getenv("HTTPS_PROXY"); rawurl != "" { + proxy, err = url.Parse(rawurl) + } else if rawurl := os.Getenv("https_proxy"); rawurl != "" { + proxy, err = url.Parse(rawurl) + } + } else { + if client.GetHttpProxy() != "" { + proxy, err = url.Parse(client.httpProxy) + } else if rawurl := os.Getenv("HTTP_PROXY"); rawurl != "" { + proxy, err = url.Parse(rawurl) + } else if rawurl := os.Getenv("http_proxy"); rawurl != "" { + proxy, err = url.Parse(rawurl) + } + } + + return proxy, err +} + +func (client *Client) getNoProxy(scheme string) []string { + var urls []string + if client.GetNoProxy() != "" { + urls = strings.Split(client.noProxy, ",") + } else if rawurl := os.Getenv("NO_PROXY"); rawurl != "" { + urls = strings.Split(rawurl, ",") + } else if rawurl := os.Getenv("no_proxy"); rawurl != "" { + urls = strings.Split(rawurl, ",") + } + + return urls +} + +// EnableAsync enable the async task queue func (client *Client) EnableAsync(routinePoolSize, maxTaskQueueSize int) { client.asyncTaskQueue = make(chan func(), maxTaskQueueSize) for i := 0; i < routinePoolSize; i++ { @@ -121,6 +249,18 @@ func (client *Client) InitWithRamRoleArn(regionId, accessKeyId, accessKeySecret, return client.InitWithOptions(regionId, config, credential) } +func (client *Client) InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (err error) { + config := client.InitClientConfig() + credential := &credentials.RamRoleArnCredential{ + AccessKeyId: accessKeyId, + AccessKeySecret: accessKeySecret, + RoleArn: roleArn, + RoleSessionName: roleSessionName, + Policy: policy, + } + return client.InitWithOptions(regionId, config, credential) +} + func (client *Client) InitWithRsaKeyPair(regionId, publicKeyId, privateKey string, sessionExpiration int) (err error) { config := client.InitClientConfig() credential := &credentials.RsaKeyPairCredential{ @@ -139,6 +279,14 @@ func (client *Client) InitWithEcsRamRole(regionId, roleName string) (err error) return client.InitWithOptions(regionId, config, credential) } +func (client *Client) InitWithBearerToken(regionId, bearerToken string) (err error) { + config := client.InitClientConfig() + credential := &credentials.BearerTokenCredential{ + BearerToken: bearerToken, + } + return client.InitWithOptions(regionId, config, credential) +} + func (client *Client) InitClientConfig() (config *Config) { if client.config != nil { return client.config @@ -151,7 +299,7 @@ func (client *Client) DoAction(request requests.AcsRequest, response responses.A return client.DoActionWithSigner(request, response, nil) } -func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (err error) { +func (client *Client) buildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (httpRequest *http.Request, err error) { // add clientVersion request.GetHeaders()["x-sdk-core-version"] = Version @@ -174,52 +322,6 @@ func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer return } request.SetDomain(endpoint) - - // init request params - err = requests.InitParams(request) - if err != nil { - return - } - - // signature - var finalSigner auth.Signer - if signer != nil { - finalSigner = signer - } else { - finalSigner = client.signer - } - httpRequest, err := buildHttpRequest(request, finalSigner, regionId) - if client.config.UserAgent != "" { - httpRequest.Header.Set("User-Agent", client.config.UserAgent) - } - return err -} - -func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error) { - - // add clientVersion - request.GetHeaders()["x-sdk-core-version"] = Version - - regionId := client.regionId - if len(request.GetRegionId()) > 0 { - regionId = request.GetRegionId() - } - - // resolve endpoint - resolveParam := &endpoints.ResolveParam{ - Domain: request.GetDomain(), - Product: request.GetProduct(), - RegionId: regionId, - LocationProduct: request.GetLocationServiceCode(), - LocationEndpointType: request.GetLocationEndpointType(), - CommonApi: client.ProcessCommonRequest, - } - endpoint, err := endpoints.Resolve(resolveParam) - if err != nil { - return - } - request.SetDomain(endpoint) - if request.GetScheme() == "" { request.SetScheme(client.config.Scheme) } @@ -236,36 +338,211 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r } else { finalSigner = client.signer } - httpRequest, err := buildHttpRequest(request, finalSigner, regionId) - if client.config.UserAgent != "" { - httpRequest.Header.Set("User-Agent", client.config.UserAgent) + httpRequest, err = buildHttpRequest(request, finalSigner, regionId) + if err == nil { + userAgent := DefaultUserAgent + getSendUserAgent(client.config.UserAgent, client.userAgent, request.GetUserAgent()) + httpRequest.Header.Set("User-Agent", userAgent) } + + return +} + +func getSendUserAgent(configUserAgent string, clientUserAgent, requestUserAgent map[string]string) string { + realUserAgent := "" + for key1, value1 := range clientUserAgent { + for key2, _ := range requestUserAgent { + if key1 == key2 { + key1 = "" + } + } + if key1 != "" { + realUserAgent += fmt.Sprintf(" %s/%s", key1, value1) + + } + } + for key, value := range requestUserAgent { + realUserAgent += fmt.Sprintf(" %s/%s", key, value) + } + if configUserAgent != "" { + return realUserAgent + fmt.Sprintf(" Extra/%s", configUserAgent) + } + return realUserAgent +} + +func (client *Client) AppendUserAgent(key, value string) { + newkey := true + + if client.userAgent == nil { + client.userAgent = make(map[string]string) + } + if strings.ToLower(key) != "core" && strings.ToLower(key) != "go" { + for tag, _ := range client.userAgent { + if tag == key { + client.userAgent[tag] = value + newkey = false + } + } + if newkey { + client.userAgent[key] = value + } + } +} + +func (client *Client) BuildRequestWithSigner(request requests.AcsRequest, signer auth.Signer) (err error) { + _, err = client.buildRequestWithSigner(request, signer) + return +} + +func (client *Client) getTimeout(request requests.AcsRequest) (time.Duration, time.Duration) { + readTimeout := defaultReadTimeout + connectTimeout := defaultConnectTimeout + + reqReadTimeout := request.GetReadTimeout() + reqConnectTimeout := request.GetConnectTimeout() + if reqReadTimeout != 0*time.Millisecond { + readTimeout = reqReadTimeout + } else if client.readTimeout != 0*time.Millisecond { + readTimeout = client.readTimeout + } else if client.httpClient.Timeout != 0 && client.httpClient.Timeout != 10000000000 { + readTimeout = client.httpClient.Timeout + } + + if reqConnectTimeout != 0*time.Millisecond { + connectTimeout = reqConnectTimeout + } else if client.connectTimeout != 0*time.Millisecond { + connectTimeout = client.connectTimeout + } + return readTimeout, connectTimeout +} + +func Timeout(connectTimeout time.Duration) func(cxt context.Context, net, addr string) (c net.Conn, err error) { + return func(ctx context.Context, network, address string) (net.Conn, error) { + return (&net.Dialer{ + Timeout: connectTimeout, + DualStack: true, + }).DialContext(ctx, network, address) + } +} + +func (client *Client) setTimeout(request requests.AcsRequest) { + readTimeout, connectTimeout := client.getTimeout(request) + client.httpClient.Timeout = readTimeout + if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil { + trans.DialContext = Timeout(connectTimeout) + client.httpClient.Transport = trans + } else { + client.httpClient.Transport = &http.Transport{ + DialContext: Timeout(connectTimeout), + } + } +} + +func (client *Client) getHTTPSInsecure(request requests.AcsRequest) (insecure bool) { + if request.GetHTTPSInsecure() != nil { + insecure = *request.GetHTTPSInsecure() + } else { + insecure = client.GetHTTPSInsecure() + } + return insecure +} + +func (client *Client) DoActionWithSigner(request requests.AcsRequest, response responses.AcsResponse, signer auth.Signer) (err error) { + + fieldMap := make(map[string]string) + initLogMsg(fieldMap) + defer func() { + client.printLog(fieldMap, err) + }() + httpRequest, err := client.buildRequestWithSigner(request, signer) if err != nil { return } + + client.setTimeout(request) + proxy, err := client.getHttpProxy(httpRequest.URL.Scheme) + if err != nil { + return err + } + + noProxy := client.getNoProxy(httpRequest.URL.Scheme) + + var flag bool + for _, value := range noProxy { + if value == httpRequest.Host { + flag = true + break + } + } + + // Set whether to ignore certificate validation. + // Default InsecureSkipVerify is false. + if trans, ok := client.httpClient.Transport.(*http.Transport); ok && trans != nil { + trans.TLSClientConfig = &tls.Config{ + InsecureSkipVerify: client.getHTTPSInsecure(request), + } + if proxy != nil && !flag { + trans.Proxy = http.ProxyURL(proxy) + } + client.httpClient.Transport = trans + } + var httpResponse *http.Response for retryTimes := 0; retryTimes <= client.config.MaxRetryTime; retryTimes++ { - httpResponse, err = client.httpClient.Do(httpRequest) + if proxy != nil && proxy.User != nil { + if password, passwordSet := proxy.User.Password(); passwordSet { + httpRequest.SetBasicAuth(proxy.User.Username(), password) + } + } + if retryTimes > 0 { + client.printLog(fieldMap, err) + initLogMsg(fieldMap) + } + putMsgToMap(fieldMap, httpRequest) + debug("> %s %s %s", httpRequest.Method, httpRequest.URL.RequestURI(), httpRequest.Proto) + debug("> Host: %s", httpRequest.Host) + for key, value := range httpRequest.Header { + debug("> %s: %v", key, strings.Join(value, "")) + } + debug(">") + debug(" Retry Times: %d.", retryTimes) - var timeout bool + startTime := time.Now() + fieldMap["{start_time}"] = startTime.Format("2006-01-02 15:04:05") + httpResponse, err = hookDo(client.httpClient.Do)(httpRequest) + fieldMap["{cost}"] = time.Now().Sub(startTime).String() + if err == nil { + fieldMap["{code}"] = strconv.Itoa(httpResponse.StatusCode) + fieldMap["{res_headers}"] = TransToString(httpResponse.Header) + debug("< %s %s", httpResponse.Proto, httpResponse.Status) + for key, value := range httpResponse.Header { + debug("< %s: %v", key, strings.Join(value, "")) + } + } + debug("<") // receive error if err != nil { + debug(" Error: %s.", err.Error()) if !client.config.AutoRetry { return - } else if timeout = isTimeout(err); !timeout { - // if not timeout error, return - return } else if retryTimes >= client.config.MaxRetryTime { // timeout but reached the max retry times, return - timeoutErrorMsg := fmt.Sprintf(errors.TimeoutErrorMessage, strconv.Itoa(retryTimes+1), strconv.Itoa(retryTimes+1)) + times := strconv.Itoa(retryTimes + 1) + timeoutErrorMsg := fmt.Sprintf(errors.TimeoutErrorMessage, times, times) + if strings.Contains(err.Error(), "Client.Timeout") { + timeoutErrorMsg += " Read timeout. Please set a valid ReadTimeout." + } else { + timeoutErrorMsg += " Connect timeout. Please set a valid ConnectTimeout." + } err = errors.NewClientError(errors.TimeoutErrorCode, timeoutErrorMsg, err) return } } // if status code >= 500 or timeout, will trigger retry - if client.config.AutoRetry && (timeout || isServerError(httpResponse)) { + if client.config.AutoRetry && (err != nil || isServerError(httpResponse)) { + client.setTimeout(request) // rewrite signatureNonce and signature - httpRequest, err = buildHttpRequest(request, finalSigner, regionId) + httpRequest, err = client.buildRequestWithSigner(request, signer) + // buildHttpRequest(request, finalSigner, regionId) if err != nil { return } @@ -273,6 +550,7 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r } break } + err = responses.Unmarshal(response, httpResponse, request.GetAcceptFormat()) // wrap server errors if serverErr, ok := err.(*errors.ServerError); ok { @@ -283,6 +561,18 @@ func (client *Client) DoActionWithSigner(request requests.AcsRequest, response r return } +func putMsgToMap(fieldMap map[string]string, request *http.Request) { + fieldMap["{host}"] = request.Host + fieldMap["{method}"] = request.Method + fieldMap["{uri}"] = request.URL.RequestURI() + fieldMap["{pid}"] = strconv.Itoa(os.Getpid()) + fieldMap["{version}"] = strings.Split(request.Proto, "/")[1] + hostname, _ := os.Hostname() + fieldMap["{hostname}"] = hostname + fieldMap["{req_headers}"] = TransToString(request.Header) + fieldMap["{target}"] = request.URL.Path + request.URL.RawQuery +} + func buildHttpRequest(request requests.AcsRequest, singer auth.Signer, regionId string) (httpRequest *http.Request, err error) { err = auth.Sign(request, singer, regionId) if err != nil { @@ -305,14 +595,6 @@ func buildHttpRequest(request requests.AcsRequest, singer auth.Signer, regionId return } -func isTimeout(err error) bool { - if err == nil { - return false - } - netErr, isNetError := err.(net.Error) - return isNetError && netErr.Timeout() -} - func isServerError(httpResponse *http.Response) bool { return httpResponse.StatusCode >= http.StatusInternalServerError } @@ -345,6 +627,18 @@ func NewClient() (client *Client, err error) { return } +func NewClientWithProvider(regionId string, providers ...provider.Provider) (client *Client, err error) { + client = &Client{} + var pc provider.Provider + if len(providers) == 0 { + pc = provider.DefaultChain + } else { + pc = provider.NewProviderChain(providers) + } + err = client.InitWithProviderChain(regionId, pc) + return +} + func NewClientWithOptions(regionId string, config *Config, credential auth.Credential) (client *Client, err error) { client = &Client{} err = client.InitWithOptions(regionId, config, credential) @@ -369,6 +663,12 @@ func NewClientWithRamRoleArn(regionId string, accessKeyId, accessKeySecret, role return } +func NewClientWithRamRoleArnAndPolicy(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy string) (client *Client, err error) { + client = &Client{} + err = client.InitWithRamRoleArnAndPolicy(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName, policy) + return +} + func NewClientWithEcsRamRole(regionId string, roleName string) (client *Client, err error) { client = &Client{} err = client.InitWithEcsRamRole(regionId, roleName) @@ -381,14 +681,10 @@ func NewClientWithRsaKeyPair(regionId string, publicKeyId, privateKey string, se return } -// Deprecated: Use NewClientWithRamRoleArn in this package instead. -func NewClientWithStsRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { - return NewClientWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) -} - -// Deprecated: Use NewClientWithEcsRamRole in this package instead. -func NewClientWithStsRoleNameOnEcs(regionId string, roleName string) (client *Client, err error) { - return NewClientWithEcsRamRole(regionId, roleName) +func NewClientWithBearerToken(regionId, bearerToken string) (client *Client, err error) { + client = &Client{} + err = client.InitWithBearerToken(regionId, bearerToken) + return } func (client *Client) ProcessCommonRequest(request *requests.CommonRequest) (response *responses.CommonResponse, err error) { @@ -404,16 +700,26 @@ func (client *Client) ProcessCommonRequestWithSigner(request *requests.CommonReq response = responses.NewCommonResponse() err = client.DoActionWithSigner(request, response, signer) return - } else { - panic("should not be here") } + panic("should not be here") } func (client *Client) Shutdown() { - client.signer.Shutdown() // lock the addAsync() client.asyncChanLock.Lock() defer client.asyncChanLock.Unlock() + if client.asyncTaskQueue != nil { + close(client.asyncTaskQueue) + } client.isRunning = false - close(client.asyncTaskQueue) +} + +// Deprecated: Use NewClientWithRamRoleArn in this package instead. +func NewClientWithStsRoleArn(regionId string, accessKeyId, accessKeySecret, roleArn, roleSessionName string) (client *Client, err error) { + return NewClientWithRamRoleArn(regionId, accessKeyId, accessKeySecret, roleArn, roleSessionName) +} + +// Deprecated: Use NewClientWithEcsRamRole in this package instead. +func NewClientWithStsRoleNameOnEcs(regionId string, roleName string) (client *Client, err error) { + return NewClientWithEcsRamRole(regionId, roleName) } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/config.go index c67c2ad0..e8862e0c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/config.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/config.go @@ -15,9 +15,10 @@ package sdk import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" "net/http" "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) type Config struct { @@ -39,11 +40,6 @@ func NewConfig() (config *Config) { return } -func (c *Config) WithTimeout(timeout time.Duration) *Config { - c.Timeout = timeout - return c -} - func (c *Config) WithAutoRetry(isAutoRetry bool) *Config { c.AutoRetry = isAutoRetry return c @@ -59,6 +55,16 @@ func (c *Config) WithUserAgent(userAgent string) *Config { return c } +func (c *Config) WithDebug(isDebug bool) *Config { + c.Debug = isDebug + return c +} + +func (c *Config) WithTimeout(timeout time.Duration) *Config { + c.Timeout = timeout + return c +} + func (c *Config) WithHttpTransport(httpTransport *http.Transport) *Config { c.HttpTransport = httpTransport return c @@ -79,7 +85,7 @@ func (c *Config) WithGoRoutinePoolSize(goRoutinePoolSize int) *Config { return c } -func (c *Config) WithDebug(isDebug bool) *Config { - c.Debug = isDebug +func (c *Config) WithScheme(scheme string) *Config { + c.Scheme = scheme return c } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go index ec0d56f6..60adf7d4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/endpoints_config.go @@ -1,3 +1,4 @@ + package endpoints import ( @@ -6,491 +7,1655 @@ import ( "sync" ) -const endpointsJson = "{" + - " \"products\":[" + - " {" + - " \"code\": \"aegis\"," + - " \"document_id\": \"28449\"," + - " \"location_service_code\": \"vipaegis\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"aegis.cn-hangzhou.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"alidns\"," + - " \"document_id\": \"29739\"," + - " \"location_service_code\": \"alidns\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"alidns.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"arms\"," + - " \"document_id\": \"42924\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"ap-southeast-1\"," + - " \"endpoint\": \"arms.ap-southeast-1.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-beijing\"," + - " \"endpoint\": \"arms.cn-beijing.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"arms.cn-hangzhou.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hongkong\"," + - " \"endpoint\": \"arms.cn-hongkong.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-qingdao\"," + - " \"endpoint\": \"arms.cn-qingdao.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shanghai\"," + - " \"endpoint\": \"arms.cn-shanghai.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shenzhen\"," + - " \"endpoint\": \"arms.cn-shenzhen.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"arms.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"batchcompute\"," + - " \"document_id\": \"44717\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"ap-southeast-1\"," + - " \"endpoint\": \"batchcompute.ap-southeast-1.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-beijing\"," + - " \"endpoint\": \"batchcompute.cn-beijing.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"batchcompute.cn-hangzhou.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-huhehaote\"," + - " \"endpoint\": \"batchcompute.cn-huhehaote.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-qingdao\"," + - " \"endpoint\": \"batchcompute.cn-qingdao.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shanghai\"," + - " \"endpoint\": \"batchcompute.cn-shanghai.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shenzhen\"," + - " \"endpoint\": \"batchcompute.cn-shenzhen.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-zhangjiakou\"," + - " \"endpoint\": \"batchcompute.cn-zhangjiakou.aliyuncs.com\"" + - " }, {" + - " \"region\": \"us-west-1\"," + - " \"endpoint\": \"batchcompute.us-west-1.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"batchcompute.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"ccc\"," + - " \"document_id\": \"63027\"," + - " \"location_service_code\": \"ccc\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"ccc.cn-hangzhou.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shanghai\"," + - " \"endpoint\": \"ccc.cn-shanghai.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"ccc.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"cdn\"," + - " \"document_id\": \"27148\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cdn.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"cds\"," + - " \"document_id\": \"62887\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cds.cn-beijing.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"chatbot\"," + - " \"document_id\": \"60760\"," + - " \"location_service_code\": \"beebot\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"chatbot.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"cloudapi\"," + - " \"document_id\": \"43590\"," + - " \"location_service_code\": \"apigateway\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"ap-northeast-1\"," + - " \"endpoint\": \"apigateway.ap-northeast-1.aliyuncs.com\"" + - " }, {" + - " \"region\": \"us-west-1\"," + - " \"endpoint\": \"apigateway.us-west-1.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"apigateway.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"cloudauth\"," + - " \"document_id\": \"60687\"," + - " \"location_service_code\": \"cloudauth\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cloudauth.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"cloudphoto\"," + - " \"document_id\": \"59902\"," + - " \"location_service_code\": \"cloudphoto\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"cloudphoto.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"cloudwf\"," + - " \"document_id\": \"58111\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cloudwf.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"cms\"," + - " \"document_id\": \"28615\"," + - " \"location_service_code\": \"cms\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"cr\"," + - " \"document_id\": \"60716\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cr.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"cs\"," + - " \"document_id\": \"26043\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cs.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"csb\"," + - " \"document_id\": \"64837\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"cn-beijing\"," + - " \"endpoint\": \"csb.cn-beijing.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"csb.cn-hangzhou.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"csb.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"dds\"," + - " \"document_id\": \"61715\"," + - " \"location_service_code\": \"dds\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"mongodb.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"mongodb.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"dm\"," + - " \"document_id\": \"29434\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"ap-southeast-1\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"ap-southeast-2\"," + - " \"endpoint\": \"dm.ap-southeast-2.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-beijing\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-hongkong\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-qingdao\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shanghai\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"cn-shenzhen\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"us-east-1\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }, {" + - " \"region\": \"us-west-1\"," + - " \"endpoint\": \"dm.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"dm.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"dm.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"domain\"," + - " \"document_id\": \"42875\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"domain.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"domain.aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"domain-intl\"," + - " \"document_id\": \"\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"domain-intl.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"domain-intl.aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"drds\"," + - " \"document_id\": \"51111\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"drds.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"drds.aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"ecs\"," + - " \"document_id\": \"25484\"," + - " \"location_service_code\": \"ecs\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"emr\"," + - " \"document_id\": \"28140\"," + - " \"location_service_code\": \"emr\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"emr.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"ess\"," + - " \"document_id\": \"25925\"," + - " \"location_service_code\": \"ess\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"ess.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"green\"," + - " \"document_id\": \"28427\"," + - " \"location_service_code\": \"green\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"green.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"hpc\"," + - " \"document_id\": \"35201\"," + - " \"location_service_code\": \"hpc\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"hpc.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"httpdns\"," + - " \"document_id\": \"52679\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"httpdns-api.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"iot\"," + - " \"document_id\": \"30557\"," + - " \"location_service_code\": \"iot\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"iot.[RegionId].aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"itaas\"," + - " \"document_id\": \"55759\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"itaas.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"jaq\"," + - " \"document_id\": \"35037\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"jaq.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"live\"," + - " \"document_id\": \"48207\"," + - " \"location_service_code\": \"live\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"live.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"mts\"," + - " \"document_id\": \"29212\"," + - " \"location_service_code\": \"mts\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"nas\"," + - " \"document_id\": \"62598\"," + - " \"location_service_code\": \"nas\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"ons\"," + - " \"document_id\": \"44416\"," + - " \"location_service_code\": \"ons\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"polardb\"," + - " \"document_id\": \"58764\"," + - " \"location_service_code\": \"polardb\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"ap-south-1\"," + - " \"endpoint\": \"polardb.ap-south-1.aliyuncs.com\"" + - " }, {" + - " \"region\": \"ap-southeast-5\"," + - " \"endpoint\": \"polardb.ap-southeast-5.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"polardb.aliyuncs.com\"" + - " }," + - " {" + - " \"code\": \"push\"," + - " \"document_id\": \"30074\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"cloudpush.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"qualitycheck\"," + - " \"document_id\": \"50807\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": [ {" + - " \"region\": \"cn-hangzhou\"," + - " \"endpoint\": \"qualitycheck.cn-hangzhou.aliyuncs.com\"" + - " }]," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"r-kvstore\"," + - " \"document_id\": \"60831\"," + - " \"location_service_code\": \"redisa\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"ram\"," + - " \"document_id\": \"28672\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"ram.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"rds\"," + - " \"document_id\": \"26223\"," + - " \"location_service_code\": \"rds\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"ros\"," + - " \"document_id\": \"28899\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"ros.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"sas-api\"," + - " \"document_id\": \"28498\"," + - " \"location_service_code\": \"sas\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"slb\"," + - " \"document_id\": \"27565\"," + - " \"location_service_code\": \"slb\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"sts\"," + - " \"document_id\": \"28756\"," + - " \"location_service_code\": \"\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"sts.aliyuncs.com\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"vod\"," + - " \"document_id\": \"60574\"," + - " \"location_service_code\": \"vod\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"vpc\"," + - " \"document_id\": \"34962\"," + - " \"location_service_code\": \"vpc\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }," + - " {" + - " \"code\": \"waf\"," + - " \"document_id\": \"62847\"," + - " \"location_service_code\": \"waf\"," + - " \"regional_endpoints\": []," + - " \"global_endpoint\": \"\"," + - " \"regional_endpoint_pattern\": \"\"" + - " }]" + - "}" - +const endpointsJson =`{ + "products": [ + { + "code": "ecs", + "document_id": "25484", + "location_service_code": "ecs", + "regional_endpoints": [ + { + "region": "cn-shanghai", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "ecs.eu-west-1.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "ecs.cn-huhehaote.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "ecs.me-east-1.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "ecs.ap-southeast-3.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "ecs.ap-southeast-2.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "ecs.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "ecs.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "ecs.ap-southeast-5.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "ecs.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "ecs.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "ecs-cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "ecs-cn-hangzhou.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "chatbot", + "document_id": "60760", + "location_service_code": "beebot", + "regional_endpoints": [ + { + "region": "cn-shanghai", + "endpoint": "chatbot.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "chatbot.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "chatbot.[RegionId].aliyuncs.com" + }, + { + "code": "alidns", + "document_id": "29739", + "location_service_code": "alidns", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "alidns.aliyuncs.com" + } + ], + "global_endpoint": "alidns.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "itaas", + "document_id": "55759", + "location_service_code": "itaas", + "regional_endpoints": null, + "global_endpoint": "itaas.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "csb", + "document_id": "64837", + "location_service_code": "csb", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "csb.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "csb.cn-beijing.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "csb.[RegionId].aliyuncs.com" + }, + { + "code": "slb", + "document_id": "27565", + "location_service_code": "slb", + "regional_endpoints": [ + { + "region": "cn-hongkong", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "slb.me-east-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "slb.ap-southeast-5.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "slb.ap-southeast-2.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "slb.ap-south-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "slb.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "slb.eu-west-1.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "slb.cn-huhehaote.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "slb.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "slb.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "slb.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "slb.ap-northeast-1.aliyuncs.com" + } + ], + "global_endpoint": "slb.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "cloudwf", + "document_id": "58111", + "location_service_code": "cloudwf", + "regional_endpoints": null, + "global_endpoint": "cloudwf.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "cloudphoto", + "document_id": "59902", + "location_service_code": "cloudphoto", + "regional_endpoints": [ + { + "region": "cn-shanghai", + "endpoint": "cloudphoto.cn-shanghai.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "cloudphoto.[RegionId].aliyuncs.com" + }, + { + "code": "dds", + "document_id": "61715", + "location_service_code": "dds", + "regional_endpoints": [ + { + "region": "ap-southeast-5", + "endpoint": "mongodb.ap-southeast-5.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "mongodb.eu-west-1.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "mongodb.me-east-1.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "mongodb.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "mongodb.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "mongodb.ap-southeast-2.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "mongodb.ap-southeast-3.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "mongodb.ap-south-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "mongodb.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "mongodb.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "mongodb.cn-huhehaote.aliyuncs.com" + } + ], + "global_endpoint": "mongodb.aliyuncs.com", + "regional_endpoint_pattern": "mongodb.[RegionId].aliyuncs.com" + }, + { + "code": "dm", + "document_id": "29434", + "location_service_code": "dm", + "regional_endpoints": [ + { + "region": "ap-southeast-2", + "endpoint": "dm.ap-southeast-2.aliyuncs.com" + } + ], + "global_endpoint": "dm.aliyuncs.com", + "regional_endpoint_pattern": "dm.[RegionId].aliyuncs.com" + }, + { + "code": "ons", + "document_id": "44416", + "location_service_code": "ons", + "regional_endpoints": [ + { + "region": "cn-zhangjiakou", + "endpoint": "ons.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "ons.us-west-1.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "ons.me-east-1.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "ons.us-east-1.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "ons.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "ons.ap-southeast-2.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "ons.ap-southeast-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "ons.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "ons.cn-shenzhen.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "ons.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "ons.cn-hangzhou.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "ons.eu-central-1.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "ons.eu-west-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "ons.cn-beijing.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "ons.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "ons.cn-huhehaote.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "ons.cn-hongkong.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "ons.cn-qingdao.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "polardb", + "document_id": "58764", + "location_service_code": "polardb", + "regional_endpoints": [ + { + "region": "cn-qingdao", + "endpoint": "polardb.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "polardb.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "polardb.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "polardb.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "polardb.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "polardb.cn-huhehaote.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "polardb.ap-southeast-5.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "polardb.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "polardb.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "polardb.aliyuncs.com" + }, + { + "code": "batchcompute", + "document_id": "44717", + "location_service_code": "batchcompute", + "regional_endpoints": [ + { + "region": "us-west-1", + "endpoint": "batchcompute.us-west-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "batchcompute.cn-beijing.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "batchcompute.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "batchcompute.cn-shanghai.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "batchcompute.ap-southeast-1.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "batchcompute.cn-huhehaote.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "batchcompute.cn-qingdao.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "batchcompute.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "batchcompute.cn-shenzhen.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "batchcompute.[RegionId].aliyuncs.com" + }, + { + "code": "cloudauth", + "document_id": "60687", + "location_service_code": "cloudauth", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "cloudauth.aliyuncs.com" + } + ], + "global_endpoint": "cloudauth.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "vod", + "document_id": "60574", + "location_service_code": "vod", + "regional_endpoints": [ + { + "region": "cn-beijing", + "endpoint": "vod.cn-shanghai.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "vod.ap-southeast-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "vod.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "vod.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "vod.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "vod.cn-shanghai.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "ram", + "document_id": "28672", + "location_service_code": "ram", + "regional_endpoints": null, + "global_endpoint": "ram.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "ess", + "document_id": "25925", + "location_service_code": "ess", + "regional_endpoints": [ + { + "region": "me-east-1", + "endpoint": "ess.me-east-1.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "ess.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "ess.ap-south-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "ess.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "ess.cn-huhehaote.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "ess.ap-southeast-2.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "ess.ap-southeast-5.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "ess.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "ess.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "ess.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "ess.eu-west-1.aliyuncs.com" + } + ], + "global_endpoint": "ess.aliyuncs.com", + "regional_endpoint_pattern": "ess.[RegionId].aliyuncs.com" + }, + { + "code": "live", + "document_id": "48207", + "location_service_code": "live", + "regional_endpoints": [ + { + "region": "cn-beijing", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "live.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "live.aliyuncs.com" + } + ], + "global_endpoint": "live.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "hpc", + "document_id": "35201", + "location_service_code": "hpc", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "hpc.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "hpc.aliyuncs.com" + } + ], + "global_endpoint": "hpc.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "rds", + "document_id": "26223", + "location_service_code": "rds", + "regional_endpoints": [ + { + "region": "me-east-1", + "endpoint": "rds.me-east-1.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "rds.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "rds.ap-southeast-3.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "rds.ap-southeast-2.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "rds.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "rds.ap-southeast-5.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "rds.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "rds.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "rds.eu-west-1.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "rds.cn-huhehaote.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "rds.ap-northeast-1.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "rds.aliyuncs.com" + } + ], + "global_endpoint": "rds.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "cloudapi", + "document_id": "43590", + "location_service_code": "apigateway", + "regional_endpoints": [ + { + "region": "cn-beijing", + "endpoint": "apigateway.cn-beijing.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "apigateway.ap-southeast-2.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "apigateway.ap-south-1.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "apigateway.us-east-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "apigateway.cn-shanghai.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "apigateway.us-west-1.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "apigateway.ap-southeast-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "apigateway.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "apigateway.cn-qingdao.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "apigateway.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "apigateway.cn-huhehaote.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "apigateway.eu-west-1.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "apigateway.me-east-1.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "apigateway.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "apigateway.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "apigateway.ap-southeast-5.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "apigateway.cn-hongkong.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "apigateway.cn-shenzhen.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "apigateway.ap-southeast-3.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "apigateway.[RegionId].aliyuncs.com" + }, + { + "code": "sas-api", + "document_id": "28498", + "location_service_code": "sas", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "sas.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "cs", + "document_id": "26043", + "location_service_code": "cs", + "regional_endpoints": null, + "global_endpoint": "cs.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "jaq", + "document_id": "35037", + "location_service_code": "jaq", + "regional_endpoints": null, + "global_endpoint": "jaq.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "r-kvstore", + "document_id": "60831", + "location_service_code": "redisa", + "regional_endpoints": [ + { + "region": "cn-huhehaote", + "endpoint": "r-kvstore.cn-huhehaote.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "r-kvstore.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "r-kvstore.ap-south-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "r-kvstore.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "r-kvstore.me-east-1.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "r-kvstore.ap-northeast-1.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "r-kvstore.cn-hongkong.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "r-kvstore.ap-southeast-2.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "r-kvstore.eu-west-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "r-kvstore.ap-southeast-5.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "r-kvstore.ap-southeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "r-kvstore.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "r-kvstore.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "r-kvstore.aliyuncs.com" + } + ], + "global_endpoint": "r-kvstore.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "drds", + "document_id": "51111", + "location_service_code": "drds", + "regional_endpoints": [ + { + "region": "ap-southeast-1", + "endpoint": "drds.ap-southeast-1.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "drds.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "drds.aliyuncs.com", + "regional_endpoint_pattern": "drds.aliyuncs.com" + }, + { + "code": "waf", + "document_id": "62847", + "location_service_code": "waf", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "wafopenapi.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "sts", + "document_id": "28756", + "location_service_code": "sts", + "regional_endpoints": null, + "global_endpoint": "sts.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "cr", + "document_id": "60716", + "location_service_code": "cr", + "regional_endpoints": null, + "global_endpoint": "cr.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "arms", + "document_id": "42924", + "location_service_code": "arms", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "arms.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "arms.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "arms.cn-hongkong.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "arms.ap-southeast-1.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "arms.cn-shenzhen.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "arms.cn-qingdao.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "arms.cn-beijing.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "arms.[RegionId].aliyuncs.com" + }, + { + "code": "iot", + "document_id": "30557", + "location_service_code": "iot", + "regional_endpoints": [ + { + "region": "us-east-1", + "endpoint": "iot.us-east-1.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "iot.ap-northeast-1.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "iot.us-west-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "iot.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "iot.cn-shanghai.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "iot.ap-southeast-1.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "iot.[RegionId].aliyuncs.com" + }, + { + "code": "vpc", + "document_id": "34962", + "location_service_code": "vpc", + "regional_endpoints": [ + { + "region": "us-west-1", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "vpc.cn-huhehaote.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "vpc.me-east-1.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "vpc.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "vpc.ap-southeast-3.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "vpc.eu-central-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "vpc.ap-southeast-5.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "vpc.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "vpc.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "vpc.ap-southeast-2.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "vpc.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "vpc.eu-west-1.aliyuncs.com" + } + ], + "global_endpoint": "vpc.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "aegis", + "document_id": "28449", + "location_service_code": "vipaegis", + "regional_endpoints": [ + { + "region": "ap-southeast-3", + "endpoint": "aegis.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "aegis.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "aegis.cn-hangzhou.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "domain", + "document_id": "42875", + "location_service_code": "domain", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "domain.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "domain-intl.aliyuncs.com" + } + ], + "global_endpoint": "domain.aliyuncs.com", + "regional_endpoint_pattern": "domain.aliyuncs.com" + }, + { + "code": "cdn", + "document_id": "27148", + "location_service_code": "cdn", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "cdn.aliyuncs.com" + } + ], + "global_endpoint": "cdn.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "qualitycheck", + "document_id": "50807", + "location_service_code": "qualitycheck", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "qualitycheck.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "emr", + "document_id": "28140", + "location_service_code": "emr", + "regional_endpoints": [ + { + "region": "us-east-1", + "endpoint": "emr.us-east-1.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "emr.ap-southeast-5.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "emr.eu-central-1.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "emr.eu-west-1.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "emr.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "emr.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "emr.ap-south-1.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "emr.me-east-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "emr.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "emr.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "emr.cn-hongkong.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "emr.cn-huhehaote.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "emr.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "emr.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "emr.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "emr.ap-southeast-2.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "emr.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "emr.cn-qingdao.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "emr.aliyuncs.com" + } + ], + "global_endpoint": "emr.aliyuncs.com", + "regional_endpoint_pattern": "emr.[RegionId].aliyuncs.com" + }, + { + "code": "httpdns", + "document_id": "52679", + "location_service_code": "httpdns", + "regional_endpoints": null, + "global_endpoint": "httpdns-api.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "push", + "document_id": "30074", + "location_service_code": "push", + "regional_endpoints": null, + "global_endpoint": "cloudpush.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "cms", + "document_id": "28615", + "location_service_code": "cms", + "regional_endpoints": [ + { + "region": "cn-qingdao", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "metrics.eu-west-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "metrics.ap-northeast-1.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "metrics.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-5", + "endpoint": "metrics.ap-southeast-5.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "metrics.cn-huhehaote.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "me-east-1", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "metrics.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "metrics.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "metrics.cn-hangzhou.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "nas", + "document_id": "62598", + "location_service_code": "nas", + "regional_endpoints": [ + { + "region": "ap-southeast-5", + "endpoint": "nas.ap-southeast-5.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "nas.ap-south-1.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "nas.us-west-1.aliyuncs.com" + }, + { + "region": "ap-southeast-3", + "endpoint": "nas.ap-southeast-3.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "nas.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "ap-northeast-1", + "endpoint": "nas.ap-northeast-1.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "nas.cn-hangzhou.aliyuncs.com" + }, + { + "region": "cn-qingdao", + "endpoint": "nas.cn-qingdao.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "nas.cn-beijing.aliyuncs.com" + }, + { + "region": "ap-southeast-2", + "endpoint": "nas.ap-southeast-2.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "nas.cn-shenzhen.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "nas.eu-central-1.aliyuncs.com" + }, + { + "region": "cn-huhehaote", + "endpoint": "nas.cn-huhehaote.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "nas.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "nas.cn-hongkong.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "nas.ap-southeast-1.aliyuncs.com" + }, + { + "region": "us-east-1", + "endpoint": "nas.us-east-1.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + }, + { + "code": "cds", + "document_id": "62887", + "location_service_code": "codepipeline", + "regional_endpoints": [ + { + "region": "cn-beijing", + "endpoint": "cds.cn-beijing.aliyuncs.com" + } + ], + "global_endpoint": "cds.cn-beijing.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "green", + "document_id": "28427", + "location_service_code": "green", + "regional_endpoints": [ + { + "region": "us-west-1", + "endpoint": "green.us-west-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "green.cn-beijing.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "green.ap-southeast-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "green.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "green.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "green.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "ccc", + "document_id": "63027", + "location_service_code": "ccc", + "regional_endpoints": [ + { + "region": "cn-shanghai", + "endpoint": "ccc.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "ccc.cn-hangzhou.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "ccc.[RegionId].aliyuncs.com" + }, + { + "code": "ros", + "document_id": "28899", + "location_service_code": "ros", + "regional_endpoints": [ + { + "region": "cn-hangzhou", + "endpoint": "ros.aliyuncs.com" + } + ], + "global_endpoint": "ros.aliyuncs.com", + "regional_endpoint_pattern": "" + }, + { + "code": "mts", + "document_id": "29212", + "location_service_code": "mts", + "regional_endpoints": [ + { + "region": "ap-northeast-1", + "endpoint": "mts.ap-northeast-1.aliyuncs.com" + }, + { + "region": "cn-shanghai", + "endpoint": "mts.cn-shanghai.aliyuncs.com" + }, + { + "region": "cn-hongkong", + "endpoint": "mts.cn-hongkong.aliyuncs.com" + }, + { + "region": "cn-shenzhen", + "endpoint": "mts.cn-shenzhen.aliyuncs.com" + }, + { + "region": "us-west-1", + "endpoint": "mts.us-west-1.aliyuncs.com" + }, + { + "region": "cn-zhangjiakou", + "endpoint": "mts.cn-zhangjiakou.aliyuncs.com" + }, + { + "region": "eu-west-1", + "endpoint": "mts.eu-west-1.aliyuncs.com" + }, + { + "region": "ap-south-1", + "endpoint": "mts.ap-south-1.aliyuncs.com" + }, + { + "region": "cn-beijing", + "endpoint": "mts.cn-beijing.aliyuncs.com" + }, + { + "region": "cn-hangzhou", + "endpoint": "mts.cn-hangzhou.aliyuncs.com" + }, + { + "region": "ap-southeast-1", + "endpoint": "mts.ap-southeast-1.aliyuncs.com" + }, + { + "region": "eu-central-1", + "endpoint": "mts.eu-central-1.aliyuncs.com" + } + ], + "global_endpoint": "", + "regional_endpoint_pattern": "" + } + ] +}` var initOnce sync.Once var data interface{} @@ -498,7 +1663,7 @@ func getEndpointConfigData() interface{} { initOnce.Do(func() { err := json.Unmarshal([]byte(endpointsJson), &data) if err != nil { - fmt.Println("init endpoint config data failed.", err) + panic(fmt.Sprintf("init endpoint config data failed. %s", err)) } }) return data diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_global_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_global_resolver.go index 864b7cc4..160e62cb 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_global_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_global_resolver.go @@ -16,13 +16,19 @@ package endpoints import ( "fmt" - "github.com/jmespath/go-jmespath" "strings" + + "github.com/jmespath/go-jmespath" ) type LocalGlobalResolver struct { } +func (resolver *LocalGlobalResolver) GetName() (name string) { + name = "local global resolver" + return +} + func (resolver *LocalGlobalResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) { // get the global endpoints configs endpointExpression := fmt.Sprintf("products[?code=='%s'].global_endpoint", strings.ToLower(param.Product)) @@ -30,7 +36,7 @@ func (resolver *LocalGlobalResolver) TryResolve(param *ResolveParam) (endpoint s if err == nil && endpointData != nil && len(endpointData.([]interface{})) > 0 { endpoint = endpointData.([]interface{})[0].(string) support = len(endpoint) > 0 - return endpoint, support, nil + return } support = false return diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_regional_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_regional_resolver.go index f8aa0f92..7fee64d4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_regional_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/local_regional_resolver.go @@ -16,24 +16,31 @@ package endpoints import ( "fmt" - "github.com/jmespath/go-jmespath" "strings" + + "github.com/jmespath/go-jmespath" ) type LocalRegionalResolver struct { } +func (resolver *LocalRegionalResolver) GetName() (name string) { + name = "local regional resolver" + return +} + func (resolver *LocalRegionalResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) { // get the regional endpoints configs regionalExpression := fmt.Sprintf("products[?code=='%s'].regional_endpoints", strings.ToLower(param.Product)) regionalData, err := jmespath.Search(regionalExpression, getEndpointConfigData()) if err == nil && regionalData != nil && len(regionalData.([]interface{})) > 0 { endpointExpression := fmt.Sprintf("[0][?region=='%s'].endpoint", strings.ToLower(param.RegionId)) - endpointData, err := jmespath.Search(endpointExpression, regionalData) + var endpointData interface{} + endpointData, err = jmespath.Search(endpointExpression, regionalData) if err == nil && endpointData != nil && len(endpointData.([]interface{})) > 0 { endpoint = endpointData.([]interface{})[0].(string) support = len(endpoint) > 0 - return endpoint, support, nil + return } } support = false diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go index 803bc57d..cc354cc4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/location_resolver.go @@ -15,28 +15,51 @@ package endpoints import ( "encoding/json" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "sync" "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" ) const ( + // EndpointCacheExpireTime ... EndpointCacheExpireTime = 3600 //Seconds ) -var lastClearTimePerProduct = struct { +// Cache caches endpoint for specific product and region +type Cache struct { sync.RWMutex - cache map[string]int64 -}{cache: make(map[string]int64)} + cache map[string]interface{} +} -var endpointCache = struct { - sync.RWMutex - cache map[string]string -}{cache: make(map[string]string)} +// Get ... +func (c *Cache) Get(k string) (v interface{}) { + c.RLock() + v = c.cache[k] + c.RUnlock() + return +} +// Set ... +func (c *Cache) Set(k string, v interface{}) { + c.Lock() + c.cache[k] = v + c.Unlock() +} + +var lastClearTimePerProduct = &Cache{cache: make(map[string]interface{})} +var endpointCache = &Cache{cache: make(map[string]interface{})} + +// LocationResolver ... type LocationResolver struct { } +func (resolver *LocationResolver) GetName() (name string) { + name = "location resolver" + return +} + +// TryResolve resolves endpoint giving product and region func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) { if len(param.LocationProduct) <= 0 { support = false @@ -45,8 +68,10 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri //get from cache cacheKey := param.Product + "#" + param.RegionId - if endpointCache.cache != nil && len(endpointCache.cache[cacheKey]) > 0 && !CheckCacheIsExpire(cacheKey) { - endpoint = endpointCache.cache[cacheKey] + var ok bool + endpoint, ok = endpointCache.Get(cacheKey).(string) + + if ok && len(endpoint) > 0 && !CheckCacheIsExpire(cacheKey) { support = true return } @@ -57,7 +82,7 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri getEndpointRequest.Product = "Location" getEndpointRequest.Version = "2015-06-12" getEndpointRequest.ApiName = "DescribeEndpoints" - getEndpointRequest.Domain = "location.aliyuncs.com" + getEndpointRequest.Domain = "location-readonly.aliyuncs.com" getEndpointRequest.Method = "GET" getEndpointRequest.Scheme = requests.HTTPS @@ -70,13 +95,23 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri } response, err := param.CommonApi(getEndpointRequest) - var getEndpointResponse GetEndpointResponse + if err != nil { + support = false + return + } + if !response.IsSuccess() { support = false return } - json.Unmarshal([]byte(response.GetHttpContentString()), &getEndpointResponse) + var getEndpointResponse GetEndpointResponse + err = json.Unmarshal([]byte(response.GetHttpContentString()), &getEndpointResponse) + if err != nil { + support = false + return + } + if !getEndpointResponse.Success || getEndpointResponse.Endpoints == nil { support = false return @@ -87,12 +122,8 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri } if len(getEndpointResponse.Endpoints.Endpoint[0].Endpoint) > 0 { endpoint = getEndpointResponse.Endpoints.Endpoint[0].Endpoint - endpointCache.Lock() - endpointCache.cache[cacheKey] = endpoint - endpointCache.Unlock() - lastClearTimePerProduct.Lock() - lastClearTimePerProduct.cache[cacheKey] = time.Now().Unix() - lastClearTimePerProduct.Unlock() + endpointCache.Set(cacheKey, endpoint) + lastClearTimePerProduct.Set(cacheKey, time.Now().Unix()) support = true return } @@ -101,13 +132,16 @@ func (resolver *LocationResolver) TryResolve(param *ResolveParam) (endpoint stri return } +// CheckCacheIsExpire ... func CheckCacheIsExpire(cacheKey string) bool { - lastClearTime := lastClearTimePerProduct.cache[cacheKey] + lastClearTime, ok := lastClearTimePerProduct.Get(cacheKey).(int64) + if !ok { + return true + } + if lastClearTime <= 0 { lastClearTime = time.Now().Unix() - lastClearTimePerProduct.Lock() - lastClearTimePerProduct.cache[cacheKey] = lastClearTime - lastClearTimePerProduct.Unlock() + lastClearTimePerProduct.Set(cacheKey, lastClearTime) } now := time.Now().Unix() @@ -119,18 +153,21 @@ func CheckCacheIsExpire(cacheKey string) bool { return false } +// GetEndpointResponse ... type GetEndpointResponse struct { Endpoints *EndpointsObj RequestId string Success bool } +// EndpointsObj ... type EndpointsObj struct { Endpoint []EndpointObj } +// EndpointObj ... type EndpointObj struct { - Protocols map[string]string + // Protocols map[string]string Type string Namespace string Id string diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go index f7b5a1aa..e39f5336 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/mapping_resolver.go @@ -23,15 +23,24 @@ const keyFormatter = "%s::%s" var endpointMapping = make(map[string]string) +// AddEndpointMapping Use product id and region id as key to store the endpoint into inner map func AddEndpointMapping(regionId, productId, endpoint string) (err error) { key := fmt.Sprintf(keyFormatter, strings.ToLower(regionId), strings.ToLower(productId)) endpointMapping[key] = endpoint return nil } +// MappingResolver the mapping resolver type type MappingResolver struct { } +// GetName get the resolver name: "mapping resolver" +func (resolver *MappingResolver) GetName() (name string) { + name = "mapping resolver" + return +} + +// TryResolve use Product and RegionId as key to find endpoint from inner map func (resolver *MappingResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) { key := fmt.Sprintf(keyFormatter, strings.ToLower(param.RegionId), strings.ToLower(param.Product)) endpoint, contains := endpointMapping[key] diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/resolver.go index e58cfbf2..5e1e3053 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/resolver.go @@ -17,12 +17,20 @@ package endpoints import ( "encoding/json" "fmt" + "sync" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" - "sync" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) +var debug utils.Debug + +func init() { + debug = utils.Init("sdk") +} + const ( ResolveEndpointUserGuideLink = "" ) @@ -32,20 +40,30 @@ var resolvers []Resolver type Resolver interface { TryResolve(param *ResolveParam) (endpoint string, support bool, err error) + GetName() (name string) } +// Resolve resolve endpoint with params +// It will resolve with each supported resolver until anyone resolved func Resolve(param *ResolveParam) (endpoint string, err error) { supportedResolvers := getAllResolvers() + var lastErr error for _, resolver := range supportedResolvers { - endpoint, supported, err := resolver.TryResolve(param) + endpoint, supported, resolveErr := resolver.TryResolve(param) + if resolveErr != nil { + lastErr = resolveErr + } + if supported { - return endpoint, err + debug("resolve endpoint with %s\n", param) + debug("\t%s by resolver(%s)\n", endpoint, resolver.GetName()) + return endpoint, nil } } // not support errorMsg := fmt.Sprintf(errors.CanNotResolveEndpointErrorMessage, param, ResolveEndpointUserGuideLink) - err = errors.NewClientError(errors.CanNotResolveEndpointErrorCode, errorMsg, nil) + err = errors.NewClientError(errors.CanNotResolveEndpointErrorCode, errorMsg, lastErr) return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go index 3e2e731e..9ba2346c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/endpoints/simple_host_resolver.go @@ -14,9 +14,17 @@ package endpoints +// SimpleHostResolver the simple host resolver type type SimpleHostResolver struct { } +// GetName get the resolver name: "simple host resolver" +func (resolver *SimpleHostResolver) GetName() (name string) { + name = "simple host resolver" + return +} + +// TryResolve if the Domain exist in param, use it as endpoint func (resolver *SimpleHostResolver) TryResolve(param *ResolveParam) (endpoint string, support bool, err error) { if support = len(param.Domain) > 0; support { endpoint = param.Domain diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/client_error.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/client_error.go index 3d4048b4..1e2d9c00 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/client_error.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/client_error.go @@ -60,7 +60,7 @@ func NewClientError(errorCode, message string, originErr error) Error { } func (err *ClientError) Error() string { - clientErrMsg := fmt.Sprintf("[%s] %s", err.errorCode, err.message) + clientErrMsg := fmt.Sprintf("[%s] %s", err.ErrorCode(), err.message) if err.originError != nil { return clientErrMsg + "\ncaused by:\n" + err.originError.Error() } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/server_error.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/server_error.go index d90638c0..1b781041 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/server_error.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/server_error.go @@ -17,6 +17,7 @@ package errors import ( "encoding/json" "fmt" + "github.com/jmespath/go-jmespath" ) @@ -35,7 +36,7 @@ type ServerError struct { } type ServerErrorWrapper interface { - tryWrap(error *ServerError, wrapInfo map[string]string) (bool, *ServerError) + tryWrap(error *ServerError, wrapInfo map[string]string) bool } func (err *ServerError) Error() string { @@ -81,9 +82,9 @@ func NewServerError(httpStatus int, responseContent, comment string) Error { func WrapServerError(originError *ServerError, wrapInfo map[string]string) *ServerError { for _, wrapper := range wrapperList { - ok, newError := wrapper.tryWrap(originError, wrapInfo) + ok := wrapper.tryWrap(originError, wrapInfo) if ok { - return newError + return originError } } return originError diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/signature_does_not_match_wrapper.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/signature_does_not_match_wrapper.go index 33b3e4c4..4b09d7d7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/signature_does_not_match_wrapper.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors/signature_does_not_match_wrapper.go @@ -1,29 +1,45 @@ package errors -import "strings" +import ( + "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" +) const SignatureDostNotMatchErrorCode = "SignatureDoesNotMatch" -const MessagePrefix = "Specified signature is not matched with our calculation. server string to sign is:" +const IncompleteSignatureErrorCode = "IncompleteSignature" +const MessageContain = "server string to sign is:" + +var debug utils.Debug + +func init() { + debug = utils.Init("sdk") +} type SignatureDostNotMatchWrapper struct { } -func (*SignatureDostNotMatchWrapper) tryWrap(error *ServerError, wrapInfo map[string]string) (bool, *ServerError) { +func (*SignatureDostNotMatchWrapper) tryWrap(error *ServerError, wrapInfo map[string]string) (ok bool) { clientStringToSign := wrapInfo["StringToSign"] - if error.errorCode == SignatureDostNotMatchErrorCode && clientStringToSign != "" { + if (error.errorCode == SignatureDostNotMatchErrorCode || error.errorCode == IncompleteSignatureErrorCode) && clientStringToSign != "" { message := error.message - if strings.HasPrefix(message, MessagePrefix) { - serverStringToSign := message[len(MessagePrefix):] + if strings.Contains(message, MessageContain) { + str := strings.Split(message, MessageContain) + serverStringToSign := str[1] + if clientStringToSign == serverStringToSign { // user secret is error - error.recommend = "Please check you AccessKeySecret" + error.recommend = "InvalidAccessKeySecret: Please check you AccessKeySecret" } else { + debug("Client StringToSign: %s", clientStringToSign) + debug("Server StringToSign: %s", serverStringToSign) error.recommend = "This may be a bug with the SDK and we hope you can submit this question in the " + "github issue(https://github.com/aliyun/alibaba-cloud-sdk-go/issues), thanks very much" } } - return true, error - } else { - return false, nil + ok = true + return } + ok = false + return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go new file mode 100644 index 00000000..04f03393 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/logger.go @@ -0,0 +1,116 @@ +package sdk + +import ( + "encoding/json" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" + "io" + "log" + "os" + "strings" + "time" +) + +var logChannel string +var defaultChannel = "AlibabaCloud" + +type Logger struct { + *log.Logger + formatTemplate string + isOpen bool + lastLogMsg string +} + +var defaultLoggerTemplate = `{time} {channel}: "{method} {uri} HTTP/{version}" {code} {cost} {hostname}` +var loggerParam = []string{"{time}", "{start_time}", "{ts}", "{channel}", "{pid}", "{host}", "{method}", "{uri}", "{version}", "{target}", "{hostname}", "{code}", "{error}", "{req_headers}", "{res_headers}", "{cost}"} + +func initLogMsg(fieldMap map[string]string) { + for _, value := range loggerParam { + fieldMap[value] = "" + } +} + +func (client *Client) GetLogger() *Logger { + return client.logger +} + +func (client *Client) GetLoggerMsg() string { + if client.logger == nil { + client.SetLogger("", "", os.Stdout, "") + } + return client.logger.lastLogMsg +} + +func (client *Client) SetLogger(level string, channel string, out io.Writer, template string) { + if level == "" { + level = "info" + } + + logChannel = "AlibabaCloud" + if channel != "" { + logChannel = channel + } + log := log.New(out, "["+strings.ToUpper(level)+"]", log.Lshortfile) + if template == "" { + template = defaultLoggerTemplate + } + + client.logger = &Logger{ + Logger: log, + formatTemplate: template, + isOpen: true, + } +} + +func (client *Client) OpenLogger() { + if client.logger == nil { + client.SetLogger("", "", os.Stdout, "") + } + client.logger.isOpen = true +} + +func (client *Client) CloseLogger() { + if client.logger != nil { + client.logger.isOpen = false + } +} + +func (client *Client) SetTemplate(template string) { + if client.logger == nil { + client.SetLogger("", "", os.Stdout, "") + } + client.logger.formatTemplate = template +} + +func (client *Client) GetTemplate() string { + if client.logger == nil { + client.SetLogger("", "", os.Stdout, "") + } + return client.logger.formatTemplate +} + +func TransToString(object interface{}) string { + byt, err := json.Marshal(object) + if err != nil { + return "" + } + return string(byt) +} + +func (client *Client) printLog(fieldMap map[string]string, err error) { + if err != nil { + fieldMap["{error}"] = err.Error() + } + fieldMap["{time}"] = time.Now().Format("2006-01-02 15:04:05") + fieldMap["{ts}"] = utils.GetTimeInFormatISO8601() + fieldMap["{channel}"] = logChannel + if client.logger != nil { + logMsg := client.logger.formatTemplate + for key, value := range fieldMap { + logMsg = strings.Replace(logMsg, key, value, -1) + } + client.logger.lastLogMsg = logMsg + if client.logger.isOpen == true { + client.logger.Output(2, logMsg) + } + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_reqeust.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go similarity index 77% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_reqeust.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go index 5f4a42bb..fa22db1f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_reqeust.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/acs_request.go @@ -15,11 +15,15 @@ package requests import ( + "encoding/json" "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "io" "reflect" "strconv" + "strings" + "time" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" ) const ( @@ -58,8 +62,6 @@ type AcsRequest interface { GetDomain() string GetPort() string GetRegionId() string - GetUrl() string - GetQueries() string GetHeaders() map[string]string GetQueryParams() map[string]string GetFormParams() map[string]string @@ -68,10 +70,19 @@ type AcsRequest interface { GetStyle() string GetProduct() string GetVersion() string + SetVersion(version string) GetActionName() string GetAcceptFormat() string GetLocationServiceCode() string GetLocationEndpointType() string + GetReadTimeout() time.Duration + GetConnectTimeout() time.Duration + SetReadTimeout(readTimeout time.Duration) + SetConnectTimeout(connectTimeout time.Duration) + SetHTTPSInsecure(isInsecure bool) + GetHTTPSInsecure() *bool + + GetUserAgent() map[string]string SetStringToSign(stringToSign string) GetStringToSign() string @@ -90,14 +101,18 @@ type AcsRequest interface { // base class type baseRequest struct { - Scheme string - Method string - Domain string - Port string - RegionId string + Scheme string + Method string + Domain string + Port string + RegionId string + ReadTimeout time.Duration + ConnectTimeout time.Duration + isInsecure *bool - product string - version string + userAgent map[string]string + product string + version string actionName string @@ -124,10 +139,38 @@ func (request *baseRequest) GetFormParams() map[string]string { return request.FormParams } +func (request *baseRequest) GetReadTimeout() time.Duration { + return request.ReadTimeout +} + +func (request *baseRequest) GetConnectTimeout() time.Duration { + return request.ConnectTimeout +} + +func (request *baseRequest) SetReadTimeout(readTimeout time.Duration) { + request.ReadTimeout = readTimeout +} + +func (request *baseRequest) SetConnectTimeout(connectTimeout time.Duration) { + request.ConnectTimeout = connectTimeout +} + +func (request *baseRequest) GetHTTPSInsecure() *bool { + return request.isInsecure +} + +func (request *baseRequest) SetHTTPSInsecure(isInsecure bool) { + request.isInsecure = &isInsecure +} + func (request *baseRequest) GetContent() []byte { return request.Content } +func (request *baseRequest) SetVersion(version string) { + request.version = version +} + func (request *baseRequest) GetVersion() string { return request.version } @@ -140,6 +183,28 @@ func (request *baseRequest) SetContent(content []byte) { request.Content = content } +func (request *baseRequest) GetUserAgent() map[string]string { + return request.userAgent +} + +func (request *baseRequest) AppendUserAgent(key, value string) { + newkey := true + if request.userAgent == nil { + request.userAgent = make(map[string]string) + } + if strings.ToLower(key) != "core" && strings.ToLower(key) != "go" { + for tag, _ := range request.userAgent { + if tag == key { + request.userAgent[tag] = value + newkey = false + } + } + if newkey { + request.userAgent[key] = value + } + } +} + func (request *baseRequest) addHeaderParam(key, value string) { request.Headers[key] = value } @@ -201,7 +266,7 @@ func (request *baseRequest) GetHeaders() map[string]string { } func (request *baseRequest) SetContentType(contentType string) { - request.Headers["Content-Type"] = contentType + request.addHeaderParam("Content-Type", contentType) } func (request *baseRequest) GetContentType() (contentType string, contains bool) { @@ -226,7 +291,7 @@ func defaultBaseRequest() (request *baseRequest) { Headers: map[string]string{ "x-sdk-client": "golang/1.0.0", "x-sdk-invoke-type": "normal", - "Accept-Encoding": "identity", + "Accept-Encoding": "identity", }, FormParams: make(map[string]string), } @@ -254,6 +319,10 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre // simple param key := prefix + name value := dataValue.Field(i).String() + if dataValue.Field(i).Kind().String() == "map" { + byt, _ := json.Marshal(dataValue.Field(i).Interface()) + value = string(byt) + } err = addParam(request, fieldPosition, key, value) if err != nil { return @@ -269,7 +338,7 @@ func flatRepeatedList(dataValue reflect.Value, request AcsRequest, position, pre for m := 0; m < repeatedFieldValue.Len(); m++ { elementValue := repeatedFieldValue.Index(m) key := prefix + name + "." + strconv.Itoa(m+1) - if elementValue.Type().String() == "string" { + if elementValue.Type().Kind().String() == "string" { value := elementValue.String() err = addParam(request, fieldPosition, key, value) if err != nil { diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/common_request.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/common_request.go index d5d841b4..80c17009 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/common_request.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/common_request.go @@ -3,17 +3,18 @@ package requests import ( "bytes" "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "io" + "sort" "strings" ) type CommonRequest struct { *baseRequest - Version string - ApiName string - Product string + Version string + ApiName string + Product string + ServiceCode string // roa params PathPattern string @@ -33,22 +34,27 @@ func NewCommonRequest() (request *CommonRequest) { func (request *CommonRequest) String() string { request.TransToAcsRequest() - request.BuildQueries() - request.BuildUrl() resultBuilder := bytes.Buffer{} mapOutput := func(m map[string]string) { if len(m) > 0 { - for key, value := range m { - resultBuilder.WriteString(key + ": " + value + "\n") + sortedKeys := make([]string, 0) + for k := range m { + sortedKeys = append(sortedKeys, k) + } + + // sort 'string' key in increasing order + sort.Strings(sortedKeys) + + for _, key := range sortedKeys { + resultBuilder.WriteString(key + ": " + m[key] + "\n") } } } // Request Line - resultBuilder.WriteString("\n") - resultBuilder.WriteString(fmt.Sprintf("%s %s %s/1.1\n", request.Method, request.GetQueries(), strings.ToUpper(request.Scheme))) + resultBuilder.WriteString(fmt.Sprintf("%s %s %s/1.1\n", request.Method, request.BuildQueries(), strings.ToUpper(request.Scheme))) // Headers resultBuilder.WriteString("Host" + ": " + request.Domain + "\n") @@ -66,16 +72,6 @@ func (request *CommonRequest) String() string { } func (request *CommonRequest) TransToAcsRequest() { - if len(request.Version) == 0 { - errors.NewClientError(errors.MissingParamErrorCode, "Common request [version] is required", nil) - } - if len(request.ApiName) == 0 && len(request.PathPattern) == 0 { - errors.NewClientError(errors.MissingParamErrorCode, "At least one of [ApiName] and [PathPattern] should has a value", nil) - } - if len(request.Domain) == 0 && len(request.Product) == 0 { - errors.NewClientError(errors.MissingParamErrorCode, "At least one of [Domain] and [Product] should has a value", nil) - } - if len(request.PathPattern) > 0 { roaRequest := &RoaRequest{} roaRequest.initWithCommonRequest(request) @@ -85,36 +81,20 @@ func (request *CommonRequest) TransToAcsRequest() { rpcRequest.baseRequest = request.baseRequest rpcRequest.product = request.Product rpcRequest.version = request.Version + rpcRequest.locationServiceCode = request.ServiceCode rpcRequest.actionName = request.ApiName request.Ontology = rpcRequest } - } func (request *CommonRequest) BuildUrl() string { - if len(request.Port) > 0 { - return strings.ToLower(request.Scheme) + "://" + request.Domain + ":" + request.Port + request.BuildQueries() - } - - return strings.ToLower(request.Scheme) + "://" + request.Domain + request.BuildQueries() + return request.Ontology.BuildUrl() } func (request *CommonRequest) BuildQueries() string { return request.Ontology.BuildQueries() } -func (request *CommonRequest) GetUrl() string { - if len(request.Port) > 0 { - return strings.ToLower(request.Scheme) + "://" + request.Domain + ":" + request.Port + request.GetQueries() - } - - return strings.ToLower(request.Scheme) + "://" + request.Domain + request.GetQueries() -} - -func (request *CommonRequest) GetQueries() string { - return request.Ontology.GetQueries() -} - func (request *CommonRequest) GetBodyReader() io.Reader { return request.Ontology.GetBodyReader() } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/roa_request.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/roa_request.go index cd1ab178..70b856e3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/roa_request.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/roa_request.go @@ -16,11 +16,13 @@ package requests import ( "bytes" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" + "fmt" "io" "net/url" "sort" "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) type RoaRequest struct { @@ -44,29 +46,23 @@ func (request *RoaRequest) GetBodyReader() io.Reader { } } -func (request *RoaRequest) GetQueries() string { - return request.queries -} - // for sign method, need not url encoded func (request *RoaRequest) BuildQueries() string { - return request.buildQueries(false) + return request.buildQueries() } -func (request *RoaRequest) buildQueries(needParamEncode bool) string { - // replace path params with value +func (request *RoaRequest) buildPath() string { path := request.pathPattern for key, value := range request.PathParams { path = strings.Replace(path, "["+key+"]", value, 1) } + return path +} +func (request *RoaRequest) buildQueries() string { + // replace path params with value + path := request.buildPath() queryParams := request.QueryParams - // check if path contains params - splitArray := strings.Split(path, "?") - path = splitArray[0] - if len(splitArray) > 1 && len(splitArray[1]) > 0 { - queryParams[splitArray[1]] = "" - } // sort QueryParams by key var queryKeys []string for key := range queryParams { @@ -85,11 +81,7 @@ func (request *RoaRequest) buildQueries(needParamEncode bool) string { urlBuilder.WriteString(queryKey) if value := queryParams[queryKey]; len(value) > 0 { urlBuilder.WriteString("=") - if needParamEncode { - urlBuilder.WriteString(url.QueryEscape(value)) - } else { - urlBuilder.WriteString(value) - } + urlBuilder.WriteString(value) } if i < len(queryKeys)-1 { urlBuilder.WriteString("&") @@ -97,8 +89,17 @@ func (request *RoaRequest) buildQueries(needParamEncode bool) string { } result := urlBuilder.String() result = popStandardUrlencode(result) - request.queries = result - return request.queries + return result +} + +func (request *RoaRequest) buildQueryString() string { + queryParams := request.QueryParams + // sort QueryParams by key + q := url.Values{} + for key, value := range queryParams { + q.Add(key, value) + } + return q.Encode() } func popStandardUrlencode(stringToSign string) (result string) { @@ -108,13 +109,18 @@ func popStandardUrlencode(stringToSign string) (result string) { return } -func (request *RoaRequest) GetUrl() string { - return strings.ToLower(request.Scheme) + "://" + request.Domain + ":" + request.Port + request.GetQueries() -} - func (request *RoaRequest) BuildUrl() string { // for network trans, need url encoded - return strings.ToLower(request.Scheme) + "://" + request.Domain + ":" + request.Port + request.buildQueries(true) + scheme := strings.ToLower(request.Scheme) + domain := request.Domain + port := request.Port + path := request.buildPath() + url := fmt.Sprintf("%s://%s:%s%s", scheme, domain, port, path) + querystring := request.buildQueryString() + if len(querystring) > 0 { + url = fmt.Sprintf("%s?%s", url, querystring) + } + return url } func (request *RoaRequest) addPathParam(key, value string) { @@ -128,19 +134,19 @@ func (request *RoaRequest) InitWithApiInfo(product, version, action, uriPattern, request.pathPattern = uriPattern request.locationServiceCode = serviceCode request.locationEndpointType = endpointType - //request.product = product + request.product = product //request.version = version - //request.actionName = action + request.actionName = action } func (request *RoaRequest) initWithCommonRequest(commonRequest *CommonRequest) { request.baseRequest = commonRequest.baseRequest request.PathParams = commonRequest.PathParams - //request.product = commonRequest.Product + request.product = commonRequest.Product //request.version = commonRequest.Version request.Headers["x-acs-version"] = commonRequest.Version - //request.actionName = commonRequest.ApiName + request.actionName = commonRequest.ApiName request.pathPattern = commonRequest.PathPattern - request.locationServiceCode = "" + request.locationServiceCode = commonRequest.ServiceCode request.locationEndpointType = "" } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/rpc_request.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/rpc_request.go index 7a61c19f..01be6fd0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/rpc_request.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests/rpc_request.go @@ -15,9 +15,11 @@ package requests import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" + "fmt" "io" "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) type RpcRequest struct { @@ -47,16 +49,12 @@ func (request *RpcRequest) BuildQueries() string { return request.queries } -func (request *RpcRequest) GetQueries() string { - return request.queries -} - func (request *RpcRequest) BuildUrl() string { - return strings.ToLower(request.Scheme) + "://" + request.Domain + ":" + request.Port + request.BuildQueries() -} - -func (request *RpcRequest) GetUrl() string { - return strings.ToLower(request.Scheme) + "://" + request.Domain + request.GetQueries() + url := fmt.Sprintf("%s://%s", strings.ToLower(request.Scheme), request.Domain) + if len(request.Port) > 0 { + url = fmt.Sprintf("%s:%s", url, request.Port) + } + return url + request.BuildQueries() } func (request *RpcRequest) GetVersion() string { diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/json_parser.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/json_parser.go index 43ba6fc2..36604fe8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/json_parser.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/json_parser.go @@ -2,13 +2,13 @@ package responses import ( "encoding/json" - "github.com/json-iterator/go" "io" "math" "strconv" "strings" - "sync" "unsafe" + + jsoniter "github.com/json-iterator/go" ) const maxUint = ^uint(0) @@ -16,13 +16,15 @@ const maxInt = int(maxUint >> 1) const minInt = -maxInt - 1 var jsonParser jsoniter.API -var initJson = &sync.Once{} -func initJsonParserOnce() { - initJson.Do(func() { - registerBetterFuzzyDecoder() - jsonParser = jsoniter.ConfigCompatibleWithStandardLibrary - }) +func init() { + registerBetterFuzzyDecoder() + jsonParser = jsoniter.Config{ + EscapeHTML: true, + SortMapKeys: true, + ValidateJsonRawMessage: true, + CaseSensitive: true, + }.Froze() } func registerBetterFuzzyDecoder() { @@ -211,21 +213,6 @@ func (decoder *fuzzyBoolDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Itera } } -type tolerateEmptyArrayDecoder struct { - valDecoder jsoniter.ValDecoder -} - -func (decoder *tolerateEmptyArrayDecoder) Decode(ptr unsafe.Pointer, iter *jsoniter.Iterator) { - if iter.WhatIsNext() == jsoniter.ArrayValue { - iter.Skip() - newIter := iter.Pool().BorrowIterator([]byte("{}")) - defer iter.Pool().ReturnIterator(newIter) - decoder.valDecoder.Decode(ptr, newIter) - } else { - decoder.valDecoder.Decode(ptr, iter) - } -} - type nullableFuzzyIntegerDecoder struct { fun func(isFloat bool, ptr unsafe.Pointer, iter *jsoniter.Iterator) } @@ -336,6 +323,6 @@ func (decoder *nullableFuzzyFloat64Decoder) Decode(ptr unsafe.Pointer, iter *jso iter.ReadNil() *((*float64)(ptr)) = 0 default: - iter.ReportError("nullableFuzzyFloat32Decoder", "not number or string") + iter.ReportError("nullableFuzzyFloat64Decoder", "not number or string") } } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/response.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/response.go index 8780f26f..2b9eff1a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/response.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses/response.go @@ -18,10 +18,12 @@ import ( "bytes" "encoding/xml" "fmt" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" "io/ioutil" "net/http" "strings" + + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/errors" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils" ) type AcsResponse interface { @@ -34,6 +36,13 @@ type AcsResponse interface { parseFromHttpResponse(httpResponse *http.Response) error } +var debug utils.Debug + +func init() { + debug = utils.Init("sdk") +} + +// Unmarshal object from http response body to target Response func Unmarshal(response AcsResponse, httpResponse *http.Response, format string) (err error) { err = response.parseFromHttpResponse(httpResponse) if err != nil { @@ -43,7 +52,8 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string) err = errors.NewServerError(response.GetHttpStatus(), response.GetHttpContentString(), "") return } - if _, isCommonResponse := response.(CommonResponse); isCommonResponse { + + if _, isCommonResponse := response.(*CommonResponse); isCommonResponse { // common response need not unmarshal return } @@ -53,7 +63,6 @@ func Unmarshal(response AcsResponse, httpResponse *http.Response, format string) } if strings.ToUpper(format) == "JSON" { - initJsonParserOnce() err = jsonParser.Unmarshal(response.GetHttpContentBytes(), response) if err != nil { err = errors.NewClientError(errors.JsonUnmarshalErrorCode, errors.JsonUnmarshalErrorMessage, err) @@ -106,6 +115,7 @@ func (baseResponse *BaseResponse) parseFromHttpResponse(httpResponse *http.Respo if err != nil { return } + debug("%s", string(body)) baseResponse.httpStatus = httpResponse.StatusCode baseResponse.httpHeaders = httpResponse.Header baseResponse.httpContentBytes = body @@ -117,7 +127,7 @@ func (baseResponse *BaseResponse) parseFromHttpResponse(httpResponse *http.Respo func (baseResponse *BaseResponse) String() string { resultBuilder := bytes.Buffer{} // statusCode - resultBuilder.WriteString("\n") + // resultBuilder.WriteString("\n") resultBuilder.WriteString(fmt.Sprintf("%s %s\n", baseResponse.originHttpResponse.Proto, baseResponse.originHttpResponse.Status)) // httpHeaders //resultBuilder.WriteString("Headers:\n") diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/debug.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/debug.go new file mode 100644 index 00000000..09440d27 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/debug.go @@ -0,0 +1,36 @@ +package utils + +import ( + "fmt" + "os" + "strings" +) + +type Debug func(format string, v ...interface{}) + +var hookGetEnv = func() string { + return os.Getenv("DEBUG") +} + +var hookPrint = func(input string) { + fmt.Println(input) +} + +func Init(flag string) Debug { + enable := false + + env := hookGetEnv() + parts := strings.Split(env, ",") + for _, part := range parts { + if part == flag { + enable = true + break + } + } + + return func(format string, v ...interface{}) { + if enable { + hookPrint(fmt.Sprintf(format, v...)) + } + } +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/utils.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/utils.go index a00c775c..f8a3ad38 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/utils.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/sdk/utils/utils.go @@ -16,27 +16,35 @@ package utils import ( "crypto/md5" + "crypto/rand" "encoding/base64" "encoding/hex" - "encoding/json" - "fmt" - "github.com/satori/go.uuid" + "hash" + rand2 "math/rand" "net/url" "reflect" "strconv" "time" ) -// if you use go 1.10 or higher, you can hack this util by these to avoid "TimeZone.zip not found" on Windows -var LoadLocationFromTZData func(name string, data []byte) (*time.Location, error) = nil -var TZData []byte = nil +type UUID [16]byte -func GetUUIDV4() (uuidHex string) { - uuidV4 := uuid.NewV4() - uuidHex = hex.EncodeToString(uuidV4.Bytes()) +const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ" + +func GetUUID() (uuidHex string) { + uuid := NewUUID() + uuidHex = hex.EncodeToString(uuid[:]) return } +func RandStringBytes(n int) string { + b := make([]byte, n) + for i := range b { + b[i] = letterBytes[rand2.Intn(len(letterBytes))] + } + return string(b) +} + func GetMD5Base64(bytes []byte) (base64Value string) { md5Ctx := md5.New() md5Ctx.Write(bytes) @@ -45,29 +53,15 @@ func GetMD5Base64(bytes []byte) (base64Value string) { return } -func GetGMTLocation() (*time.Location, error) { - if LoadLocationFromTZData != nil && TZData != nil { - return LoadLocationFromTZData("GMT", TZData) - } else { - return time.LoadLocation("GMT") - } -} - func GetTimeInFormatISO8601() (timeStr string) { - gmt, err := GetGMTLocation() + gmt := time.FixedZone("GMT", 0) - if err != nil { - panic(err) - } return time.Now().In(gmt).Format("2006-01-02T15:04:05Z") } func GetTimeInFormatRFC2616() (timeStr string) { - gmt, err := GetGMTLocation() + gmt := time.FixedZone("GMT", 0) - if err != nil { - panic(err) - } return time.Now().In(gmt).Format("Mon, 02 Jan 2006 15:04:05 GMT") } @@ -80,17 +74,6 @@ func GetUrlFormedMap(source map[string]string) (urlEncoded string) { return } -func GetFromJsonString(jsonString, key string) (result string, err error) { - var responseMap map[string]*json.RawMessage - err = json.Unmarshal([]byte(jsonString), &responseMap) - if err != nil { - return - } - fmt.Println(string(*responseMap[key])) - err = json.Unmarshal(*responseMap[key], &result) - return -} - func InitStructWithDefaultTag(bean interface{}) { configType := reflect.TypeOf(bean) for i := 0; i < configType.Elem().NumField(); i++ { @@ -115,3 +98,44 @@ func InitStructWithDefaultTag(bean interface{}) { } } } + +func NewUUID() UUID { + ns := UUID{} + safeRandom(ns[:]) + u := newFromHash(md5.New(), ns, RandStringBytes(16)) + u[6] = (u[6] & 0x0f) | (byte(2) << 4) + u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) + + return u +} + +func newFromHash(h hash.Hash, ns UUID, name string) UUID { + u := UUID{} + h.Write(ns[:]) + h.Write([]byte(name)) + copy(u[:], h.Sum(nil)) + + return u +} + +func safeRandom(dest []byte) { + if _, err := rand.Read(dest); err != nil { + panic(err) + } +} + +func (u UUID) String() string { + buf := make([]byte, 36) + + hex.Encode(buf[0:8], u[0:4]) + buf[8] = '-' + hex.Encode(buf[9:13], u[4:6]) + buf[13] = '-' + hex.Encode(buf[14:18], u[6:8]) + buf[18] = '-' + hex.Encode(buf[19:23], u[8:10]) + buf[23] = '-' + hex.Encode(buf[24:], u[10:]) + + return string(buf) +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_batch_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_batch_domain_records.go deleted file mode 100644 index 30e1dea4..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_batch_domain_records.go +++ /dev/null @@ -1,106 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// AddBatchDomainRecords invokes the alidns.AddBatchDomainRecords API synchronously -// api document: https://help.aliyun.com/api/alidns/addbatchdomainrecords.html -func (client *Client) AddBatchDomainRecords(request *AddBatchDomainRecordsRequest) (response *AddBatchDomainRecordsResponse, err error) { - response = CreateAddBatchDomainRecordsResponse() - err = client.DoAction(request, response) - return -} - -// AddBatchDomainRecordsWithChan invokes the alidns.AddBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/addbatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) AddBatchDomainRecordsWithChan(request *AddBatchDomainRecordsRequest) (<-chan *AddBatchDomainRecordsResponse, <-chan error) { - responseChan := make(chan *AddBatchDomainRecordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.AddBatchDomainRecords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// AddBatchDomainRecordsWithCallback invokes the alidns.AddBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/addbatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) AddBatchDomainRecordsWithCallback(request *AddBatchDomainRecordsRequest, callback func(response *AddBatchDomainRecordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *AddBatchDomainRecordsResponse - var err error - defer close(result) - response, err = client.AddBatchDomainRecords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// AddBatchDomainRecordsRequest is the request struct for api AddBatchDomainRecords -type AddBatchDomainRecordsRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - Records string `position:"Query" name:"Records"` -} - -// AddBatchDomainRecordsResponse is the response struct for api AddBatchDomainRecords -type AddBatchDomainRecordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TraceId string `json:"TraceId" xml:"TraceId"` -} - -// CreateAddBatchDomainRecordsRequest creates a request to invoke AddBatchDomainRecords API -func CreateAddBatchDomainRecordsRequest() (request *AddBatchDomainRecordsRequest) { - request = &AddBatchDomainRecordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "AddBatchDomainRecords", "", "") - return -} - -// CreateAddBatchDomainRecordsResponse creates a response to parse from AddBatchDomainRecords response -func CreateAddBatchDomainRecordsResponse() (response *AddBatchDomainRecordsResponse) { - response = &AddBatchDomainRecordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain.go index 1b2249e2..d3370e39 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain.go @@ -76,10 +76,9 @@ func (client *Client) AddDomainWithCallback(request *AddDomainRequest, callback // AddDomainRequest is the request struct for api AddDomain type AddDomainRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - DomainName string `position:"Query" name:"DomainName"` - GroupId string `position:"Query" name:"GroupId"` + GroupId string `position:"Query" name:"GroupId"` + DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` } // AddDomainResponse is the response struct for api AddDomain @@ -99,7 +98,7 @@ func CreateAddDomainRequest() (request *AddDomainRequest) { request = &AddDomainRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomain", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomain", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_group.go index a1c7cd4c..5693ab0c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_group.go @@ -76,8 +76,8 @@ func (client *Client) AddDomainGroupWithCallback(request *AddDomainGroupRequest, // AddDomainGroupRequest is the request struct for api AddDomainGroup type AddDomainGroupRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` GroupName string `position:"Query" name:"GroupName"` } @@ -94,7 +94,7 @@ func CreateAddDomainGroupRequest() (request *AddDomainGroupRequest) { request = &AddDomainGroupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomainGroup", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomainGroup", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_record.go index 1da60245..23188e48 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_record.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_domain_record.go @@ -76,15 +76,15 @@ func (client *Client) AddDomainRecordWithCallback(request *AddDomainRecordReques // AddDomainRecordRequest is the request struct for api AddDomainRecord type AddDomainRecordRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + RR string `position:"Query" name:"RR"` + Line string `position:"Query" name:"Line"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - RR string `position:"Query" name:"RR"` + Lang string `position:"Query" name:"Lang"` Type string `position:"Query" name:"Type"` + Priority requests.Integer `position:"Query" name:"Priority"` Value string `position:"Query" name:"Value"` TTL requests.Integer `position:"Query" name:"TTL"` - Priority requests.Integer `position:"Query" name:"Priority"` - Line string `position:"Query" name:"Line"` } // AddDomainRecordResponse is the response struct for api AddDomainRecord @@ -99,7 +99,7 @@ func CreateAddDomainRecordRequest() (request *AddDomainRecordRequest) { request = &AddDomainRecordRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomainRecord", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "AddDomainRecord", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_access_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_access_strategy.go new file mode 100644 index 00000000..0f3e3f7a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_access_strategy.go @@ -0,0 +1,110 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddGtmAccessStrategy invokes the alidns.AddGtmAccessStrategy API synchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaccessstrategy.html +func (client *Client) AddGtmAccessStrategy(request *AddGtmAccessStrategyRequest) (response *AddGtmAccessStrategyResponse, err error) { + response = CreateAddGtmAccessStrategyResponse() + err = client.DoAction(request, response) + return +} + +// AddGtmAccessStrategyWithChan invokes the alidns.AddGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmAccessStrategyWithChan(request *AddGtmAccessStrategyRequest) (<-chan *AddGtmAccessStrategyResponse, <-chan error) { + responseChan := make(chan *AddGtmAccessStrategyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddGtmAccessStrategy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddGtmAccessStrategyWithCallback invokes the alidns.AddGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmAccessStrategyWithCallback(request *AddGtmAccessStrategyRequest, callback func(response *AddGtmAccessStrategyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddGtmAccessStrategyResponse + var err error + defer close(result) + response, err = client.AddGtmAccessStrategy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddGtmAccessStrategyRequest is the request struct for api AddGtmAccessStrategy +type AddGtmAccessStrategyRequest struct { + *requests.RpcRequest + StrategyName string `position:"Query" name:"StrategyName"` + DefaultAddrPoolId string `position:"Query" name:"DefaultAddrPoolId"` + AccessLines string `position:"Query" name:"AccessLines"` + InstanceId string `position:"Query" name:"InstanceId"` + FailoverAddrPoolId string `position:"Query" name:"FailoverAddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// AddGtmAccessStrategyResponse is the response struct for api AddGtmAccessStrategy +type AddGtmAccessStrategyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + StrategyId string `json:"StrategyId" xml:"StrategyId"` +} + +// CreateAddGtmAccessStrategyRequest creates a request to invoke AddGtmAccessStrategy API +func CreateAddGtmAccessStrategyRequest() (request *AddGtmAccessStrategyRequest) { + request = &AddGtmAccessStrategyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "AddGtmAccessStrategy", "alidns", "openAPI") + return +} + +// CreateAddGtmAccessStrategyResponse creates a response to parse from AddGtmAccessStrategy response +func CreateAddGtmAccessStrategyResponse() (response *AddGtmAccessStrategyResponse) { + response = &AddGtmAccessStrategyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_address_pool.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_address_pool.go new file mode 100644 index 00000000..4e8b139b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_address_pool.go @@ -0,0 +1,117 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddGtmAddressPool invokes the alidns.AddGtmAddressPool API synchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaddresspool.html +func (client *Client) AddGtmAddressPool(request *AddGtmAddressPoolRequest) (response *AddGtmAddressPoolResponse, err error) { + response = CreateAddGtmAddressPoolResponse() + err = client.DoAction(request, response) + return +} + +// AddGtmAddressPoolWithChan invokes the alidns.AddGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmAddressPoolWithChan(request *AddGtmAddressPoolRequest) (<-chan *AddGtmAddressPoolResponse, <-chan error) { + responseChan := make(chan *AddGtmAddressPoolResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddGtmAddressPool(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddGtmAddressPoolWithCallback invokes the alidns.AddGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmAddressPoolWithCallback(request *AddGtmAddressPoolRequest, callback func(response *AddGtmAddressPoolResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddGtmAddressPoolResponse + var err error + defer close(result) + response, err = client.AddGtmAddressPool(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddGtmAddressPoolRequest is the request struct for api AddGtmAddressPool +type AddGtmAddressPoolRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Name string `position:"Query" name:"Name"` + Lang string `position:"Query" name:"Lang"` + Type string `position:"Query" name:"Type"` + Addr *[]AddGtmAddressPoolAddr `position:"Query" name:"Addr" type:"Repeated"` + MinAvailableAddrNum requests.Integer `position:"Query" name:"MinAvailableAddrNum"` +} + +// AddGtmAddressPoolAddr is a repeated param struct in AddGtmAddressPoolRequest +type AddGtmAddressPoolAddr struct { + Mode string `name:"Mode"` + LbaWeight string `name:"LbaWeight"` + Value string `name:"Value"` +} + +// AddGtmAddressPoolResponse is the response struct for api AddGtmAddressPool +type AddGtmAddressPoolResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AddrPoolId string `json:"AddrPoolId" xml:"AddrPoolId"` +} + +// CreateAddGtmAddressPoolRequest creates a request to invoke AddGtmAddressPool API +func CreateAddGtmAddressPoolRequest() (request *AddGtmAddressPoolRequest) { + request = &AddGtmAddressPoolRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "AddGtmAddressPool", "alidns", "openAPI") + return +} + +// CreateAddGtmAddressPoolResponse creates a response to parse from AddGtmAddressPool response +func CreateAddGtmAddressPoolResponse() (response *AddGtmAddressPoolResponse) { + response = &AddGtmAddressPoolResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_monitor.go new file mode 100644 index 00000000..b37ec419 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/add_gtm_monitor.go @@ -0,0 +1,119 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// AddGtmMonitor invokes the alidns.AddGtmMonitor API synchronously +// api document: https://help.aliyun.com/api/alidns/addgtmmonitor.html +func (client *Client) AddGtmMonitor(request *AddGtmMonitorRequest) (response *AddGtmMonitorResponse, err error) { + response = CreateAddGtmMonitorResponse() + err = client.DoAction(request, response) + return +} + +// AddGtmMonitorWithChan invokes the alidns.AddGtmMonitor API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmmonitor.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmMonitorWithChan(request *AddGtmMonitorRequest) (<-chan *AddGtmMonitorResponse, <-chan error) { + responseChan := make(chan *AddGtmMonitorResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.AddGtmMonitor(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// AddGtmMonitorWithCallback invokes the alidns.AddGtmMonitor API asynchronously +// api document: https://help.aliyun.com/api/alidns/addgtmmonitor.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) AddGtmMonitorWithCallback(request *AddGtmMonitorRequest, callback func(response *AddGtmMonitorResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *AddGtmMonitorResponse + var err error + defer close(result) + response, err = client.AddGtmMonitor(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// AddGtmMonitorRequest is the request struct for api AddGtmMonitor +type AddGtmMonitorRequest struct { + *requests.RpcRequest + MonitorExtendInfo string `position:"Query" name:"MonitorExtendInfo"` + AddrPoolId string `position:"Query" name:"AddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Name string `position:"Query" name:"Name"` + EvaluationCount requests.Integer `position:"Query" name:"EvaluationCount"` + ProtocolType string `position:"Query" name:"ProtocolType"` + Interval requests.Integer `position:"Query" name:"Interval"` + Lang string `position:"Query" name:"Lang"` + Timeout requests.Integer `position:"Query" name:"Timeout"` + IspCityNode *[]AddGtmMonitorIspCityNode `position:"Query" name:"IspCityNode" type:"Repeated"` +} + +// AddGtmMonitorIspCityNode is a repeated param struct in AddGtmMonitorRequest +type AddGtmMonitorIspCityNode struct { + CityCode string `name:"CityCode"` + IspCode string `name:"IspCode"` +} + +// AddGtmMonitorResponse is the response struct for api AddGtmMonitor +type AddGtmMonitorResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + MonitorConfigId string `json:"MonitorConfigId" xml:"MonitorConfigId"` +} + +// CreateAddGtmMonitorRequest creates a request to invoke AddGtmMonitor API +func CreateAddGtmMonitorRequest() (request *AddGtmMonitorRequest) { + request = &AddGtmMonitorRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "AddGtmMonitor", "alidns", "openAPI") + return +} + +// CreateAddGtmMonitorResponse creates a response to parse from AddGtmMonitor response +func CreateAddGtmMonitorResponse() (response *AddGtmMonitorResponse) { + response = &AddGtmMonitorResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/apply_for_retrieval_domain_name.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/apply_for_retrieval_domain_name.go deleted file mode 100644 index 86b68e7b..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/apply_for_retrieval_domain_name.go +++ /dev/null @@ -1,106 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// ApplyForRetrievalDomainName invokes the alidns.ApplyForRetrievalDomainName API synchronously -// api document: https://help.aliyun.com/api/alidns/applyforretrievaldomainname.html -func (client *Client) ApplyForRetrievalDomainName(request *ApplyForRetrievalDomainNameRequest) (response *ApplyForRetrievalDomainNameResponse, err error) { - response = CreateApplyForRetrievalDomainNameResponse() - err = client.DoAction(request, response) - return -} - -// ApplyForRetrievalDomainNameWithChan invokes the alidns.ApplyForRetrievalDomainName API asynchronously -// api document: https://help.aliyun.com/api/alidns/applyforretrievaldomainname.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) ApplyForRetrievalDomainNameWithChan(request *ApplyForRetrievalDomainNameRequest) (<-chan *ApplyForRetrievalDomainNameResponse, <-chan error) { - responseChan := make(chan *ApplyForRetrievalDomainNameResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.ApplyForRetrievalDomainName(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// ApplyForRetrievalDomainNameWithCallback invokes the alidns.ApplyForRetrievalDomainName API asynchronously -// api document: https://help.aliyun.com/api/alidns/applyforretrievaldomainname.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) ApplyForRetrievalDomainNameWithCallback(request *ApplyForRetrievalDomainNameRequest, callback func(response *ApplyForRetrievalDomainNameResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *ApplyForRetrievalDomainNameResponse - var err error - defer close(result) - response, err = client.ApplyForRetrievalDomainName(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// ApplyForRetrievalDomainNameRequest is the request struct for api ApplyForRetrievalDomainName -type ApplyForRetrievalDomainNameRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - DomainName string `position:"Query" name:"DomainName"` -} - -// ApplyForRetrievalDomainNameResponse is the response struct for api ApplyForRetrievalDomainName -type ApplyForRetrievalDomainNameResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DomainName string `json:"DomainName" xml:"DomainName"` -} - -// CreateApplyForRetrievalDomainNameRequest creates a request to invoke ApplyForRetrievalDomainName API -func CreateApplyForRetrievalDomainNameRequest() (request *ApplyForRetrievalDomainNameRequest) { - request = &ApplyForRetrievalDomainNameRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "ApplyForRetrievalDomainName", "", "") - return -} - -// CreateApplyForRetrievalDomainNameResponse creates a response to parse from ApplyForRetrievalDomainName response -func CreateApplyForRetrievalDomainNameResponse() (response *ApplyForRetrievalDomainNameResponse) { - response = &ApplyForRetrievalDomainNameResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_group.go index 61fed5be..46b6b2a6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_group.go @@ -76,10 +76,10 @@ func (client *Client) ChangeDomainGroupWithCallback(request *ChangeDomainGroupRe // ChangeDomainGroupRequest is the request struct for api ChangeDomainGroup type ChangeDomainGroupRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + GroupId string `position:"Query" name:"GroupId"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - GroupId string `position:"Query" name:"GroupId"` + Lang string `position:"Query" name:"Lang"` } // ChangeDomainGroupResponse is the response struct for api ChangeDomainGroup @@ -95,7 +95,7 @@ func CreateChangeDomainGroupRequest() (request *ChangeDomainGroupRequest) { request = &ChangeDomainGroupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "ChangeDomainGroup", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "ChangeDomainGroup", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_of_dns_product.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_of_dns_product.go index 04f329e4..234f9df9 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_of_dns_product.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/change_domain_of_dns_product.go @@ -76,11 +76,11 @@ func (client *Client) ChangeDomainOfDnsProductWithCallback(request *ChangeDomain // ChangeDomainOfDnsProductRequest is the request struct for api ChangeDomainOfDnsProduct type ChangeDomainOfDnsProductRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` InstanceId string `position:"Query" name:"InstanceId"` NewDomain string `position:"Query" name:"NewDomain"` + UserClientIp string `position:"Query" name:"UserClientIp"` Force requests.Boolean `position:"Query" name:"Force"` + Lang string `position:"Query" name:"Lang"` } // ChangeDomainOfDnsProductResponse is the response struct for api ChangeDomainOfDnsProduct @@ -95,7 +95,7 @@ func CreateChangeDomainOfDnsProductRequest() (request *ChangeDomainOfDnsProductR request = &ChangeDomainOfDnsProductRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "ChangeDomainOfDnsProduct", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "ChangeDomainOfDnsProduct", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/check_domain_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/check_domain_record.go index 876e4deb..c23ed1cd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/check_domain_record.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/check_domain_record.go @@ -76,10 +76,10 @@ func (client *Client) CheckDomainRecordWithCallback(request *CheckDomainRecordRe // CheckDomainRecordRequest is the request struct for api CheckDomainRecord type CheckDomainRecordRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + RR string `position:"Query" name:"RR"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - RR string `position:"Query" name:"RR"` + Lang string `position:"Query" name:"Lang"` Type string `position:"Query" name:"Type"` Value string `position:"Query" name:"Value"` } @@ -96,7 +96,7 @@ func CreateCheckDomainRecordRequest() (request *CheckDomainRecordRequest) { request = &CheckDomainRecordRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "CheckDomainRecord", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "CheckDomainRecord", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/create_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/create_instance.go new file mode 100644 index 00000000..cabeeed5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/create_instance.go @@ -0,0 +1,111 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// CreateInstance invokes the alidns.CreateInstance API synchronously +// api document: https://help.aliyun.com/api/alidns/createinstance.html +func (client *Client) CreateInstance(request *CreateInstanceRequest) (response *CreateInstanceResponse, err error) { + response = CreateCreateInstanceResponse() + err = client.DoAction(request, response) + return +} + +// CreateInstanceWithChan invokes the alidns.CreateInstance API asynchronously +// api document: https://help.aliyun.com/api/alidns/createinstance.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) CreateInstanceWithChan(request *CreateInstanceRequest) (<-chan *CreateInstanceResponse, <-chan error) { + responseChan := make(chan *CreateInstanceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.CreateInstance(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// CreateInstanceWithCallback invokes the alidns.CreateInstance API asynchronously +// api document: https://help.aliyun.com/api/alidns/createinstance.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) CreateInstanceWithCallback(request *CreateInstanceRequest, callback func(response *CreateInstanceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *CreateInstanceResponse + var err error + defer close(result) + response, err = client.CreateInstance(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// CreateInstanceRequest is the request struct for api CreateInstance +type CreateInstanceRequest struct { + *requests.RpcRequest + Month requests.Integer `position:"Query" name:"Month"` + UserClientIp string `position:"Query" name:"UserClientIp"` + DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` + InstanceVersion string `position:"Query" name:"InstanceVersion"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` + Token string `position:"Query" name:"Token"` +} + +// CreateInstanceResponse is the response struct for api CreateInstance +type CreateInstanceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + OrderId string `json:"OrderId" xml:"OrderId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` +} + +// CreateCreateInstanceRequest creates a request to invoke CreateInstance API +func CreateCreateInstanceRequest() (request *CreateInstanceRequest) { + request = &CreateInstanceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "CreateInstance", "alidns", "openAPI") + return +} + +// CreateCreateInstanceResponse creates a response to parse from CreateInstance response +func CreateCreateInstanceResponse() (response *CreateInstanceResponse) { + response = &CreateInstanceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domain_records.go deleted file mode 100644 index 8c973f76..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domain_records.go +++ /dev/null @@ -1,106 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteBatchDomainRecords invokes the alidns.DeleteBatchDomainRecords API synchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomainrecords.html -func (client *Client) DeleteBatchDomainRecords(request *DeleteBatchDomainRecordsRequest) (response *DeleteBatchDomainRecordsResponse, err error) { - response = CreateDeleteBatchDomainRecordsResponse() - err = client.DoAction(request, response) - return -} - -// DeleteBatchDomainRecordsWithChan invokes the alidns.DeleteBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DeleteBatchDomainRecordsWithChan(request *DeleteBatchDomainRecordsRequest) (<-chan *DeleteBatchDomainRecordsResponse, <-chan error) { - responseChan := make(chan *DeleteBatchDomainRecordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteBatchDomainRecords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteBatchDomainRecordsWithCallback invokes the alidns.DeleteBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DeleteBatchDomainRecordsWithCallback(request *DeleteBatchDomainRecordsRequest, callback func(response *DeleteBatchDomainRecordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteBatchDomainRecordsResponse - var err error - defer close(result) - response, err = client.DeleteBatchDomainRecords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteBatchDomainRecordsRequest is the request struct for api DeleteBatchDomainRecords -type DeleteBatchDomainRecordsRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - Records string `position:"Query" name:"Records"` -} - -// DeleteBatchDomainRecordsResponse is the response struct for api DeleteBatchDomainRecords -type DeleteBatchDomainRecordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TraceId string `json:"TraceId" xml:"TraceId"` -} - -// CreateDeleteBatchDomainRecordsRequest creates a request to invoke DeleteBatchDomainRecords API -func CreateDeleteBatchDomainRecordsRequest() (request *DeleteBatchDomainRecordsRequest) { - request = &DeleteBatchDomainRecordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteBatchDomainRecords", "", "") - return -} - -// CreateDeleteBatchDomainRecordsResponse creates a response to parse from DeleteBatchDomainRecords response -func CreateDeleteBatchDomainRecordsResponse() (response *DeleteBatchDomainRecordsResponse) { - response = &DeleteBatchDomainRecordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domains.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domains.go deleted file mode 100644 index fbbac4ce..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_batch_domains.go +++ /dev/null @@ -1,106 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DeleteBatchDomains invokes the alidns.DeleteBatchDomains API synchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomains.html -func (client *Client) DeleteBatchDomains(request *DeleteBatchDomainsRequest) (response *DeleteBatchDomainsResponse, err error) { - response = CreateDeleteBatchDomainsResponse() - err = client.DoAction(request, response) - return -} - -// DeleteBatchDomainsWithChan invokes the alidns.DeleteBatchDomains API asynchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomains.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DeleteBatchDomainsWithChan(request *DeleteBatchDomainsRequest) (<-chan *DeleteBatchDomainsResponse, <-chan error) { - responseChan := make(chan *DeleteBatchDomainsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DeleteBatchDomains(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DeleteBatchDomainsWithCallback invokes the alidns.DeleteBatchDomains API asynchronously -// api document: https://help.aliyun.com/api/alidns/deletebatchdomains.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DeleteBatchDomainsWithCallback(request *DeleteBatchDomainsRequest, callback func(response *DeleteBatchDomainsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DeleteBatchDomainsResponse - var err error - defer close(result) - response, err = client.DeleteBatchDomains(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DeleteBatchDomainsRequest is the request struct for api DeleteBatchDomains -type DeleteBatchDomainsRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - Domains string `position:"Query" name:"Domains"` -} - -// DeleteBatchDomainsResponse is the response struct for api DeleteBatchDomains -type DeleteBatchDomainsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TraceId string `json:"TraceId" xml:"TraceId"` -} - -// CreateDeleteBatchDomainsRequest creates a request to invoke DeleteBatchDomains API -func CreateDeleteBatchDomainsRequest() (request *DeleteBatchDomainsRequest) { - request = &DeleteBatchDomainsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteBatchDomains", "", "") - return -} - -// CreateDeleteBatchDomainsResponse creates a response to parse from DeleteBatchDomains response -func CreateDeleteBatchDomainsResponse() (response *DeleteBatchDomainsResponse) { - response = &DeleteBatchDomainsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain.go index 097f37f9..73362708 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain.go @@ -76,9 +76,9 @@ func (client *Client) DeleteDomainWithCallback(request *DeleteDomainRequest, cal // DeleteDomainRequest is the request struct for api DeleteDomain type DeleteDomainRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` } // DeleteDomainResponse is the response struct for api DeleteDomain @@ -93,7 +93,7 @@ func CreateDeleteDomainRequest() (request *DeleteDomainRequest) { request = &DeleteDomainRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomain", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomain", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_group.go index 341b9122..87ae4119 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_group.go @@ -76,9 +76,9 @@ func (client *Client) DeleteDomainGroupWithCallback(request *DeleteDomainGroupRe // DeleteDomainGroupRequest is the request struct for api DeleteDomainGroup type DeleteDomainGroupRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` GroupId string `position:"Query" name:"GroupId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` } // DeleteDomainGroupResponse is the response struct for api DeleteDomainGroup @@ -93,7 +93,7 @@ func CreateDeleteDomainGroupRequest() (request *DeleteDomainGroupRequest) { request = &DeleteDomainGroupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomainGroup", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomainGroup", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_record.go index 73f2b08f..aeccf1e2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_record.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_domain_record.go @@ -76,9 +76,9 @@ func (client *Client) DeleteDomainRecordWithCallback(request *DeleteDomainRecord // DeleteDomainRecordRequest is the request struct for api DeleteDomainRecord type DeleteDomainRecordRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` RecordId string `position:"Query" name:"RecordId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` } // DeleteDomainRecordResponse is the response struct for api DeleteDomainRecord @@ -93,7 +93,7 @@ func CreateDeleteDomainRecordRequest() (request *DeleteDomainRecordRequest) { request = &DeleteDomainRecordRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomainRecord", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteDomainRecord", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_access_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_access_strategy.go new file mode 100644 index 00000000..2dd12014 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_access_strategy.go @@ -0,0 +1,105 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteGtmAccessStrategy invokes the alidns.DeleteGtmAccessStrategy API synchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaccessstrategy.html +func (client *Client) DeleteGtmAccessStrategy(request *DeleteGtmAccessStrategyRequest) (response *DeleteGtmAccessStrategyResponse, err error) { + response = CreateDeleteGtmAccessStrategyResponse() + err = client.DoAction(request, response) + return +} + +// DeleteGtmAccessStrategyWithChan invokes the alidns.DeleteGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DeleteGtmAccessStrategyWithChan(request *DeleteGtmAccessStrategyRequest) (<-chan *DeleteGtmAccessStrategyResponse, <-chan error) { + responseChan := make(chan *DeleteGtmAccessStrategyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteGtmAccessStrategy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteGtmAccessStrategyWithCallback invokes the alidns.DeleteGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DeleteGtmAccessStrategyWithCallback(request *DeleteGtmAccessStrategyRequest, callback func(response *DeleteGtmAccessStrategyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteGtmAccessStrategyResponse + var err error + defer close(result) + response, err = client.DeleteGtmAccessStrategy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteGtmAccessStrategyRequest is the request struct for api DeleteGtmAccessStrategy +type DeleteGtmAccessStrategyRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + StrategyId string `position:"Query" name:"StrategyId"` + Lang string `position:"Query" name:"Lang"` +} + +// DeleteGtmAccessStrategyResponse is the response struct for api DeleteGtmAccessStrategy +type DeleteGtmAccessStrategyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteGtmAccessStrategyRequest creates a request to invoke DeleteGtmAccessStrategy API +func CreateDeleteGtmAccessStrategyRequest() (request *DeleteGtmAccessStrategyRequest) { + request = &DeleteGtmAccessStrategyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteGtmAccessStrategy", "alidns", "openAPI") + return +} + +// CreateDeleteGtmAccessStrategyResponse creates a response to parse from DeleteGtmAccessStrategy response +func CreateDeleteGtmAccessStrategyResponse() (response *DeleteGtmAccessStrategyResponse) { + response = &DeleteGtmAccessStrategyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_address_pool.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_address_pool.go new file mode 100644 index 00000000..f26b65c6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_gtm_address_pool.go @@ -0,0 +1,105 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DeleteGtmAddressPool invokes the alidns.DeleteGtmAddressPool API synchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaddresspool.html +func (client *Client) DeleteGtmAddressPool(request *DeleteGtmAddressPoolRequest) (response *DeleteGtmAddressPoolResponse, err error) { + response = CreateDeleteGtmAddressPoolResponse() + err = client.DoAction(request, response) + return +} + +// DeleteGtmAddressPoolWithChan invokes the alidns.DeleteGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DeleteGtmAddressPoolWithChan(request *DeleteGtmAddressPoolRequest) (<-chan *DeleteGtmAddressPoolResponse, <-chan error) { + responseChan := make(chan *DeleteGtmAddressPoolResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DeleteGtmAddressPool(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DeleteGtmAddressPoolWithCallback invokes the alidns.DeleteGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/deletegtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DeleteGtmAddressPoolWithCallback(request *DeleteGtmAddressPoolRequest, callback func(response *DeleteGtmAddressPoolResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DeleteGtmAddressPoolResponse + var err error + defer close(result) + response, err = client.DeleteGtmAddressPool(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DeleteGtmAddressPoolRequest is the request struct for api DeleteGtmAddressPool +type DeleteGtmAddressPoolRequest struct { + *requests.RpcRequest + AddrPoolId string `position:"Query" name:"AddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DeleteGtmAddressPoolResponse is the response struct for api DeleteGtmAddressPool +type DeleteGtmAddressPoolResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateDeleteGtmAddressPoolRequest creates a request to invoke DeleteGtmAddressPool API +func CreateDeleteGtmAddressPoolRequest() (request *DeleteGtmAddressPoolRequest) { + request = &DeleteGtmAddressPoolRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteGtmAddressPool", "alidns", "openAPI") + return +} + +// CreateDeleteGtmAddressPoolResponse creates a response to parse from DeleteGtmAddressPool response +func CreateDeleteGtmAddressPoolResponse() (response *DeleteGtmAddressPoolResponse) { + response = &DeleteGtmAddressPoolResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_sub_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_sub_domain_records.go index 06bb0fd7..6862fd0f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_sub_domain_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/delete_sub_domain_records.go @@ -76,10 +76,10 @@ func (client *Client) DeleteSubDomainRecordsWithCallback(request *DeleteSubDomai // DeleteSubDomainRecordsRequest is the request struct for api DeleteSubDomainRecords type DeleteSubDomainRecordsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + RR string `position:"Query" name:"RR"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - RR string `position:"Query" name:"RR"` + Lang string `position:"Query" name:"Lang"` Type string `position:"Query" name:"Type"` } @@ -96,7 +96,7 @@ func CreateDeleteSubDomainRecordsRequest() (request *DeleteSubDomainRecordsReque request = &DeleteSubDomainRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteSubDomainRecords", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DeleteSubDomainRecords", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result.go deleted file mode 100644 index 67590cb8..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result.go +++ /dev/null @@ -1,110 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeBatchResult invokes the alidns.DescribeBatchResult API synchronously -// api document: https://help.aliyun.com/api/alidns/describebatchresult.html -func (client *Client) DescribeBatchResult(request *DescribeBatchResultRequest) (response *DescribeBatchResultResponse, err error) { - response = CreateDescribeBatchResultResponse() - err = client.DoAction(request, response) - return -} - -// DescribeBatchResultWithChan invokes the alidns.DescribeBatchResult API asynchronously -// api document: https://help.aliyun.com/api/alidns/describebatchresult.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DescribeBatchResultWithChan(request *DescribeBatchResultRequest) (<-chan *DescribeBatchResultResponse, <-chan error) { - responseChan := make(chan *DescribeBatchResultResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeBatchResult(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeBatchResultWithCallback invokes the alidns.DescribeBatchResult API asynchronously -// api document: https://help.aliyun.com/api/alidns/describebatchresult.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DescribeBatchResultWithCallback(request *DescribeBatchResultRequest, callback func(response *DescribeBatchResultResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeBatchResultResponse - var err error - defer close(result) - response, err = client.DescribeBatchResult(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeBatchResultRequest is the request struct for api DescribeBatchResult -type DescribeBatchResultRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - TraceId string `position:"Query" name:"TraceId"` -} - -// DescribeBatchResultResponse is the response struct for api DescribeBatchResult -type DescribeBatchResultResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TraceId string `json:"TraceId" xml:"TraceId"` - Status int `json:"Status" xml:"Status"` - BatchCount int `json:"BatchCount" xml:"BatchCount"` - SuccessNumber int `json:"SuccessNumber" xml:"SuccessNumber"` - FailResults FailResults `json:"FailResults" xml:"FailResults"` -} - -// CreateDescribeBatchResultRequest creates a request to invoke DescribeBatchResult API -func CreateDescribeBatchResultRequest() (request *DescribeBatchResultRequest) { - request = &DescribeBatchResultRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeBatchResult", "", "") - return -} - -// CreateDescribeBatchResultResponse creates a response to parse from DescribeBatchResult response -func CreateDescribeBatchResultResponse() (response *DescribeBatchResultResponse) { - response = &DescribeBatchResultResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_count.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_count.go new file mode 100644 index 00000000..12be14d9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_count.go @@ -0,0 +1,113 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeBatchResultCount invokes the alidns.DescribeBatchResultCount API synchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultcount.html +func (client *Client) DescribeBatchResultCount(request *DescribeBatchResultCountRequest) (response *DescribeBatchResultCountResponse, err error) { + response = CreateDescribeBatchResultCountResponse() + err = client.DoAction(request, response) + return +} + +// DescribeBatchResultCountWithChan invokes the alidns.DescribeBatchResultCount API asynchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultcount.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeBatchResultCountWithChan(request *DescribeBatchResultCountRequest) (<-chan *DescribeBatchResultCountResponse, <-chan error) { + responseChan := make(chan *DescribeBatchResultCountResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeBatchResultCount(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeBatchResultCountWithCallback invokes the alidns.DescribeBatchResultCount API asynchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultcount.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeBatchResultCountWithCallback(request *DescribeBatchResultCountRequest, callback func(response *DescribeBatchResultCountResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeBatchResultCountResponse + var err error + defer close(result) + response, err = client.DescribeBatchResultCount(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeBatchResultCountRequest is the request struct for api DescribeBatchResultCount +type DescribeBatchResultCountRequest struct { + *requests.RpcRequest + BatchType string `position:"Query" name:"BatchType"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` + TaskId requests.Integer `position:"Query" name:"TaskId"` +} + +// DescribeBatchResultCountResponse is the response struct for api DescribeBatchResultCount +type DescribeBatchResultCountResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Status int `json:"Status" xml:"Status"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + SuccessCount int `json:"SuccessCount" xml:"SuccessCount"` + FailedCount int `json:"FailedCount" xml:"FailedCount"` + Reason string `json:"Reason" xml:"Reason"` + BatchType string `json:"BatchType" xml:"BatchType"` + TaskId int `json:"TaskId" xml:"TaskId"` +} + +// CreateDescribeBatchResultCountRequest creates a request to invoke DescribeBatchResultCount API +func CreateDescribeBatchResultCountRequest() (request *DescribeBatchResultCountRequest) { + request = &DescribeBatchResultCountRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeBatchResultCount", "alidns", "openAPI") + return +} + +// CreateDescribeBatchResultCountResponse creates a response to parse from DescribeBatchResultCount response +func CreateDescribeBatchResultCountResponse() (response *DescribeBatchResultCountResponse) { + response = &DescribeBatchResultCountResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_detail.go new file mode 100644 index 00000000..910bfb1f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_batch_result_detail.go @@ -0,0 +1,112 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeBatchResultDetail invokes the alidns.DescribeBatchResultDetail API synchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultdetail.html +func (client *Client) DescribeBatchResultDetail(request *DescribeBatchResultDetailRequest) (response *DescribeBatchResultDetailResponse, err error) { + response = CreateDescribeBatchResultDetailResponse() + err = client.DoAction(request, response) + return +} + +// DescribeBatchResultDetailWithChan invokes the alidns.DescribeBatchResultDetail API asynchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultdetail.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeBatchResultDetailWithChan(request *DescribeBatchResultDetailRequest) (<-chan *DescribeBatchResultDetailResponse, <-chan error) { + responseChan := make(chan *DescribeBatchResultDetailResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeBatchResultDetail(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeBatchResultDetailWithCallback invokes the alidns.DescribeBatchResultDetail API asynchronously +// api document: https://help.aliyun.com/api/alidns/describebatchresultdetail.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeBatchResultDetailWithCallback(request *DescribeBatchResultDetailRequest, callback func(response *DescribeBatchResultDetailResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeBatchResultDetailResponse + var err error + defer close(result) + response, err = client.DescribeBatchResultDetail(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeBatchResultDetailRequest is the request struct for api DescribeBatchResultDetail +type DescribeBatchResultDetailRequest struct { + *requests.RpcRequest + BatchType string `position:"Query" name:"BatchType"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + TaskId requests.Integer `position:"Query" name:"TaskId"` +} + +// DescribeBatchResultDetailResponse is the response struct for api DescribeBatchResultDetail +type DescribeBatchResultDetailResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalCount int `json:"TotalCount" xml:"TotalCount"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + BatchResultDetails BatchResultDetails `json:"BatchResultDetails" xml:"BatchResultDetails"` +} + +// CreateDescribeBatchResultDetailRequest creates a request to invoke DescribeBatchResultDetail API +func CreateDescribeBatchResultDetailRequest() (request *DescribeBatchResultDetailRequest) { + request = &DescribeBatchResultDetailRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeBatchResultDetail", "alidns", "openAPI") + return +} + +// CreateDescribeBatchResultDetailResponse creates a response to parse from DescribeBatchResultDetail response +func CreateDescribeBatchResultDetailResponse() (response *DescribeBatchResultDetailResponse) { + response = &DescribeBatchResultDetailResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instance.go index b92bf783..cddd4427 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instance.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instance.go @@ -76,9 +76,9 @@ func (client *Client) DescribeDnsProductInstanceWithCallback(request *DescribeDn // DescribeDnsProductInstanceRequest is the request struct for api DescribeDnsProductInstance type DescribeDnsProductInstanceRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` } // DescribeDnsProductInstanceResponse is the response struct for api DescribeDnsProductInstance @@ -113,6 +113,9 @@ type DescribeDnsProductInstanceResponse struct { Gslb bool `json:"Gslb" xml:"Gslb"` InClean bool `json:"InClean" xml:"InClean"` InBlackHole bool `json:"InBlackHole" xml:"InBlackHole"` + BindDomainCount int `json:"BindDomainCount" xml:"BindDomainCount"` + BindDomainUsedCount int `json:"BindDomainUsedCount" xml:"BindDomainUsedCount"` + DnsSecurity string `json:"DnsSecurity" xml:"DnsSecurity"` DnsServers DnsServersInDescribeDnsProductInstance `json:"DnsServers" xml:"DnsServers"` } @@ -121,7 +124,7 @@ func CreateDescribeDnsProductInstanceRequest() (request *DescribeDnsProductInsta request = &DescribeDnsProductInstanceRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDnsProductInstance", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDnsProductInstance", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instances.go index ae17278e..d15157f0 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instances.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dns_product_instances.go @@ -76,11 +76,11 @@ func (client *Client) DescribeDnsProductInstancesWithCallback(request *DescribeD // DescribeDnsProductInstancesRequest is the request struct for api DescribeDnsProductInstances type DescribeDnsProductInstancesRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` VersionCode string `position:"Query" name:"VersionCode"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeDnsProductInstancesResponse is the response struct for api DescribeDnsProductInstances @@ -98,7 +98,7 @@ func CreateDescribeDnsProductInstancesRequest() (request *DescribeDnsProductInst request = &DescribeDnsProductInstancesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDnsProductInstances", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDnsProductInstances", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dnsslb_sub_domains.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dnsslb_sub_domains.go index b545f411..fa8444e5 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dnsslb_sub_domains.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_dnsslb_sub_domains.go @@ -76,11 +76,11 @@ func (client *Client) DescribeDNSSLBSubDomainsWithCallback(request *DescribeDNSS // DescribeDNSSLBSubDomainsRequest is the request struct for api DescribeDNSSLBSubDomains type DescribeDNSSLBSubDomainsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeDNSSLBSubDomainsResponse is the response struct for api DescribeDNSSLBSubDomains @@ -98,7 +98,7 @@ func CreateDescribeDNSSLBSubDomainsRequest() (request *DescribeDNSSLBSubDomainsR request = &DescribeDNSSLBSubDomainsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDNSSLBSubDomains", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDNSSLBSubDomains", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_groups.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_groups.go index ffe1f1f3..b2280a06 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_groups.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_groups.go @@ -76,11 +76,11 @@ func (client *Client) DescribeDomainGroupsWithCallback(request *DescribeDomainGr // DescribeDomainGroupsRequest is the request struct for api DescribeDomainGroups type DescribeDomainGroupsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` KeyWord string `position:"Query" name:"KeyWord"` PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` } // DescribeDomainGroupsResponse is the response struct for api DescribeDomainGroups @@ -98,7 +98,7 @@ func CreateDescribeDomainGroupsRequest() (request *DescribeDomainGroupsRequest) request = &DescribeDomainGroupsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainGroups", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainGroups", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_info.go index 0f6f3e08..1e640d0b 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_info.go @@ -76,9 +76,9 @@ func (client *Client) DescribeDomainInfoWithCallback(request *DescribeDomainInfo // DescribeDomainInfoRequest is the request struct for api DescribeDomainInfo type DescribeDomainInfoRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` NeedDetailAttributes requests.Boolean `position:"Query" name:"NeedDetailAttributes"` } @@ -100,6 +100,9 @@ type DescribeDomainInfoResponse struct { RecordLineTreeJson string `json:"RecordLineTreeJson" xml:"RecordLineTreeJson"` LineType string `json:"LineType" xml:"LineType"` RegionLines bool `json:"RegionLines" xml:"RegionLines"` + InBlackHole bool `json:"InBlackHole" xml:"InBlackHole"` + InClean bool `json:"InClean" xml:"InClean"` + SlaveDns bool `json:"SlaveDns" xml:"SlaveDns"` DnsServers DnsServersInDescribeDomainInfo `json:"DnsServers" xml:"DnsServers"` AvailableTtls AvailableTtls `json:"AvailableTtls" xml:"AvailableTtls"` RecordLines RecordLinesInDescribeDomainInfo `json:"RecordLines" xml:"RecordLines"` @@ -110,7 +113,7 @@ func CreateDescribeDomainInfoRequest() (request *DescribeDomainInfoRequest) { request = &DescribeDomainInfoRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainInfo", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainInfo", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_logs.go index 39e18ce8..05574c67 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_logs.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_logs.go @@ -76,14 +76,15 @@ func (client *Client) DescribeDomainLogsWithCallback(request *DescribeDomainLogs // DescribeDomainLogsRequest is the request struct for api DescribeDomainLogs type DescribeDomainLogsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - KeyWord string `position:"Query" name:"KeyWord"` - GroupId string `position:"Query" name:"GroupId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - StartDate string `position:"Query" name:"StartDate"` EndDate string `position:"Query" name:"endDate"` + GroupId string `position:"Query" name:"GroupId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + KeyWord string `position:"Query" name:"KeyWord"` + StartDate string `position:"Query" name:"StartDate"` + Type string `position:"Query" name:"Type"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeDomainLogsResponse is the response struct for api DescribeDomainLogs @@ -101,7 +102,7 @@ func CreateDescribeDomainLogsRequest() (request *DescribeDomainLogsRequest) { request = &DescribeDomainLogsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainLogs", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainLogs", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_ns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_ns.go index 51c86a95..8bd6a5b4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_ns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_ns.go @@ -76,9 +76,9 @@ func (client *Client) DescribeDomainNsWithCallback(request *DescribeDomainNsRequ // DescribeDomainNsRequest is the request struct for api DescribeDomainNs type DescribeDomainNsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` } // DescribeDomainNsResponse is the response struct for api DescribeDomainNs @@ -96,7 +96,7 @@ func CreateDescribeDomainNsRequest() (request *DescribeDomainNsRequest) { request = &DescribeDomainNsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainNs", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainNs", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_record_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_record_info.go index c59a7c52..0d1a5cba 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_record_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_record_info.go @@ -76,9 +76,9 @@ func (client *Client) DescribeDomainRecordInfoWithCallback(request *DescribeDoma // DescribeDomainRecordInfoRequest is the request struct for api DescribeDomainRecordInfo type DescribeDomainRecordInfoRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` RecordId string `position:"Query" name:"RecordId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` } // DescribeDomainRecordInfoResponse is the response struct for api DescribeDomainRecordInfo @@ -106,7 +106,7 @@ func CreateDescribeDomainRecordInfoRequest() (request *DescribeDomainRecordInfoR request = &DescribeDomainRecordInfoRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainRecordInfo", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainRecordInfo", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_records.go index bc905384..d959225a 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_records.go @@ -76,16 +76,18 @@ func (client *Client) DescribeDomainRecordsWithCallback(request *DescribeDomainR // DescribeDomainRecordsRequest is the request struct for api DescribeDomainRecords type DescribeDomainRecordsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - DomainName string `position:"Query" name:"DomainName"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` - PageSize requests.Integer `position:"Query" name:"PageSize"` - KeyWord string `position:"Query" name:"KeyWord"` - RRKeyWord string `position:"Query" name:"RRKeyWord"` - TypeKeyWord string `position:"Query" name:"TypeKeyWord"` ValueKeyWord string `position:"Query" name:"ValueKeyWord"` + GroupId requests.Integer `position:"Query" name:"GroupId"` + DomainName string `position:"Query" name:"DomainName"` OrderBy string `position:"Query" name:"OrderBy"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + SearchMode string `position:"Query" name:"SearchMode"` + Lang string `position:"Query" name:"Lang"` + KeyWord string `position:"Query" name:"KeyWord"` + TypeKeyWord string `position:"Query" name:"TypeKeyWord"` + RRKeyWord string `position:"Query" name:"RRKeyWord"` Direction string `position:"Query" name:"Direction"` } @@ -104,7 +106,7 @@ func CreateDescribeDomainRecordsRequest() (request *DescribeDomainRecordsRequest request = &DescribeDomainRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainRecords", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainRecords", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_whois_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_whois_info.go deleted file mode 100644 index 9984f6df..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domain_whois_info.go +++ /dev/null @@ -1,113 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// DescribeDomainWhoisInfo invokes the alidns.DescribeDomainWhoisInfo API synchronously -// api document: https://help.aliyun.com/api/alidns/describedomainwhoisinfo.html -func (client *Client) DescribeDomainWhoisInfo(request *DescribeDomainWhoisInfoRequest) (response *DescribeDomainWhoisInfoResponse, err error) { - response = CreateDescribeDomainWhoisInfoResponse() - err = client.DoAction(request, response) - return -} - -// DescribeDomainWhoisInfoWithChan invokes the alidns.DescribeDomainWhoisInfo API asynchronously -// api document: https://help.aliyun.com/api/alidns/describedomainwhoisinfo.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DescribeDomainWhoisInfoWithChan(request *DescribeDomainWhoisInfoRequest) (<-chan *DescribeDomainWhoisInfoResponse, <-chan error) { - responseChan := make(chan *DescribeDomainWhoisInfoResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.DescribeDomainWhoisInfo(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// DescribeDomainWhoisInfoWithCallback invokes the alidns.DescribeDomainWhoisInfo API asynchronously -// api document: https://help.aliyun.com/api/alidns/describedomainwhoisinfo.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) DescribeDomainWhoisInfoWithCallback(request *DescribeDomainWhoisInfoRequest, callback func(response *DescribeDomainWhoisInfoResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *DescribeDomainWhoisInfoResponse - var err error - defer close(result) - response, err = client.DescribeDomainWhoisInfo(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// DescribeDomainWhoisInfoRequest is the request struct for api DescribeDomainWhoisInfo -type DescribeDomainWhoisInfoRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - DomainName string `position:"Query" name:"DomainName"` - GroupId string `position:"Query" name:"GroupId"` -} - -// DescribeDomainWhoisInfoResponse is the response struct for api DescribeDomainWhoisInfo -type DescribeDomainWhoisInfoResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - RegistrantName string `json:"RegistrantName" xml:"RegistrantName"` - RegistrantEmail string `json:"RegistrantEmail" xml:"RegistrantEmail"` - Registrar string `json:"Registrar" xml:"Registrar"` - RegistrationDate string `json:"RegistrationDate" xml:"RegistrationDate"` - ExpirationDate string `json:"ExpirationDate" xml:"ExpirationDate"` - StatusList StatusList `json:"StatusList" xml:"StatusList"` - DnsServers DnsServersInDescribeDomainWhoisInfo `json:"DnsServers" xml:"DnsServers"` -} - -// CreateDescribeDomainWhoisInfoRequest creates a request to invoke DescribeDomainWhoisInfo API -func CreateDescribeDomainWhoisInfoRequest() (request *DescribeDomainWhoisInfoRequest) { - request = &DescribeDomainWhoisInfoRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomainWhoisInfo", "", "") - return -} - -// CreateDescribeDomainWhoisInfoResponse creates a response to parse from DescribeDomainWhoisInfo response -func CreateDescribeDomainWhoisInfoResponse() (response *DescribeDomainWhoisInfoResponse) { - response = &DescribeDomainWhoisInfoResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domains.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domains.go index a49982b7..838f97f4 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domains.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_domains.go @@ -76,12 +76,13 @@ func (client *Client) DescribeDomainsWithCallback(request *DescribeDomainsReques // DescribeDomainsRequest is the request struct for api DescribeDomains type DescribeDomainsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - KeyWord string `position:"Query" name:"KeyWord"` GroupId string `position:"Query" name:"GroupId"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` + UserClientIp string `position:"Query" name:"UserClientIp"` PageSize requests.Integer `position:"Query" name:"PageSize"` + SearchMode string `position:"Query" name:"SearchMode"` + Lang string `position:"Query" name:"Lang"` + KeyWord string `position:"Query" name:"KeyWord"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeDomainsResponse is the response struct for api DescribeDomains @@ -99,7 +100,7 @@ func CreateDescribeDomainsRequest() (request *DescribeDomainsRequest) { request = &DescribeDomainsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomains", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeDomains", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategies.go new file mode 100644 index 00000000..0cef54d0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategies.go @@ -0,0 +1,112 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmAccessStrategies invokes the alidns.DescribeGtmAccessStrategies API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategies.html +func (client *Client) DescribeGtmAccessStrategies(request *DescribeGtmAccessStrategiesRequest) (response *DescribeGtmAccessStrategiesResponse, err error) { + response = CreateDescribeGtmAccessStrategiesResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmAccessStrategiesWithChan invokes the alidns.DescribeGtmAccessStrategies API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategies.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategiesWithChan(request *DescribeGtmAccessStrategiesRequest) (<-chan *DescribeGtmAccessStrategiesResponse, <-chan error) { + responseChan := make(chan *DescribeGtmAccessStrategiesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmAccessStrategies(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmAccessStrategiesWithCallback invokes the alidns.DescribeGtmAccessStrategies API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategies.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategiesWithCallback(request *DescribeGtmAccessStrategiesRequest, callback func(response *DescribeGtmAccessStrategiesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmAccessStrategiesResponse + var err error + defer close(result) + response, err = client.DescribeGtmAccessStrategies(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmAccessStrategiesRequest is the request struct for api DescribeGtmAccessStrategies +type DescribeGtmAccessStrategiesRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` +} + +// DescribeGtmAccessStrategiesResponse is the response struct for api DescribeGtmAccessStrategies +type DescribeGtmAccessStrategiesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalItems int `json:"TotalItems" xml:"TotalItems"` + TotalPages int `json:"TotalPages" xml:"TotalPages"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + Strategies Strategies `json:"Strategies" xml:"Strategies"` +} + +// CreateDescribeGtmAccessStrategiesRequest creates a request to invoke DescribeGtmAccessStrategies API +func CreateDescribeGtmAccessStrategiesRequest() (request *DescribeGtmAccessStrategiesRequest) { + request = &DescribeGtmAccessStrategiesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmAccessStrategies", "alidns", "openAPI") + return +} + +// CreateDescribeGtmAccessStrategiesResponse creates a response to parse from DescribeGtmAccessStrategies response +func CreateDescribeGtmAccessStrategiesResponse() (response *DescribeGtmAccessStrategiesResponse) { + response = &DescribeGtmAccessStrategiesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy.go new file mode 100644 index 00000000..4a0a0025 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy.go @@ -0,0 +1,116 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmAccessStrategy invokes the alidns.DescribeGtmAccessStrategy API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategy.html +func (client *Client) DescribeGtmAccessStrategy(request *DescribeGtmAccessStrategyRequest) (response *DescribeGtmAccessStrategyResponse, err error) { + response = CreateDescribeGtmAccessStrategyResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmAccessStrategyWithChan invokes the alidns.DescribeGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategyWithChan(request *DescribeGtmAccessStrategyRequest) (<-chan *DescribeGtmAccessStrategyResponse, <-chan error) { + responseChan := make(chan *DescribeGtmAccessStrategyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmAccessStrategy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmAccessStrategyWithCallback invokes the alidns.DescribeGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategyWithCallback(request *DescribeGtmAccessStrategyRequest, callback func(response *DescribeGtmAccessStrategyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmAccessStrategyResponse + var err error + defer close(result) + response, err = client.DescribeGtmAccessStrategy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmAccessStrategyRequest is the request struct for api DescribeGtmAccessStrategy +type DescribeGtmAccessStrategyRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + StrategyId string `position:"Query" name:"StrategyId"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmAccessStrategyResponse is the response struct for api DescribeGtmAccessStrategy +type DescribeGtmAccessStrategyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + StrategyId string `json:"StrategyId" xml:"StrategyId"` + StrategyName string `json:"StrategyName" xml:"StrategyName"` + DefultAddrPoolId string `json:"DefultAddrPoolId" xml:"DefultAddrPoolId"` + DefaultAddrPoolName string `json:"DefaultAddrPoolName" xml:"DefaultAddrPoolName"` + FailoverAddrPoolId string `json:"FailoverAddrPoolId" xml:"FailoverAddrPoolId"` + FailoverAddrPoolName string `json:"FailoverAddrPoolName" xml:"FailoverAddrPoolName"` + StrategyMode string `json:"StrategyMode" xml:"StrategyMode"` + AccessMode string `json:"AccessMode" xml:"AccessMode"` + AccessStatus string `json:"AccessStatus" xml:"AccessStatus"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Lines LinesInDescribeGtmAccessStrategy `json:"Lines" xml:"Lines"` +} + +// CreateDescribeGtmAccessStrategyRequest creates a request to invoke DescribeGtmAccessStrategy API +func CreateDescribeGtmAccessStrategyRequest() (request *DescribeGtmAccessStrategyRequest) { + request = &DescribeGtmAccessStrategyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmAccessStrategy", "alidns", "openAPI") + return +} + +// CreateDescribeGtmAccessStrategyResponse creates a response to parse from DescribeGtmAccessStrategy response +func CreateDescribeGtmAccessStrategyResponse() (response *DescribeGtmAccessStrategyResponse) { + response = &DescribeGtmAccessStrategyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy_available_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy_available_config.go new file mode 100644 index 00000000..57558429 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_access_strategy_available_config.go @@ -0,0 +1,107 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmAccessStrategyAvailableConfig invokes the alidns.DescribeGtmAccessStrategyAvailableConfig API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategyavailableconfig.html +func (client *Client) DescribeGtmAccessStrategyAvailableConfig(request *DescribeGtmAccessStrategyAvailableConfigRequest) (response *DescribeGtmAccessStrategyAvailableConfigResponse, err error) { + response = CreateDescribeGtmAccessStrategyAvailableConfigResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmAccessStrategyAvailableConfigWithChan invokes the alidns.DescribeGtmAccessStrategyAvailableConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategyavailableconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategyAvailableConfigWithChan(request *DescribeGtmAccessStrategyAvailableConfigRequest) (<-chan *DescribeGtmAccessStrategyAvailableConfigResponse, <-chan error) { + responseChan := make(chan *DescribeGtmAccessStrategyAvailableConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmAccessStrategyAvailableConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmAccessStrategyAvailableConfigWithCallback invokes the alidns.DescribeGtmAccessStrategyAvailableConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmaccessstrategyavailableconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAccessStrategyAvailableConfigWithCallback(request *DescribeGtmAccessStrategyAvailableConfigRequest, callback func(response *DescribeGtmAccessStrategyAvailableConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmAccessStrategyAvailableConfigResponse + var err error + defer close(result) + response, err = client.DescribeGtmAccessStrategyAvailableConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmAccessStrategyAvailableConfigRequest is the request struct for api DescribeGtmAccessStrategyAvailableConfig +type DescribeGtmAccessStrategyAvailableConfigRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmAccessStrategyAvailableConfigResponse is the response struct for api DescribeGtmAccessStrategyAvailableConfig +type DescribeGtmAccessStrategyAvailableConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AddrPools AddrPoolsInDescribeGtmAccessStrategyAvailableConfig `json:"AddrPools" xml:"AddrPools"` + Lines LinesInDescribeGtmAccessStrategyAvailableConfig `json:"Lines" xml:"Lines"` +} + +// CreateDescribeGtmAccessStrategyAvailableConfigRequest creates a request to invoke DescribeGtmAccessStrategyAvailableConfig API +func CreateDescribeGtmAccessStrategyAvailableConfigRequest() (request *DescribeGtmAccessStrategyAvailableConfigRequest) { + request = &DescribeGtmAccessStrategyAvailableConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmAccessStrategyAvailableConfig", "alidns", "openAPI") + return +} + +// CreateDescribeGtmAccessStrategyAvailableConfigResponse creates a response to parse from DescribeGtmAccessStrategyAvailableConfig response +func CreateDescribeGtmAccessStrategyAvailableConfigResponse() (response *DescribeGtmAccessStrategyAvailableConfigResponse) { + response = &DescribeGtmAccessStrategyAvailableConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_available_alert_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_available_alert_group.go new file mode 100644 index 00000000..acd91cb1 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_available_alert_group.go @@ -0,0 +1,105 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmAvailableAlertGroup invokes the alidns.DescribeGtmAvailableAlertGroup API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmavailablealertgroup.html +func (client *Client) DescribeGtmAvailableAlertGroup(request *DescribeGtmAvailableAlertGroupRequest) (response *DescribeGtmAvailableAlertGroupResponse, err error) { + response = CreateDescribeGtmAvailableAlertGroupResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmAvailableAlertGroupWithChan invokes the alidns.DescribeGtmAvailableAlertGroup API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmavailablealertgroup.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAvailableAlertGroupWithChan(request *DescribeGtmAvailableAlertGroupRequest) (<-chan *DescribeGtmAvailableAlertGroupResponse, <-chan error) { + responseChan := make(chan *DescribeGtmAvailableAlertGroupResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmAvailableAlertGroup(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmAvailableAlertGroupWithCallback invokes the alidns.DescribeGtmAvailableAlertGroup API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmavailablealertgroup.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmAvailableAlertGroupWithCallback(request *DescribeGtmAvailableAlertGroupRequest, callback func(response *DescribeGtmAvailableAlertGroupResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmAvailableAlertGroupResponse + var err error + defer close(result) + response, err = client.DescribeGtmAvailableAlertGroup(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmAvailableAlertGroupRequest is the request struct for api DescribeGtmAvailableAlertGroup +type DescribeGtmAvailableAlertGroupRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmAvailableAlertGroupResponse is the response struct for api DescribeGtmAvailableAlertGroup +type DescribeGtmAvailableAlertGroupResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AvailableAlertGroup string `json:"AvailableAlertGroup" xml:"AvailableAlertGroup"` +} + +// CreateDescribeGtmAvailableAlertGroupRequest creates a request to invoke DescribeGtmAvailableAlertGroup API +func CreateDescribeGtmAvailableAlertGroupRequest() (request *DescribeGtmAvailableAlertGroupRequest) { + request = &DescribeGtmAvailableAlertGroupRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmAvailableAlertGroup", "alidns", "openAPI") + return +} + +// CreateDescribeGtmAvailableAlertGroupResponse creates a response to parse from DescribeGtmAvailableAlertGroup response +func CreateDescribeGtmAvailableAlertGroupResponse() (response *DescribeGtmAvailableAlertGroupResponse) { + response = &DescribeGtmAvailableAlertGroupResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance.go new file mode 100644 index 00000000..ef86a648 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance.go @@ -0,0 +1,117 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmInstance invokes the alidns.DescribeGtmInstance API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstance.html +func (client *Client) DescribeGtmInstance(request *DescribeGtmInstanceRequest) (response *DescribeGtmInstanceResponse, err error) { + response = CreateDescribeGtmInstanceResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmInstanceWithChan invokes the alidns.DescribeGtmInstance API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstance.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceWithChan(request *DescribeGtmInstanceRequest) (<-chan *DescribeGtmInstanceResponse, <-chan error) { + responseChan := make(chan *DescribeGtmInstanceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmInstance(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmInstanceWithCallback invokes the alidns.DescribeGtmInstance API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstance.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceWithCallback(request *DescribeGtmInstanceRequest, callback func(response *DescribeGtmInstanceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmInstanceResponse + var err error + defer close(result) + response, err = client.DescribeGtmInstance(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmInstanceRequest is the request struct for api DescribeGtmInstance +type DescribeGtmInstanceRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmInstanceResponse is the response struct for api DescribeGtmInstance +type DescribeGtmInstanceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + VersionCode string `json:"VersionCode" xml:"VersionCode"` + ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` + ExpireTimestamp int `json:"ExpireTimestamp" xml:"ExpireTimestamp"` + Cname string `json:"Cname" xml:"Cname"` + UserDomainName string `json:"UserDomainName" xml:"UserDomainName"` + Ttl int `json:"Ttl" xml:"Ttl"` + LbaStrategy string `json:"LbaStrategy" xml:"LbaStrategy"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + AlertGroup string `json:"AlertGroup" xml:"AlertGroup"` +} + +// CreateDescribeGtmInstanceRequest creates a request to invoke DescribeGtmInstance API +func CreateDescribeGtmInstanceRequest() (request *DescribeGtmInstanceRequest) { + request = &DescribeGtmInstanceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmInstance", "alidns", "openAPI") + return +} + +// CreateDescribeGtmInstanceResponse creates a response to parse from DescribeGtmInstance response +func CreateDescribeGtmInstanceResponse() (response *DescribeGtmInstanceResponse) { + response = &DescribeGtmInstanceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pool.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pool.go new file mode 100644 index 00000000..5366ef62 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pool.go @@ -0,0 +1,118 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmInstanceAddressPool invokes the alidns.DescribeGtmInstanceAddressPool API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspool.html +func (client *Client) DescribeGtmInstanceAddressPool(request *DescribeGtmInstanceAddressPoolRequest) (response *DescribeGtmInstanceAddressPoolResponse, err error) { + response = CreateDescribeGtmInstanceAddressPoolResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmInstanceAddressPoolWithChan invokes the alidns.DescribeGtmInstanceAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceAddressPoolWithChan(request *DescribeGtmInstanceAddressPoolRequest) (<-chan *DescribeGtmInstanceAddressPoolResponse, <-chan error) { + responseChan := make(chan *DescribeGtmInstanceAddressPoolResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmInstanceAddressPool(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmInstanceAddressPoolWithCallback invokes the alidns.DescribeGtmInstanceAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceAddressPoolWithCallback(request *DescribeGtmInstanceAddressPoolRequest, callback func(response *DescribeGtmInstanceAddressPoolResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmInstanceAddressPoolResponse + var err error + defer close(result) + response, err = client.DescribeGtmInstanceAddressPool(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmInstanceAddressPoolRequest is the request struct for api DescribeGtmInstanceAddressPool +type DescribeGtmInstanceAddressPoolRequest struct { + *requests.RpcRequest + AddrPoolId string `position:"Query" name:"AddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmInstanceAddressPoolResponse is the response struct for api DescribeGtmInstanceAddressPool +type DescribeGtmInstanceAddressPoolResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AddrPoolId string `json:"AddrPoolId" xml:"AddrPoolId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + UpdateTime string `json:"UpdateTime" xml:"UpdateTime"` + UpdateTimestamp int `json:"UpdateTimestamp" xml:"UpdateTimestamp"` + AddrCount int `json:"AddrCount" xml:"AddrCount"` + MinAvailableAddrNum int `json:"MinAvailableAddrNum" xml:"MinAvailableAddrNum"` + MonitorConfigId string `json:"MonitorConfigId" xml:"MonitorConfigId"` + MonitorStatus string `json:"MonitorStatus" xml:"MonitorStatus"` + Name string `json:"Name" xml:"Name"` + Status string `json:"Status" xml:"Status"` + Type string `json:"Type" xml:"Type"` + Addrs Addrs `json:"Addrs" xml:"Addrs"` +} + +// CreateDescribeGtmInstanceAddressPoolRequest creates a request to invoke DescribeGtmInstanceAddressPool API +func CreateDescribeGtmInstanceAddressPoolRequest() (request *DescribeGtmInstanceAddressPoolRequest) { + request = &DescribeGtmInstanceAddressPoolRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmInstanceAddressPool", "alidns", "openAPI") + return +} + +// CreateDescribeGtmInstanceAddressPoolResponse creates a response to parse from DescribeGtmInstanceAddressPool response +func CreateDescribeGtmInstanceAddressPoolResponse() (response *DescribeGtmInstanceAddressPoolResponse) { + response = &DescribeGtmInstanceAddressPoolResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pools.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pools.go new file mode 100644 index 00000000..b3af1369 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_address_pools.go @@ -0,0 +1,112 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmInstanceAddressPools invokes the alidns.DescribeGtmInstanceAddressPools API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspools.html +func (client *Client) DescribeGtmInstanceAddressPools(request *DescribeGtmInstanceAddressPoolsRequest) (response *DescribeGtmInstanceAddressPoolsResponse, err error) { + response = CreateDescribeGtmInstanceAddressPoolsResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmInstanceAddressPoolsWithChan invokes the alidns.DescribeGtmInstanceAddressPools API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspools.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceAddressPoolsWithChan(request *DescribeGtmInstanceAddressPoolsRequest) (<-chan *DescribeGtmInstanceAddressPoolsResponse, <-chan error) { + responseChan := make(chan *DescribeGtmInstanceAddressPoolsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmInstanceAddressPools(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmInstanceAddressPoolsWithCallback invokes the alidns.DescribeGtmInstanceAddressPools API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstanceaddresspools.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceAddressPoolsWithCallback(request *DescribeGtmInstanceAddressPoolsRequest, callback func(response *DescribeGtmInstanceAddressPoolsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmInstanceAddressPoolsResponse + var err error + defer close(result) + response, err = client.DescribeGtmInstanceAddressPools(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmInstanceAddressPoolsRequest is the request struct for api DescribeGtmInstanceAddressPools +type DescribeGtmInstanceAddressPoolsRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` +} + +// DescribeGtmInstanceAddressPoolsResponse is the response struct for api DescribeGtmInstanceAddressPools +type DescribeGtmInstanceAddressPoolsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalItems int `json:"TotalItems" xml:"TotalItems"` + TotalPages int `json:"TotalPages" xml:"TotalPages"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + AddrPools AddrPoolsInDescribeGtmInstanceAddressPools `json:"AddrPools" xml:"AddrPools"` +} + +// CreateDescribeGtmInstanceAddressPoolsRequest creates a request to invoke DescribeGtmInstanceAddressPools API +func CreateDescribeGtmInstanceAddressPoolsRequest() (request *DescribeGtmInstanceAddressPoolsRequest) { + request = &DescribeGtmInstanceAddressPoolsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmInstanceAddressPools", "alidns", "openAPI") + return +} + +// CreateDescribeGtmInstanceAddressPoolsResponse creates a response to parse from DescribeGtmInstanceAddressPools response +func CreateDescribeGtmInstanceAddressPoolsResponse() (response *DescribeGtmInstanceAddressPoolsResponse) { + response = &DescribeGtmInstanceAddressPoolsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_status.go new file mode 100644 index 00000000..542e1941 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instance_status.go @@ -0,0 +1,107 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmInstanceStatus invokes the alidns.DescribeGtmInstanceStatus API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstancestatus.html +func (client *Client) DescribeGtmInstanceStatus(request *DescribeGtmInstanceStatusRequest) (response *DescribeGtmInstanceStatusResponse, err error) { + response = CreateDescribeGtmInstanceStatusResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmInstanceStatusWithChan invokes the alidns.DescribeGtmInstanceStatus API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstancestatus.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceStatusWithChan(request *DescribeGtmInstanceStatusRequest) (<-chan *DescribeGtmInstanceStatusResponse, <-chan error) { + responseChan := make(chan *DescribeGtmInstanceStatusResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmInstanceStatus(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmInstanceStatusWithCallback invokes the alidns.DescribeGtmInstanceStatus API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstancestatus.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstanceStatusWithCallback(request *DescribeGtmInstanceStatusRequest, callback func(response *DescribeGtmInstanceStatusResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmInstanceStatusResponse + var err error + defer close(result) + response, err = client.DescribeGtmInstanceStatus(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmInstanceStatusRequest is the request struct for api DescribeGtmInstanceStatus +type DescribeGtmInstanceStatusRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmInstanceStatusResponse is the response struct for api DescribeGtmInstanceStatus +type DescribeGtmInstanceStatusResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + AccessStatus string `json:"AccessStatus" xml:"AccessStatus"` + AlertStatus string `json:"AlertStatus" xml:"AlertStatus"` +} + +// CreateDescribeGtmInstanceStatusRequest creates a request to invoke DescribeGtmInstanceStatus API +func CreateDescribeGtmInstanceStatusRequest() (request *DescribeGtmInstanceStatusRequest) { + request = &DescribeGtmInstanceStatusRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmInstanceStatus", "alidns", "openAPI") + return +} + +// CreateDescribeGtmInstanceStatusResponse creates a response to parse from DescribeGtmInstanceStatus response +func CreateDescribeGtmInstanceStatusResponse() (response *DescribeGtmInstanceStatusResponse) { + response = &DescribeGtmInstanceStatusResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instances.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instances.go new file mode 100644 index 00000000..4303fd2a --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_instances.go @@ -0,0 +1,112 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmInstances invokes the alidns.DescribeGtmInstances API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstances.html +func (client *Client) DescribeGtmInstances(request *DescribeGtmInstancesRequest) (response *DescribeGtmInstancesResponse, err error) { + response = CreateDescribeGtmInstancesResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmInstancesWithChan invokes the alidns.DescribeGtmInstances API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstances.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstancesWithChan(request *DescribeGtmInstancesRequest) (<-chan *DescribeGtmInstancesResponse, <-chan error) { + responseChan := make(chan *DescribeGtmInstancesResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmInstances(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmInstancesWithCallback invokes the alidns.DescribeGtmInstances API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtminstances.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmInstancesWithCallback(request *DescribeGtmInstancesRequest, callback func(response *DescribeGtmInstancesResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmInstancesResponse + var err error + defer close(result) + response, err = client.DescribeGtmInstances(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmInstancesRequest is the request struct for api DescribeGtmInstances +type DescribeGtmInstancesRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + Keyword string `position:"Query" name:"Keyword"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` +} + +// DescribeGtmInstancesResponse is the response struct for api DescribeGtmInstances +type DescribeGtmInstancesResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + PageSize int `json:"PageSize" xml:"PageSize"` + TotalItems int `json:"TotalItems" xml:"TotalItems"` + TotalPages int `json:"TotalPages" xml:"TotalPages"` + GtmInstances GtmInstances `json:"GtmInstances" xml:"GtmInstances"` +} + +// CreateDescribeGtmInstancesRequest creates a request to invoke DescribeGtmInstances API +func CreateDescribeGtmInstancesRequest() (request *DescribeGtmInstancesRequest) { + request = &DescribeGtmInstancesRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmInstances", "alidns", "openAPI") + return +} + +// CreateDescribeGtmInstancesResponse creates a response to parse from DescribeGtmInstances response +func CreateDescribeGtmInstancesResponse() (response *DescribeGtmInstancesResponse) { + response = &DescribeGtmInstancesResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_logs.go new file mode 100644 index 00000000..6e8833bc --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_logs.go @@ -0,0 +1,115 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmLogs invokes the alidns.DescribeGtmLogs API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmlogs.html +func (client *Client) DescribeGtmLogs(request *DescribeGtmLogsRequest) (response *DescribeGtmLogsResponse, err error) { + response = CreateDescribeGtmLogsResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmLogsWithChan invokes the alidns.DescribeGtmLogs API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmlogs.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmLogsWithChan(request *DescribeGtmLogsRequest) (<-chan *DescribeGtmLogsResponse, <-chan error) { + responseChan := make(chan *DescribeGtmLogsResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmLogs(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmLogsWithCallback invokes the alidns.DescribeGtmLogs API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmlogs.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmLogsWithCallback(request *DescribeGtmLogsRequest, callback func(response *DescribeGtmLogsResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmLogsResponse + var err error + defer close(result) + response, err = client.DescribeGtmLogs(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmLogsRequest is the request struct for api DescribeGtmLogs +type DescribeGtmLogsRequest struct { + *requests.RpcRequest + InstanceId string `position:"Query" name:"InstanceId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` + Keyword string `position:"Query" name:"Keyword"` + StartTimestamp requests.Integer `position:"Query" name:"StartTimestamp"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` + EndTimestamp requests.Integer `position:"Query" name:"EndTimestamp"` +} + +// DescribeGtmLogsResponse is the response struct for api DescribeGtmLogs +type DescribeGtmLogsResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TotalItems int `json:"TotalItems" xml:"TotalItems"` + TotalPages int `json:"TotalPages" xml:"TotalPages"` + PageSize int `json:"PageSize" xml:"PageSize"` + PageNumber int `json:"PageNumber" xml:"PageNumber"` + Logs Logs `json:"Logs" xml:"Logs"` +} + +// CreateDescribeGtmLogsRequest creates a request to invoke DescribeGtmLogs API +func CreateDescribeGtmLogsRequest() (request *DescribeGtmLogsRequest) { + request = &DescribeGtmLogsRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmLogs", "alidns", "openAPI") + return +} + +// CreateDescribeGtmLogsResponse creates a response to parse from DescribeGtmLogs response +func CreateDescribeGtmLogsResponse() (response *DescribeGtmLogsResponse) { + response = &DescribeGtmLogsResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_available_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_available_config.go new file mode 100644 index 00000000..a0a6365f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_available_config.go @@ -0,0 +1,105 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmMonitorAvailableConfig invokes the alidns.DescribeGtmMonitorAvailableConfig API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitoravailableconfig.html +func (client *Client) DescribeGtmMonitorAvailableConfig(request *DescribeGtmMonitorAvailableConfigRequest) (response *DescribeGtmMonitorAvailableConfigResponse, err error) { + response = CreateDescribeGtmMonitorAvailableConfigResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmMonitorAvailableConfigWithChan invokes the alidns.DescribeGtmMonitorAvailableConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitoravailableconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmMonitorAvailableConfigWithChan(request *DescribeGtmMonitorAvailableConfigRequest) (<-chan *DescribeGtmMonitorAvailableConfigResponse, <-chan error) { + responseChan := make(chan *DescribeGtmMonitorAvailableConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmMonitorAvailableConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmMonitorAvailableConfigWithCallback invokes the alidns.DescribeGtmMonitorAvailableConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitoravailableconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmMonitorAvailableConfigWithCallback(request *DescribeGtmMonitorAvailableConfigRequest, callback func(response *DescribeGtmMonitorAvailableConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmMonitorAvailableConfigResponse + var err error + defer close(result) + response, err = client.DescribeGtmMonitorAvailableConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmMonitorAvailableConfigRequest is the request struct for api DescribeGtmMonitorAvailableConfig +type DescribeGtmMonitorAvailableConfigRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmMonitorAvailableConfigResponse is the response struct for api DescribeGtmMonitorAvailableConfig +type DescribeGtmMonitorAvailableConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + IspCityNodes IspCityNodesInDescribeGtmMonitorAvailableConfig `json:"IspCityNodes" xml:"IspCityNodes"` +} + +// CreateDescribeGtmMonitorAvailableConfigRequest creates a request to invoke DescribeGtmMonitorAvailableConfig API +func CreateDescribeGtmMonitorAvailableConfigRequest() (request *DescribeGtmMonitorAvailableConfigRequest) { + request = &DescribeGtmMonitorAvailableConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmMonitorAvailableConfig", "alidns", "openAPI") + return +} + +// CreateDescribeGtmMonitorAvailableConfigResponse creates a response to parse from DescribeGtmMonitorAvailableConfig response +func CreateDescribeGtmMonitorAvailableConfigResponse() (response *DescribeGtmMonitorAvailableConfigResponse) { + response = &DescribeGtmMonitorAvailableConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_config.go new file mode 100644 index 00000000..2aa171e3 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_gtm_monitor_config.go @@ -0,0 +1,117 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// DescribeGtmMonitorConfig invokes the alidns.DescribeGtmMonitorConfig API synchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitorconfig.html +func (client *Client) DescribeGtmMonitorConfig(request *DescribeGtmMonitorConfigRequest) (response *DescribeGtmMonitorConfigResponse, err error) { + response = CreateDescribeGtmMonitorConfigResponse() + err = client.DoAction(request, response) + return +} + +// DescribeGtmMonitorConfigWithChan invokes the alidns.DescribeGtmMonitorConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitorconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmMonitorConfigWithChan(request *DescribeGtmMonitorConfigRequest) (<-chan *DescribeGtmMonitorConfigResponse, <-chan error) { + responseChan := make(chan *DescribeGtmMonitorConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.DescribeGtmMonitorConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// DescribeGtmMonitorConfigWithCallback invokes the alidns.DescribeGtmMonitorConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/describegtmmonitorconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) DescribeGtmMonitorConfigWithCallback(request *DescribeGtmMonitorConfigRequest, callback func(response *DescribeGtmMonitorConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *DescribeGtmMonitorConfigResponse + var err error + defer close(result) + response, err = client.DescribeGtmMonitorConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// DescribeGtmMonitorConfigRequest is the request struct for api DescribeGtmMonitorConfig +type DescribeGtmMonitorConfigRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + MonitorConfigId string `position:"Query" name:"MonitorConfigId"` + Lang string `position:"Query" name:"Lang"` +} + +// DescribeGtmMonitorConfigResponse is the response struct for api DescribeGtmMonitorConfig +type DescribeGtmMonitorConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + MonitorConfigId string `json:"MonitorConfigId" xml:"MonitorConfigId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + UpdateTime string `json:"UpdateTime" xml:"UpdateTime"` + UpdateTimestamp int `json:"UpdateTimestamp" xml:"UpdateTimestamp"` + Name string `json:"Name" xml:"Name"` + ProtocolType string `json:"ProtocolType" xml:"ProtocolType"` + Interval int `json:"Interval" xml:"Interval"` + EvaluationCount int `json:"EvaluationCount" xml:"EvaluationCount"` + Timeout int `json:"Timeout" xml:"Timeout"` + MonitorExtendInfo string `json:"MonitorExtendInfo" xml:"MonitorExtendInfo"` + IspCityNodes IspCityNodesInDescribeGtmMonitorConfig `json:"IspCityNodes" xml:"IspCityNodes"` +} + +// CreateDescribeGtmMonitorConfigRequest creates a request to invoke DescribeGtmMonitorConfig API +func CreateDescribeGtmMonitorConfigRequest() (request *DescribeGtmMonitorConfigRequest) { + request = &DescribeGtmMonitorConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeGtmMonitorConfig", "alidns", "openAPI") + return +} + +// CreateDescribeGtmMonitorConfigResponse creates a response to parse from DescribeGtmMonitorConfig response +func CreateDescribeGtmMonitorConfigResponse() (response *DescribeGtmMonitorConfigResponse) { + response = &DescribeGtmMonitorConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_record_logs.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_record_logs.go index d9cd3e62..3b6087a6 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_record_logs.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_record_logs.go @@ -76,14 +76,14 @@ func (client *Client) DescribeRecordLogsWithCallback(request *DescribeRecordLogs // DescribeRecordLogsRequest is the request struct for api DescribeRecordLogs type DescribeRecordLogsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + EndDate string `position:"Query" name:"endDate"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` PageSize requests.Integer `position:"Query" name:"PageSize"` + Lang string `position:"Query" name:"Lang"` KeyWord string `position:"Query" name:"KeyWord"` StartDate string `position:"Query" name:"StartDate"` - EndDate string `position:"Query" name:"endDate"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeRecordLogsResponse is the response struct for api DescribeRecordLogs @@ -101,7 +101,7 @@ func CreateDescribeRecordLogsRequest() (request *DescribeRecordLogsRequest) { request = &DescribeRecordLogsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeRecordLogs", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeRecordLogs", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_sub_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_sub_domain_records.go index 2b4ae7d9..994d5e6f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_sub_domain_records.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_sub_domain_records.go @@ -76,12 +76,13 @@ func (client *Client) DescribeSubDomainRecordsWithCallback(request *DescribeSubD // DescribeSubDomainRecordsRequest is the request struct for api DescribeSubDomainRecords type DescribeSubDomainRecordsRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` + Line string `position:"Query" name:"Line"` UserClientIp string `position:"Query" name:"UserClientIp"` - SubDomain string `position:"Query" name:"SubDomain"` - PageNumber requests.Integer `position:"Query" name:"PageNumber"` PageSize requests.Integer `position:"Query" name:"PageSize"` + SubDomain string `position:"Query" name:"SubDomain"` + Lang string `position:"Query" name:"Lang"` Type string `position:"Query" name:"Type"` + PageNumber requests.Integer `position:"Query" name:"PageNumber"` } // DescribeSubDomainRecordsResponse is the response struct for api DescribeSubDomainRecords @@ -99,7 +100,7 @@ func CreateDescribeSubDomainRecordsRequest() (request *DescribeSubDomainRecordsR request = &DescribeSubDomainRecordsRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeSubDomainRecords", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeSubDomainRecords", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_support_lines.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_support_lines.go index 3738c3cb..e68cc1c3 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_support_lines.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/describe_support_lines.go @@ -76,8 +76,9 @@ func (client *Client) DescribeSupportLinesWithCallback(request *DescribeSupportL // DescribeSupportLinesRequest is the request struct for api DescribeSupportLines type DescribeSupportLinesRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` + DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` } // DescribeSupportLinesResponse is the response struct for api DescribeSupportLines @@ -92,7 +93,7 @@ func CreateDescribeSupportLinesRequest() (request *DescribeSupportLinesRequest) request = &DescribeSupportLinesRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeSupportLines", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "DescribeSupportLines", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/get_main_domain_name.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/get_main_domain_name.go index e5199878..cbf9c02c 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/get_main_domain_name.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/get_main_domain_name.go @@ -76,9 +76,9 @@ func (client *Client) GetMainDomainNameWithCallback(request *GetMainDomainNameRe // GetMainDomainNameRequest is the request struct for api GetMainDomainName type GetMainDomainNameRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` InputString string `position:"Query" name:"InputString"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` } // GetMainDomainNameResponse is the response struct for api GetMainDomainName @@ -95,7 +95,7 @@ func CreateGetMainDomainNameRequest() (request *GetMainDomainNameRequest) { request = &GetMainDomainNameRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "GetMainDomainName", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "GetMainDomainName", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/modify_hichina_domain_dns.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/modify_hichina_domain_dns.go index 3b452cdf..e3297bc8 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/modify_hichina_domain_dns.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/modify_hichina_domain_dns.go @@ -76,9 +76,9 @@ func (client *Client) ModifyHichinaDomainDNSWithCallback(request *ModifyHichinaD // ModifyHichinaDomainDNSRequest is the request struct for api ModifyHichinaDomainDNS type ModifyHichinaDomainDNSRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` DomainName string `position:"Query" name:"DomainName"` + Lang string `position:"Query" name:"Lang"` } // ModifyHichinaDomainDNSResponse is the response struct for api ModifyHichinaDomainDNS @@ -94,7 +94,7 @@ func CreateModifyHichinaDomainDNSRequest() (request *ModifyHichinaDomainDNSReque request = &ModifyHichinaDomainDNSRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "ModifyHichinaDomainDNS", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "ModifyHichinaDomainDNS", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/operate_batch_domain.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/operate_batch_domain.go new file mode 100644 index 00000000..c137a5c7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/operate_batch_domain.go @@ -0,0 +1,118 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// OperateBatchDomain invokes the alidns.OperateBatchDomain API synchronously +// api document: https://help.aliyun.com/api/alidns/operatebatchdomain.html +func (client *Client) OperateBatchDomain(request *OperateBatchDomainRequest) (response *OperateBatchDomainResponse, err error) { + response = CreateOperateBatchDomainResponse() + err = client.DoAction(request, response) + return +} + +// OperateBatchDomainWithChan invokes the alidns.OperateBatchDomain API asynchronously +// api document: https://help.aliyun.com/api/alidns/operatebatchdomain.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) OperateBatchDomainWithChan(request *OperateBatchDomainRequest) (<-chan *OperateBatchDomainResponse, <-chan error) { + responseChan := make(chan *OperateBatchDomainResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.OperateBatchDomain(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// OperateBatchDomainWithCallback invokes the alidns.OperateBatchDomain API asynchronously +// api document: https://help.aliyun.com/api/alidns/operatebatchdomain.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) OperateBatchDomainWithCallback(request *OperateBatchDomainRequest, callback func(response *OperateBatchDomainResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *OperateBatchDomainResponse + var err error + defer close(result) + response, err = client.OperateBatchDomain(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// OperateBatchDomainRequest is the request struct for api OperateBatchDomain +type OperateBatchDomainRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + DomainRecordInfo *[]OperateBatchDomainDomainRecordInfo `position:"Query" name:"DomainRecordInfo" type:"Repeated"` + Lang string `position:"Query" name:"Lang"` + Type string `position:"Query" name:"Type"` +} + +// OperateBatchDomainDomainRecordInfo is a repeated param struct in OperateBatchDomainRequest +type OperateBatchDomainDomainRecordInfo struct { + Rr string `name:"Rr"` + Line string `name:"Line"` + Domain string `name:"Domain"` + Type string `name:"Type"` + Priority string `name:"Priority"` + Value string `name:"Value"` + Ttl string `name:"Ttl"` +} + +// OperateBatchDomainResponse is the response struct for api OperateBatchDomain +type OperateBatchDomainResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + TaskId int `json:"TaskId" xml:"TaskId"` +} + +// CreateOperateBatchDomainRequest creates a request to invoke OperateBatchDomain API +func CreateOperateBatchDomainRequest() (request *OperateBatchDomainRequest) { + request = &OperateBatchDomainRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "OperateBatchDomain", "alidns", "openAPI") + return +} + +// CreateOperateBatchDomainResponse creates a response to parse from OperateBatchDomain response +func CreateOperateBatchDomainResponse() (response *OperateBatchDomainResponse) { + response = &OperateBatchDomainResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/query_create_instance_price.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/query_create_instance_price.go new file mode 100644 index 00000000..580d533b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/query_create_instance_price.go @@ -0,0 +1,112 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// QueryCreateInstancePrice invokes the alidns.QueryCreateInstancePrice API synchronously +// api document: https://help.aliyun.com/api/alidns/querycreateinstanceprice.html +func (client *Client) QueryCreateInstancePrice(request *QueryCreateInstancePriceRequest) (response *QueryCreateInstancePriceResponse, err error) { + response = CreateQueryCreateInstancePriceResponse() + err = client.DoAction(request, response) + return +} + +// QueryCreateInstancePriceWithChan invokes the alidns.QueryCreateInstancePrice API asynchronously +// api document: https://help.aliyun.com/api/alidns/querycreateinstanceprice.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) QueryCreateInstancePriceWithChan(request *QueryCreateInstancePriceRequest) (<-chan *QueryCreateInstancePriceResponse, <-chan error) { + responseChan := make(chan *QueryCreateInstancePriceResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.QueryCreateInstancePrice(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// QueryCreateInstancePriceWithCallback invokes the alidns.QueryCreateInstancePrice API asynchronously +// api document: https://help.aliyun.com/api/alidns/querycreateinstanceprice.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) QueryCreateInstancePriceWithCallback(request *QueryCreateInstancePriceRequest, callback func(response *QueryCreateInstancePriceResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *QueryCreateInstancePriceResponse + var err error + defer close(result) + response, err = client.QueryCreateInstancePrice(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// QueryCreateInstancePriceRequest is the request struct for api QueryCreateInstancePrice +type QueryCreateInstancePriceRequest struct { + *requests.RpcRequest + Month requests.Integer `position:"Query" name:"Month"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` + InstanceVersion string `position:"Query" name:"InstanceVersion"` + OwnerId requests.Integer `position:"Query" name:"OwnerId"` +} + +// QueryCreateInstancePriceResponse is the response struct for api QueryCreateInstancePrice +type QueryCreateInstancePriceResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` + Origin string `json:"Origin" xml:"Origin"` + Discount string `json:"Discount" xml:"Discount"` + Amount string `json:"Amount" xml:"Amount"` + Currency string `json:"Currency" xml:"Currency"` + Rules Rules `json:"Rules" xml:"Rules"` +} + +// CreateQueryCreateInstancePriceRequest creates a request to invoke QueryCreateInstancePrice API +func CreateQueryCreateInstancePriceRequest() (request *QueryCreateInstancePriceRequest) { + request = &QueryCreateInstancePriceRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "QueryCreateInstancePrice", "alidns", "openAPI") + return +} + +// CreateQueryCreateInstancePriceResponse creates a response to parse from QueryCreateInstancePrice response +func CreateQueryCreateInstancePriceResponse() (response *QueryCreateInstancePriceResponse) { + response = &QueryCreateInstancePriceResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/retrieval_domain_name.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/retrieval_domain_name.go deleted file mode 100644 index 753b85df..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/retrieval_domain_name.go +++ /dev/null @@ -1,107 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// RetrievalDomainName invokes the alidns.RetrievalDomainName API synchronously -// api document: https://help.aliyun.com/api/alidns/retrievaldomainname.html -func (client *Client) RetrievalDomainName(request *RetrievalDomainNameRequest) (response *RetrievalDomainNameResponse, err error) { - response = CreateRetrievalDomainNameResponse() - err = client.DoAction(request, response) - return -} - -// RetrievalDomainNameWithChan invokes the alidns.RetrievalDomainName API asynchronously -// api document: https://help.aliyun.com/api/alidns/retrievaldomainname.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) RetrievalDomainNameWithChan(request *RetrievalDomainNameRequest) (<-chan *RetrievalDomainNameResponse, <-chan error) { - responseChan := make(chan *RetrievalDomainNameResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.RetrievalDomainName(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// RetrievalDomainNameWithCallback invokes the alidns.RetrievalDomainName API asynchronously -// api document: https://help.aliyun.com/api/alidns/retrievaldomainname.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) RetrievalDomainNameWithCallback(request *RetrievalDomainNameRequest, callback func(response *RetrievalDomainNameResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *RetrievalDomainNameResponse - var err error - defer close(result) - response, err = client.RetrievalDomainName(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// RetrievalDomainNameRequest is the request struct for api RetrievalDomainName -type RetrievalDomainNameRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - DomainName string `position:"Query" name:"DomainName"` -} - -// RetrievalDomainNameResponse is the response struct for api RetrievalDomainName -type RetrievalDomainNameResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - DomainName string `json:"DomainName" xml:"DomainName"` - WhoisEmail string `json:"WhoisEmail" xml:"WhoisEmail"` -} - -// CreateRetrievalDomainNameRequest creates a request to invoke RetrievalDomainName API -func CreateRetrievalDomainNameRequest() (request *RetrievalDomainNameRequest) { - request = &RetrievalDomainNameRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "RetrievalDomainName", "", "") - return -} - -// CreateRetrievalDomainNameResponse creates a response to parse from RetrievalDomainName response -func CreateRetrievalDomainNameResponse() (response *RetrievalDomainNameResponse) { - response = &RetrievalDomainNameResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_dnsslb_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_dnsslb_status.go index 858d6fe6..1cd677b7 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_dnsslb_status.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_dnsslb_status.go @@ -76,9 +76,9 @@ func (client *Client) SetDNSSLBStatusWithCallback(request *SetDNSSLBStatusReques // SetDNSSLBStatusRequest is the request struct for api SetDNSSLBStatus type SetDNSSLBStatusRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` UserClientIp string `position:"Query" name:"UserClientIp"` SubDomain string `position:"Query" name:"SubDomain"` + Lang string `position:"Query" name:"Lang"` Open requests.Boolean `position:"Query" name:"Open"` } @@ -95,7 +95,7 @@ func CreateSetDNSSLBStatusRequest() (request *SetDNSSLBStatusRequest) { request = &SetDNSSLBStatusRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "SetDNSSLBStatus", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "SetDNSSLBStatus", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_domain_record_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_domain_record_status.go index 29ba5f72..269af188 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_domain_record_status.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_domain_record_status.go @@ -76,9 +76,9 @@ func (client *Client) SetDomainRecordStatusWithCallback(request *SetDomainRecord // SetDomainRecordStatusRequest is the request struct for api SetDomainRecordStatus type SetDomainRecordStatusRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` RecordId string `position:"Query" name:"RecordId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` Status string `position:"Query" name:"Status"` } @@ -95,7 +95,7 @@ func CreateSetDomainRecordStatusRequest() (request *SetDomainRecordStatusRequest request = &SetDomainRecordStatusRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "SetDomainRecordStatus", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "SetDomainRecordStatus", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_access_mode.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_access_mode.go new file mode 100644 index 00000000..f4e2b95e --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_access_mode.go @@ -0,0 +1,106 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetGtmAccessMode invokes the alidns.SetGtmAccessMode API synchronously +// api document: https://help.aliyun.com/api/alidns/setgtmaccessmode.html +func (client *Client) SetGtmAccessMode(request *SetGtmAccessModeRequest) (response *SetGtmAccessModeResponse, err error) { + response = CreateSetGtmAccessModeResponse() + err = client.DoAction(request, response) + return +} + +// SetGtmAccessModeWithChan invokes the alidns.SetGtmAccessMode API asynchronously +// api document: https://help.aliyun.com/api/alidns/setgtmaccessmode.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) SetGtmAccessModeWithChan(request *SetGtmAccessModeRequest) (<-chan *SetGtmAccessModeResponse, <-chan error) { + responseChan := make(chan *SetGtmAccessModeResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetGtmAccessMode(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetGtmAccessModeWithCallback invokes the alidns.SetGtmAccessMode API asynchronously +// api document: https://help.aliyun.com/api/alidns/setgtmaccessmode.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) SetGtmAccessModeWithCallback(request *SetGtmAccessModeRequest, callback func(response *SetGtmAccessModeResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetGtmAccessModeResponse + var err error + defer close(result) + response, err = client.SetGtmAccessMode(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetGtmAccessModeRequest is the request struct for api SetGtmAccessMode +type SetGtmAccessModeRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + StrategyId string `position:"Query" name:"StrategyId"` + Lang string `position:"Query" name:"Lang"` + AccessMode string `position:"Query" name:"AccessMode"` +} + +// SetGtmAccessModeResponse is the response struct for api SetGtmAccessMode +type SetGtmAccessModeResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateSetGtmAccessModeRequest creates a request to invoke SetGtmAccessMode API +func CreateSetGtmAccessModeRequest() (request *SetGtmAccessModeRequest) { + request = &SetGtmAccessModeRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "SetGtmAccessMode", "alidns", "openAPI") + return +} + +// CreateSetGtmAccessModeResponse creates a response to parse from SetGtmAccessMode response +func CreateSetGtmAccessModeResponse() (response *SetGtmAccessModeResponse) { + response = &SetGtmAccessModeResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_monitor_status.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_monitor_status.go new file mode 100644 index 00000000..2be5de6d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/set_gtm_monitor_status.go @@ -0,0 +1,106 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// SetGtmMonitorStatus invokes the alidns.SetGtmMonitorStatus API synchronously +// api document: https://help.aliyun.com/api/alidns/setgtmmonitorstatus.html +func (client *Client) SetGtmMonitorStatus(request *SetGtmMonitorStatusRequest) (response *SetGtmMonitorStatusResponse, err error) { + response = CreateSetGtmMonitorStatusResponse() + err = client.DoAction(request, response) + return +} + +// SetGtmMonitorStatusWithChan invokes the alidns.SetGtmMonitorStatus API asynchronously +// api document: https://help.aliyun.com/api/alidns/setgtmmonitorstatus.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) SetGtmMonitorStatusWithChan(request *SetGtmMonitorStatusRequest) (<-chan *SetGtmMonitorStatusResponse, <-chan error) { + responseChan := make(chan *SetGtmMonitorStatusResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.SetGtmMonitorStatus(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// SetGtmMonitorStatusWithCallback invokes the alidns.SetGtmMonitorStatus API asynchronously +// api document: https://help.aliyun.com/api/alidns/setgtmmonitorstatus.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) SetGtmMonitorStatusWithCallback(request *SetGtmMonitorStatusRequest, callback func(response *SetGtmMonitorStatusResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *SetGtmMonitorStatusResponse + var err error + defer close(result) + response, err = client.SetGtmMonitorStatus(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// SetGtmMonitorStatusRequest is the request struct for api SetGtmMonitorStatus +type SetGtmMonitorStatusRequest struct { + *requests.RpcRequest + UserClientIp string `position:"Query" name:"UserClientIp"` + MonitorConfigId string `position:"Query" name:"MonitorConfigId"` + Lang string `position:"Query" name:"Lang"` + Status string `position:"Query" name:"Status"` +} + +// SetGtmMonitorStatusResponse is the response struct for api SetGtmMonitorStatus +type SetGtmMonitorStatusResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateSetGtmMonitorStatusRequest creates a request to invoke SetGtmMonitorStatus API +func CreateSetGtmMonitorStatusRequest() (request *SetGtmMonitorStatusRequest) { + request = &SetGtmMonitorStatusRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "SetGtmMonitorStatus", "alidns", "openAPI") + return +} + +// CreateSetGtmMonitorStatusResponse creates a response to parse from SetGtmMonitorStatus response +func CreateSetGtmMonitorStatusResponse() (response *SetGtmMonitorStatusResponse) { + response = &SetGtmMonitorStatusResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr.go new file mode 100644 index 00000000..259f32f5 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr.go @@ -0,0 +1,29 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Addr is a nested struct in alidns response +type Addr struct { + AddrId int `json:"AddrId" xml:"AddrId"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + UpdateTime string `json:"UpdateTime" xml:"UpdateTime"` + UpdateTimestamp int `json:"UpdateTimestamp" xml:"UpdateTimestamp"` + Value string `json:"Value" xml:"Value"` + LbaWeight int `json:"LbaWeight" xml:"LbaWeight"` + Mode string `json:"Mode" xml:"Mode"` + AlertStatus string `json:"AlertStatus" xml:"AlertStatus"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pool.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pool.go new file mode 100644 index 00000000..c9c85082 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pool.go @@ -0,0 +1,33 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AddrPool is a nested struct in alidns response +type AddrPool struct { + AddrCount int `json:"AddrCount" xml:"AddrCount"` + Name string `json:"Name" xml:"Name"` + MinAvailableAddrNum int `json:"MinAvailableAddrNum" xml:"MinAvailableAddrNum"` + UpdateTime string `json:"UpdateTime" xml:"UpdateTime"` + MonitorConfigId string `json:"MonitorConfigId" xml:"MonitorConfigId"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + AddrPoolName string `json:"AddrPoolName" xml:"AddrPoolName"` + AddrPoolId string `json:"AddrPoolId" xml:"AddrPoolId"` + UpdateTimestamp int `json:"UpdateTimestamp" xml:"UpdateTimestamp"` + Status string `json:"Status" xml:"Status"` + MonitorStatus string `json:"MonitorStatus" xml:"MonitorStatus"` + Type string `json:"Type" xml:"Type"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_access_strategy_available_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_access_strategy_available_config.go new file mode 100644 index 00000000..dddb2fe6 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_access_strategy_available_config.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AddrPoolsInDescribeGtmAccessStrategyAvailableConfig is a nested struct in alidns response +type AddrPoolsInDescribeGtmAccessStrategyAvailableConfig struct { + AddrPool []AddrPool `json:"AddrPool" xml:"AddrPool"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_instance_address_pools.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_instance_address_pools.go new file mode 100644 index 00000000..2d340d81 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addr_pools_in_describe_gtm_instance_address_pools.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// AddrPoolsInDescribeGtmInstanceAddressPools is a nested struct in alidns response +type AddrPoolsInDescribeGtmInstanceAddressPools struct { + AddrPool []AddrPool `json:"AddrPool" xml:"AddrPool"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_status_list.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addrs.go similarity index 85% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_status_list.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addrs.go index 341e43d0..66bf0836 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_status_list.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_addrs.go @@ -15,7 +15,7 @@ package alidns // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// StatusList is a nested struct in alidns response -type StatusList struct { - Status []string `json:"Status" xml:"Status"` +// Addrs is a nested struct in alidns response +type Addrs struct { + Addr []Addr `json:"Addr" xml:"Addr"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_detail.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_detail.go new file mode 100644 index 00000000..62fc1b33 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_detail.go @@ -0,0 +1,36 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// BatchResultDetail is a nested struct in alidns response +type BatchResultDetail struct { + Domain string `json:"Domain" xml:"Domain"` + Type string `json:"Type" xml:"Type"` + Rr string `json:"Rr" xml:"Rr"` + Value string `json:"Value" xml:"Value"` + Status bool `json:"Status" xml:"Status"` + Reason string `json:"Reason" xml:"Reason"` + NewRr string `json:"NewRr" xml:"NewRr"` + NewValue string `json:"NewValue" xml:"NewValue"` + BatchType string `json:"BatchType" xml:"BatchType"` + OperateDateStr string `json:"OperateDateStr" xml:"OperateDateStr"` + Line string `json:"Line" xml:"Line"` + Priority int `json:"Priority" xml:"Priority"` + Ttl int `json:"Ttl" xml:"Ttl"` + RecordId string `json:"RecordId" xml:"RecordId"` + Remark string `json:"Remark" xml:"Remark"` + RrStatus string `json:"RrStatus" xml:"RrStatus"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_result.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_details.go similarity index 79% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_result.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_details.go index 0fc2d305..b2655d45 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_result.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_batch_result_details.go @@ -15,8 +15,7 @@ package alidns // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// FailResult is a nested struct in alidns response -type FailResult struct { - BatchIndex string `json:"BatchIndex" xml:"BatchIndex"` - ErrorCode string `json:"ErrorCode" xml:"ErrorCode"` +// BatchResultDetails is a nested struct in alidns response +type BatchResultDetails struct { + BatchResultDetail []BatchResultDetail `json:"BatchResultDetail" xml:"BatchResultDetail"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_product.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_product.go index 50a2e867..ed971ed2 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_product.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_product.go @@ -45,4 +45,7 @@ type DnsProduct struct { Gslb bool `json:"Gslb" xml:"Gslb"` InClean bool `json:"InClean" xml:"InClean"` InBlackHole bool `json:"InBlackHole" xml:"InBlackHole"` + BindDomainCount int `json:"BindDomainCount" xml:"BindDomainCount"` + BindDomainUsedCount int `json:"BindDomainUsedCount" xml:"BindDomainUsedCount"` + DnsSecurity string `json:"DnsSecurity" xml:"DnsSecurity"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instance.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instance.go new file mode 100644 index 00000000..5229c366 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instance.go @@ -0,0 +1,32 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// GtmInstance is a nested struct in alidns response +type GtmInstance struct { + InstanceId string `json:"InstanceId" xml:"InstanceId"` + InstanceName string `json:"InstanceName" xml:"InstanceName"` + Cname string `json:"Cname" xml:"Cname"` + UserDomainName string `json:"UserDomainName" xml:"UserDomainName"` + VersionCode string `json:"VersionCode" xml:"VersionCode"` + Ttl int `json:"Ttl" xml:"Ttl"` + LbaStrategy string `json:"LbaStrategy" xml:"LbaStrategy"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + ExpireTime string `json:"ExpireTime" xml:"ExpireTime"` + ExpireTimestamp int `json:"ExpireTimestamp" xml:"ExpireTimestamp"` + AlertGroup string `json:"AlertGroup" xml:"AlertGroup"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_servers_in_describe_domain_whois_info.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instances.go similarity index 79% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_servers_in_describe_domain_whois_info.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instances.go index fc03ed41..0609ce25 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_dns_servers_in_describe_domain_whois_info.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_gtm_instances.go @@ -15,7 +15,7 @@ package alidns // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// DnsServersInDescribeDomainWhoisInfo is a nested struct in alidns response -type DnsServersInDescribeDomainWhoisInfo struct { - DnsServer []string `json:"DnsServer" xml:"DnsServer"` +// GtmInstances is a nested struct in alidns response +type GtmInstances struct { + GtmInstance []GtmInstance `json:"GtmInstance" xml:"GtmInstance"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_node.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_node.go new file mode 100644 index 00000000..5549e2d9 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_node.go @@ -0,0 +1,28 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// IspCityNode is a nested struct in alidns response +type IspCityNode struct { + CityCode string `json:"CityCode" xml:"CityCode"` + DefaultSelected bool `json:"DefaultSelected" xml:"DefaultSelected"` + IspName string `json:"IspName" xml:"IspName"` + CountryName string `json:"CountryName" xml:"CountryName"` + CityName string `json:"CityName" xml:"CityName"` + Mainland bool `json:"Mainland" xml:"Mainland"` + CountryCode string `json:"CountryCode" xml:"CountryCode"` + IspCode string `json:"IspCode" xml:"IspCode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_available_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_available_config.go new file mode 100644 index 00000000..82c86e99 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_available_config.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// IspCityNodesInDescribeGtmMonitorAvailableConfig is a nested struct in alidns response +type IspCityNodesInDescribeGtmMonitorAvailableConfig struct { + IspCityNode []IspCityNode `json:"IspCityNode" xml:"IspCityNode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_config.go new file mode 100644 index 00000000..7f531d44 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_isp_city_nodes_in_describe_gtm_monitor_config.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// IspCityNodesInDescribeGtmMonitorConfig is a nested struct in alidns response +type IspCityNodesInDescribeGtmMonitorConfig struct { + IspCityNode []IspCityNode `json:"IspCityNode" xml:"IspCityNode"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_line.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_line.go new file mode 100644 index 00000000..76487a7d --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_line.go @@ -0,0 +1,25 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Line is a nested struct in alidns response +type Line struct { + GroupCode string `json:"GroupCode" xml:"GroupCode"` + LineCode string `json:"LineCode" xml:"LineCode"` + LineName string `json:"LineName" xml:"LineName"` + GroupName string `json:"GroupName" xml:"GroupName"` + Status string `json:"Status" xml:"Status"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategies.go new file mode 100644 index 00000000..75defbd0 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategies.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LinesInDescribeGtmAccessStrategies is a nested struct in alidns response +type LinesInDescribeGtmAccessStrategies struct { + Line []Line `json:"Line" xml:"Line"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy.go new file mode 100644 index 00000000..86d10f66 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LinesInDescribeGtmAccessStrategy is a nested struct in alidns response +type LinesInDescribeGtmAccessStrategy struct { + Line []Line `json:"Line" xml:"Line"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy_available_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy_available_config.go new file mode 100644 index 00000000..7289ff37 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_lines_in_describe_gtm_access_strategy_available_config.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// LinesInDescribeGtmAccessStrategyAvailableConfig is a nested struct in alidns response +type LinesInDescribeGtmAccessStrategyAvailableConfig struct { + Line []Line `json:"Line" xml:"Line"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_log.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_log.go new file mode 100644 index 00000000..19b07514 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_log.go @@ -0,0 +1,29 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Log is a nested struct in alidns response +type Log struct { + OperTime string `json:"OperTime" xml:"OperTime"` + OperAction string `json:"OperAction" xml:"OperAction"` + EntityType string `json:"EntityType" xml:"EntityType"` + EntityId string `json:"EntityId" xml:"EntityId"` + EntityName string `json:"EntityName" xml:"EntityName"` + OperIp string `json:"OperIp" xml:"OperIp"` + OperTimestamp int `json:"OperTimestamp" xml:"OperTimestamp"` + Id int `json:"Id" xml:"Id"` + Content string `json:"Content" xml:"Content"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_results.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_logs.go similarity index 83% rename from vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_results.go rename to vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_logs.go index 54ee4d18..9ae45717 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_fail_results.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_logs.go @@ -15,7 +15,7 @@ package alidns // Code generated by Alibaba Cloud SDK Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -// FailResults is a nested struct in alidns response -type FailResults struct { - FailResult []FailResult `json:"FailResult" xml:"FailResult"` +// Logs is a nested struct in alidns response +type Logs struct { + Log []Log `json:"Log" xml:"Log"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record.go index b4f0f191..8c9922fd 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record.go @@ -17,16 +17,16 @@ package alidns // Record is a nested struct in alidns response type Record struct { - Locked bool `json:"Locked" xml:"Locked"` - Type string `json:"Type" xml:"Type"` - Line string `json:"Line" xml:"Line"` - RR string `json:"RR" xml:"RR"` + Value string `json:"Value" xml:"Value"` + TTL int `json:"TTL" xml:"TTL"` Remark string `json:"Remark" xml:"Remark"` + DomainName string `json:"DomainName" xml:"DomainName"` + RR string `json:"RR" xml:"RR"` Priority int `json:"Priority" xml:"Priority"` RecordId string `json:"RecordId" xml:"RecordId"` - Value string `json:"Value" xml:"Value"` - DomainName string `json:"DomainName" xml:"DomainName"` - Weight int `json:"Weight" xml:"Weight"` Status string `json:"Status" xml:"Status"` - TTL int `json:"TTL" xml:"TTL"` + Locked bool `json:"Locked" xml:"Locked"` + Weight int `json:"Weight" xml:"Weight"` + Line string `json:"Line" xml:"Line"` + Type string `json:"Type" xml:"Type"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record_line.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record_line.go index 2219c2d1..d4db7038 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record_line.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_record_line.go @@ -17,8 +17,8 @@ package alidns // RecordLine is a nested struct in alidns response type RecordLine struct { - LineName string `json:"LineName" xml:"LineName"` - FatherCode string `json:"FatherCode" xml:"FatherCode"` LineDisplayName string `json:"LineDisplayName" xml:"LineDisplayName"` LineCode string `json:"LineCode" xml:"LineCode"` + LineName string `json:"LineName" xml:"LineName"` + FatherCode string `json:"FatherCode" xml:"FatherCode"` } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rule.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rule.go new file mode 100644 index 00000000..2967989b --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rule.go @@ -0,0 +1,23 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Rule is a nested struct in alidns response +type Rule struct { + RuleId int `json:"RuleId" xml:"RuleId"` + Name string `json:"Name" xml:"Name"` + Title string `json:"Title" xml:"Title"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rules.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rules.go new file mode 100644 index 00000000..067a9588 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_rules.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Rules is a nested struct in alidns response +type Rules struct { + Rule []Rule `json:"Rule" xml:"Rule"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategies.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategies.go new file mode 100644 index 00000000..abe9988f --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategies.go @@ -0,0 +1,21 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Strategies is a nested struct in alidns response +type Strategies struct { + Strategy []Strategy `json:"Strategy" xml:"Strategy"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategy.go new file mode 100644 index 00000000..62d30148 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/struct_strategy.go @@ -0,0 +1,33 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +// Strategy is a nested struct in alidns response +type Strategy struct { + StrategyId string `json:"StrategyId" xml:"StrategyId"` + StrategyName string `json:"StrategyName" xml:"StrategyName"` + CreateTime string `json:"CreateTime" xml:"CreateTime"` + CreateTimestamp int `json:"CreateTimestamp" xml:"CreateTimestamp"` + DefaultAddrPoolId string `json:"DefaultAddrPoolId" xml:"DefaultAddrPoolId"` + DefaultAddrPoolName string `json:"DefaultAddrPoolName" xml:"DefaultAddrPoolName"` + FailoverAddrPoolId string `json:"FailoverAddrPoolId" xml:"FailoverAddrPoolId"` + FailoverAddrPoolName string `json:"FailoverAddrPoolName" xml:"FailoverAddrPoolName"` + AccessMode string `json:"AccessMode" xml:"AccessMode"` + AccessStatus string `json:"AccessStatus" xml:"AccessStatus"` + StrategyMode string `json:"StrategyMode" xml:"StrategyMode"` + InstanceId string `json:"InstanceId" xml:"InstanceId"` + Lines LinesInDescribeGtmAccessStrategies `json:"Lines" xml:"Lines"` +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_batch_domain_records.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_batch_domain_records.go deleted file mode 100644 index c90e2045..00000000 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_batch_domain_records.go +++ /dev/null @@ -1,106 +0,0 @@ -package alidns - -//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. -// -// Code generated by Alibaba Cloud SDK Code Generator. -// Changes may cause incorrect behavior and will be lost if the code is regenerated. - -import ( - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" - "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" -) - -// UpdateBatchDomainRecords invokes the alidns.UpdateBatchDomainRecords API synchronously -// api document: https://help.aliyun.com/api/alidns/updatebatchdomainrecords.html -func (client *Client) UpdateBatchDomainRecords(request *UpdateBatchDomainRecordsRequest) (response *UpdateBatchDomainRecordsResponse, err error) { - response = CreateUpdateBatchDomainRecordsResponse() - err = client.DoAction(request, response) - return -} - -// UpdateBatchDomainRecordsWithChan invokes the alidns.UpdateBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/updatebatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) UpdateBatchDomainRecordsWithChan(request *UpdateBatchDomainRecordsRequest) (<-chan *UpdateBatchDomainRecordsResponse, <-chan error) { - responseChan := make(chan *UpdateBatchDomainRecordsResponse, 1) - errChan := make(chan error, 1) - err := client.AddAsyncTask(func() { - defer close(responseChan) - defer close(errChan) - response, err := client.UpdateBatchDomainRecords(request) - if err != nil { - errChan <- err - } else { - responseChan <- response - } - }) - if err != nil { - errChan <- err - close(responseChan) - close(errChan) - } - return responseChan, errChan -} - -// UpdateBatchDomainRecordsWithCallback invokes the alidns.UpdateBatchDomainRecords API asynchronously -// api document: https://help.aliyun.com/api/alidns/updatebatchdomainrecords.html -// asynchronous document: https://help.aliyun.com/document_detail/66220.html -func (client *Client) UpdateBatchDomainRecordsWithCallback(request *UpdateBatchDomainRecordsRequest, callback func(response *UpdateBatchDomainRecordsResponse, err error)) <-chan int { - result := make(chan int, 1) - err := client.AddAsyncTask(func() { - var response *UpdateBatchDomainRecordsResponse - var err error - defer close(result) - response, err = client.UpdateBatchDomainRecords(request) - callback(response, err) - result <- 1 - }) - if err != nil { - defer close(result) - callback(nil, err) - result <- 0 - } - return result -} - -// UpdateBatchDomainRecordsRequest is the request struct for api UpdateBatchDomainRecords -type UpdateBatchDomainRecordsRequest struct { - *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` - Records string `position:"Query" name:"Records"` -} - -// UpdateBatchDomainRecordsResponse is the response struct for api UpdateBatchDomainRecords -type UpdateBatchDomainRecordsResponse struct { - *responses.BaseResponse - RequestId string `json:"RequestId" xml:"RequestId"` - TraceId string `json:"TraceId" xml:"TraceId"` -} - -// CreateUpdateBatchDomainRecordsRequest creates a request to invoke UpdateBatchDomainRecords API -func CreateUpdateBatchDomainRecordsRequest() (request *UpdateBatchDomainRecordsRequest) { - request = &UpdateBatchDomainRecordsRequest{ - RpcRequest: &requests.RpcRequest{}, - } - request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateBatchDomainRecords", "", "") - return -} - -// CreateUpdateBatchDomainRecordsResponse creates a response to parse from UpdateBatchDomainRecords response -func CreateUpdateBatchDomainRecordsResponse() (response *UpdateBatchDomainRecordsResponse) { - response = &UpdateBatchDomainRecordsResponse{ - BaseResponse: &responses.BaseResponse{}, - } - return -} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_dnsslb_weight.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_dnsslb_weight.go index ec372a21..b36b432f 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_dnsslb_weight.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_dnsslb_weight.go @@ -76,10 +76,10 @@ func (client *Client) UpdateDNSSLBWeightWithCallback(request *UpdateDNSSLBWeight // UpdateDNSSLBWeightRequest is the request struct for api UpdateDNSSLBWeight type UpdateDNSSLBWeightRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` RecordId string `position:"Query" name:"RecordId"` + UserClientIp string `position:"Query" name:"UserClientIp"` Weight requests.Integer `position:"Query" name:"Weight"` + Lang string `position:"Query" name:"Lang"` } // UpdateDNSSLBWeightResponse is the response struct for api UpdateDNSSLBWeight @@ -95,7 +95,7 @@ func CreateUpdateDNSSLBWeightRequest() (request *UpdateDNSSLBWeightRequest) { request = &UpdateDNSSLBWeightRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDNSSLBWeight", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDNSSLBWeight", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_group.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_group.go index 61f1fb1d..acdbca18 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_group.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_group.go @@ -76,9 +76,9 @@ func (client *Client) UpdateDomainGroupWithCallback(request *UpdateDomainGroupRe // UpdateDomainGroupRequest is the request struct for api UpdateDomainGroup type UpdateDomainGroupRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` GroupId string `position:"Query" name:"GroupId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` GroupName string `position:"Query" name:"GroupName"` } @@ -95,7 +95,7 @@ func CreateUpdateDomainGroupRequest() (request *UpdateDomainGroupRequest) { request = &UpdateDomainGroupRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDomainGroup", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDomainGroup", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_record.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_record.go index 1e9c0daf..6b5c83d1 100644 --- a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_record.go +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_domain_record.go @@ -76,15 +76,15 @@ func (client *Client) UpdateDomainRecordWithCallback(request *UpdateDomainRecord // UpdateDomainRecordRequest is the request struct for api UpdateDomainRecord type UpdateDomainRecordRequest struct { *requests.RpcRequest - Lang string `position:"Query" name:"Lang"` - UserClientIp string `position:"Query" name:"UserClientIp"` RecordId string `position:"Query" name:"RecordId"` RR string `position:"Query" name:"RR"` + Line string `position:"Query" name:"Line"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Lang string `position:"Query" name:"Lang"` Type string `position:"Query" name:"Type"` + Priority requests.Integer `position:"Query" name:"Priority"` Value string `position:"Query" name:"Value"` TTL requests.Integer `position:"Query" name:"TTL"` - Priority requests.Integer `position:"Query" name:"Priority"` - Line string `position:"Query" name:"Line"` } // UpdateDomainRecordResponse is the response struct for api UpdateDomainRecord @@ -99,7 +99,7 @@ func CreateUpdateDomainRecordRequest() (request *UpdateDomainRecordRequest) { request = &UpdateDomainRecordRequest{ RpcRequest: &requests.RpcRequest{}, } - request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDomainRecord", "", "") + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateDomainRecord", "alidns", "openAPI") return } diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_access_strategy.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_access_strategy.go new file mode 100644 index 00000000..2eeeef10 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_access_strategy.go @@ -0,0 +1,109 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateGtmAccessStrategy invokes the alidns.UpdateGtmAccessStrategy API synchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaccessstrategy.html +func (client *Client) UpdateGtmAccessStrategy(request *UpdateGtmAccessStrategyRequest) (response *UpdateGtmAccessStrategyResponse, err error) { + response = CreateUpdateGtmAccessStrategyResponse() + err = client.DoAction(request, response) + return +} + +// UpdateGtmAccessStrategyWithChan invokes the alidns.UpdateGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmAccessStrategyWithChan(request *UpdateGtmAccessStrategyRequest) (<-chan *UpdateGtmAccessStrategyResponse, <-chan error) { + responseChan := make(chan *UpdateGtmAccessStrategyResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateGtmAccessStrategy(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateGtmAccessStrategyWithCallback invokes the alidns.UpdateGtmAccessStrategy API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaccessstrategy.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmAccessStrategyWithCallback(request *UpdateGtmAccessStrategyRequest, callback func(response *UpdateGtmAccessStrategyResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateGtmAccessStrategyResponse + var err error + defer close(result) + response, err = client.UpdateGtmAccessStrategy(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateGtmAccessStrategyRequest is the request struct for api UpdateGtmAccessStrategy +type UpdateGtmAccessStrategyRequest struct { + *requests.RpcRequest + StrategyName string `position:"Query" name:"StrategyName"` + DefaultAddrPoolId string `position:"Query" name:"DefaultAddrPoolId"` + AccessLines string `position:"Query" name:"AccessLines"` + FailoverAddrPoolId string `position:"Query" name:"FailoverAddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + StrategyId string `position:"Query" name:"StrategyId"` + Lang string `position:"Query" name:"Lang"` +} + +// UpdateGtmAccessStrategyResponse is the response struct for api UpdateGtmAccessStrategy +type UpdateGtmAccessStrategyResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateGtmAccessStrategyRequest creates a request to invoke UpdateGtmAccessStrategy API +func CreateUpdateGtmAccessStrategyRequest() (request *UpdateGtmAccessStrategyRequest) { + request = &UpdateGtmAccessStrategyRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateGtmAccessStrategy", "alidns", "openAPI") + return +} + +// CreateUpdateGtmAccessStrategyResponse creates a response to parse from UpdateGtmAccessStrategy response +func CreateUpdateGtmAccessStrategyResponse() (response *UpdateGtmAccessStrategyResponse) { + response = &UpdateGtmAccessStrategyResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_address_pool.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_address_pool.go new file mode 100644 index 00000000..d1bb156c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_address_pool.go @@ -0,0 +1,116 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateGtmAddressPool invokes the alidns.UpdateGtmAddressPool API synchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaddresspool.html +func (client *Client) UpdateGtmAddressPool(request *UpdateGtmAddressPoolRequest) (response *UpdateGtmAddressPoolResponse, err error) { + response = CreateUpdateGtmAddressPoolResponse() + err = client.DoAction(request, response) + return +} + +// UpdateGtmAddressPoolWithChan invokes the alidns.UpdateGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmAddressPoolWithChan(request *UpdateGtmAddressPoolRequest) (<-chan *UpdateGtmAddressPoolResponse, <-chan error) { + responseChan := make(chan *UpdateGtmAddressPoolResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateGtmAddressPool(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateGtmAddressPoolWithCallback invokes the alidns.UpdateGtmAddressPool API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmaddresspool.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmAddressPoolWithCallback(request *UpdateGtmAddressPoolRequest, callback func(response *UpdateGtmAddressPoolResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateGtmAddressPoolResponse + var err error + defer close(result) + response, err = client.UpdateGtmAddressPool(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateGtmAddressPoolRequest is the request struct for api UpdateGtmAddressPool +type UpdateGtmAddressPoolRequest struct { + *requests.RpcRequest + AddrPoolId string `position:"Query" name:"AddrPoolId"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Name string `position:"Query" name:"Name"` + Lang string `position:"Query" name:"Lang"` + Type string `position:"Query" name:"Type"` + Addr *[]UpdateGtmAddressPoolAddr `position:"Query" name:"Addr" type:"Repeated"` + MinAvailableAddrNum requests.Integer `position:"Query" name:"MinAvailableAddrNum"` +} + +// UpdateGtmAddressPoolAddr is a repeated param struct in UpdateGtmAddressPoolRequest +type UpdateGtmAddressPoolAddr struct { + Mode string `name:"Mode"` + LbaWeight string `name:"LbaWeight"` + Value string `name:"Value"` +} + +// UpdateGtmAddressPoolResponse is the response struct for api UpdateGtmAddressPool +type UpdateGtmAddressPoolResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateGtmAddressPoolRequest creates a request to invoke UpdateGtmAddressPool API +func CreateUpdateGtmAddressPoolRequest() (request *UpdateGtmAddressPoolRequest) { + request = &UpdateGtmAddressPoolRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateGtmAddressPool", "alidns", "openAPI") + return +} + +// CreateUpdateGtmAddressPoolResponse creates a response to parse from UpdateGtmAddressPool response +func CreateUpdateGtmAddressPoolResponse() (response *UpdateGtmAddressPoolResponse) { + response = &UpdateGtmAddressPoolResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_instance_global_config.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_instance_global_config.go new file mode 100644 index 00000000..1f43a7e7 --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_instance_global_config.go @@ -0,0 +1,110 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateGtmInstanceGlobalConfig invokes the alidns.UpdateGtmInstanceGlobalConfig API synchronously +// api document: https://help.aliyun.com/api/alidns/updategtminstanceglobalconfig.html +func (client *Client) UpdateGtmInstanceGlobalConfig(request *UpdateGtmInstanceGlobalConfigRequest) (response *UpdateGtmInstanceGlobalConfigResponse, err error) { + response = CreateUpdateGtmInstanceGlobalConfigResponse() + err = client.DoAction(request, response) + return +} + +// UpdateGtmInstanceGlobalConfigWithChan invokes the alidns.UpdateGtmInstanceGlobalConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtminstanceglobalconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmInstanceGlobalConfigWithChan(request *UpdateGtmInstanceGlobalConfigRequest) (<-chan *UpdateGtmInstanceGlobalConfigResponse, <-chan error) { + responseChan := make(chan *UpdateGtmInstanceGlobalConfigResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateGtmInstanceGlobalConfig(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateGtmInstanceGlobalConfigWithCallback invokes the alidns.UpdateGtmInstanceGlobalConfig API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtminstanceglobalconfig.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmInstanceGlobalConfigWithCallback(request *UpdateGtmInstanceGlobalConfigRequest, callback func(response *UpdateGtmInstanceGlobalConfigResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateGtmInstanceGlobalConfigResponse + var err error + defer close(result) + response, err = client.UpdateGtmInstanceGlobalConfig(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateGtmInstanceGlobalConfigRequest is the request struct for api UpdateGtmInstanceGlobalConfig +type UpdateGtmInstanceGlobalConfigRequest struct { + *requests.RpcRequest + AlertGroup string `position:"Query" name:"AlertGroup"` + InstanceId string `position:"Query" name:"InstanceId"` + InstanceName string `position:"Query" name:"InstanceName"` + UserDomainName string `position:"Query" name:"UserDomainName"` + UserClientIp string `position:"Query" name:"UserClientIp"` + LbaStrategy string `position:"Query" name:"LbaStrategy"` + Lang string `position:"Query" name:"Lang"` + Ttl requests.Integer `position:"Query" name:"Ttl"` +} + +// UpdateGtmInstanceGlobalConfigResponse is the response struct for api UpdateGtmInstanceGlobalConfig +type UpdateGtmInstanceGlobalConfigResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateGtmInstanceGlobalConfigRequest creates a request to invoke UpdateGtmInstanceGlobalConfig API +func CreateUpdateGtmInstanceGlobalConfigRequest() (request *UpdateGtmInstanceGlobalConfigRequest) { + request = &UpdateGtmInstanceGlobalConfigRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateGtmInstanceGlobalConfig", "alidns", "openAPI") + return +} + +// CreateUpdateGtmInstanceGlobalConfigResponse creates a response to parse from UpdateGtmInstanceGlobalConfig response +func CreateUpdateGtmInstanceGlobalConfigResponse() (response *UpdateGtmInstanceGlobalConfigResponse) { + response = &UpdateGtmInstanceGlobalConfigResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_monitor.go b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_monitor.go new file mode 100644 index 00000000..7df0882c --- /dev/null +++ b/vendor/github.com/aliyun/alibaba-cloud-sdk-go/services/alidns/update_gtm_monitor.go @@ -0,0 +1,118 @@ +package alidns + +//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. +// +// Code generated by Alibaba Cloud SDK Code Generator. +// Changes may cause incorrect behavior and will be lost if the code is regenerated. + +import ( + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/requests" + "github.com/aliyun/alibaba-cloud-sdk-go/sdk/responses" +) + +// UpdateGtmMonitor invokes the alidns.UpdateGtmMonitor API synchronously +// api document: https://help.aliyun.com/api/alidns/updategtmmonitor.html +func (client *Client) UpdateGtmMonitor(request *UpdateGtmMonitorRequest) (response *UpdateGtmMonitorResponse, err error) { + response = CreateUpdateGtmMonitorResponse() + err = client.DoAction(request, response) + return +} + +// UpdateGtmMonitorWithChan invokes the alidns.UpdateGtmMonitor API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmmonitor.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmMonitorWithChan(request *UpdateGtmMonitorRequest) (<-chan *UpdateGtmMonitorResponse, <-chan error) { + responseChan := make(chan *UpdateGtmMonitorResponse, 1) + errChan := make(chan error, 1) + err := client.AddAsyncTask(func() { + defer close(responseChan) + defer close(errChan) + response, err := client.UpdateGtmMonitor(request) + if err != nil { + errChan <- err + } else { + responseChan <- response + } + }) + if err != nil { + errChan <- err + close(responseChan) + close(errChan) + } + return responseChan, errChan +} + +// UpdateGtmMonitorWithCallback invokes the alidns.UpdateGtmMonitor API asynchronously +// api document: https://help.aliyun.com/api/alidns/updategtmmonitor.html +// asynchronous document: https://help.aliyun.com/document_detail/66220.html +func (client *Client) UpdateGtmMonitorWithCallback(request *UpdateGtmMonitorRequest, callback func(response *UpdateGtmMonitorResponse, err error)) <-chan int { + result := make(chan int, 1) + err := client.AddAsyncTask(func() { + var response *UpdateGtmMonitorResponse + var err error + defer close(result) + response, err = client.UpdateGtmMonitor(request) + callback(response, err) + result <- 1 + }) + if err != nil { + defer close(result) + callback(nil, err) + result <- 0 + } + return result +} + +// UpdateGtmMonitorRequest is the request struct for api UpdateGtmMonitor +type UpdateGtmMonitorRequest struct { + *requests.RpcRequest + MonitorExtendInfo string `position:"Query" name:"MonitorExtendInfo"` + UserClientIp string `position:"Query" name:"UserClientIp"` + Name string `position:"Query" name:"Name"` + MonitorConfigId string `position:"Query" name:"MonitorConfigId"` + EvaluationCount requests.Integer `position:"Query" name:"EvaluationCount"` + ProtocolType string `position:"Query" name:"ProtocolType"` + Interval requests.Integer `position:"Query" name:"Interval"` + Lang string `position:"Query" name:"Lang"` + Timeout requests.Integer `position:"Query" name:"Timeout"` + IspCityNode *[]UpdateGtmMonitorIspCityNode `position:"Query" name:"IspCityNode" type:"Repeated"` +} + +// UpdateGtmMonitorIspCityNode is a repeated param struct in UpdateGtmMonitorRequest +type UpdateGtmMonitorIspCityNode struct { + CityCode string `name:"CityCode"` + IspCode string `name:"IspCode"` +} + +// UpdateGtmMonitorResponse is the response struct for api UpdateGtmMonitor +type UpdateGtmMonitorResponse struct { + *responses.BaseResponse + RequestId string `json:"RequestId" xml:"RequestId"` +} + +// CreateUpdateGtmMonitorRequest creates a request to invoke UpdateGtmMonitor API +func CreateUpdateGtmMonitorRequest() (request *UpdateGtmMonitorRequest) { + request = &UpdateGtmMonitorRequest{ + RpcRequest: &requests.RpcRequest{}, + } + request.InitWithApiInfo("Alidns", "2015-01-09", "UpdateGtmMonitor", "alidns", "openAPI") + return +} + +// CreateUpdateGtmMonitorResponse creates a response to parse from UpdateGtmMonitor response +func CreateUpdateGtmMonitorResponse() (response *UpdateGtmMonitorResponse) { + response = &UpdateGtmMonitorResponse{ + BaseResponse: &responses.BaseResponse{}, + } + return +} diff --git a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt index 5f14d116..899129ec 100644 --- a/vendor/github.com/aws/aws-sdk-go/NOTICE.txt +++ b/vendor/github.com/aws/aws-sdk-go/NOTICE.txt @@ -1,3 +1,3 @@ AWS SDK for Go -Copyright 2015 Amazon.com, Inc. or its affiliates. All Rights Reserved. +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/aws/awserr/error.go b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go index 56fdfc2b..99849c0e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/error.go @@ -138,8 +138,27 @@ type RequestFailure interface { RequestID() string } -// NewRequestFailure returns a new request error wrapper for the given Error -// provided. +// NewRequestFailure 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. func NewRequestFailure(err Error, statusCode int, reqID string) RequestFailure { return newRequestError(err, statusCode, reqID) } + +// UnmarshalError provides the interface for the SDK failing to unmarshal data. +type UnmarshalError interface { + awsError + Bytes() []byte +} + +// NewUnmarshalError returns an initialized UnmarshalError error wrapper adding +// the bytes that fail to unmarshal to the error. +func NewUnmarshalError(err error, msg string, bytes []byte) UnmarshalError { + return &unmarshalError{ + awsError: New("UnmarshalError", msg, err), + bytes: bytes, + } +} 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 index 0202a008..a2c5817c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awserr/types.go @@ -1,6 +1,9 @@ package awserr -import "fmt" +import ( + "encoding/hex" + "fmt" +) // SprintError returns a string of the formatted error code. // @@ -119,6 +122,7 @@ type requestError struct { awsError statusCode int requestID string + bytes []byte } // newRequestError returns a wrapped error with additional information for @@ -170,6 +174,29 @@ func (r requestError) OrigErrs() []error { return []error{r.OrigErr()} } +type unmarshalError struct { + awsError + bytes []byte +} + +// Error returns the string representation of the error. +// Satisfies the error interface. +func (e unmarshalError) Error() string { + extra := hex.Dump(e.bytes) + return SprintError(e.Code(), e.Message(), extra, e.OrigErr()) +} + +// String returns the string representation of the error. +// Alias for Error to satisfy the stringer interface. +func (e unmarshalError) String() string { + return e.Error() +} + +// Bytes returns the bytes that failed to unmarshal. +func (e unmarshalError) Bytes() []byte { + return e.bytes +} + // An error list that satisfies the golang interface type errorList []error 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 index 59fa4a55..142a7a01 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/awsutil/equal.go @@ -15,7 +15,7 @@ func DeepEqual(a, b interface{}) bool { 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 the elements are both nil, and of the same type they are equal // If they are of different types they are not equal return reflect.TypeOf(a) == reflect.TypeOf(b) } else if raValid != rbValid { 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 index b6432f1a..645df245 100644 --- 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 @@ -23,28 +23,27 @@ func stringValue(v reflect.Value, indent int, buf *bytes.Buffer) { 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]) { + ft := v.Type().Field(i) + fv := v.Field(i) + + if ft.Name[0:1] == strings.ToLower(ft.Name[0:1]) { continue // ignore unexported fields } - if (f.Kind() == reflect.Ptr || f.Kind() == reflect.Slice) && f.IsNil() { + if (fv.Kind() == reflect.Ptr || fv.Kind() == reflect.Slice) && fv.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) + buf.WriteString(ft.Name + ": ") - if i < len(names)-1 { - buf.WriteString(",\n") + if tag := ft.Tag.Get("sensitive"); tag == "true" { + buf.WriteString("") + } else { + stringValue(fv, indent+2, buf) } + + buf.WriteString(",\n") } buf.WriteString("\n" + strings.Repeat(" ", indent) + "}") 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 index 212fe25e..70960538 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/client.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/client.go @@ -18,7 +18,7 @@ type Config struct { // States that the signing name did not come from a modeled source but // was derived based on other data. Used by service client constructors - // to determine if the signin name can be overriden based on metadata the + // to determine if the signin name can be overridden based on metadata the // service has. SigningNameDerived bool } 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 index ce9fb896..7b5e1276 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -118,6 +118,12 @@ var LogHTTPResponseHandler = request.NamedHandler{ func logResponse(r *request.Request) { lw := &logWriter{r.Config.Logger, bytes.NewBuffer(nil)} + if r.HTTPResponse == nil { + lw.Logger.Log(fmt.Sprintf(logRespErrMsg, + r.ClientInfo.ServiceName, r.Operation.Name, "request's HTTPResponse is nil")) + return + } + logBody := r.Config.LogLevel.Matches(aws.LogDebugWithHTTPBody) if logBody { r.HTTPResponse.Body = &teeReaderCloser{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/config.go b/vendor/github.com/aws/aws-sdk-go/aws/config.go index 5421b5d4..10634d17 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/config.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/config.go @@ -18,7 +18,7 @@ const UseServiceDefaultRetries = -1 type RequestRetryer interface{} // A Config provides service configuration for service clients. By default, -// all clients will use the defaults.DefaultConfig tructure. +// all clients will use the defaults.DefaultConfig structure. // // // Create Session with MaxRetry configuration to be shared by multiple // // service clients. @@ -45,8 +45,8 @@ type Config struct { // 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. + // 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 @@ -65,8 +65,8 @@ type Config struct { // 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 + // See http://docs.aws.amazon.com/general/latest/gr/rande.html for AWS + // Regions and Endpoints. Region *string // Set this to `true` to disable SSL when sending requests. Defaults @@ -120,9 +120,10 @@ type Config struct { // 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 + // Note: This configuration option is specific to the Amazon S3 service. + // + // See http://docs.aws.amazon.com/AmazonS3/latest/dev/VirtualHosting.html + // for Amazon S3: Virtual Hosting of Buckets S3ForcePathStyle *bool // Set this to `true` to disable the SDK adding the `Expect: 100-Continue` @@ -223,6 +224,28 @@ type Config struct { // Key: aws.String("//foo//bar//moo"), // }) DisableRestProtocolURICleaning *bool + + // EnableEndpointDiscovery will allow for endpoint discovery on operations that + // have the definition in its model. By default, endpoint discovery is off. + // + // Example: + // sess := session.Must(session.NewSession(&aws.Config{ + // EnableEndpointDiscovery: aws.Bool(true), + // })) + // + // svc := s3.New(sess) + // out, err := svc.GetObject(&s3.GetObjectInput { + // Bucket: aws.String("bucketname"), + // Key: aws.String("/foo/bar/moo"), + // }) + EnableEndpointDiscovery *bool + + // DisableEndpointHostPrefix will disable the SDK's behavior of prefixing + // request endpoint hosts with modeled information. + // + // Disabling this feature is useful when you want to use local endpoints + // for testing that do not support the modeled host prefix pattern. + DisableEndpointHostPrefix *bool } // NewConfig returns a new Config pointer that can be chained with builder @@ -377,6 +400,19 @@ func (c *Config) WithSleepDelay(fn func(time.Duration)) *Config { return c } +// WithEndpointDiscovery will set whether or not to use endpoint discovery. +func (c *Config) WithEndpointDiscovery(t bool) *Config { + c.EnableEndpointDiscovery = &t + return c +} + +// WithDisableEndpointHostPrefix will set whether or not to use modeled host prefix +// when making requests. +func (c *Config) WithDisableEndpointHostPrefix(t bool) *Config { + c.DisableEndpointHostPrefix = &t + return c +} + // MergeIn merges the passed in configs into the existing config object. func (c *Config) MergeIn(cfgs ...*Config) { for _, other := range cfgs { @@ -476,6 +512,14 @@ func mergeInConfig(dst *Config, other *Config) { if other.EnforceShouldRetryCheck != nil { dst.EnforceShouldRetryCheck = other.EnforceShouldRetryCheck } + + if other.EnableEndpointDiscovery != nil { + dst.EnableEndpointDiscovery = other.EnableEndpointDiscovery + } + + if other.DisableEndpointHostPrefix != nil { + dst.DisableEndpointHostPrefix = other.DisableEndpointHostPrefix + } } // Copy will return a shallow copy of the Config object. If any additional diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go similarity index 58% rename from vendor/github.com/aws/aws-sdk-go/aws/context.go rename to vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go index 79f42685..2866f9a7 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/context.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_1_5.go @@ -1,8 +1,8 @@ +// +build !go1.9 + package aws -import ( - "time" -) +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" @@ -35,37 +35,3 @@ type Context interface { // 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_7.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go deleted file mode 100644 index 064f75c9..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_7.go +++ /dev/null @@ -1,9 +0,0 @@ -// +build go1.7 - -package aws - -import "context" - -var ( - backgroundCtx = context.Background() -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go b/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go new file mode 100644 index 00000000..3718b26e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_1_9.go @@ -0,0 +1,11 @@ +// +build go1.9 + +package aws + +import "context" + +// Context is an alias of the Go stdlib's context.Context interface. +// It can be used within the SDK's API operation "WithContext" methods. +// +// See https://golang.org/pkg/context on how to use contexts. +type Context = context.Context 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_background_1_5.go similarity index 59% rename from vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go rename to vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go index 8fdda530..66c5945d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/context_1_6.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_5.go @@ -39,3 +39,18 @@ func (e *emptyCtx) String() string { var ( backgroundCtx = new(emptyCtx) ) + +// 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 +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go new file mode 100644 index 00000000..9c29f29a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_background_1_7.go @@ -0,0 +1,20 @@ +// +build go1.7 + +package aws + +import "context" + +// 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 context.Background() +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go b/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go new file mode 100644 index 00000000..304fd156 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/context_sleep.go @@ -0,0 +1,24 @@ +package aws + +import ( + "time" +) + +// 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/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index cfcddf3d..f8853d78 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -72,9 +72,9 @@ var ValidateReqSigHandler = request.NamedHandler{ signedTime = r.LastSignedAt } - // 10 minutes to allow for some clock skew/delays in transmission. + // 5 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()) { + if signedTime.Add(5 * time.Minute).After(time.Now()) { return } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go index a15f496b..ab69c7a6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/user_agent.go @@ -17,7 +17,7 @@ var SDKVersionUserAgentHandler = request.NamedHandler{ } const execEnvVar = `AWS_EXECUTION_ENV` -const execEnvUAKey = `exec_env` +const execEnvUAKey = `exec-env` // AddHostExecEnvUserAgentHander is a request handler appending the SDK's // execution environment to the user agent. 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 index f298d659..3ad1e798 100644 --- 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 @@ -9,9 +9,7 @@ var ( // providers in the ChainProvider. // // This has been deprecated. For verbose error messaging set - // aws.Config.CredentialsChainVerboseErrors to true - // - // @readonly + // aws.Config.CredentialsChainVerboseErrors to true. ErrNoValidProvidersFoundInChain = awserr.New("NoCredentialProviders", `no valid providers in chain. Deprecated. For verbose messaging see aws.Config.CredentialsChainVerboseErrors`, 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 index a270844d..83bbc311 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/credentials.go @@ -49,8 +49,11 @@ package credentials import ( + "fmt" "sync" "time" + + "github.com/aws/aws-sdk-go/aws/awserr" ) // AnonymousCredentials is an empty Credential object that can be used as @@ -64,8 +67,6 @@ import ( // Credentials: credentials.AnonymousCredentials, // }))) // // Access public S3 buckets. -// -// @readonly var AnonymousCredentials = NewStaticCredentials("", "", "") // A Value is the AWS credentials value for individual credential fields. @@ -99,6 +100,14 @@ type Provider interface { IsExpired() bool } +// An Expirer is an interface that Providers can implement to expose the expiration +// time, if known. If the Provider cannot accurately provide this info, +// it should not implement this interface. +type Expirer interface { + // The time at which the credentials are no longer valid + ExpiresAt() time.Time +} + // 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. @@ -165,6 +174,11 @@ func (e *Expiry) IsExpired() bool { return e.expiration.Before(curTime()) } +// ExpiresAt returns the expiration time of the credential +func (e *Expiry) ExpiresAt() time.Time { + return e.expiration +} + // A Credentials provides concurrency 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. @@ -257,3 +271,23 @@ func (c *Credentials) IsExpired() bool { func (c *Credentials) isExpired() bool { return c.forceRefresh || c.provider.IsExpired() } + +// ExpiresAt provides access to the functionality of the Expirer interface of +// the underlying Provider, if it supports that interface. Otherwise, it returns +// an error. +func (c *Credentials) ExpiresAt() (time.Time, error) { + c.m.RLock() + defer c.m.RUnlock() + + expirer, ok := c.provider.(Expirer) + if !ok { + return time.Time{}, awserr.New("ProviderNotExpirer", + fmt.Sprintf("provider %s does not support ExpiresAt()", c.creds.ProviderName), + nil) + } + if c.forceRefresh { + // set expiration time to the distant past + return time.Time{}, nil + } + return expirer.ExpiresAt(), nil +} 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 index 0ed791be..43d4ed38 100644 --- 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 @@ -11,6 +11,7 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/ec2metadata" + "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/internal/sdkuri" ) @@ -142,7 +143,8 @@ func requestCredList(client *ec2metadata.EC2Metadata) ([]string, error) { } if err := s.Err(); err != nil { - return nil, awserr.New("SerializationError", "failed to read EC2 instance role from metadata service", err) + return nil, awserr.New(request.ErrCodeSerialization, + "failed to read EC2 instance role from metadata service", err) } return credsList, nil @@ -164,7 +166,7 @@ func requestCred(client *ec2metadata.EC2Metadata, credsName string) (ec2RoleCred respCreds := ec2RoleCredRespBody{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&respCreds); err != nil { return ec2RoleCredRespBody{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, fmt.Sprintf("failed to decode %s EC2 instance role credentials", credsName), 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 index a4cec5c5..c2b2c5d6 100644 --- 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 @@ -39,6 +39,7 @@ import ( "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" + "github.com/aws/aws-sdk-go/private/protocol/json/jsonutil" ) // ProviderName is the name of the credentials provider. @@ -65,6 +66,10 @@ type Provider struct { // // If ExpiryWindow is 0 or less it will be ignored. ExpiryWindow time.Duration + + // Optional authorization token value if set will be used as the value of + // the Authorization header of the endpoint credential request. + AuthorizationToken string } // NewProviderClient returns a credentials Provider for retrieving AWS credentials @@ -152,6 +157,9 @@ func (p *Provider) getCredentials() (*getCredentialsOutput, error) { out := &getCredentialsOutput{} req := p.Client.NewRequest(op, nil, out) req.HTTPRequest.Header.Set("Accept", "application/json") + if authToken := p.AuthorizationToken; len(authToken) != 0 { + req.HTTPRequest.Header.Set("Authorization", authToken) + } return out, req.Send() } @@ -167,7 +175,7 @@ func unmarshalHandler(r *request.Request) { out := r.Data.(*getCredentialsOutput) if err := json.NewDecoder(r.HTTPResponse.Body).Decode(&out); err != nil { - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode endpoint credentials", err, ) @@ -178,11 +186,15 @@ 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, + err := jsonutil.UnmarshalJSONError(&errOut, r.HTTPResponse.Body) + if err != nil { + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to decode error message", err), + r.HTTPResponse.StatusCode, + r.RequestID, ) + return } // Response body format is not consistent between metadata endpoints. 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 index c14231a1..54c5cf73 100644 --- 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 @@ -12,14 +12,10 @@ 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) ) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go b/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go new file mode 100644 index 00000000..1980c8c1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/credentials/processcreds/provider.go @@ -0,0 +1,425 @@ +/* +Package processcreds is a credential Provider to retrieve `credential_process` +credentials. + +WARNING: The following describes a method of sourcing credentials from an external +process. This can potentially be dangerous, so proceed with caution. Other +credential providers should be preferred if at all possible. If using this +option, you should make sure that the config file is as locked down as possible +using security best practices for your operating system. + +You can use credentials from a `credential_process` in a variety of ways. + +One way is to setup your shared config file, located in the default +location, with the `credential_process` key and the command you want to be +called. You also need to set the AWS_SDK_LOAD_CONFIG environment variable +(e.g., `export AWS_SDK_LOAD_CONFIG=1`) to use the shared config file. + + [default] + credential_process = /command/to/call + +Creating a new session will use the credential process to retrieve credentials. +NOTE: If there are credentials in the profile you are using, the credential +process will not be used. + + // Initialize a session to load credentials. + sess, _ := session.NewSession(&aws.Config{ + Region: aws.String("us-east-1")}, + ) + + // Create S3 service client to use the credentials. + svc := s3.New(sess) + +Another way to use the `credential_process` method is by using +`credentials.NewCredentials()` and providing a command to be executed to +retrieve credentials: + + // Create credentials using the ProcessProvider. + creds := processcreds.NewCredentials("/path/to/command") + + // Create service client value configured for credentials. + svc := s3.New(sess, &aws.Config{Credentials: creds}) + +You can set a non-default timeout for the `credential_process` with another +constructor, `credentials.NewCredentialsTimeout()`, providing the timeout. To +set a one minute timeout: + + // Create credentials using the ProcessProvider. + creds := processcreds.NewCredentialsTimeout( + "/path/to/command", + time.Duration(500) * time.Millisecond) + +If you need more control, you can set any configurable options in the +credentials using one or more option functions. For example, you can set a two +minute timeout, a credential duration of 60 minutes, and a maximum stdout +buffer size of 2k. + + creds := processcreds.NewCredentials( + "/path/to/command", + func(opt *ProcessProvider) { + opt.Timeout = time.Duration(2) * time.Minute + opt.Duration = time.Duration(60) * time.Minute + opt.MaxBufSize = 2048 + }) + +You can also use your own `exec.Cmd`: + + // Create an exec.Cmd + myCommand := exec.Command("/path/to/command") + + // Create credentials using your exec.Cmd and custom timeout + creds := processcreds.NewCredentialsCommand( + myCommand, + func(opt *processcreds.ProcessProvider) { + opt.Timeout = time.Duration(1) * time.Second + }) +*/ +package processcreds + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "io/ioutil" + "os" + "os/exec" + "runtime" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/aws/credentials" +) + +const ( + // ProviderName is the name this credentials provider will label any + // returned credentials Value with. + ProviderName = `ProcessProvider` + + // ErrCodeProcessProviderParse error parsing process output + ErrCodeProcessProviderParse = "ProcessProviderParseError" + + // ErrCodeProcessProviderVersion version error in output + ErrCodeProcessProviderVersion = "ProcessProviderVersionError" + + // ErrCodeProcessProviderRequired required attribute missing in output + ErrCodeProcessProviderRequired = "ProcessProviderRequiredError" + + // ErrCodeProcessProviderExecution execution of command failed + ErrCodeProcessProviderExecution = "ProcessProviderExecutionError" + + // errMsgProcessProviderTimeout process took longer than allowed + errMsgProcessProviderTimeout = "credential process timed out" + + // errMsgProcessProviderProcess process error + errMsgProcessProviderProcess = "error in credential_process" + + // errMsgProcessProviderParse problem parsing output + errMsgProcessProviderParse = "parse failed of credential_process output" + + // errMsgProcessProviderVersion version error in output + errMsgProcessProviderVersion = "wrong version in process output (not 1)" + + // errMsgProcessProviderMissKey missing access key id in output + errMsgProcessProviderMissKey = "missing AccessKeyId in process output" + + // errMsgProcessProviderMissSecret missing secret acess key in output + errMsgProcessProviderMissSecret = "missing SecretAccessKey in process output" + + // errMsgProcessProviderPrepareCmd prepare of command failed + errMsgProcessProviderPrepareCmd = "failed to prepare command" + + // errMsgProcessProviderEmptyCmd command must not be empty + errMsgProcessProviderEmptyCmd = "command must not be empty" + + // errMsgProcessProviderPipe failed to initialize pipe + errMsgProcessProviderPipe = "failed to initialize pipe" + + // DefaultDuration is the default amount of time in minutes that the + // credentials will be valid for. + DefaultDuration = time.Duration(15) * time.Minute + + // DefaultBufSize limits buffer size from growing to an enormous + // amount due to a faulty process. + DefaultBufSize = 1024 + + // DefaultTimeout default limit on time a process can run. + DefaultTimeout = time.Duration(1) * time.Minute +) + +// ProcessProvider satisfies the credentials.Provider interface, and is a +// client to retrieve credentials from a process. +type ProcessProvider struct { + staticCreds bool + credentials.Expiry + originalCommand []string + + // Expiry duration of the credentials. Defaults to 15 minutes if not set. + Duration time.Duration + + // 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 + + // A string representing an os command that should return a JSON with + // credential information. + command *exec.Cmd + + // MaxBufSize limits memory usage from growing to an enormous + // amount due to a faulty process. + MaxBufSize int + + // Timeout limits the time a process can run. + Timeout time.Duration +} + +// NewCredentials returns a pointer to a new Credentials object wrapping the +// ProcessProvider. The credentials will expire every 15 minutes by default. +func NewCredentials(command string, options ...func(*ProcessProvider)) *credentials.Credentials { + p := &ProcessProvider{ + command: exec.Command(command), + Duration: DefaultDuration, + Timeout: DefaultTimeout, + MaxBufSize: DefaultBufSize, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +// NewCredentialsTimeout returns a pointer to a new Credentials object with +// the specified command and timeout, and default duration and max buffer size. +func NewCredentialsTimeout(command string, timeout time.Duration) *credentials.Credentials { + p := NewCredentials(command, func(opt *ProcessProvider) { + opt.Timeout = timeout + }) + + return p +} + +// NewCredentialsCommand returns a pointer to a new Credentials object with +// the specified command, and default timeout, duration and max buffer size. +func NewCredentialsCommand(command *exec.Cmd, options ...func(*ProcessProvider)) *credentials.Credentials { + p := &ProcessProvider{ + command: command, + Duration: DefaultDuration, + Timeout: DefaultTimeout, + MaxBufSize: DefaultBufSize, + } + + for _, option := range options { + option(p) + } + + return credentials.NewCredentials(p) +} + +type credentialProcessResponse struct { + Version int + AccessKeyID string `json:"AccessKeyId"` + SecretAccessKey string + SessionToken string + Expiration *time.Time +} + +// Retrieve executes the 'credential_process' and returns the credentials. +func (p *ProcessProvider) Retrieve() (credentials.Value, error) { + out, err := p.executeCredentialProcess() + if err != nil { + return credentials.Value{ProviderName: ProviderName}, err + } + + // Serialize and validate response + resp := &credentialProcessResponse{} + if err = json.Unmarshal(out, resp); err != nil { + return credentials.Value{ProviderName: ProviderName}, awserr.New( + ErrCodeProcessProviderParse, + fmt.Sprintf("%s: %s", errMsgProcessProviderParse, string(out)), + err) + } + + if resp.Version != 1 { + return credentials.Value{ProviderName: ProviderName}, awserr.New( + ErrCodeProcessProviderVersion, + errMsgProcessProviderVersion, + nil) + } + + if len(resp.AccessKeyID) == 0 { + return credentials.Value{ProviderName: ProviderName}, awserr.New( + ErrCodeProcessProviderRequired, + errMsgProcessProviderMissKey, + nil) + } + + if len(resp.SecretAccessKey) == 0 { + return credentials.Value{ProviderName: ProviderName}, awserr.New( + ErrCodeProcessProviderRequired, + errMsgProcessProviderMissSecret, + nil) + } + + // Handle expiration + p.staticCreds = resp.Expiration == nil + if resp.Expiration != nil { + p.SetExpiration(*resp.Expiration, p.ExpiryWindow) + } + + return credentials.Value{ + ProviderName: ProviderName, + AccessKeyID: resp.AccessKeyID, + SecretAccessKey: resp.SecretAccessKey, + SessionToken: resp.SessionToken, + }, nil +} + +// IsExpired returns true if the credentials retrieved are expired, or not yet +// retrieved. +func (p *ProcessProvider) IsExpired() bool { + if p.staticCreds { + return false + } + return p.Expiry.IsExpired() +} + +// prepareCommand prepares the command to be executed. +func (p *ProcessProvider) prepareCommand() error { + + var cmdArgs []string + if runtime.GOOS == "windows" { + cmdArgs = []string{"cmd.exe", "/C"} + } else { + cmdArgs = []string{"sh", "-c"} + } + + if len(p.originalCommand) == 0 { + p.originalCommand = make([]string, len(p.command.Args)) + copy(p.originalCommand, p.command.Args) + + // check for empty command because it succeeds + if len(strings.TrimSpace(p.originalCommand[0])) < 1 { + return awserr.New( + ErrCodeProcessProviderExecution, + fmt.Sprintf( + "%s: %s", + errMsgProcessProviderPrepareCmd, + errMsgProcessProviderEmptyCmd), + nil) + } + } + + cmdArgs = append(cmdArgs, p.originalCommand...) + p.command = exec.Command(cmdArgs[0], cmdArgs[1:]...) + p.command.Env = os.Environ() + + return nil +} + +// executeCredentialProcess starts the credential process on the OS and +// returns the results or an error. +func (p *ProcessProvider) executeCredentialProcess() ([]byte, error) { + + if err := p.prepareCommand(); err != nil { + return nil, err + } + + // Setup the pipes + outReadPipe, outWritePipe, err := os.Pipe() + if err != nil { + return nil, awserr.New( + ErrCodeProcessProviderExecution, + errMsgProcessProviderPipe, + err) + } + + p.command.Stderr = os.Stderr // display stderr on console for MFA + p.command.Stdout = outWritePipe // get creds json on process's stdout + p.command.Stdin = os.Stdin // enable stdin for MFA + + output := bytes.NewBuffer(make([]byte, 0, p.MaxBufSize)) + + stdoutCh := make(chan error, 1) + go readInput( + io.LimitReader(outReadPipe, int64(p.MaxBufSize)), + output, + stdoutCh) + + execCh := make(chan error, 1) + go executeCommand(*p.command, execCh) + + finished := false + var errors []error + for !finished { + select { + case readError := <-stdoutCh: + errors = appendError(errors, readError) + finished = true + case execError := <-execCh: + err := outWritePipe.Close() + errors = appendError(errors, err) + errors = appendError(errors, execError) + if errors != nil { + return output.Bytes(), awserr.NewBatchError( + ErrCodeProcessProviderExecution, + errMsgProcessProviderProcess, + errors) + } + case <-time.After(p.Timeout): + finished = true + return output.Bytes(), awserr.NewBatchError( + ErrCodeProcessProviderExecution, + errMsgProcessProviderTimeout, + errors) // errors can be nil + } + } + + out := output.Bytes() + + if runtime.GOOS == "windows" { + // windows adds slashes to quotes + out = []byte(strings.Replace(string(out), `\"`, `"`, -1)) + } + + return out, nil +} + +// appendError conveniently checks for nil before appending slice +func appendError(errors []error, err error) []error { + if err != nil { + return append(errors, err) + } + return errors +} + +func executeCommand(cmd exec.Cmd, exec chan error) { + // Start the command + err := cmd.Start() + if err == nil { + err = cmd.Wait() + } + + exec <- err +} + +func readInput(r io.Reader, w io.Writer, read chan error) { + tee := io.TeeReader(r, w) + + _, err := ioutil.ReadAll(tee) + + if err == io.EOF { + err = nil + } + + read <- err // will only arrive here when write end of pipe is closed +} 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 index 51e21e0f..e1551495 100644 --- 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 @@ -4,9 +4,8 @@ import ( "fmt" "os" - "github.com/go-ini/ini" - "github.com/aws/aws-sdk-go/aws/awserr" + "github.com/aws/aws-sdk-go/internal/ini" "github.com/aws/aws-sdk-go/internal/shareddefaults" ) @@ -77,36 +76,37 @@ func (p *SharedCredentialsProvider) IsExpired() bool { // 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) + config, err := ini.OpenFile(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) + + iniProfile, ok := config.GetSection(profile) + if !ok { + return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsLoad", "failed to get profile", nil) } - id, err := iniProfile.GetKey("aws_access_key_id") - if err != nil { + id := iniProfile.String("aws_access_key_id") + if len(id) == 0 { return Value{ProviderName: SharedCredsProviderName}, awserr.New("SharedCredsAccessKey", fmt.Sprintf("shared credentials %s in %s did not contain aws_access_key_id", profile, filename), - err) + nil) } - secret, err := iniProfile.GetKey("aws_secret_access_key") - if err != nil { + secret := iniProfile.String("aws_secret_access_key") + if len(secret) == 0 { 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") + token := iniProfile.String("aws_session_token") return Value{ - AccessKeyID: id.String(), - SecretAccessKey: secret.String(), - SessionToken: token.String(), + AccessKeyID: id, + SecretAccessKey: secret, + SessionToken: token, ProviderName: SharedCredsProviderName, }, nil } 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 index 4f5dab3f..531139e3 100644 --- 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 @@ -9,8 +9,6 @@ const StaticProviderName = "StaticProvider" var ( // ErrStaticCredentialsEmpty is emitted when static credentials are empty. - // - // @readonly ErrStaticCredentialsEmpty = awserr.New("EmptyStaticCreds", "static credentials are empty", nil) ) 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 index 4108e433..2e528d13 100644 --- 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 @@ -80,16 +80,18 @@ package stscreds import ( "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/client" "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/internal/sdkrand" "github.com/aws/aws-sdk-go/service/sts" ) -// StdinTokenProvider will prompt on stdout and read from stdin for a string value. +// StdinTokenProvider will prompt on stderr 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 @@ -102,7 +104,7 @@ import ( // Will wait forever until something is provided on the stdin. func StdinTokenProvider() (string, error) { var v string - fmt.Printf("Assume Role MFA token code: ") + fmt.Fprintf(os.Stderr, "Assume Role MFA token code: ") _, err := fmt.Scanln(&v) return v, err @@ -193,6 +195,18 @@ type AssumeRoleProvider struct { // // If ExpiryWindow is 0 or less it will be ignored. ExpiryWindow time.Duration + + // MaxJitterFrac reduces the effective Duration of each credential requested + // by a random percentage between 0 and MaxJitterFraction. MaxJitterFrac must + // have a value between 0 and 1. Any other value may lead to expected behavior. + // With a MaxJitterFrac value of 0, default) will no jitter will be used. + // + // For example, with a Duration of 30m and a MaxJitterFrac of 0.1, the + // AssumeRole call will be made with an arbitrary Duration between 27m and + // 30m. + // + // MaxJitterFrac should not be negative. + MaxJitterFrac float64 } // NewCredentials returns a pointer to a new Credentials object wrapping the @@ -244,7 +258,6 @@ func NewCredentialsWithClient(svc AssumeRoler, roleARN string, options ...func(* // 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. @@ -254,8 +267,9 @@ func (p *AssumeRoleProvider) Retrieve() (credentials.Value, error) { // Expire as often as AWS permits. p.Duration = DefaultDuration } + jitter := time.Duration(sdkrand.SeededRand.Float64() * p.MaxJitterFrac * float64(p.Duration)) input := &sts.AssumeRoleInput{ - DurationSeconds: aws.Int64(int64(p.Duration / time.Second)), + DurationSeconds: aws.Int64(int64((p.Duration - jitter) / time.Second)), RoleArn: aws.String(p.RoleARN), RoleSessionName: aws.String(p.RoleSessionName), ExternalId: p.ExternalID, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go index 4b0d630e..5bacc791 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric.go @@ -3,6 +3,8 @@ package csm import ( "strconv" "time" + + "github.com/aws/aws-sdk-go/aws" ) type metricTime time.Time @@ -39,6 +41,12 @@ type metric struct { SDKException *string `json:"SdkException,omitempty"` SDKExceptionMessage *string `json:"SdkExceptionMessage,omitempty"` + FinalHTTPStatusCode *int `json:"FinalHttpStatusCode,omitempty"` + FinalAWSException *string `json:"FinalAwsException,omitempty"` + FinalAWSExceptionMessage *string `json:"FinalAwsExceptionMessage,omitempty"` + FinalSDKException *string `json:"FinalSdkException,omitempty"` + FinalSDKExceptionMessage *string `json:"FinalSdkExceptionMessage,omitempty"` + DestinationIP *string `json:"DestinationIp,omitempty"` ConnectionReused *int `json:"ConnectionReused,omitempty"` @@ -48,4 +56,54 @@ type metric struct { DNSLatency *int `json:"DnsLatency,omitempty"` TCPLatency *int `json:"TcpLatency,omitempty"` SSLLatency *int `json:"SslLatency,omitempty"` + + MaxRetriesExceeded *int `json:"MaxRetriesExceeded,omitempty"` +} + +func (m *metric) TruncateFields() { + m.ClientID = truncateString(m.ClientID, 255) + m.UserAgent = truncateString(m.UserAgent, 256) + + m.AWSException = truncateString(m.AWSException, 128) + m.AWSExceptionMessage = truncateString(m.AWSExceptionMessage, 512) + + m.SDKException = truncateString(m.SDKException, 128) + m.SDKExceptionMessage = truncateString(m.SDKExceptionMessage, 512) + + m.FinalAWSException = truncateString(m.FinalAWSException, 128) + m.FinalAWSExceptionMessage = truncateString(m.FinalAWSExceptionMessage, 512) + + m.FinalSDKException = truncateString(m.FinalSDKException, 128) + m.FinalSDKExceptionMessage = truncateString(m.FinalSDKExceptionMessage, 512) +} + +func truncateString(v *string, l int) *string { + if v != nil && len(*v) > l { + nv := (*v)[:l] + return &nv + } + + return v +} + +func (m *metric) SetException(e metricException) { + switch te := e.(type) { + case awsException: + m.AWSException = aws.String(te.exception) + m.AWSExceptionMessage = aws.String(te.message) + case sdkException: + m.SDKException = aws.String(te.exception) + m.SDKExceptionMessage = aws.String(te.message) + } +} + +func (m *metric) SetFinalException(e metricException) { + switch te := e.(type) { + case awsException: + m.FinalAWSException = aws.String(te.exception) + m.FinalAWSExceptionMessage = aws.String(te.message) + case sdkException: + m.FinalSDKException = aws.String(te.exception) + m.FinalSDKExceptionMessage = aws.String(te.message) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go new file mode 100644 index 00000000..54a99280 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/metric_exception.go @@ -0,0 +1,26 @@ +package csm + +type metricException interface { + Exception() string + Message() string +} + +type requestException struct { + exception string + message string +} + +func (e requestException) Exception() string { + return e.exception +} +func (e requestException) Message() string { + return e.message +} + +type awsException struct { + requestException +} + +type sdkException struct { + requestException +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go index 11082e5e..d9aa5b06 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/csm/reporter.go @@ -82,26 +82,29 @@ func (rep *Reporter) sendAPICallAttemptMetric(r *request.Request) { if r.Error != nil { if awserr, ok := r.Error.(awserr.Error); ok { - setError(&m, awserr) + m.SetException(getMetricException(awserr)) } } + m.TruncateFields() rep.metricsCh.Push(m) } -func setError(m *metric, err awserr.Error) { +func getMetricException(err awserr.Error) metricException { msg := err.Error() code := err.Code() switch code { case "RequestError", - "SerializationError", + request.ErrCodeSerialization, request.CanceledErrorCode: - m.SDKException = &code - m.SDKExceptionMessage = &msg + return sdkException{ + requestException{exception: code, message: msg}, + } default: - m.AWSException = &code - m.AWSExceptionMessage = &msg + return awsException{ + requestException{exception: code, message: msg}, + } } } @@ -112,16 +115,31 @@ func (rep *Reporter) sendAPICallMetric(r *request.Request) { now := time.Now() m := metric{ - ClientID: aws.String(rep.clientID), - API: aws.String(r.Operation.Name), - Service: aws.String(r.ClientInfo.ServiceID), - Timestamp: (*metricTime)(&now), - Type: aws.String("ApiCall"), - AttemptCount: aws.Int(r.RetryCount + 1), - Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)), - XAmzRequestID: aws.String(r.RequestID), + ClientID: aws.String(rep.clientID), + API: aws.String(r.Operation.Name), + Service: aws.String(r.ClientInfo.ServiceID), + Timestamp: (*metricTime)(&now), + UserAgent: aws.String(r.HTTPRequest.Header.Get("User-Agent")), + Type: aws.String("ApiCall"), + AttemptCount: aws.Int(r.RetryCount + 1), + Region: r.Config.Region, + Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)), + XAmzRequestID: aws.String(r.RequestID), + MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())), } + if r.HTTPResponse != nil { + m.FinalHTTPStatusCode = aws.Int(r.HTTPResponse.StatusCode) + } + + if r.Error != nil { + if awserr, ok := r.Error.(awserr.Error); ok { + m.SetFinalException(getMetricException(awserr)) + } + } + + m.TruncateFields() + // TODO: Probably want to figure something out for logging dropped // metrics rep.metricsCh.Push(m) @@ -221,11 +239,22 @@ func (rep *Reporter) InjectHandlers(handlers *request.Handlers) { return } - apiCallHandler := request.NamedHandler{Name: APICallMetricHandlerName, Fn: rep.sendAPICallMetric} - apiCallAttemptHandler := request.NamedHandler{Name: APICallAttemptMetricHandlerName, Fn: rep.sendAPICallAttemptMetric} + handlers.Complete.PushFrontNamed(request.NamedHandler{ + Name: APICallMetricHandlerName, + Fn: rep.sendAPICallMetric, + }) - handlers.Complete.PushFrontNamed(apiCallHandler) - handlers.Complete.PushFrontNamed(apiCallAttemptHandler) - - handlers.AfterRetry.PushFrontNamed(apiCallAttemptHandler) + handlers.CompleteAttempt.PushFrontNamed(request.NamedHandler{ + Name: APICallAttemptMetricHandlerName, + Fn: rep.sendAPICallAttemptMetric, + }) +} + +// boolIntValue return 1 for true and 0 for false. +func boolIntValue(b bool) int { + if b { + return 1 + } + + return 0 } 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 index 5040a2f6..23bb639e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/defaults/defaults.go @@ -24,6 +24,7 @@ import ( "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/internal/shareddefaults" ) // A Defaults provides a collection of default values for SDK clients. @@ -112,8 +113,8 @@ func CredProviders(cfg *aws.Config, handlers request.Handlers) []credentials.Pro } const ( - httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" - ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" + httpProviderAuthorizationEnvVar = "AWS_CONTAINER_AUTHORIZATION_TOKEN" + httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI" ) // RemoteCredProvider returns a credentials provider for the default remote @@ -123,8 +124,8 @@ func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.P return localHTTPCredProvider(cfg, handlers, u) } - if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 { - u := fmt.Sprintf("http://169.254.170.2%s", uri) + if uri := os.Getenv(shareddefaults.ECSCredsProviderEnvVar); len(uri) > 0 { + u := fmt.Sprintf("%s%s", shareddefaults.ECSContainerCredentialsURI, uri) return httpCredProvider(cfg, handlers, u) } @@ -187,6 +188,7 @@ func httpCredProvider(cfg aws.Config, handlers request.Handlers, u string) crede return endpointcreds.NewProviderClient(cfg, handlers, u, func(p *endpointcreds.Provider) { p.ExpiryWindow = 5 * time.Minute + p.AuthorizationToken = os.Getenv(httpProviderAuthorizationEnvVar) }, ) } 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 index c215cd3f..2c8d5f56 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/api.go @@ -24,8 +24,9 @@ func (c *EC2Metadata) GetMetadata(p string) (string, error) { output := &metadataOutput{} req := c.NewRequest(op, nil, output) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetUserData returns the userdata that was configured for the service. If @@ -45,8 +46,9 @@ func (c *EC2Metadata) GetUserData() (string, error) { r.Error = awserr.New("NotFoundError", "user-data not found", r.Error) } }) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetDynamicData uses the path provided to request information from the EC2 @@ -61,8 +63,9 @@ func (c *EC2Metadata) GetDynamicData(p string) (string, error) { output := &metadataOutput{} req := c.NewRequest(op, nil, output) + err := req.Send() - return output.Content, req.Send() + return output.Content, err } // GetInstanceIdentityDocument retrieves an identity document describing an @@ -79,7 +82,7 @@ func (c *EC2Metadata) GetInstanceIdentityDocument() (EC2InstanceIdentityDocument doc := EC2InstanceIdentityDocument{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&doc); err != nil { return EC2InstanceIdentityDocument{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, "failed to decode EC2 instance identity document", err) } @@ -98,7 +101,7 @@ func (c *EC2Metadata) IAMInfo() (EC2IAMInfo, error) { info := EC2IAMInfo{} if err := json.NewDecoder(strings.NewReader(resp)).Decode(&info); err != nil { return EC2IAMInfo{}, - awserr.New("SerializationError", + awserr.New(request.ErrCodeSerialization, "failed to decode EC2 IAM info", err) } @@ -118,6 +121,10 @@ func (c *EC2Metadata) Region() (string, error) { return "", err } + if len(resp) == 0 { + return "", awserr.New("EC2MetadataError", "invalid Region response", nil) + } + // returns region without the suffix. Eg: us-west-2a becomes us-west-2 return resp[:len(resp)-1], nil } 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 index ef5f7329..f0c1d31e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/ec2metadata/service.go @@ -4,7 +4,7 @@ // This package's client can be disabled completely by setting the environment // variable "AWS_EC2_METADATA_DISABLED=true". This environment variable set to // true instructs the SDK to disable the EC2 Metadata client. The client cannot -// be used while the environemnt variable is set to true, (case insensitive). +// be used while the environment variable is set to true, (case insensitive). package ec2metadata import ( @@ -72,6 +72,7 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio cfg, metadata.ClientInfo{ ServiceName: ServiceName, + ServiceID: ServiceName, Endpoint: endpoint, APIVersion: "latest", }, @@ -91,6 +92,9 @@ func NewClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegio svc.Handlers.Send.SwapNamed(request.NamedHandler{ Name: corehandlers.SendHandler.Name, Fn: func(r *request.Request) { + r.HTTPResponse = &http.Response{ + Header: http.Header{}, + } r.Error = awserr.New( request.CanceledErrorCode, "EC2 IMDS access disabled via "+disableServiceEnvVar+" env var", @@ -119,7 +123,7 @@ 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) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata respose", err) return } @@ -132,7 +136,7 @@ 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) + r.Error = awserr.New(request.ErrCodeSerialization, "unable to unmarshal EC2 metadata error respose", err) return } 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 index c04ba06c..87b9ff3f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/decode.go @@ -85,6 +85,7 @@ func decodeV3Endpoints(modelDef modelDefinition, opts DecodeModelOptions) (Resol custAddS3DualStack(p) custRmIotDataService(p) custFixAppAutoscalingChina(p) + custFixAppAutoscalingUsGov(p) } return ps, nil @@ -95,7 +96,12 @@ func custAddS3DualStack(p *partition) { return } - s, ok := p.Services["s3"] + custAddDualstack(p, "s3") + custAddDualstack(p, "s3-control") +} + +func custAddDualstack(p *partition, svcName string) { + s, ok := p.Services[svcName] if !ok { return } @@ -103,7 +109,7 @@ func custAddS3DualStack(p *partition) { s.Defaults.HasDualStack = boxedTrue s.Defaults.DualStackHostname = "{service}.dualstack.{region}.{dnsSuffix}" - p.Services["s3"] = s + p.Services[svcName] = s } func custAddEC2Metadata(p *partition) { @@ -144,6 +150,33 @@ func custFixAppAutoscalingChina(p *partition) { p.Services[serviceName] = s } +func custFixAppAutoscalingUsGov(p *partition) { + if p.ID != "aws-us-gov" { + return + } + + const serviceName = "application-autoscaling" + s, ok := p.Services[serviceName] + if !ok { + return + } + + if a := s.Defaults.CredentialScope.Service; a != "" { + fmt.Printf("custFixAppAutoscalingUsGov: ignoring customization, expected empty credential scope service, got %s\n", a) + return + } + + if a := s.Defaults.Hostname; a != "" { + fmt.Printf("custFixAppAutoscalingUsGov: ignoring customization, expected empty hostname, got %s\n", a) + return + } + + s.Defaults.CredentialScope.Service = "application-autoscaling" + s.Defaults.Hostname = "autoscaling.{region}.amazonaws.com" + + p.Services[serviceName] = s +} + type decodeModelError struct { awsError } 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 index 86788100..996c64cf 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -15,6 +15,7 @@ const ( // AWS Standard partition's regions. const ( + ApEast1RegionID = "ap-east-1" // Asia Pacific (Hong Kong). ApNortheast1RegionID = "ap-northeast-1" // Asia Pacific (Tokyo). ApNortheast2RegionID = "ap-northeast-2" // Asia Pacific (Seoul). ApSouth1RegionID = "ap-south-1" // Asia Pacific (Mumbai). @@ -22,6 +23,7 @@ const ( ApSoutheast2RegionID = "ap-southeast-2" // Asia Pacific (Sydney). CaCentral1RegionID = "ca-central-1" // Canada (Central). EuCentral1RegionID = "eu-central-1" // EU (Frankfurt). + EuNorth1RegionID = "eu-north-1" // EU (Stockholm). EuWest1RegionID = "eu-west-1" // EU (Ireland). EuWest2RegionID = "eu-west-2" // EU (London). EuWest3RegionID = "eu-west-3" // EU (Paris). @@ -40,141 +42,10 @@ const ( // AWS GovCloud (US) partition's regions. const ( + UsGovEast1RegionID = "us-gov-east-1" // AWS GovCloud (US-East). UsGovWest1RegionID = "us-gov-west-1" // AWS GovCloud (US). ) -// Service identifiers -const ( - A4bServiceID = "a4b" // A4b. - AcmServiceID = "acm" // Acm. - AcmPcaServiceID = "acm-pca" // AcmPca. - ApiMediatailorServiceID = "api.mediatailor" // ApiMediatailor. - ApiPricingServiceID = "api.pricing" // ApiPricing. - ApiSagemakerServiceID = "api.sagemaker" // ApiSagemaker. - ApigatewayServiceID = "apigateway" // Apigateway. - ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. - Appstream2ServiceID = "appstream2" // Appstream2. - AthenaServiceID = "athena" // Athena. - AutoscalingServiceID = "autoscaling" // Autoscaling. - AutoscalingPlansServiceID = "autoscaling-plans" // AutoscalingPlans. - BatchServiceID = "batch" // Batch. - BudgetsServiceID = "budgets" // Budgets. - CeServiceID = "ce" // Ce. - Cloud9ServiceID = "cloud9" // Cloud9. - 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. - ComprehendServiceID = "comprehend" // Comprehend. - 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. - FmsServiceID = "fms" // Fms. - GameliftServiceID = "gamelift" // Gamelift. - GlacierServiceID = "glacier" // Glacier. - GlueServiceID = "glue" // Glue. - GreengrassServiceID = "greengrass" // Greengrass. - GuarddutyServiceID = "guardduty" // Guardduty. - HealthServiceID = "health" // Health. - IamServiceID = "iam" // Iam. - ImportexportServiceID = "importexport" // Importexport. - InspectorServiceID = "inspector" // Inspector. - IotServiceID = "iot" // Iot. - IotanalyticsServiceID = "iotanalytics" // Iotanalytics. - KinesisServiceID = "kinesis" // Kinesis. - KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. - KinesisvideoServiceID = "kinesisvideo" // Kinesisvideo. - KmsServiceID = "kms" // Kms. - LambdaServiceID = "lambda" // Lambda. - LightsailServiceID = "lightsail" // Lightsail. - LogsServiceID = "logs" // Logs. - MachinelearningServiceID = "machinelearning" // Machinelearning. - MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. - MediaconvertServiceID = "mediaconvert" // Mediaconvert. - MedialiveServiceID = "medialive" // Medialive. - MediapackageServiceID = "mediapackage" // Mediapackage. - MediastoreServiceID = "mediastore" // Mediastore. - MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. - MghServiceID = "mgh" // Mgh. - MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. - ModelsLexServiceID = "models.lex" // ModelsLex. - MonitoringServiceID = "monitoring" // Monitoring. - MturkRequesterServiceID = "mturk-requester" // MturkRequester. - NeptuneServiceID = "neptune" // Neptune. - 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. - ResourceGroupsServiceID = "resource-groups" // ResourceGroups. - Route53ServiceID = "route53" // Route53. - Route53domainsServiceID = "route53domains" // Route53domains. - RuntimeLexServiceID = "runtime.lex" // RuntimeLex. - RuntimeSagemakerServiceID = "runtime.sagemaker" // RuntimeSagemaker. - S3ServiceID = "s3" // S3. - SdbServiceID = "sdb" // Sdb. - SecretsmanagerServiceID = "secretsmanager" // Secretsmanager. - ServerlessrepoServiceID = "serverlessrepo" // Serverlessrepo. - ServicecatalogServiceID = "servicecatalog" // Servicecatalog. - ServicediscoveryServiceID = "servicediscovery" // Servicediscovery. - 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. - TranslateServiceID = "translate" // Translate. - WafServiceID = "waf" // Waf. - WafRegionalServiceID = "waf-regional" // WafRegional. - WorkdocsServiceID = "workdocs" // Workdocs. - WorkmailServiceID = "workmail" // Workmail. - 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). // @@ -221,6 +92,9 @@ var awsPartition = partition{ SignatureVersions: []string{"v4"}, }, Regions: regions{ + "ap-east-1": region{ + Description: "Asia Pacific (Hong Kong)", + }, "ap-northeast-1": region{ Description: "Asia Pacific (Tokyo)", }, @@ -242,6 +116,9 @@ var awsPartition = partition{ "eu-central-1": region{ Description: "EU (Frankfurt)", }, + "eu-north-1": region{ + Description: "EU (Stockholm)", + }, "eu-west-1": region{ Description: "EU (Ireland)", }, @@ -277,6 +154,7 @@ var awsPartition = partition{ "acm": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -284,6 +162,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -300,17 +179,129 @@ var awsPartition = partition{ }, 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-north-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{}, }, }, + "api.ecr": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{ + Hostname: "api.ecr.ap-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-east-1", + }, + }, + "ap-northeast-1": endpoint{ + Hostname: "api.ecr.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "api.ecr.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{ + Hostname: "api.ecr.ap-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, + "ap-southeast-1": endpoint{ + Hostname: "api.ecr.ap-southeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "api.ecr.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "ca-central-1": endpoint{ + Hostname: "api.ecr.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{ + Hostname: "api.ecr.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-north-1": endpoint{ + Hostname: "api.ecr.eu-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-north-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "api.ecr.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "eu-west-2": endpoint{ + Hostname: "api.ecr.eu-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, + "eu-west-3": endpoint{ + Hostname: "api.ecr.eu-west-3.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-3", + }, + }, + "sa-east-1": endpoint{ + Hostname: "api.ecr.sa-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "sa-east-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "api.ecr.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "api.ecr.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{ + Hostname: "api.ecr.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{ + Hostname: "api.ecr.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "api.mediatailor": service{ Endpoints: endpoints{ @@ -319,6 +310,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "api.pricing": service{ @@ -337,17 +329,47 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "api-fips.sagemaker.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "apigateway": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -355,6 +377,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -373,6 +396,28 @@ var awsPartition = partition{ Service: "application-autoscaling", }, }, + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-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{}, + }, + }, + "appmesh": service{ + Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -383,8 +428,6 @@ var awsPartition = partition{ "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{}, @@ -400,12 +443,16 @@ var awsPartition = partition{ }, 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{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, }, }, - "athena": service{ + "appsync": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, @@ -421,10 +468,8 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "autoscaling": service{ - Defaults: endpoint{ - Protocols: []string{"http", "https"}, - }, + "athena": service{ + Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -433,6 +478,28 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "autoscaling": service{ + Defaults: endpoint{ + Protocols: []string{"http", "https"}, + }, + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -451,16 +518,6 @@ var awsPartition = partition{ Service: "autoscaling-plans", }, }, - Endpoints: endpoints{ - "ap-southeast-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, - }, - }, - "batch": service{ - Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -471,6 +528,44 @@ var awsPartition = partition{ "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{}, + }, + }, + "backup": 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{}, + }, + }, + "batch": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-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{}, @@ -504,10 +599,29 @@ var awsPartition = partition{ }, }, }, + "chime": service{ + PartitionEndpoint: "aws-global", + IsRegionalized: boxedFalse, + Defaults: endpoint{ + SSLCommonName: "service.chime.aws.amazon.com", + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "aws-global": endpoint{ + Hostname: "service.chime.aws.amazon.com", + Protocols: []string{"https"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + }, + }, "cloud9": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, "ap-southeast-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -519,6 +633,7 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, @@ -530,6 +645,7 @@ var awsPartition = partition{ "cloudformation": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -537,6 +653,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -583,14 +700,18 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "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-north-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{}, @@ -615,6 +736,7 @@ var awsPartition = partition{ "cloudtrail": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -622,6 +744,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -642,6 +765,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -689,16 +813,23 @@ var awsPartition = partition{ "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{}, + "fips": endpoint{ + Hostname: "codecommit-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "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-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -706,14 +837,39 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, + "us-east-1-fips": endpoint{ + Hostname: "codedeploy-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "codedeploy-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "codedeploy-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "codedeploy-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "codepipeline": service{ @@ -761,6 +917,7 @@ var awsPartition = partition{ "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{}, @@ -777,6 +934,7 @@ var awsPartition = partition{ "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{}, @@ -806,8 +964,24 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "comprehendmedical": service{ + + Endpoints: endpoints{ + "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-2": endpoint{}, @@ -816,6 +990,7 @@ var awsPartition = partition{ "config": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -823,6 +998,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -839,6 +1015,19 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "data.mediastore": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "datapipeline": service{ Endpoints: endpoints{ @@ -849,6 +1038,21 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "datasync": 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{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "dax": service{ Endpoints: endpoints{ @@ -856,6 +1060,7 @@ var awsPartition = partition{ "ap-south-1": 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{}, @@ -880,6 +1085,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -899,6 +1105,7 @@ var awsPartition = partition{ "dms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -906,6 +1113,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -916,6 +1124,59 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "docdb": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "rds.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "rds.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "rds.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "eu-central-1": endpoint{ + Hostname: "rds.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "rds.eu-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "rds.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "rds.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-2": endpoint{ + Hostname: "rds.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "ds": service{ Endpoints: endpoints{ @@ -926,6 +1187,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, @@ -940,16 +1202,24 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "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{}, + "ca-central-1-fips": endpoint{ + Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -959,9 +1229,33 @@ var awsPartition = partition{ }, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "ec2": service{ @@ -969,6 +1263,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -976,6 +1271,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -997,29 +1293,10 @@ var awsPartition = partition{ }, }, }, - "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-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1027,6 +1304,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1040,6 +1318,7 @@ var awsPartition = partition{ "elasticache": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1047,6 +1326,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1066,6 +1346,7 @@ var awsPartition = partition{ "elasticbeanstalk": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1073,6 +1354,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1088,9 +1370,14 @@ var awsPartition = partition{ 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{}, @@ -1102,6 +1389,7 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1109,6 +1397,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1125,6 +1414,7 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1134,10 +1424,11 @@ var awsPartition = partition{ "eu-central-1": endpoint{ SSLCommonName: "{service}.{region}.{dnsSuffix}", }, - "eu-west-1": endpoint{}, - "eu-west-2": endpoint{}, - "eu-west-3": endpoint{}, - "sa-east-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, + "sa-east-1": endpoint{}, "us-east-1": endpoint{ SSLCommonName: "{service}.{region}.{dnsSuffix}", }, @@ -1162,9 +1453,12 @@ var awsPartition = partition{ "email": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "entitlement.marketplace": service{ @@ -1180,6 +1474,7 @@ var awsPartition = partition{ "es": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1187,19 +1482,27 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, + "fips": endpoint{ + Hostname: "es-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "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-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1207,6 +1510,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1227,6 +1531,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1242,9 +1547,30 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "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-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "fsx": 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{}, }, }, "gamelift": service{ @@ -1271,6 +1597,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1278,9 +1605,11 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, @@ -1290,6 +1619,7 @@ var awsPartition = partition{ "glue": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1297,10 +1627,13 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, }, }, @@ -1318,6 +1651,13 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "groundstation": service{ + + Endpoints: endpoints{ + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "guardduty": service{ IsRegionalized: boxedTrue, Defaults: endpoint{ @@ -1331,6 +1671,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1384,6 +1725,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -1413,15 +1755,47 @@ var awsPartition = partition{ "iotanalytics": service{ Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "iotthingsgraph": service{ + Defaults: endpoint{ + CredentialScope: credentialScope{ + Service: "iotthingsgraph", + }, + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "kafka": 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{}, + "eu-west-3": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "kinesis": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1429,6 +1803,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1442,16 +1817,23 @@ var awsPartition = partition{ "kinesisanalytics": service{ Endpoints: endpoints{ - "eu-central-1": endpoint{}, - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, - "us-west-2": endpoint{}, + "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{}, }, }, "kinesisvideo": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, @@ -1461,6 +1843,7 @@ var awsPartition = partition{ "kms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1468,6 +1851,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1481,6 +1865,7 @@ var awsPartition = partition{ "lambda": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1488,6 +1873,28 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, + }, + }, + "license-manager": 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-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1519,6 +1926,7 @@ var awsPartition = partition{ "logs": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1526,6 +1934,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1549,6 +1958,25 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "mediaconnect": 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{}, + }, + }, "mediaconvert": service{ Endpoints: endpoints{ @@ -1561,6 +1989,7 @@ var awsPartition = partition{ "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{}, @@ -1577,6 +2006,7 @@ var awsPartition = partition{ "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, @@ -1588,6 +2018,7 @@ var awsPartition = partition{ 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{}, @@ -1595,6 +2026,7 @@ var awsPartition = partition{ "eu-west-3": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-west-1": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1605,6 +2037,7 @@ var awsPartition = partition{ "ap-northeast-2": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "us-east-1": endpoint{}, "us-west-2": endpoint{}, @@ -1617,6 +2050,7 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1624,6 +2058,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1662,6 +2097,28 @@ var awsPartition = partition{ Defaults: endpoint{ Protocols: []string{"http", "https"}, }, + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-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{}, + }, + }, + "mq": service{ + Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -1673,7 +2130,6 @@ var awsPartition = partition{ "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{}, @@ -1693,12 +2149,60 @@ var awsPartition = partition{ "neptune": service{ Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "rds.ap-northeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "rds.ap-northeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{ + Hostname: "rds.ap-south-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, + "ap-southeast-1": endpoint{ + Hostname: "rds.ap-southeast-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "rds.ap-southeast-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "eu-central-1": endpoint{ + Hostname: "rds.eu-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-north-1": endpoint{ + Hostname: "rds.eu-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-north-1", + }, + }, "eu-west-1": endpoint{ Hostname: "rds.eu-west-1.amazonaws.com", CredentialScope: credentialScope{ Region: "eu-west-1", }, }, + "eu-west-2": endpoint{ + Hostname: "rds.eu-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, "us-east-1": endpoint{ Hostname: "rds.us-east-1.amazonaws.com", CredentialScope: credentialScope{ @@ -1773,7 +2277,12 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ - "us-east-1": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-2": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, }, }, "polly": service{ @@ -1786,6 +2295,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1796,7 +2306,19 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "rds": service{ + "projects.iot1click": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, + }, + }, + "ram": service{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, @@ -1809,6 +2331,27 @@ var awsPartition = partition{ "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{}, + }, + }, + "rds": service{ + + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-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}", @@ -1821,6 +2364,7 @@ var awsPartition = partition{ "redshift": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1828,6 +2372,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1842,16 +2387,23 @@ var awsPartition = partition{ 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-1": endpoint{}, "us-west-2": endpoint{}, }, }, "resource-groups": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -1859,6 +2411,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -1869,6 +2422,15 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, + "robomaker": service{ + + Endpoints: endpoints{ + "ap-northeast-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "route53": service{ PartitionEndpoint: "aws-global", IsRegionalized: boxedFalse, @@ -1888,6 +2450,27 @@ var awsPartition = partition{ "us-east-1": endpoint{}, }, }, + "route53resolver": 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{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-1": endpoint{}, + "us-west-2": endpoint{}, + }, + }, "runtime.lex": service{ Defaults: endpoint{ CredentialScope: credentialScope{ @@ -1905,12 +2488,41 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "runtime-fips.sagemaker.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "s3": service{ @@ -1924,6 +2536,7 @@ var awsPartition = partition{ DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{ Hostname: "s3.ap-northeast-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, @@ -1940,6 +2553,7 @@ var awsPartition = partition{ }, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{ Hostname: "s3.eu-west-1.amazonaws.com", SignatureVersions: []string{"s3", "s3v4"}, @@ -1972,6 +2586,157 @@ var awsPartition = partition{ }, }, }, + "s3-control": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + + HasDualStack: boxedTrue, + DualStackHostname: "{service}.dualstack.{region}.{dnsSuffix}", + }, + Endpoints: endpoints{ + "ap-northeast-1": endpoint{ + Hostname: "s3-control.ap-northeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-northeast-1", + }, + }, + "ap-northeast-2": endpoint{ + Hostname: "s3-control.ap-northeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-northeast-2", + }, + }, + "ap-south-1": endpoint{ + Hostname: "s3-control.ap-south-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-south-1", + }, + }, + "ap-southeast-1": endpoint{ + Hostname: "s3-control.ap-southeast-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-southeast-1", + }, + }, + "ap-southeast-2": endpoint{ + Hostname: "s3-control.ap-southeast-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ap-southeast-2", + }, + }, + "ca-central-1": endpoint{ + Hostname: "s3-control.ca-central-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{ + Hostname: "s3-control.eu-central-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "eu-central-1", + }, + }, + "eu-north-1": endpoint{ + Hostname: "s3-control.eu-north-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "eu-north-1", + }, + }, + "eu-west-1": endpoint{ + Hostname: "s3-control.eu-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "eu-west-1", + }, + }, + "eu-west-2": endpoint{ + Hostname: "s3-control.eu-west-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "eu-west-2", + }, + }, + "eu-west-3": endpoint{ + Hostname: "s3-control.eu-west-3.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "eu-west-3", + }, + }, + "sa-east-1": endpoint{ + Hostname: "s3-control.sa-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "sa-east-1", + }, + }, + "us-east-1": endpoint{ + Hostname: "s3-control.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-1-fips": endpoint{ + Hostname: "s3-control-fips.us-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{ + Hostname: "s3-control.us-east-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-east-2-fips": endpoint{ + Hostname: "s3-control-fips.us-east-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{ + Hostname: "s3-control.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-1-fips": endpoint{ + Hostname: "s3-control-fips.us-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{ + Hostname: "s3-control.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + "us-west-2-fips": endpoint{ + Hostname: "s3-control-fips.us-west-2.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, "sdb": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -2000,8 +2765,55 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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: "secretsmanager-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "secretsmanager-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "secretsmanager-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "secretsmanager-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "securityhub": 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-north-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{}, @@ -2035,12 +2847,18 @@ var awsPartition = partition{ "eu-central-1": endpoint{ Protocols: []string{"https"}, }, + "eu-north-1": endpoint{ + Protocols: []string{"https"}, + }, "eu-west-1": endpoint{ Protocols: []string{"https"}, }, "eu-west-2": endpoint{ Protocols: []string{"https"}, }, + "eu-west-3": endpoint{ + Protocols: []string{"https"}, + }, "sa-east-1": endpoint{ Protocols: []string{"https"}, }, @@ -2060,6 +2878,51 @@ var awsPartition = partition{ }, "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-north-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: "servicecatalog-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "servicecatalog-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "servicecatalog-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "servicecatalog-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, + }, + }, + "servicediscovery": service{ + Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -2078,20 +2941,10 @@ var awsPartition = partition{ "us-west-2": endpoint{}, }, }, - "servicediscovery": service{ - - Endpoints: endpoints{ - "eu-west-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", + SSLCommonName: "shield.us-east-1.amazonaws.com", Protocols: []string{"https"}, }, Endpoints: endpoints{ @@ -2101,6 +2954,7 @@ var awsPartition = partition{ "sms": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2108,6 +2962,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2142,6 +2997,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2149,6 +3005,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2165,6 +3022,7 @@ var awsPartition = partition{ Protocols: []string{"http", "https"}, }, Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2172,6 +3030,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2211,6 +3070,7 @@ var awsPartition = partition{ "ssm": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2218,6 +3078,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2231,6 +3092,7 @@ var awsPartition = partition{ "states": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2238,8 +3100,11 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, @@ -2256,6 +3121,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2280,10 +3146,17 @@ var awsPartition = partition{ "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{}, + "ca-central-1-fips": endpoint{ + Hostname: "dynamodb-fips.ca-central-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ca-central-1", + }, + }, + "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "eu-west-3": endpoint{}, "local": endpoint{ Hostname: "localhost:8000", Protocols: []string{"http"}, @@ -2293,9 +3166,33 @@ var awsPartition = partition{ }, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "dynamodb-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "sts": service{ @@ -2307,6 +3204,12 @@ var awsPartition = partition{ }, }, Endpoints: endpoints{ + "ap-east-1": endpoint{ + Hostname: "sts.ap-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "ap-east-1", + }, + }, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{ Hostname: "sts.ap-northeast-2.amazonaws.com", @@ -2320,6 +3223,7 @@ var awsPartition = partition{ "aws-global": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2355,14 +3259,21 @@ var awsPartition = partition{ }, }, "support": service{ + PartitionEndpoint: "aws-global", Endpoints: endpoints{ - "us-east-1": endpoint{}, + "aws-global": endpoint{ + Hostname: "support.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, }, }, "swf": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2370,6 +3281,7 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, "eu-west-2": endpoint{}, "eu-west-3": endpoint{}, @@ -2382,6 +3294,28 @@ var awsPartition = partition{ }, "tagging": service{ + Endpoints: endpoints{ + "ap-east-1": endpoint{}, + "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-north-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{}, + }, + }, + "transfer": service{ + Endpoints: endpoints{ "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, @@ -2393,7 +3327,6 @@ var awsPartition = partition{ "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{}, @@ -2405,10 +3338,34 @@ var awsPartition = partition{ Protocols: []string{"https"}, }, Endpoints: endpoints{ - "eu-west-1": endpoint{}, - "us-east-1": endpoint{}, + "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-south-1": endpoint{}, + "ap-southeast-1": endpoint{}, + "ca-central-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "us-east-1": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "translate-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "translate-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "translate-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "waf": service{ @@ -2428,9 +3385,13 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, + "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, "us-west-1": endpoint{}, @@ -2477,6 +3438,7 @@ var awsPartition = partition{ "xray": service{ Endpoints: endpoints{ + "ap-east-1": endpoint{}, "ap-northeast-1": endpoint{}, "ap-northeast-2": endpoint{}, "ap-south-1": endpoint{}, @@ -2484,8 +3446,10 @@ var awsPartition = partition{ "ap-southeast-2": endpoint{}, "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, + "eu-north-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{}, @@ -2525,6 +3489,23 @@ var awscnPartition = partition{ }, }, Services: services{ + "api.ecr": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{ + Hostname: "api.ecr.cn-north-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + "cn-northwest-1": endpoint{ + Hostname: "api.ecr.cn-northwest-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "apigateway": service{ Endpoints: endpoints{ @@ -2561,6 +3542,20 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "cloudfront": service{ + PartitionEndpoint: "aws-cn-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "cloudfront.cn-northwest-1.amazonaws.com.cn", + Protocols: []string{"http", "https"}, + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "cloudtrail": service{ Endpoints: endpoints{ @@ -2568,6 +3563,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "codebuild": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "codedeploy": service{ Endpoints: endpoints{ @@ -2595,6 +3597,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "dms": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "ds": service{ Endpoints: endpoints{ @@ -2631,13 +3640,6 @@ var awscnPartition = partition{ }, }, }, - "ecr": service{ - - Endpoints: endpoints{ - "cn-north-1": endpoint{}, - "cn-northwest-1": endpoint{}, - }, - }, "ecs": service{ Endpoints: endpoints{ @@ -2680,6 +3682,7 @@ var awscnPartition = partition{ "es": service{ Endpoints: endpoints{ + "cn-north-1": endpoint{}, "cn-northwest-1": endpoint{}, }, }, @@ -2690,6 +3693,19 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "firehose": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, + "gamelift": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + }, + }, "glacier": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -2729,6 +3745,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "kms": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "lambda": service{ Endpoints: endpoints{ @@ -2743,6 +3766,17 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "mediaconvert": service{ + + Endpoints: endpoints{ + "cn-northwest-1": endpoint{ + Hostname: "subscribe.mediaconvert.cn-northwest-1.amazonaws.com.cn", + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "monitoring": service{ Defaults: endpoint{ Protocols: []string{"http", "https"}, @@ -2752,6 +3786,12 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "polly": service{ + + Endpoints: endpoints{ + "cn-northwest-1": endpoint{}, + }, + }, "rds": service{ Endpoints: endpoints{ @@ -2776,6 +3816,28 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "s3-control": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, + Endpoints: endpoints{ + "cn-north-1": endpoint{ + Hostname: "s3-control.cn-north-1.amazonaws.com.cn", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + "cn-northwest-1": endpoint{ + Hostname: "s3-control.cn-northwest-1.amazonaws.com.cn", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "cn-northwest-1", + }, + }, + }, + }, "sms": service{ Endpoints: endpoints{ @@ -2815,6 +3877,13 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "states": service{ + + Endpoints: endpoints{ + "cn-north-1": endpoint{}, + "cn-northwest-1": endpoint{}, + }, + }, "storagegateway": service{ Endpoints: endpoints{ @@ -2840,6 +3909,18 @@ var awscnPartition = partition{ "cn-northwest-1": endpoint{}, }, }, + "support": service{ + PartitionEndpoint: "aws-cn-global", + + Endpoints: endpoints{ + "aws-cn-global": endpoint{ + Hostname: "support.cn-north-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "cn-north-1", + }, + }, + }, + }, "swf": service{ Endpoints: endpoints{ @@ -2878,6 +3959,9 @@ var awsusgovPartition = partition{ SignatureVersions: []string{"v4"}, }, Regions: regions{ + "us-gov-east-1": region{ + Description: "AWS GovCloud (US-East)", + }, "us-gov-west-1": region{ Description: "AWS GovCloud (US)", }, @@ -2885,6 +3969,39 @@ var awsusgovPartition = partition{ Services: services{ "acm": service{ + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "acm-pca": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "api.ecr": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{ + Hostname: "api.ecr.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-west-1": endpoint{ + Hostname: "api.ecr.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "api.sagemaker": service{ + Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, @@ -2892,20 +4009,48 @@ var awsusgovPartition = partition{ "apigateway": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "application-autoscaling": service{ + Defaults: endpoint{ + Hostname: "autoscaling.{region}.amazonaws.com", + CredentialScope: credentialScope{ + Service: "application-autoscaling", + }, + }, + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "athena": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "autoscaling": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ Protocols: []string{"http", "https"}, }, }, }, + "clouddirectory": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "cloudformation": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -2922,23 +4067,67 @@ var awsusgovPartition = partition{ }, }, Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "cloudtrail": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "codebuild": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "codecommit": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "codedeploy": service{ + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-east-1-fips": endpoint{ + Hostname: "codedeploy-fips.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "codedeploy-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "comprehend": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, }, "config": service{ + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "datasync": service{ + Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, @@ -2946,18 +4135,34 @@ var awsusgovPartition = partition{ "directconnect": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "dms": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "ds": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "dynamodb": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-east-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -2970,6 +4175,7 @@ var awsusgovPartition = partition{ "ec2": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -2984,15 +4190,10 @@ var awsusgovPartition = partition{ }, }, }, - "ecr": service{ - - Endpoints: endpoints{ - "us-gov-west-1": endpoint{}, - }, - }, "ecs": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3005,11 +4206,19 @@ var awsusgovPartition = partition{ Region: "us-gov-west-1", }, }, + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "elasticbeanstalk": service{ + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "elasticfilesystem": service{ + Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, @@ -3017,6 +4226,7 @@ var awsusgovPartition = partition{ "elasticloadbalancing": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ Protocols: []string{"http", "https"}, }, @@ -3025,6 +4235,7 @@ var awsusgovPartition = partition{ "elasticmapreduce": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ Protocols: []string{"https"}, }, @@ -3033,23 +4244,55 @@ var awsusgovPartition = partition{ "es": service{ Endpoints: endpoints{ + "fips": endpoint{ + Hostname: "es-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "events": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "firehose": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "glacier": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ Protocols: []string{"http", "https"}, }, }, }, + "glue": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "guardduty": service{ + IsRegionalized: boxedTrue, + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "iam": service{ PartitionEndpoint: "aws-us-gov-global", IsRegionalized: boxedFalse, @@ -3066,6 +4309,7 @@ var awsusgovPartition = partition{ "inspector": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3082,23 +4326,46 @@ var awsusgovPartition = partition{ "kinesis": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "kms": service{ Endpoints: endpoints{ + "ProdFips": endpoint{ + Hostname: "kms-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "lambda": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "license-manager": service{ + + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "logs": service{ + Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-west-1": endpoint{}, + }, + }, + "mediaconvert": service{ + Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, @@ -3116,9 +4383,23 @@ var awsusgovPartition = partition{ "monitoring": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, + "organizations": service{ + PartitionEndpoint: "aws-us-gov-global", + IsRegionalized: boxedFalse, + + Endpoints: endpoints{ + "aws-us-gov-global": endpoint{ + Hostname: "organizations.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, "polly": service{ Endpoints: endpoints{ @@ -3128,12 +4409,14 @@ var awsusgovPartition = partition{ "rds": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "redshift": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3143,6 +4426,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "runtime.sagemaker": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "s3": service{ Defaults: endpoint{ SignatureVersions: []string{"s3", "s3v4"}, @@ -3154,27 +4443,92 @@ var awsusgovPartition = partition{ Region: "us-gov-west-1", }, }, + "us-gov-east-1": endpoint{ + Hostname: "s3.us-gov-east-1.amazonaws.com", + Protocols: []string{"http", "https"}, + }, "us-gov-west-1": endpoint{ Hostname: "s3.us-gov-west-1.amazonaws.com", Protocols: []string{"http", "https"}, }, }, }, + "s3-control": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + SignatureVersions: []string{"s3v4"}, + }, + Endpoints: endpoints{ + "us-gov-east-1": endpoint{ + Hostname: "s3-control.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-east-1-fips": endpoint{ + Hostname: "s3-control-fips.us-gov-east-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, + "us-gov-west-1": endpoint{ + Hostname: "s3-control.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + "us-gov-west-1-fips": endpoint{ + Hostname: "s3-control-fips.us-gov-west-1.amazonaws.com", + SignatureVersions: []string{"s3v4"}, + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "secretsmanager": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "secretsmanager-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "serverlessrepo": service{ + Defaults: endpoint{ + Protocols: []string{"https"}, + }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{ + Protocols: []string{"https"}, + }, + }, + }, "sms": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "snowball": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "sns": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ Protocols: []string{"http", "https"}, }, @@ -3183,6 +4537,7 @@ var awsusgovPartition = partition{ "sqs": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{ SSLCommonName: "{region}.queue.{dnsSuffix}", Protocols: []string{"http", "https"}, @@ -3192,12 +4547,14 @@ var awsusgovPartition = partition{ "ssm": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "states": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3214,6 +4571,13 @@ var awsusgovPartition = partition{ }, }, Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, + "us-gov-east-1-fips": endpoint{ + Hostname: "dynamodb.us-gov-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-east-1", + }, + }, "us-gov-west-1": endpoint{}, "us-gov-west-1-fips": endpoint{ Hostname: "dynamodb.us-gov-west-1.amazonaws.com", @@ -3226,18 +4590,21 @@ var awsusgovPartition = partition{ "sts": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "swf": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, "tagging": service{ Endpoints: endpoints{ + "us-gov-east-1": endpoint{}, "us-gov-west-1": endpoint{}, }, }, @@ -3245,6 +4612,24 @@ var awsusgovPartition = partition{ Defaults: endpoint{ Protocols: []string{"https"}, }, + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + "us-gov-west-1-fips": endpoint{ + Hostname: "translate-fips.us-gov-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-gov-west-1", + }, + }, + }, + }, + "waf-regional": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, + "workspaces": service{ + Endpoints: endpoints{ "us-gov-west-1": endpoint{}, }, diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go new file mode 100644 index 00000000..ca8fc828 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/dep_service_ids.go @@ -0,0 +1,141 @@ +package endpoints + +// Service identifiers +// +// Deprecated: Use client package's EndpointsID value instead of these +// ServiceIDs. These IDs are not maintained, and are out of date. +const ( + A4bServiceID = "a4b" // A4b. + AcmServiceID = "acm" // Acm. + AcmPcaServiceID = "acm-pca" // AcmPca. + ApiMediatailorServiceID = "api.mediatailor" // ApiMediatailor. + ApiPricingServiceID = "api.pricing" // ApiPricing. + ApiSagemakerServiceID = "api.sagemaker" // ApiSagemaker. + ApigatewayServiceID = "apigateway" // Apigateway. + ApplicationAutoscalingServiceID = "application-autoscaling" // ApplicationAutoscaling. + Appstream2ServiceID = "appstream2" // Appstream2. + AppsyncServiceID = "appsync" // Appsync. + AthenaServiceID = "athena" // Athena. + AutoscalingServiceID = "autoscaling" // Autoscaling. + AutoscalingPlansServiceID = "autoscaling-plans" // AutoscalingPlans. + BatchServiceID = "batch" // Batch. + BudgetsServiceID = "budgets" // Budgets. + CeServiceID = "ce" // Ce. + ChimeServiceID = "chime" // Chime. + Cloud9ServiceID = "cloud9" // Cloud9. + 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. + ComprehendServiceID = "comprehend" // Comprehend. + 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. + FmsServiceID = "fms" // Fms. + GameliftServiceID = "gamelift" // Gamelift. + GlacierServiceID = "glacier" // Glacier. + GlueServiceID = "glue" // Glue. + GreengrassServiceID = "greengrass" // Greengrass. + GuarddutyServiceID = "guardduty" // Guardduty. + HealthServiceID = "health" // Health. + IamServiceID = "iam" // Iam. + ImportexportServiceID = "importexport" // Importexport. + InspectorServiceID = "inspector" // Inspector. + IotServiceID = "iot" // Iot. + IotanalyticsServiceID = "iotanalytics" // Iotanalytics. + KinesisServiceID = "kinesis" // Kinesis. + KinesisanalyticsServiceID = "kinesisanalytics" // Kinesisanalytics. + KinesisvideoServiceID = "kinesisvideo" // Kinesisvideo. + KmsServiceID = "kms" // Kms. + LambdaServiceID = "lambda" // Lambda. + LightsailServiceID = "lightsail" // Lightsail. + LogsServiceID = "logs" // Logs. + MachinelearningServiceID = "machinelearning" // Machinelearning. + MarketplacecommerceanalyticsServiceID = "marketplacecommerceanalytics" // Marketplacecommerceanalytics. + MediaconvertServiceID = "mediaconvert" // Mediaconvert. + MedialiveServiceID = "medialive" // Medialive. + MediapackageServiceID = "mediapackage" // Mediapackage. + MediastoreServiceID = "mediastore" // Mediastore. + MeteringMarketplaceServiceID = "metering.marketplace" // MeteringMarketplace. + MghServiceID = "mgh" // Mgh. + MobileanalyticsServiceID = "mobileanalytics" // Mobileanalytics. + ModelsLexServiceID = "models.lex" // ModelsLex. + MonitoringServiceID = "monitoring" // Monitoring. + MturkRequesterServiceID = "mturk-requester" // MturkRequester. + NeptuneServiceID = "neptune" // Neptune. + 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. + ResourceGroupsServiceID = "resource-groups" // ResourceGroups. + Route53ServiceID = "route53" // Route53. + Route53domainsServiceID = "route53domains" // Route53domains. + RuntimeLexServiceID = "runtime.lex" // RuntimeLex. + RuntimeSagemakerServiceID = "runtime.sagemaker" // RuntimeSagemaker. + S3ServiceID = "s3" // S3. + S3ControlServiceID = "s3-control" // S3Control. + SagemakerServiceID = "api.sagemaker" // Sagemaker. + SdbServiceID = "sdb" // Sdb. + SecretsmanagerServiceID = "secretsmanager" // Secretsmanager. + ServerlessrepoServiceID = "serverlessrepo" // Serverlessrepo. + ServicecatalogServiceID = "servicecatalog" // Servicecatalog. + ServicediscoveryServiceID = "servicediscovery" // Servicediscovery. + 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. + TransferServiceID = "transfer" // Transfer. + TranslateServiceID = "translate" // Translate. + WafServiceID = "waf" // Waf. + WafRegionalServiceID = "waf-regional" // WafRegional. + WorkdocsServiceID = "workdocs" // Workdocs. + WorkmailServiceID = "workmail" // Workmail. + WorkspacesServiceID = "workspaces" // Workspaces. + XrayServiceID = "xray" // Xray. +) 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 index e29c0951..f82babf6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/endpoints.go @@ -35,7 +35,7 @@ type Options struct { // // 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 + // endpoint ID with. If both the service and region are unknown 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 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 index 05e92df2..0fdfcc56 100644 --- 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 @@ -16,6 +16,10 @@ import ( type CodeGenOptions struct { // Options for how the model will be decoded. DecodeModelOptions DecodeModelOptions + + // Disables code generation of the service endpoint prefix IDs defined in + // the model. + DisableGenerateServiceIDs bool } // Set combines all of the option functions together @@ -39,8 +43,16 @@ func CodeGenModel(modelFile io.Reader, outFile io.Writer, optFns ...func(*CodeGe return err } + v := struct { + Resolver + CodeGenOptions + }{ + Resolver: resolver, + CodeGenOptions: opts, + } + tmpl := template.Must(template.New("tmpl").Funcs(funcMap).Parse(v3Tmpl)) - if err := tmpl.ExecuteTemplate(outFile, "defaults", resolver); err != nil { + if err := tmpl.ExecuteTemplate(outFile, "defaults", v); err != nil { return fmt.Errorf("failed to execute template, %v", err) } @@ -166,15 +178,17 @@ import ( "regexp" ) - {{ template "partition consts" . }} + {{ template "partition consts" $.Resolver }} - {{ range $_, $partition := . }} + {{ range $_, $partition := $.Resolver }} {{ template "partition region consts" $partition }} {{ end }} - {{ template "service consts" . }} + {{ if not $.DisableGenerateServiceIDs -}} + {{ template "service consts" $.Resolver }} + {{- end }} - {{ template "endpoint resolvers" . }} + {{ template "endpoint resolvers" $.Resolver }} {{- end }} {{ define "partition consts" }} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/errors.go b/vendor/github.com/aws/aws-sdk-go/aws/errors.go index 57663616..fa06f7a8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/errors.go @@ -5,13 +5,9 @@ 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/request/connection_reset_error.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error.go index 271da432..d9b37f4d 100644 --- 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 @@ -1,18 +1,17 @@ -// +build !appengine,!plan9 - package request import ( - "net" - "os" - "syscall" + "strings" ) 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 - } + if strings.Contains(err.Error(), "read: connection reset") { + return false + } + + if strings.Contains(err.Error(), "connection reset") || + strings.Contains(err.Error(), "broken pipe") { + return true } return false diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go b/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go deleted file mode 100644 index daf9eca4..00000000 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/connection_reset_error_other.go +++ /dev/null @@ -1,11 +0,0 @@ -// +build appengine plan9 - -package request - -import ( - "strings" -) - -func isErrConnectionReset(err error) bool { - return strings.Contains(err.Error(), "connection reset") -} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 605a72d3..627ec722 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -19,6 +19,7 @@ type Handlers struct { UnmarshalError HandlerList Retry HandlerList AfterRetry HandlerList + CompleteAttempt HandlerList Complete HandlerList } @@ -36,6 +37,7 @@ func (h *Handlers) Copy() Handlers { UnmarshalMeta: h.UnmarshalMeta.copy(), Retry: h.Retry.copy(), AfterRetry: h.AfterRetry.copy(), + CompleteAttempt: h.CompleteAttempt.copy(), Complete: h.Complete.copy(), } } @@ -53,9 +55,55 @@ func (h *Handlers) Clear() { h.ValidateResponse.Clear() h.Retry.Clear() h.AfterRetry.Clear() + h.CompleteAttempt.Clear() h.Complete.Clear() } +// IsEmpty returns if there are no handlers in any of the handlerlists. +func (h *Handlers) IsEmpty() bool { + if h.Validate.Len() != 0 { + return false + } + if h.Build.Len() != 0 { + return false + } + if h.Send.Len() != 0 { + return false + } + if h.Sign.Len() != 0 { + return false + } + if h.Unmarshal.Len() != 0 { + return false + } + if h.UnmarshalStream.Len() != 0 { + return false + } + if h.UnmarshalMeta.Len() != 0 { + return false + } + if h.UnmarshalError.Len() != 0 { + return false + } + if h.ValidateResponse.Len() != 0 { + return false + } + if h.Retry.Len() != 0 { + return false + } + if h.AfterRetry.Len() != 0 { + return false + } + if h.CompleteAttempt.Len() != 0 { + return false + } + if h.Complete.Len() != 0 { + return false + } + + return true +} + // A HandlerListRunItem represents an entry in the HandlerList which // is being run. type HandlerListRunItem struct { 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 index 75f0fe07..0c46b7d2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -4,7 +4,6 @@ import ( "bytes" "fmt" "io" - "net" "net/http" "net/url" "reflect" @@ -122,7 +121,6 @@ func New(cfg aws.Config, clientInfo metadata.ClientInfo, handlers Handlers, Handlers: handlers.Copy(), Retryer: retryer, - AttemptTime: time.Now(), Time: time.Now(), ExpireTime: 0, Operation: operation, @@ -233,6 +231,10 @@ func (r *Request) WillRetry() bool { return r.Error != nil && aws.BoolValue(r.Retryable) && r.RetryCount < r.MaxRetries() } +func fmtAttemptCount(retryCount, maxRetries int) string { + return fmt.Sprintf("attempt %v/%v", retryCount, 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. @@ -266,7 +268,9 @@ func (r *Request) SetReaderBody(reader io.ReadSeeker) { } // Presign returns the request's signed URL. Error will be returned -// if the signing fails. +// if the signing fails. The expire parameter is only used for presigned Amazon +// S3 API requests. All other AWS services will use a fixed expiration +// time of 15 minutes. // // 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. @@ -283,7 +287,9 @@ func (r *Request) Presign(expire time.Duration) (string, error) { } // PresignRequest behaves just like presign, with the addition of returning a -// set of headers that were signed. +// set of headers that were signed. The expire parameter is only used for +// presigned Amazon S3 API requests. All other AWS services will use a fixed +// expiration time of 15 minutes. // // 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. @@ -328,16 +334,17 @@ func getPresignedURL(r *Request, expire time.Duration) (string, http.Header, err return r.HTTPRequest.URL.String(), r.SignedHeaderVals, nil } -func debugLogReqError(r *Request, stage string, retrying bool, err error) { +const ( + willRetry = "will retry" + notRetrying = "not retrying" + retryCount = "retry %v/%v" +) + +func debugLogReqError(r *Request, stage, retryStr string, 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)) } @@ -356,12 +363,12 @@ func (r *Request) Build() error { if !r.built { r.Handlers.Validate.Run(r) if r.Error != nil { - debugLogReqError(r, "Validate Request", false, r.Error) + debugLogReqError(r, "Validate Request", notRetrying, r.Error) return r.Error } r.Handlers.Build.Run(r) if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) + debugLogReqError(r, "Build Request", notRetrying, r.Error) return r.Error } r.built = true @@ -377,7 +384,7 @@ func (r *Request) Build() error { func (r *Request) Sign() error { r.Build() if r.Error != nil { - debugLogReqError(r, "Build Request", false, r.Error) + debugLogReqError(r, "Build Request", notRetrying, r.Error) return r.Error } @@ -462,80 +469,84 @@ func (r *Request) Send() error { r.Handlers.Complete.Run(r) }() + if err := r.Error; err != nil { + return err + } + for { + r.Error = nil r.AttemptTime = time.Now() - 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() - } + if err := r.Sign(); err != nil { + debugLogReqError(r, "Sign Request", notRetrying, err) + return err } - 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 + if err := r.sendRequest(); err == nil { + return nil + } else if !shouldRetryCancel(r.Error) { + return err + } else { r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) - if r.Error != nil { - debugLogReqError(r, "Send Request", false, err) + + if r.Error != nil || !aws.BoolValue(r.Retryable) { return r.Error } - debugLogReqError(r, "Send Request", true, err) + + r.prepareRetry() 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 - } +func (r *Request) prepareRetry() { + 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)) + } - 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 - } + // 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() - break + // 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() + } +} + +func (r *Request) sendRequest() (sendErr error) { + defer r.Handlers.CompleteAttempt.Run(r) + + r.Retryable = nil + r.Handlers.Send.Run(r) + if r.Error != nil { + debugLogReqError(r, "Send Request", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) + return r.Error + } + + r.Handlers.UnmarshalMeta.Run(r) + r.Handlers.ValidateResponse.Run(r) + if r.Error != nil { + r.Handlers.UnmarshalError.Run(r) + debugLogReqError(r, "Validate Response", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) + return r.Error + } + + r.Handlers.Unmarshal.Run(r) + if r.Error != nil { + debugLogReqError(r, "Unmarshal Response", + fmtAttemptCount(r.RetryCount, r.MaxRetries()), + r.Error) + return r.Error } return nil @@ -561,30 +572,46 @@ func AddToUserAgent(r *Request, s string) { 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 { +type temporary interface { + Temporary() bool +} + +func shouldRetryCancel(origErr error) bool { + switch err := origErr.(type) { + case awserr.Error: + if err.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() + return shouldRetryCancel(err.OrigErr()) + case *url.Error: + if strings.Contains(err.Error(), "connection refused") { + // Refused connections should be retried as the service may not yet + // be running on the port. Go TCP dial considers refused + // connections as not temporary. + return true } + // *url.Error only implements Temporary after golang 1.6 but since + // url.Error only wraps the error: + return shouldRetryCancel(err.Err) + case temporary: + // If the error is temporary, we want to allow continuation of the + // retry process + return err.Temporary() || isErrConnectionReset(origErr) + case nil: + // `awserr.Error.OrigErr()` can be nil, meaning there was an error but + // because we don't know the cause, it is marked as retryable. See + // TestRequest4xxUnretryable for an example. + return true + default: + switch err.Error() { + case "net/http: request canceled", + "net/http: request canceled while waiting for connection": + // known 1.5 error case when an http request is cancelled + return false + } + // here we don't know the error; so we allow a retry. + return true } - - // 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 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 index 7d527029..d0aa54c6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -38,8 +38,10 @@ var throttleCodes = map[string]struct{}{ "ThrottlingException": {}, "RequestLimitExceeded": {}, "RequestThrottled": {}, + "RequestThrottledException": {}, "TooManyRequestsException": {}, // Lambda functions "PriorRequestNotComplete": {}, // Route53 + "TransactionInProgressException": {}, } // credsExpiredCodes is a collection of error codes which signify the credentials 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 index 40124622..8630683f 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/validation.go @@ -17,6 +17,12 @@ const ( ParamMinValueErrCode = "ParamMinValueError" // ParamMinLenErrCode is the error code for fields without enough elements. ParamMinLenErrCode = "ParamMinLenError" + // ParamMaxLenErrCode is the error code for value being too long. + ParamMaxLenErrCode = "ParamMaxLenError" + + // ParamFormatErrCode is the error code for a field with invalid + // format or characters. + ParamFormatErrCode = "ParamFormatInvalidError" ) // Validator provides a way for types to perform validation logic on their @@ -232,3 +238,49 @@ func NewErrParamMinLen(field string, min int) *ErrParamMinLen { func (e *ErrParamMinLen) MinLen() int { return e.min } + +// An ErrParamMaxLen represents a maximum length parameter error. +type ErrParamMaxLen struct { + errInvalidParam + max int +} + +// NewErrParamMaxLen creates a new maximum length parameter error. +func NewErrParamMaxLen(field string, max int, value string) *ErrParamMaxLen { + return &ErrParamMaxLen{ + errInvalidParam: errInvalidParam{ + code: ParamMaxLenErrCode, + field: field, + msg: fmt.Sprintf("maximum size of %v, %v", max, value), + }, + max: max, + } +} + +// MaxLen returns the field's required minimum length. +func (e *ErrParamMaxLen) MaxLen() int { + return e.max +} + +// An ErrParamFormat represents a invalid format parameter error. +type ErrParamFormat struct { + errInvalidParam + format string +} + +// NewErrParamFormat creates a new invalid format parameter error. +func NewErrParamFormat(field string, format, value string) *ErrParamFormat { + return &ErrParamFormat{ + errInvalidParam: errInvalidParam{ + code: ParamFormatErrCode, + field: field, + msg: fmt.Sprintf("format %v, %v", format, value), + }, + format: format, + } +} + +// Format returns the field's required format. +func (e *ErrParamFormat) Format() string { + return e.format +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go new file mode 100644 index 00000000..ea9ebb6f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport.go @@ -0,0 +1,26 @@ +// +build go1.7 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &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, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go new file mode 100644 index 00000000..fec39dfc --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_5.go @@ -0,0 +1,22 @@ +// +build !go1.6,go1.5 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go new file mode 100644 index 00000000..1c5a5391 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/cabundle_transport_1_6.go @@ -0,0 +1,23 @@ +// +build !go1.7,go1.6 + +package session + +import ( + "net" + "net/http" + "time" +) + +// Transport that should be used when a custom CA bundle is specified with the +// SDK. +func getCABundleTransport() *http.Transport { + return &http.Transport{ + Proxy: http.ProxyFromEnvironment, + Dial: (&net.Dialer{ + Timeout: 30 * time.Second, + KeepAlive: 30 * time.Second, + }).Dial, + TLSHandshakeTimeout: 10 * time.Second, + ExpectContinueTimeout: 1 * time.Second, + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go new file mode 100644 index 00000000..0c9dcf7c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/credentials.go @@ -0,0 +1,203 @@ +package session + +import ( + "fmt" + "os" + + "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/credentials/processcreds" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" + "github.com/aws/aws-sdk-go/aws/defaults" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/internal/shareddefaults" +) + +// valid credential source values +const ( + credSourceEc2Metadata = "Ec2InstanceMetadata" + credSourceEnvironment = "Environment" + credSourceECSContainer = "EcsContainer" +) + +func resolveCredentials(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (*credentials.Credentials, error) { + // Credentials from Assume Role with specific credentials source. + if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.CredentialSource) > 0 { + return resolveCredsFromSource(cfg, envCfg, sharedCfg, handlers, sessOpts) + } + + // Credentials from environment variables + if len(envCfg.Creds.AccessKeyID) > 0 { + return credentials.NewStaticCredentialsFromCreds(envCfg.Creds), nil + } + + // Fallback to the "default" credential resolution chain. + return resolveCredsFromProfile(cfg, envCfg, sharedCfg, handlers, sessOpts) +} + +func resolveCredsFromProfile(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (*credentials.Credentials, error) { + + if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.RoleARN) > 0 && sharedCfg.AssumeRoleSource != nil { + // Assume IAM role with credentials source from a different profile. + cred, err := resolveCredsFromProfile(cfg, envCfg, *sharedCfg.AssumeRoleSource, handlers, sessOpts) + if err != nil { + return nil, err + } + + cfgCp := *cfg + cfgCp.Credentials = cred + return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) + + } else if len(sharedCfg.Creds.AccessKeyID) > 0 { + // Static Credentials from Shared Config/Credentials file. + return credentials.NewStaticCredentialsFromCreds( + sharedCfg.Creds, + ), nil + + } else if len(sharedCfg.CredentialProcess) > 0 { + // Credential Process credentials from Shared Config/Credentials file. + return processcreds.NewCredentials( + sharedCfg.CredentialProcess, + ), nil + + } else if envCfg.EnableSharedConfig && len(sharedCfg.AssumeRole.CredentialSource) > 0 { + // Assume IAM Role with specific credential source. + return resolveCredsFromSource(cfg, envCfg, sharedCfg, handlers, sessOpts) + } + + // Fallback to default credentials provider, include mock errors + // for the credential chain so user can identify why credentials + // failed to be retrieved. + return 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), + }, + }), nil +} + +func resolveCredsFromSource(cfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) (*credentials.Credentials, error) { + // if both credential_source and source_profile have been set, return an + // error as this is undefined behavior. Only one can be used at a time + // within a profile. + if len(sharedCfg.AssumeRole.SourceProfile) > 0 { + return nil, ErrSharedConfigSourceCollision + } + + cfgCp := *cfg + switch sharedCfg.AssumeRole.CredentialSource { + case credSourceEc2Metadata: + p := defaults.RemoteCredProvider(cfgCp, handlers) + cfgCp.Credentials = credentials.NewCredentials(p) + + case credSourceEnvironment: + cfgCp.Credentials = credentials.NewStaticCredentialsFromCreds(envCfg.Creds) + + case credSourceECSContainer: + if len(os.Getenv(shareddefaults.ECSCredsProviderEnvVar)) == 0 { + return nil, ErrSharedConfigECSContainerEnvVarEmpty + } + + p := defaults.RemoteCredProvider(cfgCp, handlers) + cfgCp.Credentials = credentials.NewCredentials(p) + + default: + return nil, ErrSharedConfigInvalidCredSource + } + + return credsFromAssumeRole(cfgCp, handlers, sharedCfg, sessOpts) +} + +func credsFromAssumeRole(cfg aws.Config, + handlers request.Handlers, + sharedCfg sharedConfig, + sessOpts Options, +) (*credentials.Credentials, error) { + if len(sharedCfg.AssumeRole.MFASerial) > 0 && sessOpts.AssumeRoleTokenProvider == nil { + // AssumeRole Token provider is required if doing Assume Role + // with MFA. + return nil, AssumeRoleTokenProviderNotSetError{} + } + + return stscreds.NewCredentials( + &Session{ + Config: &cfg, + Handlers: handlers.Copy(), + }, + sharedCfg.AssumeRole.RoleARN, + func(opt *stscreds.AssumeRoleProvider) { + opt.RoleSessionName = sharedCfg.AssumeRole.RoleSessionName + opt.Duration = sessOpts.AssumeRoleDuration + + // 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 + } + }, + ), 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 +} 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 index 98d420fd..38a7b05a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/doc.go @@ -99,7 +99,7 @@ handler logs every request and its payload made by a service client: sess.Handlers.Send.PushFront(func(r *request.Request) { // Log every request made and its payload - logger.Println("Request: %s/%s, Payload: %s", + logger.Printf("Request: %s/%s, Payload: %s", r.ClientInfo.ServiceName, r.Operation, r.Params) }) @@ -183,7 +183,7 @@ be returned when creating the session. // from assumed role. svc := s3.New(sess) -To setup assume role outside of a session see the stscrds.AssumeRoleProvider +To setup assume role outside of a session see the stscreds.AssumeRoleProvider documentation. Environment Variables 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 index 82e04d76..e3959b95 100644 --- 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 @@ -4,6 +4,7 @@ import ( "os" "strconv" + "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/defaults" ) @@ -79,7 +80,7 @@ type envConfig struct { // AWS_CONFIG_FILE=$HOME/my_shared_config SharedConfigFile string - // Sets the path to a custom Credentials Authroity (CA) Bundle PEM file + // Sets the path to a custom Credentials Authority (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. @@ -101,6 +102,12 @@ type envConfig struct { CSMEnabled bool CSMPort string CSMClientID string + + enableEndpointDiscovery string + // Enables endpoint discovery via environment variables. + // + // AWS_ENABLE_ENDPOINT_DISCOVERY=true + EnableEndpointDiscovery *bool } var ( @@ -125,6 +132,10 @@ var ( "AWS_SESSION_TOKEN", } + enableEndpointDiscoveryEnvKey = []string{ + "AWS_ENABLE_ENDPOINT_DISCOVERY", + } + regionEnvKeys = []string{ "AWS_REGION", "AWS_DEFAULT_REGION", // Only read if AWS_SDK_LOAD_CONFIG is also set @@ -194,6 +205,12 @@ func envConfigLoad(enableSharedConfig bool) envConfig { setFromEnvVal(&cfg.Region, regionKeys) setFromEnvVal(&cfg.Profile, profileKeys) + // endpoint discovery is in reference to it being enabled. + setFromEnvVal(&cfg.enableEndpointDiscovery, enableEndpointDiscoveryEnvKey) + if len(cfg.enableEndpointDiscovery) > 0 { + cfg.EnableEndpointDiscovery = aws.Bool(cfg.enableEndpointDiscovery != "false") + } + setFromEnvVal(&cfg.SharedCredentialsFile, sharedCredsFileEnvKey) setFromEnvVal(&cfg.SharedConfigFile, sharedConfigFileEnvKey) 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 index 51f30556..84b01f0e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -3,24 +3,40 @@ package session import ( "crypto/tls" "crypto/x509" - "fmt" "io" "io/ioutil" "net/http" "os" + "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/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/csm" "github.com/aws/aws-sdk-go/aws/defaults" "github.com/aws/aws-sdk-go/aws/endpoints" "github.com/aws/aws-sdk-go/aws/request" ) +const ( + // ErrCodeSharedConfig represents an error that occurs in the shared + // configuration logic + ErrCodeSharedConfig = "SharedConfigErr" +) + +// ErrSharedConfigSourceCollision will be returned if a section contains both +// source_profile and credential_source +var ErrSharedConfigSourceCollision = awserr.New(ErrCodeSharedConfig, "only source profile or credential source can be specified, not both", nil) + +// ErrSharedConfigECSContainerEnvVarEmpty will be returned if the environment +// variables are empty and Environment was set as the credential source +var ErrSharedConfigECSContainerEnvVarEmpty = awserr.New(ErrCodeSharedConfig, "EcsContainer was specified as the credential_source, but 'AWS_CONTAINER_CREDENTIALS_RELATIVE_URI' was not set", nil) + +// ErrSharedConfigInvalidCredSource will be returned if an invalid credential source was provided +var ErrSharedConfigInvalidCredSource = awserr.New(ErrCodeSharedConfig, "credential source values must be EcsContainer, Ec2InstanceMetadata, or Environment", nil) + // A Session provides a central location to create service clients from and // store configurations and request handlers for those services. // @@ -191,6 +207,12 @@ type Options struct { // the config enables assume role wit MFA via the mfa_serial field. AssumeRoleTokenProvider func() (string, error) + // When the SDK's shared config is configured to assume a role this option + // may be provided to set the expiry duration of the STS credentials. + // Defaults to 15 minutes if not set as documented in the + // stscreds.AssumeRoleProvider. + AssumeRoleDuration time.Duration + // 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. @@ -205,6 +227,12 @@ type Options struct { // 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 + + // The handlers that the session and all API clients will be created with. + // This must be a complete set of handlers. Use the defaults.Handlers() + // function to initialize this value before changing the handlers to be + // used by the SDK. + Handlers request.Handlers } // NewSessionWithOptions returns a new Session created from SDK defaults, config files, @@ -325,7 +353,11 @@ func enableCSM(handlers *request.Handlers, clientID string, port string, logger func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, error) { cfg := defaults.Config() - handlers := defaults.Handlers() + + handlers := opts.Handlers + if handlers.IsEmpty() { + handlers = defaults.Handlers() + } // Get a merged version of the user provided config to determine if // credentials were. @@ -388,7 +420,10 @@ func loadCustomCABundle(s *Session, bundle io.Reader) error { } } if t == nil { - t = &http.Transport{} + // Nil transport implies `http.DefaultTransport` should be used. Since + // the SDK cannot modify, nor copy the `DefaultTransport` specifying + // the values the next closest behavior. + t = getCABundleTransport() } p, err := loadCertPool(bundle) @@ -421,7 +456,11 @@ func loadCertPool(r io.Reader) (*x509.CertPool, error) { return p, nil } -func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg sharedConfig, handlers request.Handlers, sessOpts Options) error { +func mergeConfigSrcs(cfg, userCfg *aws.Config, + envCfg envConfig, sharedCfg sharedConfig, + handlers request.Handlers, + sessOpts Options, +) error { // Merge in user provided configuration cfg.MergeIn(userCfg) @@ -434,103 +473,27 @@ func mergeConfigSrcs(cfg, userCfg *aws.Config, envCfg envConfig, sharedCfg share } } - // 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), - }, - }) + if cfg.EnableEndpointDiscovery == nil { + if envCfg.EnableEndpointDiscovery != nil { + cfg.WithEndpointDiscovery(*envCfg.EnableEndpointDiscovery) + } else if envCfg.EnableSharedConfig && sharedCfg.EnableEndpointDiscovery != nil { + cfg.WithEndpointDiscovery(*sharedCfg.EnableEndpointDiscovery) } } + // Configure credentials if not already set by the user when creating the + // Session. + if cfg.Credentials == credentials.AnonymousCredentials && userCfg.Credentials == nil { + creds, err := resolveCredentials(cfg, envCfg, sharedCfg, handlers, sessOpts) + if err != nil { + return err + } + cfg.Credentials = creds + } + 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) 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 index 09c8e5bc..e0102363 100644 --- 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 @@ -2,11 +2,11 @@ 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" + + "github.com/aws/aws-sdk-go/internal/ini" ) const ( @@ -16,15 +16,21 @@ const ( 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 + roleArnKey = `role_arn` // group required + sourceProfileKey = `source_profile` // group required (or credential_source) + credentialSourceKey = `credential_source` // group required (or source_profile) + externalIDKey = `external_id` // optional + mfaSerialKey = `mfa_serial` // optional + roleSessionNameKey = `role_session_name` // optional // Additional Config fields regionKey = `region` + // endpoint discovery group + enableEndpointDiscoveryKey = `endpoint_discovery_enabled` // optional + // External Credential Process + credentialProcessKey = `credential_process` + // DefaultSharedConfigProfile is the default profile to be used when // loading configuration from the config files if another profile name // is not provided. @@ -32,11 +38,12 @@ const ( ) type assumeRoleConfig struct { - RoleARN string - SourceProfile string - ExternalID string - MFASerial string - RoleSessionName string + RoleARN string + SourceProfile string + CredentialSource string + ExternalID string + MFASerial string + RoleSessionName string } // sharedConfig represents the configuration fields of the SDK config files. @@ -55,16 +62,25 @@ type sharedConfig struct { AssumeRole assumeRoleConfig AssumeRoleSource *sharedConfig + // An external process to request credentials + CredentialProcess string + // Region is the region the SDK should use for looking up AWS service endpoints // and signing requests. // // region Region string + + // EnableEndpointDiscovery can be enabled in the shared config by setting + // endpoint_discovery_enabled to true + // + // endpoint_discovery_enabled = true + EnableEndpointDiscovery *bool } type sharedConfigFile struct { Filename string - IniData *ini.File + IniData ini.Sections } // loadSharedConfig retrieves the configuration from the list of files @@ -105,19 +121,16 @@ func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { files := make([]sharedConfigFile, 0, len(filenames)) for _, filename := range filenames { - b, err := ioutil.ReadFile(filename) - if err != nil { + sections, err := ini.OpenFile(filename) + if aerr, ok := err.(awserr.Error); ok && aerr.Code() == ini.ErrCodeUnableToReadFile { // Skip files which can't be opened and read for whatever reason continue - } - - f, err := ini.Load(b) - if err != nil { + } else if err != nil { return nil, SharedConfigLoadError{Filename: filename, Err: err} } files = append(files, sharedConfigFile{ - Filename: filename, IniData: f, + Filename: filename, IniData: sections, }) } @@ -127,6 +140,13 @@ func loadSharedConfigIniFiles(filenames []string) ([]sharedConfigFile, error) { func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedConfigFile) error { var assumeRoleSrc sharedConfig + if len(cfg.AssumeRole.CredentialSource) > 0 { + // setAssumeRoleSource is only called when source_profile is found. + // If both source_profile and credential_source are set, then + // ErrSharedConfigSourceCollision will be returned + return ErrSharedConfigSourceCollision + } + // Multiple level assume role chains are not support if cfg.AssumeRole.SourceProfile == origProfile { assumeRoleSrc = *cfg @@ -136,10 +156,20 @@ func (cfg *sharedConfig) setAssumeRoleSource(origProfile string, files []sharedC if err != nil { return err } + + // Chain if profile depends of other profiles + if len(assumeRoleSrc.AssumeRole.SourceProfile) > 0 { + err := assumeRoleSrc.setAssumeRoleSource(cfg.AssumeRole.SourceProfile, files) + if err != nil { + return err + } + } } - if len(assumeRoleSrc.Creds.AccessKeyID) == 0 { - return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} + if cfg.AssumeRole.SourceProfile == origProfile || len(assumeRoleSrc.AssumeRole.SourceProfile) == 0 { + if len(assumeRoleSrc.AssumeRole.CredentialSource) == 0 && len(assumeRoleSrc.Creds.AccessKeyID) == 0 { + return SharedConfigAssumeRoleError{RoleARN: cfg.AssumeRole.RoleARN} + } } cfg.AssumeRoleSource = &assumeRoleSrc @@ -171,45 +201,59 @@ func (cfg *sharedConfig) setFromIniFiles(profile string, files []sharedConfigFil // 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 { + section, ok := file.IniData.GetSection(profile) + if !ok { // 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} + section, ok = file.IniData.GetSection(fmt.Sprintf("profile %s", profile)) + if !ok { + return SharedConfigProfileNotExistsError{Profile: profile, Err: nil} } } // Shared Credentials - akid := section.Key(accessKeyIDKey).String() - secret := section.Key(secretAccessKey).String() + akid := section.String(accessKeyIDKey) + secret := section.String(secretAccessKey) if len(akid) > 0 && len(secret) > 0 { cfg.Creds = credentials.Value{ AccessKeyID: akid, SecretAccessKey: secret, - SessionToken: section.Key(sessionTokenKey).String(), + SessionToken: section.String(sessionTokenKey), 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 { + roleArn := section.String(roleArnKey) + srcProfile := section.String(sourceProfileKey) + credentialSource := section.String(credentialSourceKey) + hasSource := len(srcProfile) > 0 || len(credentialSource) > 0 + if len(roleArn) > 0 && hasSource { cfg.AssumeRole = assumeRoleConfig{ - RoleARN: roleArn, - SourceProfile: srcProfile, - ExternalID: section.Key(externalIDKey).String(), - MFASerial: section.Key(mfaSerialKey).String(), - RoleSessionName: section.Key(roleSessionNameKey).String(), + RoleARN: roleArn, + SourceProfile: srcProfile, + CredentialSource: credentialSource, + ExternalID: section.String(externalIDKey), + MFASerial: section.String(mfaSerialKey), + RoleSessionName: section.String(roleSessionNameKey), } } + // `credential_process` + if credProc := section.String(credentialProcessKey); len(credProc) > 0 { + cfg.CredentialProcess = credProc + } + // Region - if v := section.Key(regionKey).String(); len(v) > 0 { + if v := section.String(regionKey); len(v) > 0 { cfg.Region = v } + // Endpoint discovery + if section.Has(enableEndpointDiscoveryKey) { + v := section.Bool(enableEndpointDiscoveryKey) + cfg.EnableEndpointDiscovery = &v + } + return nil } 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 index 8aa0681d..523db79f 100644 --- 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 @@ -134,6 +134,7 @@ var requiredSignedHeaders = rules{ "X-Amz-Server-Side-Encryption-Customer-Key": struct{}{}, "X-Amz-Server-Side-Encryption-Customer-Key-Md5": struct{}{}, "X-Amz-Storage-Class": struct{}{}, + "X-Amz-Tagging": struct{}{}, "X-Amz-Website-Redirect-Location": struct{}{}, "X-Amz-Content-Sha256": struct{}{}, }, @@ -181,7 +182,7 @@ type Signer struct { // 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 + // Disables 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. @@ -421,7 +422,7 @@ var SignRequestHandler = request.NamedHandler{ // 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) + SignSDKRequestWithCurrentTime(req, time.Now) } // BuildNamedHandler will build a generic handler for signing. @@ -429,12 +430,15 @@ func BuildNamedHandler(name string, opts ...func(*Signer)) request.NamedHandler return request.NamedHandler{ Name: name, Fn: func(req *request.Request) { - signSDKRequestWithCurrTime(req, time.Now, opts...) + SignSDKRequestWithCurrentTime(req, time.Now, opts...) }, } } -func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time, opts ...func(*Signer)) { +// SignSDKRequestWithCurrentTime will sign the SDK's request using the time +// function passed in. Behaves the same as SignSDKRequest with the exception +// the request is signed with the value returned by the current time function. +func SignSDKRequestWithCurrentTime(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 { @@ -470,13 +474,9 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time opt(v4) } - signingTime := req.Time - if !req.LastSignedAt.IsZero() { - signingTime = req.LastSignedAt - } - + curTime := curTimeFn() signedHeaders, err := v4.signWithBody(req.HTTPRequest, req.GetBody(), - name, region, req.ExpireTime, req.ExpireTime > 0, signingTime, + name, region, req.ExpireTime, req.ExpireTime > 0, curTime, ) if err != nil { req.Error = err @@ -485,7 +485,7 @@ func signSDKRequestWithCurrTime(req *request.Request, curTimeFn func() time.Time } req.SignedHeaderVals = signedHeaders - req.LastSignedAt = curTimeFn() + req.LastSignedAt = curTime } const logSignInfoMsg = `DEBUG: Request Signature: @@ -739,14 +739,22 @@ func makeSha256Reader(reader io.ReadSeeker) []byte { start, _ := reader.Seek(0, sdkio.SeekCurrent) defer reader.Seek(start, sdkio.SeekStart) - io.Copy(hash, reader) + // Use CopyN to avoid allocating the 32KB buffer in io.Copy for bodies + // smaller than 32KB. Fall back to io.Copy if we fail to determine the size. + size, err := aws.SeekerLen(reader) + if err != nil { + io.Copy(hash, reader) + } else { + io.CopyN(hash, reader, size) + } + return hash.Sum(nil) } const doubleSpace = " " // stripExcessSpaces will rewrite the passed in slice's string values to not -// contain muliple side-by-side spaces. +// contain multiple side-by-side spaces. func stripExcessSpaces(vals []string) { var j, k, l, m, spaces int for i, str := range vals { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/types.go b/vendor/github.com/aws/aws-sdk-go/aws/types.go index 8b6f2342..45509154 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/types.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/types.go @@ -7,13 +7,18 @@ import ( "github.com/aws/aws-sdk-go/internal/sdkio" ) -// 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. +// ReadSeekCloser wraps a io.Reader returning a ReaderSeekerCloser. Allows the +// SDK to accept an io.Reader that is not also an io.Seeker for unsigned +// streaming payload API operations. // -// Deprecated: Should only be used with io.ReadSeeker. If using for -// S3 PutObject to stream content use s3manager.Uploader instead. +// A ReadSeekCloser wrapping an nonseekable io.Reader used in an API +// operation's input will prevent that operation being retried in the case of +// network errors, and cause operation requests to fail if the operation +// requires payload signing. +// +// Note: If using With S3 PutObject to stream an object upload The SDK's S3 +// Upload manager (s3manager.Uploader) provides support for streaming with the +// ability to retry network errors. func ReadSeekCloser(r io.Reader) ReaderSeekerCloser { return ReaderSeekerCloser{r} } @@ -43,7 +48,8 @@ func IsReaderSeekable(r io.Reader) bool { // 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. +// 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) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index dc9bcabd..83d8b9f7 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.15.23" +const SDKVersion = "1.20.14" diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go new file mode 100644 index 00000000..e83a9988 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ast.go @@ -0,0 +1,120 @@ +package ini + +// ASTKind represents different states in the parse table +// and the type of AST that is being constructed +type ASTKind int + +// ASTKind* is used in the parse table to transition between +// the different states +const ( + ASTKindNone = ASTKind(iota) + ASTKindStart + ASTKindExpr + ASTKindEqualExpr + ASTKindStatement + ASTKindSkipStatement + ASTKindExprStatement + ASTKindSectionStatement + ASTKindNestedSectionStatement + ASTKindCompletedNestedSectionStatement + ASTKindCommentStatement + ASTKindCompletedSectionStatement +) + +func (k ASTKind) String() string { + switch k { + case ASTKindNone: + return "none" + case ASTKindStart: + return "start" + case ASTKindExpr: + return "expr" + case ASTKindStatement: + return "stmt" + case ASTKindSectionStatement: + return "section_stmt" + case ASTKindExprStatement: + return "expr_stmt" + case ASTKindCommentStatement: + return "comment" + case ASTKindNestedSectionStatement: + return "nested_section_stmt" + case ASTKindCompletedSectionStatement: + return "completed_stmt" + case ASTKindSkipStatement: + return "skip" + default: + return "" + } +} + +// AST interface allows us to determine what kind of node we +// are on and casting may not need to be necessary. +// +// The root is always the first node in Children +type AST struct { + Kind ASTKind + Root Token + RootToken bool + Children []AST +} + +func newAST(kind ASTKind, root AST, children ...AST) AST { + return AST{ + Kind: kind, + Children: append([]AST{root}, children...), + } +} + +func newASTWithRootToken(kind ASTKind, root Token, children ...AST) AST { + return AST{ + Kind: kind, + Root: root, + RootToken: true, + Children: children, + } +} + +// AppendChild will append to the list of children an AST has. +func (a *AST) AppendChild(child AST) { + a.Children = append(a.Children, child) +} + +// GetRoot will return the root AST which can be the first entry +// in the children list or a token. +func (a *AST) GetRoot() AST { + if a.RootToken { + return *a + } + + if len(a.Children) == 0 { + return AST{} + } + + return a.Children[0] +} + +// GetChildren will return the current AST's list of children +func (a *AST) GetChildren() []AST { + if len(a.Children) == 0 { + return []AST{} + } + + if a.RootToken { + return a.Children + } + + return a.Children[1:] +} + +// SetChildren will set and override all children of the AST. +func (a *AST) SetChildren(children []AST) { + if a.RootToken { + a.Children = children + } else { + a.Children = append(a.Children[:1], children...) + } +} + +// Start is used to indicate the starting state of the parse table. +var Start = newAST(ASTKindStart, AST{}) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go new file mode 100644 index 00000000..0895d53c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/comma_token.go @@ -0,0 +1,11 @@ +package ini + +var commaRunes = []rune(",") + +func isComma(b rune) bool { + return b == ',' +} + +func newCommaToken() Token { + return newToken(TokenComma, commaRunes, NoneType) +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go new file mode 100644 index 00000000..0b76999b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/comment_token.go @@ -0,0 +1,35 @@ +package ini + +// isComment will return whether or not the next byte(s) is a +// comment. +func isComment(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case ';': + return true + case '#': + return true + } + + return false +} + +// newCommentToken will create a comment token and +// return how many bytes were read. +func newCommentToken(b []rune) (Token, int, error) { + i := 0 + for ; i < len(b); i++ { + if b[i] == '\n' { + break + } + + if len(b)-i > 2 && b[i] == '\r' && b[i+1] == '\n' { + break + } + } + + return newToken(TokenComment, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go new file mode 100644 index 00000000..25ce0fe1 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/doc.go @@ -0,0 +1,29 @@ +// Package ini is an LL(1) parser for configuration files. +// +// Example: +// sections, err := ini.OpenFile("/path/to/file") +// if err != nil { +// panic(err) +// } +// +// profile := "foo" +// section, ok := sections.GetSection(profile) +// if !ok { +// fmt.Printf("section %q could not be found", profile) +// } +// +// Below is the BNF that describes this parser +// Grammar: +// stmt -> value stmt' +// stmt' -> epsilon | op stmt +// value -> number | string | boolean | quoted_string +// +// section -> [ section' +// section' -> value section_close +// section_close -> ] +// +// SkipState will skip (NL WS)+ +// +// comment -> # comment' | ; comment' +// comment' -> epsilon | value +package ini diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go new file mode 100644 index 00000000..04345a54 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/empty_token.go @@ -0,0 +1,4 @@ +package ini + +// emptyToken is used to satisfy the Token interface +var emptyToken = newToken(TokenNone, []rune{}, NoneType) diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go new file mode 100644 index 00000000..91ba2a59 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/expression.go @@ -0,0 +1,24 @@ +package ini + +// newExpression will return an expression AST. +// Expr represents an expression +// +// grammar: +// expr -> string | number +func newExpression(tok Token) AST { + return newASTWithRootToken(ASTKindExpr, tok) +} + +func newEqualExpr(left AST, tok Token) AST { + return newASTWithRootToken(ASTKindEqualExpr, tok, left) +} + +// EqualExprKey will return a LHS value in the equal expr +func EqualExprKey(ast AST) string { + children := ast.GetChildren() + if len(children) == 0 || ast.Kind != ASTKindEqualExpr { + return "" + } + + return string(children[0].Root.Raw()) +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go new file mode 100644 index 00000000..8d462f77 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/fuzz.go @@ -0,0 +1,17 @@ +// +build gofuzz + +package ini + +import ( + "bytes" +) + +func Fuzz(data []byte) int { + b := bytes.NewReader(data) + + if _, err := Parse(b); err != nil { + return 0 + } + + return 1 +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go new file mode 100644 index 00000000..3b0ca7af --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini.go @@ -0,0 +1,51 @@ +package ini + +import ( + "io" + "os" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +// OpenFile takes a path to a given file, and will open and parse +// that file. +func OpenFile(path string) (Sections, error) { + f, err := os.Open(path) + if err != nil { + return Sections{}, awserr.New(ErrCodeUnableToReadFile, "unable to open file", err) + } + defer f.Close() + + return Parse(f) +} + +// Parse will parse the given file using the shared config +// visitor. +func Parse(f io.Reader) (Sections, error) { + tree, err := ParseAST(f) + if err != nil { + return Sections{}, err + } + + v := NewDefaultVisitor() + if err = Walk(tree, v); err != nil { + return Sections{}, err + } + + return v.Sections, nil +} + +// ParseBytes will parse the given bytes and return the parsed sections. +func ParseBytes(b []byte) (Sections, error) { + tree, err := ParseASTBytes(b) + if err != nil { + return Sections{}, err + } + + v := NewDefaultVisitor() + if err = Walk(tree, v); err != nil { + return Sections{}, err + } + + return v.Sections, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go new file mode 100644 index 00000000..582c024a --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_lexer.go @@ -0,0 +1,165 @@ +package ini + +import ( + "bytes" + "io" + "io/ioutil" + + "github.com/aws/aws-sdk-go/aws/awserr" +) + +const ( + // ErrCodeUnableToReadFile is used when a file is failed to be + // opened or read from. + ErrCodeUnableToReadFile = "FailedRead" +) + +// TokenType represents the various different tokens types +type TokenType int + +func (t TokenType) String() string { + switch t { + case TokenNone: + return "none" + case TokenLit: + return "literal" + case TokenSep: + return "sep" + case TokenOp: + return "op" + case TokenWS: + return "ws" + case TokenNL: + return "newline" + case TokenComment: + return "comment" + case TokenComma: + return "comma" + default: + return "" + } +} + +// TokenType enums +const ( + TokenNone = TokenType(iota) + TokenLit + TokenSep + TokenComma + TokenOp + TokenWS + TokenNL + TokenComment +) + +type iniLexer struct{} + +// Tokenize will return a list of tokens during lexical analysis of the +// io.Reader. +func (l *iniLexer) Tokenize(r io.Reader) ([]Token, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, awserr.New(ErrCodeUnableToReadFile, "unable to read file", err) + } + + return l.tokenize(b) +} + +func (l *iniLexer) tokenize(b []byte) ([]Token, error) { + runes := bytes.Runes(b) + var err error + n := 0 + tokenAmount := countTokens(runes) + tokens := make([]Token, tokenAmount) + count := 0 + + for len(runes) > 0 && count < tokenAmount { + switch { + case isWhitespace(runes[0]): + tokens[count], n, err = newWSToken(runes) + case isComma(runes[0]): + tokens[count], n = newCommaToken(), 1 + case isComment(runes): + tokens[count], n, err = newCommentToken(runes) + case isNewline(runes): + tokens[count], n, err = newNewlineToken(runes) + case isSep(runes): + tokens[count], n, err = newSepToken(runes) + case isOp(runes): + tokens[count], n, err = newOpToken(runes) + default: + tokens[count], n, err = newLitToken(runes) + } + + if err != nil { + return nil, err + } + + count++ + + runes = runes[n:] + } + + return tokens[:count], nil +} + +func countTokens(runes []rune) int { + count, n := 0, 0 + var err error + + for len(runes) > 0 { + switch { + case isWhitespace(runes[0]): + _, n, err = newWSToken(runes) + case isComma(runes[0]): + _, n = newCommaToken(), 1 + case isComment(runes): + _, n, err = newCommentToken(runes) + case isNewline(runes): + _, n, err = newNewlineToken(runes) + case isSep(runes): + _, n, err = newSepToken(runes) + case isOp(runes): + _, n, err = newOpToken(runes) + default: + _, n, err = newLitToken(runes) + } + + if err != nil { + return 0 + } + + count++ + runes = runes[n:] + } + + return count + 1 +} + +// Token indicates a metadata about a given value. +type Token struct { + t TokenType + ValueType ValueType + base int + raw []rune +} + +var emptyValue = Value{} + +func newToken(t TokenType, raw []rune, v ValueType) Token { + return Token{ + t: t, + raw: raw, + ValueType: v, + } +} + +// Raw return the raw runes that were consumed +func (tok Token) Raw() []rune { + return tok.raw +} + +// Type returns the token type +func (tok Token) Type() TokenType { + return tok.t +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go new file mode 100644 index 00000000..e56dcee2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ini_parser.go @@ -0,0 +1,349 @@ +package ini + +import ( + "fmt" + "io" +) + +// State enums for the parse table +const ( + InvalidState = iota + // stmt -> value stmt' + StatementState + // stmt' -> MarkComplete | op stmt + StatementPrimeState + // value -> number | string | boolean | quoted_string + ValueState + // section -> [ section' + OpenScopeState + // section' -> value section_close + SectionState + // section_close -> ] + CloseScopeState + // SkipState will skip (NL WS)+ + SkipState + // SkipTokenState will skip any token and push the previous + // state onto the stack. + SkipTokenState + // comment -> # comment' | ; comment' + // comment' -> MarkComplete | value + CommentState + // MarkComplete state will complete statements and move that + // to the completed AST list + MarkCompleteState + // TerminalState signifies that the tokens have been fully parsed + TerminalState +) + +// parseTable is a state machine to dictate the grammar above. +var parseTable = map[ASTKind]map[TokenType]int{ + ASTKindStart: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: TerminalState, + }, + ASTKindCommentStatement: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindExpr: map[TokenType]int{ + TokenOp: StatementPrimeState, + TokenLit: ValueState, + TokenSep: OpenScopeState, + TokenWS: ValueState, + TokenNL: SkipState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindEqualExpr: map[TokenType]int{ + TokenLit: ValueState, + TokenWS: SkipTokenState, + TokenNL: SkipState, + }, + ASTKindStatement: map[TokenType]int{ + TokenLit: SectionState, + TokenSep: CloseScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindExprStatement: map[TokenType]int{ + TokenLit: ValueState, + TokenSep: OpenScopeState, + TokenOp: ValueState, + TokenWS: ValueState, + TokenNL: MarkCompleteState, + TokenComment: CommentState, + TokenNone: TerminalState, + TokenComma: SkipState, + }, + ASTKindSectionStatement: map[TokenType]int{ + TokenLit: SectionState, + TokenOp: SectionState, + TokenSep: CloseScopeState, + TokenWS: SectionState, + TokenNL: SkipTokenState, + }, + ASTKindCompletedSectionStatement: map[TokenType]int{ + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenComment: CommentState, + TokenNone: MarkCompleteState, + }, + ASTKindSkipStatement: map[TokenType]int{ + TokenLit: StatementState, + TokenSep: OpenScopeState, + TokenWS: SkipTokenState, + TokenNL: SkipTokenState, + TokenComment: CommentState, + TokenNone: TerminalState, + }, +} + +// ParseAST will parse input from an io.Reader using +// an LL(1) parser. +func ParseAST(r io.Reader) ([]AST, error) { + lexer := iniLexer{} + tokens, err := lexer.Tokenize(r) + if err != nil { + return []AST{}, err + } + + return parse(tokens) +} + +// ParseASTBytes will parse input from a byte slice using +// an LL(1) parser. +func ParseASTBytes(b []byte) ([]AST, error) { + lexer := iniLexer{} + tokens, err := lexer.tokenize(b) + if err != nil { + return []AST{}, err + } + + return parse(tokens) +} + +func parse(tokens []Token) ([]AST, error) { + start := Start + stack := newParseStack(3, len(tokens)) + + stack.Push(start) + s := newSkipper() + +loop: + for stack.Len() > 0 { + k := stack.Pop() + + var tok Token + if len(tokens) == 0 { + // this occurs when all the tokens have been processed + // but reduction of what's left on the stack needs to + // occur. + tok = emptyToken + } else { + tok = tokens[0] + } + + step := parseTable[k.Kind][tok.Type()] + if s.ShouldSkip(tok) { + // being in a skip state with no tokens will break out of + // the parse loop since there is nothing left to process. + if len(tokens) == 0 { + break loop + } + + step = SkipTokenState + } + + switch step { + case TerminalState: + // Finished parsing. Push what should be the last + // statement to the stack. If there is anything left + // on the stack, an error in parsing has occurred. + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + break loop + case SkipTokenState: + // When skipping a token, the previous state was popped off the stack. + // To maintain the correct state, the previous state will be pushed + // onto the stack. + stack.Push(k) + case StatementState: + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + expr := newExpression(tok) + stack.Push(expr) + case StatementPrimeState: + if tok.Type() != TokenOp { + stack.MarkComplete(k) + continue + } + + if k.Kind != ASTKindExpr { + return nil, NewParseError( + fmt.Sprintf("invalid expression: expected Expr type, but found %T type", k), + ) + } + + k = trimSpaces(k) + expr := newEqualExpr(k, tok) + stack.Push(expr) + case ValueState: + // ValueState requires the previous state to either be an equal expression + // or an expression statement. + // + // This grammar occurs when the RHS is a number, word, or quoted string. + // equal_expr -> lit op equal_expr' + // equal_expr' -> number | string | quoted_string + // quoted_string -> " quoted_string' + // quoted_string' -> string quoted_string_end + // quoted_string_end -> " + // + // otherwise + // expr_stmt -> equal_expr (expr_stmt')* + // expr_stmt' -> ws S | op S | MarkComplete + // S -> equal_expr' expr_stmt' + switch k.Kind { + case ASTKindEqualExpr: + // assiging a value to some key + k.AppendChild(newExpression(tok)) + stack.Push(newExprStatement(k)) + case ASTKindExpr: + k.Root.raw = append(k.Root.raw, tok.Raw()...) + stack.Push(k) + case ASTKindExprStatement: + root := k.GetRoot() + children := root.GetChildren() + if len(children) == 0 { + return nil, NewParseError( + fmt.Sprintf("invalid expression: AST contains no children %s", k.Kind), + ) + } + + rhs := children[len(children)-1] + + if rhs.Root.ValueType != QuotedStringType { + rhs.Root.ValueType = StringType + rhs.Root.raw = append(rhs.Root.raw, tok.Raw()...) + + } + + children[len(children)-1] = rhs + k.SetChildren(children) + + stack.Push(k) + } + case OpenScopeState: + if !runeCompare(tok.Raw(), openBrace) { + return nil, NewParseError("expected '['") + } + + stmt := newStatement() + stack.Push(stmt) + case CloseScopeState: + if !runeCompare(tok.Raw(), closeBrace) { + return nil, NewParseError("expected ']'") + } + + k = trimSpaces(k) + stack.Push(newCompletedSectionStatement(k)) + case SectionState: + var stmt AST + + switch k.Kind { + case ASTKindStatement: + // If there are multiple literals inside of a scope declaration, + // then the current token's raw value will be appended to the Name. + // + // This handles cases like [ profile default ] + // + // k will represent a SectionStatement with the children representing + // the label of the section + stmt = newSectionStatement(tok) + case ASTKindSectionStatement: + k.Root.raw = append(k.Root.raw, tok.Raw()...) + stmt = k + default: + return nil, NewParseError( + fmt.Sprintf("invalid statement: expected statement: %v", k.Kind), + ) + } + + stack.Push(stmt) + case MarkCompleteState: + if k.Kind != ASTKindStart { + stack.MarkComplete(k) + } + + if stack.Len() == 0 { + stack.Push(start) + } + case SkipState: + stack.Push(newSkipStatement(k)) + s.Skip() + case CommentState: + if k.Kind == ASTKindStart { + stack.Push(k) + } else { + stack.MarkComplete(k) + } + + stmt := newCommentStatement(tok) + stack.Push(stmt) + default: + return nil, NewParseError( + fmt.Sprintf("invalid state with ASTKind %v and TokenType %v", + k, tok.Type())) + } + + if len(tokens) > 0 { + tokens = tokens[1:] + } + } + + // this occurs when a statement has not been completed + if stack.top > 1 { + return nil, NewParseError(fmt.Sprintf("incomplete ini expression")) + } + + // returns a sublist which excludes the start symbol + return stack.List(), nil +} + +// trimSpaces will trim spaces on the left and right hand side of +// the literal. +func trimSpaces(k AST) AST { + // trim left hand side of spaces + for i := 0; i < len(k.Root.raw); i++ { + if !isWhitespace(k.Root.raw[i]) { + break + } + + k.Root.raw = k.Root.raw[1:] + i-- + } + + // trim right hand side of spaces + for i := len(k.Root.raw) - 1; i >= 0; i-- { + if !isWhitespace(k.Root.raw[i]) { + break + } + + k.Root.raw = k.Root.raw[:len(k.Root.raw)-1] + } + + return k +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go new file mode 100644 index 00000000..24df543d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/literal_tokens.go @@ -0,0 +1,324 @@ +package ini + +import ( + "fmt" + "strconv" + "strings" +) + +var ( + runesTrue = []rune("true") + runesFalse = []rune("false") +) + +var literalValues = [][]rune{ + runesTrue, + runesFalse, +} + +func isBoolValue(b []rune) bool { + for _, lv := range literalValues { + if isLitValue(lv, b) { + return true + } + } + return false +} + +func isLitValue(want, have []rune) bool { + if len(have) < len(want) { + return false + } + + for i := 0; i < len(want); i++ { + if want[i] != have[i] { + return false + } + } + + return true +} + +// isNumberValue will return whether not the leading characters in +// a byte slice is a number. A number is delimited by whitespace or +// the newline token. +// +// A number is defined to be in a binary, octal, decimal (int | float), hex format, +// or in scientific notation. +func isNumberValue(b []rune) bool { + negativeIndex := 0 + helper := numberHelper{} + needDigit := false + + for i := 0; i < len(b); i++ { + negativeIndex++ + + switch b[i] { + case '-': + if helper.IsNegative() || negativeIndex != 1 { + return false + } + helper.Determine(b[i]) + needDigit = true + continue + case 'e', 'E': + if err := helper.Determine(b[i]); err != nil { + return false + } + negativeIndex = 0 + needDigit = true + continue + case 'b': + if helper.numberFormat == hex { + break + } + fallthrough + case 'o', 'x': + needDigit = true + if i == 0 { + return false + } + + fallthrough + case '.': + if err := helper.Determine(b[i]); err != nil { + return false + } + needDigit = true + continue + } + + if i > 0 && (isNewline(b[i:]) || isWhitespace(b[i])) { + return !needDigit + } + + if !helper.CorrectByte(b[i]) { + return false + } + needDigit = false + } + + return !needDigit +} + +func isValid(b []rune) (bool, int, error) { + if len(b) == 0 { + // TODO: should probably return an error + return false, 0, nil + } + + return isValidRune(b[0]), 1, nil +} + +func isValidRune(r rune) bool { + return r != ':' && r != '=' && r != '[' && r != ']' && r != ' ' && r != '\n' +} + +// ValueType is an enum that will signify what type +// the Value is +type ValueType int + +func (v ValueType) String() string { + switch v { + case NoneType: + return "NONE" + case DecimalType: + return "FLOAT" + case IntegerType: + return "INT" + case StringType: + return "STRING" + case BoolType: + return "BOOL" + } + + return "" +} + +// ValueType enums +const ( + NoneType = ValueType(iota) + DecimalType + IntegerType + StringType + QuotedStringType + BoolType +) + +// Value is a union container +type Value struct { + Type ValueType + raw []rune + + integer int64 + decimal float64 + boolean bool + str string +} + +func newValue(t ValueType, base int, raw []rune) (Value, error) { + v := Value{ + Type: t, + raw: raw, + } + var err error + + switch t { + case DecimalType: + v.decimal, err = strconv.ParseFloat(string(raw), 64) + case IntegerType: + if base != 10 { + raw = raw[2:] + } + + v.integer, err = strconv.ParseInt(string(raw), base, 64) + case StringType: + v.str = string(raw) + case QuotedStringType: + v.str = string(raw[1 : len(raw)-1]) + case BoolType: + v.boolean = runeCompare(v.raw, runesTrue) + } + + // issue 2253 + // + // if the value trying to be parsed is too large, then we will use + // the 'StringType' and raw value instead. + if nerr, ok := err.(*strconv.NumError); ok && nerr.Err == strconv.ErrRange { + v.Type = StringType + v.str = string(raw) + err = nil + } + + return v, err +} + +// Append will append values and change the type to a string +// type. +func (v *Value) Append(tok Token) { + r := tok.Raw() + if v.Type != QuotedStringType { + v.Type = StringType + r = tok.raw[1 : len(tok.raw)-1] + } + if tok.Type() != TokenLit { + v.raw = append(v.raw, tok.Raw()...) + } else { + v.raw = append(v.raw, r...) + } +} + +func (v Value) String() string { + switch v.Type { + case DecimalType: + return fmt.Sprintf("decimal: %f", v.decimal) + case IntegerType: + return fmt.Sprintf("integer: %d", v.integer) + case StringType: + return fmt.Sprintf("string: %s", string(v.raw)) + case QuotedStringType: + return fmt.Sprintf("quoted string: %s", string(v.raw)) + case BoolType: + return fmt.Sprintf("bool: %t", v.boolean) + default: + return "union not set" + } +} + +func newLitToken(b []rune) (Token, int, error) { + n := 0 + var err error + + token := Token{} + if b[0] == '"' { + n, err = getStringValue(b) + if err != nil { + return token, n, err + } + + token = newToken(TokenLit, b[:n], QuotedStringType) + } else if isNumberValue(b) { + var base int + base, n, err = getNumericalValue(b) + if err != nil { + return token, 0, err + } + + value := b[:n] + vType := IntegerType + if contains(value, '.') || hasExponent(value) { + vType = DecimalType + } + token = newToken(TokenLit, value, vType) + token.base = base + } else if isBoolValue(b) { + n, err = getBoolValue(b) + + token = newToken(TokenLit, b[:n], BoolType) + } else { + n, err = getValue(b) + token = newToken(TokenLit, b[:n], StringType) + } + + return token, n, err +} + +// IntValue returns an integer value +func (v Value) IntValue() int64 { + return v.integer +} + +// FloatValue returns a float value +func (v Value) FloatValue() float64 { + return v.decimal +} + +// BoolValue returns a bool value +func (v Value) BoolValue() bool { + return v.boolean +} + +func isTrimmable(r rune) bool { + switch r { + case '\n', ' ': + return true + } + return false +} + +// StringValue returns the string value +func (v Value) StringValue() string { + switch v.Type { + case StringType: + return strings.TrimFunc(string(v.raw), isTrimmable) + case QuotedStringType: + // preserve all characters in the quotes + return string(removeEscapedCharacters(v.raw[1 : len(v.raw)-1])) + default: + return strings.TrimFunc(string(v.raw), isTrimmable) + } +} + +func contains(runes []rune, c rune) bool { + for i := 0; i < len(runes); i++ { + if runes[i] == c { + return true + } + } + + return false +} + +func runeCompare(v1 []rune, v2 []rune) bool { + if len(v1) != len(v2) { + return false + } + + for i := 0; i < len(v1); i++ { + if v1[i] != v2[i] { + return false + } + } + + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go new file mode 100644 index 00000000..e52ac399 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/newline_token.go @@ -0,0 +1,30 @@ +package ini + +func isNewline(b []rune) bool { + if len(b) == 0 { + return false + } + + if b[0] == '\n' { + return true + } + + if len(b) < 2 { + return false + } + + return b[0] == '\r' && b[1] == '\n' +} + +func newNewlineToken(b []rune) (Token, int, error) { + i := 1 + if b[0] == '\r' && isNewline(b[1:]) { + i++ + } + + if !isNewline([]rune(b[:i])) { + return emptyToken, 0, NewParseError("invalid new line token") + } + + return newToken(TokenNL, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go new file mode 100644 index 00000000..a45c0bc5 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/number_helper.go @@ -0,0 +1,152 @@ +package ini + +import ( + "bytes" + "fmt" + "strconv" +) + +const ( + none = numberFormat(iota) + binary + octal + decimal + hex + exponent +) + +type numberFormat int + +// numberHelper is used to dictate what format a number is in +// and what to do for negative values. Since -1e-4 is a valid +// number, we cannot just simply check for duplicate negatives. +type numberHelper struct { + numberFormat numberFormat + + negative bool + negativeExponent bool +} + +func (b numberHelper) Exists() bool { + return b.numberFormat != none +} + +func (b numberHelper) IsNegative() bool { + return b.negative || b.negativeExponent +} + +func (b *numberHelper) Determine(c rune) error { + if b.Exists() { + return NewParseError(fmt.Sprintf("multiple number formats: 0%v", string(c))) + } + + switch c { + case 'b': + b.numberFormat = binary + case 'o': + b.numberFormat = octal + case 'x': + b.numberFormat = hex + case 'e', 'E': + b.numberFormat = exponent + case '-': + if b.numberFormat != exponent { + b.negative = true + } else { + b.negativeExponent = true + } + case '.': + b.numberFormat = decimal + default: + return NewParseError(fmt.Sprintf("invalid number character: %v", string(c))) + } + + return nil +} + +func (b numberHelper) CorrectByte(c rune) bool { + switch { + case b.numberFormat == binary: + if !isBinaryByte(c) { + return false + } + case b.numberFormat == octal: + if !isOctalByte(c) { + return false + } + case b.numberFormat == hex: + if !isHexByte(c) { + return false + } + case b.numberFormat == decimal: + if !isDigit(c) { + return false + } + case b.numberFormat == exponent: + if !isDigit(c) { + return false + } + case b.negativeExponent: + if !isDigit(c) { + return false + } + case b.negative: + if !isDigit(c) { + return false + } + default: + if !isDigit(c) { + return false + } + } + + return true +} + +func (b numberHelper) Base() int { + switch b.numberFormat { + case binary: + return 2 + case octal: + return 8 + case hex: + return 16 + default: + return 10 + } +} + +func (b numberHelper) String() string { + buf := bytes.Buffer{} + i := 0 + + switch b.numberFormat { + case binary: + i++ + buf.WriteString(strconv.Itoa(i) + ": binary format\n") + case octal: + i++ + buf.WriteString(strconv.Itoa(i) + ": octal format\n") + case hex: + i++ + buf.WriteString(strconv.Itoa(i) + ": hex format\n") + case exponent: + i++ + buf.WriteString(strconv.Itoa(i) + ": exponent format\n") + default: + i++ + buf.WriteString(strconv.Itoa(i) + ": integer format\n") + } + + if b.negative { + i++ + buf.WriteString(strconv.Itoa(i) + ": negative format\n") + } + + if b.negativeExponent { + i++ + buf.WriteString(strconv.Itoa(i) + ": negative exponent format\n") + } + + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go new file mode 100644 index 00000000..8a84c7cb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/op_tokens.go @@ -0,0 +1,39 @@ +package ini + +import ( + "fmt" +) + +var ( + equalOp = []rune("=") + equalColonOp = []rune(":") +) + +func isOp(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case '=': + return true + case ':': + return true + default: + return false + } +} + +func newOpToken(b []rune) (Token, int, error) { + tok := Token{} + + switch b[0] { + case '=': + tok = newToken(TokenOp, equalOp, NoneType) + case ':': + tok = newToken(TokenOp, equalColonOp, NoneType) + default: + return tok, 0, NewParseError(fmt.Sprintf("unexpected op type, %v", b[0])) + } + return tok, 1, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go new file mode 100644 index 00000000..45728701 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_error.go @@ -0,0 +1,43 @@ +package ini + +import "fmt" + +const ( + // ErrCodeParseError is returned when a parsing error + // has occurred. + ErrCodeParseError = "INIParseError" +) + +// ParseError is an error which is returned during any part of +// the parsing process. +type ParseError struct { + msg string +} + +// NewParseError will return a new ParseError where message +// is the description of the error. +func NewParseError(message string) *ParseError { + return &ParseError{ + msg: message, + } +} + +// Code will return the ErrCodeParseError +func (err *ParseError) Code() string { + return ErrCodeParseError +} + +// Message returns the error's message +func (err *ParseError) Message() string { + return err.msg +} + +// OrigError return nothing since there will never be any +// original error. +func (err *ParseError) OrigError() error { + return nil +} + +func (err *ParseError) Error() string { + return fmt.Sprintf("%s: %s", err.Code(), err.Message()) +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go new file mode 100644 index 00000000..7f01cf7c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/parse_stack.go @@ -0,0 +1,60 @@ +package ini + +import ( + "bytes" + "fmt" +) + +// ParseStack is a stack that contains a container, the stack portion, +// and the list which is the list of ASTs that have been successfully +// parsed. +type ParseStack struct { + top int + container []AST + list []AST + index int +} + +func newParseStack(sizeContainer, sizeList int) ParseStack { + return ParseStack{ + container: make([]AST, sizeContainer), + list: make([]AST, sizeList), + } +} + +// Pop will return and truncate the last container element. +func (s *ParseStack) Pop() AST { + s.top-- + return s.container[s.top] +} + +// Push will add the new AST to the container +func (s *ParseStack) Push(ast AST) { + s.container[s.top] = ast + s.top++ +} + +// MarkComplete will append the AST to the list of completed statements +func (s *ParseStack) MarkComplete(ast AST) { + s.list[s.index] = ast + s.index++ +} + +// List will return the completed statements +func (s ParseStack) List() []AST { + return s.list[:s.index] +} + +// Len will return the length of the container +func (s *ParseStack) Len() int { + return s.top +} + +func (s ParseStack) String() string { + buf := bytes.Buffer{} + for i, node := range s.list { + buf.WriteString(fmt.Sprintf("%d: %v\n", i+1, node)) + } + + return buf.String() +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go new file mode 100644 index 00000000..f82095ba --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/sep_tokens.go @@ -0,0 +1,41 @@ +package ini + +import ( + "fmt" +) + +var ( + emptyRunes = []rune{} +) + +func isSep(b []rune) bool { + if len(b) == 0 { + return false + } + + switch b[0] { + case '[', ']': + return true + default: + return false + } +} + +var ( + openBrace = []rune("[") + closeBrace = []rune("]") +) + +func newSepToken(b []rune) (Token, int, error) { + tok := Token{} + + switch b[0] { + case '[': + tok = newToken(TokenSep, openBrace, NoneType) + case ']': + tok = newToken(TokenSep, closeBrace, NoneType) + default: + return tok, 0, NewParseError(fmt.Sprintf("unexpected sep type, %v", b[0])) + } + return tok, 1, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go new file mode 100644 index 00000000..6bb69644 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/skipper.go @@ -0,0 +1,45 @@ +package ini + +// skipper is used to skip certain blocks of an ini file. +// Currently skipper is used to skip nested blocks of ini +// files. See example below +// +// [ foo ] +// nested = ; this section will be skipped +// a=b +// c=d +// bar=baz ; this will be included +type skipper struct { + shouldSkip bool + TokenSet bool + prevTok Token +} + +func newSkipper() skipper { + return skipper{ + prevTok: emptyToken, + } +} + +func (s *skipper) ShouldSkip(tok Token) bool { + if s.shouldSkip && + s.prevTok.Type() == TokenNL && + tok.Type() != TokenWS { + + s.Continue() + return false + } + s.prevTok = tok + + return s.shouldSkip +} + +func (s *skipper) Skip() { + s.shouldSkip = true + s.prevTok = emptyToken +} + +func (s *skipper) Continue() { + s.shouldSkip = false + s.prevTok = emptyToken +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go new file mode 100644 index 00000000..18f3fe89 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/statement.go @@ -0,0 +1,35 @@ +package ini + +// Statement is an empty AST mostly used for transitioning states. +func newStatement() AST { + return newAST(ASTKindStatement, AST{}) +} + +// SectionStatement represents a section AST +func newSectionStatement(tok Token) AST { + return newASTWithRootToken(ASTKindSectionStatement, tok) +} + +// ExprStatement represents a completed expression AST +func newExprStatement(ast AST) AST { + return newAST(ASTKindExprStatement, ast) +} + +// CommentStatement represents a comment in the ini definition. +// +// grammar: +// comment -> #comment' | ;comment' +// comment' -> epsilon | value +func newCommentStatement(tok Token) AST { + return newAST(ASTKindCommentStatement, newExpression(tok)) +} + +// CompletedSectionStatement represents a completed section +func newCompletedSectionStatement(ast AST) AST { + return newAST(ASTKindCompletedSectionStatement, ast) +} + +// SkipStatement is used to skip whole statements +func newSkipStatement(ast AST) AST { + return newAST(ASTKindSkipStatement, ast) +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go new file mode 100644 index 00000000..305999d2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/value_util.go @@ -0,0 +1,284 @@ +package ini + +import ( + "fmt" +) + +// getStringValue will return a quoted string and the amount +// of bytes read +// +// an error will be returned if the string is not properly formatted +func getStringValue(b []rune) (int, error) { + if b[0] != '"' { + return 0, NewParseError("strings must start with '\"'") + } + + endQuote := false + i := 1 + + for ; i < len(b) && !endQuote; i++ { + if escaped := isEscaped(b[:i], b[i]); b[i] == '"' && !escaped { + endQuote = true + break + } else if escaped { + /*c, err := getEscapedByte(b[i]) + if err != nil { + return 0, err + } + + b[i-1] = c + b = append(b[:i], b[i+1:]...) + i--*/ + + continue + } + } + + if !endQuote { + return 0, NewParseError("missing '\"' in string value") + } + + return i + 1, nil +} + +// getBoolValue will return a boolean and the amount +// of bytes read +// +// an error will be returned if the boolean is not of a correct +// value +func getBoolValue(b []rune) (int, error) { + if len(b) < 4 { + return 0, NewParseError("invalid boolean value") + } + + n := 0 + for _, lv := range literalValues { + if len(lv) > len(b) { + continue + } + + if isLitValue(lv, b) { + n = len(lv) + } + } + + if n == 0 { + return 0, NewParseError("invalid boolean value") + } + + return n, nil +} + +// getNumericalValue will return a numerical string, the amount +// of bytes read, and the base of the number +// +// an error will be returned if the number is not of a correct +// value +func getNumericalValue(b []rune) (int, int, error) { + if !isDigit(b[0]) { + return 0, 0, NewParseError("invalid digit value") + } + + i := 0 + helper := numberHelper{} + +loop: + for negativeIndex := 0; i < len(b); i++ { + negativeIndex++ + + if !isDigit(b[i]) { + switch b[i] { + case '-': + if helper.IsNegative() || negativeIndex != 1 { + return 0, 0, NewParseError("parse error '-'") + } + + n := getNegativeNumber(b[i:]) + i += (n - 1) + helper.Determine(b[i]) + continue + case '.': + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + case 'e', 'E': + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + + negativeIndex = 0 + case 'b': + if helper.numberFormat == hex { + break + } + fallthrough + case 'o', 'x': + if i == 0 && b[i] != '0' { + return 0, 0, NewParseError("incorrect base format, expected leading '0'") + } + + if i != 1 { + return 0, 0, NewParseError(fmt.Sprintf("incorrect base format found %s at %d index", string(b[i]), i)) + } + + if err := helper.Determine(b[i]); err != nil { + return 0, 0, err + } + default: + if isWhitespace(b[i]) { + break loop + } + + if isNewline(b[i:]) { + break loop + } + + if !(helper.numberFormat == hex && isHexByte(b[i])) { + if i+2 < len(b) && !isNewline(b[i:i+2]) { + return 0, 0, NewParseError("invalid numerical character") + } else if !isNewline([]rune{b[i]}) { + return 0, 0, NewParseError("invalid numerical character") + } + + break loop + } + } + } + } + + return helper.Base(), i, nil +} + +// isDigit will return whether or not something is an integer +func isDigit(b rune) bool { + return b >= '0' && b <= '9' +} + +func hasExponent(v []rune) bool { + return contains(v, 'e') || contains(v, 'E') +} + +func isBinaryByte(b rune) bool { + switch b { + case '0', '1': + return true + default: + return false + } +} + +func isOctalByte(b rune) bool { + switch b { + case '0', '1', '2', '3', '4', '5', '6', '7': + return true + default: + return false + } +} + +func isHexByte(b rune) bool { + if isDigit(b) { + return true + } + return (b >= 'A' && b <= 'F') || + (b >= 'a' && b <= 'f') +} + +func getValue(b []rune) (int, error) { + i := 0 + + for i < len(b) { + if isNewline(b[i:]) { + break + } + + if isOp(b[i:]) { + break + } + + valid, n, err := isValid(b[i:]) + if err != nil { + return 0, err + } + + if !valid { + break + } + + i += n + } + + return i, nil +} + +// getNegativeNumber will return a negative number from a +// byte slice. This will iterate through all characters until +// a non-digit has been found. +func getNegativeNumber(b []rune) int { + if b[0] != '-' { + return 0 + } + + i := 1 + for ; i < len(b); i++ { + if !isDigit(b[i]) { + return i + } + } + + return i +} + +// isEscaped will return whether or not the character is an escaped +// character. +func isEscaped(value []rune, b rune) bool { + if len(value) == 0 { + return false + } + + switch b { + case '\'': // single quote + case '"': // quote + case 'n': // newline + case 't': // tab + case '\\': // backslash + default: + return false + } + + return value[len(value)-1] == '\\' +} + +func getEscapedByte(b rune) (rune, error) { + switch b { + case '\'': // single quote + return '\'', nil + case '"': // quote + return '"', nil + case 'n': // newline + return '\n', nil + case 't': // table + return '\t', nil + case '\\': // backslash + return '\\', nil + default: + return b, NewParseError(fmt.Sprintf("invalid escaped character %c", b)) + } +} + +func removeEscapedCharacters(b []rune) []rune { + for i := 0; i < len(b); i++ { + if isEscaped(b[:i], b[i]) { + c, err := getEscapedByte(b[i]) + if err != nil { + return b + } + + b[i-1] = c + b = append(b[:i], b[i+1:]...) + i-- + } + } + + return b +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go new file mode 100644 index 00000000..94841c32 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/visitor.go @@ -0,0 +1,166 @@ +package ini + +import ( + "fmt" + "sort" +) + +// Visitor is an interface used by walkers that will +// traverse an array of ASTs. +type Visitor interface { + VisitExpr(AST) error + VisitStatement(AST) error +} + +// DefaultVisitor is used to visit statements and expressions +// and ensure that they are both of the correct format. +// In addition, upon visiting this will build sections and populate +// the Sections field which can be used to retrieve profile +// configuration. +type DefaultVisitor struct { + scope string + Sections Sections +} + +// NewDefaultVisitor return a DefaultVisitor +func NewDefaultVisitor() *DefaultVisitor { + return &DefaultVisitor{ + Sections: Sections{ + container: map[string]Section{}, + }, + } +} + +// VisitExpr visits expressions... +func (v *DefaultVisitor) VisitExpr(expr AST) error { + t := v.Sections.container[v.scope] + if t.values == nil { + t.values = values{} + } + + switch expr.Kind { + case ASTKindExprStatement: + opExpr := expr.GetRoot() + switch opExpr.Kind { + case ASTKindEqualExpr: + children := opExpr.GetChildren() + if len(children) <= 1 { + return NewParseError("unexpected token type") + } + + rhs := children[1] + + if rhs.Root.Type() != TokenLit { + return NewParseError("unexpected token type") + } + + key := EqualExprKey(opExpr) + v, err := newValue(rhs.Root.ValueType, rhs.Root.base, rhs.Root.Raw()) + if err != nil { + return err + } + + t.values[key] = v + default: + return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) + } + default: + return NewParseError(fmt.Sprintf("unsupported expression %v", expr)) + } + + v.Sections.container[v.scope] = t + return nil +} + +// VisitStatement visits statements... +func (v *DefaultVisitor) VisitStatement(stmt AST) error { + switch stmt.Kind { + case ASTKindCompletedSectionStatement: + child := stmt.GetRoot() + if child.Kind != ASTKindSectionStatement { + return NewParseError(fmt.Sprintf("unsupported child statement: %T", child)) + } + + name := string(child.Root.Raw()) + v.Sections.container[name] = Section{} + v.scope = name + default: + return NewParseError(fmt.Sprintf("unsupported statement: %s", stmt.Kind)) + } + + return nil +} + +// Sections is a map of Section structures that represent +// a configuration. +type Sections struct { + container map[string]Section +} + +// GetSection will return section p. If section p does not exist, +// false will be returned in the second parameter. +func (t Sections) GetSection(p string) (Section, bool) { + v, ok := t.container[p] + return v, ok +} + +// values represents a map of union values. +type values map[string]Value + +// List will return a list of all sections that were successfully +// parsed. +func (t Sections) List() []string { + keys := make([]string, len(t.container)) + i := 0 + for k := range t.container { + keys[i] = k + i++ + } + + sort.Strings(keys) + return keys +} + +// Section contains a name and values. This represent +// a sectioned entry in a configuration file. +type Section struct { + Name string + values values +} + +// Has will return whether or not an entry exists in a given section +func (t Section) Has(k string) bool { + _, ok := t.values[k] + return ok +} + +// ValueType will returned what type the union is set to. If +// k was not found, the NoneType will be returned. +func (t Section) ValueType(k string) (ValueType, bool) { + v, ok := t.values[k] + return v.Type, ok +} + +// Bool returns a bool value at k +func (t Section) Bool(k string) bool { + return t.values[k].BoolValue() +} + +// Int returns an integer value at k +func (t Section) Int(k string) int64 { + return t.values[k].IntValue() +} + +// Float64 returns a float value at k +func (t Section) Float64(k string) float64 { + return t.values[k].FloatValue() +} + +// String returns the string value at k +func (t Section) String(k string) string { + _, ok := t.values[k] + if !ok { + return "" + } + return t.values[k].StringValue() +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go new file mode 100644 index 00000000..99915f7f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/walker.go @@ -0,0 +1,25 @@ +package ini + +// Walk will traverse the AST using the v, the Visitor. +func Walk(tree []AST, v Visitor) error { + for _, node := range tree { + switch node.Kind { + case ASTKindExpr, + ASTKindExprStatement: + + if err := v.VisitExpr(node); err != nil { + return err + } + case ASTKindStatement, + ASTKindCompletedSectionStatement, + ASTKindNestedSectionStatement, + ASTKindCompletedNestedSectionStatement: + + if err := v.VisitStatement(node); err != nil { + return err + } + } + } + + return nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go b/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go new file mode 100644 index 00000000..7ffb4ae0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/ini/ws_token.go @@ -0,0 +1,24 @@ +package ini + +import ( + "unicode" +) + +// isWhitespace will return whether or not the character is +// a whitespace character. +// +// Whitespace is defined as a space or tab. +func isWhitespace(c rune) bool { + return unicode.IsSpace(c) && c != '\n' && c != '\r' +} + +func newWSToken(b []rune) (Token, int, error) { + i := 0 + for ; i < len(b); i++ { + if !isWhitespace(b[i]) { + break + } + } + + return newToken(TokenWS, b[:i], NoneType), i, nil +} diff --git a/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go new file mode 100644 index 00000000..7da8a49c --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/internal/shareddefaults/ecs_container.go @@ -0,0 +1,12 @@ +package shareddefaults + +const ( + // ECSCredsProviderEnvVar is an environmental variable key used to + // determine which path needs to be hit. + ECSCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI" +) + +// ECSContainerCredentialsURI is the endpoint to retrieve container +// credentials. This can be overridden to test to ensure the credential process +// is behaving correctly. +var ECSContainerCredentialsURI = "http://169.254.170.2" diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go new file mode 100644 index 00000000..d7d42db0 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/host.go @@ -0,0 +1,68 @@ +package protocol + +import ( + "strings" + + "github.com/aws/aws-sdk-go/aws/request" +) + +// ValidateEndpointHostHandler is a request handler that will validate the +// request endpoint's hosts is a valid RFC 3986 host. +var ValidateEndpointHostHandler = request.NamedHandler{ + Name: "awssdk.protocol.ValidateEndpointHostHandler", + Fn: func(r *request.Request) { + err := ValidateEndpointHost(r.Operation.Name, r.HTTPRequest.URL.Host) + if err != nil { + r.Error = err + } + }, +} + +// ValidateEndpointHost validates that the host string passed in is a valid RFC +// 3986 host. Returns error if the host is not valid. +func ValidateEndpointHost(opName, host string) error { + paramErrs := request.ErrInvalidParams{Context: opName} + labels := strings.Split(host, ".") + + for i, label := range labels { + if i == len(labels)-1 && len(label) == 0 { + // Allow trailing dot for FQDN hosts. + continue + } + + if !ValidHostLabel(label) { + paramErrs.Add(request.NewErrParamFormat( + "endpoint host label", "[a-zA-Z0-9-]{1,63}", label)) + } + } + + if len(host) > 255 { + paramErrs.Add(request.NewErrParamMaxLen( + "endpoint host", 255, host, + )) + } + + if paramErrs.Len() > 0 { + return paramErrs + } + return nil +} + +// ValidHostLabel returns if the label is a valid RFC 3986 host label. +func ValidHostLabel(label string) bool { + if l := len(label); l == 0 || l > 63 { + return false + } + for _, r := range label { + switch { + case r >= '0' && r <= '9': + case r >= 'A' && r <= 'Z': + case r >= 'a' && r <= 'z': + case r == '-': + default: + return false + } + } + + return true +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go new file mode 100644 index 00000000..915b0fca --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/host_prefix.go @@ -0,0 +1,54 @@ +package protocol + +import ( + "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" +) + +// HostPrefixHandlerName is the handler name for the host prefix request +// handler. +const HostPrefixHandlerName = "awssdk.endpoint.HostPrefixHandler" + +// NewHostPrefixHandler constructs a build handler +func NewHostPrefixHandler(prefix string, labelsFn func() map[string]string) request.NamedHandler { + builder := HostPrefixBuilder{ + Prefix: prefix, + LabelsFn: labelsFn, + } + + return request.NamedHandler{ + Name: HostPrefixHandlerName, + Fn: builder.Build, + } +} + +// HostPrefixBuilder provides the request handler to expand and prepend +// the host prefix into the operation's request endpoint host. +type HostPrefixBuilder struct { + Prefix string + LabelsFn func() map[string]string +} + +// Build updates the passed in Request with the HostPrefix template expanded. +func (h HostPrefixBuilder) Build(r *request.Request) { + if aws.BoolValue(r.Config.DisableEndpointHostPrefix) { + return + } + + var labels map[string]string + if h.LabelsFn != nil { + labels = h.LabelsFn() + } + + prefix := h.Prefix + for name, value := range labels { + prefix = strings.Replace(prefix, "{"+name+"}", value, -1) + } + + r.HTTPRequest.URL.Host = prefix + r.HTTPRequest.URL.Host + if len(r.HTTPRequest.Host) > 0 { + r.HTTPRequest.Host = prefix + r.HTTPRequest.Host + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go index 2f6628d4..ea0da79a 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/json/jsonutil/unmarshal.go @@ -1,32 +1,47 @@ package jsonutil import ( + "bytes" "encoding/base64" "encoding/json" "fmt" "io" - "io/ioutil" "reflect" "time" "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/private/protocol" ) +// UnmarshalJSONError unmarshal's the reader's JSON document into the passed in +// type. The value to unmarshal the json document into must be a pointer to the +// type. +func UnmarshalJSONError(v interface{}, stream io.Reader) error { + var errBuf bytes.Buffer + body := io.TeeReader(stream, &errBuf) + + err := json.NewDecoder(body).Decode(v) + if err != nil { + msg := "failed decoding error message" + if err == io.EOF { + msg = "error message missing" + err = nil + } + return awserr.NewUnmarshalError(err, msg, errBuf.Bytes()) + } + + return nil +} + // UnmarshalJSON reads a stream and unmarshals the results in object v. func UnmarshalJSON(v interface{}, stream io.Reader) error { var out interface{} - b, err := ioutil.ReadAll(stream) - if err != nil { - return err - } - - if len(b) == 0 { + err := json.NewDecoder(stream).Decode(&out) + if err == io.EOF { return nil - } - - if err := json.Unmarshal(b, &out); err != nil { + } else if err != nil { return err } diff --git a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go index 56af4dc4..bfedc9fd 100644 --- a/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go +++ b/vendor/github.com/aws/aws-sdk-go/private/protocol/jsonrpc/jsonrpc.go @@ -6,8 +6,6 @@ package jsonrpc //go:generate go run -tags codegen ../../../models/protocol_tests/generate.go ../../../models/protocol_tests/output/json.json unmarshal_test.go import ( - "encoding/json" - "io/ioutil" "strings" "github.com/aws/aws-sdk-go/aws/awserr" @@ -37,7 +35,7 @@ func Build(req *request.Request) { if req.ParamsFilled() { buf, err = jsonutil.BuildJSON(req.Params) if err != nil { - req.Error = awserr.New("SerializationError", "failed encoding JSON RPC request", err) + req.Error = awserr.New(request.ErrCodeSerialization, "failed encoding JSON RPC request", err) return } } else { @@ -52,9 +50,12 @@ func Build(req *request.Request) { target := req.ClientInfo.TargetPrefix + "." + req.Operation.Name req.HTTPRequest.Header.Add("X-Amz-Target", target) } - if req.ClientInfo.JSONVersion != "" { + + // Only set the content type if one is not already specified and an + // JSONVersion is specified. + if ct, v := req.HTTPRequest.Header.Get("Content-Type"), req.ClientInfo.JSONVersion; len(ct) == 0 && len(v) != 0 { jsonVersion := req.ClientInfo.JSONVersion - req.HTTPRequest.Header.Add("Content-Type", "application/x-amz-json-"+jsonVersion) + req.HTTPRequest.Header.Set("Content-Type", "application/x-amz-json-"+jsonVersion) } } @@ -64,7 +65,11 @@ func Unmarshal(req *request.Request) { if req.DataFilled() { err := jsonutil.UnmarshalJSON(req.Data, req.HTTPResponse.Body) if err != nil { - req.Error = awserr.New("SerializationError", "failed decoding JSON RPC response", err) + req.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, "failed decoding JSON RPC response", err), + req.HTTPResponse.StatusCode, + req.RequestID, + ) } } return @@ -78,22 +83,16 @@ func UnmarshalMeta(req *request.Request) { // UnmarshalError unmarshals an error response for a JSON RPC service. func UnmarshalError(req *request.Request) { defer req.HTTPResponse.Body.Close() - bodyBytes, err := ioutil.ReadAll(req.HTTPResponse.Body) - if err != nil { - req.Error = awserr.New("SerializationError", "failed reading JSON RPC error response", err) - return - } - if len(bodyBytes) == 0 { - req.Error = awserr.NewRequestFailure( - awserr.New("SerializationError", req.HTTPResponse.Status, nil), - req.HTTPResponse.StatusCode, - "", - ) - return - } + var jsonErr jsonErrorResponse - if err := json.Unmarshal(bodyBytes, &jsonErr); err != nil { - req.Error = awserr.New("SerializationError", "failed decoding JSON RPC error response", err) + err := jsonutil.UnmarshalJSONError(&jsonErr, req.HTTPResponse.Body) + if err != nil { + req.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), + req.HTTPResponse.StatusCode, + req.RequestID, + ) return } 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 index 60e5b09d..0cb99eb5 100644 --- 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 @@ -21,7 +21,7 @@ func Build(r *request.Request) { "Version": {r.ClientInfo.APIVersion}, } if err := queryutil.Parse(body, r.Params, false); err != nil { - r.Error = awserr.New("SerializationError", "failed encoding Query request", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed encoding Query request", err) return } 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 index e0f4d5a5..f69c1efc 100644 --- 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 @@ -23,7 +23,11 @@ func Unmarshal(r *request.Request) { 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) + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, "failed decoding Query response", err), + r.HTTPResponse.StatusCode, + r.RequestID, + ) return } } 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 index f2142961..831b0110 100644 --- 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 @@ -2,65 +2,68 @@ package query import ( "encoding/xml" - "io/ioutil" + "fmt" "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" ) -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} +type xmlErrorResponse struct { + Code string `xml:"Error>Code"` + Message string `xml:"Error>Message"` + RequestID string `xml:"RequestId"` +} + +type xmlResponseError struct { + xmlErrorResponse +} + +func (e *xmlResponseError) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + const svcUnavailableTagName = "ServiceUnavailableException" + const errorResponseTagName = "ErrorResponse" + + switch start.Name.Local { + case svcUnavailableTagName: + e.Code = svcUnavailableTagName + e.Message = "service is unavailable" + return d.Skip() + + case errorResponseTagName: + return d.DecodeElement(&e.xmlErrorResponse, &start) + + default: + return fmt.Errorf("unknown error response tag, %v", start) + } +} + // 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) + var respErr xmlResponseError + err := xmlutil.UnmarshalXMLError(&respErr, 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), + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), 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) + reqID := respErr.RequestID + if len(reqID) == 0 { + reqID = r.RequestID + } + + r.Error = awserr.NewRequestFailure( + awserr.New(respErr.Code, respErr.Message, nil), + r.HTTPResponse.StatusCode, + reqID, + ) } 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 index b34f5258..1301b149 100644 --- 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 @@ -25,6 +25,8 @@ var noEscape [256]bool var errValueNotSet = fmt.Errorf("value not set") +var byteSliceType = reflect.TypeOf([]byte{}) + func init() { for i := 0; i < len(noEscape); i++ { // AWS expects every character except these to be escaped @@ -94,6 +96,14 @@ func buildLocationElements(r *request.Request, v reflect.Value, buildGETQuery bo continue } + // Support the ability to customize values to be marshaled as a + // blob even though they were modeled as a string. Required for S3 + // API operations like SSECustomerKey is modeled as stirng but + // required to be base64 encoded in request. + if field.Tag.Get("marshal-as") == "blob" { + m = m.Convert(byteSliceType) + } + var err error switch field.Tag.Get("location") { case "headers": // header maps @@ -137,7 +147,7 @@ func buildBody(r *request.Request, v reflect.Value) { case string: r.SetStringBody(reader) default: - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to encode REST request", fmt.Errorf("unknown payload type %s", payload.Type())) } @@ -152,9 +162,12 @@ func buildHeader(header *http.Header, v reflect.Value, name string, tag reflect. if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } + name = strings.TrimSpace(name) + str = strings.TrimSpace(str) + header.Add(name, str) return nil @@ -167,11 +180,13 @@ func buildHeaderMap(header *http.Header, v reflect.Value, tag reflect.StructTag) if err == errValueNotSet { continue } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } + keyStr := strings.TrimSpace(key.String()) + str = strings.TrimSpace(str) - header.Add(prefix+key.String(), str) + header.Add(prefix+keyStr, str) } return nil } @@ -181,7 +196,7 @@ func buildURI(u *url.URL, v reflect.Value, name string, tag reflect.StructTag) e if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } u.Path = strings.Replace(u.Path, "{"+name+"}", value, -1) @@ -214,7 +229,7 @@ func buildQueryString(query url.Values, v reflect.Value, name string, tag reflec if err == errValueNotSet { return nil } else if err != nil { - return awserr.New("SerializationError", "failed to encode REST request", err) + return awserr.New(request.ErrCodeSerialization, "failed to encode REST request", err) } query.Set(name, str) } 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 index 33fd53b1..de021367 100644 --- 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 @@ -57,7 +57,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { 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) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) } else { payload.Set(reflect.ValueOf(b)) } @@ -65,7 +65,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { 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) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) } else { str := string(b) payload.Set(reflect.ValueOf(&str)) @@ -77,7 +77,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { case "io.ReadSeeker": b, err := ioutil.ReadAll(r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to read response body", err) return } @@ -85,7 +85,7 @@ func unmarshalBody(r *request.Request, v reflect.Value) { default: io.Copy(ioutil.Discard, r.HTTPResponse.Body) defer r.HTTPResponse.Body.Close() - r.Error = awserr.New("SerializationError", + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", fmt.Errorf("unknown payload type %s", payload.Type())) } @@ -115,14 +115,14 @@ func unmarshalLocationElements(r *request.Request, v reflect.Value) { 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) + r.Error = awserr.New(request.ErrCodeSerialization, "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) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to decode REST response", err) break } } 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 index 7bdf4c85..cf569645 100644 --- 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 @@ -36,7 +36,12 @@ func Build(r *request.Request) { 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) + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to encode rest XML request", err), + r.HTTPResponse.StatusCode, + r.RequestID, + ) return } r.SetBufferBody(buf.Bytes()) @@ -50,7 +55,12 @@ func Unmarshal(r *request.Request) { 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) + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to decode REST XML response", err), + r.HTTPResponse.StatusCode, + r.RequestID, + ) return } } else { 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 index 1bfe45f6..cf981fe9 100644 --- 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 @@ -87,7 +87,7 @@ func (b *xmlBuilder) buildValue(value reflect.Value, current *XMLNode, tag refle } } -// buildStruct adds a struct and its fields to the current XMLNode. All fields any any nested +// buildStruct adds a struct and its fields to the current XMLNode. All fields and any nested // types are converted to XMLNodes also. func (b *xmlBuilder) buildStruct(value reflect.Value, current *XMLNode, tag reflect.StructTag) error { if !value.IsValid() { 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 index ff1ef683..7108d380 100644 --- 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 @@ -1,6 +1,7 @@ package xmlutil import ( + "bytes" "encoding/base64" "encoding/xml" "fmt" @@ -10,9 +11,27 @@ import ( "strings" "time" + "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/private/protocol" ) +// UnmarshalXMLError unmarshals the XML error from the stream into the value +// type specified. The value must be a pointer. If the message fails to +// unmarshal, the message content will be included in the returned error as a +// awserr.UnmarshalError. +func UnmarshalXMLError(v interface{}, stream io.Reader) error { + var errBuf bytes.Buffer + body := io.TeeReader(stream, &errBuf) + + err := xml.NewDecoder(body).Decode(v) + if err != nil && err != io.EOF { + return awserr.NewUnmarshalError(err, + "failed to unmarshal error message", errBuf.Bytes()) + } + + return nil +} + // 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. diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go index 8178113c..5d7c5a33 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go @@ -3,6 +3,7 @@ package lightsail import ( + "fmt" "time" "github.com/aws/aws-sdk-go/aws" @@ -15,7 +16,7 @@ const opAllocateStaticIp = "AllocateStaticIp" // AllocateStaticIpRequest generates a "aws/request.Request" representing the // client's request for the AllocateStaticIp operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -119,7 +120,7 @@ const opAttachDisk = "AttachDisk" // AttachDiskRequest generates a "aws/request.Request" representing the // client's request for the AttachDisk operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -161,6 +162,10 @@ func (c *Lightsail) AttachDiskRequest(input *AttachDiskInput) (req *request.Requ // Attaches a block storage disk to a running or stopped Lightsail instance // and exposes it to the instance with the specified disk name. // +// The attach disk operation supports tag-based access control via resource +// tags applied to the resource identified by diskName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -224,7 +229,7 @@ const opAttachInstancesToLoadBalancer = "AttachInstancesToLoadBalancer" // AttachInstancesToLoadBalancerRequest generates a "aws/request.Request" representing the // client's request for the AttachInstancesToLoadBalancer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -268,6 +273,10 @@ func (c *Lightsail) AttachInstancesToLoadBalancerRequest(input *AttachInstancesT // After some time, the instances are attached to the load balancer and the // health check status is available. // +// The attach instances to load balancer operation supports tag-based access +// control via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -331,7 +340,7 @@ const opAttachLoadBalancerTlsCertificate = "AttachLoadBalancerTlsCertificate" // AttachLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the // client's request for the AttachLoadBalancerTlsCertificate operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -379,6 +388,10 @@ func (c *Lightsail) AttachLoadBalancerTlsCertificateRequest(input *AttachLoadBal // certificate, and it will replace the existing one and become the attached // certificate. // +// The attach load balancer tls certificate operation supports tag-based access +// control via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -442,7 +455,7 @@ const opAttachStaticIp = "AttachStaticIp" // AttachStaticIpRequest generates a "aws/request.Request" representing the // client's request for the AttachStaticIp operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -546,7 +559,7 @@ const opCloseInstancePublicPorts = "CloseInstancePublicPorts" // CloseInstancePublicPortsRequest generates a "aws/request.Request" representing the // client's request for the CloseInstancePublicPorts operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -587,6 +600,10 @@ func (c *Lightsail) CloseInstancePublicPortsRequest(input *CloseInstancePublicPo // // Closes the public ports on a specific Amazon Lightsail instance. // +// The close instance public ports operation supports tag-based access control +// via resource tags applied to the resource identified by instanceName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -645,12 +662,229 @@ func (c *Lightsail) CloseInstancePublicPortsWithContext(ctx aws.Context, input * return out, req.Send() } +const opCopySnapshot = "CopySnapshot" + +// CopySnapshotRequest generates a "aws/request.Request" representing the +// client's request for the CopySnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CopySnapshot for more information on using the CopySnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CopySnapshotRequest method. +// req, resp := client.CopySnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CopySnapshot +func (c *Lightsail) CopySnapshotRequest(input *CopySnapshotInput) (req *request.Request, output *CopySnapshotOutput) { + op := &request.Operation{ + Name: opCopySnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CopySnapshotInput{} + } + + output = &CopySnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// CopySnapshot API operation for Amazon Lightsail. +// +// Copies an instance or disk snapshot from one AWS Region to another in Amazon +// Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation CopySnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CopySnapshot +func (c *Lightsail) CopySnapshot(input *CopySnapshotInput) (*CopySnapshotOutput, error) { + req, out := c.CopySnapshotRequest(input) + return out, req.Send() +} + +// CopySnapshotWithContext is the same as CopySnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CopySnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) CopySnapshotWithContext(ctx aws.Context, input *CopySnapshotInput, opts ...request.Option) (*CopySnapshotOutput, error) { + req, out := c.CopySnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateCloudFormationStack = "CreateCloudFormationStack" + +// CreateCloudFormationStackRequest generates a "aws/request.Request" representing the +// client's request for the CreateCloudFormationStack operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateCloudFormationStack for more information on using the CreateCloudFormationStack +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateCloudFormationStackRequest method. +// req, resp := client.CreateCloudFormationStackRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateCloudFormationStack +func (c *Lightsail) CreateCloudFormationStackRequest(input *CreateCloudFormationStackInput) (req *request.Request, output *CreateCloudFormationStackOutput) { + op := &request.Operation{ + Name: opCreateCloudFormationStack, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateCloudFormationStackInput{} + } + + output = &CreateCloudFormationStackOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateCloudFormationStack API operation for Amazon Lightsail. +// +// Creates an AWS CloudFormation stack, which creates a new Amazon EC2 instance +// from an exported Amazon Lightsail snapshot. This operation results in a CloudFormation +// stack record that can be used to track the AWS CloudFormation stack created. +// Use the get cloud formation stack records operation to get a list of the +// CloudFormation stacks created. +// +// Wait until after your new Amazon EC2 instance is created before running the +// create cloud formation stack operation again with the same export snapshot +// record. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation CreateCloudFormationStack for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateCloudFormationStack +func (c *Lightsail) CreateCloudFormationStack(input *CreateCloudFormationStackInput) (*CreateCloudFormationStackOutput, error) { + req, out := c.CreateCloudFormationStackRequest(input) + return out, req.Send() +} + +// CreateCloudFormationStackWithContext is the same as CreateCloudFormationStack with the addition of +// the ability to pass a context and additional request options. +// +// See CreateCloudFormationStack for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) CreateCloudFormationStackWithContext(ctx aws.Context, input *CreateCloudFormationStackInput, opts ...request.Option) (*CreateCloudFormationStackOutput, error) { + req, out := c.CreateCloudFormationStackRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opCreateDisk = "CreateDisk" // CreateDiskRequest generates a "aws/request.Request" representing the // client's request for the CreateDisk operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -694,6 +928,9 @@ func (c *Lightsail) CreateDiskRequest(input *CreateDiskInput) (req *request.Requ // the regional endpoint that you send the HTTP request to. For more information, // see Regions and Availability Zones in Lightsail (https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail). // +// The create disk operation supports tag-based access control via request tags. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -757,7 +994,7 @@ const opCreateDiskFromSnapshot = "CreateDiskFromSnapshot" // CreateDiskFromSnapshotRequest generates a "aws/request.Request" representing the // client's request for the CreateDiskFromSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -801,6 +1038,10 @@ func (c *Lightsail) CreateDiskFromSnapshotRequest(input *CreateDiskFromSnapshotI // disk is created in the regional endpoint that you send the HTTP request to. // For more information, see Regions and Availability Zones in Lightsail (https://lightsail.aws.amazon.com/ls/docs/overview/article/understanding-regions-and-availability-zones-in-amazon-lightsail). // +// The create disk from snapshot operation supports tag-based access control +// via request tags and resource tags applied to the resource identified by +// diskSnapshotName. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -864,7 +1105,7 @@ const opCreateDiskSnapshot = "CreateDiskSnapshot" // CreateDiskSnapshotRequest generates a "aws/request.Request" representing the // client's request for the CreateDiskSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -918,6 +1159,19 @@ func (c *Lightsail) CreateDiskSnapshotRequest(input *CreateDiskSnapshotInput) (r // snapshot. You may remount and use your disk while the snapshot status is // pending. // +// You can also use this operation to create a snapshot of an instance's system +// volume. You might want to do this, for example, to recover data from the +// system volume of a botched instance or to create a backup of the system volume +// like you would for a block storage disk. To create a snapshot of a system +// volume, just define the instance name parameter when issuing the snapshot +// command, and a snapshot of the defined instance's system volume will be created. +// After the snapshot is available, you can create a block storage disk from +// the snapshot and attach it to a running instance to access the data on the +// disk. +// +// The create disk snapshot operation supports tag-based access control via +// request tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -981,7 +1235,7 @@ const opCreateDomain = "CreateDomain" // CreateDomainRequest generates a "aws/request.Request" representing the // client's request for the CreateDomain operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1022,6 +1276,9 @@ func (c *Lightsail) CreateDomainRequest(input *CreateDomainInput) (req *request. // // Creates a domain resource for the specified domain (e.g., example.com). // +// The create domain operation supports tag-based access control via request +// tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1085,7 +1342,7 @@ const opCreateDomainEntry = "CreateDomainEntry" // CreateDomainEntryRequest generates a "aws/request.Request" representing the // client's request for the CreateDomainEntry operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1124,8 +1381,13 @@ func (c *Lightsail) CreateDomainEntryRequest(input *CreateDomainEntryInput) (req // CreateDomainEntry API operation for Amazon Lightsail. // -// Creates one of the following entry records associated with the domain: A -// record, CNAME record, TXT record, or MX record. +// Creates one of the following entry records associated with the domain: Address +// (A), canonical name (CNAME), mail exchanger (MX), name server (NS), start +// of authority (SOA), service locator (SRV), or text (TXT). +// +// The create domain entry operation supports tag-based access control via resource +// tags applied to the resource identified by domainName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1190,7 +1452,7 @@ const opCreateInstanceSnapshot = "CreateInstanceSnapshot" // CreateInstanceSnapshotRequest generates a "aws/request.Request" representing the // client's request for the CreateInstanceSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1232,6 +1494,9 @@ func (c *Lightsail) CreateInstanceSnapshotRequest(input *CreateInstanceSnapshotI // Creates a snapshot of a specific virtual private server, or instance. You // can use a snapshot to create a new instance that is based on that snapshot. // +// The create instance snapshot operation supports tag-based access control +// via request tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1295,7 +1560,7 @@ const opCreateInstances = "CreateInstances" // CreateInstancesRequest generates a "aws/request.Request" representing the // client's request for the CreateInstances operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1335,6 +1600,14 @@ func (c *Lightsail) CreateInstancesRequest(input *CreateInstancesInput) (req *re // CreateInstances API operation for Amazon Lightsail. // // Creates one or more Amazon Lightsail virtual private servers, or instances. +// Create instances using active blueprints. Inactive blueprints are listed +// to support customers with existing instances but are not necessarily available +// for launch of new instances. Blueprints are marked inactive when they become +// outdated due to operating system updates or new application releases. Use +// the get blueprints operation to return a list of available blueprints. +// +// The create instances operation supports tag-based access control via request +// tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1399,7 +1672,7 @@ const opCreateInstancesFromSnapshot = "CreateInstancesFromSnapshot" // CreateInstancesFromSnapshotRequest generates a "aws/request.Request" representing the // client's request for the CreateInstancesFromSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1441,6 +1714,10 @@ func (c *Lightsail) CreateInstancesFromSnapshotRequest(input *CreateInstancesFro // Uses a specific snapshot as a blueprint for creating one or more new instances // that are based on that identical configuration. // +// The create instances from snapshot operation supports tag-based access control +// via request tags and resource tags applied to the resource identified by +// instanceSnapshotName. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1504,7 +1781,7 @@ const opCreateKeyPair = "CreateKeyPair" // CreateKeyPairRequest generates a "aws/request.Request" representing the // client's request for the CreateKeyPair operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1543,7 +1820,10 @@ func (c *Lightsail) CreateKeyPairRequest(input *CreateKeyPairInput) (req *reques // CreateKeyPair API operation for Amazon Lightsail. // -// Creates sn SSH key pair. +// Creates an SSH key pair. +// +// The create key pair operation supports tag-based access control via request +// tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1608,7 +1888,7 @@ const opCreateLoadBalancer = "CreateLoadBalancer" // CreateLoadBalancerRequest generates a "aws/request.Request" representing the // client's request for the CreateLoadBalancer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1656,6 +1936,9 @@ func (c *Lightsail) CreateLoadBalancerRequest(input *CreateLoadBalancerInput) (r // To change additional load balancer settings, use the UpdateLoadBalancerAttribute // operation. // +// The create load balancer operation supports tag-based access control via +// request tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1719,7 +2002,7 @@ const opCreateLoadBalancerTlsCertificate = "CreateLoadBalancerTlsCertificate" // CreateLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the // client's request for the CreateLoadBalancerTlsCertificate operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1762,6 +2045,10 @@ func (c *Lightsail) CreateLoadBalancerTlsCertificateRequest(input *CreateLoadBal // // TLS is just an updated, more secure version of Secure Socket Layer (SSL). // +// The create load balancer tls certificate operation supports tag-based access +// control via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1820,12 +2107,342 @@ func (c *Lightsail) CreateLoadBalancerTlsCertificateWithContext(ctx aws.Context, return out, req.Send() } +const opCreateRelationalDatabase = "CreateRelationalDatabase" + +// CreateRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the CreateRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateRelationalDatabase for more information on using the CreateRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateRelationalDatabaseRequest method. +// req, resp := client.CreateRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabase +func (c *Lightsail) CreateRelationalDatabaseRequest(input *CreateRelationalDatabaseInput) (req *request.Request, output *CreateRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opCreateRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateRelationalDatabaseInput{} + } + + output = &CreateRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateRelationalDatabase API operation for Amazon Lightsail. +// +// Creates a new database in Amazon Lightsail. +// +// The create relational database operation supports tag-based access control +// via request tags. For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation CreateRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabase +func (c *Lightsail) CreateRelationalDatabase(input *CreateRelationalDatabaseInput) (*CreateRelationalDatabaseOutput, error) { + req, out := c.CreateRelationalDatabaseRequest(input) + return out, req.Send() +} + +// CreateRelationalDatabaseWithContext is the same as CreateRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) CreateRelationalDatabaseWithContext(ctx aws.Context, input *CreateRelationalDatabaseInput, opts ...request.Option) (*CreateRelationalDatabaseOutput, error) { + req, out := c.CreateRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateRelationalDatabaseFromSnapshot = "CreateRelationalDatabaseFromSnapshot" + +// CreateRelationalDatabaseFromSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the CreateRelationalDatabaseFromSnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateRelationalDatabaseFromSnapshot for more information on using the CreateRelationalDatabaseFromSnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateRelationalDatabaseFromSnapshotRequest method. +// req, resp := client.CreateRelationalDatabaseFromSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabaseFromSnapshot +func (c *Lightsail) CreateRelationalDatabaseFromSnapshotRequest(input *CreateRelationalDatabaseFromSnapshotInput) (req *request.Request, output *CreateRelationalDatabaseFromSnapshotOutput) { + op := &request.Operation{ + Name: opCreateRelationalDatabaseFromSnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateRelationalDatabaseFromSnapshotInput{} + } + + output = &CreateRelationalDatabaseFromSnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateRelationalDatabaseFromSnapshot API operation for Amazon Lightsail. +// +// Creates a new database from an existing database snapshot in Amazon Lightsail. +// +// You can create a new database from a snapshot in if something goes wrong +// with your original database, or to change it to a different plan, such as +// a high availability or standard plan. +// +// The create relational database from snapshot operation supports tag-based +// access control via request tags and resource tags applied to the resource +// identified by relationalDatabaseSnapshotName. For more information, see the +// Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation CreateRelationalDatabaseFromSnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabaseFromSnapshot +func (c *Lightsail) CreateRelationalDatabaseFromSnapshot(input *CreateRelationalDatabaseFromSnapshotInput) (*CreateRelationalDatabaseFromSnapshotOutput, error) { + req, out := c.CreateRelationalDatabaseFromSnapshotRequest(input) + return out, req.Send() +} + +// CreateRelationalDatabaseFromSnapshotWithContext is the same as CreateRelationalDatabaseFromSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRelationalDatabaseFromSnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) CreateRelationalDatabaseFromSnapshotWithContext(ctx aws.Context, input *CreateRelationalDatabaseFromSnapshotInput, opts ...request.Option) (*CreateRelationalDatabaseFromSnapshotOutput, error) { + req, out := c.CreateRelationalDatabaseFromSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateRelationalDatabaseSnapshot = "CreateRelationalDatabaseSnapshot" + +// CreateRelationalDatabaseSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the CreateRelationalDatabaseSnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See CreateRelationalDatabaseSnapshot for more information on using the CreateRelationalDatabaseSnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the CreateRelationalDatabaseSnapshotRequest method. +// req, resp := client.CreateRelationalDatabaseSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabaseSnapshot +func (c *Lightsail) CreateRelationalDatabaseSnapshotRequest(input *CreateRelationalDatabaseSnapshotInput) (req *request.Request, output *CreateRelationalDatabaseSnapshotOutput) { + op := &request.Operation{ + Name: opCreateRelationalDatabaseSnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateRelationalDatabaseSnapshotInput{} + } + + output = &CreateRelationalDatabaseSnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateRelationalDatabaseSnapshot API operation for Amazon Lightsail. +// +// Creates a snapshot of your database in Amazon Lightsail. You can use snapshots +// for backups, to make copies of a database, and to save data before deleting +// a database. +// +// The create relational database snapshot operation supports tag-based access +// control via request tags. For more information, see the Lightsail Dev Guide +// (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation CreateRelationalDatabaseSnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/CreateRelationalDatabaseSnapshot +func (c *Lightsail) CreateRelationalDatabaseSnapshot(input *CreateRelationalDatabaseSnapshotInput) (*CreateRelationalDatabaseSnapshotOutput, error) { + req, out := c.CreateRelationalDatabaseSnapshotRequest(input) + return out, req.Send() +} + +// CreateRelationalDatabaseSnapshotWithContext is the same as CreateRelationalDatabaseSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See CreateRelationalDatabaseSnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) CreateRelationalDatabaseSnapshotWithContext(ctx aws.Context, input *CreateRelationalDatabaseSnapshotInput, opts ...request.Option) (*CreateRelationalDatabaseSnapshotOutput, error) { + req, out := c.CreateRelationalDatabaseSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDeleteDisk = "DeleteDisk" // DeleteDiskRequest generates a "aws/request.Request" representing the // client's request for the DeleteDisk operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1869,6 +2486,10 @@ func (c *Lightsail) DeleteDiskRequest(input *DeleteDiskInput) (req *request.Requ // // The disk may remain in the deleting state for several minutes. // +// The delete disk operation supports tag-based access control via resource +// tags applied to the resource identified by diskName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1932,7 +2553,7 @@ const opDeleteDiskSnapshot = "DeleteDiskSnapshot" // DeleteDiskSnapshotRequest generates a "aws/request.Request" representing the // client's request for the DeleteDiskSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1980,6 +2601,10 @@ func (c *Lightsail) DeleteDiskSnapshotRequest(input *DeleteDiskSnapshotInput) (r // snapshots have been deleted, all active snapshots will have access to all // the information needed to restore the disk. // +// The delete disk snapshot operation supports tag-based access control via +// resource tags applied to the resource identified by diskSnapshotName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2043,7 +2668,7 @@ const opDeleteDomain = "DeleteDomain" // DeleteDomainRequest generates a "aws/request.Request" representing the // client's request for the DeleteDomain operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2084,6 +2709,10 @@ func (c *Lightsail) DeleteDomainRequest(input *DeleteDomainInput) (req *request. // // Deletes the specified domain recordset and all of its domain records. // +// The delete domain operation supports tag-based access control via resource +// tags applied to the resource identified by domainName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2147,7 +2776,7 @@ const opDeleteDomainEntry = "DeleteDomainEntry" // DeleteDomainEntryRequest generates a "aws/request.Request" representing the // client's request for the DeleteDomainEntry operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2188,6 +2817,10 @@ func (c *Lightsail) DeleteDomainEntryRequest(input *DeleteDomainEntryInput) (req // // Deletes a specific domain entry. // +// The delete domain entry operation supports tag-based access control via resource +// tags applied to the resource identified by domainName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2251,7 +2884,7 @@ const opDeleteInstance = "DeleteInstance" // DeleteInstanceRequest generates a "aws/request.Request" representing the // client's request for the DeleteInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2292,6 +2925,10 @@ func (c *Lightsail) DeleteInstanceRequest(input *DeleteInstanceInput) (req *requ // // Deletes a specific Amazon Lightsail virtual private server, or instance. // +// The delete instance operation supports tag-based access control via resource +// tags applied to the resource identified by instanceName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2355,7 +2992,7 @@ const opDeleteInstanceSnapshot = "DeleteInstanceSnapshot" // DeleteInstanceSnapshotRequest generates a "aws/request.Request" representing the // client's request for the DeleteInstanceSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2396,6 +3033,10 @@ func (c *Lightsail) DeleteInstanceSnapshotRequest(input *DeleteInstanceSnapshotI // // Deletes a specific snapshot of a virtual private server (or instance). // +// The delete instance snapshot operation supports tag-based access control +// via resource tags applied to the resource identified by instanceSnapshotName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2459,7 +3100,7 @@ const opDeleteKeyPair = "DeleteKeyPair" // DeleteKeyPairRequest generates a "aws/request.Request" representing the // client's request for the DeleteKeyPair operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2500,6 +3141,10 @@ func (c *Lightsail) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *reques // // Deletes a specific SSH key pair. // +// The delete key pair operation supports tag-based access control via resource +// tags applied to the resource identified by keyPairName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2558,12 +3203,124 @@ func (c *Lightsail) DeleteKeyPairWithContext(ctx aws.Context, input *DeleteKeyPa return out, req.Send() } +const opDeleteKnownHostKeys = "DeleteKnownHostKeys" + +// DeleteKnownHostKeysRequest generates a "aws/request.Request" representing the +// client's request for the DeleteKnownHostKeys operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteKnownHostKeys for more information on using the DeleteKnownHostKeys +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteKnownHostKeysRequest method. +// req, resp := client.DeleteKnownHostKeysRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteKnownHostKeys +func (c *Lightsail) DeleteKnownHostKeysRequest(input *DeleteKnownHostKeysInput) (req *request.Request, output *DeleteKnownHostKeysOutput) { + op := &request.Operation{ + Name: opDeleteKnownHostKeys, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteKnownHostKeysInput{} + } + + output = &DeleteKnownHostKeysOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteKnownHostKeys API operation for Amazon Lightsail. +// +// Deletes the known host key or certificate used by the Amazon Lightsail browser-based +// SSH or RDP clients to authenticate an instance. This operation enables the +// Lightsail browser-based SSH or RDP clients to connect to the instance after +// a host key mismatch. +// +// Perform this operation only if you were expecting the host key or certificate +// mismatch or if you are familiar with the new host key or certificate on the +// instance. For more information, see Troubleshooting connection issues when +// using the Amazon Lightsail browser-based SSH or RDP client (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-troubleshooting-browser-based-ssh-rdp-client-connection). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation DeleteKnownHostKeys for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteKnownHostKeys +func (c *Lightsail) DeleteKnownHostKeys(input *DeleteKnownHostKeysInput) (*DeleteKnownHostKeysOutput, error) { + req, out := c.DeleteKnownHostKeysRequest(input) + return out, req.Send() +} + +// DeleteKnownHostKeysWithContext is the same as DeleteKnownHostKeys with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteKnownHostKeys for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) DeleteKnownHostKeysWithContext(ctx aws.Context, input *DeleteKnownHostKeysInput, opts ...request.Option) (*DeleteKnownHostKeysOutput, error) { + req, out := c.DeleteKnownHostKeysRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDeleteLoadBalancer = "DeleteLoadBalancer" // DeleteLoadBalancerRequest generates a "aws/request.Request" representing the // client's request for the DeleteLoadBalancer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2606,6 +3363,10 @@ func (c *Lightsail) DeleteLoadBalancerRequest(input *DeleteLoadBalancerInput) (r // Once the load balancer is deleted, you will need to create a new load balancer, // create a new certificate, and verify domain ownership again. // +// The delete load balancer operation supports tag-based access control via +// resource tags applied to the resource identified by loadBalancerName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2669,7 +3430,7 @@ const opDeleteLoadBalancerTlsCertificate = "DeleteLoadBalancerTlsCertificate" // DeleteLoadBalancerTlsCertificateRequest generates a "aws/request.Request" representing the // client's request for the DeleteLoadBalancerTlsCertificate operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2710,6 +3471,10 @@ func (c *Lightsail) DeleteLoadBalancerTlsCertificateRequest(input *DeleteLoadBal // // Deletes an SSL/TLS certificate associated with a Lightsail load balancer. // +// The delete load balancer tls certificate operation supports tag-based access +// control via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2768,12 +3533,228 @@ func (c *Lightsail) DeleteLoadBalancerTlsCertificateWithContext(ctx aws.Context, return out, req.Send() } +const opDeleteRelationalDatabase = "DeleteRelationalDatabase" + +// DeleteRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteRelationalDatabase for more information on using the DeleteRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteRelationalDatabaseRequest method. +// req, resp := client.DeleteRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteRelationalDatabase +func (c *Lightsail) DeleteRelationalDatabaseRequest(input *DeleteRelationalDatabaseInput) (req *request.Request, output *DeleteRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opDeleteRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRelationalDatabaseInput{} + } + + output = &DeleteRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteRelationalDatabase API operation for Amazon Lightsail. +// +// Deletes a database in Amazon Lightsail. +// +// The delete relational database operation supports tag-based access control +// via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation DeleteRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteRelationalDatabase +func (c *Lightsail) DeleteRelationalDatabase(input *DeleteRelationalDatabaseInput) (*DeleteRelationalDatabaseOutput, error) { + req, out := c.DeleteRelationalDatabaseRequest(input) + return out, req.Send() +} + +// DeleteRelationalDatabaseWithContext is the same as DeleteRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) DeleteRelationalDatabaseWithContext(ctx aws.Context, input *DeleteRelationalDatabaseInput, opts ...request.Option) (*DeleteRelationalDatabaseOutput, error) { + req, out := c.DeleteRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteRelationalDatabaseSnapshot = "DeleteRelationalDatabaseSnapshot" + +// DeleteRelationalDatabaseSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the DeleteRelationalDatabaseSnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See DeleteRelationalDatabaseSnapshot for more information on using the DeleteRelationalDatabaseSnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the DeleteRelationalDatabaseSnapshotRequest method. +// req, resp := client.DeleteRelationalDatabaseSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteRelationalDatabaseSnapshot +func (c *Lightsail) DeleteRelationalDatabaseSnapshotRequest(input *DeleteRelationalDatabaseSnapshotInput) (req *request.Request, output *DeleteRelationalDatabaseSnapshotOutput) { + op := &request.Operation{ + Name: opDeleteRelationalDatabaseSnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteRelationalDatabaseSnapshotInput{} + } + + output = &DeleteRelationalDatabaseSnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteRelationalDatabaseSnapshot API operation for Amazon Lightsail. +// +// Deletes a database snapshot in Amazon Lightsail. +// +// The delete relational database snapshot operation supports tag-based access +// control via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation DeleteRelationalDatabaseSnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/DeleteRelationalDatabaseSnapshot +func (c *Lightsail) DeleteRelationalDatabaseSnapshot(input *DeleteRelationalDatabaseSnapshotInput) (*DeleteRelationalDatabaseSnapshotOutput, error) { + req, out := c.DeleteRelationalDatabaseSnapshotRequest(input) + return out, req.Send() +} + +// DeleteRelationalDatabaseSnapshotWithContext is the same as DeleteRelationalDatabaseSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteRelationalDatabaseSnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) DeleteRelationalDatabaseSnapshotWithContext(ctx aws.Context, input *DeleteRelationalDatabaseSnapshotInput, opts ...request.Option) (*DeleteRelationalDatabaseSnapshotOutput, error) { + req, out := c.DeleteRelationalDatabaseSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opDetachDisk = "DetachDisk" // DetachDiskRequest generates a "aws/request.Request" representing the // client's request for the DetachDisk operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2816,6 +3797,10 @@ func (c *Lightsail) DetachDiskRequest(input *DetachDiskInput) (req *request.Requ // to unmount any file systems on the device within your operating system before // stopping the instance and detaching the disk. // +// The detach disk operation supports tag-based access control via resource +// tags applied to the resource identified by diskName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2879,7 +3864,7 @@ const opDetachInstancesFromLoadBalancer = "DetachInstancesFromLoadBalancer" // DetachInstancesFromLoadBalancerRequest generates a "aws/request.Request" representing the // client's request for the DetachInstancesFromLoadBalancer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2923,6 +3908,10 @@ func (c *Lightsail) DetachInstancesFromLoadBalancerRequest(input *DetachInstance // This operation waits until the instances are no longer needed before they // are detached from the load balancer. // +// The detach instances from load balancer operation supports tag-based access +// control via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2986,7 +3975,7 @@ const opDetachStaticIp = "DetachStaticIp" // DetachStaticIpRequest generates a "aws/request.Request" representing the // client's request for the DetachStaticIp operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3090,7 +4079,7 @@ const opDownloadDefaultKeyPair = "DownloadDefaultKeyPair" // DownloadDefaultKeyPairRequest generates a "aws/request.Request" representing the // client's request for the DownloadDefaultKeyPair operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3189,12 +4178,132 @@ func (c *Lightsail) DownloadDefaultKeyPairWithContext(ctx aws.Context, input *Do return out, req.Send() } +const opExportSnapshot = "ExportSnapshot" + +// ExportSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the ExportSnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See ExportSnapshot for more information on using the ExportSnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the ExportSnapshotRequest method. +// req, resp := client.ExportSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ExportSnapshot +func (c *Lightsail) ExportSnapshotRequest(input *ExportSnapshotInput) (req *request.Request, output *ExportSnapshotOutput) { + op := &request.Operation{ + Name: opExportSnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &ExportSnapshotInput{} + } + + output = &ExportSnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// ExportSnapshot API operation for Amazon Lightsail. +// +// Exports an Amazon Lightsail instance or block storage disk snapshot to Amazon +// Elastic Compute Cloud (Amazon EC2). This operation results in an export snapshot +// record that can be used with the create cloud formation stack operation to +// create new Amazon EC2 instances. +// +// Exported instance snapshots appear in Amazon EC2 as Amazon Machine Images +// (AMIs), and the instance system disk appears as an Amazon Elastic Block Store +// (Amazon EBS) volume. Exported disk snapshots appear in Amazon EC2 as Amazon +// EBS volumes. Snapshots are exported to the same Amazon Web Services Region +// in Amazon EC2 as the source Lightsail snapshot. +// +// The export snapshot operation supports tag-based access control via resource +// tags applied to the resource identified by sourceSnapshotName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Use the get instance snapshots or get disk snapshots operations to get a +// list of snapshots that you can export to Amazon EC2. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation ExportSnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/ExportSnapshot +func (c *Lightsail) ExportSnapshot(input *ExportSnapshotInput) (*ExportSnapshotOutput, error) { + req, out := c.ExportSnapshotRequest(input) + return out, req.Send() +} + +// ExportSnapshotWithContext is the same as ExportSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See ExportSnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) ExportSnapshotWithContext(ctx aws.Context, input *ExportSnapshotInput, opts ...request.Option) (*ExportSnapshotOutput, error) { + req, out := c.ExportSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetActiveNames = "GetActiveNames" // GetActiveNamesRequest generates a "aws/request.Request" representing the // client's request for the GetActiveNames operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3298,7 +4407,7 @@ const opGetBlueprints = "GetBlueprints" // GetBlueprintsRequest generates a "aws/request.Request" representing the // client's request for the GetBlueprints operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3405,7 +4514,7 @@ const opGetBundles = "GetBundles" // GetBundlesRequest generates a "aws/request.Request" representing the // client's request for the GetBundles operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3505,12 +4614,120 @@ func (c *Lightsail) GetBundlesWithContext(ctx aws.Context, input *GetBundlesInpu return out, req.Send() } +const opGetCloudFormationStackRecords = "GetCloudFormationStackRecords" + +// GetCloudFormationStackRecordsRequest generates a "aws/request.Request" representing the +// client's request for the GetCloudFormationStackRecords operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetCloudFormationStackRecords for more information on using the GetCloudFormationStackRecords +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetCloudFormationStackRecordsRequest method. +// req, resp := client.GetCloudFormationStackRecordsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetCloudFormationStackRecords +func (c *Lightsail) GetCloudFormationStackRecordsRequest(input *GetCloudFormationStackRecordsInput) (req *request.Request, output *GetCloudFormationStackRecordsOutput) { + op := &request.Operation{ + Name: opGetCloudFormationStackRecords, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetCloudFormationStackRecordsInput{} + } + + output = &GetCloudFormationStackRecordsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetCloudFormationStackRecords API operation for Amazon Lightsail. +// +// Returns the CloudFormation stack record created as a result of the create +// cloud formation stack operation. +// +// An AWS CloudFormation stack is used to create a new Amazon EC2 instance from +// an exported Lightsail snapshot. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetCloudFormationStackRecords for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetCloudFormationStackRecords +func (c *Lightsail) GetCloudFormationStackRecords(input *GetCloudFormationStackRecordsInput) (*GetCloudFormationStackRecordsOutput, error) { + req, out := c.GetCloudFormationStackRecordsRequest(input) + return out, req.Send() +} + +// GetCloudFormationStackRecordsWithContext is the same as GetCloudFormationStackRecords with the addition of +// the ability to pass a context and additional request options. +// +// See GetCloudFormationStackRecords for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetCloudFormationStackRecordsWithContext(ctx aws.Context, input *GetCloudFormationStackRecordsInput, opts ...request.Option) (*GetCloudFormationStackRecordsOutput, error) { + req, out := c.GetCloudFormationStackRecordsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetDisk = "GetDisk" // GetDiskRequest generates a "aws/request.Request" representing the // client's request for the GetDisk operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3614,7 +4831,7 @@ const opGetDiskSnapshot = "GetDiskSnapshot" // GetDiskSnapshotRequest generates a "aws/request.Request" representing the // client's request for the GetDiskSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3718,7 +4935,7 @@ const opGetDiskSnapshots = "GetDiskSnapshots" // GetDiskSnapshotsRequest generates a "aws/request.Request" representing the // client's request for the GetDiskSnapshots operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3827,7 +5044,7 @@ const opGetDisks = "GetDisks" // GetDisksRequest generates a "aws/request.Request" representing the // client's request for the GetDisks operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3936,7 +5153,7 @@ const opGetDomain = "GetDomain" // GetDomainRequest generates a "aws/request.Request" representing the // client's request for the GetDomain operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4040,7 +5257,7 @@ const opGetDomains = "GetDomains" // GetDomainsRequest generates a "aws/request.Request" representing the // client's request for the GetDomains operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4139,12 +5356,120 @@ func (c *Lightsail) GetDomainsWithContext(ctx aws.Context, input *GetDomainsInpu return out, req.Send() } +const opGetExportSnapshotRecords = "GetExportSnapshotRecords" + +// GetExportSnapshotRecordsRequest generates a "aws/request.Request" representing the +// client's request for the GetExportSnapshotRecords operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetExportSnapshotRecords for more information on using the GetExportSnapshotRecords +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetExportSnapshotRecordsRequest method. +// req, resp := client.GetExportSnapshotRecordsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetExportSnapshotRecords +func (c *Lightsail) GetExportSnapshotRecordsRequest(input *GetExportSnapshotRecordsInput) (req *request.Request, output *GetExportSnapshotRecordsOutput) { + op := &request.Operation{ + Name: opGetExportSnapshotRecords, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetExportSnapshotRecordsInput{} + } + + output = &GetExportSnapshotRecordsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetExportSnapshotRecords API operation for Amazon Lightsail. +// +// Returns the export snapshot record created as a result of the export snapshot +// operation. +// +// An export snapshot record can be used to create a new Amazon EC2 instance +// and its related resources with the create cloud formation stack 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 Lightsail's +// API operation GetExportSnapshotRecords for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetExportSnapshotRecords +func (c *Lightsail) GetExportSnapshotRecords(input *GetExportSnapshotRecordsInput) (*GetExportSnapshotRecordsOutput, error) { + req, out := c.GetExportSnapshotRecordsRequest(input) + return out, req.Send() +} + +// GetExportSnapshotRecordsWithContext is the same as GetExportSnapshotRecords with the addition of +// the ability to pass a context and additional request options. +// +// See GetExportSnapshotRecords for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetExportSnapshotRecordsWithContext(ctx aws.Context, input *GetExportSnapshotRecordsInput, opts ...request.Option) (*GetExportSnapshotRecordsOutput, error) { + req, out := c.GetExportSnapshotRecordsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetInstance = "GetInstance" // GetInstanceRequest generates a "aws/request.Request" representing the // client's request for the GetInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4249,7 +5574,7 @@ const opGetInstanceAccessDetails = "GetInstanceAccessDetails" // GetInstanceAccessDetailsRequest generates a "aws/request.Request" representing the // client's request for the GetInstanceAccessDetails operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4291,6 +5616,10 @@ func (c *Lightsail) GetInstanceAccessDetailsRequest(input *GetInstanceAccessDeta // Returns temporary SSH keys you can use to connect to a specific virtual private // server, or instance. // +// The get instance access details operation supports tag-based access control +// via resource tags applied to the resource identified by instanceName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -4354,7 +5683,7 @@ const opGetInstanceMetricData = "GetInstanceMetricData" // GetInstanceMetricDataRequest generates a "aws/request.Request" representing the // client's request for the GetInstanceMetricData operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4459,7 +5788,7 @@ const opGetInstancePortStates = "GetInstancePortStates" // GetInstancePortStatesRequest generates a "aws/request.Request" representing the // client's request for the GetInstancePortStates operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4563,7 +5892,7 @@ const opGetInstanceSnapshot = "GetInstanceSnapshot" // GetInstanceSnapshotRequest generates a "aws/request.Request" representing the // client's request for the GetInstanceSnapshot operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4667,7 +5996,7 @@ const opGetInstanceSnapshots = "GetInstanceSnapshots" // GetInstanceSnapshotsRequest generates a "aws/request.Request" representing the // client's request for the GetInstanceSnapshots operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4771,7 +6100,7 @@ const opGetInstanceState = "GetInstanceState" // GetInstanceStateRequest generates a "aws/request.Request" representing the // client's request for the GetInstanceState operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4875,7 +6204,7 @@ const opGetInstances = "GetInstances" // GetInstancesRequest generates a "aws/request.Request" representing the // client's request for the GetInstances operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4980,7 +6309,7 @@ const opGetKeyPair = "GetKeyPair" // GetKeyPairRequest generates a "aws/request.Request" representing the // client's request for the GetKeyPair operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5084,7 +6413,7 @@ const opGetKeyPairs = "GetKeyPairs" // GetKeyPairsRequest generates a "aws/request.Request" representing the // client's request for the GetKeyPairs operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5188,7 +6517,7 @@ const opGetLoadBalancer = "GetLoadBalancer" // GetLoadBalancerRequest generates a "aws/request.Request" representing the // client's request for the GetLoadBalancer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5292,7 +6621,7 @@ const opGetLoadBalancerMetricData = "GetLoadBalancerMetricData" // GetLoadBalancerMetricDataRequest generates a "aws/request.Request" representing the // client's request for the GetLoadBalancerMetricData operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5396,7 +6725,7 @@ const opGetLoadBalancerTlsCertificates = "GetLoadBalancerTlsCertificates" // GetLoadBalancerTlsCertificatesRequest generates a "aws/request.Request" representing the // client's request for the GetLoadBalancerTlsCertificates operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5506,7 +6835,7 @@ const opGetLoadBalancers = "GetLoadBalancers" // GetLoadBalancersRequest generates a "aws/request.Request" representing the // client's request for the GetLoadBalancers operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5614,7 +6943,7 @@ const opGetOperation = "GetOperation" // GetOperationRequest generates a "aws/request.Request" representing the // client's request for the GetOperation operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5720,7 +7049,7 @@ const opGetOperations = "GetOperations" // GetOperationsRequest generates a "aws/request.Request" representing the // client's request for the GetOperations operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5828,7 +7157,7 @@ const opGetOperationsForResource = "GetOperationsForResource" // GetOperationsForResourceRequest generates a "aws/request.Request" representing the // client's request for the GetOperationsForResource operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5932,7 +7261,7 @@ const opGetRegions = "GetRegions" // GetRegionsRequest generates a "aws/request.Request" representing the // client's request for the GetRegions operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5972,7 +7301,7 @@ func (c *Lightsail) GetRegionsRequest(input *GetRegionsInput) (req *request.Requ // GetRegions API operation for Amazon Lightsail. // // Returns a list of all valid regions for Amazon Lightsail. Use the include -// availability zones parameter to also return the availability zones in a region. +// availability zones parameter to also return the Availability Zones in a region. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6032,12 +7361,1280 @@ func (c *Lightsail) GetRegionsWithContext(ctx aws.Context, input *GetRegionsInpu return out, req.Send() } +const opGetRelationalDatabase = "GetRelationalDatabase" + +// GetRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabase for more information on using the GetRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseRequest method. +// req, resp := client.GetRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabase +func (c *Lightsail) GetRelationalDatabaseRequest(input *GetRelationalDatabaseInput) (req *request.Request, output *GetRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseInput{} + } + + output = &GetRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabase API operation for Amazon Lightsail. +// +// Returns information about a specific database in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabase +func (c *Lightsail) GetRelationalDatabase(input *GetRelationalDatabaseInput) (*GetRelationalDatabaseOutput, error) { + req, out := c.GetRelationalDatabaseRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseWithContext is the same as GetRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseWithContext(ctx aws.Context, input *GetRelationalDatabaseInput, opts ...request.Option) (*GetRelationalDatabaseOutput, error) { + req, out := c.GetRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseBlueprints = "GetRelationalDatabaseBlueprints" + +// GetRelationalDatabaseBlueprintsRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseBlueprints operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseBlueprints for more information on using the GetRelationalDatabaseBlueprints +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseBlueprintsRequest method. +// req, resp := client.GetRelationalDatabaseBlueprintsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseBlueprints +func (c *Lightsail) GetRelationalDatabaseBlueprintsRequest(input *GetRelationalDatabaseBlueprintsInput) (req *request.Request, output *GetRelationalDatabaseBlueprintsOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseBlueprints, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseBlueprintsInput{} + } + + output = &GetRelationalDatabaseBlueprintsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseBlueprints API operation for Amazon Lightsail. +// +// Returns a list of available database blueprints in Amazon Lightsail. A blueprint +// describes the major engine version of a database. +// +// You can use a blueprint ID to create a new database that runs a specific +// database engine. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseBlueprints for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseBlueprints +func (c *Lightsail) GetRelationalDatabaseBlueprints(input *GetRelationalDatabaseBlueprintsInput) (*GetRelationalDatabaseBlueprintsOutput, error) { + req, out := c.GetRelationalDatabaseBlueprintsRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseBlueprintsWithContext is the same as GetRelationalDatabaseBlueprints with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseBlueprints for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseBlueprintsWithContext(ctx aws.Context, input *GetRelationalDatabaseBlueprintsInput, opts ...request.Option) (*GetRelationalDatabaseBlueprintsOutput, error) { + req, out := c.GetRelationalDatabaseBlueprintsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseBundles = "GetRelationalDatabaseBundles" + +// GetRelationalDatabaseBundlesRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseBundles operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseBundles for more information on using the GetRelationalDatabaseBundles +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseBundlesRequest method. +// req, resp := client.GetRelationalDatabaseBundlesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseBundles +func (c *Lightsail) GetRelationalDatabaseBundlesRequest(input *GetRelationalDatabaseBundlesInput) (req *request.Request, output *GetRelationalDatabaseBundlesOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseBundles, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseBundlesInput{} + } + + output = &GetRelationalDatabaseBundlesOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseBundles API operation for Amazon Lightsail. +// +// Returns the list of bundles that are available in Amazon Lightsail. A bundle +// describes the performance specifications for a database. +// +// You can use a bundle ID to create a new database with explicit performance +// specifications. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseBundles for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseBundles +func (c *Lightsail) GetRelationalDatabaseBundles(input *GetRelationalDatabaseBundlesInput) (*GetRelationalDatabaseBundlesOutput, error) { + req, out := c.GetRelationalDatabaseBundlesRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseBundlesWithContext is the same as GetRelationalDatabaseBundles with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseBundles for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseBundlesWithContext(ctx aws.Context, input *GetRelationalDatabaseBundlesInput, opts ...request.Option) (*GetRelationalDatabaseBundlesOutput, error) { + req, out := c.GetRelationalDatabaseBundlesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseEvents = "GetRelationalDatabaseEvents" + +// GetRelationalDatabaseEventsRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseEvents for more information on using the GetRelationalDatabaseEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseEventsRequest method. +// req, resp := client.GetRelationalDatabaseEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseEvents +func (c *Lightsail) GetRelationalDatabaseEventsRequest(input *GetRelationalDatabaseEventsInput) (req *request.Request, output *GetRelationalDatabaseEventsOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseEventsInput{} + } + + output = &GetRelationalDatabaseEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseEvents API operation for Amazon Lightsail. +// +// Returns a list of events for a specific database in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseEvents for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseEvents +func (c *Lightsail) GetRelationalDatabaseEvents(input *GetRelationalDatabaseEventsInput) (*GetRelationalDatabaseEventsOutput, error) { + req, out := c.GetRelationalDatabaseEventsRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseEventsWithContext is the same as GetRelationalDatabaseEvents with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseEventsWithContext(ctx aws.Context, input *GetRelationalDatabaseEventsInput, opts ...request.Option) (*GetRelationalDatabaseEventsOutput, error) { + req, out := c.GetRelationalDatabaseEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseLogEvents = "GetRelationalDatabaseLogEvents" + +// GetRelationalDatabaseLogEventsRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseLogEvents operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseLogEvents for more information on using the GetRelationalDatabaseLogEvents +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseLogEventsRequest method. +// req, resp := client.GetRelationalDatabaseLogEventsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseLogEvents +func (c *Lightsail) GetRelationalDatabaseLogEventsRequest(input *GetRelationalDatabaseLogEventsInput) (req *request.Request, output *GetRelationalDatabaseLogEventsOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseLogEvents, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseLogEventsInput{} + } + + output = &GetRelationalDatabaseLogEventsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseLogEvents API operation for Amazon Lightsail. +// +// Returns a list of log events for a database in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseLogEvents for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseLogEvents +func (c *Lightsail) GetRelationalDatabaseLogEvents(input *GetRelationalDatabaseLogEventsInput) (*GetRelationalDatabaseLogEventsOutput, error) { + req, out := c.GetRelationalDatabaseLogEventsRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseLogEventsWithContext is the same as GetRelationalDatabaseLogEvents with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseLogEvents for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseLogEventsWithContext(ctx aws.Context, input *GetRelationalDatabaseLogEventsInput, opts ...request.Option) (*GetRelationalDatabaseLogEventsOutput, error) { + req, out := c.GetRelationalDatabaseLogEventsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseLogStreams = "GetRelationalDatabaseLogStreams" + +// GetRelationalDatabaseLogStreamsRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseLogStreams operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseLogStreams for more information on using the GetRelationalDatabaseLogStreams +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseLogStreamsRequest method. +// req, resp := client.GetRelationalDatabaseLogStreamsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseLogStreams +func (c *Lightsail) GetRelationalDatabaseLogStreamsRequest(input *GetRelationalDatabaseLogStreamsInput) (req *request.Request, output *GetRelationalDatabaseLogStreamsOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseLogStreams, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseLogStreamsInput{} + } + + output = &GetRelationalDatabaseLogStreamsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseLogStreams API operation for Amazon Lightsail. +// +// Returns a list of available log streams for a specific database in Amazon +// Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseLogStreams for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseLogStreams +func (c *Lightsail) GetRelationalDatabaseLogStreams(input *GetRelationalDatabaseLogStreamsInput) (*GetRelationalDatabaseLogStreamsOutput, error) { + req, out := c.GetRelationalDatabaseLogStreamsRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseLogStreamsWithContext is the same as GetRelationalDatabaseLogStreams with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseLogStreams for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseLogStreamsWithContext(ctx aws.Context, input *GetRelationalDatabaseLogStreamsInput, opts ...request.Option) (*GetRelationalDatabaseLogStreamsOutput, error) { + req, out := c.GetRelationalDatabaseLogStreamsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseMasterUserPassword = "GetRelationalDatabaseMasterUserPassword" + +// GetRelationalDatabaseMasterUserPasswordRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseMasterUserPassword operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseMasterUserPassword for more information on using the GetRelationalDatabaseMasterUserPassword +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseMasterUserPasswordRequest method. +// req, resp := client.GetRelationalDatabaseMasterUserPasswordRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseMasterUserPassword +func (c *Lightsail) GetRelationalDatabaseMasterUserPasswordRequest(input *GetRelationalDatabaseMasterUserPasswordInput) (req *request.Request, output *GetRelationalDatabaseMasterUserPasswordOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseMasterUserPassword, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseMasterUserPasswordInput{} + } + + output = &GetRelationalDatabaseMasterUserPasswordOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseMasterUserPassword API operation for Amazon Lightsail. +// +// Returns the current, previous, or pending versions of the master user password +// for a Lightsail database. +// +// The asdf operation GetRelationalDatabaseMasterUserPassword supports tag-based +// access control via resource tags applied to the resource identified by relationalDatabaseName. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseMasterUserPassword for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseMasterUserPassword +func (c *Lightsail) GetRelationalDatabaseMasterUserPassword(input *GetRelationalDatabaseMasterUserPasswordInput) (*GetRelationalDatabaseMasterUserPasswordOutput, error) { + req, out := c.GetRelationalDatabaseMasterUserPasswordRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseMasterUserPasswordWithContext is the same as GetRelationalDatabaseMasterUserPassword with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseMasterUserPassword for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseMasterUserPasswordWithContext(ctx aws.Context, input *GetRelationalDatabaseMasterUserPasswordInput, opts ...request.Option) (*GetRelationalDatabaseMasterUserPasswordOutput, error) { + req, out := c.GetRelationalDatabaseMasterUserPasswordRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseMetricData = "GetRelationalDatabaseMetricData" + +// GetRelationalDatabaseMetricDataRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseMetricData operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseMetricData for more information on using the GetRelationalDatabaseMetricData +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseMetricDataRequest method. +// req, resp := client.GetRelationalDatabaseMetricDataRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseMetricData +func (c *Lightsail) GetRelationalDatabaseMetricDataRequest(input *GetRelationalDatabaseMetricDataInput) (req *request.Request, output *GetRelationalDatabaseMetricDataOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseMetricData, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseMetricDataInput{} + } + + output = &GetRelationalDatabaseMetricDataOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseMetricData API operation for Amazon Lightsail. +// +// Returns the data points of the specified metric for a database in Amazon +// Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseMetricData for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseMetricData +func (c *Lightsail) GetRelationalDatabaseMetricData(input *GetRelationalDatabaseMetricDataInput) (*GetRelationalDatabaseMetricDataOutput, error) { + req, out := c.GetRelationalDatabaseMetricDataRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseMetricDataWithContext is the same as GetRelationalDatabaseMetricData with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseMetricData for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseMetricDataWithContext(ctx aws.Context, input *GetRelationalDatabaseMetricDataInput, opts ...request.Option) (*GetRelationalDatabaseMetricDataOutput, error) { + req, out := c.GetRelationalDatabaseMetricDataRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseParameters = "GetRelationalDatabaseParameters" + +// GetRelationalDatabaseParametersRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseParameters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseParameters for more information on using the GetRelationalDatabaseParameters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseParametersRequest method. +// req, resp := client.GetRelationalDatabaseParametersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseParameters +func (c *Lightsail) GetRelationalDatabaseParametersRequest(input *GetRelationalDatabaseParametersInput) (req *request.Request, output *GetRelationalDatabaseParametersOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseParameters, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseParametersInput{} + } + + output = &GetRelationalDatabaseParametersOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseParameters API operation for Amazon Lightsail. +// +// Returns all of the runtime parameters offered by the underlying database +// software, or engine, for a specific database in Amazon Lightsail. +// +// In addition to the parameter names and values, this operation returns other +// information about each parameter. This information includes whether changes +// require a reboot, whether the parameter is modifiable, the allowed values, +// and the data types. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseParameters for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseParameters +func (c *Lightsail) GetRelationalDatabaseParameters(input *GetRelationalDatabaseParametersInput) (*GetRelationalDatabaseParametersOutput, error) { + req, out := c.GetRelationalDatabaseParametersRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseParametersWithContext is the same as GetRelationalDatabaseParameters with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseParameters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseParametersWithContext(ctx aws.Context, input *GetRelationalDatabaseParametersInput, opts ...request.Option) (*GetRelationalDatabaseParametersOutput, error) { + req, out := c.GetRelationalDatabaseParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseSnapshot = "GetRelationalDatabaseSnapshot" + +// GetRelationalDatabaseSnapshotRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseSnapshot operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseSnapshot for more information on using the GetRelationalDatabaseSnapshot +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseSnapshotRequest method. +// req, resp := client.GetRelationalDatabaseSnapshotRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseSnapshot +func (c *Lightsail) GetRelationalDatabaseSnapshotRequest(input *GetRelationalDatabaseSnapshotInput) (req *request.Request, output *GetRelationalDatabaseSnapshotOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseSnapshot, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseSnapshotInput{} + } + + output = &GetRelationalDatabaseSnapshotOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseSnapshot API operation for Amazon Lightsail. +// +// Returns information about a specific database snapshot in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseSnapshot for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseSnapshot +func (c *Lightsail) GetRelationalDatabaseSnapshot(input *GetRelationalDatabaseSnapshotInput) (*GetRelationalDatabaseSnapshotOutput, error) { + req, out := c.GetRelationalDatabaseSnapshotRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseSnapshotWithContext is the same as GetRelationalDatabaseSnapshot with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseSnapshot for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseSnapshotWithContext(ctx aws.Context, input *GetRelationalDatabaseSnapshotInput, opts ...request.Option) (*GetRelationalDatabaseSnapshotOutput, error) { + req, out := c.GetRelationalDatabaseSnapshotRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabaseSnapshots = "GetRelationalDatabaseSnapshots" + +// GetRelationalDatabaseSnapshotsRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabaseSnapshots operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabaseSnapshots for more information on using the GetRelationalDatabaseSnapshots +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabaseSnapshotsRequest method. +// req, resp := client.GetRelationalDatabaseSnapshotsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseSnapshots +func (c *Lightsail) GetRelationalDatabaseSnapshotsRequest(input *GetRelationalDatabaseSnapshotsInput) (req *request.Request, output *GetRelationalDatabaseSnapshotsOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabaseSnapshots, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabaseSnapshotsInput{} + } + + output = &GetRelationalDatabaseSnapshotsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabaseSnapshots API operation for Amazon Lightsail. +// +// Returns information about all of your database snapshots in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabaseSnapshots for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabaseSnapshots +func (c *Lightsail) GetRelationalDatabaseSnapshots(input *GetRelationalDatabaseSnapshotsInput) (*GetRelationalDatabaseSnapshotsOutput, error) { + req, out := c.GetRelationalDatabaseSnapshotsRequest(input) + return out, req.Send() +} + +// GetRelationalDatabaseSnapshotsWithContext is the same as GetRelationalDatabaseSnapshots with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabaseSnapshots for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabaseSnapshotsWithContext(ctx aws.Context, input *GetRelationalDatabaseSnapshotsInput, opts ...request.Option) (*GetRelationalDatabaseSnapshotsOutput, error) { + req, out := c.GetRelationalDatabaseSnapshotsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetRelationalDatabases = "GetRelationalDatabases" + +// GetRelationalDatabasesRequest generates a "aws/request.Request" representing the +// client's request for the GetRelationalDatabases operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See GetRelationalDatabases for more information on using the GetRelationalDatabases +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the GetRelationalDatabasesRequest method. +// req, resp := client.GetRelationalDatabasesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabases +func (c *Lightsail) GetRelationalDatabasesRequest(input *GetRelationalDatabasesInput) (req *request.Request, output *GetRelationalDatabasesOutput) { + op := &request.Operation{ + Name: opGetRelationalDatabases, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetRelationalDatabasesInput{} + } + + output = &GetRelationalDatabasesOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetRelationalDatabases API operation for Amazon Lightsail. +// +// Returns information about all of your databases in Amazon Lightsail. +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation GetRelationalDatabases for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/GetRelationalDatabases +func (c *Lightsail) GetRelationalDatabases(input *GetRelationalDatabasesInput) (*GetRelationalDatabasesOutput, error) { + req, out := c.GetRelationalDatabasesRequest(input) + return out, req.Send() +} + +// GetRelationalDatabasesWithContext is the same as GetRelationalDatabases with the addition of +// the ability to pass a context and additional request options. +// +// See GetRelationalDatabases for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) GetRelationalDatabasesWithContext(ctx aws.Context, input *GetRelationalDatabasesInput, opts ...request.Option) (*GetRelationalDatabasesOutput, error) { + req, out := c.GetRelationalDatabasesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetStaticIp = "GetStaticIp" // GetStaticIpRequest generates a "aws/request.Request" representing the // client's request for the GetStaticIp operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6141,7 +8738,7 @@ const opGetStaticIps = "GetStaticIps" // GetStaticIpsRequest generates a "aws/request.Request" representing the // client's request for the GetStaticIps operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6245,7 +8842,7 @@ const opImportKeyPair = "ImportKeyPair" // ImportKeyPairRequest generates a "aws/request.Request" representing the // client's request for the ImportKeyPair operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6349,7 +8946,7 @@ const opIsVpcPeered = "IsVpcPeered" // IsVpcPeeredRequest generates a "aws/request.Request" representing the // client's request for the IsVpcPeered operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6453,7 +9050,7 @@ const opOpenInstancePublicPorts = "OpenInstancePublicPorts" // OpenInstancePublicPortsRequest generates a "aws/request.Request" representing the // client's request for the OpenInstancePublicPorts operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6494,6 +9091,10 @@ func (c *Lightsail) OpenInstancePublicPortsRequest(input *OpenInstancePublicPort // // Adds public ports to an Amazon Lightsail instance. // +// The open instance public ports operation supports tag-based access control +// via resource tags applied to the resource identified by instanceName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -6557,7 +9158,7 @@ const opPeerVpc = "PeerVpc" // PeerVpcRequest generates a "aws/request.Request" representing the // client's request for the PeerVpc operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6661,7 +9262,7 @@ const opPutInstancePublicPorts = "PutInstancePublicPorts" // PutInstancePublicPortsRequest generates a "aws/request.Request" representing the // client's request for the PutInstancePublicPorts operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6703,6 +9304,10 @@ func (c *Lightsail) PutInstancePublicPortsRequest(input *PutInstancePublicPortsI // Sets the specified open ports for an Amazon Lightsail instance, and closes // all ports for every protocol not included in the current request. // +// The put instance public ports operation supports tag-based access control +// via resource tags applied to the resource identified by instanceName. For +// more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -6766,7 +9371,7 @@ const opRebootInstance = "RebootInstance" // RebootInstanceRequest generates a "aws/request.Request" representing the // client's request for the RebootInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6805,10 +9410,11 @@ func (c *Lightsail) RebootInstanceRequest(input *RebootInstanceInput) (req *requ // RebootInstance API operation for Amazon Lightsail. // -// Restarts a specific instance. When your Amazon Lightsail instance is finished -// rebooting, Lightsail assigns a new public IP address. To use the same IP -// address after restarting, create a static IP address and attach it to the -// instance. +// Restarts a specific instance. +// +// The reboot instance operation supports tag-based access control via resource +// tags applied to the resource identified by instanceName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -6868,12 +9474,120 @@ func (c *Lightsail) RebootInstanceWithContext(ctx aws.Context, input *RebootInst return out, req.Send() } +const opRebootRelationalDatabase = "RebootRelationalDatabase" + +// RebootRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the RebootRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See RebootRelationalDatabase for more information on using the RebootRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the RebootRelationalDatabaseRequest method. +// req, resp := client.RebootRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootRelationalDatabase +func (c *Lightsail) RebootRelationalDatabaseRequest(input *RebootRelationalDatabaseInput) (req *request.Request, output *RebootRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opRebootRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &RebootRelationalDatabaseInput{} + } + + output = &RebootRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// RebootRelationalDatabase API operation for Amazon Lightsail. +// +// Restarts a specific database in Amazon Lightsail. +// +// The reboot relational database operation supports tag-based access control +// via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation RebootRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootRelationalDatabase +func (c *Lightsail) RebootRelationalDatabase(input *RebootRelationalDatabaseInput) (*RebootRelationalDatabaseOutput, error) { + req, out := c.RebootRelationalDatabaseRequest(input) + return out, req.Send() +} + +// RebootRelationalDatabaseWithContext is the same as RebootRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See RebootRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) RebootRelationalDatabaseWithContext(ctx aws.Context, input *RebootRelationalDatabaseInput, opts ...request.Option) (*RebootRelationalDatabaseOutput, error) { + req, out := c.RebootRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opReleaseStaticIp = "ReleaseStaticIp" // ReleaseStaticIpRequest generates a "aws/request.Request" representing the // client's request for the ReleaseStaticIp operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -6977,7 +9691,7 @@ const opStartInstance = "StartInstance" // StartInstanceRequest generates a "aws/request.Request" representing the // client's request for the StartInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -7019,6 +9733,15 @@ func (c *Lightsail) StartInstanceRequest(input *StartInstanceInput) (req *reques // Starts a specific Amazon Lightsail instance from a stopped state. To restart // an instance, use the reboot instance operation. // +// When you start a stopped instance, Lightsail assigns a new public IP address +// to the instance. To use the same IP address after stopping and starting an +// instance, create a static IP address and attach it to the instance. For more +// information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/lightsail-create-static-ip). +// +// The start instance operation supports tag-based access control via resource +// tags applied to the resource identified by instanceName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -7077,12 +9800,121 @@ func (c *Lightsail) StartInstanceWithContext(ctx aws.Context, input *StartInstan return out, req.Send() } +const opStartRelationalDatabase = "StartRelationalDatabase" + +// StartRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the StartRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StartRelationalDatabase for more information on using the StartRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the StartRelationalDatabaseRequest method. +// req, resp := client.StartRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StartRelationalDatabase +func (c *Lightsail) StartRelationalDatabaseRequest(input *StartRelationalDatabaseInput) (req *request.Request, output *StartRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opStartRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StartRelationalDatabaseInput{} + } + + output = &StartRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// StartRelationalDatabase API operation for Amazon Lightsail. +// +// Starts a specific database from a stopped state in Amazon Lightsail. To restart +// a database, use the reboot relational database operation. +// +// The start relational database operation supports tag-based access control +// via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation StartRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StartRelationalDatabase +func (c *Lightsail) StartRelationalDatabase(input *StartRelationalDatabaseInput) (*StartRelationalDatabaseOutput, error) { + req, out := c.StartRelationalDatabaseRequest(input) + return out, req.Send() +} + +// StartRelationalDatabaseWithContext is the same as StartRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See StartRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) StartRelationalDatabaseWithContext(ctx aws.Context, input *StartRelationalDatabaseInput, opts ...request.Option) (*StartRelationalDatabaseOutput, error) { + req, out := c.StartRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opStopInstance = "StopInstance" // StopInstanceRequest generates a "aws/request.Request" representing the // client's request for the StopInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -7123,6 +9955,15 @@ func (c *Lightsail) StopInstanceRequest(input *StopInstanceInput) (req *request. // // Stops a specific Amazon Lightsail instance that is currently running. // +// When you start a stopped instance, Lightsail assigns a new public IP address +// to the instance. To use the same IP address after stopping and starting an +// instance, create a static IP address and attach it to the instance. For more +// information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/lightsail-create-static-ip). +// +// The stop instance operation supports tag-based access control via resource +// tags applied to the resource identified by instanceName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -7181,12 +10022,231 @@ func (c *Lightsail) StopInstanceWithContext(ctx aws.Context, input *StopInstance return out, req.Send() } +const opStopRelationalDatabase = "StopRelationalDatabase" + +// StopRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the StopRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See StopRelationalDatabase for more information on using the StopRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the StopRelationalDatabaseRequest method. +// req, resp := client.StopRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StopRelationalDatabase +func (c *Lightsail) StopRelationalDatabaseRequest(input *StopRelationalDatabaseInput) (req *request.Request, output *StopRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opStopRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StopRelationalDatabaseInput{} + } + + output = &StopRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// StopRelationalDatabase API operation for Amazon Lightsail. +// +// Stops a specific database that is currently running in Amazon Lightsail. +// +// The stop relational database operation supports tag-based access control +// via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation StopRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/StopRelationalDatabase +func (c *Lightsail) StopRelationalDatabase(input *StopRelationalDatabaseInput) (*StopRelationalDatabaseOutput, error) { + req, out := c.StopRelationalDatabaseRequest(input) + return out, req.Send() +} + +// StopRelationalDatabaseWithContext is the same as StopRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See StopRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) StopRelationalDatabaseWithContext(ctx aws.Context, input *StopRelationalDatabaseInput, opts ...request.Option) (*StopRelationalDatabaseOutput, error) { + req, out := c.StopRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opTagResource = "TagResource" + +// TagResourceRequest generates a "aws/request.Request" representing the +// client's request for the TagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See TagResource for more information on using the TagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the TagResourceRequest method. +// req, resp := client.TagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/TagResource +func (c *Lightsail) TagResourceRequest(input *TagResourceInput) (req *request.Request, output *TagResourceOutput) { + op := &request.Operation{ + Name: opTagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &TagResourceInput{} + } + + output = &TagResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// TagResource API operation for Amazon Lightsail. +// +// Adds one or more tags to the specified Amazon Lightsail resource. Each resource +// can have a maximum of 50 tags. Each tag consists of a key and an optional +// value. Tag keys must be unique per resource. For more information about tags, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). +// +// The tag resource operation supports tag-based access control via request +// tags and resource tags applied to the resource identified by resourceName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation TagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/TagResource +func (c *Lightsail) TagResource(input *TagResourceInput) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + return out, req.Send() +} + +// TagResourceWithContext is the same as TagResource with the addition of +// the ability to pass a context and additional request options. +// +// See TagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) TagResourceWithContext(ctx aws.Context, input *TagResourceInput, opts ...request.Option) (*TagResourceOutput, error) { + req, out := c.TagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opUnpeerVpc = "UnpeerVpc" // UnpeerVpcRequest generates a "aws/request.Request" representing the // client's request for the UnpeerVpc operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -7285,12 +10345,121 @@ func (c *Lightsail) UnpeerVpcWithContext(ctx aws.Context, input *UnpeerVpcInput, return out, req.Send() } +const opUntagResource = "UntagResource" + +// UntagResourceRequest generates a "aws/request.Request" representing the +// client's request for the UntagResource operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UntagResource for more information on using the UntagResource +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UntagResourceRequest method. +// req, resp := client.UntagResourceRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UntagResource +func (c *Lightsail) UntagResourceRequest(input *UntagResourceInput) (req *request.Request, output *UntagResourceOutput) { + op := &request.Operation{ + Name: opUntagResource, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UntagResourceInput{} + } + + output = &UntagResourceOutput{} + req = c.newRequest(op, input, output) + return +} + +// UntagResource API operation for Amazon Lightsail. +// +// Deletes the specified set of tag keys and their values from the specified +// Amazon Lightsail resource. +// +// The untag resource operation supports tag-based access control via request +// tags and resource tags applied to the resource identified by resourceName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation UntagResource for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UntagResource +func (c *Lightsail) UntagResource(input *UntagResourceInput) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + return out, req.Send() +} + +// UntagResourceWithContext is the same as UntagResource with the addition of +// the ability to pass a context and additional request options. +// +// See UntagResource for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) UntagResourceWithContext(ctx aws.Context, input *UntagResourceInput, opts ...request.Option) (*UntagResourceOutput, error) { + req, out := c.UntagResourceRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opUpdateDomainEntry = "UpdateDomainEntry" // UpdateDomainEntryRequest generates a "aws/request.Request" representing the // client's request for the UpdateDomainEntry operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -7331,6 +10500,10 @@ func (c *Lightsail) UpdateDomainEntryRequest(input *UpdateDomainEntryInput) (req // // Updates a domain recordset after it is created. // +// The update domain entry operation supports tag-based access control via resource +// tags applied to the resource identified by domainName. For more information, +// see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -7394,7 +10567,7 @@ const opUpdateLoadBalancerAttribute = "UpdateLoadBalancerAttribute" // UpdateLoadBalancerAttributeRequest generates a "aws/request.Request" representing the // client's request for the UpdateLoadBalancerAttribute operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -7436,6 +10609,10 @@ func (c *Lightsail) UpdateLoadBalancerAttributeRequest(input *UpdateLoadBalancer // Updates the specified attribute for a load balancer. You can only update // one attribute at a time. // +// The update load balancer attribute operation supports tag-based access control +// via resource tags applied to the resource identified by loadBalancerName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -7494,6 +10671,232 @@ func (c *Lightsail) UpdateLoadBalancerAttributeWithContext(ctx aws.Context, inpu return out, req.Send() } +const opUpdateRelationalDatabase = "UpdateRelationalDatabase" + +// UpdateRelationalDatabaseRequest generates a "aws/request.Request" representing the +// client's request for the UpdateRelationalDatabase operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateRelationalDatabase for more information on using the UpdateRelationalDatabase +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateRelationalDatabaseRequest method. +// req, resp := client.UpdateRelationalDatabaseRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateRelationalDatabase +func (c *Lightsail) UpdateRelationalDatabaseRequest(input *UpdateRelationalDatabaseInput) (req *request.Request, output *UpdateRelationalDatabaseOutput) { + op := &request.Operation{ + Name: opUpdateRelationalDatabase, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateRelationalDatabaseInput{} + } + + output = &UpdateRelationalDatabaseOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateRelationalDatabase API operation for Amazon Lightsail. +// +// Allows the update of one or more attributes of a database in Amazon Lightsail. +// +// Updates are applied immediately, or in cases where the updates could result +// in an outage, are applied during the database's predefined maintenance window. +// +// The update relational database operation supports tag-based access control +// via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation UpdateRelationalDatabase for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateRelationalDatabase +func (c *Lightsail) UpdateRelationalDatabase(input *UpdateRelationalDatabaseInput) (*UpdateRelationalDatabaseOutput, error) { + req, out := c.UpdateRelationalDatabaseRequest(input) + return out, req.Send() +} + +// UpdateRelationalDatabaseWithContext is the same as UpdateRelationalDatabase with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRelationalDatabase for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) UpdateRelationalDatabaseWithContext(ctx aws.Context, input *UpdateRelationalDatabaseInput, opts ...request.Option) (*UpdateRelationalDatabaseOutput, error) { + req, out := c.UpdateRelationalDatabaseRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opUpdateRelationalDatabaseParameters = "UpdateRelationalDatabaseParameters" + +// UpdateRelationalDatabaseParametersRequest generates a "aws/request.Request" representing the +// client's request for the UpdateRelationalDatabaseParameters operation. The "output" return +// value will be populated with the request's response once the request completes +// successfully. +// +// Use "Send" method on the returned Request to send the API call to the service. +// the "output" return value is not valid until after Send returns without error. +// +// See UpdateRelationalDatabaseParameters for more information on using the UpdateRelationalDatabaseParameters +// API call, and error handling. +// +// This method is useful when you want to inject custom logic or configuration +// into the SDK's request lifecycle. Such as custom headers, or retry logic. +// +// +// // Example sending a request using the UpdateRelationalDatabaseParametersRequest method. +// req, resp := client.UpdateRelationalDatabaseParametersRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateRelationalDatabaseParameters +func (c *Lightsail) UpdateRelationalDatabaseParametersRequest(input *UpdateRelationalDatabaseParametersInput) (req *request.Request, output *UpdateRelationalDatabaseParametersOutput) { + op := &request.Operation{ + Name: opUpdateRelationalDatabaseParameters, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &UpdateRelationalDatabaseParametersInput{} + } + + output = &UpdateRelationalDatabaseParametersOutput{} + req = c.newRequest(op, input, output) + return +} + +// UpdateRelationalDatabaseParameters API operation for Amazon Lightsail. +// +// Allows the update of one or more parameters of a database in Amazon Lightsail. +// +// Parameter updates don't cause outages; therefore, their application is not +// subject to the preferred maintenance window. However, there are two ways +// in which paramater updates are applied: dynamic or pending-reboot. Parameters +// marked with a dynamic apply type are applied immediately. Parameters marked +// with a pending-reboot apply type are applied only after the database is rebooted +// using the reboot relational database operation. +// +// The update relational database parameters operation supports tag-based access +// control via resource tags applied to the resource identified by relationalDatabaseName. +// For more information, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-controlling-access-using-tags). +// +// Returns awserr.Error for service API and SDK errors. Use runtime 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 Lightsail's +// API operation UpdateRelationalDatabaseParameters for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your AWS Region configuration to us-east-1 to create, view, or +// edit these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// See also, https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/UpdateRelationalDatabaseParameters +func (c *Lightsail) UpdateRelationalDatabaseParameters(input *UpdateRelationalDatabaseParametersInput) (*UpdateRelationalDatabaseParametersOutput, error) { + req, out := c.UpdateRelationalDatabaseParametersRequest(input) + return out, req.Send() +} + +// UpdateRelationalDatabaseParametersWithContext is the same as UpdateRelationalDatabaseParameters with the addition of +// the ability to pass a context and additional request options. +// +// See UpdateRelationalDatabaseParameters for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) UpdateRelationalDatabaseParametersWithContext(ctx aws.Context, input *UpdateRelationalDatabaseParametersInput, opts ...request.Option) (*UpdateRelationalDatabaseParametersOutput, error) { + req, out := c.UpdateRelationalDatabaseParametersRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + type AllocateStaticIpInput struct { _ struct{} `type:"structure"` @@ -7928,9 +11331,10 @@ type Blueprint struct { // The group name of the blueprint (e.g., amazon-linux). Group *string `locationName:"group" type:"string"` - // A Boolean value indicating whether the blueprint is active. When you update - // your blueprints, you will inactivate old blueprints and keep the most recent - // versions active. + // A Boolean value indicating whether the blueprint is active. Inactive blueprints + // are listed to support customers with existing instances but are not necessarily + // available for launch of new instances. Blueprints are marked inactive when + // they become outdated due to operating system updates or new application releases. IsActive *bool `locationName:"isActive" type:"boolean"` // The end-user license agreement URL for the image or blueprint. @@ -8242,6 +11646,307 @@ func (s *CloseInstancePublicPortsOutput) SetOperation(v *Operation) *CloseInstan return s } +// Describes a CloudFormation stack record created as a result of the create +// cloud formation stack operation. +// +// A CloudFormation stack record provides information about the AWS CloudFormation +// stack used to create a new Amazon Elastic Compute Cloud instance from an +// exported Lightsail instance snapshot. +type CloudFormationStackRecord struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the CloudFormation stack record. + Arn *string `locationName:"arn" type:"string"` + + // The date when the CloudFormation stack record was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // A list of objects describing the destination service, which is AWS CloudFormation, + // and the Amazon Resource Name (ARN) of the AWS CloudFormation stack. + DestinationInfo *DestinationInfo `locationName:"destinationInfo" type:"structure"` + + // A list of objects describing the Availability Zone and AWS Region of the + // CloudFormation stack record. + Location *ResourceLocation `locationName:"location" type:"structure"` + + // The name of the CloudFormation stack record. It starts with CloudFormationStackRecord + // followed by a GUID. + Name *string `locationName:"name" type:"string"` + + // The Lightsail resource type (e.g., CloudFormationStackRecord). + ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` + + // A list of objects describing the source of the CloudFormation stack record. + SourceInfo []*CloudFormationStackRecordSourceInfo `locationName:"sourceInfo" type:"list"` + + // The current state of the CloudFormation stack record. + State *string `locationName:"state" type:"string" enum:"RecordState"` +} + +// String returns the string representation +func (s CloudFormationStackRecord) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CloudFormationStackRecord) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *CloudFormationStackRecord) SetArn(v string) *CloudFormationStackRecord { + s.Arn = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *CloudFormationStackRecord) SetCreatedAt(v time.Time) *CloudFormationStackRecord { + s.CreatedAt = &v + return s +} + +// SetDestinationInfo sets the DestinationInfo field's value. +func (s *CloudFormationStackRecord) SetDestinationInfo(v *DestinationInfo) *CloudFormationStackRecord { + s.DestinationInfo = v + return s +} + +// SetLocation sets the Location field's value. +func (s *CloudFormationStackRecord) SetLocation(v *ResourceLocation) *CloudFormationStackRecord { + s.Location = v + return s +} + +// SetName sets the Name field's value. +func (s *CloudFormationStackRecord) SetName(v string) *CloudFormationStackRecord { + s.Name = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *CloudFormationStackRecord) SetResourceType(v string) *CloudFormationStackRecord { + s.ResourceType = &v + return s +} + +// SetSourceInfo sets the SourceInfo field's value. +func (s *CloudFormationStackRecord) SetSourceInfo(v []*CloudFormationStackRecordSourceInfo) *CloudFormationStackRecord { + s.SourceInfo = v + return s +} + +// SetState sets the State field's value. +func (s *CloudFormationStackRecord) SetState(v string) *CloudFormationStackRecord { + s.State = &v + return s +} + +// Describes the source of a CloudFormation stack record (i.e., the export snapshot +// record). +type CloudFormationStackRecordSourceInfo struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the export snapshot record. + Arn *string `locationName:"arn" type:"string"` + + // The name of the record. + Name *string `locationName:"name" type:"string"` + + // The Lightsail resource type (e.g., ExportSnapshotRecord). + ResourceType *string `locationName:"resourceType" type:"string" enum:"CloudFormationStackRecordSourceType"` +} + +// String returns the string representation +func (s CloudFormationStackRecordSourceInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CloudFormationStackRecordSourceInfo) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *CloudFormationStackRecordSourceInfo) SetArn(v string) *CloudFormationStackRecordSourceInfo { + s.Arn = &v + return s +} + +// SetName sets the Name field's value. +func (s *CloudFormationStackRecordSourceInfo) SetName(v string) *CloudFormationStackRecordSourceInfo { + s.Name = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *CloudFormationStackRecordSourceInfo) SetResourceType(v string) *CloudFormationStackRecordSourceInfo { + s.ResourceType = &v + return s +} + +type CopySnapshotInput struct { + _ struct{} `type:"structure"` + + // The AWS Region where the source snapshot is located. + // + // SourceRegion is a required field + SourceRegion *string `locationName:"sourceRegion" type:"string" required:"true" enum:"RegionName"` + + // The name of the source instance or disk snapshot to be copied. + // + // SourceSnapshotName is a required field + SourceSnapshotName *string `locationName:"sourceSnapshotName" type:"string" required:"true"` + + // The name of the new instance or disk snapshot to be created as a copy. + // + // TargetSnapshotName is a required field + TargetSnapshotName *string `locationName:"targetSnapshotName" type:"string" required:"true"` +} + +// String returns the string representation +func (s CopySnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopySnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CopySnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CopySnapshotInput"} + if s.SourceRegion == nil { + invalidParams.Add(request.NewErrParamRequired("SourceRegion")) + } + if s.SourceSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("SourceSnapshotName")) + } + if s.TargetSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("TargetSnapshotName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetSourceRegion sets the SourceRegion field's value. +func (s *CopySnapshotInput) SetSourceRegion(v string) *CopySnapshotInput { + s.SourceRegion = &v + return s +} + +// SetSourceSnapshotName sets the SourceSnapshotName field's value. +func (s *CopySnapshotInput) SetSourceSnapshotName(v string) *CopySnapshotInput { + s.SourceSnapshotName = &v + return s +} + +// SetTargetSnapshotName sets the TargetSnapshotName field's value. +func (s *CopySnapshotInput) SetTargetSnapshotName(v string) *CopySnapshotInput { + s.TargetSnapshotName = &v + return s +} + +type CopySnapshotOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s CopySnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CopySnapshotOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *CopySnapshotOutput) SetOperations(v []*Operation) *CopySnapshotOutput { + s.Operations = v + return s +} + +type CreateCloudFormationStackInput struct { + _ struct{} `type:"structure"` + + // An array of parameters that will be used to create the new Amazon EC2 instance. + // You can only pass one instance entry at a time in this array. You will get + // an invalid parameter error if you pass more than one instance entry in this + // array. + // + // Instances is a required field + Instances []*InstanceEntry `locationName:"instances" type:"list" required:"true"` +} + +// String returns the string representation +func (s CreateCloudFormationStackInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateCloudFormationStackInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateCloudFormationStackInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateCloudFormationStackInput"} + if s.Instances == nil { + invalidParams.Add(request.NewErrParamRequired("Instances")) + } + if s.Instances != nil { + for i, v := range s.Instances { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Instances", i), err.(request.ErrInvalidParams)) + } + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInstances sets the Instances field's value. +func (s *CreateCloudFormationStackInput) SetInstances(v []*InstanceEntry) *CreateCloudFormationStackInput { + s.Instances = v + return s +} + +type CreateCloudFormationStackOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s CreateCloudFormationStackOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateCloudFormationStackOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *CreateCloudFormationStackOutput) SetOperations(v []*Operation) *CreateCloudFormationStackOutput { + s.Operations = v + return s +} + type CreateDiskFromSnapshotInput struct { _ struct{} `type:"structure"` @@ -8270,6 +11975,11 @@ type CreateDiskFromSnapshotInput struct { // // SizeInGb is a required field SizeInGb *int64 `locationName:"sizeInGb" type:"integer" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -8328,6 +12038,12 @@ func (s *CreateDiskFromSnapshotInput) SetSizeInGb(v int64) *CreateDiskFromSnapsh return s } +// SetTags sets the Tags field's value. +func (s *CreateDiskFromSnapshotInput) SetTags(v []*Tag) *CreateDiskFromSnapshotInput { + s.Tags = v + return s +} + type CreateDiskFromSnapshotOutput struct { _ struct{} `type:"structure"` @@ -8373,6 +12089,11 @@ type CreateDiskInput struct { // // SizeInGb is a required field SizeInGb *int64 `locationName:"sizeInGb" type:"integer" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -8422,6 +12143,12 @@ func (s *CreateDiskInput) SetSizeInGb(v int64) *CreateDiskInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateDiskInput) SetTags(v []*Tag) *CreateDiskInput { + s.Tags = v + return s +} + type CreateDiskOutput struct { _ struct{} `type:"structure"` @@ -8448,16 +12175,29 @@ func (s *CreateDiskOutput) SetOperations(v []*Operation) *CreateDiskOutput { type CreateDiskSnapshotInput struct { _ struct{} `type:"structure"` - // The unique name of the source disk (e.g., my-source-disk). + // The unique name of the source disk (e.g., Disk-Virginia-1). // - // DiskName is a required field - DiskName *string `locationName:"diskName" type:"string" required:"true"` + // This parameter cannot be defined together with the instance name parameter. + // The disk name and instance name parameters are mutually exclusive. + DiskName *string `locationName:"diskName" type:"string"` // The name of the destination disk snapshot (e.g., my-disk-snapshot) based // on the source disk. // // DiskSnapshotName is a required field DiskSnapshotName *string `locationName:"diskSnapshotName" type:"string" required:"true"` + + // The unique name of the source instance (e.g., Amazon_Linux-512MB-Virginia-1). + // When this is defined, a snapshot of the instance's system volume is created. + // + // This parameter cannot be defined together with the disk name parameter. The + // instance name and disk name parameters are mutually exclusive. + InstanceName *string `locationName:"instanceName" type:"string"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -8473,9 +12213,6 @@ func (s CreateDiskSnapshotInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *CreateDiskSnapshotInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "CreateDiskSnapshotInput"} - if s.DiskName == nil { - invalidParams.Add(request.NewErrParamRequired("DiskName")) - } if s.DiskSnapshotName == nil { invalidParams.Add(request.NewErrParamRequired("DiskSnapshotName")) } @@ -8498,6 +12235,18 @@ func (s *CreateDiskSnapshotInput) SetDiskSnapshotName(v string) *CreateDiskSnaps return s } +// SetInstanceName sets the InstanceName field's value. +func (s *CreateDiskSnapshotInput) SetInstanceName(v string) *CreateDiskSnapshotInput { + s.InstanceName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateDiskSnapshotInput) SetTags(v []*Tag) *CreateDiskSnapshotInput { + s.Tags = v + return s +} + type CreateDiskSnapshotOutput struct { _ struct{} `type:"structure"` @@ -8610,6 +12359,11 @@ type CreateDomainInput struct { // // DomainName is a required field DomainName *string `locationName:"domainName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -8641,6 +12395,12 @@ func (s *CreateDomainInput) SetDomainName(v string) *CreateDomainInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateDomainInput) SetTags(v []*Tag) *CreateDomainInput { + s.Tags = v + return s +} + type CreateDomainOutput struct { _ struct{} `type:"structure"` @@ -8677,6 +12437,11 @@ type CreateInstanceSnapshotInput struct { // // InstanceSnapshotName is a required field InstanceSnapshotName *string `locationName:"instanceSnapshotName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -8717,6 +12482,12 @@ func (s *CreateInstanceSnapshotInput) SetInstanceSnapshotName(v string) *CreateI return s } +// SetTags sets the Tags field's value. +func (s *CreateInstanceSnapshotInput) SetTags(v []*Tag) *CreateInstanceSnapshotInput { + s.Tags = v + return s +} + type CreateInstanceSnapshotOutput struct { _ struct{} `type:"structure"` @@ -8748,9 +12519,9 @@ type CreateInstancesFromSnapshotInput struct { AttachedDiskMapping map[string][]*DiskMap `locationName:"attachedDiskMapping" type:"map"` // The Availability Zone where you want to create your instances. Use the following - // formatting: us-east-2a (case sensitive). You can get a list of availability - // zones by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html) - // operation. Be sure to add the include availability zones parameter to your + // formatting: us-east-2a (case sensitive). You can get a list of Availability + // Zones by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html) + // operation. Be sure to add the include Availability Zones parameter to your // request. // // AvailabilityZone is a required field @@ -8777,13 +12548,18 @@ type CreateInstancesFromSnapshotInput struct { // The name for your key pair. KeyPairName *string `locationName:"keyPairName" type:"string"` + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` + // You can create a launch script that configures a server with additional user // data. For example, apt-get -y update. // // Depending on the machine image you choose, the command to get software on // your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu // use apt-get, and FreeBSD uses pkg. For a complete list, see the Dev Guide - // (http://lightsail.aws.amazon.com/ls/docs/getting-started/articles/pre-installed-apps). + // (https://lightsail.aws.amazon.com/ls/docs/getting-started/article/compare-options-choose-lightsail-instance-image). UserData *string `locationName:"userData" type:"string"` } @@ -8855,6 +12631,12 @@ func (s *CreateInstancesFromSnapshotInput) SetKeyPairName(v string) *CreateInsta return s } +// SetTags sets the Tags field's value. +func (s *CreateInstancesFromSnapshotInput) SetTags(v []*Tag) *CreateInstancesFromSnapshotInput { + s.Tags = v + return s +} + // SetUserData sets the UserData field's value. func (s *CreateInstancesFromSnapshotInput) SetUserData(v string) *CreateInstancesFromSnapshotInput { s.UserData = &v @@ -8889,9 +12671,9 @@ type CreateInstancesInput struct { _ struct{} `type:"structure"` // The Availability Zone in which to create your instance. Use the following - // format: us-east-2a (case sensitive). You can get a list of availability zones + // format: us-east-2a (case sensitive). You can get a list of Availability Zones // by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html) - // operation. Be sure to add the include availability zones parameter to your + // operation. Be sure to add the include Availability Zones parameter to your // request. // // AvailabilityZone is a required field @@ -8914,6 +12696,8 @@ type CreateInstancesInput struct { // // In releases prior to June 12, 2017, this parameter was ignored by the API. // It is now deprecated. + // + // Deprecated: CustomImageName has been deprecated CustomImageName *string `locationName:"customImageName" deprecated:"true" type:"string"` // The names to use for your new Lightsail instances. Separate multiple values @@ -8925,6 +12709,11 @@ type CreateInstancesInput struct { // The name of your key pair. KeyPairName *string `locationName:"keyPairName" type:"string"` + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` + // A launch script you can create that configures a server with additional user // data. For example, you might want to run apt-get -y update. // @@ -9003,6 +12792,12 @@ func (s *CreateInstancesInput) SetKeyPairName(v string) *CreateInstancesInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateInstancesInput) SetTags(v []*Tag) *CreateInstancesInput { + s.Tags = v + return s +} + // SetUserData sets the UserData field's value. func (s *CreateInstancesInput) SetUserData(v string) *CreateInstancesInput { s.UserData = &v @@ -9040,6 +12835,11 @@ type CreateKeyPairInput struct { // // KeyPairName is a required field KeyPairName *string `locationName:"keyPairName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -9071,6 +12871,12 @@ func (s *CreateKeyPairInput) SetKeyPairName(v string) *CreateKeyPairInput { return s } +// SetTags sets the Tags field's value. +func (s *CreateKeyPairInput) SetTags(v []*Tag) *CreateKeyPairInput { + s.Tags = v + return s +} + type CreateKeyPairOutput struct { _ struct{} `type:"structure"` @@ -9160,6 +12966,11 @@ type CreateLoadBalancerInput struct { // // LoadBalancerName is a required field LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -9224,6 +13035,12 @@ func (s *CreateLoadBalancerInput) SetLoadBalancerName(v string) *CreateLoadBalan return s } +// SetTags sets the Tags field's value. +func (s *CreateLoadBalancerInput) SetTags(v []*Tag) *CreateLoadBalancerInput { + s.Tags = v + return s +} + type CreateLoadBalancerOutput struct { _ struct{} `type:"structure"` @@ -9275,6 +13092,11 @@ type CreateLoadBalancerTlsCertificateInput struct { // // LoadBalancerName is a required field LoadBalancerName *string `locationName:"loadBalancerName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -9330,6 +13152,12 @@ func (s *CreateLoadBalancerTlsCertificateInput) SetLoadBalancerName(v string) *C return s } +// SetTags sets the Tags field's value. +func (s *CreateLoadBalancerTlsCertificateInput) SetTags(v []*Tag) *CreateLoadBalancerTlsCertificateInput { + s.Tags = v + return s +} + type CreateLoadBalancerTlsCertificateOutput struct { _ struct{} `type:"structure"` @@ -9353,6 +13181,523 @@ func (s *CreateLoadBalancerTlsCertificateOutput) SetOperations(v []*Operation) * return s } +type CreateRelationalDatabaseFromSnapshotInput struct { + _ struct{} `type:"structure"` + + // The Availability Zone in which to create your new database. Use the us-east-2a + // case-sensitive format. + // + // You can get a list of Availability Zones by using the get regions operation. + // Be sure to add the include relational database Availability Zones parameter + // to your request. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // Specifies the accessibility options for your new database. A value of true + // specifies a database that is available to resources outside of your Lightsail + // account. A value of false specifies a database that is available only to + // your Lightsail resources in the same region as your database. + PubliclyAccessible *bool `locationName:"publiclyAccessible" type:"boolean"` + + // The bundle ID for your new database. A bundle describes the performance specifications + // for your database. + // + // You can get a list of database bundle IDs by using the get relational database + // bundles operation. + // + // When creating a new database from a snapshot, you cannot choose a bundle + // that is smaller than the bundle of the source database. + RelationalDatabaseBundleId *string `locationName:"relationalDatabaseBundleId" type:"string"` + + // The name to use for your new database. + // + // Constraints: + // + // * Must contain from 2 to 255 alphanumeric characters, or hyphens. + // + // * The first and last character must be a letter or number. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // The name of the database snapshot from which to create your new database. + RelationalDatabaseSnapshotName *string `locationName:"relationalDatabaseSnapshotName" type:"string"` + + // The date and time to restore your database from. + // + // Constraints: + // + // * Must be before the latest restorable time for the database. + // + // * Cannot be specified if the use latest restorable time parameter is true. + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Specified in the Unix time format. For example, if you wish to use a + // restore time of October 1, 2018, at 8 PM UTC, then you input 1538424000 + // as the restore time. + RestoreTime *time.Time `locationName:"restoreTime" type:"timestamp"` + + // The name of the source database. + SourceRelationalDatabaseName *string `locationName:"sourceRelationalDatabaseName" type:"string"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` + + // Specifies whether your database is restored from the latest backup time. + // A value of true restores from the latest backup time. + // + // Default: false + // + // Constraints: Cannot be specified if the restore time parameter is provided. + UseLatestRestorableTime *bool `locationName:"useLatestRestorableTime" type:"boolean"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseFromSnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseFromSnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRelationalDatabaseFromSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRelationalDatabaseFromSnapshotInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAvailabilityZone sets the AvailabilityZone field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetAvailabilityZone(v string) *CreateRelationalDatabaseFromSnapshotInput { + s.AvailabilityZone = &v + return s +} + +// SetPubliclyAccessible sets the PubliclyAccessible field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetPubliclyAccessible(v bool) *CreateRelationalDatabaseFromSnapshotInput { + s.PubliclyAccessible = &v + return s +} + +// SetRelationalDatabaseBundleId sets the RelationalDatabaseBundleId field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetRelationalDatabaseBundleId(v string) *CreateRelationalDatabaseFromSnapshotInput { + s.RelationalDatabaseBundleId = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetRelationalDatabaseName(v string) *CreateRelationalDatabaseFromSnapshotInput { + s.RelationalDatabaseName = &v + return s +} + +// SetRelationalDatabaseSnapshotName sets the RelationalDatabaseSnapshotName field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetRelationalDatabaseSnapshotName(v string) *CreateRelationalDatabaseFromSnapshotInput { + s.RelationalDatabaseSnapshotName = &v + return s +} + +// SetRestoreTime sets the RestoreTime field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetRestoreTime(v time.Time) *CreateRelationalDatabaseFromSnapshotInput { + s.RestoreTime = &v + return s +} + +// SetSourceRelationalDatabaseName sets the SourceRelationalDatabaseName field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetSourceRelationalDatabaseName(v string) *CreateRelationalDatabaseFromSnapshotInput { + s.SourceRelationalDatabaseName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetTags(v []*Tag) *CreateRelationalDatabaseFromSnapshotInput { + s.Tags = v + return s +} + +// SetUseLatestRestorableTime sets the UseLatestRestorableTime field's value. +func (s *CreateRelationalDatabaseFromSnapshotInput) SetUseLatestRestorableTime(v bool) *CreateRelationalDatabaseFromSnapshotInput { + s.UseLatestRestorableTime = &v + return s +} + +type CreateRelationalDatabaseFromSnapshotOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your create relational database from snapshot + // request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseFromSnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseFromSnapshotOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *CreateRelationalDatabaseFromSnapshotOutput) SetOperations(v []*Operation) *CreateRelationalDatabaseFromSnapshotOutput { + s.Operations = v + return s +} + +type CreateRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The Availability Zone in which to create your new database. Use the us-east-2a + // case-sensitive format. + // + // You can get a list of Availability Zones by using the get regions operation. + // Be sure to add the include relational database Availability Zones parameter + // to your request. + AvailabilityZone *string `locationName:"availabilityZone" type:"string"` + + // The name of the master database created when the Lightsail database resource + // is created. + // + // Constraints: + // + // * Must contain from 1 to 64 alphanumeric characters. + // + // * Cannot be a word reserved by the specified database engine + // + // MasterDatabaseName is a required field + MasterDatabaseName *string `locationName:"masterDatabaseName" type:"string" required:"true"` + + // The password for the master user of your new database. The password can include + // any printable ASCII character except "/", """, or "@". + // + // Constraints: Must contain 8 to 41 characters. + MasterUserPassword *string `locationName:"masterUserPassword" type:"string" sensitive:"true"` + + // The master user name for your new database. + // + // Constraints: + // + // * Master user name is required. + // + // * Must contain from 1 to 16 alphanumeric characters. + // + // * The first character must be a letter. + // + // * Cannot be a reserved word for the database engine you choose. For more + // information about reserved words in MySQL 5.6 or 5.7, see the Keywords + // and Reserved Words articles for MySQL 5.6 (https://dev.mysql.com/doc/refman/5.6/en/keywords.html) + // or MySQL 5.7 (https://dev.mysql.com/doc/refman/5.7/en/keywords.html) respectively. + // + // MasterUsername is a required field + MasterUsername *string `locationName:"masterUsername" type:"string" required:"true"` + + // The daily time range during which automated backups are created for your + // new database if automated backups are enabled. + // + // The default is a 30-minute window selected at random from an 8-hour block + // of time for each AWS Region. For more information about the preferred backup + // window time blocks for each region, see the Working With Backups (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_WorkingWithAutomatedBackups.html#USER_WorkingWithAutomatedBackups.BackupWindow) + // guide in the Amazon Relational Database Service (Amazon RDS) documentation. + // + // Constraints: + // + // * Must be in the hh24:mi-hh24:mi format. Example: 16:00-16:30 + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Must not conflict with the preferred maintenance window. + // + // * Must be at least 30 minutes. + PreferredBackupWindow *string `locationName:"preferredBackupWindow" type:"string"` + + // The weekly time range during which system maintenance can occur on your new + // database. + // + // The default is a 30-minute window selected at random from an 8-hour block + // of time for each AWS Region, occurring on a random day of the week. + // + // Constraints: + // + // * Must be in the ddd:hh24:mi-ddd:hh24:mi format. + // + // * Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. + // + // * Must be at least 30 minutes. + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Example: Tue:17:00-Tue:17:30 + PreferredMaintenanceWindow *string `locationName:"preferredMaintenanceWindow" type:"string"` + + // Specifies the accessibility options for your new database. A value of true + // specifies a database that is available to resources outside of your Lightsail + // account. A value of false specifies a database that is available only to + // your Lightsail resources in the same region as your database. + PubliclyAccessible *bool `locationName:"publiclyAccessible" type:"boolean"` + + // The blueprint ID for your new database. A blueprint describes the major engine + // version of a database. + // + // You can get a list of database blueprints IDs by using the get relational + // database blueprints operation. + // + // RelationalDatabaseBlueprintId is a required field + RelationalDatabaseBlueprintId *string `locationName:"relationalDatabaseBlueprintId" type:"string" required:"true"` + + // The bundle ID for your new database. A bundle describes the performance specifications + // for your database. + // + // You can get a list of database bundle IDs by using the get relational database + // bundles operation. + // + // RelationalDatabaseBundleId is a required field + RelationalDatabaseBundleId *string `locationName:"relationalDatabaseBundleId" type:"string" required:"true"` + + // The name to use for your new database. + // + // Constraints: + // + // * Must contain from 2 to 255 alphanumeric characters, or hyphens. + // + // * The first and last character must be a letter or number. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRelationalDatabaseInput"} + if s.MasterDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("MasterDatabaseName")) + } + if s.MasterUsername == nil { + invalidParams.Add(request.NewErrParamRequired("MasterUsername")) + } + if s.RelationalDatabaseBlueprintId == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseBlueprintId")) + } + if s.RelationalDatabaseBundleId == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseBundleId")) + } + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAvailabilityZone sets the AvailabilityZone field's value. +func (s *CreateRelationalDatabaseInput) SetAvailabilityZone(v string) *CreateRelationalDatabaseInput { + s.AvailabilityZone = &v + return s +} + +// SetMasterDatabaseName sets the MasterDatabaseName field's value. +func (s *CreateRelationalDatabaseInput) SetMasterDatabaseName(v string) *CreateRelationalDatabaseInput { + s.MasterDatabaseName = &v + return s +} + +// SetMasterUserPassword sets the MasterUserPassword field's value. +func (s *CreateRelationalDatabaseInput) SetMasterUserPassword(v string) *CreateRelationalDatabaseInput { + s.MasterUserPassword = &v + return s +} + +// SetMasterUsername sets the MasterUsername field's value. +func (s *CreateRelationalDatabaseInput) SetMasterUsername(v string) *CreateRelationalDatabaseInput { + s.MasterUsername = &v + return s +} + +// SetPreferredBackupWindow sets the PreferredBackupWindow field's value. +func (s *CreateRelationalDatabaseInput) SetPreferredBackupWindow(v string) *CreateRelationalDatabaseInput { + s.PreferredBackupWindow = &v + return s +} + +// SetPreferredMaintenanceWindow sets the PreferredMaintenanceWindow field's value. +func (s *CreateRelationalDatabaseInput) SetPreferredMaintenanceWindow(v string) *CreateRelationalDatabaseInput { + s.PreferredMaintenanceWindow = &v + return s +} + +// SetPubliclyAccessible sets the PubliclyAccessible field's value. +func (s *CreateRelationalDatabaseInput) SetPubliclyAccessible(v bool) *CreateRelationalDatabaseInput { + s.PubliclyAccessible = &v + return s +} + +// SetRelationalDatabaseBlueprintId sets the RelationalDatabaseBlueprintId field's value. +func (s *CreateRelationalDatabaseInput) SetRelationalDatabaseBlueprintId(v string) *CreateRelationalDatabaseInput { + s.RelationalDatabaseBlueprintId = &v + return s +} + +// SetRelationalDatabaseBundleId sets the RelationalDatabaseBundleId field's value. +func (s *CreateRelationalDatabaseInput) SetRelationalDatabaseBundleId(v string) *CreateRelationalDatabaseInput { + s.RelationalDatabaseBundleId = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *CreateRelationalDatabaseInput) SetRelationalDatabaseName(v string) *CreateRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateRelationalDatabaseInput) SetTags(v []*Tag) *CreateRelationalDatabaseInput { + s.Tags = v + return s +} + +type CreateRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your create relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *CreateRelationalDatabaseOutput) SetOperations(v []*Operation) *CreateRelationalDatabaseOutput { + s.Operations = v + return s +} + +type CreateRelationalDatabaseSnapshotInput struct { + _ struct{} `type:"structure"` + + // The name of the database on which to base your new snapshot. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // The name for your new database snapshot. + // + // Constraints: + // + // * Must contain from 2 to 255 alphanumeric characters, or hyphens. + // + // * The first and last character must be a letter or number. + // + // RelationalDatabaseSnapshotName is a required field + RelationalDatabaseSnapshotName *string `locationName:"relationalDatabaseSnapshotName" type:"string" required:"true"` + + // The tag keys and optional values to add to the resource during create. + // + // To tag a resource after it has been created, see the tag resource operation. + Tags []*Tag `locationName:"tags" type:"list"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseSnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseSnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateRelationalDatabaseSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateRelationalDatabaseSnapshotInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + if s.RelationalDatabaseSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseSnapshotName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *CreateRelationalDatabaseSnapshotInput) SetRelationalDatabaseName(v string) *CreateRelationalDatabaseSnapshotInput { + s.RelationalDatabaseName = &v + return s +} + +// SetRelationalDatabaseSnapshotName sets the RelationalDatabaseSnapshotName field's value. +func (s *CreateRelationalDatabaseSnapshotInput) SetRelationalDatabaseSnapshotName(v string) *CreateRelationalDatabaseSnapshotInput { + s.RelationalDatabaseSnapshotName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *CreateRelationalDatabaseSnapshotInput) SetTags(v []*Tag) *CreateRelationalDatabaseSnapshotInput { + s.Tags = v + return s +} + +type CreateRelationalDatabaseSnapshotOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your create relational database snapshot + // request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s CreateRelationalDatabaseSnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateRelationalDatabaseSnapshotOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *CreateRelationalDatabaseSnapshotOutput) SetOperations(v []*Operation) *CreateRelationalDatabaseSnapshotOutput { + s.Operations = v + return s +} + type DeleteDiskInput struct { _ struct{} `type:"structure"` @@ -9799,6 +14144,67 @@ func (s *DeleteKeyPairOutput) SetOperation(v *Operation) *DeleteKeyPairOutput { return s } +type DeleteKnownHostKeysInput struct { + _ struct{} `type:"structure"` + + // The name of the instance for which you want to reset the host key or certificate. + // + // InstanceName is a required field + InstanceName *string `locationName:"instanceName" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteKnownHostKeysInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteKnownHostKeysInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteKnownHostKeysInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteKnownHostKeysInput"} + if s.InstanceName == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInstanceName sets the InstanceName field's value. +func (s *DeleteKnownHostKeysInput) SetInstanceName(v string) *DeleteKnownHostKeysInput { + s.InstanceName = &v + return s +} + +type DeleteKnownHostKeysOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s DeleteKnownHostKeysOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteKnownHostKeysOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *DeleteKnownHostKeysOutput) SetOperations(v []*Operation) *DeleteKnownHostKeysOutput { + s.Operations = v + return s +} + type DeleteLoadBalancerInput struct { _ struct{} `type:"structure"` @@ -9948,6 +14354,197 @@ func (s *DeleteLoadBalancerTlsCertificateOutput) SetOperations(v []*Operation) * return s } +type DeleteRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The name of the database snapshot created if skip final snapshot is false, + // which is the default value for that parameter. + // + // Specifying this parameter and also specifying the skip final snapshot parameter + // to true results in an error. + // + // Constraints: + // + // * Must contain from 2 to 255 alphanumeric characters, or hyphens. + // + // * The first and last character must be a letter or number. + FinalRelationalDatabaseSnapshotName *string `locationName:"finalRelationalDatabaseSnapshotName" type:"string"` + + // The name of the database that you are deleting. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // Determines whether a final database snapshot is created before your database + // is deleted. If true is specified, no database snapshot is created. If false + // is specified, a database snapshot is created before your database is deleted. + // + // You must specify the final relational database snapshot name parameter if + // the skip final snapshot parameter is false. + // + // Default: false + SkipFinalSnapshot *bool `locationName:"skipFinalSnapshot" type:"boolean"` +} + +// String returns the string representation +func (s DeleteRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetFinalRelationalDatabaseSnapshotName sets the FinalRelationalDatabaseSnapshotName field's value. +func (s *DeleteRelationalDatabaseInput) SetFinalRelationalDatabaseSnapshotName(v string) *DeleteRelationalDatabaseInput { + s.FinalRelationalDatabaseSnapshotName = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *DeleteRelationalDatabaseInput) SetRelationalDatabaseName(v string) *DeleteRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +// SetSkipFinalSnapshot sets the SkipFinalSnapshot field's value. +func (s *DeleteRelationalDatabaseInput) SetSkipFinalSnapshot(v bool) *DeleteRelationalDatabaseInput { + s.SkipFinalSnapshot = &v + return s +} + +type DeleteRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your delete relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s DeleteRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *DeleteRelationalDatabaseOutput) SetOperations(v []*Operation) *DeleteRelationalDatabaseOutput { + s.Operations = v + return s +} + +type DeleteRelationalDatabaseSnapshotInput struct { + _ struct{} `type:"structure"` + + // The name of the database snapshot that you are deleting. + // + // RelationalDatabaseSnapshotName is a required field + RelationalDatabaseSnapshotName *string `locationName:"relationalDatabaseSnapshotName" type:"string" required:"true"` +} + +// String returns the string representation +func (s DeleteRelationalDatabaseSnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRelationalDatabaseSnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteRelationalDatabaseSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteRelationalDatabaseSnapshotInput"} + if s.RelationalDatabaseSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseSnapshotName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseSnapshotName sets the RelationalDatabaseSnapshotName field's value. +func (s *DeleteRelationalDatabaseSnapshotInput) SetRelationalDatabaseSnapshotName(v string) *DeleteRelationalDatabaseSnapshotInput { + s.RelationalDatabaseSnapshotName = &v + return s +} + +type DeleteRelationalDatabaseSnapshotOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your delete relational database snapshot + // request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s DeleteRelationalDatabaseSnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteRelationalDatabaseSnapshotOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *DeleteRelationalDatabaseSnapshotOutput) SetOperations(v []*Operation) *DeleteRelationalDatabaseSnapshotOutput { + s.Operations = v + return s +} + +// Describes the destination of a record. +type DestinationInfo struct { + _ struct{} `type:"structure"` + + // The ID of the resource created at the destination. + Id *string `locationName:"id" type:"string"` + + // The destination service of the record. + Service *string `locationName:"service" type:"string"` +} + +// String returns the string representation +func (s DestinationInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DestinationInfo) GoString() string { + return s.String() +} + +// SetId sets the Id field's value. +func (s *DestinationInfo) SetId(v string) *DestinationInfo { + s.Id = &v + return s +} + +// SetService sets the Service field's value. +func (s *DestinationInfo) SetService(v string) *DestinationInfo { + s.Service = &v + return s +} + type DetachDiskInput struct { _ struct{} `type:"structure"` @@ -10163,6 +14760,8 @@ type Disk struct { // In releases prior to November 14, 2017, this parameter returned attached // for system disks in the API response. It is now deprecated, but still included // in the response. Use isAttached instead. + // + // Deprecated: AttachmentState has been deprecated AttachmentState *string `locationName:"attachmentState" deprecated:"true" type:"string"` // The date when the disk was created. @@ -10172,6 +14771,8 @@ type Disk struct { // // In releases prior to November 14, 2017, this parameter was not included in // the API response. It is now deprecated. + // + // Deprecated: GbInUse has been deprecated GbInUse *int64 `locationName:"gbInUse" deprecated:"true" type:"integer"` // The input/output operations per second (IOPS) of the disk. @@ -10206,6 +14807,10 @@ type Disk struct { // questions about an instance or another resource in Lightsail. This code enables // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -10308,6 +14913,64 @@ func (s *Disk) SetSupportCode(v string) *Disk { return s } +// SetTags sets the Tags field's value. +func (s *Disk) SetTags(v []*Tag) *Disk { + s.Tags = v + return s +} + +// Describes a disk. +type DiskInfo struct { + _ struct{} `type:"structure"` + + // A Boolean value indicating whether this disk is a system disk (has an operating + // system loaded on it). + IsSystemDisk *bool `locationName:"isSystemDisk" type:"boolean"` + + // The disk name. + Name *string `locationName:"name" type:"string"` + + // The disk path. + Path *string `locationName:"path" type:"string"` + + // The size of the disk in GB (e.g., 32). + SizeInGb *int64 `locationName:"sizeInGb" type:"integer"` +} + +// String returns the string representation +func (s DiskInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DiskInfo) GoString() string { + return s.String() +} + +// SetIsSystemDisk sets the IsSystemDisk field's value. +func (s *DiskInfo) SetIsSystemDisk(v bool) *DiskInfo { + s.IsSystemDisk = &v + return s +} + +// SetName sets the Name field's value. +func (s *DiskInfo) SetName(v string) *DiskInfo { + s.Name = &v + return s +} + +// SetPath sets the Path field's value. +func (s *DiskInfo) SetPath(v string) *DiskInfo { + s.Path = &v + return s +} + +// SetSizeInGb sets the SizeInGb field's value. +func (s *DiskInfo) SetSizeInGb(v int64) *DiskInfo { + s.SizeInGb = &v + return s +} + // Describes a block storage disk mapping. type DiskMap struct { _ struct{} `type:"structure"` @@ -10351,13 +15014,21 @@ type DiskSnapshot struct { // The date when the disk snapshot was created. CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` - // The Amazon Resource Name (ARN) of the source disk from which you are creating - // the disk snapshot. + // The Amazon Resource Name (ARN) of the source disk from which the disk snapshot + // was created. FromDiskArn *string `locationName:"fromDiskArn" type:"string"` - // The unique name of the source disk from which you are creating the disk snapshot. + // The unique name of the source disk from which the disk snapshot was created. FromDiskName *string `locationName:"fromDiskName" type:"string"` + // The Amazon Resource Name (ARN) of the source instance from which the disk + // (system volume) snapshot was created. + FromInstanceArn *string `locationName:"fromInstanceArn" type:"string"` + + // The unique name of the source instance from which the disk (system volume) + // snapshot was created. + FromInstanceName *string `locationName:"fromInstanceName" type:"string"` + // The AWS Region and Availability Zone where the disk snapshot was created. Location *ResourceLocation `locationName:"location" type:"structure"` @@ -10380,6 +15051,10 @@ type DiskSnapshot struct { // questions about an instance or another resource in Lightsail. This code enables // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -10416,6 +15091,18 @@ func (s *DiskSnapshot) SetFromDiskName(v string) *DiskSnapshot { return s } +// SetFromInstanceArn sets the FromInstanceArn field's value. +func (s *DiskSnapshot) SetFromInstanceArn(v string) *DiskSnapshot { + s.FromInstanceArn = &v + return s +} + +// SetFromInstanceName sets the FromInstanceName field's value. +func (s *DiskSnapshot) SetFromInstanceName(v string) *DiskSnapshot { + s.FromInstanceName = &v + return s +} + // SetLocation sets the Location field's value. func (s *DiskSnapshot) SetLocation(v *ResourceLocation) *DiskSnapshot { s.Location = v @@ -10458,6 +15145,36 @@ func (s *DiskSnapshot) SetSupportCode(v string) *DiskSnapshot { return s } +// SetTags sets the Tags field's value. +func (s *DiskSnapshot) SetTags(v []*Tag) *DiskSnapshot { + s.Tags = v + return s +} + +// Describes a disk snapshot. +type DiskSnapshotInfo struct { + _ struct{} `type:"structure"` + + // The size of the disk in GB (e.g., 32). + SizeInGb *int64 `locationName:"sizeInGb" type:"integer"` +} + +// String returns the string representation +func (s DiskSnapshotInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DiskSnapshotInfo) GoString() string { + return s.String() +} + +// SetSizeInGb sets the SizeInGb field's value. +func (s *DiskSnapshotInfo) SetSizeInGb(v int64) *DiskSnapshotInfo { + s.SizeInGb = &v + return s +} + // Describes a domain where you are storing recordsets in Lightsail. type Domain struct { _ struct{} `type:"structure"` @@ -10484,6 +15201,10 @@ type Domain struct { // questions about an instance or another resource in Lightsail. This code enables // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -10538,6 +15259,12 @@ func (s *Domain) SetSupportCode(v string) *Domain { return s } +// SetTags sets the Tags field's value. +func (s *Domain) SetTags(v []*Tag) *Domain { + s.Tags = v + return s +} + // Describes a domain recordset entry. type DomainEntry struct { _ struct{} `type:"structure"` @@ -10558,6 +15285,8 @@ type DomainEntry struct { // // In releases prior to November 29, 2017, this parameter was not included in // the API response. It is now deprecated. + // + // Deprecated: Options has been deprecated Options map[string]*string `locationName:"options" deprecated:"true" type:"map"` // The target AWS name server (e.g., ns-111.awsdns-22.com.). @@ -10567,7 +15296,25 @@ type DomainEntry struct { // balancer. Target *string `locationName:"target" type:"string"` - // The type of domain entry (e.g., SOA or NS). + // The type of domain entry, such as address (A), canonical name (CNAME), mail + // exchanger (MX), name server (NS), start of authority (SOA), service locator + // (SRV), or text (TXT). + // + // The following domain entry types can be used: + // + // * A + // + // * CNAME + // + // * MX + // + // * NS + // + // * SOA + // + // * SRV + // + // * TXT Type *string `locationName:"type" type:"string"` } @@ -10663,6 +15410,242 @@ func (s *DownloadDefaultKeyPairOutput) SetPublicKeyBase64(v string) *DownloadDef return s } +type ExportSnapshotInput struct { + _ struct{} `type:"structure"` + + // The name of the instance or disk snapshot to be exported to Amazon EC2. + // + // SourceSnapshotName is a required field + SourceSnapshotName *string `locationName:"sourceSnapshotName" type:"string" required:"true"` +} + +// String returns the string representation +func (s ExportSnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportSnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ExportSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ExportSnapshotInput"} + if s.SourceSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("SourceSnapshotName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetSourceSnapshotName sets the SourceSnapshotName field's value. +func (s *ExportSnapshotInput) SetSourceSnapshotName(v string) *ExportSnapshotInput { + s.SourceSnapshotName = &v + return s +} + +type ExportSnapshotOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s ExportSnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportSnapshotOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *ExportSnapshotOutput) SetOperations(v []*Operation) *ExportSnapshotOutput { + s.Operations = v + return s +} + +// Describes an export snapshot record. +type ExportSnapshotRecord struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the export snapshot record. + Arn *string `locationName:"arn" type:"string"` + + // The date when the export snapshot record was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // A list of objects describing the destination of the export snapshot record. + DestinationInfo *DestinationInfo `locationName:"destinationInfo" type:"structure"` + + // The AWS Region and Availability Zone where the export snapshot record is + // located. + Location *ResourceLocation `locationName:"location" type:"structure"` + + // The export snapshot record name. + Name *string `locationName:"name" type:"string"` + + // The Lightsail resource type (e.g., ExportSnapshotRecord). + ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` + + // A list of objects describing the source of the export snapshot record. + SourceInfo *ExportSnapshotRecordSourceInfo `locationName:"sourceInfo" type:"structure"` + + // The state of the export snapshot record. + State *string `locationName:"state" type:"string" enum:"RecordState"` +} + +// String returns the string representation +func (s ExportSnapshotRecord) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportSnapshotRecord) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *ExportSnapshotRecord) SetArn(v string) *ExportSnapshotRecord { + s.Arn = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *ExportSnapshotRecord) SetCreatedAt(v time.Time) *ExportSnapshotRecord { + s.CreatedAt = &v + return s +} + +// SetDestinationInfo sets the DestinationInfo field's value. +func (s *ExportSnapshotRecord) SetDestinationInfo(v *DestinationInfo) *ExportSnapshotRecord { + s.DestinationInfo = v + return s +} + +// SetLocation sets the Location field's value. +func (s *ExportSnapshotRecord) SetLocation(v *ResourceLocation) *ExportSnapshotRecord { + s.Location = v + return s +} + +// SetName sets the Name field's value. +func (s *ExportSnapshotRecord) SetName(v string) *ExportSnapshotRecord { + s.Name = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *ExportSnapshotRecord) SetResourceType(v string) *ExportSnapshotRecord { + s.ResourceType = &v + return s +} + +// SetSourceInfo sets the SourceInfo field's value. +func (s *ExportSnapshotRecord) SetSourceInfo(v *ExportSnapshotRecordSourceInfo) *ExportSnapshotRecord { + s.SourceInfo = v + return s +} + +// SetState sets the State field's value. +func (s *ExportSnapshotRecord) SetState(v string) *ExportSnapshotRecord { + s.State = &v + return s +} + +// Describes the source of an export snapshot record. +type ExportSnapshotRecordSourceInfo struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the source instance or disk snapshot. + Arn *string `locationName:"arn" type:"string"` + + // The date when the source instance or disk snapshot was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // A list of objects describing a disk snapshot. + DiskSnapshotInfo *DiskSnapshotInfo `locationName:"diskSnapshotInfo" type:"structure"` + + // The Amazon Resource Name (ARN) of the snapshot's source instance or disk. + FromResourceArn *string `locationName:"fromResourceArn" type:"string"` + + // The name of the snapshot's source instance or disk. + FromResourceName *string `locationName:"fromResourceName" type:"string"` + + // A list of objects describing an instance snapshot. + InstanceSnapshotInfo *InstanceSnapshotInfo `locationName:"instanceSnapshotInfo" type:"structure"` + + // The name of the source instance or disk snapshot. + Name *string `locationName:"name" type:"string"` + + // The Lightsail resource type (e.g., InstanceSnapshot or DiskSnapshot). + ResourceType *string `locationName:"resourceType" type:"string" enum:"ExportSnapshotRecordSourceType"` +} + +// String returns the string representation +func (s ExportSnapshotRecordSourceInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ExportSnapshotRecordSourceInfo) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *ExportSnapshotRecordSourceInfo) SetArn(v string) *ExportSnapshotRecordSourceInfo { + s.Arn = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *ExportSnapshotRecordSourceInfo) SetCreatedAt(v time.Time) *ExportSnapshotRecordSourceInfo { + s.CreatedAt = &v + return s +} + +// SetDiskSnapshotInfo sets the DiskSnapshotInfo field's value. +func (s *ExportSnapshotRecordSourceInfo) SetDiskSnapshotInfo(v *DiskSnapshotInfo) *ExportSnapshotRecordSourceInfo { + s.DiskSnapshotInfo = v + return s +} + +// SetFromResourceArn sets the FromResourceArn field's value. +func (s *ExportSnapshotRecordSourceInfo) SetFromResourceArn(v string) *ExportSnapshotRecordSourceInfo { + s.FromResourceArn = &v + return s +} + +// SetFromResourceName sets the FromResourceName field's value. +func (s *ExportSnapshotRecordSourceInfo) SetFromResourceName(v string) *ExportSnapshotRecordSourceInfo { + s.FromResourceName = &v + return s +} + +// SetInstanceSnapshotInfo sets the InstanceSnapshotInfo field's value. +func (s *ExportSnapshotRecordSourceInfo) SetInstanceSnapshotInfo(v *InstanceSnapshotInfo) *ExportSnapshotRecordSourceInfo { + s.InstanceSnapshotInfo = v + return s +} + +// SetName sets the Name field's value. +func (s *ExportSnapshotRecordSourceInfo) SetName(v string) *ExportSnapshotRecordSourceInfo { + s.Name = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *ExportSnapshotRecordSourceInfo) SetResourceType(v string) *ExportSnapshotRecordSourceInfo { + s.ResourceType = &v + return s +} + type GetActiveNamesInput struct { _ struct{} `type:"structure"` @@ -10854,6 +15837,63 @@ func (s *GetBundlesOutput) SetNextPageToken(v string) *GetBundlesOutput { return s } +type GetCloudFormationStackRecordsInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get cloud + // formation stack records request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetCloudFormationStackRecordsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCloudFormationStackRecordsInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetCloudFormationStackRecordsInput) SetPageToken(v string) *GetCloudFormationStackRecordsInput { + s.PageToken = &v + return s +} + +type GetCloudFormationStackRecordsOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the CloudFormation stack records. + CloudFormationStackRecords []*CloudFormationStackRecord `locationName:"cloudFormationStackRecords" type:"list"` + + // A token used for advancing to the next page of results of your get relational + // database bundles request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` +} + +// String returns the string representation +func (s GetCloudFormationStackRecordsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetCloudFormationStackRecordsOutput) GoString() string { + return s.String() +} + +// SetCloudFormationStackRecords sets the CloudFormationStackRecords field's value. +func (s *GetCloudFormationStackRecordsOutput) SetCloudFormationStackRecords(v []*CloudFormationStackRecord) *GetCloudFormationStackRecordsOutput { + s.CloudFormationStackRecords = v + return s +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetCloudFormationStackRecordsOutput) SetNextPageToken(v string) *GetCloudFormationStackRecordsOutput { + s.NextPageToken = &v + return s +} + type GetDiskInput struct { _ struct{} `type:"structure"` @@ -11210,6 +16250,63 @@ func (s *GetDomainsOutput) SetNextPageToken(v string) *GetDomainsOutput { return s } +type GetExportSnapshotRecordsInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get export + // snapshot records request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetExportSnapshotRecordsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetExportSnapshotRecordsInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetExportSnapshotRecordsInput) SetPageToken(v string) *GetExportSnapshotRecordsInput { + s.PageToken = &v + return s +} + +type GetExportSnapshotRecordsOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the export snapshot records. + ExportSnapshotRecords []*ExportSnapshotRecord `locationName:"exportSnapshotRecords" type:"list"` + + // A token used for advancing to the next page of results of your get relational + // database bundles request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` +} + +// String returns the string representation +func (s GetExportSnapshotRecordsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetExportSnapshotRecordsOutput) GoString() string { + return s.String() +} + +// SetExportSnapshotRecords sets the ExportSnapshotRecords field's value. +func (s *GetExportSnapshotRecordsOutput) SetExportSnapshotRecords(v []*ExportSnapshotRecord) *GetExportSnapshotRecordsOutput { + s.ExportSnapshotRecords = v + return s +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetExportSnapshotRecordsOutput) SetNextPageToken(v string) *GetExportSnapshotRecordsOutput { + s.NextPageToken = &v + return s +} + type GetInstanceAccessDetailsInput struct { _ struct{} `type:"structure"` @@ -11337,7 +16434,7 @@ type GetInstanceMetricDataInput struct { // MetricName is a required field MetricName *string `locationName:"metricName" type:"string" required:"true" enum:"InstanceMetricName"` - // The time period for which you are requesting data. + // The granularity, in seconds, of the returned data points. // // Period is a required field Period *int64 `locationName:"period" min:"60" type:"integer" required:"true"` @@ -11973,87 +17070,67 @@ type GetLoadBalancerMetricDataInput struct { // // * ClientTLSNegotiationErrorCount - The number of TLS connections initiated // by the client that did not establish a session with the load balancer. - // Possible causes include a mismatch of ciphers or protocols. - // - // Statistics: The most useful statistic is Sum. + // Possible causes include a mismatch of ciphers or protocols. Statistics: + // The most useful statistic is Sum. // // * HealthyHostCount - The number of target instances that are considered - // healthy. - // - // Statistics: The most useful statistic are Average, Minimum, and Maximum. + // healthy. Statistics: The most useful statistic are Average, Minimum, and + // Maximum. // // * UnhealthyHostCount - The number of target instances that are considered - // unhealthy. - // - // Statistics: The most useful statistic are Average, Minimum, and Maximum. + // unhealthy. Statistics: The most useful statistic are Average, Minimum, + // and Maximum. // // * HTTPCode_LB_4XX_Count - The number of HTTP 4XX client error codes that // originate from the load balancer. Client errors are generated when requests // are malformed or incomplete. These requests have not been received by // the target instance. This count does not include any response codes generated - // by the target instances. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the target instances. Statistics: The most useful statistic is Sum. + // Note that Minimum, Maximum, and Average all return 1. // // * HTTPCode_LB_5XX_Count - The number of HTTP 5XX server error codes that // originate from the load balancer. This count does not include any response - // codes generated by the target instances. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. Note that Minimum, Maximum, and Average all - // return 1. + // codes generated by the target instances. Statistics: The most useful statistic + // is Sum. Note that Minimum, Maximum, and Average all return 1. Note that + // Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_2XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_3XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_4XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_5XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * InstanceResponseTime - The time elapsed, in seconds, after the request // leaves the load balancer until a response from the target instance is - // received. - // - // Statistics: The most useful statistic is Average. + // received. Statistics: The most useful statistic is Average. // // * RejectedConnectionCount - The number of connections that were rejected // because the load balancer had reached its maximum number of connections. - // - // Statistics: The most useful statistic is Sum. + // Statistics: The most useful statistic is Sum. // // * RequestCount - The number of requests processed over IPv4. This count // includes only the requests with a response generated by a target instance - // of the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // of the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // MetricName is a required field MetricName *string `locationName:"metricName" type:"string" required:"true" enum:"LoadBalancerMetricName"` - // The time period duration for your health data request. + // The granularity, in seconds, of the returned data points. // // Period is a required field Period *int64 `locationName:"period" min:"60" type:"integer" required:"true"` @@ -12190,82 +17267,62 @@ type GetLoadBalancerMetricDataOutput struct { // // * ClientTLSNegotiationErrorCount - The number of TLS connections initiated // by the client that did not establish a session with the load balancer. - // Possible causes include a mismatch of ciphers or protocols. - // - // Statistics: The most useful statistic is Sum. + // Possible causes include a mismatch of ciphers or protocols. Statistics: + // The most useful statistic is Sum. // // * HealthyHostCount - The number of target instances that are considered - // healthy. - // - // Statistics: The most useful statistic are Average, Minimum, and Maximum. + // healthy. Statistics: The most useful statistic are Average, Minimum, and + // Maximum. // // * UnhealthyHostCount - The number of target instances that are considered - // unhealthy. - // - // Statistics: The most useful statistic are Average, Minimum, and Maximum. + // unhealthy. Statistics: The most useful statistic are Average, Minimum, + // and Maximum. // // * HTTPCode_LB_4XX_Count - The number of HTTP 4XX client error codes that // originate from the load balancer. Client errors are generated when requests // are malformed or incomplete. These requests have not been received by // the target instance. This count does not include any response codes generated - // by the target instances. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the target instances. Statistics: The most useful statistic is Sum. + // Note that Minimum, Maximum, and Average all return 1. // // * HTTPCode_LB_5XX_Count - The number of HTTP 5XX server error codes that // originate from the load balancer. This count does not include any response - // codes generated by the target instances. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. Note that Minimum, Maximum, and Average all - // return 1. + // codes generated by the target instances. Statistics: The most useful statistic + // is Sum. Note that Minimum, Maximum, and Average all return 1. Note that + // Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_2XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_3XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_4XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * HTTPCode_Instance_5XX_Count - The number of HTTP response codes generated // by the target instances. This does not include any response codes generated - // by the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // by the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. // // * InstanceResponseTime - The time elapsed, in seconds, after the request // leaves the load balancer until a response from the target instance is - // received. - // - // Statistics: The most useful statistic is Average. + // received. Statistics: The most useful statistic is Average. // // * RejectedConnectionCount - The number of connections that were rejected // because the load balancer had reached its maximum number of connections. - // - // Statistics: The most useful statistic is Sum. + // Statistics: The most useful statistic is Sum. // // * RequestCount - The number of requests processed over IPv4. This count // includes only the requests with a response generated by a target instance - // of the load balancer. - // - // Statistics: The most useful statistic is Sum. Note that Minimum, Maximum, - // and Average all return 1. + // of the load balancer. Statistics: The most useful statistic is Sum. Note + // that Minimum, Maximum, and Average all return 1. MetricName *string `locationName:"metricName" type:"string" enum:"LoadBalancerMetricName"` } @@ -12547,7 +17604,9 @@ type GetOperationsForResourceOutput struct { // (Deprecated) Returns the number of pages of results that remain. // // In releases prior to June 12, 2017, this parameter returned null by the API. - // It is now deprecated, and the API returns the nextPageToken parameter instead. + // It is now deprecated, and the API returns the next page token parameter instead. + // + // Deprecated: NextPageCount has been deprecated NextPageCount *string `locationName:"nextPageCount" deprecated:"true" type:"string"` // An identifier that was returned from the previous call to this operation, @@ -12652,6 +17711,11 @@ type GetRegionsInput struct { // your get regions request. Availability Zones are indicated with a letter: // e.g., us-east-2a. IncludeAvailabilityZones *bool `locationName:"includeAvailabilityZones" type:"boolean"` + + // >A Boolean value indicating whether to also include Availability Zones for + // databases in your get regions request. Availability Zones are indicated with + // a letter (e.g., us-east-2a). + IncludeRelationalDatabaseAvailabilityZones *bool `locationName:"includeRelationalDatabaseAvailabilityZones" type:"boolean"` } // String returns the string representation @@ -12670,6 +17734,12 @@ func (s *GetRegionsInput) SetIncludeAvailabilityZones(v bool) *GetRegionsInput { return s } +// SetIncludeRelationalDatabaseAvailabilityZones sets the IncludeRelationalDatabaseAvailabilityZones field's value. +func (s *GetRegionsInput) SetIncludeRelationalDatabaseAvailabilityZones(v bool) *GetRegionsInput { + s.IncludeRelationalDatabaseAvailabilityZones = &v + return s +} + type GetRegionsOutput struct { _ struct{} `type:"structure"` @@ -12694,6 +17764,1014 @@ func (s *GetRegionsOutput) SetRegions(v []*Region) *GetRegionsOutput { return s } +type GetRelationalDatabaseBlueprintsInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get relational + // database blueprints request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabaseBlueprintsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseBlueprintsInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseBlueprintsInput) SetPageToken(v string) *GetRelationalDatabaseBlueprintsInput { + s.PageToken = &v + return s +} + +type GetRelationalDatabaseBlueprintsOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your get relational database blueprints + // request. + Blueprints []*RelationalDatabaseBlueprint `locationName:"blueprints" type:"list"` + + // A token used for advancing to the next page of results of your get relational + // database blueprints request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabaseBlueprintsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseBlueprintsOutput) GoString() string { + return s.String() +} + +// SetBlueprints sets the Blueprints field's value. +func (s *GetRelationalDatabaseBlueprintsOutput) SetBlueprints(v []*RelationalDatabaseBlueprint) *GetRelationalDatabaseBlueprintsOutput { + s.Blueprints = v + return s +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabaseBlueprintsOutput) SetNextPageToken(v string) *GetRelationalDatabaseBlueprintsOutput { + s.NextPageToken = &v + return s +} + +type GetRelationalDatabaseBundlesInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get relational + // database bundles request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabaseBundlesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseBundlesInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseBundlesInput) SetPageToken(v string) *GetRelationalDatabaseBundlesInput { + s.PageToken = &v + return s +} + +type GetRelationalDatabaseBundlesOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your get relational database bundles request. + Bundles []*RelationalDatabaseBundle `locationName:"bundles" type:"list"` + + // A token used for advancing to the next page of results of your get relational + // database bundles request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabaseBundlesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseBundlesOutput) GoString() string { + return s.String() +} + +// SetBundles sets the Bundles field's value. +func (s *GetRelationalDatabaseBundlesOutput) SetBundles(v []*RelationalDatabaseBundle) *GetRelationalDatabaseBundlesOutput { + s.Bundles = v + return s +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabaseBundlesOutput) SetNextPageToken(v string) *GetRelationalDatabaseBundlesOutput { + s.NextPageToken = &v + return s +} + +type GetRelationalDatabaseEventsInput struct { + _ struct{} `type:"structure"` + + // The number of minutes in the past from which to retrieve events. For example, + // to get all events from the past 2 hours, enter 120. + // + // Default: 60 + // + // The minimum is 1 and the maximum is 14 days (20160 minutes). + DurationInMinutes *int64 `locationName:"durationInMinutes" type:"integer"` + + // A token used for advancing to a specific page of results from for get relational + // database events request. + PageToken *string `locationName:"pageToken" type:"string"` + + // The name of the database from which to get events. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseEventsInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDurationInMinutes sets the DurationInMinutes field's value. +func (s *GetRelationalDatabaseEventsInput) SetDurationInMinutes(v int64) *GetRelationalDatabaseEventsInput { + s.DurationInMinutes = &v + return s +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseEventsInput) SetPageToken(v string) *GetRelationalDatabaseEventsInput { + s.PageToken = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseEventsInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseEventsInput { + s.RelationalDatabaseName = &v + return s +} + +type GetRelationalDatabaseEventsOutput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to the next page of results from your get relational + // database events request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` + + // An object describing the result of your get relational database events request. + RelationalDatabaseEvents []*RelationalDatabaseEvent `locationName:"relationalDatabaseEvents" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabaseEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseEventsOutput) GoString() string { + return s.String() +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabaseEventsOutput) SetNextPageToken(v string) *GetRelationalDatabaseEventsOutput { + s.NextPageToken = &v + return s +} + +// SetRelationalDatabaseEvents sets the RelationalDatabaseEvents field's value. +func (s *GetRelationalDatabaseEventsOutput) SetRelationalDatabaseEvents(v []*RelationalDatabaseEvent) *GetRelationalDatabaseEventsOutput { + s.RelationalDatabaseEvents = v + return s +} + +type GetRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The name of the database that you are looking up. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +type GetRelationalDatabaseLogEventsInput struct { + _ struct{} `type:"structure"` + + // The end of the time interval from which to get log events. + // + // Constraints: + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Specified in the Unix time format. For example, if you wish to use an + // end time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as + // the end time. + EndTime *time.Time `locationName:"endTime" type:"timestamp"` + + // The name of the log stream. + // + // Use the get relational database log streams operation to get a list of available + // log streams. + // + // LogStreamName is a required field + LogStreamName *string `locationName:"logStreamName" type:"string" required:"true"` + + // A token used for advancing to a specific page of results for your get relational + // database log events request. + PageToken *string `locationName:"pageToken" type:"string"` + + // The name of your database for which to get log events. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // Parameter to specify if the log should start from head or tail. If true is + // specified, the log event starts from the head of the log. If false is specified, + // the log event starts from the tail of the log. + // + // Default: false + StartFromHead *bool `locationName:"startFromHead" type:"boolean"` + + // The start of the time interval from which to get log events. + // + // Constraints: + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Specified in the Unix time format. For example, if you wish to use a + // start time of October 1, 2018, at 8 PM UTC, then you input 1538424000 + // as the start time. + StartTime *time.Time `locationName:"startTime" type:"timestamp"` +} + +// String returns the string representation +func (s GetRelationalDatabaseLogEventsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseLogEventsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseLogEventsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseLogEventsInput"} + if s.LogStreamName == nil { + invalidParams.Add(request.NewErrParamRequired("LogStreamName")) + } + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetEndTime(v time.Time) *GetRelationalDatabaseLogEventsInput { + s.EndTime = &v + return s +} + +// SetLogStreamName sets the LogStreamName field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetLogStreamName(v string) *GetRelationalDatabaseLogEventsInput { + s.LogStreamName = &v + return s +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetPageToken(v string) *GetRelationalDatabaseLogEventsInput { + s.PageToken = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseLogEventsInput { + s.RelationalDatabaseName = &v + return s +} + +// SetStartFromHead sets the StartFromHead field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetStartFromHead(v bool) *GetRelationalDatabaseLogEventsInput { + s.StartFromHead = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetRelationalDatabaseLogEventsInput) SetStartTime(v time.Time) *GetRelationalDatabaseLogEventsInput { + s.StartTime = &v + return s +} + +type GetRelationalDatabaseLogEventsOutput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to the previous page of results from your get + // relational database log events request. + NextBackwardToken *string `locationName:"nextBackwardToken" type:"string"` + + // A token used for advancing to the next page of results from your get relational + // database log events request. + NextForwardToken *string `locationName:"nextForwardToken" type:"string"` + + // An object describing the result of your get relational database log events + // request. + ResourceLogEvents []*LogEvent `locationName:"resourceLogEvents" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabaseLogEventsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseLogEventsOutput) GoString() string { + return s.String() +} + +// SetNextBackwardToken sets the NextBackwardToken field's value. +func (s *GetRelationalDatabaseLogEventsOutput) SetNextBackwardToken(v string) *GetRelationalDatabaseLogEventsOutput { + s.NextBackwardToken = &v + return s +} + +// SetNextForwardToken sets the NextForwardToken field's value. +func (s *GetRelationalDatabaseLogEventsOutput) SetNextForwardToken(v string) *GetRelationalDatabaseLogEventsOutput { + s.NextForwardToken = &v + return s +} + +// SetResourceLogEvents sets the ResourceLogEvents field's value. +func (s *GetRelationalDatabaseLogEventsOutput) SetResourceLogEvents(v []*LogEvent) *GetRelationalDatabaseLogEventsOutput { + s.ResourceLogEvents = v + return s +} + +type GetRelationalDatabaseLogStreamsInput struct { + _ struct{} `type:"structure"` + + // The name of your database for which to get log streams. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseLogStreamsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseLogStreamsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseLogStreamsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseLogStreamsInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseLogStreamsInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseLogStreamsInput { + s.RelationalDatabaseName = &v + return s +} + +type GetRelationalDatabaseLogStreamsOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your get relational database log streams + // request. + LogStreams []*string `locationName:"logStreams" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabaseLogStreamsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseLogStreamsOutput) GoString() string { + return s.String() +} + +// SetLogStreams sets the LogStreams field's value. +func (s *GetRelationalDatabaseLogStreamsOutput) SetLogStreams(v []*string) *GetRelationalDatabaseLogStreamsOutput { + s.LogStreams = v + return s +} + +type GetRelationalDatabaseMasterUserPasswordInput struct { + _ struct{} `type:"structure"` + + // The password version to return. + // + // Specifying CURRENT or PREVIOUS returns the current or previous passwords + // respectively. Specifying PENDING returns the newest version of the password + // that will rotate to CURRENT. After the PENDING password rotates to CURRENT, + // the PENDING password is no longer available. + // + // Default: CURRENT + PasswordVersion *string `locationName:"passwordVersion" type:"string" enum:"RelationalDatabasePasswordVersion"` + + // The name of your database for which to get the master user password. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseMasterUserPasswordInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseMasterUserPasswordInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseMasterUserPasswordInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseMasterUserPasswordInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPasswordVersion sets the PasswordVersion field's value. +func (s *GetRelationalDatabaseMasterUserPasswordInput) SetPasswordVersion(v string) *GetRelationalDatabaseMasterUserPasswordInput { + s.PasswordVersion = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseMasterUserPasswordInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseMasterUserPasswordInput { + s.RelationalDatabaseName = &v + return s +} + +type GetRelationalDatabaseMasterUserPasswordOutput struct { + _ struct{} `type:"structure"` + + // The timestamp when the specified version of the master user password was + // created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // The master user password for the password version specified. + MasterUserPassword *string `locationName:"masterUserPassword" type:"string" sensitive:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseMasterUserPasswordOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseMasterUserPasswordOutput) GoString() string { + return s.String() +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *GetRelationalDatabaseMasterUserPasswordOutput) SetCreatedAt(v time.Time) *GetRelationalDatabaseMasterUserPasswordOutput { + s.CreatedAt = &v + return s +} + +// SetMasterUserPassword sets the MasterUserPassword field's value. +func (s *GetRelationalDatabaseMasterUserPasswordOutput) SetMasterUserPassword(v string) *GetRelationalDatabaseMasterUserPasswordOutput { + s.MasterUserPassword = &v + return s +} + +type GetRelationalDatabaseMetricDataInput struct { + _ struct{} `type:"structure"` + + // The end of the time interval from which to get metric data. + // + // Constraints: + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Specified in the Unix time format. For example, if you wish to use an + // end time of October 1, 2018, at 8 PM UTC, then you input 1538424000 as + // the end time. + // + // EndTime is a required field + EndTime *time.Time `locationName:"endTime" type:"timestamp" required:"true"` + + // The name of the metric data to return. + // + // MetricName is a required field + MetricName *string `locationName:"metricName" type:"string" required:"true" enum:"RelationalDatabaseMetricName"` + + // The granularity, in seconds, of the returned data points. + // + // Period is a required field + Period *int64 `locationName:"period" min:"60" type:"integer" required:"true"` + + // The name of your database from which to get metric data. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // The start of the time interval from which to get metric data. + // + // Constraints: + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Specified in the Unix time format. For example, if you wish to use a + // start time of October 1, 2018, at 8 PM UTC, then you input 1538424000 + // as the start time. + // + // StartTime is a required field + StartTime *time.Time `locationName:"startTime" type:"timestamp" required:"true"` + + // The array of statistics for your metric data request. + // + // Statistics is a required field + Statistics []*string `locationName:"statistics" type:"list" required:"true"` + + // The unit for the metric data request. + // + // Unit is a required field + Unit *string `locationName:"unit" type:"string" required:"true" enum:"MetricUnit"` +} + +// String returns the string representation +func (s GetRelationalDatabaseMetricDataInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseMetricDataInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseMetricDataInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseMetricDataInput"} + if s.EndTime == nil { + invalidParams.Add(request.NewErrParamRequired("EndTime")) + } + if s.MetricName == nil { + invalidParams.Add(request.NewErrParamRequired("MetricName")) + } + if s.Period == nil { + invalidParams.Add(request.NewErrParamRequired("Period")) + } + if s.Period != nil && *s.Period < 60 { + invalidParams.Add(request.NewErrParamMinValue("Period", 60)) + } + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + if s.StartTime == nil { + invalidParams.Add(request.NewErrParamRequired("StartTime")) + } + if s.Statistics == nil { + invalidParams.Add(request.NewErrParamRequired("Statistics")) + } + if s.Unit == nil { + invalidParams.Add(request.NewErrParamRequired("Unit")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEndTime sets the EndTime field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetEndTime(v time.Time) *GetRelationalDatabaseMetricDataInput { + s.EndTime = &v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetMetricName(v string) *GetRelationalDatabaseMetricDataInput { + s.MetricName = &v + return s +} + +// SetPeriod sets the Period field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetPeriod(v int64) *GetRelationalDatabaseMetricDataInput { + s.Period = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseMetricDataInput { + s.RelationalDatabaseName = &v + return s +} + +// SetStartTime sets the StartTime field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetStartTime(v time.Time) *GetRelationalDatabaseMetricDataInput { + s.StartTime = &v + return s +} + +// SetStatistics sets the Statistics field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetStatistics(v []*string) *GetRelationalDatabaseMetricDataInput { + s.Statistics = v + return s +} + +// SetUnit sets the Unit field's value. +func (s *GetRelationalDatabaseMetricDataInput) SetUnit(v string) *GetRelationalDatabaseMetricDataInput { + s.Unit = &v + return s +} + +type GetRelationalDatabaseMetricDataOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your get relational database metric data + // request. + MetricData []*MetricDatapoint `locationName:"metricData" type:"list"` + + // The name of the metric. + MetricName *string `locationName:"metricName" type:"string" enum:"RelationalDatabaseMetricName"` +} + +// String returns the string representation +func (s GetRelationalDatabaseMetricDataOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseMetricDataOutput) GoString() string { + return s.String() +} + +// SetMetricData sets the MetricData field's value. +func (s *GetRelationalDatabaseMetricDataOutput) SetMetricData(v []*MetricDatapoint) *GetRelationalDatabaseMetricDataOutput { + s.MetricData = v + return s +} + +// SetMetricName sets the MetricName field's value. +func (s *GetRelationalDatabaseMetricDataOutput) SetMetricName(v string) *GetRelationalDatabaseMetricDataOutput { + s.MetricName = &v + return s +} + +type GetRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the specified database. + RelationalDatabase *RelationalDatabase `locationName:"relationalDatabase" type:"structure"` +} + +// String returns the string representation +func (s GetRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetRelationalDatabase sets the RelationalDatabase field's value. +func (s *GetRelationalDatabaseOutput) SetRelationalDatabase(v *RelationalDatabase) *GetRelationalDatabaseOutput { + s.RelationalDatabase = v + return s +} + +type GetRelationalDatabaseParametersInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get relational + // database parameters request. + PageToken *string `locationName:"pageToken" type:"string"` + + // The name of your database for which to get parameters. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseParametersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseParametersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseParametersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseParametersInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseParametersInput) SetPageToken(v string) *GetRelationalDatabaseParametersInput { + s.PageToken = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *GetRelationalDatabaseParametersInput) SetRelationalDatabaseName(v string) *GetRelationalDatabaseParametersInput { + s.RelationalDatabaseName = &v + return s +} + +type GetRelationalDatabaseParametersOutput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to the next page of results from your get static + // IPs request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` + + // An object describing the result of your get relational database parameters + // request. + Parameters []*RelationalDatabaseParameter `locationName:"parameters" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabaseParametersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseParametersOutput) GoString() string { + return s.String() +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabaseParametersOutput) SetNextPageToken(v string) *GetRelationalDatabaseParametersOutput { + s.NextPageToken = &v + return s +} + +// SetParameters sets the Parameters field's value. +func (s *GetRelationalDatabaseParametersOutput) SetParameters(v []*RelationalDatabaseParameter) *GetRelationalDatabaseParametersOutput { + s.Parameters = v + return s +} + +type GetRelationalDatabaseSnapshotInput struct { + _ struct{} `type:"structure"` + + // The name of the database snapshot for which to get information. + // + // RelationalDatabaseSnapshotName is a required field + RelationalDatabaseSnapshotName *string `locationName:"relationalDatabaseSnapshotName" type:"string" required:"true"` +} + +// String returns the string representation +func (s GetRelationalDatabaseSnapshotInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseSnapshotInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetRelationalDatabaseSnapshotInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetRelationalDatabaseSnapshotInput"} + if s.RelationalDatabaseSnapshotName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseSnapshotName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseSnapshotName sets the RelationalDatabaseSnapshotName field's value. +func (s *GetRelationalDatabaseSnapshotInput) SetRelationalDatabaseSnapshotName(v string) *GetRelationalDatabaseSnapshotInput { + s.RelationalDatabaseSnapshotName = &v + return s +} + +type GetRelationalDatabaseSnapshotOutput struct { + _ struct{} `type:"structure"` + + // An object describing the specified database snapshot. + RelationalDatabaseSnapshot *RelationalDatabaseSnapshot `locationName:"relationalDatabaseSnapshot" type:"structure"` +} + +// String returns the string representation +func (s GetRelationalDatabaseSnapshotOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseSnapshotOutput) GoString() string { + return s.String() +} + +// SetRelationalDatabaseSnapshot sets the RelationalDatabaseSnapshot field's value. +func (s *GetRelationalDatabaseSnapshotOutput) SetRelationalDatabaseSnapshot(v *RelationalDatabaseSnapshot) *GetRelationalDatabaseSnapshotOutput { + s.RelationalDatabaseSnapshot = v + return s +} + +type GetRelationalDatabaseSnapshotsInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get relational + // database snapshots request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabaseSnapshotsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseSnapshotsInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabaseSnapshotsInput) SetPageToken(v string) *GetRelationalDatabaseSnapshotsInput { + s.PageToken = &v + return s +} + +type GetRelationalDatabaseSnapshotsOutput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to the next page of results from your get relational + // database snapshots request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` + + // An object describing the result of your get relational database snapshots + // request. + RelationalDatabaseSnapshots []*RelationalDatabaseSnapshot `locationName:"relationalDatabaseSnapshots" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabaseSnapshotsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabaseSnapshotsOutput) GoString() string { + return s.String() +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabaseSnapshotsOutput) SetNextPageToken(v string) *GetRelationalDatabaseSnapshotsOutput { + s.NextPageToken = &v + return s +} + +// SetRelationalDatabaseSnapshots sets the RelationalDatabaseSnapshots field's value. +func (s *GetRelationalDatabaseSnapshotsOutput) SetRelationalDatabaseSnapshots(v []*RelationalDatabaseSnapshot) *GetRelationalDatabaseSnapshotsOutput { + s.RelationalDatabaseSnapshots = v + return s +} + +type GetRelationalDatabasesInput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to a specific page of results for your get relational + // database request. + PageToken *string `locationName:"pageToken" type:"string"` +} + +// String returns the string representation +func (s GetRelationalDatabasesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabasesInput) GoString() string { + return s.String() +} + +// SetPageToken sets the PageToken field's value. +func (s *GetRelationalDatabasesInput) SetPageToken(v string) *GetRelationalDatabasesInput { + s.PageToken = &v + return s +} + +type GetRelationalDatabasesOutput struct { + _ struct{} `type:"structure"` + + // A token used for advancing to the next page of results from your get relational + // databases request. + NextPageToken *string `locationName:"nextPageToken" type:"string"` + + // An object describing the result of your get relational databases request. + RelationalDatabases []*RelationalDatabase `locationName:"relationalDatabases" type:"list"` +} + +// String returns the string representation +func (s GetRelationalDatabasesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetRelationalDatabasesOutput) GoString() string { + return s.String() +} + +// SetNextPageToken sets the NextPageToken field's value. +func (s *GetRelationalDatabasesOutput) SetNextPageToken(v string) *GetRelationalDatabasesOutput { + s.NextPageToken = &v + return s +} + +// SetRelationalDatabases sets the RelationalDatabases field's value. +func (s *GetRelationalDatabasesOutput) SetRelationalDatabases(v []*RelationalDatabase) *GetRelationalDatabasesOutput { + s.RelationalDatabases = v + return s +} + type GetStaticIpInput struct { _ struct{} `type:"structure"` @@ -12814,6 +18892,99 @@ func (s *GetStaticIpsOutput) SetStaticIps(v []*StaticIp) *GetStaticIpsOutput { return s } +// Describes the public SSH host keys or the RDP certificate. +type HostKeyAttributes struct { + _ struct{} `type:"structure"` + + // The SSH host key algorithm or the RDP certificate format. + // + // For SSH host keys, the algorithm may be ssh-rsa, ecdsa-sha2-nistp256, ssh-ed25519, + // etc. For RDP certificates, the algorithm is always x509-cert. + Algorithm *string `locationName:"algorithm" type:"string"` + + // The SHA-1 fingerprint of the returned SSH host key or RDP certificate. + // + // * Example of an SHA-1 SSH fingerprint: SHA1:1CHH6FaAaXjtFOsR/t83vf91SR0 + // + // * Example of an SHA-1 RDP fingerprint: af:34:51:fe:09:f0:e0:da:b8:4e:56:ca:60:c2:10:ff:38:06:db:45 + FingerprintSHA1 *string `locationName:"fingerprintSHA1" type:"string"` + + // The SHA-256 fingerprint of the returned SSH host key or RDP certificate. + // + // * Example of an SHA-256 SSH fingerprint: SHA256:KTsMnRBh1IhD17HpdfsbzeGA4jOijm5tyXsMjKVbB8o + // + // * Example of an SHA-256 RDP fingerprint: 03:9b:36:9f:4b:de:4e:61:70:fc:7c:c9:78:e7:d2:1a:1c:25:a8:0c:91:f6:7c:e4:d6:a0:85:c8:b4:53:99:68 + FingerprintSHA256 *string `locationName:"fingerprintSHA256" type:"string"` + + // The returned RDP certificate is not valid after this point in time. + // + // This value is listed only for RDP certificates. + NotValidAfter *time.Time `locationName:"notValidAfter" type:"timestamp"` + + // The returned RDP certificate is valid after this point in time. + // + // This value is listed only for RDP certificates. + NotValidBefore *time.Time `locationName:"notValidBefore" type:"timestamp"` + + // The public SSH host key or the RDP certificate. + PublicKey *string `locationName:"publicKey" type:"string"` + + // The time that the SSH host key or RDP certificate was recorded by Lightsail. + WitnessedAt *time.Time `locationName:"witnessedAt" type:"timestamp"` +} + +// String returns the string representation +func (s HostKeyAttributes) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s HostKeyAttributes) GoString() string { + return s.String() +} + +// SetAlgorithm sets the Algorithm field's value. +func (s *HostKeyAttributes) SetAlgorithm(v string) *HostKeyAttributes { + s.Algorithm = &v + return s +} + +// SetFingerprintSHA1 sets the FingerprintSHA1 field's value. +func (s *HostKeyAttributes) SetFingerprintSHA1(v string) *HostKeyAttributes { + s.FingerprintSHA1 = &v + return s +} + +// SetFingerprintSHA256 sets the FingerprintSHA256 field's value. +func (s *HostKeyAttributes) SetFingerprintSHA256(v string) *HostKeyAttributes { + s.FingerprintSHA256 = &v + return s +} + +// SetNotValidAfter sets the NotValidAfter field's value. +func (s *HostKeyAttributes) SetNotValidAfter(v time.Time) *HostKeyAttributes { + s.NotValidAfter = &v + return s +} + +// SetNotValidBefore sets the NotValidBefore field's value. +func (s *HostKeyAttributes) SetNotValidBefore(v time.Time) *HostKeyAttributes { + s.NotValidBefore = &v + return s +} + +// SetPublicKey sets the PublicKey field's value. +func (s *HostKeyAttributes) SetPublicKey(v string) *HostKeyAttributes { + s.PublicKey = &v + return s +} + +// SetWitnessedAt sets the WitnessedAt field's value. +func (s *HostKeyAttributes) SetWitnessedAt(v time.Time) *HostKeyAttributes { + s.WitnessedAt = &v + return s +} + type ImportKeyPairInput struct { _ struct{} `type:"structure"` @@ -12918,7 +19089,7 @@ type Instance struct { // to it. IsStaticIp *bool `locationName:"isStaticIp" type:"boolean"` - // The region name and availability zone where the instance is located. + // The region name and Availability Zone where the instance is located. Location *ResourceLocation `locationName:"location" type:"structure"` // The name the user gave the instance (e.g., Amazon_Linux-1GB-Ohio-1). @@ -12948,6 +19119,10 @@ type Instance struct { // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` + // The user name for connecting to the instance (e.g., ec2-user). Username *string `locationName:"username" type:"string"` } @@ -13064,6 +19239,12 @@ func (s *Instance) SetSupportCode(v string) *Instance { return s } +// SetTags sets the Tags field's value. +func (s *Instance) SetTags(v []*Tag) *Instance { + s.Tags = v + return s +} + // SetUsername sets the Username field's value. func (s *Instance) SetUsername(v string) *Instance { s.Username = &v @@ -13082,6 +19263,9 @@ type InstanceAccessDetails struct { // For SSH access, the date on which the temporary keys expire. ExpiresAt *time.Time `locationName:"expiresAt" type:"timestamp"` + // Describes the public SSH host keys or the RDP certificate. + HostKeys []*HostKeyAttributes `locationName:"hostKeys" type:"list"` + // The name of this Amazon Lightsail instance. InstanceName *string `locationName:"instanceName" type:"string"` @@ -13141,6 +19325,12 @@ func (s *InstanceAccessDetails) SetExpiresAt(v time.Time) *InstanceAccessDetails return s } +// SetHostKeys sets the HostKeys field's value. +func (s *InstanceAccessDetails) SetHostKeys(v []*HostKeyAttributes) *InstanceAccessDetails { + s.HostKeys = v + return s +} + // SetInstanceName sets the InstanceName field's value. func (s *InstanceAccessDetails) SetInstanceName(v string) *InstanceAccessDetails { s.InstanceName = &v @@ -13183,6 +19373,116 @@ func (s *InstanceAccessDetails) SetUsername(v string) *InstanceAccessDetails { return s } +// Describes the Amazon Elastic Compute Cloud instance and related resources +// to be created using the create cloud formation stack operation. +type InstanceEntry struct { + _ struct{} `type:"structure"` + + // The Availability Zone for the new Amazon EC2 instance. + // + // AvailabilityZone is a required field + AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` + + // The instance type (e.g., t2.micro) to use for the new Amazon EC2 instance. + // + // InstanceType is a required field + InstanceType *string `locationName:"instanceType" type:"string" required:"true"` + + // The port configuration to use for the new Amazon EC2 instance. + // + // The following configuration options are available: + // + // * DEFAULT — Use the default firewall settings from the image. + // + // * INSTANCE — Use the firewall settings from the source Lightsail instance. + // + // * NONE — Default to Amazon EC2. + // + // * CLOSED — All ports closed. + // + // PortInfoSource is a required field + PortInfoSource *string `locationName:"portInfoSource" type:"string" required:"true" enum:"PortInfoSourceType"` + + // The name of the export snapshot record, which contains the exported Lightsail + // instance snapshot that will be used as the source of the new Amazon EC2 instance. + // + // Use the get export snapshot records operation to get a list of export snapshot + // records that you can use to create a CloudFormation stack. + // + // SourceName is a required field + SourceName *string `locationName:"sourceName" type:"string" required:"true"` + + // A launch script you can create that configures a server with additional user + // data. For example, you might want to run apt-get -y update. + // + // Depending on the machine image you choose, the command to get software on + // your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu + // use apt-get, and FreeBSD uses pkg. + UserData *string `locationName:"userData" type:"string"` +} + +// String returns the string representation +func (s InstanceEntry) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceEntry) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *InstanceEntry) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "InstanceEntry"} + if s.AvailabilityZone == nil { + invalidParams.Add(request.NewErrParamRequired("AvailabilityZone")) + } + if s.InstanceType == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceType")) + } + if s.PortInfoSource == nil { + invalidParams.Add(request.NewErrParamRequired("PortInfoSource")) + } + if s.SourceName == nil { + invalidParams.Add(request.NewErrParamRequired("SourceName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAvailabilityZone sets the AvailabilityZone field's value. +func (s *InstanceEntry) SetAvailabilityZone(v string) *InstanceEntry { + s.AvailabilityZone = &v + return s +} + +// SetInstanceType sets the InstanceType field's value. +func (s *InstanceEntry) SetInstanceType(v string) *InstanceEntry { + s.InstanceType = &v + return s +} + +// SetPortInfoSource sets the PortInfoSource field's value. +func (s *InstanceEntry) SetPortInfoSource(v string) *InstanceEntry { + s.PortInfoSource = &v + return s +} + +// SetSourceName sets the SourceName field's value. +func (s *InstanceEntry) SetSourceName(v string) *InstanceEntry { + s.SourceName = &v + return s +} + +// SetUserData sets the UserData field's value. +func (s *InstanceEntry) SetUserData(v string) *InstanceEntry { + s.UserData = &v + return s +} + // Describes the hardware for the instance. type InstanceHardware struct { _ struct{} `type:"structure"` @@ -13539,7 +19839,7 @@ type InstanceSnapshot struct { // The instance from which the snapshot was created. FromInstanceName *string `locationName:"fromInstanceName" type:"string"` - // The region name and availability zone where you created the snapshot. + // The region name and Availability Zone where you created the snapshot. Location *ResourceLocation `locationName:"location" type:"structure"` // The name of the snapshot. @@ -13561,6 +19861,10 @@ type InstanceSnapshot struct { // questions about an instance or another resource in Lightsail. This code enables // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -13657,6 +19961,54 @@ func (s *InstanceSnapshot) SetSupportCode(v string) *InstanceSnapshot { return s } +// SetTags sets the Tags field's value. +func (s *InstanceSnapshot) SetTags(v []*Tag) *InstanceSnapshot { + s.Tags = v + return s +} + +// Describes an instance snapshot. +type InstanceSnapshotInfo struct { + _ struct{} `type:"structure"` + + // The blueprint ID from which the source instance (e.g., os_debian_8_3). + FromBlueprintId *string `locationName:"fromBlueprintId" type:"string"` + + // The bundle ID from which the source instance was created (e.g., micro_1_0). + FromBundleId *string `locationName:"fromBundleId" type:"string"` + + // A list of objects describing the disks that were attached to the source instance. + FromDiskInfo []*DiskInfo `locationName:"fromDiskInfo" type:"list"` +} + +// String returns the string representation +func (s InstanceSnapshotInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstanceSnapshotInfo) GoString() string { + return s.String() +} + +// SetFromBlueprintId sets the FromBlueprintId field's value. +func (s *InstanceSnapshotInfo) SetFromBlueprintId(v string) *InstanceSnapshotInfo { + s.FromBlueprintId = &v + return s +} + +// SetFromBundleId sets the FromBundleId field's value. +func (s *InstanceSnapshotInfo) SetFromBundleId(v string) *InstanceSnapshotInfo { + s.FromBundleId = &v + return s +} + +// SetFromDiskInfo sets the FromDiskInfo field's value. +func (s *InstanceSnapshotInfo) SetFromDiskInfo(v []*DiskInfo) *InstanceSnapshotInfo { + s.FromDiskInfo = v + return s +} + // Describes the virtual private server (or instance) status. type InstanceState struct { _ struct{} `type:"structure"` @@ -13753,6 +20105,10 @@ type KeyPair struct { // questions about an instance or another resource in Lightsail. This code enables // our support team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -13807,6 +20163,12 @@ func (s *KeyPair) SetSupportCode(v string) *KeyPair { return s } +// SetTags sets the Tags field's value. +func (s *KeyPair) SetTags(v []*Tag) *KeyPair { + s.Tags = v + return s +} + // Describes the Lightsail load balancer. type LoadBalancer struct { _ struct{} `type:"structure"` @@ -13863,6 +20225,10 @@ type LoadBalancer struct { // team to look up your Lightsail information more easily. SupportCode *string `locationName:"supportCode" type:"string"` + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` + // An array of LoadBalancerTlsCertificateSummary objects that provide additional // information about the SSL/TLS certificates. For example, if true, the certificate // is attached to the load balancer. @@ -13963,6 +20329,12 @@ func (s *LoadBalancer) SetSupportCode(v string) *LoadBalancer { return s } +// SetTags sets the Tags field's value. +func (s *LoadBalancer) SetTags(v []*Tag) *LoadBalancer { + s.Tags = v + return s +} + // SetTlsCertificateSummaries sets the TlsCertificateSummaries field's value. func (s *LoadBalancer) SetTlsCertificateSummaries(v []*LoadBalancerTlsCertificateSummary) *LoadBalancer { s.TlsCertificateSummaries = v @@ -14078,6 +20450,10 @@ type LoadBalancerTlsCertificate struct { // code enables our support team to look up your Lightsail information more // easily. SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` } // String returns the string representation @@ -14234,6 +20610,12 @@ func (s *LoadBalancerTlsCertificate) SetSupportCode(v string) *LoadBalancerTlsCe return s } +// SetTags sets the Tags field's value. +func (s *LoadBalancerTlsCertificate) SetTags(v []*Tag) *LoadBalancerTlsCertificate { + s.Tags = v + return s +} + // Contains information about the domain names on an SSL/TLS certificate that // you will use to validate domain ownership. type LoadBalancerTlsCertificateDomainValidationOption struct { @@ -14398,6 +20780,39 @@ func (s *LoadBalancerTlsCertificateSummary) SetName(v string) *LoadBalancerTlsCe return s } +// Describes a database log event. +type LogEvent struct { + _ struct{} `type:"structure"` + + // The timestamp when the database log event was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // The message of the database log event. + Message *string `locationName:"message" type:"string"` +} + +// String returns the string representation +func (s LogEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s LogEvent) GoString() string { + return s.String() +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *LogEvent) SetCreatedAt(v time.Time) *LogEvent { + s.CreatedAt = &v + return s +} + +// SetMessage sets the Message field's value. +func (s *LogEvent) SetMessage(v string) *LogEvent { + s.Message = &v + return s +} + // Describes the metric data point. type MetricDatapoint struct { _ struct{} `type:"structure"` @@ -14788,6 +21203,90 @@ func (s *PeerVpcOutput) SetOperation(v *Operation) *PeerVpcOutput { return s } +// Describes a pending database maintenance action. +type PendingMaintenanceAction struct { + _ struct{} `type:"structure"` + + // The type of pending database maintenance action. + Action *string `locationName:"action" type:"string"` + + // The effective date of the pending database maintenance action. + CurrentApplyDate *time.Time `locationName:"currentApplyDate" type:"timestamp"` + + // Additional detail about the pending database maintenance action. + Description *string `locationName:"description" type:"string"` +} + +// String returns the string representation +func (s PendingMaintenanceAction) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PendingMaintenanceAction) GoString() string { + return s.String() +} + +// SetAction sets the Action field's value. +func (s *PendingMaintenanceAction) SetAction(v string) *PendingMaintenanceAction { + s.Action = &v + return s +} + +// SetCurrentApplyDate sets the CurrentApplyDate field's value. +func (s *PendingMaintenanceAction) SetCurrentApplyDate(v time.Time) *PendingMaintenanceAction { + s.CurrentApplyDate = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *PendingMaintenanceAction) SetDescription(v string) *PendingMaintenanceAction { + s.Description = &v + return s +} + +// Describes a pending database value modification. +type PendingModifiedRelationalDatabaseValues struct { + _ struct{} `type:"structure"` + + // A Boolean value indicating whether automated backup retention is enabled. + BackupRetentionEnabled *bool `locationName:"backupRetentionEnabled" type:"boolean"` + + // The database engine version. + EngineVersion *string `locationName:"engineVersion" type:"string"` + + // The password for the master user of the database. + MasterUserPassword *string `locationName:"masterUserPassword" type:"string"` +} + +// String returns the string representation +func (s PendingModifiedRelationalDatabaseValues) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PendingModifiedRelationalDatabaseValues) GoString() string { + return s.String() +} + +// SetBackupRetentionEnabled sets the BackupRetentionEnabled field's value. +func (s *PendingModifiedRelationalDatabaseValues) SetBackupRetentionEnabled(v bool) *PendingModifiedRelationalDatabaseValues { + s.BackupRetentionEnabled = &v + return s +} + +// SetEngineVersion sets the EngineVersion field's value. +func (s *PendingModifiedRelationalDatabaseValues) SetEngineVersion(v string) *PendingModifiedRelationalDatabaseValues { + s.EngineVersion = &v + return s +} + +// SetMasterUserPassword sets the MasterUserPassword field's value. +func (s *PendingModifiedRelationalDatabaseValues) SetMasterUserPassword(v string) *PendingModifiedRelationalDatabaseValues { + s.MasterUserPassword = &v + return s +} + // Describes information about the ports on your virtual private server (or // instance). type PortInfo struct { @@ -14967,6 +21466,67 @@ func (s *RebootInstanceOutput) SetOperations(v []*Operation) *RebootInstanceOutp return s } +type RebootRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The name of your database to reboot. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s RebootRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RebootRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *RebootRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "RebootRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *RebootRelationalDatabaseInput) SetRelationalDatabaseName(v string) *RebootRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +type RebootRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your reboot relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s RebootRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RebootRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *RebootRelationalDatabaseOutput) SetOperations(v []*Operation) *RebootRelationalDatabaseOutput { + s.Operations = v + return s +} + // Describes the AWS Region. type Region struct { _ struct{} `type:"structure"` @@ -14986,6 +21546,9 @@ type Region struct { // The region name (e.g., us-east-2). Name *string `locationName:"name" type:"string" enum:"RegionName"` + + // The Availability Zones for databases. Follows the format us-east-2a (case-sensitive). + RelationalDatabaseAvailabilityZones []*AvailabilityZone `locationName:"relationalDatabaseAvailabilityZones" type:"list"` } // String returns the string representation @@ -15028,6 +21591,805 @@ func (s *Region) SetName(v string) *Region { return s } +// SetRelationalDatabaseAvailabilityZones sets the RelationalDatabaseAvailabilityZones field's value. +func (s *Region) SetRelationalDatabaseAvailabilityZones(v []*AvailabilityZone) *Region { + s.RelationalDatabaseAvailabilityZones = v + return s +} + +// Describes a database. +type RelationalDatabase struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the database. + Arn *string `locationName:"arn" type:"string"` + + // A Boolean value indicating whether automated backup retention is enabled + // for the database. + BackupRetentionEnabled *bool `locationName:"backupRetentionEnabled" type:"boolean"` + + // The timestamp when the database was created. Formatted in Unix time. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // The database software (for example, MySQL). + Engine *string `locationName:"engine" type:"string"` + + // The database engine version (for example, 5.7.23). + EngineVersion *string `locationName:"engineVersion" type:"string"` + + // Describes the hardware of the database. + Hardware *RelationalDatabaseHardware `locationName:"hardware" type:"structure"` + + // The latest point in time to which the database can be restored. Formatted + // in Unix time. + LatestRestorableTime *time.Time `locationName:"latestRestorableTime" type:"timestamp"` + + // The Region name and Availability Zone where the database is located. + Location *ResourceLocation `locationName:"location" type:"structure"` + + // The name of the master database created when the Lightsail database resource + // is created. + MasterDatabaseName *string `locationName:"masterDatabaseName" type:"string"` + + // The master endpoint for the database. + MasterEndpoint *RelationalDatabaseEndpoint `locationName:"masterEndpoint" type:"structure"` + + // The master user name of the database. + MasterUsername *string `locationName:"masterUsername" type:"string"` + + // The unique name of the database resource in Lightsail. + Name *string `locationName:"name" type:"string"` + + // The status of parameter updates for the database. + ParameterApplyStatus *string `locationName:"parameterApplyStatus" type:"string"` + + // Describes the pending maintenance actions for the database. + PendingMaintenanceActions []*PendingMaintenanceAction `locationName:"pendingMaintenanceActions" type:"list"` + + // Describes pending database value modifications. + PendingModifiedValues *PendingModifiedRelationalDatabaseValues `locationName:"pendingModifiedValues" type:"structure"` + + // The daily time range during which automated backups are created for the database + // (for example, 16:00-16:30). + PreferredBackupWindow *string `locationName:"preferredBackupWindow" type:"string"` + + // The weekly time range during which system maintenance can occur on the database. + // + // In the format ddd:hh24:mi-ddd:hh24:mi. For example, Tue:17:00-Tue:17:30. + PreferredMaintenanceWindow *string `locationName:"preferredMaintenanceWindow" type:"string"` + + // A Boolean value indicating whether the database is publicly accessible. + PubliclyAccessible *bool `locationName:"publiclyAccessible" type:"boolean"` + + // The blueprint ID for the database. A blueprint describes the major engine + // version of a database. + RelationalDatabaseBlueprintId *string `locationName:"relationalDatabaseBlueprintId" type:"string"` + + // The bundle ID for the database. A bundle describes the performance specifications + // for your database. + RelationalDatabaseBundleId *string `locationName:"relationalDatabaseBundleId" type:"string"` + + // The Lightsail resource type for the database (for example, RelationalDatabase). + ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` + + // Describes the secondary Availability Zone of a high availability database. + // + // The secondary database is used for failover support of a high availability + // database. + SecondaryAvailabilityZone *string `locationName:"secondaryAvailabilityZone" type:"string"` + + // Describes the current state of the database. + State *string `locationName:"state" type:"string"` + + // The support code for the database. Include this code in your email to support + // when you have questions about a database in Lightsail. This code enables + // our support team to look up your Lightsail information more easily. + SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` +} + +// String returns the string representation +func (s RelationalDatabase) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabase) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *RelationalDatabase) SetArn(v string) *RelationalDatabase { + s.Arn = &v + return s +} + +// SetBackupRetentionEnabled sets the BackupRetentionEnabled field's value. +func (s *RelationalDatabase) SetBackupRetentionEnabled(v bool) *RelationalDatabase { + s.BackupRetentionEnabled = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *RelationalDatabase) SetCreatedAt(v time.Time) *RelationalDatabase { + s.CreatedAt = &v + return s +} + +// SetEngine sets the Engine field's value. +func (s *RelationalDatabase) SetEngine(v string) *RelationalDatabase { + s.Engine = &v + return s +} + +// SetEngineVersion sets the EngineVersion field's value. +func (s *RelationalDatabase) SetEngineVersion(v string) *RelationalDatabase { + s.EngineVersion = &v + return s +} + +// SetHardware sets the Hardware field's value. +func (s *RelationalDatabase) SetHardware(v *RelationalDatabaseHardware) *RelationalDatabase { + s.Hardware = v + return s +} + +// SetLatestRestorableTime sets the LatestRestorableTime field's value. +func (s *RelationalDatabase) SetLatestRestorableTime(v time.Time) *RelationalDatabase { + s.LatestRestorableTime = &v + return s +} + +// SetLocation sets the Location field's value. +func (s *RelationalDatabase) SetLocation(v *ResourceLocation) *RelationalDatabase { + s.Location = v + return s +} + +// SetMasterDatabaseName sets the MasterDatabaseName field's value. +func (s *RelationalDatabase) SetMasterDatabaseName(v string) *RelationalDatabase { + s.MasterDatabaseName = &v + return s +} + +// SetMasterEndpoint sets the MasterEndpoint field's value. +func (s *RelationalDatabase) SetMasterEndpoint(v *RelationalDatabaseEndpoint) *RelationalDatabase { + s.MasterEndpoint = v + return s +} + +// SetMasterUsername sets the MasterUsername field's value. +func (s *RelationalDatabase) SetMasterUsername(v string) *RelationalDatabase { + s.MasterUsername = &v + return s +} + +// SetName sets the Name field's value. +func (s *RelationalDatabase) SetName(v string) *RelationalDatabase { + s.Name = &v + return s +} + +// SetParameterApplyStatus sets the ParameterApplyStatus field's value. +func (s *RelationalDatabase) SetParameterApplyStatus(v string) *RelationalDatabase { + s.ParameterApplyStatus = &v + return s +} + +// SetPendingMaintenanceActions sets the PendingMaintenanceActions field's value. +func (s *RelationalDatabase) SetPendingMaintenanceActions(v []*PendingMaintenanceAction) *RelationalDatabase { + s.PendingMaintenanceActions = v + return s +} + +// SetPendingModifiedValues sets the PendingModifiedValues field's value. +func (s *RelationalDatabase) SetPendingModifiedValues(v *PendingModifiedRelationalDatabaseValues) *RelationalDatabase { + s.PendingModifiedValues = v + return s +} + +// SetPreferredBackupWindow sets the PreferredBackupWindow field's value. +func (s *RelationalDatabase) SetPreferredBackupWindow(v string) *RelationalDatabase { + s.PreferredBackupWindow = &v + return s +} + +// SetPreferredMaintenanceWindow sets the PreferredMaintenanceWindow field's value. +func (s *RelationalDatabase) SetPreferredMaintenanceWindow(v string) *RelationalDatabase { + s.PreferredMaintenanceWindow = &v + return s +} + +// SetPubliclyAccessible sets the PubliclyAccessible field's value. +func (s *RelationalDatabase) SetPubliclyAccessible(v bool) *RelationalDatabase { + s.PubliclyAccessible = &v + return s +} + +// SetRelationalDatabaseBlueprintId sets the RelationalDatabaseBlueprintId field's value. +func (s *RelationalDatabase) SetRelationalDatabaseBlueprintId(v string) *RelationalDatabase { + s.RelationalDatabaseBlueprintId = &v + return s +} + +// SetRelationalDatabaseBundleId sets the RelationalDatabaseBundleId field's value. +func (s *RelationalDatabase) SetRelationalDatabaseBundleId(v string) *RelationalDatabase { + s.RelationalDatabaseBundleId = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *RelationalDatabase) SetResourceType(v string) *RelationalDatabase { + s.ResourceType = &v + return s +} + +// SetSecondaryAvailabilityZone sets the SecondaryAvailabilityZone field's value. +func (s *RelationalDatabase) SetSecondaryAvailabilityZone(v string) *RelationalDatabase { + s.SecondaryAvailabilityZone = &v + return s +} + +// SetState sets the State field's value. +func (s *RelationalDatabase) SetState(v string) *RelationalDatabase { + s.State = &v + return s +} + +// SetSupportCode sets the SupportCode field's value. +func (s *RelationalDatabase) SetSupportCode(v string) *RelationalDatabase { + s.SupportCode = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *RelationalDatabase) SetTags(v []*Tag) *RelationalDatabase { + s.Tags = v + return s +} + +// Describes a database image, or blueprint. A blueprint describes the major +// engine version of a database. +type RelationalDatabaseBlueprint struct { + _ struct{} `type:"structure"` + + // The ID for the database blueprint. + BlueprintId *string `locationName:"blueprintId" type:"string"` + + // The database software of the database blueprint (for example, MySQL). + Engine *string `locationName:"engine" type:"string" enum:"RelationalDatabaseEngine"` + + // The description of the database engine for the database blueprint. + EngineDescription *string `locationName:"engineDescription" type:"string"` + + // The database engine version for the database blueprint (for example, 5.7.23). + EngineVersion *string `locationName:"engineVersion" type:"string"` + + // The description of the database engine version for the database blueprint. + EngineVersionDescription *string `locationName:"engineVersionDescription" type:"string"` + + // A Boolean value indicating whether the engine version is the default for + // the database blueprint. + IsEngineDefault *bool `locationName:"isEngineDefault" type:"boolean"` +} + +// String returns the string representation +func (s RelationalDatabaseBlueprint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseBlueprint) GoString() string { + return s.String() +} + +// SetBlueprintId sets the BlueprintId field's value. +func (s *RelationalDatabaseBlueprint) SetBlueprintId(v string) *RelationalDatabaseBlueprint { + s.BlueprintId = &v + return s +} + +// SetEngine sets the Engine field's value. +func (s *RelationalDatabaseBlueprint) SetEngine(v string) *RelationalDatabaseBlueprint { + s.Engine = &v + return s +} + +// SetEngineDescription sets the EngineDescription field's value. +func (s *RelationalDatabaseBlueprint) SetEngineDescription(v string) *RelationalDatabaseBlueprint { + s.EngineDescription = &v + return s +} + +// SetEngineVersion sets the EngineVersion field's value. +func (s *RelationalDatabaseBlueprint) SetEngineVersion(v string) *RelationalDatabaseBlueprint { + s.EngineVersion = &v + return s +} + +// SetEngineVersionDescription sets the EngineVersionDescription field's value. +func (s *RelationalDatabaseBlueprint) SetEngineVersionDescription(v string) *RelationalDatabaseBlueprint { + s.EngineVersionDescription = &v + return s +} + +// SetIsEngineDefault sets the IsEngineDefault field's value. +func (s *RelationalDatabaseBlueprint) SetIsEngineDefault(v bool) *RelationalDatabaseBlueprint { + s.IsEngineDefault = &v + return s +} + +// Describes a database bundle. A bundle describes the performance specifications +// of the database. +type RelationalDatabaseBundle struct { + _ struct{} `type:"structure"` + + // The ID for the database bundle. + BundleId *string `locationName:"bundleId" type:"string"` + + // The number of virtual CPUs (vCPUs) for the database bundle. + CpuCount *int64 `locationName:"cpuCount" type:"integer"` + + // The size of the disk for the database bundle. + DiskSizeInGb *int64 `locationName:"diskSizeInGb" type:"integer"` + + // A Boolean value indicating whether the database bundle is active. + IsActive *bool `locationName:"isActive" type:"boolean"` + + // A Boolean value indicating whether the database bundle is encrypted. + IsEncrypted *bool `locationName:"isEncrypted" type:"boolean"` + + // The name for the database bundle. + Name *string `locationName:"name" type:"string"` + + // The cost of the database bundle in US currency. + Price *float64 `locationName:"price" type:"float"` + + // The amount of RAM in GB (for example, 2.0) for the database bundle. + RamSizeInGb *float64 `locationName:"ramSizeInGb" type:"float"` + + // The data transfer rate per month in GB for the database bundle. + TransferPerMonthInGb *int64 `locationName:"transferPerMonthInGb" type:"integer"` +} + +// String returns the string representation +func (s RelationalDatabaseBundle) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseBundle) GoString() string { + return s.String() +} + +// SetBundleId sets the BundleId field's value. +func (s *RelationalDatabaseBundle) SetBundleId(v string) *RelationalDatabaseBundle { + s.BundleId = &v + return s +} + +// SetCpuCount sets the CpuCount field's value. +func (s *RelationalDatabaseBundle) SetCpuCount(v int64) *RelationalDatabaseBundle { + s.CpuCount = &v + return s +} + +// SetDiskSizeInGb sets the DiskSizeInGb field's value. +func (s *RelationalDatabaseBundle) SetDiskSizeInGb(v int64) *RelationalDatabaseBundle { + s.DiskSizeInGb = &v + return s +} + +// SetIsActive sets the IsActive field's value. +func (s *RelationalDatabaseBundle) SetIsActive(v bool) *RelationalDatabaseBundle { + s.IsActive = &v + return s +} + +// SetIsEncrypted sets the IsEncrypted field's value. +func (s *RelationalDatabaseBundle) SetIsEncrypted(v bool) *RelationalDatabaseBundle { + s.IsEncrypted = &v + return s +} + +// SetName sets the Name field's value. +func (s *RelationalDatabaseBundle) SetName(v string) *RelationalDatabaseBundle { + s.Name = &v + return s +} + +// SetPrice sets the Price field's value. +func (s *RelationalDatabaseBundle) SetPrice(v float64) *RelationalDatabaseBundle { + s.Price = &v + return s +} + +// SetRamSizeInGb sets the RamSizeInGb field's value. +func (s *RelationalDatabaseBundle) SetRamSizeInGb(v float64) *RelationalDatabaseBundle { + s.RamSizeInGb = &v + return s +} + +// SetTransferPerMonthInGb sets the TransferPerMonthInGb field's value. +func (s *RelationalDatabaseBundle) SetTransferPerMonthInGb(v int64) *RelationalDatabaseBundle { + s.TransferPerMonthInGb = &v + return s +} + +// Describes an endpoint for a database. +type RelationalDatabaseEndpoint struct { + _ struct{} `type:"structure"` + + // Specifies the DNS address of the database. + Address *string `locationName:"address" type:"string"` + + // Specifies the port that the database is listening on. + Port *int64 `locationName:"port" type:"integer"` +} + +// String returns the string representation +func (s RelationalDatabaseEndpoint) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseEndpoint) GoString() string { + return s.String() +} + +// SetAddress sets the Address field's value. +func (s *RelationalDatabaseEndpoint) SetAddress(v string) *RelationalDatabaseEndpoint { + s.Address = &v + return s +} + +// SetPort sets the Port field's value. +func (s *RelationalDatabaseEndpoint) SetPort(v int64) *RelationalDatabaseEndpoint { + s.Port = &v + return s +} + +// Describes an event for a database. +type RelationalDatabaseEvent struct { + _ struct{} `type:"structure"` + + // The timestamp when the database event was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // The category that the database event belongs to. + EventCategories []*string `locationName:"eventCategories" type:"list"` + + // The message of the database event. + Message *string `locationName:"message" type:"string"` + + // The database that the database event relates to. + Resource *string `locationName:"resource" type:"string"` +} + +// String returns the string representation +func (s RelationalDatabaseEvent) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseEvent) GoString() string { + return s.String() +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *RelationalDatabaseEvent) SetCreatedAt(v time.Time) *RelationalDatabaseEvent { + s.CreatedAt = &v + return s +} + +// SetEventCategories sets the EventCategories field's value. +func (s *RelationalDatabaseEvent) SetEventCategories(v []*string) *RelationalDatabaseEvent { + s.EventCategories = v + return s +} + +// SetMessage sets the Message field's value. +func (s *RelationalDatabaseEvent) SetMessage(v string) *RelationalDatabaseEvent { + s.Message = &v + return s +} + +// SetResource sets the Resource field's value. +func (s *RelationalDatabaseEvent) SetResource(v string) *RelationalDatabaseEvent { + s.Resource = &v + return s +} + +// Describes the hardware of a database. +type RelationalDatabaseHardware struct { + _ struct{} `type:"structure"` + + // The number of vCPUs for the database. + CpuCount *int64 `locationName:"cpuCount" type:"integer"` + + // The size of the disk for the database. + DiskSizeInGb *int64 `locationName:"diskSizeInGb" type:"integer"` + + // The amount of RAM in GB for the database. + RamSizeInGb *float64 `locationName:"ramSizeInGb" type:"float"` +} + +// String returns the string representation +func (s RelationalDatabaseHardware) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseHardware) GoString() string { + return s.String() +} + +// SetCpuCount sets the CpuCount field's value. +func (s *RelationalDatabaseHardware) SetCpuCount(v int64) *RelationalDatabaseHardware { + s.CpuCount = &v + return s +} + +// SetDiskSizeInGb sets the DiskSizeInGb field's value. +func (s *RelationalDatabaseHardware) SetDiskSizeInGb(v int64) *RelationalDatabaseHardware { + s.DiskSizeInGb = &v + return s +} + +// SetRamSizeInGb sets the RamSizeInGb field's value. +func (s *RelationalDatabaseHardware) SetRamSizeInGb(v float64) *RelationalDatabaseHardware { + s.RamSizeInGb = &v + return s +} + +// Describes the parameters of a database. +type RelationalDatabaseParameter struct { + _ struct{} `type:"structure"` + + // Specifies the valid range of values for the parameter. + AllowedValues *string `locationName:"allowedValues" type:"string"` + + // Indicates when parameter updates are applied. + // + // Can be immediate or pending-reboot. + ApplyMethod *string `locationName:"applyMethod" type:"string"` + + // Specifies the engine-specific parameter type. + ApplyType *string `locationName:"applyType" type:"string"` + + // Specifies the valid data type for the parameter. + DataType *string `locationName:"dataType" type:"string"` + + // Provides a description of the parameter. + Description *string `locationName:"description" type:"string"` + + // A Boolean value indicating whether the parameter can be modified. + IsModifiable *bool `locationName:"isModifiable" type:"boolean"` + + // Specifies the name of the parameter. + ParameterName *string `locationName:"parameterName" type:"string"` + + // Specifies the value of the parameter. + ParameterValue *string `locationName:"parameterValue" type:"string"` +} + +// String returns the string representation +func (s RelationalDatabaseParameter) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseParameter) GoString() string { + return s.String() +} + +// SetAllowedValues sets the AllowedValues field's value. +func (s *RelationalDatabaseParameter) SetAllowedValues(v string) *RelationalDatabaseParameter { + s.AllowedValues = &v + return s +} + +// SetApplyMethod sets the ApplyMethod field's value. +func (s *RelationalDatabaseParameter) SetApplyMethod(v string) *RelationalDatabaseParameter { + s.ApplyMethod = &v + return s +} + +// SetApplyType sets the ApplyType field's value. +func (s *RelationalDatabaseParameter) SetApplyType(v string) *RelationalDatabaseParameter { + s.ApplyType = &v + return s +} + +// SetDataType sets the DataType field's value. +func (s *RelationalDatabaseParameter) SetDataType(v string) *RelationalDatabaseParameter { + s.DataType = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *RelationalDatabaseParameter) SetDescription(v string) *RelationalDatabaseParameter { + s.Description = &v + return s +} + +// SetIsModifiable sets the IsModifiable field's value. +func (s *RelationalDatabaseParameter) SetIsModifiable(v bool) *RelationalDatabaseParameter { + s.IsModifiable = &v + return s +} + +// SetParameterName sets the ParameterName field's value. +func (s *RelationalDatabaseParameter) SetParameterName(v string) *RelationalDatabaseParameter { + s.ParameterName = &v + return s +} + +// SetParameterValue sets the ParameterValue field's value. +func (s *RelationalDatabaseParameter) SetParameterValue(v string) *RelationalDatabaseParameter { + s.ParameterValue = &v + return s +} + +// Describes a database snapshot. +type RelationalDatabaseSnapshot struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the database snapshot. + Arn *string `locationName:"arn" type:"string"` + + // The timestamp when the database snapshot was created. + CreatedAt *time.Time `locationName:"createdAt" type:"timestamp"` + + // The software of the database snapshot (for example, MySQL) + Engine *string `locationName:"engine" type:"string"` + + // The database engine version for the database snapshot (for example, 5.7.23). + EngineVersion *string `locationName:"engineVersion" type:"string"` + + // The Amazon Resource Name (ARN) of the database from which the database snapshot + // was created. + FromRelationalDatabaseArn *string `locationName:"fromRelationalDatabaseArn" type:"string"` + + // The blueprint ID of the database from which the database snapshot was created. + // A blueprint describes the major engine version of a database. + FromRelationalDatabaseBlueprintId *string `locationName:"fromRelationalDatabaseBlueprintId" type:"string"` + + // The bundle ID of the database from which the database snapshot was created. + FromRelationalDatabaseBundleId *string `locationName:"fromRelationalDatabaseBundleId" type:"string"` + + // The name of the source database from which the database snapshot was created. + FromRelationalDatabaseName *string `locationName:"fromRelationalDatabaseName" type:"string"` + + // The Region name and Availability Zone where the database snapshot is located. + Location *ResourceLocation `locationName:"location" type:"structure"` + + // The name of the database snapshot. + Name *string `locationName:"name" type:"string"` + + // The Lightsail resource type. + ResourceType *string `locationName:"resourceType" type:"string" enum:"ResourceType"` + + // The size of the disk in GB (for example, 32) for the database snapshot. + SizeInGb *int64 `locationName:"sizeInGb" type:"integer"` + + // The state of the database snapshot. + State *string `locationName:"state" type:"string"` + + // The support code for the database snapshot. Include this code in your email + // to support when you have questions about a database snapshot in Lightsail. + // This code enables our support team to look up your Lightsail information + // more easily. + SupportCode *string `locationName:"supportCode" type:"string"` + + // The tag keys and optional values for the resource. For more information about + // tags in Lightsail, see the Lightsail Dev Guide (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). + Tags []*Tag `locationName:"tags" type:"list"` +} + +// String returns the string representation +func (s RelationalDatabaseSnapshot) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s RelationalDatabaseSnapshot) GoString() string { + return s.String() +} + +// SetArn sets the Arn field's value. +func (s *RelationalDatabaseSnapshot) SetArn(v string) *RelationalDatabaseSnapshot { + s.Arn = &v + return s +} + +// SetCreatedAt sets the CreatedAt field's value. +func (s *RelationalDatabaseSnapshot) SetCreatedAt(v time.Time) *RelationalDatabaseSnapshot { + s.CreatedAt = &v + return s +} + +// SetEngine sets the Engine field's value. +func (s *RelationalDatabaseSnapshot) SetEngine(v string) *RelationalDatabaseSnapshot { + s.Engine = &v + return s +} + +// SetEngineVersion sets the EngineVersion field's value. +func (s *RelationalDatabaseSnapshot) SetEngineVersion(v string) *RelationalDatabaseSnapshot { + s.EngineVersion = &v + return s +} + +// SetFromRelationalDatabaseArn sets the FromRelationalDatabaseArn field's value. +func (s *RelationalDatabaseSnapshot) SetFromRelationalDatabaseArn(v string) *RelationalDatabaseSnapshot { + s.FromRelationalDatabaseArn = &v + return s +} + +// SetFromRelationalDatabaseBlueprintId sets the FromRelationalDatabaseBlueprintId field's value. +func (s *RelationalDatabaseSnapshot) SetFromRelationalDatabaseBlueprintId(v string) *RelationalDatabaseSnapshot { + s.FromRelationalDatabaseBlueprintId = &v + return s +} + +// SetFromRelationalDatabaseBundleId sets the FromRelationalDatabaseBundleId field's value. +func (s *RelationalDatabaseSnapshot) SetFromRelationalDatabaseBundleId(v string) *RelationalDatabaseSnapshot { + s.FromRelationalDatabaseBundleId = &v + return s +} + +// SetFromRelationalDatabaseName sets the FromRelationalDatabaseName field's value. +func (s *RelationalDatabaseSnapshot) SetFromRelationalDatabaseName(v string) *RelationalDatabaseSnapshot { + s.FromRelationalDatabaseName = &v + return s +} + +// SetLocation sets the Location field's value. +func (s *RelationalDatabaseSnapshot) SetLocation(v *ResourceLocation) *RelationalDatabaseSnapshot { + s.Location = v + return s +} + +// SetName sets the Name field's value. +func (s *RelationalDatabaseSnapshot) SetName(v string) *RelationalDatabaseSnapshot { + s.Name = &v + return s +} + +// SetResourceType sets the ResourceType field's value. +func (s *RelationalDatabaseSnapshot) SetResourceType(v string) *RelationalDatabaseSnapshot { + s.ResourceType = &v + return s +} + +// SetSizeInGb sets the SizeInGb field's value. +func (s *RelationalDatabaseSnapshot) SetSizeInGb(v int64) *RelationalDatabaseSnapshot { + s.SizeInGb = &v + return s +} + +// SetState sets the State field's value. +func (s *RelationalDatabaseSnapshot) SetState(v string) *RelationalDatabaseSnapshot { + s.State = &v + return s +} + +// SetSupportCode sets the SupportCode field's value. +func (s *RelationalDatabaseSnapshot) SetSupportCode(v string) *RelationalDatabaseSnapshot { + s.SupportCode = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *RelationalDatabaseSnapshot) SetTags(v []*Tag) *RelationalDatabaseSnapshot { + s.Tags = v + return s +} + type ReleaseStaticIpInput struct { _ struct{} `type:"structure"` @@ -15183,6 +22545,67 @@ func (s *StartInstanceOutput) SetOperations(v []*Operation) *StartInstanceOutput return s } +type StartRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The name of your database to start. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s StartRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *StartRelationalDatabaseInput) SetRelationalDatabaseName(v string) *StartRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +type StartRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your start relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s StartRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *StartRelationalDatabaseOutput) SetOperations(v []*Operation) *StartRelationalDatabaseOutput { + s.Operations = v + return s +} + // Describes the static IP. type StaticIp struct { _ struct{} `type:"structure"` @@ -15356,6 +22779,194 @@ func (s *StopInstanceOutput) SetOperations(v []*Operation) *StopInstanceOutput { return s } +type StopRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // The name of your database to stop. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // The name of your new database snapshot to be created before stopping your + // database. + RelationalDatabaseSnapshotName *string `locationName:"relationalDatabaseSnapshotName" type:"string"` +} + +// String returns the string representation +func (s StopRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *StopRelationalDatabaseInput) SetRelationalDatabaseName(v string) *StopRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +// SetRelationalDatabaseSnapshotName sets the RelationalDatabaseSnapshotName field's value. +func (s *StopRelationalDatabaseInput) SetRelationalDatabaseSnapshotName(v string) *StopRelationalDatabaseInput { + s.RelationalDatabaseSnapshotName = &v + return s +} + +type StopRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your stop relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s StopRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *StopRelationalDatabaseOutput) SetOperations(v []*Operation) *StopRelationalDatabaseOutput { + s.Operations = v + return s +} + +// Describes a tag key and optional value assigned to an Amazon Lightsail resource. +// +// For more information about tags in Lightsail, see the Lightsail Dev Guide +// (https://lightsail.aws.amazon.com/ls/docs/en/articles/amazon-lightsail-tags). +type Tag struct { + _ struct{} `type:"structure"` + + // The key of the tag. + // + // Constraints: Tag keys accept a maximum of 128 letters, numbers, spaces in + // UTF-8, or the following characters: + - = . _ : / @ + Key *string `locationName:"key" type:"string"` + + // The value of the tag. + // + // Constraints: Tag values accept a maximum of 256 letters, numbers, spaces + // in UTF-8, or the following characters: + - = . _ : / @ + Value *string `locationName:"value" type:"string"` +} + +// 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() +} + +// 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 +} + +type TagResourceInput struct { + _ struct{} `type:"structure"` + + // The name of the resource to which you are adding tags. + // + // ResourceName is a required field + ResourceName *string `locationName:"resourceName" type:"string" required:"true"` + + // The tag key and optional value. + // + // Tags is a required field + Tags []*Tag `locationName:"tags" type:"list" required:"true"` +} + +// String returns the string representation +func (s TagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *TagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "TagResourceInput"} + if s.ResourceName == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceName")) + } + if s.Tags == nil { + invalidParams.Add(request.NewErrParamRequired("Tags")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceName sets the ResourceName field's value. +func (s *TagResourceInput) SetResourceName(v string) *TagResourceInput { + s.ResourceName = &v + return s +} + +// SetTags sets the Tags field's value. +func (s *TagResourceInput) SetTags(v []*Tag) *TagResourceInput { + s.Tags = v + return s +} + +type TagResourceOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s TagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s TagResourceOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *TagResourceOutput) SetOperations(v []*Operation) *TagResourceOutput { + s.Operations = v + return s +} + type UnpeerVpcInput struct { _ struct{} `type:"structure"` } @@ -15393,6 +23004,81 @@ func (s *UnpeerVpcOutput) SetOperation(v *Operation) *UnpeerVpcOutput { return s } +type UntagResourceInput struct { + _ struct{} `type:"structure"` + + // The name of the resource from which you are removing a tag. + // + // ResourceName is a required field + ResourceName *string `locationName:"resourceName" type:"string" required:"true"` + + // The tag keys to delete from the specified resource. + // + // TagKeys is a required field + TagKeys []*string `locationName:"tagKeys" type:"list" required:"true"` +} + +// String returns the string representation +func (s UntagResourceInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UntagResourceInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UntagResourceInput"} + if s.ResourceName == nil { + invalidParams.Add(request.NewErrParamRequired("ResourceName")) + } + if s.TagKeys == nil { + invalidParams.Add(request.NewErrParamRequired("TagKeys")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetResourceName sets the ResourceName field's value. +func (s *UntagResourceInput) SetResourceName(v string) *UntagResourceInput { + s.ResourceName = &v + return s +} + +// SetTagKeys sets the TagKeys field's value. +func (s *UntagResourceInput) SetTagKeys(v []*string) *UntagResourceInput { + s.TagKeys = v + return s +} + +type UntagResourceOutput struct { + _ struct{} `type:"structure"` + + // A list of objects describing the API operation. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s UntagResourceOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UntagResourceOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *UntagResourceOutput) SetOperations(v []*Operation) *UntagResourceOutput { + s.Operations = v + return s +} + type UpdateDomainEntryInput struct { _ struct{} `type:"structure"` @@ -15560,6 +23246,264 @@ func (s *UpdateLoadBalancerAttributeOutput) SetOperations(v []*Operation) *Updat return s } +type UpdateRelationalDatabaseInput struct { + _ struct{} `type:"structure"` + + // When true, applies changes immediately. When false, applies changes during + // the preferred maintenance window. Some changes may cause an outage. + // + // Default: false + ApplyImmediately *bool `locationName:"applyImmediately" type:"boolean"` + + // When true, disables automated backup retention for your database. + // + // Disabling backup retention deletes all automated database backups. Before + // disabling this, you may want to create a snapshot of your database using + // the create relational database snapshot operation. + // + // Updates are applied during the next maintenance window because this can result + // in an outage. + DisableBackupRetention *bool `locationName:"disableBackupRetention" type:"boolean"` + + // When true, enables automated backup retention for your database. + // + // Updates are applied during the next maintenance window because this can result + // in an outage. + EnableBackupRetention *bool `locationName:"enableBackupRetention" type:"boolean"` + + // The password for the master user of your database. The password can include + // any printable ASCII character except "/", """, or "@". + // + // Constraints: Must contain 8 to 41 characters. + MasterUserPassword *string `locationName:"masterUserPassword" type:"string" sensitive:"true"` + + // The daily time range during which automated backups are created for your + // database if automated backups are enabled. + // + // Constraints: + // + // * Must be in the hh24:mi-hh24:mi format. Example: 16:00-16:30 + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Must not conflict with the preferred maintenance window. + // + // * Must be at least 30 minutes. + PreferredBackupWindow *string `locationName:"preferredBackupWindow" type:"string"` + + // The weekly time range during which system maintenance can occur on your database. + // + // The default is a 30-minute window selected at random from an 8-hour block + // of time for each AWS Region, occurring on a random day of the week. + // + // Constraints: + // + // * Must be in the ddd:hh24:mi-ddd:hh24:mi format. + // + // * Valid days: Mon, Tue, Wed, Thu, Fri, Sat, Sun. + // + // * Must be at least 30 minutes. + // + // * Specified in Universal Coordinated Time (UTC). + // + // * Example: Tue:17:00-Tue:17:30 + PreferredMaintenanceWindow *string `locationName:"preferredMaintenanceWindow" type:"string"` + + // Specifies the accessibility options for your database. A value of true specifies + // a database that is available to resources outside of your Lightsail account. + // A value of false specifies a database that is available only to your Lightsail + // resources in the same region as your database. + PubliclyAccessible *bool `locationName:"publiclyAccessible" type:"boolean"` + + // The name of your database to update. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` + + // When true, the master user password is changed to a new strong password generated + // by Lightsail. + // + // Use the get relational database master user password operation to get the + // new password. + RotateMasterUserPassword *bool `locationName:"rotateMasterUserPassword" type:"boolean"` +} + +// String returns the string representation +func (s UpdateRelationalDatabaseInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRelationalDatabaseInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateRelationalDatabaseInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateRelationalDatabaseInput"} + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetApplyImmediately sets the ApplyImmediately field's value. +func (s *UpdateRelationalDatabaseInput) SetApplyImmediately(v bool) *UpdateRelationalDatabaseInput { + s.ApplyImmediately = &v + return s +} + +// SetDisableBackupRetention sets the DisableBackupRetention field's value. +func (s *UpdateRelationalDatabaseInput) SetDisableBackupRetention(v bool) *UpdateRelationalDatabaseInput { + s.DisableBackupRetention = &v + return s +} + +// SetEnableBackupRetention sets the EnableBackupRetention field's value. +func (s *UpdateRelationalDatabaseInput) SetEnableBackupRetention(v bool) *UpdateRelationalDatabaseInput { + s.EnableBackupRetention = &v + return s +} + +// SetMasterUserPassword sets the MasterUserPassword field's value. +func (s *UpdateRelationalDatabaseInput) SetMasterUserPassword(v string) *UpdateRelationalDatabaseInput { + s.MasterUserPassword = &v + return s +} + +// SetPreferredBackupWindow sets the PreferredBackupWindow field's value. +func (s *UpdateRelationalDatabaseInput) SetPreferredBackupWindow(v string) *UpdateRelationalDatabaseInput { + s.PreferredBackupWindow = &v + return s +} + +// SetPreferredMaintenanceWindow sets the PreferredMaintenanceWindow field's value. +func (s *UpdateRelationalDatabaseInput) SetPreferredMaintenanceWindow(v string) *UpdateRelationalDatabaseInput { + s.PreferredMaintenanceWindow = &v + return s +} + +// SetPubliclyAccessible sets the PubliclyAccessible field's value. +func (s *UpdateRelationalDatabaseInput) SetPubliclyAccessible(v bool) *UpdateRelationalDatabaseInput { + s.PubliclyAccessible = &v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *UpdateRelationalDatabaseInput) SetRelationalDatabaseName(v string) *UpdateRelationalDatabaseInput { + s.RelationalDatabaseName = &v + return s +} + +// SetRotateMasterUserPassword sets the RotateMasterUserPassword field's value. +func (s *UpdateRelationalDatabaseInput) SetRotateMasterUserPassword(v bool) *UpdateRelationalDatabaseInput { + s.RotateMasterUserPassword = &v + return s +} + +type UpdateRelationalDatabaseOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your update relational database request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s UpdateRelationalDatabaseOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRelationalDatabaseOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *UpdateRelationalDatabaseOutput) SetOperations(v []*Operation) *UpdateRelationalDatabaseOutput { + s.Operations = v + return s +} + +type UpdateRelationalDatabaseParametersInput struct { + _ struct{} `type:"structure"` + + // The database parameters to update. + // + // Parameters is a required field + Parameters []*RelationalDatabaseParameter `locationName:"parameters" type:"list" required:"true"` + + // The name of your database for which to update parameters. + // + // RelationalDatabaseName is a required field + RelationalDatabaseName *string `locationName:"relationalDatabaseName" type:"string" required:"true"` +} + +// String returns the string representation +func (s UpdateRelationalDatabaseParametersInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRelationalDatabaseParametersInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *UpdateRelationalDatabaseParametersInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "UpdateRelationalDatabaseParametersInput"} + if s.Parameters == nil { + invalidParams.Add(request.NewErrParamRequired("Parameters")) + } + if s.RelationalDatabaseName == nil { + invalidParams.Add(request.NewErrParamRequired("RelationalDatabaseName")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetParameters sets the Parameters field's value. +func (s *UpdateRelationalDatabaseParametersInput) SetParameters(v []*RelationalDatabaseParameter) *UpdateRelationalDatabaseParametersInput { + s.Parameters = v + return s +} + +// SetRelationalDatabaseName sets the RelationalDatabaseName field's value. +func (s *UpdateRelationalDatabaseParametersInput) SetRelationalDatabaseName(v string) *UpdateRelationalDatabaseParametersInput { + s.RelationalDatabaseName = &v + return s +} + +type UpdateRelationalDatabaseParametersOutput struct { + _ struct{} `type:"structure"` + + // An object describing the result of your update relational database parameters + // request. + Operations []*Operation `locationName:"operations" type:"list"` +} + +// String returns the string representation +func (s UpdateRelationalDatabaseParametersOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UpdateRelationalDatabaseParametersOutput) GoString() string { + return s.String() +} + +// SetOperations sets the Operations field's value. +func (s *UpdateRelationalDatabaseParametersOutput) SetOperations(v []*Operation) *UpdateRelationalDatabaseParametersOutput { + s.Operations = v + return s +} + const ( // AccessDirectionInbound is a AccessDirection enum value AccessDirectionInbound = "inbound" @@ -15576,6 +23520,11 @@ const ( BlueprintTypeApp = "app" ) +const ( + // CloudFormationStackRecordSourceTypeExportSnapshotRecord is a CloudFormationStackRecordSourceType enum value + CloudFormationStackRecordSourceTypeExportSnapshotRecord = "ExportSnapshotRecord" +) + const ( // DiskSnapshotStatePending is a DiskSnapshotState enum value DiskSnapshotStatePending = "pending" @@ -15607,6 +23556,14 @@ const ( DiskStateUnknown = "unknown" ) +const ( + // ExportSnapshotRecordSourceTypeInstanceSnapshot is a ExportSnapshotRecordSourceType enum value + ExportSnapshotRecordSourceTypeInstanceSnapshot = "InstanceSnapshot" + + // ExportSnapshotRecordSourceTypeDiskSnapshot is a ExportSnapshotRecordSourceType enum value + ExportSnapshotRecordSourceTypeDiskSnapshot = "DiskSnapshot" +) + const ( // InstanceAccessProtocolSsh is a InstanceAccessProtocol enum value InstanceAccessProtocolSsh = "ssh" @@ -16012,6 +23969,9 @@ const ( ) const ( + // OperationTypeDeleteKnownHostKeys is a OperationType enum value + OperationTypeDeleteKnownHostKeys = "DeleteKnownHostKeys" + // OperationTypeDeleteInstance is a OperationType enum value OperationTypeDeleteInstance = "DeleteInstance" @@ -16113,6 +24073,36 @@ const ( // OperationTypeCreateDiskFromSnapshot is a OperationType enum value OperationTypeCreateDiskFromSnapshot = "CreateDiskFromSnapshot" + + // OperationTypeCreateRelationalDatabase is a OperationType enum value + OperationTypeCreateRelationalDatabase = "CreateRelationalDatabase" + + // OperationTypeUpdateRelationalDatabase is a OperationType enum value + OperationTypeUpdateRelationalDatabase = "UpdateRelationalDatabase" + + // OperationTypeDeleteRelationalDatabase is a OperationType enum value + OperationTypeDeleteRelationalDatabase = "DeleteRelationalDatabase" + + // OperationTypeCreateRelationalDatabaseFromSnapshot is a OperationType enum value + OperationTypeCreateRelationalDatabaseFromSnapshot = "CreateRelationalDatabaseFromSnapshot" + + // OperationTypeCreateRelationalDatabaseSnapshot is a OperationType enum value + OperationTypeCreateRelationalDatabaseSnapshot = "CreateRelationalDatabaseSnapshot" + + // OperationTypeDeleteRelationalDatabaseSnapshot is a OperationType enum value + OperationTypeDeleteRelationalDatabaseSnapshot = "DeleteRelationalDatabaseSnapshot" + + // OperationTypeUpdateRelationalDatabaseParameters is a OperationType enum value + OperationTypeUpdateRelationalDatabaseParameters = "UpdateRelationalDatabaseParameters" + + // OperationTypeStartRelationalDatabase is a OperationType enum value + OperationTypeStartRelationalDatabase = "StartRelationalDatabase" + + // OperationTypeRebootRelationalDatabase is a OperationType enum value + OperationTypeRebootRelationalDatabase = "RebootRelationalDatabase" + + // OperationTypeStopRelationalDatabase is a OperationType enum value + OperationTypeStopRelationalDatabase = "StopRelationalDatabase" ) const ( @@ -16123,6 +24113,20 @@ const ( PortAccessTypePrivate = "Private" ) +const ( + // PortInfoSourceTypeDefault is a PortInfoSourceType enum value + PortInfoSourceTypeDefault = "DEFAULT" + + // PortInfoSourceTypeInstance is a PortInfoSourceType enum value + PortInfoSourceTypeInstance = "INSTANCE" + + // PortInfoSourceTypeNone is a PortInfoSourceType enum value + PortInfoSourceTypeNone = "NONE" + + // PortInfoSourceTypeClosed is a PortInfoSourceType enum value + PortInfoSourceTypeClosed = "CLOSED" +) + const ( // PortStateOpen is a PortState enum value PortStateOpen = "open" @@ -16131,6 +24135,17 @@ const ( PortStateClosed = "closed" ) +const ( + // RecordStateStarted is a RecordState enum value + RecordStateStarted = "Started" + + // RecordStateSucceeded is a RecordState enum value + RecordStateSucceeded = "Succeeded" + + // RecordStateFailed is a RecordState enum value + RecordStateFailed = "Failed" +) + const ( // RegionNameUsEast1 is a RegionName enum value RegionNameUsEast1 = "us-east-1" @@ -16144,15 +24159,21 @@ const ( // RegionNameUsWest2 is a RegionName enum value RegionNameUsWest2 = "us-west-2" - // RegionNameEuCentral1 is a RegionName enum value - RegionNameEuCentral1 = "eu-central-1" - // RegionNameEuWest1 is a RegionName enum value RegionNameEuWest1 = "eu-west-1" // RegionNameEuWest2 is a RegionName enum value RegionNameEuWest2 = "eu-west-2" + // RegionNameEuWest3 is a RegionName enum value + RegionNameEuWest3 = "eu-west-3" + + // RegionNameEuCentral1 is a RegionName enum value + RegionNameEuCentral1 = "eu-central-1" + + // RegionNameCaCentral1 is a RegionName enum value + RegionNameCaCentral1 = "ca-central-1" + // RegionNameApSouth1 is a RegionName enum value RegionNameApSouth1 = "ap-south-1" @@ -16169,6 +24190,42 @@ const ( RegionNameApNortheast2 = "ap-northeast-2" ) +const ( + // RelationalDatabaseEngineMysql is a RelationalDatabaseEngine enum value + RelationalDatabaseEngineMysql = "mysql" +) + +const ( + // RelationalDatabaseMetricNameCpuutilization is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameCpuutilization = "CPUUtilization" + + // RelationalDatabaseMetricNameDatabaseConnections is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameDatabaseConnections = "DatabaseConnections" + + // RelationalDatabaseMetricNameDiskQueueDepth is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameDiskQueueDepth = "DiskQueueDepth" + + // RelationalDatabaseMetricNameFreeStorageSpace is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameFreeStorageSpace = "FreeStorageSpace" + + // RelationalDatabaseMetricNameNetworkReceiveThroughput is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameNetworkReceiveThroughput = "NetworkReceiveThroughput" + + // RelationalDatabaseMetricNameNetworkTransmitThroughput is a RelationalDatabaseMetricName enum value + RelationalDatabaseMetricNameNetworkTransmitThroughput = "NetworkTransmitThroughput" +) + +const ( + // RelationalDatabasePasswordVersionCurrent is a RelationalDatabasePasswordVersion enum value + RelationalDatabasePasswordVersionCurrent = "CURRENT" + + // RelationalDatabasePasswordVersionPrevious is a RelationalDatabasePasswordVersion enum value + RelationalDatabasePasswordVersionPrevious = "PREVIOUS" + + // RelationalDatabasePasswordVersionPending is a RelationalDatabasePasswordVersion enum value + RelationalDatabasePasswordVersionPending = "PENDING" +) + const ( // ResourceTypeInstance is a ResourceType enum value ResourceTypeInstance = "Instance" @@ -16199,4 +24256,16 @@ const ( // ResourceTypeDiskSnapshot is a ResourceType enum value ResourceTypeDiskSnapshot = "DiskSnapshot" + + // ResourceTypeRelationalDatabase is a ResourceType enum value + ResourceTypeRelationalDatabase = "RelationalDatabase" + + // ResourceTypeRelationalDatabaseSnapshot is a ResourceType enum value + ResourceTypeRelationalDatabaseSnapshot = "RelationalDatabaseSnapshot" + + // ResourceTypeExportSnapshotRecord is a ResourceType enum value + ResourceTypeExportSnapshotRecord = "ExportSnapshotRecord" + + // ResourceTypeCloudFormationStackRecord is a ResourceType enum value + ResourceTypeCloudFormationStackRecord = "CloudFormationStackRecord" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go index 9c52815b..f806bbf0 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go @@ -5,10 +5,10 @@ // // Amazon Lightsail is the easiest way to get started with AWS for developers // who just need virtual private servers. Lightsail includes everything you -// need to launch your project quickly - a virtual machine, SSD-based storage, -// data transfer, DNS management, and a static IP - for a low, predictable price. -// You manage those Lightsail servers through the Lightsail console or by using -// the API or command-line interface (CLI). +// need to launch your project quickly - a virtual machine, a managed database, +// SSD-based storage, data transfer, DNS management, and a static IP - for a +// low, predictable price. You manage those Lightsail servers through the Lightsail +// console or by using the API or command-line interface (CLI). // // For more information about Lightsail concepts and tasks, see the Lightsail // Dev Guide (https://lightsail.aws.amazon.com/ls/docs/all). diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/api.go b/vendor/github.com/aws/aws-sdk-go/service/route53/api.go index 97351a76..25821d8c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/api.go @@ -9,6 +9,8 @@ import ( "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 opAssociateVPCWithHostedZone = "AssociateVPCWithHostedZone" @@ -16,7 +18,7 @@ const opAssociateVPCWithHostedZone = "AssociateVPCWithHostedZone" // AssociateVPCWithHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the AssociateVPCWithHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -102,7 +104,7 @@ func (c *Route53) AssociateVPCWithHostedZoneRequest(input *AssociateVPCWithHoste // the same name as an existing hosted zone or that's the parent or child // of an existing hosted zone, and you specified a delegation set that shares // one or more name servers with the existing hosted zone. For more information, -// see CreateReusableDelegationSet. +// see CreateReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html). // // * Private hosted zone: You specified an Amazon VPC that you're already // using for another hosted zone, and the domain that you specified for one @@ -115,8 +117,9 @@ func (c *Route53) AssociateVPCWithHostedZoneRequest(input *AssociateVPCWithHoste // reached the limit on reusable delegation sets that it can create or because // you've reached the limit on the number of Amazon VPCs that you can associate // with a private hosted zone. To get the current limit on the number of reusable -// delegation sets, see GetAccountLimit. To get the current limit on the number -// of Amazon VPCs that you can associate with a private hosted zone, see GetHostedZoneLimit. +// delegation sets, see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). +// To get the current limit on the number of Amazon VPCs that you can associate +// with a private hosted zone, see GetHostedZoneLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetHostedZoneLimit.html). // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. // @@ -147,7 +150,7 @@ const opChangeResourceRecordSets = "ChangeResourceRecordSets" // ChangeResourceRecordSetsRequest generates a "aws/request.Request" representing the // client's request for the ChangeResourceRecordSets operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -197,28 +200,28 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // The request body must include a document with a ChangeResourceRecordSetsRequest // element. The request body contains a list of change items, known as a change // batch. Change batches are considered transactional changes. When using the -// Amazon Route 53 API to change resource record sets, Amazon Route 53 either -// makes all or none of the changes in a change batch request. This ensures -// that Amazon Route 53 never partially implements the intended changes to the -// resource record sets in a hosted zone. +// Amazon Route 53 API to change resource record sets, Route 53 either makes +// all or none of the changes in a change batch request. This ensures that Route +// 53 never partially implements the intended changes to the resource record +// sets in a hosted zone. // // For example, a change batch request that deletes the CNAME record for www.example.com -// and creates an alias resource record set for www.example.com. Amazon Route -// 53 deletes the first resource record set and creates the second resource -// record set in a single operation. If either the DELETE or the CREATE action -// fails, then both changes (plus any other changes in the batch) fail, and -// the original CNAME record continues to exist. +// and creates an alias resource record set for www.example.com. Route 53 deletes +// the first resource record set and creates the second resource record set +// in a single operation. If either the DELETE or the CREATE action fails, then +// both changes (plus any other changes in the batch) fail, and the original +// CNAME record continues to exist. // // Due to the nature of transactional changes, you can't delete the same resource // record set more than once in a single change batch. If you attempt to delete -// the same change batch more than once, Amazon Route 53 returns an InvalidChangeBatch +// the same change batch more than once, Route 53 returns an InvalidChangeBatch // error. // // Traffic Flow // // To create resource record sets for complex routing configurations, use either -// the traffic flow visual editor in the Amazon Route 53 console or the API -// actions for traffic policies and traffic policy instances. Save the configuration +// the traffic flow visual editor in the Route 53 console or the API actions +// for traffic policies and traffic policy instances. Save the configuration // as a traffic policy, then associate the traffic policy with one or more domain // names (such as example.com) or subdomain names (such as www.example.com), // in the same hosted zone or in multiple hosted zones. You can roll back the @@ -236,8 +239,8 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // values. // // * UPSERT: If a resource record set does not already exist, AWS creates -// it. If a resource set does exist, Amazon Route 53 updates it with the -// values in the request. +// it. If a resource set does exist, Route 53 updates it with the values +// in the request. // // Syntaxes for Creating, Updating, and Deleting Resource Record Sets // @@ -251,19 +254,19 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // all of the elements for every kind of resource record set that you can create, // delete, or update by using ChangeResourceRecordSets. // -// Change Propagation to Amazon Route 53 DNS Servers +// Change Propagation to Route 53 DNS Servers // -// When you submit a ChangeResourceRecordSets request, Amazon Route 53 propagates -// your changes to all of the Amazon Route 53 authoritative DNS servers. While -// your changes are propagating, GetChange returns a status of PENDING. When -// propagation is complete, GetChange returns a status of INSYNC. Changes generally -// propagate to all Amazon Route 53 name servers within 60 seconds. For more -// information, see GetChange. +// When you submit a ChangeResourceRecordSets request, Route 53 propagates your +// changes to all of the Route 53 authoritative DNS servers. While your changes +// are propagating, GetChange returns a status of PENDING. When propagation +// is complete, GetChange returns a status of INSYNC. Changes generally propagate +// to all Route 53 name servers within 60 seconds. For more information, see +// GetChange (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html). // // Limits on ChangeResourceRecordSets Requests // // For information about the limits on a ChangeResourceRecordSets request, see -// Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -278,8 +281,7 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // No hosted zone exists with the ID that you specified. // // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeInvalidChangeBatch "InvalidChangeBatch" // This exception contains a list of messages that might contain one or more @@ -291,8 +293,8 @@ func (c *Route53) ChangeResourceRecordSetsRequest(input *ChangeResourceRecordSet // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/ChangeResourceRecordSets @@ -322,7 +324,7 @@ const opChangeTagsForResource = "ChangeTagsForResource" // ChangeTagsForResourceRequest generates a "aws/request.Request" representing the // client's request for the ChangeTagsForResource operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -356,6 +358,7 @@ func (c *Route53) ChangeTagsForResourceRequest(input *ChangeTagsForResourceInput output = &ChangeTagsForResourceOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -364,7 +367,7 @@ func (c *Route53) ChangeTagsForResourceRequest(input *ChangeTagsForResourceInput // Adds, edits, or deletes tags for a health check or a hosted zone. // // For information about using tags for cost allocation, see Using Cost Allocation -// Tags (http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) +// Tags (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) // in the AWS Billing and Cost Management User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -379,8 +382,7 @@ func (c *Route53) ChangeTagsForResourceRequest(input *ChangeTagsForResourceInput // The input is not valid. // // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeNoSuchHostedZone "NoSuchHostedZone" // No hosted zone exists with the ID that you specified. @@ -388,8 +390,8 @@ func (c *Route53) ChangeTagsForResourceRequest(input *ChangeTagsForResourceInput // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" @@ -422,7 +424,7 @@ const opCreateHealthCheck = "CreateHealthCheck" // CreateHealthCheckRequest generates a "aws/request.Request" representing the // client's request for the CreateHealthCheck operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -463,25 +465,26 @@ func (c *Route53) CreateHealthCheckRequest(input *CreateHealthCheckInput) (req * // // Creates a new health check. // -// For information about adding health checks to resource record sets, see ResourceRecordSet$HealthCheckId -// in ChangeResourceRecordSets. +// For information about adding health checks to resource record sets, see HealthCheckId +// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ResourceRecordSet.html#Route53-Type-ResourceRecordSet-HealthCheckId) +// in ChangeResourceRecordSets (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html). // // ELB Load Balancers // // If you're registering EC2 instances with an Elastic Load Balancing (ELB) // load balancer, do not create Amazon Route 53 health checks for the EC2 instances. // When you register an EC2 instance with a load balancer, you configure settings -// for an ELB health check, which performs a similar function to an Amazon Route -// 53 health check. +// for an ELB health check, which performs a similar function to a Route 53 +// health check. // // Private Hosted Zones // // You can associate health checks with failover resource record sets in a private // hosted zone. Note the following: // -// * Amazon Route 53 health checkers are outside the VPC. To check the health -// of an endpoint within a VPC by IP address, you must assign a public IP -// address to the instance in the VPC. +// * Route 53 health checkers are outside the VPC. To check the health of +// an endpoint within a VPC by IP address, you must assign a public IP address +// to the instance in the VPC. // // * You can configure a health checker to check the health of an external // resource that the instance relies on, such as a database server. @@ -506,10 +509,11 @@ func (c *Route53) CreateHealthCheckRequest(input *CreateHealthCheckInput) (req * // This health check can't be created because the current account has reached // the limit on the number of active health checks. // -// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // -// For information about how to get the current limit for an account, see GetAccountLimit. +// For information about how to get the current limit for an account, see GetAccountLimit +// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. // @@ -558,7 +562,7 @@ const opCreateHostedZone = "CreateHostedZone" // CreateHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the CreateHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -597,41 +601,44 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // CreateHostedZone API operation for Amazon Route 53. // -// Creates a new public hosted zone, which you use to specify how the Domain -// Name System (DNS) routes traffic on the Internet for a domain, such as example.com, -// and its subdomains. +// Creates a new public or private hosted zone. You create records in a public +// hosted zone to define how you want to route traffic on the internet for a +// domain, such as example.com, and its subdomains (apex.example.com, acme.example.com). +// You create records in a private hosted zone to define how you want to route +// traffic for a domain and its subdomains within one or more Amazon Virtual +// Private Clouds (Amazon VPCs). // -// You can't convert a public hosted zones to a private hosted zone or vice -// versa. Instead, you must create a new hosted zone with the same name and -// create new resource record sets. +// You can't convert a public hosted zone to a private hosted zone or vice versa. +// Instead, you must create a new hosted zone with the same name and create +// new resource record sets. // // For more information about charges for hosted zones, see Amazon Route 53 // Pricing (http://aws.amazon.com/route53/pricing/). // // Note the following: // -// * You can't create a hosted zone for a top-level domain (TLD). +// * You can't create a hosted zone for a top-level domain (TLD) such as +// .com. // -// * Amazon Route 53 automatically creates a default SOA record and four -// NS records for the zone. For more information about SOA and NS records, -// see NS and SOA Records that Amazon Route 53 Creates for a Hosted Zone -// (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html) -// in the Amazon Route 53 Developer Guide. +// * For public hosted zones, Amazon Route 53 automatically creates a default +// SOA record and four NS records for the zone. For more information about +// SOA and NS records, see NS and SOA Records that Route 53 Creates for a +// Hosted Zone (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/SOA-NSrecords.html) +// in the Amazon Route 53 Developer Guide. If you want to use the same name +// servers for multiple public hosted zones, you can optionally associate +// a reusable delegation set with the hosted zone. See the DelegationSetId +// element. // -// If you want to use the same name servers for multiple hosted zones, you can -// optionally associate a reusable delegation set with the hosted zone. See -// the DelegationSetId element. -// -// * If your domain is registered with a registrar other than Amazon Route -// 53, you must update the name servers with your registrar to make Amazon -// Route 53 your DNS service. For more information, see Configuring Amazon -// Route 53 as your DNS Service (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/creating-migrating.html) +// * If your domain is registered with a registrar other than Route 53, you +// must update the name servers with your registrar to make Route 53 the +// DNS service for the domain. For more information, see Migrating DNS Service +// for an Existing Domain to Amazon Route 53 (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/MigratingDNS.html) // in the Amazon Route 53 Developer Guide. // // When you submit a CreateHostedZone request, the initial status of the hosted -// zone is PENDING. This means that the NS and SOA records are not yet available -// on all Amazon Route 53 DNS servers. When the NS and SOA records are available, -// the status of the zone changes to INSYNC. +// zone is PENDING. For public hosted zones, this means that the NS and SOA +// records are not yet available on all Route 53 DNS servers. When the NS and +// SOA records are available, the status of the zone changes to INSYNC. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -655,14 +662,14 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // the limit on the number of hosted zones that can be associated with a reusable // delegation set. // -// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // // To get the current limit on hosted zones that can be created by an account, -// see GetAccountLimit. +// see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To get the current limit on hosted zones that can be associated with a reusable -// delegation set, see GetReusableDelegationSetLimit. +// delegation set, see GetReusableDelegationSetLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetReusableDelegationSetLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -678,8 +685,8 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // You can create a hosted zone that has the same name as an existing hosted // zone (example.com is common), but there is a limit to the number of hosted // zones that have the same name. If you get this error, Amazon Route 53 has -// reached that limit. If you own the domain name and Amazon Route 53 generates -// this error, contact Customer Support. +// reached that limit. If you own the domain name and Route 53 generates this +// error, contact Customer Support. // // * ErrCodeConflictingDomainExists "ConflictingDomainExists" // The cause of this error depends on whether you're trying to create a public @@ -691,7 +698,7 @@ func (c *Route53) CreateHostedZoneRequest(input *CreateHostedZoneInput) (req *re // the same name as an existing hosted zone or that's the parent or child // of an existing hosted zone, and you specified a delegation set that shares // one or more name servers with the existing hosted zone. For more information, -// see CreateReusableDelegationSet. +// see CreateReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html). // // * Private hosted zone: You specified an Amazon VPC that you're already // using for another hosted zone, and the domain that you specified for one @@ -732,7 +739,7 @@ const opCreateQueryLoggingConfig = "CreateQueryLoggingConfig" // CreateQueryLoggingConfigRequest generates a "aws/request.Request" representing the // client's request for the CreateQueryLoggingConfig operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -775,10 +782,10 @@ func (c *Route53) CreateQueryLoggingConfigRequest(input *CreateQueryLoggingConfi // configuration, Amazon Route 53 begins to publish log data to an Amazon CloudWatch // Logs log group. // -// DNS query logs contain information about the queries that Amazon Route 53 -// receives for a specified public hosted zone, such as the following: +// DNS query logs contain information about the queries that Route 53 receives +// for a specified public hosted zone, such as the following: // -// * Amazon Route 53 edge location that responded to the DNS query +// * Route 53 edge location that responded to the DNS query // // * Domain or subdomain that was requested // @@ -786,52 +793,53 @@ func (c *Route53) CreateQueryLoggingConfigRequest(input *CreateQueryLoggingConfi // // * DNS response code, such as NoError or ServFail // -// Log Group and Resource PolicyBefore you create a query logging configuration, -// perform the following operations. +// Log Group and Resource Policy // -// If you create a query logging configuration using the Amazon Route 53 console, -// Amazon Route 53 performs these operations automatically. +// Before you create a query logging configuration, perform the following operations. +// +// If you create a query logging configuration using the Route 53 console, Route +// 53 performs these operations automatically. // // Create a CloudWatch Logs log group, and make note of the ARN, which you specify // when you create a query logging configuration. Note the following: // -// You must create the log group in the us-east-1 region. +// * You must create the log group in the us-east-1 region. // -// You must use the same AWS account to create the log group and the hosted -// zone that you want to configure query logging for. +// * You must use the same AWS account to create the log group and the hosted +// zone that you want to configure query logging for. // -// When you create log groups for query logging, we recommend that you use a -// consistent prefix, for example: -// -// /aws/route53/hosted zone name -// -// In the next step, you'll create a resource policy, which controls access -// to one or more log groups and the associated AWS resources, such as Amazon -// Route 53 hosted zones. There's a limit on the number of resource policies -// that you can create, so we recommend that you use a consistent prefix so -// you can use the same resource policy for all the log groups that you create -// for query logging. +// * When you create log groups for query logging, we recommend that you +// use a consistent prefix, for example: /aws/route53/hosted zone name In +// the next step, you'll create a resource policy, which controls access +// to one or more log groups and the associated AWS resources, such as Route +// 53 hosted zones. There's a limit on the number of resource policies that +// you can create, so we recommend that you use a consistent prefix so you +// can use the same resource policy for all the log groups that you create +// for query logging. // // Create a CloudWatch Logs resource policy, and give it the permissions that -// Amazon Route 53 needs to create log streams and to send query logs to log -// streams. For the value of Resource, specify the ARN for the log group that -// you created in the previous step. To use the same resource policy for all -// the CloudWatch Logs log groups that you created for query logging configurations, -// replace the hosted zone name with *, for example: +// Route 53 needs to create log streams and to send query logs to log streams. +// For the value of Resource, specify the ARN for the log group that you created +// in the previous step. To use the same resource policy for all the CloudWatch +// Logs log groups that you created for query logging configurations, replace +// the hosted zone name with *, for example: // // arn:aws:logs:us-east-1:123412341234:log-group:/aws/route53/* // // You can't use the CloudWatch console to create or edit a resource policy. // You must use the CloudWatch API, one of the AWS SDKs, or the AWS CLI. // -// Log Streams and Edge LocationsWhen Amazon Route 53 finishes creating the -// configuration for DNS query logging, it does the following: +// Log Streams and Edge Locations // -// Creates a log stream for an edge location the first time that the edge location -// responds to DNS queries for the specified hosted zone. That log stream is -// used to log all queries that Amazon Route 53 responds to for that edge location. +// When Route 53 finishes creating the configuration for DNS query logging, +// it does the following: // -// Begins to send query logs to the applicable log stream. +// * Creates a log stream for an edge location the first time that the edge +// location responds to DNS queries for the specified hosted zone. That log +// stream is used to log all queries that Route 53 responds to for that edge +// location. +// +// * Begins to send query logs to the applicable log stream. // // The name of each log stream is in the following format: // @@ -841,33 +849,39 @@ func (c *Route53) CreateQueryLoggingConfigRequest(input *CreateQueryLoggingConfi // number, for example, DFW3. The three-letter code typically corresponds with // the International Air Transport Association airport code for an airport near // the edge location. (These abbreviations might change in the future.) For -// a list of edge locations, see "The Amazon Route 53 Global Network" on the -// Amazon Route 53 Product Details (http://aws.amazon.com/route53/details/) -// page. +// a list of edge locations, see "The Route 53 Global Network" on the Route +// 53 Product Details (http://aws.amazon.com/route53/details/) page. // -// Queries That Are LoggedQuery logs contain only the queries that DNS resolvers -// forward to Amazon Route 53. If a DNS resolver has already cached the response -// to a query (such as the IP address for a load balancer for example.com), -// the resolver will continue to return the cached response. It doesn't forward -// another query to Amazon Route 53 until the TTL for the corresponding resource -// record set expires. Depending on how many DNS queries are submitted for a -// resource record set, and depending on the TTL for that resource record set, -// query logs might contain information about only one query out of every several -// thousand queries that are submitted to DNS. For more information about how -// DNS works, see Routing Internet Traffic to Your Website or Web Application -// (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/welcome-dns-service.html) +// Queries That Are Logged +// +// Query logs contain only the queries that DNS resolvers forward to Route 53. +// If a DNS resolver has already cached the response to a query (such as the +// IP address for a load balancer for example.com), the resolver will continue +// to return the cached response. It doesn't forward another query to Route +// 53 until the TTL for the corresponding resource record set expires. Depending +// on how many DNS queries are submitted for a resource record set, and depending +// on the TTL for that resource record set, query logs might contain information +// about only one query out of every several thousand queries that are submitted +// to DNS. For more information about how DNS works, see Routing Internet Traffic +// to Your Website or Web Application (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/welcome-dns-service.html) // in the Amazon Route 53 Developer Guide. // -// Log File FormatFor a list of the values in each query log and the format -// of each value, see Logging DNS Queries (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html) +// Log File Format +// +// For a list of the values in each query log and the format of each value, +// see Logging DNS Queries (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html) // in the Amazon Route 53 Developer Guide. // -// PricingFor information about charges for query logs, see Amazon CloudWatch -// Pricing (http://aws.amazon.com/cloudwatch/pricing/). +// Pricing // -// How to Stop LoggingIf you want Amazon Route 53 to stop sending query logs -// to CloudWatch Logs, delete the query logging configuration. For more information, -// see DeleteQueryLoggingConfig. +// For information about charges for query logs, see Amazon CloudWatch Pricing +// (http://aws.amazon.com/cloudwatch/pricing/). +// +// How to Stop Logging +// +// If you want Route 53 to stop sending query logs to CloudWatch Logs, delete +// the query logging configuration. For more information, see DeleteQueryLoggingConfig +// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_DeleteQueryLoggingConfig.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 @@ -933,7 +947,7 @@ const opCreateReusableDelegationSet = "CreateReusableDelegationSet" // CreateReusableDelegationSetRequest generates a "aws/request.Request" representing the // client's request for the CreateReusableDelegationSet operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1034,8 +1048,9 @@ func (c *Route53) CreateReusableDelegationSetRequest(input *CreateReusableDelega // reached the limit on reusable delegation sets that it can create or because // you've reached the limit on the number of Amazon VPCs that you can associate // with a private hosted zone. To get the current limit on the number of reusable -// delegation sets, see GetAccountLimit. To get the current limit on the number -// of Amazon VPCs that you can associate with a private hosted zone, see GetHostedZoneLimit. +// delegation sets, see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). +// To get the current limit on the number of Amazon VPCs that you can associate +// with a private hosted zone, see GetHostedZoneLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetHostedZoneLimit.html). // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. // @@ -1052,8 +1067,8 @@ func (c *Route53) CreateReusableDelegationSetRequest(input *CreateReusableDelega // You can create a hosted zone that has the same name as an existing hosted // zone (example.com is common), but there is a limit to the number of hosted // zones that have the same name. If you get this error, Amazon Route 53 has -// reached that limit. If you own the domain name and Amazon Route 53 generates -// this error, contact Customer Support. +// reached that limit. If you own the domain name and Route 53 generates this +// error, contact Customer Support. // // * ErrCodeDelegationSetAlreadyReusable "DelegationSetAlreadyReusable" // The specified delegation set has already been marked as reusable. @@ -1085,7 +1100,7 @@ const opCreateTrafficPolicy = "CreateTrafficPolicy" // CreateTrafficPolicyRequest generates a "aws/request.Request" representing the // client's request for the CreateTrafficPolicy operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1143,10 +1158,10 @@ func (c *Route53) CreateTrafficPolicyRequest(input *CreateTrafficPolicyInput) (r // This traffic policy can't be created because the current account has reached // the limit on the number of traffic policies. // -// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // -// To get the current limit for an account, see GetAccountLimit. +// To get the current limit for an account, see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -1185,7 +1200,7 @@ const opCreateTrafficPolicyInstance = "CreateTrafficPolicyInstance" // CreateTrafficPolicyInstanceRequest generates a "aws/request.Request" representing the // client's request for the CreateTrafficPolicyInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1249,10 +1264,11 @@ func (c *Route53) CreateTrafficPolicyInstanceRequest(input *CreateTrafficPolicyI // This traffic policy instance can't be created because the current account // has reached the limit on the number of traffic policy instances. // -// For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // -// For information about how to get the current limit for an account, see GetAccountLimit. +// For information about how to get the current limit for an account, see GetAccountLimit +// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -1290,7 +1306,7 @@ const opCreateTrafficPolicyVersion = "CreateTrafficPolicyVersion" // CreateTrafficPolicyVersionRequest generates a "aws/request.Request" representing the // client's request for the CreateTrafficPolicyVersion operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1357,10 +1373,10 @@ func (c *Route53) CreateTrafficPolicyVersionRequest(input *CreateTrafficPolicyVe // of 1000 on the number of versions that you can create for the current traffic // policy. // -// To create more traffic policy versions, you can use GetTrafficPolicy to get -// the traffic policy document for a specified traffic policy version, and then -// use CreateTrafficPolicy to create a new traffic policy using the traffic -// policy document. +// To create more traffic policy versions, you can use GetTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetTrafficPolicy.html) +// to get the traffic policy document for a specified traffic policy version, +// and then use CreateTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html) +// to create a new traffic policy using the traffic policy document. // // * ErrCodeConcurrentModification "ConcurrentModification" // Another user submitted a request to create, update, or delete the object @@ -1397,7 +1413,7 @@ const opCreateVPCAssociationAuthorization = "CreateVPCAssociationAuthorization" // CreateVPCAssociationAuthorizationRequest generates a "aws/request.Request" representing the // client's request for the CreateVPCAssociationAuthorization operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1503,7 +1519,7 @@ const opDeleteHealthCheck = "DeleteHealthCheck" // DeleteHealthCheckRequest generates a "aws/request.Request" representing the // client's request for the DeleteHealthCheck operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1537,6 +1553,7 @@ func (c *Route53) DeleteHealthCheckRequest(input *DeleteHealthCheckInput) (req * output = &DeleteHealthCheckOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -1561,8 +1578,7 @@ func (c *Route53) DeleteHealthCheckRequest(input *DeleteHealthCheckInput) (req * // // Returned Error Codes: // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeHealthCheckInUse "HealthCheckInUse" // This error code is not in use. @@ -1597,7 +1613,7 @@ const opDeleteHostedZone = "DeleteHostedZone" // DeleteHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the DeleteHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1638,26 +1654,42 @@ func (c *Route53) DeleteHostedZoneRequest(input *DeleteHostedZoneInput) (req *re // // Deletes a hosted zone. // -// If the name servers for the hosted zone are associated with a domain and -// if you want to make the domain unavailable on the Internet, we recommend -// that you delete the name servers from the domain to prevent future DNS queries -// from possibly being misrouted. If the domain is registered with Amazon Route -// 53, see UpdateDomainNameservers. If the domain is registered with another -// registrar, use the method provided by the registrar to delete name servers -// for the domain. +// If the hosted zone was created by another service, such as AWS Cloud Map, +// see Deleting Public Hosted Zones That Were Created by Another Service (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DeleteHostedZone.html#delete-public-hosted-zone-created-by-another-service) +// in the Amazon Route 53 Developer Guide for information about how to delete +// it. (The process is the same for public and private hosted zones that were +// created by another service.) // -// Some domain registries don't allow you to remove all of the name servers -// for a domain. If the registry for your domain requires one or more name servers, -// we recommend that you delete the hosted zone only if you transfer DNS service -// to another service provider, and you replace the name servers for the domain -// with name servers from the new provider. +// If you want to keep your domain registration but you want to stop routing +// internet traffic to your website or web application, we recommend that you +// delete resource record sets in the hosted zone instead of deleting the hosted +// zone. +// +// If you delete a hosted zone, you can't undelete it. You must create a new +// hosted zone and update the name servers for your domain registration, which +// can require up to 48 hours to take effect. (If you delegated responsibility +// for a subdomain to a hosted zone and you delete the child hosted zone, you +// must update the name servers in the parent hosted zone.) In addition, if +// you delete a hosted zone, someone could hijack the domain and route traffic +// to their own resources using your domain name. +// +// If you want to avoid the monthly charge for the hosted zone, you can transfer +// DNS service for the domain to a free DNS service. When you transfer DNS service, +// you have to update the name servers for the domain registration. If the domain +// is registered with Route 53, see UpdateDomainNameservers (https://docs.aws.amazon.com/Route53/latest/APIReference/API_domains_UpdateDomainNameservers.html) +// for information about how to replace Route 53 name servers with name servers +// for the new DNS service. If the domain is registered with another registrar, +// use the method provided by the registrar to update name servers for the domain +// registration. For more information, perform an internet search on "free DNS +// service." // // You can delete a hosted zone only if it contains only the default SOA record // and NS resource record sets. If the hosted zone contains other resource record // sets, you must delete them before you can delete the hosted zone. If you // try to delete a hosted zone that contains other resource record sets, the -// request fails, and Amazon Route 53 returns a HostedZoneNotEmpty error. For -// information about deleting records from your hosted zone, see ChangeResourceRecordSets. +// request fails, and Route 53 returns a HostedZoneNotEmpty error. For information +// about deleting records from your hosted zone, see ChangeResourceRecordSets +// (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ChangeResourceRecordSets.html). // // To verify that the hosted zone has been deleted, do one of the following: // @@ -1684,8 +1716,8 @@ func (c *Route53) DeleteHostedZoneRequest(input *DeleteHostedZoneInput) (req *re // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // * ErrCodeInvalidInput "InvalidInput" @@ -1721,7 +1753,7 @@ const opDeleteQueryLoggingConfig = "DeleteQueryLoggingConfig" // DeleteQueryLoggingConfigRequest generates a "aws/request.Request" representing the // client's request for the DeleteQueryLoggingConfig operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1755,16 +1787,17 @@ func (c *Route53) DeleteQueryLoggingConfigRequest(input *DeleteQueryLoggingConfi output = &DeleteQueryLoggingConfigOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } // DeleteQueryLoggingConfig API operation for Amazon Route 53. // // Deletes a configuration for DNS query logging. If you delete a configuration, -// Amazon Route 53 stops sending query logs to CloudWatch Logs. Amazon Route -// 53 doesn't delete any logs that are already in CloudWatch Logs. +// Amazon Route 53 stops sending query logs to CloudWatch Logs. Route 53 doesn't +// delete any logs that are already in CloudWatch Logs. // -// For more information about DNS query logs, see CreateQueryLoggingConfig. +// For more information about DNS query logs, see CreateQueryLoggingConfig (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateQueryLoggingConfig.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 @@ -1811,7 +1844,7 @@ const opDeleteReusableDelegationSet = "DeleteReusableDelegationSet" // DeleteReusableDelegationSetRequest generates a "aws/request.Request" representing the // client's request for the DeleteReusableDelegationSet operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1845,6 +1878,7 @@ func (c *Route53) DeleteReusableDelegationSetRequest(input *DeleteReusableDelega output = &DeleteReusableDelegationSetOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -1856,8 +1890,9 @@ func (c *Route53) DeleteReusableDelegationSetRequest(input *DeleteReusableDelega // any hosted zones. // // To verify that the reusable delegation set is not associated with any hosted -// zones, submit a GetReusableDelegationSet request and specify the ID of the -// reusable delegation set that you want to delete. +// zones, submit a GetReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetReusableDelegationSet.html) +// request and specify the ID of the reusable delegation set that you want to +// delete. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -1907,7 +1942,7 @@ const opDeleteTrafficPolicy = "DeleteTrafficPolicy" // DeleteTrafficPolicyRequest generates a "aws/request.Request" representing the // client's request for the DeleteTrafficPolicy operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1941,6 +1976,7 @@ func (c *Route53) DeleteTrafficPolicyRequest(input *DeleteTrafficPolicyInput) (r output = &DeleteTrafficPolicyOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -1997,7 +2033,7 @@ const opDeleteTrafficPolicyInstance = "DeleteTrafficPolicyInstance" // DeleteTrafficPolicyInstanceRequest generates a "aws/request.Request" representing the // client's request for the DeleteTrafficPolicyInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2031,6 +2067,7 @@ func (c *Route53) DeleteTrafficPolicyInstanceRequest(input *DeleteTrafficPolicyI output = &DeleteTrafficPolicyInstanceOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -2039,8 +2076,7 @@ func (c *Route53) DeleteTrafficPolicyInstanceRequest(input *DeleteTrafficPolicyI // Deletes a traffic policy instance and all of the resource record sets that // Amazon Route 53 created when you created the instance. // -// In the Amazon Route 53 console, traffic policy instances are known as policy -// records. +// In the Route 53 console, traffic policy instances are known as policy records. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2059,8 +2095,8 @@ func (c *Route53) DeleteTrafficPolicyInstanceRequest(input *DeleteTrafficPolicyI // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // See also, https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01/DeleteTrafficPolicyInstance @@ -2090,7 +2126,7 @@ const opDeleteVPCAssociationAuthorization = "DeleteVPCAssociationAuthorization" // DeleteVPCAssociationAuthorizationRequest generates a "aws/request.Request" representing the // client's request for the DeleteVPCAssociationAuthorization operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2124,6 +2160,7 @@ func (c *Route53) DeleteVPCAssociationAuthorizationRequest(input *DeleteVPCAssoc output = &DeleteVPCAssociationAuthorizationOutput{} req = c.newRequest(op, input, output) + req.Handlers.Unmarshal.Swap(restxml.UnmarshalHandler.Name, protocol.UnmarshalDiscardBodyHandler) return } @@ -2193,7 +2230,7 @@ const opDisassociateVPCFromHostedZone = "DisassociateVPCFromHostedZone" // DisassociateVPCFromHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the DisassociateVPCFromHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2232,13 +2269,16 @@ func (c *Route53) DisassociateVPCFromHostedZoneRequest(input *DisassociateVPCFro // DisassociateVPCFromHostedZone API operation for Amazon Route 53. // -// Disassociates a VPC from a Amazon Route 53 private hosted zone. +// Disassociates a VPC from a Amazon Route 53 private hosted zone. Note the +// following: // -// You can't disassociate the last VPC from a private hosted zone. +// * You can't disassociate the last VPC from a private hosted zone. // -// You can't disassociate a VPC from a private hosted zone when only one VPC -// is associated with the hosted zone. You also can't convert a private hosted -// zone into a public hosted zone. +// * You can't convert a private hosted zone into a public hosted zone. +// +// * You can submit a DisassociateVPCFromHostedZone request using either +// the account that created the hosted zone or the account that created the +// VPC. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2293,7 +2333,7 @@ const opGetAccountLimit = "GetAccountLimit" // GetAccountLimitRequest generates a "aws/request.Request" representing the // client's request for the GetAccountLimit operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2335,10 +2375,15 @@ func (c *Route53) GetAccountLimitRequest(input *GetAccountLimitInput) (req *requ // Gets the specified limit for the current account, for example, the maximum // number of health checks that you can create using the account. // -// For the default limit, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For the default limit, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. To request a higher limit, open a // case (https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-route53). // +// You can also view account limits in AWS Trusted Advisor. Sign in to the AWS +// Management Console and open the Trusted Advisor console at https://console.aws.amazon.com/trustedadvisor/ +// (https://console.aws.amazon.com/trustedadvisor). Then choose Service limits +// in the navigation pane. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -2377,7 +2422,7 @@ const opGetChange = "GetChange" // GetChangeRequest generates a "aws/request.Request" representing the // client's request for the GetChange operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2423,8 +2468,8 @@ func (c *Route53) GetChangeRequest(input *GetChangeInput) (req *request.Request, // to all Amazon Route 53 DNS servers. This is the initial status of all // change batch requests. // -// * INSYNC indicates that the changes have propagated to all Amazon Route -// 53 DNS servers. +// * INSYNC indicates that the changes have propagated to all Route 53 DNS +// servers. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2467,7 +2512,7 @@ const opGetCheckerIpRanges = "GetCheckerIpRanges" // GetCheckerIpRangesRequest generates a "aws/request.Request" representing the // client's request for the GetCheckerIpRanges operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2506,6 +2551,7 @@ func (c *Route53) GetCheckerIpRangesRequest(input *GetCheckerIpRangesInput) (req // GetCheckerIpRanges API operation for Amazon Route 53. // +// // GetCheckerIpRanges still works, but we recommend that you download ip-ranges.json, // which includes IP address ranges for all AWS services. For more information, // see IP Address Ranges of Amazon Route 53 Servers (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/route-53-ip-addresses.html) @@ -2544,7 +2590,7 @@ const opGetGeoLocation = "GetGeoLocation" // GetGeoLocationRequest generates a "aws/request.Request" representing the // client's request for the GetGeoLocation operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2589,17 +2635,17 @@ func (c *Route53) GetGeoLocationRequest(input *GetGeoLocationInput) (req *reques // Use the following syntax to determine whether a continent is supported for // geolocation: // -// GET /2013-04-01/geolocation?ContinentCode=two-letter abbreviation for a continent +// GET /2013-04-01/geolocation?continentcode=two-letter abbreviation for a continent // // Use the following syntax to determine whether a country is supported for // geolocation: // -// GET /2013-04-01/geolocation?CountryCode=two-character country code +// GET /2013-04-01/geolocation?countrycode=two-character country code // // Use the following syntax to determine whether a subdivision of a country // is supported for geolocation: // -// GET /2013-04-01/geolocation?CountryCode=two-character country code&SubdivisionCode=subdivision +// GET /2013-04-01/geolocation?countrycode=two-character country code&subdivisioncode=subdivision // code // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -2611,7 +2657,7 @@ func (c *Route53) GetGeoLocationRequest(input *GetGeoLocationInput) (req *reques // // Returned Error Codes: // * ErrCodeNoSuchGeoLocation "NoSuchGeoLocation" -// Amazon Route 53 doesn't support the specified geolocation. +// Amazon Route 53 doesn't support the specified geographic location. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -2643,7 +2689,7 @@ const opGetHealthCheck = "GetHealthCheck" // GetHealthCheckRequest generates a "aws/request.Request" representing the // client's request for the GetHealthCheck operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2693,8 +2739,7 @@ func (c *Route53) GetHealthCheckRequest(input *GetHealthCheckInput) (req *reques // // Returned Error Codes: // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -2730,7 +2775,7 @@ const opGetHealthCheckCount = "GetHealthCheckCount" // GetHealthCheckCountRequest generates a "aws/request.Request" representing the // client's request for the GetHealthCheckCount operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2805,7 +2850,7 @@ const opGetHealthCheckLastFailureReason = "GetHealthCheckLastFailureReason" // GetHealthCheckLastFailureReasonRequest generates a "aws/request.Request" representing the // client's request for the GetHealthCheckLastFailureReason operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2855,8 +2900,7 @@ func (c *Route53) GetHealthCheckLastFailureReasonRequest(input *GetHealthCheckLa // // Returned Error Codes: // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -2888,7 +2932,7 @@ const opGetHealthCheckStatus = "GetHealthCheckStatus" // GetHealthCheckStatusRequest generates a "aws/request.Request" representing the // client's request for the GetHealthCheckStatus operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -2938,8 +2982,7 @@ func (c *Route53) GetHealthCheckStatusRequest(input *GetHealthCheckStatusInput) // // Returned Error Codes: // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -2971,7 +3014,7 @@ const opGetHostedZone = "GetHostedZone" // GetHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the GetHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3054,7 +3097,7 @@ const opGetHostedZoneCount = "GetHostedZoneCount" // GetHostedZoneCountRequest generates a "aws/request.Request" representing the // client's request for the GetHostedZoneCount operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3134,7 +3177,7 @@ const opGetHostedZoneLimit = "GetHostedZoneLimit" // GetHostedZoneLimitRequest generates a "aws/request.Request" representing the // client's request for the GetHostedZoneLimit operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3176,7 +3219,7 @@ func (c *Route53) GetHostedZoneLimitRequest(input *GetHostedZoneLimitInput) (req // Gets the specified limit for a specified hosted zone, for example, the maximum // number of records that you can create in the hosted zone. // -// For the default limit, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For the default limit, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. To request a higher limit, open a // case (https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-route53). // @@ -3224,7 +3267,7 @@ const opGetQueryLoggingConfig = "GetQueryLoggingConfig" // GetQueryLoggingConfigRequest generates a "aws/request.Request" representing the // client's request for the GetQueryLoggingConfig operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3265,8 +3308,8 @@ func (c *Route53) GetQueryLoggingConfigRequest(input *GetQueryLoggingConfigInput // // Gets information about a specified configuration for DNS query logging. // -// For more information about DNS query logs, see CreateQueryLoggingConfig and -// Logging DNS Queries (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html). +// For more information about DNS query logs, see CreateQueryLoggingConfig (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateQueryLoggingConfig.html) +// and Logging DNS Queries (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.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 @@ -3309,7 +3352,7 @@ const opGetReusableDelegationSet = "GetReusableDelegationSet" // GetReusableDelegationSetRequest generates a "aws/request.Request" representing the // client's request for the GetReusableDelegationSet operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3395,7 +3438,7 @@ const opGetReusableDelegationSetLimit = "GetReusableDelegationSetLimit" // GetReusableDelegationSetLimitRequest generates a "aws/request.Request" representing the // client's request for the GetReusableDelegationSetLimit operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3437,7 +3480,7 @@ func (c *Route53) GetReusableDelegationSetLimitRequest(input *GetReusableDelegat // Gets the maximum number of hosted zones that you can associate with the specified // reusable delegation set. // -// For the default limit, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) +// For the default limit, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. To request a higher limit, open a // case (https://console.aws.amazon.com/support/home#/case/create?issueType=service-limit-increase&limitType=service-code-route53). // @@ -3482,7 +3525,7 @@ const opGetTrafficPolicy = "GetTrafficPolicy" // GetTrafficPolicyRequest generates a "aws/request.Request" representing the // client's request for the GetTrafficPolicy operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3564,7 +3607,7 @@ const opGetTrafficPolicyInstance = "GetTrafficPolicyInstance" // GetTrafficPolicyInstanceRequest generates a "aws/request.Request" representing the // client's request for the GetTrafficPolicyInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3610,8 +3653,7 @@ func (c *Route53) GetTrafficPolicyInstanceRequest(input *GetTrafficPolicyInstanc // record sets that are specified in the traffic policy definition. For more // information, see the State response element. // -// In the Amazon Route 53 console, traffic policy instances are known as policy -// records. +// In the Route 53 console, traffic policy instances are known as policy records. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3654,7 +3696,7 @@ const opGetTrafficPolicyInstanceCount = "GetTrafficPolicyInstanceCount" // GetTrafficPolicyInstanceCountRequest generates a "aws/request.Request" representing the // client's request for the GetTrafficPolicyInstanceCount operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3729,7 +3771,7 @@ const opListGeoLocations = "ListGeoLocations" // ListGeoLocationsRequest generates a "aws/request.Request" representing the // client's request for the ListGeoLocations operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3768,7 +3810,7 @@ func (c *Route53) ListGeoLocationsRequest(input *ListGeoLocationsInput) (req *re // ListGeoLocations API operation for Amazon Route 53. // -// Retrieves a list of supported geo locations. +// Retrieves a list of supported geographic locations. // // Countries are listed first, and continents are listed last. If Amazon Route // 53 supports subdivisions for a country (for example, states or provinces), @@ -3813,7 +3855,7 @@ const opListHealthChecks = "ListHealthChecks" // ListHealthChecksRequest generates a "aws/request.Request" representing the // client's request for the ListHealthChecks operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -3909,7 +3951,7 @@ func (c *Route53) ListHealthChecksWithContext(ctx aws.Context, input *ListHealth // // Example iterating over at most 3 pages of a ListHealthChecks operation. // pageNum := 0 // err := client.ListHealthChecksPages(params, -// func(page *ListHealthChecksOutput, lastPage bool) bool { +// func(page *route53.ListHealthChecksOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -3953,7 +3995,7 @@ const opListHostedZones = "ListHostedZones" // ListHostedZonesRequest generates a "aws/request.Request" representing the // client's request for the ListHostedZones operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4056,7 +4098,7 @@ func (c *Route53) ListHostedZonesWithContext(ctx aws.Context, input *ListHostedZ // // Example iterating over at most 3 pages of a ListHostedZones operation. // pageNum := 0 // err := client.ListHostedZonesPages(params, -// func(page *ListHostedZonesOutput, lastPage bool) bool { +// func(page *route53.ListHostedZonesOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4100,7 +4142,7 @@ const opListHostedZonesByName = "ListHostedZonesByName" // ListHostedZonesByNameRequest generates a "aws/request.Request" representing the // client's request for the ListHostedZonesByName operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4163,10 +4205,10 @@ func (c *Route53) ListHostedZonesByNameRequest(input *ListHostedZonesByNameInput // domain names, see DNS Domain Name Format (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DomainNameFormat.html) // in the Amazon Route 53 Developer Guide. // -// Amazon Route 53 returns up to 100 items in each response. If you have a lot -// of hosted zones, use the MaxItems parameter to list them in groups of up -// to 100. The response includes values that help navigate from one group of -// MaxItems hosted zones to the next: +// Route 53 returns up to 100 items in each response. If you have a lot of hosted +// zones, use the MaxItems parameter to list them in groups of up to 100. The +// response includes values that help navigate from one group of MaxItems hosted +// zones to the next: // // * The DNSName and HostedZoneId elements in the response contain the values, // if any, specified for the dnsname and hostedzoneid parameters in the request @@ -4177,10 +4219,9 @@ func (c *Route53) ListHostedZonesByNameRequest(input *ListHostedZonesByNameInput // the current response. // // * If the value of IsTruncated in the response is true, there are more -// hosted zones associated with the current AWS account. -// -// If IsTruncated is false, this response includes the last hosted zone that -// is associated with the current account. The NextDNSName element and NextHostedZoneId +// hosted zones associated with the current AWS account. If IsTruncated is +// false, this response includes the last hosted zone that is associated +// with the current account. The NextDNSName element and NextHostedZoneId // elements are omitted from the response. // // * The NextDNSName and NextHostedZoneId elements in the response contain @@ -4231,7 +4272,7 @@ const opListQueryLoggingConfigs = "ListQueryLoggingConfigs" // ListQueryLoggingConfigsRequest generates a "aws/request.Request" representing the // client's request for the ListQueryLoggingConfigs operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4274,9 +4315,9 @@ func (c *Route53) ListQueryLoggingConfigsRequest(input *ListQueryLoggingConfigsI // current AWS account or the configuration that is associated with a specified // hosted zone. // -// For more information about DNS query logs, see CreateQueryLoggingConfig. +// For more information about DNS query logs, see CreateQueryLoggingConfig (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateQueryLoggingConfig.html). // Additional information, including the format of DNS query logs, appears in -// Logging DNS Queries (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html) +// Logging DNS Queries (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/query-logs.html) // in the Amazon Route 53 Developer Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4324,7 +4365,7 @@ const opListResourceRecordSets = "ListResourceRecordSets" // ListResourceRecordSetsRequest generates a "aws/request.Request" representing the // client's request for the ListResourceRecordSets operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4373,35 +4414,53 @@ func (c *Route53) ListResourceRecordSetsRequest(input *ListResourceRecordSetsInp // // ListResourceRecordSets returns up to 100 resource record sets at a time in // ASCII order, beginning at a position specified by the name and type elements. -// The action sorts results first by DNS name with the labels reversed, for -// example: +// +// Sort order +// +// ListResourceRecordSets sorts results first by DNS name with the labels reversed, +// for example: // // com.example.www. // -// Note the trailing dot, which can change the sort order in some circumstances. +// Note the trailing dot, which can change the sort order when the record name +// contains characters that appear before . (decimal 46) in the ASCII table. +// These characters include the following: ! " # $ % & ' ( ) * + , - // -// When multiple records have the same DNS name, the action sorts results by -// the record type. +// When multiple records have the same DNS name, ListResourceRecordSets sorts +// results by the record type. // -// You can use the name and type elements to adjust the beginning position of -// the list of resource record sets returned: +// Specifying where to start listing records // -// If you do not specify Name or TypeThe results begin with the first resource -// record set that the hosted zone contains. +// You can use the name and type elements to specify the resource record set +// that the list begins with: // -// If you specify Name but not TypeThe results begin with the first resource -// record set in the list whose name is greater than or equal to Name. +// If you do not specify Name or Type // -// If you specify Type but not NameAmazon Route 53 returns the InvalidInput -// error. +// The results begin with the first resource record set that the hosted zone +// contains. // -// If you specify both Name and TypeThe results begin with the first resource -// record set in the list whose name is greater than or equal to Name, and whose -// type is greater than or equal to Type. +// If you specify Name but not Type +// +// The results begin with the first resource record set in the list whose name +// is greater than or equal to Name. +// +// If you specify Type but not Name +// +// Amazon Route 53 returns the InvalidInput error. +// +// If you specify both Name and Type +// +// The results begin with the first resource record set in the list whose name +// is greater than or equal to Name, and whose type is greater than or equal +// to Type. +// +// Resource record sets that are PENDING // // This action returns the most current version of the records. This includes -// records that are PENDING, and that are not yet available on all Amazon Route -// 53 DNS servers. +// records that are PENDING, and that are not yet available on all Route 53 +// DNS servers. +// +// Changing resource record sets // // To ensure that you get an accurate listing of the resource record sets for // a hosted zone at a point in time, do not submit a ChangeResourceRecordSets @@ -4409,6 +4468,14 @@ func (c *Route53) ListResourceRecordSetsRequest(input *ListResourceRecordSetsInp // request. If you do, some pages may display results without the latest changes // while other pages display results with the latest changes. // +// Displaying the next page of results +// +// If a ListResourceRecordSets command returns more than one page of results, +// the value of IsTruncated is true. To display the next page of results, get +// the values of NextRecordName, NextRecordType, and NextRecordIdentifier (if +// any) from the response. Then submit another ListResourceRecordSets request, +// and specify those values for StartRecordName, StartRecordType, and StartRecordIdentifier. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -4456,7 +4523,7 @@ func (c *Route53) ListResourceRecordSetsWithContext(ctx aws.Context, input *List // // Example iterating over at most 3 pages of a ListResourceRecordSets operation. // pageNum := 0 // err := client.ListResourceRecordSetsPages(params, -// func(page *ListResourceRecordSetsOutput, lastPage bool) bool { +// func(page *route53.ListResourceRecordSetsOutput, lastPage bool) bool { // pageNum++ // fmt.Println(page) // return pageNum <= 3 @@ -4500,7 +4567,7 @@ const opListReusableDelegationSets = "ListReusableDelegationSets" // ListReusableDelegationSetsRequest generates a "aws/request.Request" representing the // client's request for the ListReusableDelegationSets operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4580,7 +4647,7 @@ const opListTagsForResource = "ListTagsForResource" // ListTagsForResourceRequest generates a "aws/request.Request" representing the // client's request for the ListTagsForResource operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4622,7 +4689,7 @@ func (c *Route53) ListTagsForResourceRequest(input *ListTagsForResourceInput) (r // Lists tags for one health check or hosted zone. // // For information about using tags for cost allocation, see Using Cost Allocation -// Tags (http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) +// Tags (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) // in the AWS Billing and Cost Management User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4637,8 +4704,7 @@ func (c *Route53) ListTagsForResourceRequest(input *ListTagsForResourceInput) (r // The input is not valid. // // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeNoSuchHostedZone "NoSuchHostedZone" // No hosted zone exists with the ID that you specified. @@ -4646,8 +4712,8 @@ func (c *Route53) ListTagsForResourceRequest(input *ListTagsForResourceInput) (r // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" @@ -4680,7 +4746,7 @@ const opListTagsForResources = "ListTagsForResources" // ListTagsForResourcesRequest generates a "aws/request.Request" representing the // client's request for the ListTagsForResources operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4722,7 +4788,7 @@ func (c *Route53) ListTagsForResourcesRequest(input *ListTagsForResourcesInput) // Lists tags for up to 10 health checks or hosted zones. // // For information about using tags for cost allocation, see Using Cost Allocation -// Tags (http://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) +// Tags (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html) // in the AWS Billing and Cost Management User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -4737,8 +4803,7 @@ func (c *Route53) ListTagsForResourcesRequest(input *ListTagsForResourcesInput) // The input is not valid. // // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeNoSuchHostedZone "NoSuchHostedZone" // No hosted zone exists with the ID that you specified. @@ -4746,8 +4811,8 @@ func (c *Route53) ListTagsForResourcesRequest(input *ListTagsForResourcesInput) // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // * ErrCodeThrottlingException "ThrottlingException" @@ -4780,7 +4845,7 @@ const opListTrafficPolicies = "ListTrafficPolicies" // ListTrafficPoliciesRequest generates a "aws/request.Request" representing the // client's request for the ListTrafficPolicies operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4821,7 +4886,7 @@ func (c *Route53) ListTrafficPoliciesRequest(input *ListTrafficPoliciesInput) (r // // Gets information about the latest version for every traffic policy that is // associated with the current AWS account. Policies are listed in the order -// in which they were created. +// that they were created 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 @@ -4861,7 +4926,7 @@ const opListTrafficPolicyInstances = "ListTrafficPolicyInstances" // ListTrafficPolicyInstancesRequest generates a "aws/request.Request" representing the // client's request for the ListTrafficPolicyInstances operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -4908,9 +4973,9 @@ func (c *Route53) ListTrafficPolicyInstancesRequest(input *ListTrafficPolicyInst // in the traffic policy definition. For more information, see the State response // element. // -// Amazon Route 53 returns a maximum of 100 items in each response. If you have -// a lot of traffic policy instances, you can use the MaxItems parameter to -// list them in groups of up to 100. +// Route 53 returns a maximum of 100 items in each response. If you have a lot +// of traffic policy instances, you can use the MaxItems parameter to list them +// in groups of up to 100. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -4953,7 +5018,7 @@ const opListTrafficPolicyInstancesByHostedZone = "ListTrafficPolicyInstancesByHo // ListTrafficPolicyInstancesByHostedZoneRequest generates a "aws/request.Request" representing the // client's request for the ListTrafficPolicyInstancesByHostedZone operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5000,9 +5065,9 @@ func (c *Route53) ListTrafficPolicyInstancesByHostedZoneRequest(input *ListTraff // record sets that are specified in the traffic policy definition. For more // information, see the State response element. // -// Amazon Route 53 returns a maximum of 100 items in each response. If you have -// a lot of traffic policy instances, you can use the MaxItems parameter to -// list them in groups of up to 100. +// Route 53 returns a maximum of 100 items in each response. If you have a lot +// of traffic policy instances, you can use the MaxItems parameter to list them +// in groups of up to 100. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5048,7 +5113,7 @@ const opListTrafficPolicyInstancesByPolicy = "ListTrafficPolicyInstancesByPolicy // ListTrafficPolicyInstancesByPolicyRequest generates a "aws/request.Request" representing the // client's request for the ListTrafficPolicyInstancesByPolicy operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5095,9 +5160,9 @@ func (c *Route53) ListTrafficPolicyInstancesByPolicyRequest(input *ListTrafficPo // record sets that are specified in the traffic policy definition. For more // information, see the State response element. // -// Amazon Route 53 returns a maximum of 100 items in each response. If you have -// a lot of traffic policy instances, you can use the MaxItems parameter to -// list them in groups of up to 100. +// Route 53 returns a maximum of 100 items in each response. If you have a lot +// of traffic policy instances, you can use the MaxItems parameter to list them +// in groups of up to 100. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5143,7 +5208,7 @@ const opListTrafficPolicyVersions = "ListTrafficPolicyVersions" // ListTrafficPolicyVersionsRequest generates a "aws/request.Request" representing the // client's request for the ListTrafficPolicyVersions operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5227,7 +5292,7 @@ const opListVPCAssociationAuthorizations = "ListVPCAssociationAuthorizations" // ListVPCAssociationAuthorizationsRequest generates a "aws/request.Request" representing the // client's request for the ListVPCAssociationAuthorizations operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5318,7 +5383,7 @@ const opTestDNSAnswer = "TestDNSAnswer" // TestDNSAnswerRequest generates a "aws/request.Request" representing the // client's request for the TestDNSAnswer operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5402,7 +5467,7 @@ const opUpdateHealthCheck = "UpdateHealthCheck" // UpdateHealthCheckRequest generates a "aws/request.Request" representing the // client's request for the UpdateHealthCheck operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5456,8 +5521,7 @@ func (c *Route53) UpdateHealthCheckRequest(input *UpdateHealthCheckInput) (req * // // Returned Error Codes: // * ErrCodeNoSuchHealthCheck "NoSuchHealthCheck" -// No health check exists with the ID that you specified in the DeleteHealthCheck -// request. +// No health check exists with the specified ID. // // * ErrCodeInvalidInput "InvalidInput" // The input is not valid. @@ -5493,7 +5557,7 @@ const opUpdateHostedZoneComment = "UpdateHostedZoneComment" // UpdateHostedZoneCommentRequest generates a "aws/request.Request" representing the // client's request for the UpdateHostedZoneComment operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5575,7 +5639,7 @@ const opUpdateTrafficPolicyComment = "UpdateTrafficPolicyComment" // UpdateTrafficPolicyCommentRequest generates a "aws/request.Request" representing the // client's request for the UpdateTrafficPolicyComment operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5661,7 +5725,7 @@ const opUpdateTrafficPolicyInstance = "UpdateTrafficPolicyInstance" // UpdateTrafficPolicyInstanceRequest generates a "aws/request.Request" representing the // client's request for the UpdateTrafficPolicyInstance operation. The "output" return // value will be populated with the request's response once the request completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -5705,19 +5769,19 @@ func (c *Route53) UpdateTrafficPolicyInstanceRequest(input *UpdateTrafficPolicyI // // When you update a traffic policy instance, Amazon Route 53 continues to respond // to DNS queries for the root resource record set name (such as example.com) -// while it replaces one group of resource record sets with another. Amazon -// Route 53 performs the following operations: +// while it replaces one group of resource record sets with another. Route 53 +// performs the following operations: // -// Amazon Route 53 creates a new group of resource record sets based on the -// specified traffic policy. This is true regardless of how significant the -// differences are between the existing resource record sets and the new resource -// record sets. +// Route 53 creates a new group of resource record sets based on the specified +// traffic policy. This is true regardless of how significant the differences +// are between the existing resource record sets and the new resource record +// sets. // -// When all of the new resource record sets have been created, Amazon Route -// 53 starts to respond to DNS queries for the root resource record set name -// (such as example.com) by using the new resource record sets. +// When all of the new resource record sets have been created, Route 53 starts +// to respond to DNS queries for the root resource record set name (such as +// example.com) by using the new resource record sets. // -// Amazon Route 53 deletes the old group of resource record sets that are associated +// Route 53 deletes the old group of resource record sets that are associated // with the root resource record set name. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5740,8 +5804,8 @@ func (c *Route53) UpdateTrafficPolicyInstanceRequest(input *UpdateTrafficPolicyI // * ErrCodePriorRequestNotComplete "PriorRequestNotComplete" // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an -// HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly -// for the same request, we recommend that you wait, in intervals of increasing +// HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for +// the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. // // * ErrCodeConflictingTypes "ConflictingTypes" @@ -5798,7 +5862,7 @@ type AccountLimit struct { // Type is a required field Type *string `type:"string" required:"true" enum:"AccountLimitType"` - // The current value for the limit that is specified by AccountLimit$Type. + // The current value for the limit that is specified by Type (https://docs.aws.amazon.com/Route53/latest/APIReference/API_AccountLimit.html#Route53-Type-AccountLimit-Type). // // Value is a required field Value *int64 `min:"1" type:"long" required:"true"` @@ -5827,20 +5891,29 @@ func (s *AccountLimit) SetValue(v int64) *AccountLimit { } // A complex type that identifies the CloudWatch alarm that you want Amazon -// Route 53 health checkers to use to determine whether this health check is -// healthy. +// Route 53 health checkers to use to determine whether the specified health +// check is healthy. type AlarmIdentifier struct { _ struct{} `type:"structure"` // The name of the CloudWatch alarm that you want Amazon Route 53 health checkers // to use to determine whether this health check is healthy. // + // Route 53 supports CloudWatch alarms with the following features: + // + // * Standard-resolution metrics. High-resolution metrics aren't supported. + // For more information, see High-Resolution Metrics (http://docs.aws.amazon.com/AmazonCloudWatch/latest/DeveloperGuide/publishingMetrics.html#high-resolution-metrics) + // in the Amazon CloudWatch User Guide. + // + // * Statistics: Average, Minimum, Maximum, Sum, and SampleCount. Extended + // statistics aren't supported. + // // Name is a required field Name *string `min:"1" type:"string" required:"true"` - // A complex type that identifies the CloudWatch alarm that you want Amazon - // Route 53 health checkers to use to determine whether this health check is - // healthy. + // For the CloudWatch alarm that you want Route 53 health checkers to use to + // determine whether this health check is healthy, the region that the alarm + // was created in. // // For the current list of CloudWatch regions, see Amazon CloudWatch (http://docs.aws.amazon.com/general/latest/gr/rande.html#cw_region) // in the AWS Regions and Endpoints chapter of the Amazon Web Services General @@ -5894,16 +5967,12 @@ func (s *AlarmIdentifier) SetRegion(v string) *AlarmIdentifier { return s } -// Alias resource record sets only: Information about the CloudFront distribution, -// Elastic Beanstalk environment, ELB load balancer, Amazon S3 bucket, or Amazon -// Route 53 resource record set that you're redirecting queries to. An Elastic -// Beanstalk environment must have a regionalized subdomain. +// Alias resource record sets only: Information about the AWS resource, such +// as a CloudFront distribution or an Amazon S3 bucket, that you want to route +// traffic to. // // When creating resource record sets for a private hosted zone, note the following: // -// * Resource record sets can't be created for CloudFront distributions in -// a private hosted zone. -// // * Creating geolocation alias resource record sets or latency alias resource // record sets in a private hosted zone is unsupported. // @@ -5915,8 +5984,29 @@ type AliasTarget struct { // Alias resource record sets only: The value that you specify depends on where // you want to route queries: // - // CloudFront distributionSpecify the domain name that CloudFront assigned when - // you created your distribution. + // Amazon API Gateway custom regional APIs and edge-optimized APIs + // + // Specify the applicable domain name for your API. You can get the applicable + // value using the AWS CLI command get-domain-names (https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-domain-names.html): + // + // * For regional APIs, specify the value of regionalDomainName. + // + // * For edge-optimized APIs, specify the value of distributionDomainName. + // This is the name of the associated CloudFront distribution, such as da1b2c3d4e5.cloudfront.net. + // + // The name of the record that you're creating must match a custom domain name + // for your API, such as api.example.com. + // + // Amazon Virtual Private Cloud interface VPC endpoint + // + // Enter the API endpoint for the interface endpoint, such as vpce-123456789abcdef01-example-us-east-1a.elasticloadbalancing.us-east-1.vpce.amazonaws.com. + // For edge-optimized APIs, this is the domain name for the corresponding CloudFront + // distribution. You can get the value of DnsName using the AWS CLI command + // describe-vpc-endpoints (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpc-endpoints.html). + // + // CloudFront distribution + // + // Specify the domain name that CloudFront assigned when you created your distribution. // // Your CloudFront distribution must include an alternate domain name that matches // the name of the resource record set. For example, if the name of the resource @@ -5925,56 +6015,90 @@ type AliasTarget struct { // see Using Alternate Domain Names (CNAMEs) (http://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/CNAMEs.html) // in the Amazon CloudFront Developer Guide. // - // Elastic Beanstalk environmentSpecify the CNAME attribute for the environment. - // (The environment must have a regionalized domain name.) You can use the following - // methods to get the value of the CNAME attribute: + // You can't create a resource record set in a private hosted zone to route + // traffic to a CloudFront distribution. // - // AWS Management Console: For information about how to get the value by using - // the console, see Using Custom Domains with AWS Elastic Beanstalk (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html) - // in the AWS Elastic Beanstalk Developer Guide. + // For failover alias records, you can't specify a CloudFront distribution for + // both the primary and secondary records. A distribution must include an alternate + // domain name that matches the name of the record. However, the primary and + // secondary records have the same name, and you can't include the same alternate + // domain name in more than one distribution. // - // Elastic Beanstalk API: Use the DescribeEnvironments action to get the value - // of the CNAME attribute. For more information, see DescribeEnvironments (http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html) - // in the AWS Elastic Beanstalk API Reference. + // Elastic Beanstalk environment // - // AWS CLI: Use the describe-environments command to get the value of the CNAME - // attribute. For more information, see describe-environments (http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/describe-environments.html) - // in the AWS Command Line Interface Reference. + // If the domain name for your Elastic Beanstalk environment includes the region + // that you deployed the environment in, you can create an alias record that + // routes traffic to the environment. For example, the domain name my-environment.us-west-2.elasticbeanstalk.com + // is a regionalized domain name. // - // ELB load balancerSpecify the DNS name that is associated with the load balancer. - // Get the DNS name by using the AWS Management Console, the ELB API, or the - // AWS CLI. + // For environments that were created before early 2016, the domain name doesn't + // include the region. To route traffic to these environments, you must create + // a CNAME record instead of an alias record. Note that you can't create a CNAME + // record for the root domain name. For example, if your domain name is example.com, + // you can create a record that routes traffic for acme.example.com to your + // Elastic Beanstalk environment, but you can't create a record that routes + // traffic for example.com to your Elastic Beanstalk environment. // - // AWS Management Console: Go to the EC2 page, choose Load Balancers in the - // navigation pane, choose the load balancer, choose the Description tab, and - // get the value of the DNS name field. (If you're routing traffic to a Classic - // Load Balancer, get the value that begins with dualstack.) + // For Elastic Beanstalk environments that have regionalized subdomains, specify + // the CNAME attribute for the environment. You can use the following methods + // to get the value of the CNAME attribute: // - // Elastic Load Balancing API: Use DescribeLoadBalancers to get the value of - // DNSName. For more information, see the applicable guide: + // * AWS Management Console: For information about how to get the value by + // using the console, see Using Custom Domains with AWS Elastic Beanstalk + // (http://docs.aws.amazon.com/elasticbeanstalk/latest/dg/customdomains.html) + // in the AWS Elastic Beanstalk Developer Guide. // - // Classic Load Balancers: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) + // * Elastic Beanstalk API: Use the DescribeEnvironments action to get the + // value of the CNAME attribute. For more information, see DescribeEnvironments + // (http://docs.aws.amazon.com/elasticbeanstalk/latest/api/API_DescribeEnvironments.html) + // in the AWS Elastic Beanstalk API Reference. // - // Application and Network Load Balancers: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) + // * AWS CLI: Use the describe-environments command to get the value of the + // CNAME attribute. For more information, see describe-environments (http://docs.aws.amazon.com/cli/latest/reference/elasticbeanstalk/describe-environments.html) + // in the AWS Command Line Interface Reference. // - // AWS CLI: Use describe-load-balancers to get the value of DNSName. For more - // information, see the applicable guide: + // ELB load balancer // - // Classic Load Balancers: describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) + // Specify the DNS name that is associated with the load balancer. Get the DNS + // name by using the AWS Management Console, the ELB API, or the AWS CLI. // - // Application and Network Load Balancers: describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-load-balancers.html) + // * AWS Management Console: Go to the EC2 page, choose Load Balancers in + // the navigation pane, choose the load balancer, choose the Description + // tab, and get the value of the DNS name field. If you're routing traffic + // to a Classic Load Balancer, get the value that begins with dualstack. + // If you're routing traffic to another type of load balancer, get the value + // that applies to the record type, A or AAAA. // - // Amazon S3 bucket that is configured as a static websiteSpecify the domain - // name of the Amazon S3 website endpoint in which you created the bucket, for - // example, s3-website-us-east-2.amazonaws.com. For more information about valid - // values, see the table Amazon Simple Storage Service (S3) Website Endpoints - // (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) in the - // Amazon Web Services General Reference. For more information about using S3 - // buckets for websites, see Getting Started with Amazon Route 53 (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) + // * Elastic Load Balancing API: Use DescribeLoadBalancers to get the value + // of DNSName. For more information, see the applicable guide: Classic Load + // Balancers: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) + // Application and Network Load Balancers: DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) + // + // * AWS CLI: Use describe-load-balancers to get the value of DNSName. For + // more information, see the applicable guide: Classic Load Balancers: describe-load-balancers + // (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) + // Application and Network Load Balancers: describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-load-balancers.html) + // + // Amazon S3 bucket that is configured as a static website + // + // Specify the domain name of the Amazon S3 website endpoint that you created + // the bucket in, for example, s3-website.us-east-2.amazonaws.com. For more + // information about valid values, see the table Amazon Simple Storage Service + // (S3) Website Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) + // in the Amazon Web Services General Reference. For more information about + // using S3 buckets for websites, see Getting Started with Amazon Route 53 (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/getting-started.html) // in the Amazon Route 53 Developer Guide. // - // Another Amazon Route 53 resource record setSpecify the value of the Name - // element for a resource record set in the current hosted zone. + // Another Route 53 resource record set + // + // Specify the value of the Name element for a resource record set in the current + // hosted zone. + // + // If you're creating an alias record that has the same name as the hosted zone + // (known as the zone apex), you can't specify the domain name for a record + // for which the value of Type is CNAME. This is because the alias record must + // have the same type as the record that you're routing traffic to, and creating + // a CNAME record for the zone apex isn't supported even for an alias record. // // DNSName is a required field DNSName *string `type:"string" required:"true"` @@ -5982,48 +6106,69 @@ type AliasTarget struct { // Applies only to alias, failover alias, geolocation alias, latency alias, // and weighted alias resource record sets: When EvaluateTargetHealth is true, // an alias resource record set inherits the health of the referenced AWS resource, - // such as an ELB load balancer, or the referenced resource record set. + // such as an ELB load balancer or another resource record set in the hosted + // zone. // // Note the following: // - // * You can't set EvaluateTargetHealth to true when the alias target is - // a CloudFront distribution. + // CloudFront distributions // - // * If the AWS resource that you specify in AliasTarget is a resource record - // set or a group of resource record sets (for example, a group of weighted - // resource record sets), but it is not another alias resource record set, - // we recommend that you associate a health check with all of the resource - // record sets in the alias target. For more information, see What Happens - // When You Omit Health Checks? (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html#dns-failover-complex-configs-hc-omitting) - // in the Amazon Route 53 Developer Guide. + // You can't set EvaluateTargetHealth to true when the alias target is a CloudFront + // distribution. // - // * If you specify an Elastic Beanstalk environment in HostedZoneId and - // DNSName, and if the environment contains an ELB load balancer, Elastic - // Load Balancing routes queries only to the healthy Amazon EC2 instances - // that are registered with the load balancer. (An environment automatically - // contains an ELB load balancer if it includes more than one EC2 instance.) - // If you set EvaluateTargetHealth to true and either no EC2 instances are - // healthy or the load balancer itself is unhealthy, Amazon Route 53 routes - // queries to other available resources that are healthy, if any. + // Elastic Beanstalk environments that have regionalized subdomains // - // If the environment contains a single EC2 instance, there are no special requirements. + // If you specify an Elastic Beanstalk environment in DNSName and the environment + // contains an ELB load balancer, Elastic Load Balancing routes queries only + // to the healthy Amazon EC2 instances that are registered with the load balancer. + // (An environment automatically contains an ELB load balancer if it includes + // more than one Amazon EC2 instance.) If you set EvaluateTargetHealth to true + // and either no Amazon EC2 instances are healthy or the load balancer itself + // is unhealthy, Route 53 routes queries to other available resources that are + // healthy, if any. // - // * If you specify an ELB load balancer in AliasTarget, ELB routes queries - // only to the healthy EC2 instances that are registered with the load balancer. - // If no EC2 instances are healthy or if the load balancer itself is unhealthy, - // and if EvaluateTargetHealth is true for the corresponding alias resource - // record set, Amazon Route 53 routes queries to other resources. When you - // create a load balancer, you configure settings for ELB health checks; - // they're not Amazon Route 53 health checks, but they perform a similar - // function. Do not create Amazon Route 53 health checks for the EC2 instances - // that you register with an ELB load balancer. + // If the environment contains a single Amazon EC2 instance, there are no special + // requirements. // - // For more information, see How Health Checks Work in More Complex Amazon Route - // 53 Configurations (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html) - // in the Amazon Route 53 Developer Guide. + // ELB load balancers // - // * We recommend that you set EvaluateTargetHealth to true only when you - // have enough idle capacity to handle the failure of one or more endpoints. + // Health checking behavior depends on the type of load balancer: + // + // * Classic Load Balancers: If you specify an ELB Classic Load Balancer + // in DNSName, Elastic Load Balancing routes queries only to the healthy + // Amazon EC2 instances that are registered with the load balancer. If you + // set EvaluateTargetHealth to true and either no EC2 instances are healthy + // or the load balancer itself is unhealthy, Route 53 routes queries to other + // resources. + // + // * Application and Network Load Balancers: If you specify an ELB Application + // or Network Load Balancer and you set EvaluateTargetHealth to true, Route + // 53 routes queries to the load balancer based on the health of the target + // groups that are associated with the load balancer: For an Application + // or Network Load Balancer to be considered healthy, every target group + // that contains targets must contain at least one healthy target. If any + // target group contains only unhealthy targets, the load balancer is considered + // unhealthy, and Route 53 routes queries to other resources. A target group + // that has no registered targets is considered unhealthy. + // + // When you create a load balancer, you configure settings for Elastic Load + // Balancing health checks; they're not Route 53 health checks, but they perform + // a similar function. Do not create Route 53 health checks for the EC2 instances + // that you register with an ELB load balancer. + // + // S3 buckets + // + // There are no special requirements for setting EvaluateTargetHealth to true + // when the alias target is an S3 bucket. + // + // Other records in the same hosted zone + // + // If the AWS resource that you specify in DNSName is a record or a group of + // records (for example, a group of weighted records) but is not another alias + // record, we recommend that you associate a health check with all of the records + // in the alias target. For more information, see What Happens When You Omit + // Health Checks? (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-complex-configs.html#dns-failover-complex-configs-hc-omitting) + // in the Amazon Route 53 Developer Guide. // // For more information and examples, see Amazon Route 53 Health Checks and // DNS Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html) @@ -6035,57 +6180,75 @@ type AliasTarget struct { // Alias resource records sets only: The value used depends on where you want // to route traffic: // - // CloudFront distributionSpecify Z2FDTNDATAQYW2. + // Amazon API Gateway custom regional APIs and edge-optimized APIs + // + // Specify the hosted zone ID for your API. You can get the applicable value + // using the AWS CLI command get-domain-names (https://docs.aws.amazon.com/cli/latest/reference/apigateway/get-domain-names.html): + // + // * For regional APIs, specify the value of regionalHostedZoneId. + // + // * For edge-optimized APIs, specify the value of distributionHostedZoneId. + // + // Amazon Virtual Private Cloud interface VPC endpoint + // + // Specify the hosted zone ID for your interface endpoint. You can get the value + // of HostedZoneId using the AWS CLI command describe-vpc-endpoints (https://docs.aws.amazon.com/cli/latest/reference/ec2/describe-vpc-endpoints.html). + // + // CloudFront distribution + // + // Specify Z2FDTNDATAQYW2. // // Alias resource record sets for CloudFront can't be created in a private zone. // - // Elastic Beanstalk environmentSpecify the hosted zone ID for the region in - // which you created the environment. The environment must have a regionalized - // subdomain. For a list of regions and the corresponding hosted zone IDs, see - // AWS Elastic Beanstalk (http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region) + // Elastic Beanstalk environment + // + // Specify the hosted zone ID for the region that you created the environment + // in. The environment must have a regionalized subdomain. For a list of regions + // and the corresponding hosted zone IDs, see AWS Elastic Beanstalk (http://docs.aws.amazon.com/general/latest/gr/rande.html#elasticbeanstalk_region) // in the "AWS Regions and Endpoints" chapter of the Amazon Web Services General // Reference. // - // ELB load balancerSpecify the value of the hosted zone ID for the load balancer. - // Use the following methods to get the hosted zone ID: + // ELB load balancer // - // Elastic Load Balancing (http://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) - // table in the "AWS Regions and Endpoints" chapter of the Amazon Web Services - // General Reference: Use the value that corresponds with the region that you - // created your load balancer in. Note that there are separate columns for Application - // and Classic Load Balancers and for Network Load Balancers. + // Specify the value of the hosted zone ID for the load balancer. Use the following + // methods to get the hosted zone ID: // - // AWS Management Console: Go to the Amazon EC2 page, choose Load Balancers - // in the navigation pane, select the load balancer, and get the value of the - // Hosted zone field on the Description tab. + // * Elastic Load Balancing (https://docs.aws.amazon.com/general/latest/gr/rande.html#elb_region) + // table in the "AWS Regions and Endpoints" chapter of the Amazon Web Services + // General Reference: Use the value that corresponds with the region that + // you created your load balancer in. Note that there are separate columns + // for Application and Classic Load Balancers and for Network Load Balancers. // - // Elastic Load Balancing API: Use DescribeLoadBalancers to get the applicable - // value. For more information, see the applicable guide: + // * AWS Management Console: Go to the Amazon EC2 page, choose Load Balancers + // in the navigation pane, select the load balancer, and get the value of + // the Hosted zone field on the Description tab. // - // Classic Load Balancers: Use DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) - // to get the value of CanonicalHostedZoneNameId. + // * Elastic Load Balancing API: Use DescribeLoadBalancers to get the applicable + // value. For more information, see the applicable guide: Classic Load Balancers: + // Use DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/2012-06-01/APIReference/API_DescribeLoadBalancers.html) + // to get the value of CanonicalHostedZoneNameId. Application and Network + // Load Balancers: Use DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) + // to get the value of CanonicalHostedZoneId. // - // Application and Network Load Balancers: Use DescribeLoadBalancers (http://docs.aws.amazon.com/elasticloadbalancing/latest/APIReference/API_DescribeLoadBalancers.html) - // to get the value of CanonicalHostedZoneId. + // * AWS CLI: Use describe-load-balancers to get the applicable value. For + // more information, see the applicable guide: Classic Load Balancers: Use + // describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) + // to get the value of CanonicalHostedZoneNameId. Application and Network + // Load Balancers: Use describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-load-balancers.html) + // to get the value of CanonicalHostedZoneId. // - // AWS CLI: Use describe-load-balancers to get the applicable value. For more - // information, see the applicable guide: + // An Amazon S3 bucket configured as a static website // - // Classic Load Balancers: Use describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elb/describe-load-balancers.html) - // to get the value of CanonicalHostedZoneNameId. - // - // Application and Network Load Balancers: Use describe-load-balancers (http://docs.aws.amazon.com/cli/latest/reference/elbv2/describe-load-balancers.html) - // to get the value of CanonicalHostedZoneId. - // - // An Amazon S3 bucket configured as a static websiteSpecify the hosted zone - // ID for the region that you created the bucket in. For more information about - // valid values, see the Amazon Simple Storage Service Website Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) + // Specify the hosted zone ID for the region that you created the bucket in. + // For more information about valid values, see the Amazon Simple Storage Service + // Website Endpoints (http://docs.aws.amazon.com/general/latest/gr/rande.html#s3_region) // table in the "AWS Regions and Endpoints" chapter of the Amazon Web Services // General Reference. // - // Another Amazon Route 53 resource record set in your hosted zoneSpecify the - // hosted zone ID of your hosted zone. (An alias resource record set can't reference - // a resource record set in a different hosted zone.) + // Another Route 53 resource record set in your hosted zone + // + // Specify the hosted zone ID of your hosted zone. (An alias resource record + // set can't reference a resource record set in a different hosted zone.) // // HostedZoneId is a required field HostedZoneId *string `type:"string" required:"true"` @@ -6178,6 +6341,9 @@ func (s *AssociateVPCWithHostedZoneInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.VPC == nil { invalidParams.Add(request.NewErrParamRequired("VPC")) } @@ -6246,18 +6412,17 @@ type Change struct { // // * CREATE: Creates a resource record set that has the specified values. // - // * DELETE: Deletes a existing resource record set. + // * DELETE: Deletes a existing resource record set. To delete the resource + // record set that is associated with a traffic policy instance, use DeleteTrafficPolicyInstance + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_DeleteTrafficPolicyInstance.html). + // Amazon Route 53 will delete the resource record set automatically. If + // you delete the resource record set by using ChangeResourceRecordSets, + // Route 53 doesn't automatically delete the traffic policy instance, and + // you'll continue to be charged for it even though it's no longer in use. // - // To delete the resource record set that is associated with a traffic policy - // instance, use DeleteTrafficPolicyInstance. Amazon Route 53 will delete - // the resource record set automatically. If you delete the resource record - // set by using ChangeResourceRecordSets, Amazon Route 53 doesn't automatically - // delete the traffic policy instance, and you'll continue to be charged - // for it even though it's no longer in use. - // - // * UPSERT: If a resource record set doesn't already exist, Amazon Route - // 53 creates it. If a resource record set does exist, Amazon Route 53 updates - // it with the values in the request. + // * UPSERT: If a resource record set doesn't already exist, Route 53 creates + // it. If a resource record set does exist, Route 53 updates it with the + // values in the request. // // Action is a required field Action *string `type:"string" required:"true" enum:"ChangeAction"` @@ -6380,8 +6545,8 @@ type ChangeInfo struct { // A complex type that describes change information about changes made to your // hosted zone. // - // This element contains an ID that you use when performing a GetChange action - // to get detailed information about the change. + // This element contains an ID that you use when performing a GetChange (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html) + // action to get detailed information about the change. Comment *string `type:"string"` // The ID of the request. @@ -6473,6 +6638,9 @@ func (s *ChangeResourceRecordSetsInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.ChangeBatch != nil { if err := s.ChangeBatch.Validate(); err != nil { invalidParams.AddNested("ChangeBatch", err.(request.ErrInvalidParams)) @@ -6504,8 +6672,8 @@ type ChangeResourceRecordSetsOutput struct { // A complex type that contains information about changes made to your hosted // zone. // - // This element contains an ID that you use when performing a GetChange action - // to get detailed information about the change. + // This element contains an ID that you use when performing a GetChange (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetChange.html) + // action to get detailed information about the change. // // ChangeInfo is a required field ChangeInfo *ChangeInfo `type:"structure" required:"true"` @@ -6580,9 +6748,15 @@ func (s *ChangeTagsForResourceInput) Validate() error { if s.ResourceId == nil { invalidParams.Add(request.NewErrParamRequired("ResourceId")) } + if s.ResourceId != nil && len(*s.ResourceId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceId", 1)) + } if s.ResourceType == nil { invalidParams.Add(request.NewErrParamRequired("ResourceType")) } + if s.ResourceType != nil && len(*s.ResourceType) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceType", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -6752,24 +6926,24 @@ type CreateHealthCheckInput struct { // * If you send a CreateHealthCheck request with the same CallerReference // and settings as a previous request, and if the health check doesn't exist, // Amazon Route 53 creates the health check. If the health check does exist, - // Amazon Route 53 returns the settings for the existing health check. + // Route 53 returns the settings for the existing health check. // // * If you send a CreateHealthCheck request with the same CallerReference - // as a deleted health check, regardless of the settings, Amazon Route 53 - // returns a HealthCheckAlreadyExists error. + // as a deleted health check, regardless of the settings, Route 53 returns + // a HealthCheckAlreadyExists error. // // * If you send a CreateHealthCheck request with the same CallerReference - // as an existing health check but with different settings, Amazon Route - // 53 returns a HealthCheckAlreadyExists error. + // as an existing health check but with different settings, Route 53 returns + // a HealthCheckAlreadyExists error. // // * If you send a CreateHealthCheck request with a unique CallerReference - // but settings identical to an existing health check, Amazon Route 53 creates - // the health check. + // but settings identical to an existing health check, Route 53 creates the + // health check. // // CallerReference is a required field CallerReference *string `min:"1" type:"string" required:"true"` - // A complex type that contains the response to a CreateHealthCheck request. + // A complex type that contains settings for a new health check. // // HealthCheckConfig is a required field HealthCheckConfig *HealthCheckConfig `type:"structure" required:"true"` @@ -6858,8 +7032,8 @@ func (s *CreateHealthCheckOutput) SetLocation(v string) *CreateHealthCheckOutput return s } -// A complex type that contains information about the request to create a hosted -// zone. +// A complex type that contains information about the request to create a public +// or private hosted zone. type CreateHostedZoneInput struct { _ struct{} `locationName:"CreateHostedZoneRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` @@ -6875,7 +7049,7 @@ type CreateHostedZoneInput struct { // If you want to associate a reusable delegation set with this hosted zone, // the ID that Amazon Route 53 assigned to the reusable delegation set when // you created it. For more information about reusable delegation sets, see - // CreateReusableDelegationSet. + // CreateReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html). DelegationSetId *string `type:"string"` // (Optional) A complex type that contains the following optional values: @@ -6888,16 +7062,15 @@ type CreateHostedZoneInput struct { // and the other elements. HostedZoneConfig *HostedZoneConfig `type:"structure"` - // The name of the domain. For resource record types that include a domain name, - // specify a fully qualified domain name, for example, www.example.com. The - // trailing dot is optional; Amazon Route 53 assumes that the domain name is - // fully qualified. This means that Amazon Route 53 treats www.example.com (without - // a trailing dot) and www.example.com. (with a trailing dot) as identical. + // The name of the domain. Specify a fully qualified domain name, for example, + // www.example.com. The trailing dot is optional; Amazon Route 53 assumes that + // the domain name is fully qualified. This means that Route 53 treats www.example.com + // (without a trailing dot) and www.example.com. (with a trailing dot) as identical. // // If you're creating a public hosted zone, this is the name you have registered // with your DNS registrar. If your domain name is registered with a registrar - // other than Amazon Route 53, change the name servers for your domain to the - // set of NameServers that CreateHostedZone returns in DelegationSet. + // other than Route 53, change the name servers for your domain to the set of + // NameServers that CreateHostedZone returns in DelegationSet. // // Name is a required field Name *string `type:"string" required:"true"` @@ -6907,6 +7080,7 @@ type CreateHostedZoneInput struct { // // You can specify only one Amazon VPC when you create a private hosted zone. // To associate additional Amazon VPCs with the hosted zone, use AssociateVPCWithHostedZone + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_AssociateVPCWithHostedZone.html) // after you create a hosted zone. VPC *VPC `type:"structure"` } @@ -7053,8 +7227,8 @@ type CreateQueryLoggingConfigInput struct { // arn:aws:logs:region:account-id:log-group:log_group_name // // To get the ARN for a log group, you can use the CloudWatch console, the DescribeLogGroups - // (http://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html) - // API action, the describe-log-groups (http://docs.aws.amazon.com/cli/latest/reference/logs/describe-log-groups.html) + // (https://docs.aws.amazon.com/AmazonCloudWatchLogs/latest/APIReference/API_DescribeLogGroups.html) + // API action, the describe-log-groups (https://docs.aws.amazon.com/cli/latest/reference/logs/describe-log-groups.html) // command, or the applicable command in one of the AWS SDKs. // // CloudWatchLogsLogGroupArn is a required field @@ -7243,7 +7417,7 @@ type CreateTrafficPolicyInput struct { Comment *string `type:"string"` // The definition of this traffic policy in JSON format. For more information, - // see Traffic Policy Document Format (http://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html). + // see Traffic Policy Document Format (https://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html). // // Document is a required field Document *string `type:"string" required:"true"` @@ -7303,15 +7477,15 @@ func (s *CreateTrafficPolicyInput) SetName(v string) *CreateTrafficPolicyInput { type CreateTrafficPolicyInstanceInput struct { _ struct{} `locationName:"CreateTrafficPolicyInstanceRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` - // The ID of the hosted zone in which you want Amazon Route 53 to create resource - // record sets by using the configuration in a traffic policy. + // The ID of the hosted zone that you want Amazon Route 53 to create resource + // record sets in by using the configuration in a traffic policy. // // HostedZoneId is a required field HostedZoneId *string `type:"string" required:"true"` // The domain name (such as example.com) or subdomain name (such as www.example.com) // for which Amazon Route 53 responds to DNS queries by using the resource record - // sets that Amazon Route 53 creates for this traffic policy instance. + // sets that Route 53 creates for this traffic policy instance. // // Name is a required field Name *string `type:"string" required:"true"` @@ -7493,7 +7667,7 @@ type CreateTrafficPolicyVersionInput struct { // The definition of this version of the traffic policy, in JSON format. You // specified the JSON in the CreateTrafficPolicyVersion request. For more information - // about the JSON format, see CreateTrafficPolicy. + // about the JSON format, see CreateTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html). // // Document is a required field Document *string `type:"string" required:"true"` @@ -7625,6 +7799,9 @@ func (s *CreateVPCAssociationAuthorizationInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.VPC == nil { invalidParams.Add(request.NewErrParamRequired("VPC")) } @@ -7763,6 +7940,9 @@ func (s *DeleteHealthCheckInput) Validate() error { if s.HealthCheckId == nil { invalidParams.Add(request.NewErrParamRequired("HealthCheckId")) } + if s.HealthCheckId != nil && len(*s.HealthCheckId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HealthCheckId", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -7817,6 +7997,9 @@ func (s *DeleteHostedZoneInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -7938,6 +8121,9 @@ func (s *DeleteReusableDelegationSetInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -8138,6 +8324,9 @@ func (s *DeleteVPCAssociationAuthorizationInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.VPC == nil { invalidParams.Add(request.NewErrParamRequired("VPC")) } @@ -8256,6 +8445,9 @@ func (s *DisassociateVPCFromHostedZoneInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.VPC == nil { invalidParams.Add(request.NewErrParamRequired("VPC")) } @@ -8317,7 +8509,7 @@ func (s *DisassociateVPCFromHostedZoneOutput) SetChangeInfo(v *ChangeInfo) *Disa return s } -// A complex type that contains information about a geo location. +// A complex type that contains information about a geographic location. type GeoLocation struct { _ struct{} `type:"structure"` @@ -8332,8 +8524,8 @@ type GeoLocation struct { // The two-letter code for the country. CountryCode *string `min:"1" type:"string"` - // The code for the subdivision, for example, a state in the United States or - // a province in Canada. + // The code for the subdivision. Route 53 currently supports only states in + // the United States. SubdivisionCode *string `min:"1" type:"string"` } @@ -8401,12 +8593,12 @@ type GeoLocationDetails struct { // The name of the country. CountryName *string `min:"1" type:"string"` - // The code for the subdivision, for example, a state in the United States or - // a province in Canada. + // The code for the subdivision. Route 53 currently supports only states in + // the United States. SubdivisionCode *string `min:"1" type:"string"` - // The full name of the subdivision, for example, a state in the United States - // or a province in Canada. + // The full name of the subdivision. Route 53 currently supports only states + // in the United States. SubdivisionName *string `min:"1" type:"string"` } @@ -8500,6 +8692,9 @@ func (s *GetAccountLimitInput) Validate() error { if s.Type == nil { invalidParams.Add(request.NewErrParamRequired("Type")) } + if s.Type != nil && len(*s.Type) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Type", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -8584,6 +8779,9 @@ func (s *GetChangeInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -8623,6 +8821,7 @@ func (s *GetChangeOutput) SetChangeInfo(v *ChangeInfo) *GetChangeOutput { return s } +// Empty request. type GetCheckerIpRangesInput struct { _ struct{} `type:"structure"` } @@ -8637,9 +8836,13 @@ func (s GetCheckerIpRangesInput) GoString() string { return s.String() } +// A complex type that contains the CheckerIpRanges element. type GetCheckerIpRangesOutput struct { _ struct{} `type:"structure"` + // A complex type that contains sorted list of IP ranges in CIDR format for + // Amazon Route 53 health checkers. + // // CheckerIpRanges is a required field CheckerIpRanges []*string `type:"list" required:"true"` } @@ -8688,8 +8891,8 @@ type GetGeoLocationInput struct { // Amazon Route 53 uses the one- to three-letter subdivision codes that are // specified in ISO standard 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). - // Amazon Route 53 doesn't support subdivision codes for all countries. If you - // specify SubdivisionCode, you must also specify CountryCode. + // Route 53 doesn't support subdivision codes for all countries. If you specify + // subdivisioncode, you must also specify countrycode. SubdivisionCode *string `location:"querystring" locationName:"subdivisioncode" min:"1" type:"string"` } @@ -8839,6 +9042,9 @@ func (s *GetHealthCheckInput) Validate() error { if s.HealthCheckId == nil { invalidParams.Add(request.NewErrParamRequired("HealthCheckId")) } + if s.HealthCheckId != nil && len(*s.HealthCheckId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HealthCheckId", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -8884,6 +9090,9 @@ func (s *GetHealthCheckLastFailureReasonInput) Validate() error { if s.HealthCheckId == nil { invalidParams.Add(request.NewErrParamRequired("HealthCheckId")) } + if s.HealthCheckId != nil && len(*s.HealthCheckId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HealthCheckId", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -8984,6 +9193,9 @@ func (s *GetHealthCheckStatusInput) Validate() error { if s.HealthCheckId == nil { invalidParams.Add(request.NewErrParamRequired("HealthCheckId")) } + if s.HealthCheckId != nil && len(*s.HealthCheckId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HealthCheckId", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -9093,6 +9305,9 @@ func (s *GetHostedZoneInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -9144,9 +9359,15 @@ func (s *GetHostedZoneLimitInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.Type == nil { invalidParams.Add(request.NewErrParamRequired("Type")) } + if s.Type != nil && len(*s.Type) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Type", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -9302,7 +9523,8 @@ type GetQueryLoggingConfigOutput struct { _ struct{} `type:"structure"` // A complex type that contains information about the query logging configuration - // that you specified in a GetQueryLoggingConfig request. + // that you specified in a GetQueryLoggingConfig (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetQueryLoggingConfig.html) + // request. // // QueryLoggingConfig is a required field QueryLoggingConfig *QueryLoggingConfig `type:"structure" required:"true"` @@ -9351,6 +9573,9 @@ func (s *GetReusableDelegationSetInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -9398,9 +9623,15 @@ func (s *GetReusableDelegationSetLimitInput) Validate() error { if s.DelegationSetId == nil { invalidParams.Add(request.NewErrParamRequired("DelegationSetId")) } + if s.DelegationSetId != nil && len(*s.DelegationSetId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("DelegationSetId", 1)) + } if s.Type == nil { invalidParams.Add(request.NewErrParamRequired("Type")) } + if s.Type != nil && len(*s.Type) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Type", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -9776,8 +10007,8 @@ type HealthCheckConfig struct { _ struct{} `type:"structure"` // A complex type that identifies the CloudWatch alarm that you want Amazon - // Route 53 health checkers to use to determine whether this health check is - // healthy. + // Route 53 health checkers to use to determine whether the specified health + // check is healthy. AlarmIdentifier *AlarmIdentifier `type:"structure"` // (CALCULATED Health Checks Only) A complex type that contains one ChildHealthCheck @@ -9785,6 +10016,27 @@ type HealthCheckConfig struct { // health check. ChildHealthChecks []*string `locationNameList:"ChildHealthCheck" type:"list"` + // Stops Route 53 from performing health checks. When you disable a health check, + // here's what happens: + // + // * Health checks that check the health of endpoints: Route 53 stops submitting + // requests to your application, server, or other resource. + // + // * Calculated health checks: Route 53 stops aggregating the status of the + // referenced health checks. + // + // * Health checks that monitor CloudWatch alarms: Route 53 stops monitoring + // the corresponding CloudWatch metrics. + // + // After you disable a health check, Route 53 considers the status of the health + // check to always be healthy. If you configured DNS failover, Route 53 continues + // to route traffic to the corresponding resources. If you want to stop routing + // traffic to a resource, change the value of Inverted (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-Inverted). + // + // Charges for a health check still apply when the health check is disabled. + // For more information, see Amazon Route 53 Pricing (http://aws.amazon.com/route53/pricing/). + Disabled *bool `type:"boolean"` + // Specify whether you want Amazon Route 53 to send the value of FullyQualifiedDomainName // to the endpoint in the client_hello message during TLS negotiation. This // allows the endpoint to respond to HTTPS health check requests with the applicable @@ -9819,43 +10071,42 @@ type HealthCheckConfig struct { // Amazon Route 53 behavior depends on whether you specify a value for IPAddress. // - // If you specify a value forIPAddress: + // If you specify a value for IPAddress: // // Amazon Route 53 sends health check requests to the specified IPv4 or IPv6 // address and passes the value of FullyQualifiedDomainName in the Host header // for all health checks except TCP health checks. This is typically the fully - // qualified DNS name of the endpoint on which you want Amazon Route 53 to perform + // qualified DNS name of the endpoint on which you want Route 53 to perform // health checks. // - // When Amazon Route 53 checks the health of an endpoint, here is how it constructs + // When Route 53 checks the health of an endpoint, here is how it constructs // the Host header: // // * If you specify a value of 80 for Port and HTTP or HTTP_STR_MATCH for - // Type, Amazon Route 53 passes the value of FullyQualifiedDomainName to - // the endpoint in the Host header. + // Type, Route 53 passes the value of FullyQualifiedDomainName to the endpoint + // in the Host header. // // * If you specify a value of 443 for Port and HTTPS or HTTPS_STR_MATCH - // for Type, Amazon Route 53 passes the value of FullyQualifiedDomainName - // to the endpoint in the Host header. + // for Type, Route 53 passes the value of FullyQualifiedDomainName to the + // endpoint in the Host header. // // * If you specify another value for Port and any value except TCP for Type, - // Amazon Route 53 passes FullyQualifiedDomainName:Port to the endpoint in - // the Host header. + // Route 53 passes FullyQualifiedDomainName:Port to the endpoint in the Host + // header. // - // If you don't specify a value for FullyQualifiedDomainName, Amazon Route 53 - // substitutes the value of IPAddress in the Host header in each of the preceding - // cases. + // If you don't specify a value for FullyQualifiedDomainName, Route 53 substitutes + // the value of IPAddress in the Host header in each of the preceding cases. // - // If you don't specify a value for IPAddress: + // If you don't specify a value for IPAddress : // - // Amazon Route 53 sends a DNS request to the domain that you specify for FullyQualifiedDomainName + // Route 53 sends a DNS request to the domain that you specify for FullyQualifiedDomainName // at the interval that you specify for RequestInterval. Using an IPv4 address - // that DNS returns, Amazon Route 53 then checks the health of the endpoint. + // that DNS returns, Route 53 then checks the health of the endpoint. // - // If you don't specify a value for IPAddress, Amazon Route 53 uses only IPv4 - // to send health checks to the endpoint. If there's no resource record set - // with a type of A for the name that you specify for FullyQualifiedDomainName, - // the health check fails with a "DNS resolution failed" error. + // If you don't specify a value for IPAddress, Route 53 uses only IPv4 to send + // health checks to the endpoint. If there's no resource record set with a type + // of A for the name that you specify for FullyQualifiedDomainName, the health + // check fails with a "DNS resolution failed" error. // // If you want to check the health of weighted, latency, or failover resource // record sets and you choose to specify the endpoint only by FullyQualifiedDomainName, @@ -9871,32 +10122,33 @@ type HealthCheckConfig struct { // check results will be unpredictable. // // In addition, if the value that you specify for Type is HTTP, HTTPS, HTTP_STR_MATCH, - // or HTTPS_STR_MATCH, Amazon Route 53 passes the value of FullyQualifiedDomainName + // or HTTPS_STR_MATCH, Route 53 passes the value of FullyQualifiedDomainName // in the Host header, as it does when you specify a value for IPAddress. If - // the value of Type is TCP, Amazon Route 53 doesn't pass a Host header. + // the value of Type is TCP, Route 53 doesn't pass a Host header. FullyQualifiedDomainName *string `type:"string"` // The number of child health checks that are associated with a CALCULATED health - // that Amazon Route 53 must consider healthy for the CALCULATED health check - // to be considered healthy. To specify the child health checks that you want - // to associate with a CALCULATED health check, use the HealthCheckConfig$ChildHealthChecks - // and HealthCheckConfig$ChildHealthChecks elements. + // check that Amazon Route 53 must consider healthy for the CALCULATED health + // check to be considered healthy. To specify the child health checks that you + // want to associate with a CALCULATED health check, use the ChildHealthChecks + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-ChildHealthChecks) + // element. // // Note the following: // // * If you specify a number greater than the number of child health checks, - // Amazon Route 53 always considers this health check to be unhealthy. + // Route 53 always considers this health check to be unhealthy. // - // * If you specify 0, Amazon Route 53 always considers this health check - // to be healthy. + // * If you specify 0, Route 53 always considers this health check to be + // healthy. HealthThreshold *int64 `type:"integer"` // The IPv4 or IPv6 IP address of the endpoint that you want Amazon Route 53 // to perform health checks on. If you don't specify a value for IPAddress, - // Amazon Route 53 sends a DNS request to resolve the domain name that you specify + // Route 53 sends a DNS request to resolve the domain name that you specify // in FullyQualifiedDomainName at the interval that you specify in RequestInterval. - // Using an IP address returned by DNS, Amazon Route 53 then checks the health - // of the endpoint. + // Using an IP address returned by DNS, Route 53 then checks the health of the + // endpoint. // // Use one of the following formats for the value of IPAddress: // @@ -9913,11 +10165,11 @@ type HealthCheckConfig struct { // IP address for IPAddress. This ensures that the IP address of your instance // will never change. // - // For more information, see HealthCheckConfig$FullyQualifiedDomainName. + // For more information, see FullyQualifiedDomainName (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-FullyQualifiedDomainName). // - // Constraints: Amazon Route 53 can't check the health of endpoints for which - // the IP address is in local, private, non-routable, or multicast ranges. For - // more information about IP addresses for which you can't create health checks, + // Constraints: Route 53 can't check the health of endpoints for which the IP + // address is in local, private, non-routable, or multicast ranges. For more + // information about IP addresses for which you can't create health checks, // see the following documents: // // * RFC 5735, Special Use IPv4 Addresses (https://tools.ietf.org/html/rfc5735) @@ -9932,14 +10184,14 @@ type HealthCheckConfig struct { // When CloudWatch has insufficient data about the metric to determine the alarm // state, the status that you want Amazon Route 53 to assign to the health check: // - // * Healthy: Amazon Route 53 considers the health check to be healthy. + // * Healthy: Route 53 considers the health check to be healthy. // - // * Unhealthy: Amazon Route 53 considers the health check to be unhealthy. + // * Unhealthy: Route 53 considers the health check to be unhealthy. // - // * LastKnownStatus: Amazon Route 53 uses the status of the health check - // from the last time that CloudWatch had sufficient data to determine the - // alarm state. For new health checks that have no last known status, the - // default status for the health check is healthy. + // * LastKnownStatus: Route 53 uses the status of the health check from the + // last time that CloudWatch had sufficient data to determine the alarm state. + // For new health checks that have no last known status, the default status + // for the health check is healthy. InsufficientDataHealthStatus *string `type:"string" enum:"InsufficientDataHealthStatus"` // Specify whether you want Amazon Route 53 to invert the status of a health @@ -9949,7 +10201,7 @@ type HealthCheckConfig struct { // Specify whether you want Amazon Route 53 to measure the latency between health // checkers in multiple AWS regions and your endpoint, and to display CloudWatch - // latency graphs on the Health Checks page in the Amazon Route 53 console. + // latency graphs on the Health Checks page in the Route 53 console. // // You can't change the value of MeasureLatency after you create a health check. MeasureLatency *bool `type:"boolean"` @@ -9961,18 +10213,18 @@ type HealthCheckConfig struct { // A complex type that contains one Region element for each region from which // you want Amazon Route 53 health checkers to check the specified endpoint. // - // If you don't specify any regions, Amazon Route 53 health checkers automatically + // If you don't specify any regions, Route 53 health checkers automatically // performs checks from all of the regions that are listed under Valid Values. // // If you update a health check to remove a region that has been performing - // health checks, Amazon Route 53 will briefly continue to perform checks from - // that region to ensure that some health checkers are always checking the endpoint + // health checks, Route 53 will briefly continue to perform checks from that + // region to ensure that some health checkers are always checking the endpoint // (for example, if you replace three regions with four different regions). Regions []*string `locationNameList:"Region" min:"3" type:"list"` // The number of seconds between the time that Amazon Route 53 gets a response // from your endpoint and the time that it sends the next health check request. - // Each Amazon Route 53 health checker makes requests at this interval. + // Each Route 53 health checker makes requests at this interval. // // You can't change the value of RequestInterval after you create a health check. // @@ -9983,16 +10235,16 @@ type HealthCheckConfig struct { // The path, if any, that you want Amazon Route 53 to request when performing // health checks. The path can be any value for which your endpoint will return // an HTTP status code of 2xx or 3xx when the endpoint is healthy, for example, - // the file /docs/route53-health-check.html. + // the file /docs/route53-health-check.html. You can also include query string + // parameters, for example, /welcome.html?language=jp&login=y. ResourcePath *string `type:"string"` // If the value of Type is HTTP_STR_MATCH or HTTP_STR_MATCH, the string that // you want Amazon Route 53 to search for in the response body from the specified - // resource. If the string appears in the response body, Amazon Route 53 considers + // resource. If the string appears in the response body, Route 53 considers // the resource healthy. // - // Amazon Route 53 considers case when searching for SearchString in the response - // body. + // Route 53 considers case when searching for SearchString in the response body. SearchString *string `type:"string"` // The type of health check that you want to create, which indicates how Amazon @@ -10002,28 +10254,24 @@ type HealthCheckConfig struct { // // You can create the following types of health checks: // - // * HTTP: Amazon Route 53 tries to establish a TCP connection. If successful, - // Amazon Route 53 submits an HTTP request and waits for an HTTP status code - // of 200 or greater and less than 400. + // * HTTP: Route 53 tries to establish a TCP connection. If successful, Route + // 53 submits an HTTP request and waits for an HTTP status code of 200 or + // greater and less than 400. // - // * HTTPS: Amazon Route 53 tries to establish a TCP connection. If successful, - // Amazon Route 53 submits an HTTPS request and waits for an HTTP status - // code of 200 or greater and less than 400. + // * HTTPS: Route 53 tries to establish a TCP connection. If successful, + // Route 53 submits an HTTPS request and waits for an HTTP status code of + // 200 or greater and less than 400. If you specify HTTPS for the value of + // Type, the endpoint must support TLS v1.0 or later. // - // If you specify HTTPS for the value of Type, the endpoint must support TLS - // v1.0 or later. + // * HTTP_STR_MATCH: Route 53 tries to establish a TCP connection. If successful, + // Route 53 submits an HTTP request and searches the first 5,120 bytes of + // the response body for the string that you specify in SearchString. // - // * HTTP_STR_MATCH: Amazon Route 53 tries to establish a TCP connection. - // If successful, Amazon Route 53 submits an HTTP request and searches the - // first 5,120 bytes of the response body for the string that you specify - // in SearchString. + // * HTTPS_STR_MATCH: Route 53 tries to establish a TCP connection. If successful, + // Route 53 submits an HTTPS request and searches the first 5,120 bytes of + // the response body for the string that you specify in SearchString. // - // * HTTPS_STR_MATCH: Amazon Route 53 tries to establish a TCP connection. - // If successful, Amazon Route 53 submits an HTTPS request and searches the - // first 5,120 bytes of the response body for the string that you specify - // in SearchString. - // - // * TCP: Amazon Route 53 tries to establish a TCP connection. + // * TCP: Route 53 tries to establish a TCP connection. // // * CLOUDWATCH_METRIC: The health check is associated with a CloudWatch // alarm. If the state of the alarm is OK, the health check is considered @@ -10033,12 +10281,12 @@ type HealthCheckConfig struct { // Healthy, Unhealthy, or LastKnownStatus. // // * CALCULATED: For health checks that monitor the status of other health - // checks, Amazon Route 53 adds up the number of health checks that Amazon - // Route 53 health checkers consider to be healthy and compares that number - // with the value of HealthThreshold. + // checks, Route 53 adds up the number of health checks that Route 53 health + // checkers consider to be healthy and compares that number with the value + // of HealthThreshold. // - // For more information, see How Amazon Route 53 Determines Whether an Endpoint - // Is Healthy (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) + // For more information, see How Route 53 Determines Whether an Endpoint Is + // Healthy (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) // in the Amazon Route 53 Developer Guide. // // Type is a required field @@ -10097,6 +10345,12 @@ func (s *HealthCheckConfig) SetChildHealthChecks(v []*string) *HealthCheckConfig return s } +// SetDisabled sets the Disabled field's value. +func (s *HealthCheckConfig) SetDisabled(v bool) *HealthCheckConfig { + s.Disabled = &v + return s +} + // SetEnableSNI sets the EnableSNI field's value. func (s *HealthCheckConfig) SetEnableSNI(v bool) *HealthCheckConfig { s.EnableSNI = &v @@ -10250,14 +10504,15 @@ type HostedZone struct { // If the hosted zone was created by another service, the service that created // the hosted zone. When a hosted zone is created by another service, you can't - // edit or delete it using Amazon Route 53. + // edit or delete it using Route 53. LinkedService *LinkedService `type:"structure"` // The name of the domain. For public hosted zones, this is the name that you // have registered with your DNS registrar. // // For information about how to specify characters other than a-z, 0-9, and - // - (hyphen) and how to specify internationalized domain names, see CreateHostedZone. + // - (hyphen) and how to specify internationalized domain names, see CreateHostedZone + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateHostedZone.html). // // Name is a required field Name *string `type:"string" required:"true"` @@ -10438,39 +10693,39 @@ type ListGeoLocationsInput struct { _ struct{} `type:"structure"` // (Optional) The maximum number of geolocations to be included in the response - // body for this request. If more than MaxItems geolocations remain to be listed, + // body for this request. If more than maxitems geolocations remain to be listed, // then the value of the IsTruncated element in the response is true. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` // The code for the continent with which you want to start listing locations - // that Amazon Route 53 supports for geolocation. If Amazon Route 53 has already - // returned a page or more of results, if IsTruncated is true, and if NextContinentCode - // from the previous response has a value, enter that value in StartContinentCode + // that Amazon Route 53 supports for geolocation. If Route 53 has already returned + // a page or more of results, if IsTruncated is true, and if NextContinentCode + // from the previous response has a value, enter that value in startcontinentcode // to return the next page of results. // - // Include StartContinentCode only if you want to list continents. Don't include - // StartContinentCode when you're listing countries or countries with their + // Include startcontinentcode only if you want to list continents. Don't include + // startcontinentcode when you're listing countries or countries with their // subdivisions. StartContinentCode *string `location:"querystring" locationName:"startcontinentcode" min:"2" type:"string"` // The code for the country with which you want to start listing locations that - // Amazon Route 53 supports for geolocation. If Amazon Route 53 has already - // returned a page or more of results, if IsTruncated is true, and if NextCountryCode - // from the previous response has a value, enter that value in StartCountryCode + // Amazon Route 53 supports for geolocation. If Route 53 has already returned + // a page or more of results, if IsTruncated is true, and if NextCountryCode + // from the previous response has a value, enter that value in startcountrycode // to return the next page of results. // - // Amazon Route 53 uses the two-letter country codes that are specified in ISO - // standard 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). + // Route 53 uses the two-letter country codes that are specified in ISO standard + // 3166-1 alpha-2 (https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2). StartCountryCode *string `location:"querystring" locationName:"startcountrycode" min:"1" type:"string"` // The code for the subdivision (for example, state or province) with which // you want to start listing locations that Amazon Route 53 supports for geolocation. - // If Amazon Route 53 has already returned a page or more of results, if IsTruncated + // If Route 53 has already returned a page or more of results, if IsTruncated // is true, and if NextSubdivisionCode from the previous response has a value, - // enter that value in StartSubdivisionCode to return the next page of results. + // enter that value in startsubdivisioncode to return the next page of results. // - // To list subdivisions of a country, you must include both StartCountryCode - // and StartSubdivisionCode. + // To list subdivisions of a country, you must include both startcountrycode + // and startsubdivisioncode. StartSubdivisionCode *string `location:"querystring" locationName:"startsubdivisioncode" min:"1" type:"string"` } @@ -10540,8 +10795,8 @@ type ListGeoLocationsOutput struct { // A value that indicates whether more locations remain to be listed after the // last location in this response. If so, the value of IsTruncated is true. // To get more values, submit another request and include the values of NextContinentCode, - // NextCountryCode, and NextSubdivisionCode in the StartContinentCode, StartCountryCode, - // and StartSubdivisionCode, as applicable. + // NextCountryCode, and NextSubdivisionCode in the startcontinentcode, startcountrycode, + // and startsubdivisioncode, as applicable. // // IsTruncated is a required field IsTruncated *bool `type:"boolean" required:"true"` @@ -10552,17 +10807,17 @@ type ListGeoLocationsOutput struct { MaxItems *string `type:"string" required:"true"` // If IsTruncated is true, you can make a follow-up request to display more - // locations. Enter the value of NextContinentCode in the StartContinentCode + // locations. Enter the value of NextContinentCode in the startcontinentcode // parameter in another ListGeoLocations request. NextContinentCode *string `min:"2" type:"string"` // If IsTruncated is true, you can make a follow-up request to display more - // locations. Enter the value of NextCountryCode in the StartCountryCode parameter + // locations. Enter the value of NextCountryCode in the startcountrycode parameter // in another ListGeoLocations request. NextCountryCode *string `min:"1" type:"string"` // If IsTruncated is true, you can make a follow-up request to display more - // locations. Enter the value of NextSubdivisionCode in the StartSubdivisionCode + // locations. Enter the value of NextSubdivisionCode in the startsubdivisioncode // parameter in another ListGeoLocations request. NextSubdivisionCode *string `min:"1" type:"string"` } @@ -10631,8 +10886,8 @@ type ListHealthChecksInput struct { // The maximum number of health checks that you want ListHealthChecks to return // in response to the current request. Amazon Route 53 returns a maximum of - // 100 items. If you set MaxItems to a value greater than 100, Amazon Route - // 53 returns only the first 100 health checks. + // 100 items. If you set MaxItems to a value greater than 100, Route 53 returns + // only the first 100 health checks. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` } @@ -10920,7 +11175,7 @@ type ListHostedZonesInput struct { // (Optional) The maximum number of hosted zones that you want Amazon Route // 53 to return. If you have more than maxitems hosted zones, the value of IsTruncated // in the response is true, and the value of NextMarker is the hosted zone ID - // of the first hosted zone that Amazon Route 53 will return if you submit another + // of the first hosted zone that Route 53 will return if you submit another // request. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` } @@ -11042,11 +11297,11 @@ type ListQueryLoggingConfigsInput struct { // (Optional) The maximum number of query logging configurations that you want // Amazon Route 53 to return in response to the current request. If the current - // AWS account has more than MaxResults configurations, use the value of ListQueryLoggingConfigsResponse$NextToken + // AWS account has more than MaxResults configurations, use the value of NextToken + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html#API_ListQueryLoggingConfigs_RequestSyntax) // in the response to get the next page of results. // - // If you don't specify a value for MaxResults, Amazon Route 53 returns up to - // 100 configurations. + // If you don't specify a value for MaxResults, Route 53 returns up to 100 configurations. MaxResults *string `location:"querystring" locationName:"maxresults" type:"string"` // (Optional) If the current AWS account has more than MaxResults query logging @@ -11095,13 +11350,14 @@ type ListQueryLoggingConfigsOutput struct { // the response. // // If a response doesn't include the last of the configurations, you can get - // more configurations by submitting another ListQueryLoggingConfigs request. - // Get the value of NextToken that Amazon Route 53 returned in the previous - // response and include it in NextToken in the next request. + // more configurations by submitting another ListQueryLoggingConfigs (https://docs.aws.amazon.com/Route53/latest/APIReference/API_ListQueryLoggingConfigs.html) + // request. Get the value of NextToken that Amazon Route 53 returned in the + // previous response and include it in NextToken in the next request. NextToken *string `type:"string"` - // An array that contains one QueryLoggingConfig element for each configuration - // for DNS query logging that is associated with the current AWS account. + // An array that contains one QueryLoggingConfig (https://docs.aws.amazon.com/Route53/latest/APIReference/API_QueryLoggingConfig.html) + // element for each configuration for DNS query logging that is associated with + // the current AWS account. // // QueryLoggingConfigs is a required field QueryLoggingConfigs []*QueryLoggingConfig `locationNameList:"QueryLoggingConfig" type:"list" required:"true"` @@ -11163,19 +11419,23 @@ type ListResourceRecordSetsInput struct { // Valid values for basic resource record sets: A | AAAA | CAA | CNAME | MX // | NAPTR | NS | PTR | SOA | SPF | SRV | TXT // - // Values for weighted, latency, geo, and failover resource record sets: A | - // AAAA | CAA | CNAME | MX | NAPTR | PTR | SPF | SRV | TXT + // Values for weighted, latency, geolocation, and failover resource record sets: + // A | AAAA | CAA | CNAME | MX | NAPTR | PTR | SPF | SRV | TXT // // Values for alias resource record sets: // + // * API Gateway custom regional API or edge-optimized API: A + // // * CloudFront distribution: A or AAAA // // * Elastic Beanstalk environment that has a regionalized subdomain: A // - // * ELB load balancer: A | AAAA + // * Elastic Load Balancing load balancer: A | AAAA // // * Amazon S3 bucket: A // + // * Amazon VPC interface VPC endpoint: A + // // * Another resource record set in this hosted zone: The type of the resource // record set that the alias references. // @@ -11200,6 +11460,9 @@ func (s *ListResourceRecordSetsInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if s.StartRecordIdentifier != nil && len(*s.StartRecordIdentifier) < 1 { invalidParams.Add(request.NewErrParamMinLen("StartRecordIdentifier", 1)) } @@ -11256,9 +11519,12 @@ type ListResourceRecordSetsOutput struct { // MaxItems is a required field MaxItems *string `type:"string" required:"true"` - // Weighted, latency, geolocation, and failover resource record sets only: If - // results were truncated for a given DNS name and type, the value of SetIdentifier + // Resource record sets that have a routing policy other than simple: If results + // were truncated for a given DNS name and type, the value of SetIdentifier // for the next resource record set that has the current DNS name and type. + // + // For information about routing policies, see Choosing a Routing Policy (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html) + // in the Amazon Route 53 Developer Guide. NextRecordIdentifier *string `min:"1" type:"string"` // If the results were truncated, the name of the next record in the list. @@ -11342,7 +11608,7 @@ type ListReusableDelegationSetsInput struct { // The number of reusable delegation sets that you want Amazon Route 53 to return // in the response to this request. If you specify a value greater than 100, - // Amazon Route 53 returns only the first 100 reusable delegation sets. + // Route 53 returns only the first 100 reusable delegation sets. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` } @@ -11480,9 +11746,15 @@ func (s *ListTagsForResourceInput) Validate() error { if s.ResourceId == nil { invalidParams.Add(request.NewErrParamRequired("ResourceId")) } + if s.ResourceId != nil && len(*s.ResourceId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceId", 1)) + } if s.ResourceType == nil { invalidParams.Add(request.NewErrParamRequired("ResourceType")) } + if s.ResourceType != nil && len(*s.ResourceType) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceType", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -11572,6 +11844,9 @@ func (s *ListTagsForResourcesInput) Validate() error { if s.ResourceType == nil { invalidParams.Add(request.NewErrParamRequired("ResourceType")) } + if s.ResourceType != nil && len(*s.ResourceType) < 1 { + invalidParams.Add(request.NewErrParamMinLen("ResourceType", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -11626,7 +11901,7 @@ type ListTrafficPoliciesInput struct { // 53 to return in response to this request. If you have more than MaxItems // traffic policies, the value of IsTruncated in the response is true, and the // value of TrafficPolicyIdMarker is the ID of the first traffic policy that - // Amazon Route 53 will return if you submit another request. + // Route 53 will return if you submit another request. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` // (Conditional) For your first request to ListTrafficPolicies, don't include @@ -12207,8 +12482,8 @@ type ListTrafficPolicyInstancesOutput struct { _ struct{} `type:"structure"` // If IsTruncated is true, HostedZoneIdMarker is the ID of the hosted zone of - // the first traffic policy instance that Amazon Route 53 will return if you - // submit another ListTrafficPolicyInstances request. + // the first traffic policy instance that Route 53 will return if you submit + // another ListTrafficPolicyInstances request. HostedZoneIdMarker *string `type:"string"` // A flag that indicates whether there are more traffic policy instances to @@ -12227,8 +12502,8 @@ type ListTrafficPolicyInstancesOutput struct { MaxItems *string `type:"string" required:"true"` // If IsTruncated is true, TrafficPolicyInstanceNameMarker is the name of the - // first traffic policy instance that Amazon Route 53 will return if you submit - // another ListTrafficPolicyInstances request. + // first traffic policy instance that Route 53 will return if you submit another + // ListTrafficPolicyInstances request. TrafficPolicyInstanceNameMarker *string `type:"string"` // If IsTruncated is true, TrafficPolicyInstanceTypeMarker is the DNS type of @@ -12305,8 +12580,7 @@ type ListTrafficPolicyVersionsInput struct { // 53 to include in the response body for this request. If the specified traffic // policy has more than MaxItems versions, the value of IsTruncated in the response // is true, and the value of the TrafficPolicyVersionMarker element is the ID - // of the first version that Amazon Route 53 will return if you submit another - // request. + // of the first version that Route 53 will return if you submit another request. MaxItems *string `location:"querystring" locationName:"maxitems" type:"string"` // For your first request to ListTrafficPolicyVersions, don't include the TrafficPolicyVersionMarker @@ -12445,8 +12719,8 @@ type ListVPCAssociationAuthorizationsInput struct { HostedZoneId *string `location:"uri" locationName:"Id" type:"string" required:"true"` // Optional: An integer that specifies the maximum number of VPCs that you want - // Amazon Route 53 to return. If you don't specify a value for MaxResults, Amazon - // Route 53 returns up to 50 VPCs per page. + // Amazon Route 53 to return. If you don't specify a value for MaxResults, Route + // 53 returns up to 50 VPCs per page. MaxResults *string `location:"querystring" locationName:"maxresults" type:"string"` // Optional: If a response includes a NextToken element, there are more VPCs @@ -12473,6 +12747,9 @@ func (s *ListVPCAssociationAuthorizationsInput) Validate() error { if s.HostedZoneId == nil { invalidParams.Add(request.NewErrParamRequired("HostedZoneId")) } + if s.HostedZoneId != nil && len(*s.HostedZoneId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HostedZoneId", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -12608,7 +12885,7 @@ type ResourceRecord struct { // The current or new DNS record value, not to exceed 4,000 characters. In the // case of a DELETE action, if the current value does not match the actual value, // an error is returned. For descriptions about how to format Value for different - // record types, see Supported DNS Resource Record Types (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html) + // record types, see Supported DNS Resource Record Types (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/ResourceRecordTypes.html) // in the Amazon Route 53 Developer Guide. // // You can specify more than one value for all record types except CNAME and @@ -12653,16 +12930,15 @@ func (s *ResourceRecord) SetValue(v string) *ResourceRecord { type ResourceRecordSet struct { _ struct{} `type:"structure"` - // Alias resource record sets only: Information about the CloudFront distribution, - // AWS Elastic Beanstalk environment, ELB load balancer, Amazon S3 bucket, or - // Amazon Route 53 resource record set to which you're redirecting queries. - // The AWS Elastic Beanstalk environment must have a regionalized subdomain. + // Alias resource record sets only: Information about the AWS resource, such + // as a CloudFront distribution or an Amazon S3 bucket, that you want to route + // traffic to. // // If you're creating resource records sets for a private hosted zone, note // the following: // - // * You can't create alias resource record sets for CloudFront distributions - // in a private hosted zone. + // * You can't create an alias resource record set in a private hosted zone + // to route traffic to a CloudFront distribution. // // * Creating geolocation alias resource record sets or latency alias resource // record sets in a private hosted zone is unsupported. @@ -12682,23 +12958,22 @@ type ResourceRecordSet struct { // Except where noted, the following failover behaviors assume that you have // included the HealthCheckId element in both resource record sets: // - // * When the primary resource record set is healthy, Amazon Route 53 responds - // to DNS queries with the applicable value from the primary resource record + // * When the primary resource record set is healthy, Route 53 responds to + // DNS queries with the applicable value from the primary resource record // set regardless of the health of the secondary resource record set. // // * When the primary resource record set is unhealthy and the secondary - // resource record set is healthy, Amazon Route 53 responds to DNS queries - // with the applicable value from the secondary resource record set. + // resource record set is healthy, Route 53 responds to DNS queries with + // the applicable value from the secondary resource record set. // - // * When the secondary resource record set is unhealthy, Amazon Route 53 - // responds to DNS queries with the applicable value from the primary resource - // record set regardless of the health of the primary resource record set. + // * When the secondary resource record set is unhealthy, Route 53 responds + // to DNS queries with the applicable value from the primary resource record + // set regardless of the health of the primary resource record set. // // * If you omit the HealthCheckId element for the secondary resource record - // set, and if the primary resource record set is unhealthy, Amazon Route - // 53 always responds to DNS queries with the applicable value from the secondary - // resource record set. This is true regardless of the health of the associated - // endpoint. + // set, and if the primary resource record set is unhealthy, Route 53 always + // responds to DNS queries with the applicable value from the secondary resource + // record set. This is true regardless of the health of the associated endpoint. // // You can't create non-failover resource record sets that have the same values // for the Name and Type elements as failover resource record sets. @@ -12706,15 +12981,15 @@ type ResourceRecordSet struct { // For failover alias resource record sets, you must also include the EvaluateTargetHealth // element and set the value to true. // - // For more information about configuring failover for Amazon Route 53, see - // the following topics in the Amazon Route 53 Developer Guide: + // For more information about configuring failover for Route 53, see the following + // topics in the Amazon Route 53 Developer Guide: // - // * Amazon Route 53 Health Checks and DNS Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html) + // * Route 53 Health Checks and DNS Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html) // // * Configuring Failover in a Private Hosted Zone (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-private-hosted-zones.html) Failover *string `type:"string" enum:"ResourceRecordSetFailover"` - // Geo location resource record sets only: A complex type that lets you control + // Geolocation resource record sets only: A complex type that lets you control // how Amazon Route 53 responds to DNS queries based on the geographic origin // of the query. For example, if you want all queries from Africa to be routed // to a web server with an IP address of 192.0.2.111, create a resource record @@ -12738,24 +13013,24 @@ type ResourceRecordSet struct { // // Geolocation works by mapping IP addresses to locations. However, some IP // addresses aren't mapped to geographic locations, so even if you create geolocation - // resource record sets that cover all seven continents, Amazon Route 53 will - // receive some DNS queries from locations that it can't identify. We recommend - // that you create a resource record set for which the value of CountryCode - // is *, which handles both queries that come from locations for which you haven't + // resource record sets that cover all seven continents, Route 53 will receive + // some DNS queries from locations that it can't identify. We recommend that + // you create a resource record set for which the value of CountryCode is *, + // which handles both queries that come from locations for which you haven't // created geolocation resource record sets and queries from IP addresses that // aren't mapped to a location. If you don't create a * resource record set, - // Amazon Route 53 returns a "no answer" response for queries from those locations. + // Route 53 returns a "no answer" response for queries from those locations. // // You can't create non-geolocation resource record sets that have the same // values for the Name and Type elements as geolocation resource record sets. GeoLocation *GeoLocation `type:"structure"` // If you want Amazon Route 53 to return this resource record set in response - // to a DNS query only when a health check is passing, include the HealthCheckId - // element and specify the ID of the applicable health check. + // to a DNS query only when the status of a health check is healthy, include + // the HealthCheckId element and specify the ID of the applicable health check. // - // Amazon Route 53 determines whether a resource record set is healthy based - // on one of the following: + // Route 53 determines whether a resource record set is healthy based on one + // of the following: // // * By periodically sending a request to the endpoint that is specified // in the health check @@ -12766,61 +13041,88 @@ type ResourceRecordSet struct { // * By determining the current state of a CloudWatch alarm (CloudWatch metric // health checks) // - // For more information, see How Amazon Route 53 Determines Whether an Endpoint - // Is Healthy (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html). - // - // The HealthCheckId element is only useful when Amazon Route 53 is choosing - // between two or more resource record sets to respond to a DNS query, and you - // want Amazon Route 53 to base the choice in part on the status of a health - // check. Configuring health checks only makes sense in the following configurations: - // - // * You're checking the health of the resource record sets in a group of - // weighted, latency, geolocation, or failover resource record sets, and - // you specify health check IDs for all of the resource record sets. If the - // health check for one resource record set specifies an endpoint that is - // not healthy, Amazon Route 53 stops responding to queries using the value - // for that resource record set. - // - // * You set EvaluateTargetHealth to true for the resource record sets in - // a group of alias, weighted alias, latency alias, geolocation alias, or - // failover alias resource record sets, and you specify health check IDs - // for all of the resource record sets that are referenced by the alias resource - // record sets. - // - // Amazon Route 53 doesn't check the health of the endpoint specified in the + // Route 53 doesn't check the health of the endpoint that is specified in the // resource record set, for example, the endpoint specified by the IP address // in the Value element. When you add a HealthCheckId element to a resource - // record set, Amazon Route 53 checks the health of the endpoint that you specified + // record set, Route 53 checks the health of the endpoint that you specified // in the health check. // - // For geolocation resource record sets, if an endpoint is unhealthy, Amazon - // Route 53 looks for a resource record set for the larger, associated geographic + // For more information, see the following topics in the Amazon Route 53 Developer + // Guide: + // + // * How Amazon Route 53 Determines Whether an Endpoint Is Healthy (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-determining-health-of-endpoints.html) + // + // * Route 53 Health Checks and DNS Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html) + // + // * Configuring Failover in a Private Hosted Zone (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-private-hosted-zones.html) + // + // When to Specify HealthCheckId + // + // Specifying a value for HealthCheckId is useful only when Route 53 is choosing + // between two or more resource record sets to respond to a DNS query, and you + // want Route 53 to base the choice in part on the status of a health check. + // Configuring health checks makes sense only in the following configurations: + // + // * Non-alias resource record sets: You're checking the health of a group + // of non-alias resource record sets that have the same routing policy, name, + // and type (such as multiple weighted records named www.example.com with + // a type of A) and you specify health check IDs for all the resource record + // sets. If the health check status for a resource record set is healthy, + // Route 53 includes the record among the records that it responds to DNS + // queries with. If the health check status for a resource record set is + // unhealthy, Route 53 stops responding to DNS queries using the value for + // that resource record set. If the health check status for all resource + // record sets in the group is unhealthy, Route 53 considers all resource + // record sets in the group healthy and responds to DNS queries accordingly. + // + // * Alias resource record sets: You specify the following settings: You + // set EvaluateTargetHealth to true for an alias resource record set in a + // group of resource record sets that have the same routing policy, name, + // and type (such as multiple weighted records named www.example.com with + // a type of A). You configure the alias resource record set to route traffic + // to a non-alias resource record set in the same hosted zone. You specify + // a health check ID for the non-alias resource record set. If the health + // check status is healthy, Route 53 considers the alias resource record + // set to be healthy and includes the alias record among the records that + // it responds to DNS queries with. If the health check status is unhealthy, + // Route 53 stops responding to DNS queries using the alias resource record + // set. The alias resource record set can also route traffic to a group of + // non-alias resource record sets that have the same routing policy, name, + // and type. In that configuration, associate health checks with all of the + // resource record sets in the group of non-alias resource record sets. + // + // Geolocation Routing + // + // For geolocation resource record sets, if an endpoint is unhealthy, Route + // 53 looks for a resource record set for the larger, associated geographic // region. For example, suppose you have resource record sets for a state in - // the United States, for the United States, for North America, and for all + // the United States, for the entire United States, for North America, and a + // resource record set that has * for CountryCode is *, which applies to all // locations. If the endpoint for the state resource record set is unhealthy, - // Amazon Route 53 checks the resource record sets for the United States, for - // North America, and for all locations (a resource record set for which the - // value of CountryCode is *), in that order, until it finds a resource record - // set for which the endpoint is healthy. + // Route 53 checks for healthy resource record sets in the following order until + // it finds a resource record set for which the endpoint is healthy: + // + // * The United States + // + // * North America + // + // * The default resource record set + // + // Specifying the Health Check Endpoint by Domain Name // // If your health checks specify the endpoint only by domain name, we recommend // that you create a separate health check for each endpoint. For example, create // a health check for each HTTP server that is serving content for www.example.com. // For the value of FullyQualifiedDomainName, specify the domain name of the // server (such as us-east-2-www.example.com), not the name of the resource - // record sets (example.com). + // record sets (www.example.com). // - // n this configuration, if you create a health check for which the value of - // FullyQualifiedDomainName matches the name of the resource record sets and - // then associate the health check with those resource record sets, health check - // results will be unpredictable. + // Health check results will be unpredictable if you do the following: // - // For more information, see the following topics in the Amazon Route 53 Developer - // Guide: + // * Create a health check that has the same value for FullyQualifiedDomainName + // as the name of a resource record set. // - // * Amazon Route 53 Health Checks and DNS Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover.html) - // - // * Configuring Failover in a Private Hosted Zone (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-private-hosted-zones.html) + // * Associate that health check with the resource record set. HealthCheckId *string `type:"string"` // Multivalue answer resource record sets only: To route traffic approximately @@ -12833,17 +13135,17 @@ type ResourceRecordSet struct { // address only when the health check is healthy. // // * If you don't associate a health check with a multivalue answer record, - // Amazon Route 53 always considers the record to be healthy. + // Route 53 always considers the record to be healthy. // - // * Amazon Route 53 responds to DNS queries with up to eight healthy records; - // if you have eight or fewer healthy records, Amazon Route 53 responds to - // all DNS queries with all the healthy records. + // * Route 53 responds to DNS queries with up to eight healthy records; if + // you have eight or fewer healthy records, Route 53 responds to all DNS + // queries with all the healthy records. // - // * If you have more than eight healthy records, Amazon Route 53 responds - // to different DNS resolvers with different combinations of healthy records. + // * If you have more than eight healthy records, Route 53 responds to different + // DNS resolvers with different combinations of healthy records. // - // * When all records are unhealthy, Amazon Route 53 responds to DNS queries - // with up to eight unhealthy records. + // * When all records are unhealthy, Route 53 responds to DNS queries with + // up to eight unhealthy records. // // * If a resource becomes unavailable after a resolver caches a response, // client software typically tries another of the IP addresses in the response. @@ -12851,13 +13153,17 @@ type ResourceRecordSet struct { // You can't create multivalue answer alias records. MultiValueAnswer *bool `type:"boolean"` - // The name of the domain you want to perform the action on. + // For ChangeResourceRecordSets requests, the name of the record that you want + // to create, update, or delete. For ListResourceRecordSets responses, the name + // of a record in the specified hosted zone. + // + // ChangeResourceRecordSets Only // // Enter a fully qualified domain name, for example, www.example.com. You can // optionally include a trailing dot. If you omit the trailing dot, Amazon Route - // 53 still assumes that the domain name that you specify is fully qualified. - // This means that Amazon Route 53 treats www.example.com (without a trailing - // dot) and www.example.com. (with a trailing dot) as identical. + // 53 assumes that the domain name that you specify is fully qualified. This + // means that Route 53 treats www.example.com (without a trailing dot) and www.example.com. + // (with a trailing dot) as identical. // // For information about how to specify characters other than a-z, 0-9, and // - (hyphen) and how to specify internationalized domain names, see DNS Domain @@ -12874,9 +13180,8 @@ type ResourceRecordSet struct { // // * If you include * in any position other than the leftmost label in a // domain name, DNS treats it as an * character (ASCII 42), not as a wildcard. - // - // You can't use the * wildcard for resource records sets that have a type of - // NS. + // You can't use the * wildcard for resource records sets that have a type + // of NS. // // You can use the * wildcard as the leftmost label in a domain name, for example, // *.example.com. You can't use an * for one of the middle labels, for example, @@ -12896,10 +13201,10 @@ type ResourceRecordSet struct { // zones is not supported. // // When Amazon Route 53 receives a DNS query for a domain name and type for - // which you have created latency resource record sets, Amazon Route 53 selects - // the latency resource record set that has the lowest latency between the end - // user and the associated Amazon EC2 Region. Amazon Route 53 then returns the - // value that is associated with the selected resource record set. + // which you have created latency resource record sets, Route 53 selects the + // latency resource record set that has the lowest latency between the end user + // and the associated Amazon EC2 Region. Route 53 then returns the value that + // is associated with the selected resource record set. // // Note the following: // @@ -12910,8 +13215,8 @@ type ResourceRecordSet struct { // EC2 Region. // // * You aren't required to create latency resource record sets for all Amazon - // EC2 Regions. Amazon Route 53 will choose the region with the best latency - // from among the regions that you create latency resource record sets for. + // EC2 Regions. Route 53 will choose the region with the best latency from + // among the regions that you create latency resource record sets for. // // * You can't create non-latency resource record sets that have the same // values for the Name and Type elements as latency resource record sets. @@ -12922,11 +13227,15 @@ type ResourceRecordSet struct { // If you're creating an alias resource record set, omit ResourceRecords. ResourceRecords []*ResourceRecord `locationNameList:"ResourceRecord" min:"1" type:"list"` - // Weighted, Latency, Geo, and Failover resource record sets only: An identifier + // Resource record sets that have a routing policy other than simple: An identifier // that differentiates among multiple resource record sets that have the same - // combination of DNS name and type. The value of SetIdentifier must be unique - // for each resource record set that has the same combination of DNS name and - // type. Omit SetIdentifier for any other types of record sets. + // combination of name and type, such as multiple weighted resource record sets + // named acme.example.com that have a type of A. In a group of resource record + // sets that have the same name and type, the value of SetIdentifier must be + // unique for each resource record set. + // + // For information about routing policies, see Choosing a Routing Policy (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/routing-policy.html) + // in the Amazon Route 53 Developer Guide. SetIdentifier *string `min:"1" type:"string"` // The resource record cache time to live (TTL), in seconds. Note the following: @@ -12952,14 +13261,14 @@ type ResourceRecordSet struct { // When you create a traffic policy instance, Amazon Route 53 automatically // creates a resource record set. TrafficPolicyInstanceId is the ID of the traffic - // policy instance that Amazon Route 53 created this resource record set for. + // policy instance that Route 53 created this resource record set for. // // To delete the resource record set that is associated with a traffic policy - // instance, use DeleteTrafficPolicyInstance. Amazon Route 53 will delete the - // resource record set automatically. If you delete the resource record set - // by using ChangeResourceRecordSets, Amazon Route 53 doesn't automatically - // delete the traffic policy instance, and you'll continue to be charged for - // it even though it's no longer in use. + // instance, use DeleteTrafficPolicyInstance. Route 53 will delete the resource + // record set automatically. If you delete the resource record set by using + // ChangeResourceRecordSets, Route 53 doesn't automatically delete the traffic + // policy instance, and you'll continue to be charged for it even though it's + // no longer in use. TrafficPolicyInstanceId *string `min:"1" type:"string"` // The DNS record type. For information about different record types and how @@ -12988,22 +13297,29 @@ type ResourceRecordSet struct { // // Values for alias resource record sets: // - // * CloudFront distributions:A + // * Amazon API Gateway custom regional APIs and edge-optimized APIs: A // - // If IPv6 is enabled for the distribution, create two resource record sets - // to route traffic to your distribution, one with a value of A and one with - // a value of AAAA. + // * CloudFront distributions: A If IPv6 is enabled for the distribution, + // create two resource record sets to route traffic to your distribution, + // one with a value of A and one with a value of AAAA. // // * AWS Elastic Beanstalk environment that has a regionalized subdomain: // A // - // * ELB load balancers:A | AAAA + // * ELB load balancers: A | AAAA // - // * Amazon S3 buckets:A + // * Amazon S3 buckets: A + // + // * Amazon Virtual Private Cloud interface VPC endpoints A // // * Another resource record set in this hosted zone: Specify the type of // the resource record set that you're creating the alias for. All values - // are supported except NS and SOA. + // are supported except NS and SOA. If you're creating an alias record that + // has the same name as the hosted zone (known as the zone apex), you can't + // route traffic to a record for which the value of Type is CNAME. This is + // because the alias record must have the same type as the record you're + // routing traffic to, and creating a CNAME record for the zone apex isn't + // supported even for an alias record. // // Type is a required field Type *string `type:"string" required:"true" enum:"RRType"` @@ -13011,10 +13327,10 @@ type ResourceRecordSet struct { // Weighted resource record sets only: Among resource record sets that have // the same combination of DNS name and type, a value that determines the proportion // of DNS queries that Amazon Route 53 responds to using the current resource - // record set. Amazon Route 53 calculates the sum of the weights for the resource - // record sets that have the same combination of DNS name and type. Amazon Route - // 53 then responds to queries based on the ratio of a resource's weight to - // the total. Note the following: + // record set. Route 53 calculates the sum of the weights for the resource record + // sets that have the same combination of DNS name and type. Route 53 then responds + // to queries based on the ratio of a resource's weight to the total. Note the + // following: // // * You must specify a value for the Weight element for every weighted resource // record set. @@ -13030,16 +13346,13 @@ type ResourceRecordSet struct { // the same values for the Name and Type elements. // // * For weighted (but not weighted alias) resource record sets, if you set - // Weight to 0 for a resource record set, Amazon Route 53 never responds - // to queries with the applicable value for that resource record set. However, - // if you set Weight to 0 for all resource record sets that have the same - // combination of DNS name and type, traffic is routed to all resources with - // equal probability. - // - // The effect of setting Weight to 0 is different when you associate health + // Weight to 0 for a resource record set, Route 53 never responds to queries + // with the applicable value for that resource record set. However, if you + // set Weight to 0 for all resource record sets that have the same combination + // of DNS name and type, traffic is routed to all resources with equal probability. + // The effect of setting Weight to 0 is different when you associate health // checks with weighted resource record sets. For more information, see Options - // for Configuring Amazon Route 53 Active-Active and Active-Passive Failover - // (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-configuring-options.html) + // for Configuring Route 53 Active-Active and Active-Passive Failover (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/dns-failover-configuring-options.html) // in the Amazon Route 53 Developer Guide. Weight *int64 `type:"long"` } @@ -13317,7 +13630,7 @@ type Tag struct { // * Edit a tag: Key is the name of the tag that you want to change the Value // for. // - // * Delete a key: Key is the name of the tag you want to remove. + // * Delete a key: Key is the name of the tag you want to remove. // // * Give a name to a health check: Edit the default Name tag. In the Amazon // Route 53 console, the list of your health checks includes a Name column @@ -13372,6 +13685,13 @@ type TestDNSAnswerInput struct { // and 24 for edns0clientsubnetmask, the checking tool will simulate a request // from 192.0.2.0/24. The default value is 24 bits for IPv4 addresses and 64 // bits for IPv6 addresses. + // + // The range of valid values depends on whether edns0clientsubnetip is an IPv4 + // or an IPv6 address: + // + // * IPv4: Specify a value between 0 and 32 + // + // * IPv6: Specify a value between 0 and 128 EDNS0ClientSubnetMask *string `location:"querystring" locationName:"edns0clientsubnetmask" type:"string"` // The ID of the hosted zone that you want Amazon Route 53 to simulate a query @@ -13559,7 +13879,7 @@ type TrafficPolicy struct { // The definition of a traffic policy in JSON format. You specify the JSON document // to use for a new traffic policy in the CreateTrafficPolicy request. For more - // information about the JSON format, see Traffic Policy Document Format (http://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html). + // information about the JSON format, see Traffic Policy Document Format (https://docs.aws.amazon.com/Route53/latest/APIReference/api-policies-traffic-policy-document-format.html). // // Document is a required field Document *string `type:"string" required:"true"` @@ -13664,15 +13984,21 @@ type TrafficPolicyInstance struct { // The value of State is one of the following values: // - // AppliedAmazon Route 53 has finished creating resource record sets, and changes - // have propagated to all Amazon Route 53 edge locations. + // Applied // - // CreatingAmazon Route 53 is creating the resource record sets. Use GetTrafficPolicyInstance + // Amazon Route 53 has finished creating resource record sets, and changes have + // propagated to all Route 53 edge locations. + // + // Creating + // + // Route 53 is creating the resource record sets. Use GetTrafficPolicyInstance // to confirm that the CreateTrafficPolicyInstance request completed successfully. // - // FailedAmazon Route 53 wasn't able to create or update the resource record - // sets. When the value of State is Failed, see Message for an explanation of - // what caused the request to fail. + // Failed + // + // Route 53 wasn't able to create or update the resource record sets. When the + // value of State is Failed, see Message for an explanation of what caused the + // request to fail. // // State is a required field State *string `type:"string" required:"true"` @@ -13845,14 +14171,35 @@ type UpdateHealthCheckInput struct { _ struct{} `locationName:"UpdateHealthCheckRequest" type:"structure" xmlURI:"https://route53.amazonaws.com/doc/2013-04-01/"` // A complex type that identifies the CloudWatch alarm that you want Amazon - // Route 53 health checkers to use to determine whether this health check is - // healthy. + // Route 53 health checkers to use to determine whether the specified health + // check is healthy. AlarmIdentifier *AlarmIdentifier `type:"structure"` // A complex type that contains one ChildHealthCheck element for each health // check that you want to associate with a CALCULATED health check. ChildHealthChecks []*string `locationNameList:"ChildHealthCheck" type:"list"` + // Stops Route 53 from performing health checks. When you disable a health check, + // here's what happens: + // + // * Health checks that check the health of endpoints: Route 53 stops submitting + // requests to your application, server, or other resource. + // + // * Calculated health checks: Route 53 stops aggregating the status of the + // referenced health checks. + // + // * Health checks that monitor CloudWatch alarms: Route 53 stops monitoring + // the corresponding CloudWatch metrics. + // + // After you disable a health check, Route 53 considers the status of the health + // check to always be healthy. If you configured DNS failover, Route 53 continues + // to route traffic to the corresponding resources. If you want to stop routing + // traffic to a resource, change the value of Inverted (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-Inverted). + // + // Charges for a health check still apply when the health check is disabled. + // For more information, see Amazon Route 53 Pricing (http://aws.amazon.com/route53/pricing/). + Disabled *bool `type:"boolean"` + // Specify whether you want Amazon Route 53 to send the value of FullyQualifiedDomainName // to the endpoint in the client_hello message during TLS negotiation. This // allows the endpoint to respond to HTTPS health check requests with the applicable @@ -13891,44 +14238,42 @@ type UpdateHealthCheckInput struct { // However, you can't update an existing health check to add or remove the value // of IPAddress. // - // If you specify a value forIPAddress: + // If you specify a value for IPAddress: // - // Amazon Route 53 sends health check requests to the specified IPv4 or IPv6 - // address and passes the value of FullyQualifiedDomainName in the Host header - // for all health checks except TCP health checks. This is typically the fully - // qualified DNS name of the endpoint on which you want Amazon Route 53 to perform - // health checks. + // Route 53 sends health check requests to the specified IPv4 or IPv6 address + // and passes the value of FullyQualifiedDomainName in the Host header for all + // health checks except TCP health checks. This is typically the fully qualified + // DNS name of the endpoint on which you want Route 53 to perform health checks. // - // When Amazon Route 53 checks the health of an endpoint, here is how it constructs + // When Route 53 checks the health of an endpoint, here is how it constructs // the Host header: // // * If you specify a value of 80 for Port and HTTP or HTTP_STR_MATCH for - // Type, Amazon Route 53 passes the value of FullyQualifiedDomainName to - // the endpoint in the Host header. + // Type, Route 53 passes the value of FullyQualifiedDomainName to the endpoint + // in the Host header. // // * If you specify a value of 443 for Port and HTTPS or HTTPS_STR_MATCH - // for Type, Amazon Route 53 passes the value of FullyQualifiedDomainName - // to the endpoint in the Host header. + // for Type, Route 53 passes the value of FullyQualifiedDomainName to the + // endpoint in the Host header. // // * If you specify another value for Port and any value except TCP for Type, - // Amazon Route 53 passes FullyQualifiedDomainName:Port to the endpoint in - // the Host header. + // Route 53 passes FullyQualifiedDomainName:Port to the endpoint in the Host + // header. // - // If you don't specify a value for FullyQualifiedDomainName, Amazon Route 53 - // substitutes the value of IPAddress in the Host header in each of the above - // cases. + // If you don't specify a value for FullyQualifiedDomainName, Route 53 substitutes + // the value of IPAddress in the Host header in each of the above cases. // - // If you don't specify a value forIPAddress: + // If you don't specify a value for IPAddress: // - // If you don't specify a value for IPAddress, Amazon Route 53 sends a DNS request + // If you don't specify a value for IPAddress, Route 53 sends a DNS request // to the domain that you specify in FullyQualifiedDomainName at the interval // you specify in RequestInterval. Using an IPv4 address that is returned by - // DNS, Amazon Route 53 then checks the health of the endpoint. + // DNS, Route 53 then checks the health of the endpoint. // - // If you don't specify a value for IPAddress, Amazon Route 53 uses only IPv4 - // to send health checks to the endpoint. If there's no resource record set - // with a type of A for the name that you specify for FullyQualifiedDomainName, - // the health check fails with a "DNS resolution failed" error. + // If you don't specify a value for IPAddress, Route 53 uses only IPv4 to send + // health checks to the endpoint. If there's no resource record set with a type + // of A for the name that you specify for FullyQualifiedDomainName, the health + // check fails with a "DNS resolution failed" error. // // If you want to check the health of weighted, latency, or failover resource // record sets and you choose to specify the endpoint only by FullyQualifiedDomainName, @@ -13943,9 +14288,9 @@ type UpdateHealthCheckInput struct { // with those resource record sets, health check results will be unpredictable. // // In addition, if the value of Type is HTTP, HTTPS, HTTP_STR_MATCH, or HTTPS_STR_MATCH, - // Amazon Route 53 passes the value of FullyQualifiedDomainName in the Host - // header, as it does when you specify a value for IPAddress. If the value of - // Type is TCP, Amazon Route 53 doesn't pass a Host header. + // Route 53 passes the value of FullyQualifiedDomainName in the Host header, + // as it does when you specify a value for IPAddress. If the value of Type is + // TCP, Route 53 doesn't pass a Host header. FullyQualifiedDomainName *string `type:"string"` // The ID for the health check for which you want detailed information. When @@ -13961,15 +14306,14 @@ type UpdateHealthCheckInput struct { // We recommend that you use GetHealthCheck or ListHealthChecks to get the current // value of HealthCheckVersion for the health check that you want to update, // and that you include that value in your UpdateHealthCheck request. This prevents - // Amazon Route 53 from overwriting an intervening update: + // Route 53 from overwriting an intervening update: // // * If the value in the UpdateHealthCheck request matches the value of HealthCheckVersion - // in the health check, Amazon Route 53 updates the health check with the - // new settings. + // in the health check, Route 53 updates the health check with the new settings. // // * If the value of HealthCheckVersion in the health check is greater, the - // health check was changed after you got the version number. Amazon Route - // 53 does not update the health check, and it returns a HealthCheckVersionMismatch + // health check was changed after you got the version number. Route 53 does + // not update the health check, and it returns a HealthCheckVersionMismatch // error. HealthCheckVersion *int64 `min:"1" type:"long"` @@ -13982,18 +14326,18 @@ type UpdateHealthCheckInput struct { // Note the following: // // * If you specify a number greater than the number of child health checks, - // Amazon Route 53 always considers this health check to be unhealthy. + // Route 53 always considers this health check to be unhealthy. // - // * If you specify 0, Amazon Route 53 always considers this health check - // to be healthy. + // * If you specify 0, Route 53 always considers this health check to be + // healthy. HealthThreshold *int64 `type:"integer"` // The IPv4 or IPv6 IP address for the endpoint that you want Amazon Route 53 // to perform health checks on. If you don't specify a value for IPAddress, - // Amazon Route 53 sends a DNS request to resolve the domain name that you specify + // Route 53 sends a DNS request to resolve the domain name that you specify // in FullyQualifiedDomainName at the interval that you specify in RequestInterval. - // Using an IP address that is returned by DNS, Amazon Route 53 then checks - // the health of the endpoint. + // Using an IP address that is returned by DNS, Route 53 then checks the health + // of the endpoint. // // Use one of the following formats for the value of IPAddress: // @@ -14010,21 +14354,21 @@ type UpdateHealthCheckInput struct { // IP address for IPAddress. This ensures that the IP address of your instance // never changes. For more information, see the applicable documentation: // - // * Linux: Elastic IP Addresses (EIP) (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) + // * Linux: Elastic IP Addresses (EIP) (https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/elastic-ip-addresses-eip.html) // in the Amazon EC2 User Guide for Linux Instances // - // * Windows: Elastic IP Addresses (EIP) (http://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-ip-addresses-eip.html) + // * Windows: Elastic IP Addresses (EIP) (https://docs.aws.amazon.com/AWSEC2/latest/WindowsGuide/elastic-ip-addresses-eip.html) // in the Amazon EC2 User Guide for Windows Instances // // If a health check already has a value for IPAddress, you can change the value. // However, you can't update an existing health check to add or remove the value // of IPAddress. // - // For more information, see UpdateHealthCheckRequest$FullyQualifiedDomainName. + // For more information, see FullyQualifiedDomainName (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-FullyQualifiedDomainName). // - // Constraints: Amazon Route 53 can't check the health of endpoints for which - // the IP address is in local, private, non-routable, or multicast ranges. For - // more information about IP addresses for which you can't create health checks, + // Constraints: Route 53 can't check the health of endpoints for which the IP + // address is in local, private, non-routable, or multicast ranges. For more + // information about IP addresses for which you can't create health checks, // see the following documents: // // * RFC 5735, Special Use IPv4 Addresses (https://tools.ietf.org/html/rfc5735) @@ -14037,14 +14381,14 @@ type UpdateHealthCheckInput struct { // When CloudWatch has insufficient data about the metric to determine the alarm // state, the status that you want Amazon Route 53 to assign to the health check: // - // * Healthy: Amazon Route 53 considers the health check to be healthy. + // * Healthy: Route 53 considers the health check to be healthy. // - // * Unhealthy: Amazon Route 53 considers the health check to be unhealthy. + // * Unhealthy: Route 53 considers the health check to be unhealthy. // - // * LastKnownStatus: Amazon Route 53 uses the status of the health check - // from the last time CloudWatch had sufficient data to determine the alarm - // state. For new health checks that have no last known status, the default - // status for the health check is healthy. + // * LastKnownStatus: Route 53 uses the status of the health check from the + // last time CloudWatch had sufficient data to determine the alarm state. + // For new health checks that have no last known status, the default status + // for the health check is healthy. InsufficientDataHealthStatus *string `type:"string" enum:"InsufficientDataHealthStatus"` // Specify whether you want Amazon Route 53 to invert the status of a health @@ -14064,30 +14408,31 @@ type UpdateHealthCheckInput struct { // that you want to reset to the default value. Valid values for ResettableElementName // include the following: // - // * ChildHealthChecks: Amazon Route 53 resets HealthCheckConfig$ChildHealthChecks + // * ChildHealthChecks: Amazon Route 53 resets ChildHealthChecks (https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-ChildHealthChecks) // to null. // - // * FullyQualifiedDomainName: Amazon Route 53 resets HealthCheckConfig$FullyQualifiedDomainName + // * FullyQualifiedDomainName: Route 53 resets FullyQualifiedDomainName (https://docs.aws.amazon.com/Route53/latest/APIReference/API_UpdateHealthCheck.html#Route53-UpdateHealthCheck-request-FullyQualifiedDomainName). // to null. // - // * Regions: Amazon Route 53 resets the HealthCheckConfig$Regions list to - // the default set of regions. + // * Regions: Route 53 resets the Regions (https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-Regions) + // list to the default set of regions. // - // * ResourcePath: Amazon Route 53 resets HealthCheckConfig$ResourcePath + // * ResourcePath: Route 53 resets ResourcePath (https://docs.aws.amazon.com/Route53/latest/APIReference/API_HealthCheckConfig.html#Route53-Type-HealthCheckConfig-ResourcePath) // to null. ResetElements []*string `locationNameList:"ResettableElementName" type:"list"` // The path that you want Amazon Route 53 to request when performing health // checks. The path can be any value for which your endpoint will return an // HTTP status code of 2xx or 3xx when the endpoint is healthy, for example - // the file /docs/route53-health-check.html. + // the file /docs/route53-health-check.html. You can also include query string + // parameters, for example, /welcome.html?language=jp&login=y. // // Specify this value only if you want to change it. ResourcePath *string `type:"string"` // If the value of Type is HTTP_STR_MATCH or HTTP_STR_MATCH, the string that // you want Amazon Route 53 to search for in the response body from the specified - // resource. If the string appears in the response body, Amazon Route 53 considers + // resource. If the string appears in the response body, Route 53 considers // the resource healthy. (You can't change the value of Type when you update // a health check.) SearchString *string `type:"string"` @@ -14112,6 +14457,9 @@ func (s *UpdateHealthCheckInput) Validate() error { if s.HealthCheckId == nil { invalidParams.Add(request.NewErrParamRequired("HealthCheckId")) } + if s.HealthCheckId != nil && len(*s.HealthCheckId) < 1 { + invalidParams.Add(request.NewErrParamMinLen("HealthCheckId", 1)) + } if s.HealthCheckVersion != nil && *s.HealthCheckVersion < 1 { invalidParams.Add(request.NewErrParamMinValue("HealthCheckVersion", 1)) } @@ -14145,6 +14493,12 @@ func (s *UpdateHealthCheckInput) SetChildHealthChecks(v []*string) *UpdateHealth return s } +// SetDisabled sets the Disabled field's value. +func (s *UpdateHealthCheckInput) SetDisabled(v bool) *UpdateHealthCheckInput { + s.Disabled = &v + return s +} + // SetEnableSNI sets the EnableSNI field's value. func (s *UpdateHealthCheckInput) SetEnableSNI(v bool) *UpdateHealthCheckInput { s.EnableSNI = &v @@ -14229,11 +14583,11 @@ func (s *UpdateHealthCheckInput) SetSearchString(v string) *UpdateHealthCheckInp return s } +// A complex type that contains the response to the UpdateHealthCheck request. type UpdateHealthCheckOutput struct { _ struct{} `type:"structure"` - // A complex type that contains information about one health check that is associated - // with the current AWS account. + // A complex type that contains the response to an UpdateHealthCheck request. // // HealthCheck is a required field HealthCheck *HealthCheck `type:"structure" required:"true"` @@ -14285,6 +14639,9 @@ func (s *UpdateHostedZoneCommentInput) Validate() error { if s.Id == nil { invalidParams.Add(request.NewErrParamRequired("Id")) } + if s.Id != nil && len(*s.Id) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Id", 1)) + } if invalidParams.Len() > 0 { return invalidParams @@ -14309,7 +14666,8 @@ func (s *UpdateHostedZoneCommentInput) SetId(v string) *UpdateHostedZoneCommentI type UpdateHostedZoneCommentOutput struct { _ struct{} `type:"structure"` - // A complex type that contains general information about the hosted zone. + // A complex type that contains the response to the UpdateHostedZoneComment + // request. // // HostedZone is a required field HostedZone *HostedZone `type:"structure" required:"true"` @@ -14562,7 +14920,7 @@ type VPC struct { // (Private hosted zones only) The ID of an Amazon VPC. VPCId *string `type:"string"` - // (Private hosted zones only) The region in which you created an Amazon VPC. + // (Private hosted zones only) The region that an Amazon VPC was created in. VPCRegion *string `min:"1" type:"string" enum:"VPCRegion"` } @@ -14665,6 +15023,9 @@ const ( // CloudWatchRegionEuWest3 is a CloudWatchRegion enum value CloudWatchRegionEuWest3 = "eu-west-3" + // CloudWatchRegionApEast1 is a CloudWatchRegion enum value + CloudWatchRegionApEast1 = "ap-east-1" + // CloudWatchRegionApSouth1 is a CloudWatchRegion enum value CloudWatchRegionApSouth1 = "ap-south-1" @@ -14683,8 +15044,17 @@ const ( // CloudWatchRegionApNortheast3 is a CloudWatchRegion enum value CloudWatchRegionApNortheast3 = "ap-northeast-3" + // CloudWatchRegionEuNorth1 is a CloudWatchRegion enum value + CloudWatchRegionEuNorth1 = "eu-north-1" + // CloudWatchRegionSaEast1 is a CloudWatchRegion enum value CloudWatchRegionSaEast1 = "sa-east-1" + + // CloudWatchRegionCnNorthwest1 is a CloudWatchRegion enum value + CloudWatchRegionCnNorthwest1 = "cn-northwest-1" + + // CloudWatchRegionCnNorth1 is a CloudWatchRegion enum value + CloudWatchRegionCnNorth1 = "cn-north-1" ) const ( @@ -14872,6 +15242,9 @@ const ( // ResourceRecordSetRegionApNortheast3 is a ResourceRecordSetRegion enum value ResourceRecordSetRegionApNortheast3 = "ap-northeast-3" + // ResourceRecordSetRegionEuNorth1 is a ResourceRecordSetRegion enum value + ResourceRecordSetRegionEuNorth1 = "eu-north-1" + // ResourceRecordSetRegionSaEast1 is a ResourceRecordSetRegion enum value ResourceRecordSetRegionSaEast1 = "sa-east-1" @@ -14881,6 +15254,9 @@ const ( // ResourceRecordSetRegionCnNorthwest1 is a ResourceRecordSetRegion enum value ResourceRecordSetRegionCnNorthwest1 = "cn-northwest-1" + // ResourceRecordSetRegionApEast1 is a ResourceRecordSetRegion enum value + ResourceRecordSetRegionApEast1 = "ap-east-1" + // ResourceRecordSetRegionApSouth1 is a ResourceRecordSetRegion enum value ResourceRecordSetRegionApSouth1 = "ap-south-1" ) @@ -14940,6 +15316,9 @@ const ( // VPCRegionEuCentral1 is a VPCRegion enum value VPCRegionEuCentral1 = "eu-central-1" + // VPCRegionApEast1 is a VPCRegion enum value + VPCRegionApEast1 = "ap-east-1" + // VPCRegionApSoutheast1 is a VPCRegion enum value VPCRegionApSoutheast1 = "ap-southeast-1" @@ -14958,6 +15337,9 @@ const ( // VPCRegionApNortheast3 is a VPCRegion enum value VPCRegionApNortheast3 = "ap-northeast-3" + // VPCRegionEuNorth1 is a VPCRegion enum value + VPCRegionEuNorth1 = "eu-north-1" + // VPCRegionSaEast1 is a VPCRegion enum value VPCRegionSaEast1 = "sa-east-1" diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/route53/customizations.go index efe2d6e7..7aca8722 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/customizations.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/customizations.go @@ -33,7 +33,7 @@ func sanitizeURL(r *request.Request) { // Update Path so that it reflects the cleaned RawPath updated, err := url.Parse(r.HTTPRequest.URL.RawPath) if err != nil { - r.Error = awserr.New("SerializationError", "failed to clean Route53 URL", err) + r.Error = awserr.New(request.ErrCodeSerialization, "failed to clean Route53 URL", err) return } diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/doc.go b/vendor/github.com/aws/aws-sdk-go/service/route53/doc.go index 7965fea6..386f616d 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/doc.go @@ -3,6 +3,9 @@ // Package route53 provides the client and types for making API // requests to Amazon Route 53. // +// Amazon Route 53 is a highly available and scalable Domain Name System (DNS) +// web service. +// // See https://docs.aws.amazon.com/goto/WebAPI/route53-2013-04-01 for more information on this service. // // See route53 package documentation for more information. diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go b/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go index d37e10cd..ce86bd61 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/errors.go @@ -23,7 +23,7 @@ const ( // the same name as an existing hosted zone or that's the parent or child // of an existing hosted zone, and you specified a delegation set that shares // one or more name servers with the existing hosted zone. For more information, - // see CreateReusableDelegationSet. + // see CreateReusableDelegationSet (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateReusableDelegationSet.html). // // * Private hosted zone: You specified an Amazon VPC that you're already // using for another hosted zone, and the domain that you specified for one @@ -66,8 +66,8 @@ const ( // You can create a hosted zone that has the same name as an existing hosted // zone (example.com is common), but there is a limit to the number of hosted // zones that have the same name. If you get this error, Amazon Route 53 has - // reached that limit. If you own the domain name and Amazon Route 53 generates - // this error, contact Customer Support. + // reached that limit. If you own the domain name and Route 53 generates this + // error, contact Customer Support. ErrCodeDelegationSetNotAvailable = "DelegationSetNotAvailable" // ErrCodeDelegationSetNotReusable for service response error code @@ -212,8 +212,9 @@ const ( // reached the limit on reusable delegation sets that it can create or because // you've reached the limit on the number of Amazon VPCs that you can associate // with a private hosted zone. To get the current limit on the number of reusable - // delegation sets, see GetAccountLimit. To get the current limit on the number - // of Amazon VPCs that you can associate with a private hosted zone, see GetHostedZoneLimit. + // delegation sets, see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). + // To get the current limit on the number of Amazon VPCs that you can associate + // with a private hosted zone, see GetHostedZoneLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetHostedZoneLimit.html). // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. ErrCodeLimitsExceeded = "LimitsExceeded" @@ -239,14 +240,13 @@ const ( // ErrCodeNoSuchGeoLocation for service response error code // "NoSuchGeoLocation". // - // Amazon Route 53 doesn't support the specified geolocation. + // Amazon Route 53 doesn't support the specified geographic location. ErrCodeNoSuchGeoLocation = "NoSuchGeoLocation" // ErrCodeNoSuchHealthCheck for service response error code // "NoSuchHealthCheck". // - // No health check exists with the ID that you specified in the DeleteHealthCheck - // request. + // No health check exists with the specified ID. ErrCodeNoSuchHealthCheck = "NoSuchHealthCheck" // ErrCodeNoSuchHostedZone for service response error code @@ -285,8 +285,8 @@ const ( // // If Amazon Route 53 can't process a request before the next request arrives, // it will reject subsequent requests for the same hosted zone and return an - // HTTP 400 error (Bad request). If Amazon Route 53 returns this error repeatedly - // for the same request, we recommend that you wait, in intervals of increasing + // HTTP 400 error (Bad request). If Route 53 returns this error repeatedly for + // the same request, we recommend that you wait, in intervals of increasing // duration, before you try the request again. ErrCodePriorRequestNotComplete = "PriorRequestNotComplete" @@ -316,10 +316,11 @@ const ( // This health check can't be created because the current account has reached // the limit on the number of active health checks. // - // For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) + // For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // - // For information about how to get the current limit for an account, see GetAccountLimit. + // For information about how to get the current limit for an account, see GetAccountLimit + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. // @@ -336,14 +337,14 @@ const ( // the limit on the number of hosted zones that can be associated with a reusable // delegation set. // - // For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) + // For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // // To get the current limit on hosted zones that can be created by an account, - // see GetAccountLimit. + // see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To get the current limit on hosted zones that can be associated with a reusable - // delegation set, see GetReusableDelegationSetLimit. + // delegation set, see GetReusableDelegationSetLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetReusableDelegationSetLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -355,10 +356,10 @@ const ( // This traffic policy can't be created because the current account has reached // the limit on the number of traffic policies. // - // For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) + // For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // - // To get the current limit for an account, see GetAccountLimit. + // To get the current limit for an account, see GetAccountLimit (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -370,10 +371,11 @@ const ( // This traffic policy instance can't be created because the current account // has reached the limit on the number of traffic policy instances. // - // For information about default limits, see Limits (http://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) + // For information about default limits, see Limits (https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/DNSLimitations.html) // in the Amazon Route 53 Developer Guide. // - // For information about how to get the current limit for an account, see GetAccountLimit. + // For information about how to get the current limit for an account, see GetAccountLimit + // (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetAccountLimit.html). // // To request a higher limit, create a case (http://aws.amazon.com/route53-request) // with the AWS Support Center. @@ -386,10 +388,10 @@ const ( // of 1000 on the number of versions that you can create for the current traffic // policy. // - // To create more traffic policy versions, you can use GetTrafficPolicy to get - // the traffic policy document for a specified traffic policy version, and then - // use CreateTrafficPolicy to create a new traffic policy using the traffic - // policy document. + // To create more traffic policy versions, you can use GetTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_GetTrafficPolicy.html) + // to get the traffic policy document for a specified traffic policy version, + // and then use CreateTrafficPolicy (https://docs.aws.amazon.com/Route53/latest/APIReference/API_CreateTrafficPolicy.html) + // to create a new traffic policy using the traffic policy document. ErrCodeTooManyTrafficPolicyVersionsForCurrentPolicy = "TooManyTrafficPolicyVersionsForCurrentPolicy" // ErrCodeTooManyVPCAssociationAuthorizations for service response error code diff --git a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error.go b/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error.go index 266e9a8b..b3b95a12 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error.go +++ b/vendor/github.com/aws/aws-sdk-go/service/route53/unmarshal_error.go @@ -1,77 +1,106 @@ package route53 import ( - "bytes" "encoding/xml" - "io/ioutil" + "fmt" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/private/protocol/restxml" + "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" ) -type baseXMLErrorResponse struct { - XMLName xml.Name -} +const errorRespTag = "ErrorResponse" +const invalidChangeTag = "InvalidChangeBatch" type standardXMLErrorResponse struct { - XMLName xml.Name `xml:"ErrorResponse"` - Code string `xml:"Error>Code"` - Message string `xml:"Error>Message"` - RequestID string `xml:"RequestId"` + Code string `xml:"Error>Code"` + Message string `xml:"Error>Message"` + RequestID string `xml:"RequestId"` +} + +func (e standardXMLErrorResponse) FillCommon(c *xmlErrorResponse) { + c.Code = e.Code + c.Message = e.Message + c.RequestID = e.RequestID } type invalidChangeBatchXMLErrorResponse struct { - XMLName xml.Name `xml:"InvalidChangeBatch"` - Messages []string `xml:"Messages>Message"` + Messages []string `xml:"Messages>Message"` + RequestID string `xml:"RequestId"` +} + +func (e invalidChangeBatchXMLErrorResponse) FillCommon(c *xmlErrorResponse) { + c.Code = invalidChangeTag + c.Message = "ChangeBatch errors occurred" + c.Messages = e.Messages + c.RequestID = e.RequestID +} + +type xmlErrorResponse struct { + Code string + Message string + Messages []string + RequestID string +} + +func (e *xmlErrorResponse) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error { + type commonFiller interface { + FillCommon(*xmlErrorResponse) + } + + var errResp commonFiller + switch start.Name.Local { + case errorRespTag: + errResp = &standardXMLErrorResponse{} + + case invalidChangeTag: + errResp = &invalidChangeBatchXMLErrorResponse{} + + default: + return fmt.Errorf("unknown error message, %v", start.Name.Local) + } + + if err := d.DecodeElement(errResp, &start); err != nil { + return err + } + + errResp.FillCommon(e) + return nil } func unmarshalChangeResourceRecordSetsError(r *request.Request) { defer r.HTTPResponse.Body.Close() - responseBody, err := ioutil.ReadAll(r.HTTPResponse.Body) - + var errResp xmlErrorResponse + err := xmlutil.UnmarshalXMLError(&errResp, r.HTTPResponse.Body) if err != nil { - r.Error = awserr.New("SerializationError", "failed to read Route53 XML error response", err) + r.Error = awserr.NewRequestFailure( + awserr.New(request.ErrCodeSerialization, + "failed to unmarshal error message", err), + r.HTTPResponse.StatusCode, + r.RequestID, + ) return } - baseError := &baseXMLErrorResponse{} - - if err := xml.Unmarshal(responseBody, baseError); err != nil { - r.Error = awserr.New("SerializationError", "failed to decode Route53 XML error response", err) - return + var baseErr awserr.Error + if len(errResp.Messages) != 0 { + var errs []error + for _, msg := range errResp.Messages { + errs = append(errs, awserr.New(invalidChangeTag, msg, nil)) + } + baseErr = awserr.NewBatchError(errResp.Code, errResp.Message, errs) + } else { + baseErr = awserr.New(errResp.Code, errResp.Message, nil) } - switch baseError.XMLName.Local { - case "InvalidChangeBatch": - unmarshalInvalidChangeBatchError(r, responseBody) - default: - r.HTTPResponse.Body = ioutil.NopCloser(bytes.NewReader(responseBody)) - restxml.UnmarshalError(r) + reqID := errResp.RequestID + if len(reqID) == 0 { + reqID = r.RequestID } -} - -func unmarshalInvalidChangeBatchError(r *request.Request, requestBody []byte) { - resp := &invalidChangeBatchXMLErrorResponse{} - err := xml.Unmarshal(requestBody, resp) - - if err != nil { - r.Error = awserr.New("SerializationError", "failed to decode query XML error response", err) - return - } - - const errorCode = "InvalidChangeBatch" - errors := []error{} - - for _, msg := range resp.Messages { - errors = append(errors, awserr.New(errorCode, msg, nil)) - } - r.Error = awserr.NewRequestFailure( - awserr.NewBatchError(errorCode, "ChangeBatch errors occurred", errors), + baseErr, r.HTTPResponse.StatusCode, - r.RequestID, + reqID, ) - } 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 index 6f89a796..9e610591 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/api.go @@ -3,10 +3,12 @@ package sts import ( + "fmt" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/request" ) @@ -15,7 +17,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -54,38 +56,26 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // 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) +// Returns a set of temporary security credentials that you can use to access +// AWS resources that you might not normally have access to. These temporary +// credentials consist of an access key ID, a secret access key, and a security +// token. Typically, you use AssumeRole within your account or for cross-account +// access. For a comparison of AssumeRole with other API operations that produce +// temporary credentials, see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://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. +// You cannot use AWS account root user credentials to call AssumeRole. 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 +// Instead, you can create one set of long-term credentials in one account. +// 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) +// IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles.html) // in the IAM User Guide. // // By default, the temporary security credentials created by AssumeRole last @@ -94,69 +84,73 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // seconds (15 minutes) up to the maximum session duration setting for the role. // This setting can have a value from 1 hour to 12 hours. To learn how to view // the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // 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. +// API calls to any AWS service with the following exception: You cannot call +// the AWS STS GetFederationToken or GetSessionToken API operations. // -// 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) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // 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. +// To assume a role from a different account, 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 that access to users in the account. // -// 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. -// In this case, the trust policy acts as the only resource-based policy in -// IAM, and users in the same account as the role do not need explicit permission -// to assume the role. For more information about trust policies and resource-based -// policies, see IAM Policies (http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) +// A user who wants to access a role in a different account must also have permissions +// that are delegated from the user account administrator. The administrator +// must attach a policy that allows the user to call AssumeRole for the ARN +// of the role in the other account. If the user is in the same account as the +// role, then you can do either of the following: +// +// * Attach a policy to the user (identical to the previous user in a different +// account). +// +// * Add the user as a principal directly in the role's trust policy. +// +// In this case, the trust policy acts as an IAM resource-based policy. Users +// in the same account as the role do not need explicit permission to assume +// the role. For more information about trust policies and resource-based policies, +// see IAM Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html) // in the IAM User Guide. // // 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. +// (Optional) You can include multi-factor authentication (MFA) information +// when you call AssumeRole. This is useful for cross-account scenarios to ensure +// that the user that assumes the role has been authenticated with 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) +// For more information, see Configuring MFA-Protected API Access (https://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. +// the MFA device 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 @@ -179,7 +173,7 @@ func (c *STS) AssumeRoleRequest(input *AssumeRoleInput) (req *request.Request, o // 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) +// and Deactivating AWS STS in an AWS Region (https://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 @@ -209,7 +203,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -243,6 +237,7 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re output = &AssumeRoleWithSAMLOutput{} req = c.newRequest(op, input, output) + req.Config.Credentials = credentials.AnonymousCredentials return } @@ -252,9 +247,9 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // 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) +// with the other API operations that produce temporary credentials, see Requesting +// Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://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 @@ -269,37 +264,36 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // a DurationSeconds value from 900 seconds (15 minutes) up to the maximum session // duration setting for the role. This setting can have a value from 1 hour // to 12 hours. To learn how to view the maximum value for your role, see View -// the Maximum Session Duration Setting for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// the Maximum Session Duration Setting for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // 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. +// call the STS GetFederationToken or GetSessionToken API operations. // -// 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) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // 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. +// entity in your AWS account that represents your identity provider. You must +// also 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 @@ -313,16 +307,16 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // // 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) +// * About SAML 2.0-based Federation (https://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) +// * Creating SAML Identity Providers (https://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) +// * Configuring a Relying Party and Claims (https://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) +// * Creating a Role for SAML 2.0 Federation (https://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 @@ -361,7 +355,7 @@ func (c *STS) AssumeRoleWithSAMLRequest(input *AssumeRoleWithSAMLInput) (req *re // 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) +// and Deactivating AWS STS in an AWS Region (https://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 @@ -391,7 +385,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -425,41 +419,42 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI output = &AssumeRoleWithWebIdentityOutput{} req = c.newRequest(op, input, output) + req.Config.Credentials = credentials.AnonymousCredentials 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. +// in a mobile or web application with a web identity provider. Example providers +// include 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. +// use Amazon Cognito with the AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) +// and the AWS SDK for Android Developer Guide (http://aws.amazon.com/sdkforandroid/) +// to uniquely identify a user. You can also 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) +// To learn more about Amazon Cognito, see Amazon Cognito Overview (https://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-auth.html#d0e840) +// in AWS SDK for Android Developer Guide and Amazon Cognito Overview (https://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) +// long-term AWS credentials in the application. You also don't need to deploy +// 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 API +// operations that produce temporary credentials, see Requesting Temporary Security +// Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://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. +// temporary security credentials to sign calls to AWS service API operations. // // By default, the temporary security credentials created by AssumeRoleWithWebIdentity // last for one hour. However, you can use the optional DurationSeconds parameter @@ -467,29 +462,29 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // seconds (15 minutes) up to the maximum session duration setting for the role. // This setting can have a value from 1 hour to 12 hours. To learn how to view // the maximum value for your role, see View the Maximum Session Duration Setting -// for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) +// for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. The maximum session duration limit applies when you -// use the AssumeRole* API operations or the assume-role* CLI operations but -// does not apply when you use those operations to create a console URL. For -// more information, see Using IAM Roles (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) +// use the AssumeRole* API operations or the assume-role* CLI commands. However +// the limit does not apply when you use those operations to create a console +// URL. For more information, see Using IAM Roles (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html) // in the IAM User Guide. // // 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. +// you cannot call the STS GetFederationToken or GetSessionToken API operations. // -// 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) +// (Optional) You can pass inline or managed session policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. Passing policies +// to this operation returns new temporary credentials. The resulting session's +// permissions are the intersection of the role's identity-based policy and +// the session policies. You can use the role's temporary credentials in subsequent +// AWS API calls to access resources in the account that owns the role. You +// cannot use session policies to grant more permissions than those allowed +// by the identity-based policy of the role that is being assumed. For more +// information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // in the IAM User Guide. // // Before your application can call AssumeRoleWithWebIdentity, you must have @@ -508,21 +503,19 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // 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). +// * Using Web Identity Federation API Operations for Mobile Apps (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_providers_oidc_manual.html) +// and Federation Through a Web-based Identity Provider (https://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). +// Walk through the process of authenticating through Login with Amazon, +// Facebook, or Google, getting temporary security credentials, and then +// using those credentials to make a request to AWS. // -// * 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. +// * AWS SDK for iOS Developer Guide (http://aws.amazon.com/sdkforios/) and +// AWS SDK for Android Developer Guide (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/web-identity-federation-with-mobile-applications). // This article discusses web identity federation and shows an example of @@ -572,7 +565,7 @@ func (c *STS) AssumeRoleWithWebIdentityRequest(input *AssumeRoleWithWebIdentityI // 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) +// and Deactivating AWS STS in an AWS Region (https://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 @@ -602,7 +595,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -644,17 +637,17 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // 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. +// For example, if a user is not authorized to perform an operation that he +// or she has requested, the request returns a Client.UnauthorizedOperation +// response (an HTTP 403 response). Some AWS operations 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. +// Only certain AWS operations return an encoded authorization message. The +// documentation for an individual operation indicates whether that operation +// 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 +// constitute privileged information that the user who requested the operation // 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. @@ -663,7 +656,7 @@ func (c *STS) DecodeAuthorizationMessageRequest(input *DecodeAuthorizationMessag // // * 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) +// a Request is Allowed or Denied (https://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. @@ -714,7 +707,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -789,7 +782,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -831,81 +824,65 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // 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 +// on behalf of distributed applications inside a corporate network. You must +// call the GetFederationToken operation using the long-term security credentials +// of an IAM user. As a result, 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) +// For a comparison of GetFederationToken with the other API operations that +// produce temporary credentials, see Requesting Temporary Security Credentials +// (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://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 +// You can create 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. +// or an OpenID Connect-compatible identity provider. In this case, 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). +// (https://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) +// You can also call GetFederationToken using the security credentials of an +// AWS account root user, but we do not recommend it. Instead, we recommend +// that you create an IAM user for the purpose of the proxy application. Then +// attach a policy to the IAM user that limits federated users to only the actions +// and resources that they need to access. For more information, see IAM Best +// Practices (https://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 credentials are valid for the specified duration, from 900 +// seconds (15 minutes) up to a maximum of 129,600 seconds (36 hours). The default +// is 43,200 seconds (12 hours). Temporary credentials that are obtained by +// using AWS account root user credentials have a maximum duration of 3,600 +// 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 use these credentials to call any IAM API operations. // -// * You cannot call any STS APIs except GetCallerIdentity. +// * You cannot call any STS API operations except GetCallerIdentity. // // Permissions // -// The permissions for the temporary security credentials returned by GetFederationToken -// are determined by a combination of the following: +// You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// to this operation. You can pass a single JSON policy document to use as an +// inline session policy. You can also specify up to 10 managed policies to +// use as managed session policies. The plain text that you use for both inline +// and managed session policies shouldn't exceed 2048 characters. // -// * 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). +// Though the session policy parameters are optional, if you do not pass a policy, +// then the resulting federated user session has no permissions. The only exception +// is when the credentials are used to access a resource that has a resource-based +// policy that specifically references the federated user session in the Principal +// element of the policy. When you pass session policies, the session permissions +// are the intersection of the IAM user policies and the session policies that +// you pass. This gives you a way to further restrict the permissions for a +// federated user. You cannot use session policies to grant more permissions +// than those that are defined in the permissions policy of the IAM user. For +// more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) +// in the IAM User Guide. For information about using GetFederationToken to +// create temporary security credentials, see GetFederationToken—Federation +// Through a Custom Identity Broker (https://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 @@ -928,7 +905,7 @@ func (c *STS) GetFederationTokenRequest(input *GetFederationTokenInput) (req *re // 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) +// and Deactivating AWS STS in an AWS Region (https://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 @@ -958,7 +935,7 @@ 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 completes -// successfuly. +// successfully. // // Use "Send" method on the returned Request to send the API call to the service. // the "output" return value is not valid until after Send returns without error. @@ -1000,48 +977,47 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // 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) +// programmatic calls to specific AWS API operations 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 API operations 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 API operations that produce temporary credentials, +// see Requesting Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_request.html) +// and Comparing the AWS STS API operations (https://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 GetSessionToken operation must be called by using the long-term AWS security +// credentials of the AWS account root user or an IAM user. Credentials that +// are created by IAM users are valid for the duration that you specify. This +// duration can range from 900 seconds (15 minutes) up to a maximum of 129,600 +// seconds (36 hours), with a default of 43,200 seconds (12 hours). Credentials +// based on account credentials can range from 900 seconds (15 minutes) up to +// 3,600 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 IAM API operations unless MFA authentication information +// is included in the request. // -// * You cannot call any STS API exceptAssumeRole or GetCallerIdentity. +// * You cannot call any STS API except AssumeRole 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) +// We recommend that you do not call GetSessionToken with AWS account root user +// credentials. Instead, follow our best practices (https://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. +// The credentials that are returned by GetSessionToken are based on permissions +// associated with the user whose credentials were used to call the operation. +// If GetSessionToken is called using AWS account root user credentials, the +// temporary credentials have root user 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) +// go to Temporary Credentials for Users in Untrusted Environments (https://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 @@ -1056,7 +1032,7 @@ func (c *STS) GetSessionTokenRequest(input *GetSessionTokenInput) (req *request. // 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) +// and Deactivating AWS STS in an AWS Region (https://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 @@ -1091,7 +1067,7 @@ type AssumeRoleInput struct { // a session duration of 12 hours, but your administrator set the maximum session // duration to 6 hours, your operation fails. To learn how to view the maximum // value for your role, see View the Maximum Session Duration Setting for a - // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1101,51 +1077,77 @@ type AssumeRoleInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. 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) + // AWS Management Console (https://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) + // A unique identifier that might be required when you assume a role in another + // account. If the administrator of the account to which the role belongs provided + // you with an external ID, then provide that value in the ExternalId parameter. + // This value can be any string, such as a passphrase or account number. A cross-account + // role is usually set up to trust everyone in an account. Therefore, the administrator + // of the trusting account might send an external ID to the administrator of + // the trusted account. That way, only someone with the ID can assume the role, + // rather than everyone in the account. 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 (https://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 + // 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: =,.@:/- ExternalId *string `min:"2" type:"string"` - // An IAM policy in JSON format. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // 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) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // 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), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \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. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // The Amazon Resource Name (ARN) of the role to assume. // // RoleArn is a required field @@ -1158,8 +1160,8 @@ type AssumeRoleInput struct { // 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. + // requests that use the temporary security credentials will expose the role + // session name to the external account in their AWS 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 @@ -1229,6 +1231,16 @@ func (s *AssumeRoleInput) Validate() error { if s.TokenCode != nil && len(*s.TokenCode) < 6 { invalidParams.Add(request.NewErrParamMinLen("TokenCode", 6)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1254,6 +1266,12 @@ func (s *AssumeRoleInput) SetPolicy(v string) *AssumeRoleInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleInput { + s.PolicyArns = v + return s +} + // SetRoleArn sets the RoleArn field's value. func (s *AssumeRoleInput) SetRoleArn(v string) *AssumeRoleInput { s.RoleArn = &v @@ -1293,10 +1311,8 @@ type AssumeRoleOutput struct { // 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. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // A percentage value that indicates the size of the policy in packed form. @@ -1346,7 +1362,7 @@ type AssumeRoleWithSAMLInput struct { // specify a session duration of 12 hours, but your administrator set the maximum // session duration to 6 hours, your operation fails. To learn how to view the // maximum value for your role, see View the Maximum Session Duration Setting - // for a Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // for a Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1356,36 +1372,60 @@ type AssumeRoleWithSAMLInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. 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) + // AWS Management Console (https://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. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // 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) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // 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), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \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. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // The Amazon Resource Name (ARN) of the SAML provider in IAM that describes // the IdP. // @@ -1399,8 +1439,8 @@ type AssumeRoleWithSAMLInput struct { // 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. + // For more information, see Configuring a Relying Party and Adding Claims (https://docs.aws.amazon.com/IAM/latest/UserGuide/create-role-saml-IdP-tasks.html) + // in the IAM User Guide. // // SAMLAssertion is a required field SAMLAssertion *string `min:"4" type:"string" required:"true"` @@ -1443,6 +1483,16 @@ func (s *AssumeRoleWithSAMLInput) Validate() error { if s.SAMLAssertion != nil && len(*s.SAMLAssertion) < 4 { invalidParams.Add(request.NewErrParamMinLen("SAMLAssertion", 4)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1462,6 +1512,12 @@ func (s *AssumeRoleWithSAMLInput) SetPolicy(v string) *AssumeRoleWithSAMLInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleWithSAMLInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithSAMLInput { + s.PolicyArns = v + return s +} + // SetPrincipalArn sets the PrincipalArn field's value. func (s *AssumeRoleWithSAMLInput) SetPrincipalArn(v string) *AssumeRoleWithSAMLInput { s.PrincipalArn = &v @@ -1496,10 +1552,8 @@ type AssumeRoleWithSAMLOutput struct { // 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. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // The value of the Issuer element of the SAML assertion. @@ -1603,7 +1657,7 @@ type AssumeRoleWithWebIdentityInput struct { // a session duration of 12 hours, but your administrator set the maximum session // duration to 6 hours, your operation fails. To learn how to view the maximum // value for your role, see View the Maximum Session Duration Setting for a - // Role (http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) + // Role (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html#id_roles_use_view-role-max-session) // in the IAM User Guide. // // By default, the value is set to 3600 seconds. @@ -1613,35 +1667,60 @@ type AssumeRoleWithWebIdentityInput struct { // to the federation endpoint for a console sign-in token takes a SessionDuration // parameter that specifies the maximum length of the console session. 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) + // AWS Management Console (https://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. + // An IAM policy in JSON format that you want to use as an inline session policy. // - // 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) + // This parameter is optional. Passing policies to this operation returns new + // temporary credentials. The resulting session's permissions are the intersection + // of the role's identity-based policy and the session policies. You can use + // the role's temporary credentials in subsequent AWS API calls to access resources + // in the account that owns the role. You cannot use session policies to grant + // more permissions than those allowed by the identity-based policy of the role + // that is being assumed. For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) // 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), + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \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. + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as managed session policies. The policies must exist in the same account + // as the role. + // + // This parameter is optional. You can provide up to 10 managed policy ARNs. + // However, the plain text that you use for both inline and managed session + // policies shouldn't exceed 2048 characters. For more information about ARNs, + // see Amazon Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + // + // Passing policies to this operation returns new temporary credentials. The + // resulting session's permissions are the intersection of the role's identity-based + // policy and the session policies. You can use the role's temporary credentials + // in subsequent AWS API calls to access resources in the account that owns + // the role. You cannot use session policies to grant more permissions than + // those allowed by the identity-based policy of the role that is being assumed. + // For more information, see Session Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + PolicyArns []*PolicyDescriptorType `type:"list"` + // 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 @@ -1718,6 +1797,16 @@ func (s *AssumeRoleWithWebIdentityInput) Validate() error { if s.WebIdentityToken != nil && len(*s.WebIdentityToken) < 4 { invalidParams.Add(request.NewErrParamMinLen("WebIdentityToken", 4)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -1737,6 +1826,12 @@ func (s *AssumeRoleWithWebIdentityInput) SetPolicy(v string) *AssumeRoleWithWebI return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *AssumeRoleWithWebIdentityInput) SetPolicyArns(v []*PolicyDescriptorType) *AssumeRoleWithWebIdentityInput { + s.PolicyArns = v + return s +} + // SetProviderId sets the ProviderId field's value. func (s *AssumeRoleWithWebIdentityInput) SetProviderId(v string) *AssumeRoleWithWebIdentityInput { s.ProviderId = &v @@ -1781,10 +1876,8 @@ type AssumeRoleWithWebIdentityOutput struct { // 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. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // A percentage value that indicates the size of the policy in packed form. @@ -1793,7 +1886,7 @@ type AssumeRoleWithWebIdentityOutput struct { 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 + // 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"` @@ -1860,7 +1953,7 @@ type AssumedRoleUser struct { // 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) + // policies, see IAM Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) // in Using IAM. // // Arn is a required field @@ -2028,7 +2121,7 @@ type FederatedUser struct { // 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) + // Identifiers (https://docs.aws.amazon.com/IAM/latest/UserGuide/reference_identifiers.html) // in Using IAM. // // Arn is a required field @@ -2090,8 +2183,8 @@ type GetCallerIdentityOutput struct { 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) + // type of entity that is making the call. The values returned are those listed + // in the aws:userid column in the Principal table (https://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"` } @@ -2128,12 +2221,11 @@ 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 + // for federation sessions range from 900 seconds (15 minutes) to 129,600 seconds + // (36 hours), with 43,200 seconds (12 hours) as the default. Sessions obtained + // using AWS account root user credentials are restricted to a maximum of 3,600 // 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. + // session obtained by using root user 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 @@ -2148,36 +2240,73 @@ type GetFederationTokenInput struct { // 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. + // An IAM policy in JSON format that you want to use as an inline session 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. + // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // to this operation. You can pass a single JSON policy document to use as an + // inline session policy. You can also specify up to 10 managed policies to + // use as managed session policies. // - // 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), + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. The only exception + // is when the credentials are used to access a resource that has a resource-based + // policy that specifically references the federated user session in the Principal + // element of the policy. + // + // When you pass session policies, the session permissions are the intersection + // of the IAM user policies and the session policies that you pass. This gives + // you a way to further restrict the permissions for a federated user. You cannot + // use session policies to grant more permissions than those that are defined + // in the permissions policy of the IAM user. For more information, see Session + // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + // + // The plain text that you use for both inline and managed session policies + // shouldn't exceed 2048 characters. The JSON policy characters can be any ASCII + // character from the space character to the end of the valid character list + // (\u0020 through \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). + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. Policy *string `min:"1" type:"string"` + + // The Amazon Resource Names (ARNs) of the IAM managed policies that you want + // to use as a managed session policy. The policies must exist in the same account + // as the IAM user that is requesting federated access. + // + // You must pass an inline or managed session policy (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // to this operation. You can pass a single JSON policy document to use as an + // inline session policy. You can also specify up to 10 managed policies to + // use as managed session policies. The plain text that you use for both inline + // and managed session policies shouldn't exceed 2048 characters. You can provide + // up to 10 managed policy ARNs. For more information about ARNs, see Amazon + // Resource Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + // + // This parameter is optional. However, if you do not pass any session policies, + // then the resulting federated user session has no permissions. The only exception + // is when the credentials are used to access a resource that has a resource-based + // policy that specifically references the federated user session in the Principal + // element of the policy. + // + // When you pass session policies, the session permissions are the intersection + // of the IAM user policies and the session policies that you pass. This gives + // you a way to further restrict the permissions for a federated user. You cannot + // use session policies to grant more permissions than those that are defined + // in the permissions policy of the IAM user. For more information, see Session + // Policies (https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies.html#policies_session) + // in the IAM User Guide. + // + // The characters in this parameter count towards the 2048 character session + // policy guideline. However, an AWS conversion compresses the session policies + // into a packed binary format that has a separate limit. This is the enforced + // limit. The PackedPolicySize response element indicates by percentage how + // close the policy is to the upper size limit. + PolicyArns []*PolicyDescriptorType `type:"list"` } // String returns the string representation @@ -2205,6 +2334,16 @@ func (s *GetFederationTokenInput) Validate() error { if s.Policy != nil && len(*s.Policy) < 1 { invalidParams.Add(request.NewErrParamMinLen("Policy", 1)) } + if s.PolicyArns != nil { + for i, v := range s.PolicyArns { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "PolicyArns", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -2230,6 +2369,12 @@ func (s *GetFederationTokenInput) SetPolicy(v string) *GetFederationTokenInput { return s } +// SetPolicyArns sets the PolicyArns field's value. +func (s *GetFederationTokenInput) SetPolicyArns(v []*PolicyDescriptorType) *GetFederationTokenInput { + s.PolicyArns = v + return s +} + // Contains the response to a successful GetFederationToken request, including // temporary AWS credentials that can be used to make AWS requests. type GetFederationTokenOutput struct { @@ -2238,10 +2383,8 @@ type GetFederationTokenOutput struct { // 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. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` // Identifiers for the federated user associated with the credentials (such @@ -2288,11 +2431,11 @@ 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. + // durations for IAM user sessions range from 900 seconds (15 minutes) to 129,600 + // seconds (36 hours), with 43,200 seconds (12 hours) as the default. Sessions + // for AWS account owners are restricted to a maximum of 3,600 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 @@ -2303,16 +2446,16 @@ type GetSessionTokenInput struct { // 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 + // 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 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. + // is required, the user must provide a code when requesting a set of temporary + // security credentials. A user who fails to provide the code receives 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. @@ -2374,10 +2517,8 @@ type GetSessionTokenOutput struct { // 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. + // The size of the security token that STS API operations return is not fixed. + // We strongly recommend that you make no assumptions about the maximum size. Credentials *Credentials `type:"structure"` } @@ -2396,3 +2537,44 @@ func (s *GetSessionTokenOutput) SetCredentials(v *Credentials) *GetSessionTokenO s.Credentials = v return s } + +// A reference to the IAM managed policy that is passed as a session policy +// for a role session or a federated user session. +type PolicyDescriptorType struct { + _ struct{} `type:"structure"` + + // The Amazon Resource Name (ARN) of the IAM managed policy to use as a session + // policy for the role. For more information about ARNs, see Amazon Resource + // Names (ARNs) and AWS Service Namespaces (general/latest/gr/aws-arns-and-namespaces.html) + // in the AWS General Reference. + Arn *string `locationName:"arn" min:"20" type:"string"` +} + +// String returns the string representation +func (s PolicyDescriptorType) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PolicyDescriptorType) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PolicyDescriptorType) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PolicyDescriptorType"} + if s.Arn != nil && len(*s.Arn) < 20 { + invalidParams.Add(request.NewErrParamMinLen("Arn", 20)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetArn sets the Arn field's value. +func (s *PolicyDescriptorType) SetArn(v string) *PolicyDescriptorType { + s.Arn = &v + return s +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go b/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go deleted file mode 100644 index 4010cc7f..00000000 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/customizations.go +++ /dev/null @@ -1,12 +0,0 @@ -package sts - -import "github.com/aws/aws-sdk-go/aws/request" - -func init() { - initRequest = func(r *request.Request) { - switch r.Operation.Name { - case opAssumeRoleWithSAML, opAssumeRoleWithWebIdentity: - r.Handlers.Sign.Clear() // these operations are unsigned - } - } -} diff --git a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go index ef681ab0..fcb720dc 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/doc.go @@ -7,22 +7,14 @@ // 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/). +// about using this service, go to Temporary Security Credentials (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp.html). // // 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) +// API, go to Signing AWS API Requests (https://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) +// go to Making Query Requests (https://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) +// products, go to AWS Services That Work with IAM (https://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 @@ -31,14 +23,38 @@ // // 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) +// By default, AWS Security Token Service (STS) is available as a global service, +// and all AWS STS requests go to a single endpoint at https://sts.amazonaws.com. +// Global requests map to the US East (N. Virginia) region. AWS recommends using +// Regional AWS STS endpoints instead of the global endpoint to reduce latency, +// build in redundancy, and increase session token validity. For more information, +// see Managing AWS STS in an AWS Region (https://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. +// Most AWS Regions are enabled for operations in all AWS services by default. +// Those Regions are automatically activated for use with AWS STS. Some Regions, +// such as Asia Pacific (Hong Kong), must be manually enabled. To learn more +// about enabling and disabling AWS Regions, see Managing AWS Regions (https://docs.aws.amazon.com/general/latest/gr/rande-manage.html) +// in the AWS General Reference. When you enable these AWS Regions, they are +// automatically activated for use with AWS STS. You cannot activate the STS +// endpoint for a Region that is disabled. Tokens that are valid in all AWS +// Regions are longer than tokens that are valid in Regions that are enabled +// by default. Changing this setting might affect existing systems where you +// temporarily store tokens. For more information, see Managing Global Endpoint +// Session Tokens (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#sts-regions-manage-tokens) +// in the IAM User Guide. +// +// After you activate a Region for use with AWS STS, you can direct AWS STS +// API calls to that Region. AWS STS recommends that you provide both the Region +// and endpoint when you make calls to a Regional endpoint. You can provide +// the Region alone for manually enabled Regions, such as Asia Pacific (Hong +// Kong). In this case, the calls are directed to the STS Regional endpoint. +// However, if you provide the Region alone for Regions enabled by default, +// the calls are directed to the global endpoint of https://sts.amazonaws.com. +// +// To view the list of AWS STS endpoints and whether they are active by default, +// see Writing Code to Use AWS STS Regions (https://docs.aws.amazon.com/IAM/latest/UserGuide/id_credentials_temp_enable-regions.html#id_credentials_temp_enable-regions_writing_code) +// in the IAM User Guide. // // Recording API requests // @@ -46,8 +62,28 @@ // 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). +// on. +// +// If you activate AWS STS endpoints in Regions other than the default global +// endpoint, then you must also turn on CloudTrail logging in those Regions. +// This is necessary to record any AWS STS API calls that are made in those +// Regions. For more information, see Turning On CloudTrail in Additional Regions +// (https://docs.aws.amazon.com/awscloudtrail/latest/userguide/aggregating_logs_regions_turn_on_ct.html) +// in the AWS CloudTrail User Guide. +// +// AWS Security Token Service (STS) is a global service with a single endpoint +// at https://sts.amazonaws.com. Calls to this endpoint are logged as calls +// to a global service. However, because this endpoint is physically located +// in the US East (N. Virginia) Region, your logs list us-east-1 as the event +// Region. CloudTrail does not write these logs to the US East (Ohio) Region +// unless you choose to include global service logs in that Region. CloudTrail +// writes calls to all Regional endpoints to their respective Regions. For example, +// calls to sts.us-east-2.amazonaws.com are published to the US East (Ohio) +// Region and calls to sts.eu-central-1.amazonaws.com are published to the EU +// (Frankfurt) Region. +// +// To learn more about CloudTrail, including how to turn it on and find your +// log files, see the AWS CloudTrail User Guide (https://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. // 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 index e24884ef..41ea09c3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/sts/errors.go @@ -67,7 +67,7 @@ const ( // 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) + // and Deactivating AWS STS in an AWS Region (https://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/census-instrumentation/opencensus-proto/AUTHORS b/vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS new file mode 100644 index 00000000..e068e731 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/AUTHORS @@ -0,0 +1 @@ +Google Inc. \ No newline at end of file diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/LICENSE b/vendor/github.com/census-instrumentation/opencensus-proto/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/LICENSE @@ -0,0 +1,202 @@ + + 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/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go new file mode 100644 index 00000000..12b578d0 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1/common.pb.go @@ -0,0 +1,356 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/agent/common/v1/common.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +type LibraryInfo_Language int32 + +const ( + LibraryInfo_LANGUAGE_UNSPECIFIED LibraryInfo_Language = 0 + LibraryInfo_CPP LibraryInfo_Language = 1 + LibraryInfo_C_SHARP LibraryInfo_Language = 2 + LibraryInfo_ERLANG LibraryInfo_Language = 3 + LibraryInfo_GO_LANG LibraryInfo_Language = 4 + LibraryInfo_JAVA LibraryInfo_Language = 5 + LibraryInfo_NODE_JS LibraryInfo_Language = 6 + LibraryInfo_PHP LibraryInfo_Language = 7 + LibraryInfo_PYTHON LibraryInfo_Language = 8 + LibraryInfo_RUBY LibraryInfo_Language = 9 +) + +var LibraryInfo_Language_name = map[int32]string{ + 0: "LANGUAGE_UNSPECIFIED", + 1: "CPP", + 2: "C_SHARP", + 3: "ERLANG", + 4: "GO_LANG", + 5: "JAVA", + 6: "NODE_JS", + 7: "PHP", + 8: "PYTHON", + 9: "RUBY", +} + +var LibraryInfo_Language_value = map[string]int32{ + "LANGUAGE_UNSPECIFIED": 0, + "CPP": 1, + "C_SHARP": 2, + "ERLANG": 3, + "GO_LANG": 4, + "JAVA": 5, + "NODE_JS": 6, + "PHP": 7, + "PYTHON": 8, + "RUBY": 9, +} + +func (x LibraryInfo_Language) String() string { + return proto.EnumName(LibraryInfo_Language_name, int32(x)) +} + +func (LibraryInfo_Language) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_126c72ed8a252c84, []int{2, 0} +} + +// Identifier metadata of the Node that produces the span or tracing data. +// Note, this is not the metadata about the Node or service that is described by associated spans. +// In the future we plan to extend the identifier proto definition to support +// additional information (e.g cloud id, etc.) +type Node struct { + // Identifier that uniquely identifies a process within a VM/container. + Identifier *ProcessIdentifier `protobuf:"bytes,1,opt,name=identifier,proto3" json:"identifier,omitempty"` + // Information on the OpenCensus Library that initiates the stream. + LibraryInfo *LibraryInfo `protobuf:"bytes,2,opt,name=library_info,json=libraryInfo,proto3" json:"library_info,omitempty"` + // Additional information on service. + ServiceInfo *ServiceInfo `protobuf:"bytes,3,opt,name=service_info,json=serviceInfo,proto3" json:"service_info,omitempty"` + // Additional attributes. + Attributes map[string]string `protobuf:"bytes,4,rep,name=attributes,proto3" json:"attributes,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Node) Reset() { *m = Node{} } +func (m *Node) String() string { return proto.CompactTextString(m) } +func (*Node) ProtoMessage() {} +func (*Node) Descriptor() ([]byte, []int) { + return fileDescriptor_126c72ed8a252c84, []int{0} +} + +func (m *Node) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Node.Unmarshal(m, b) +} +func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Node.Marshal(b, m, deterministic) +} +func (m *Node) XXX_Merge(src proto.Message) { + xxx_messageInfo_Node.Merge(m, src) +} +func (m *Node) XXX_Size() int { + return xxx_messageInfo_Node.Size(m) +} +func (m *Node) XXX_DiscardUnknown() { + xxx_messageInfo_Node.DiscardUnknown(m) +} + +var xxx_messageInfo_Node proto.InternalMessageInfo + +func (m *Node) GetIdentifier() *ProcessIdentifier { + if m != nil { + return m.Identifier + } + return nil +} + +func (m *Node) GetLibraryInfo() *LibraryInfo { + if m != nil { + return m.LibraryInfo + } + return nil +} + +func (m *Node) GetServiceInfo() *ServiceInfo { + if m != nil { + return m.ServiceInfo + } + return nil +} + +func (m *Node) GetAttributes() map[string]string { + if m != nil { + return m.Attributes + } + return nil +} + +// Identifier that uniquely identifies a process within a VM/container. +type ProcessIdentifier struct { + // The host name. Usually refers to the machine/container name. + // For example: os.Hostname() in Go, socket.gethostname() in Python. + HostName string `protobuf:"bytes,1,opt,name=host_name,json=hostName,proto3" json:"host_name,omitempty"` + // Process id. + Pid uint32 `protobuf:"varint,2,opt,name=pid,proto3" json:"pid,omitempty"` + // Start time of this ProcessIdentifier. Represented in epoch time. + StartTimestamp *timestamp.Timestamp `protobuf:"bytes,3,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProcessIdentifier) Reset() { *m = ProcessIdentifier{} } +func (m *ProcessIdentifier) String() string { return proto.CompactTextString(m) } +func (*ProcessIdentifier) ProtoMessage() {} +func (*ProcessIdentifier) Descriptor() ([]byte, []int) { + return fileDescriptor_126c72ed8a252c84, []int{1} +} + +func (m *ProcessIdentifier) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProcessIdentifier.Unmarshal(m, b) +} +func (m *ProcessIdentifier) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProcessIdentifier.Marshal(b, m, deterministic) +} +func (m *ProcessIdentifier) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProcessIdentifier.Merge(m, src) +} +func (m *ProcessIdentifier) XXX_Size() int { + return xxx_messageInfo_ProcessIdentifier.Size(m) +} +func (m *ProcessIdentifier) XXX_DiscardUnknown() { + xxx_messageInfo_ProcessIdentifier.DiscardUnknown(m) +} + +var xxx_messageInfo_ProcessIdentifier proto.InternalMessageInfo + +func (m *ProcessIdentifier) GetHostName() string { + if m != nil { + return m.HostName + } + return "" +} + +func (m *ProcessIdentifier) GetPid() uint32 { + if m != nil { + return m.Pid + } + return 0 +} + +func (m *ProcessIdentifier) GetStartTimestamp() *timestamp.Timestamp { + if m != nil { + return m.StartTimestamp + } + return nil +} + +// Information on OpenCensus Library. +type LibraryInfo struct { + // Language of OpenCensus Library. + Language LibraryInfo_Language `protobuf:"varint,1,opt,name=language,proto3,enum=opencensus.proto.agent.common.v1.LibraryInfo_Language" json:"language,omitempty"` + // Version of Agent exporter of Library. + ExporterVersion string `protobuf:"bytes,2,opt,name=exporter_version,json=exporterVersion,proto3" json:"exporter_version,omitempty"` + // Version of OpenCensus Library. + CoreLibraryVersion string `protobuf:"bytes,3,opt,name=core_library_version,json=coreLibraryVersion,proto3" json:"core_library_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LibraryInfo) Reset() { *m = LibraryInfo{} } +func (m *LibraryInfo) String() string { return proto.CompactTextString(m) } +func (*LibraryInfo) ProtoMessage() {} +func (*LibraryInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_126c72ed8a252c84, []int{2} +} + +func (m *LibraryInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LibraryInfo.Unmarshal(m, b) +} +func (m *LibraryInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LibraryInfo.Marshal(b, m, deterministic) +} +func (m *LibraryInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_LibraryInfo.Merge(m, src) +} +func (m *LibraryInfo) XXX_Size() int { + return xxx_messageInfo_LibraryInfo.Size(m) +} +func (m *LibraryInfo) XXX_DiscardUnknown() { + xxx_messageInfo_LibraryInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_LibraryInfo proto.InternalMessageInfo + +func (m *LibraryInfo) GetLanguage() LibraryInfo_Language { + if m != nil { + return m.Language + } + return LibraryInfo_LANGUAGE_UNSPECIFIED +} + +func (m *LibraryInfo) GetExporterVersion() string { + if m != nil { + return m.ExporterVersion + } + return "" +} + +func (m *LibraryInfo) GetCoreLibraryVersion() string { + if m != nil { + return m.CoreLibraryVersion + } + return "" +} + +// Additional service information. +type ServiceInfo struct { + // Name of the service. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceInfo) Reset() { *m = ServiceInfo{} } +func (m *ServiceInfo) String() string { return proto.CompactTextString(m) } +func (*ServiceInfo) ProtoMessage() {} +func (*ServiceInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_126c72ed8a252c84, []int{3} +} + +func (m *ServiceInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceInfo.Unmarshal(m, b) +} +func (m *ServiceInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceInfo.Marshal(b, m, deterministic) +} +func (m *ServiceInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceInfo.Merge(m, src) +} +func (m *ServiceInfo) XXX_Size() int { + return xxx_messageInfo_ServiceInfo.Size(m) +} +func (m *ServiceInfo) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceInfo proto.InternalMessageInfo + +func (m *ServiceInfo) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func init() { + proto.RegisterEnum("opencensus.proto.agent.common.v1.LibraryInfo_Language", LibraryInfo_Language_name, LibraryInfo_Language_value) + proto.RegisterType((*Node)(nil), "opencensus.proto.agent.common.v1.Node") + proto.RegisterMapType((map[string]string)(nil), "opencensus.proto.agent.common.v1.Node.AttributesEntry") + proto.RegisterType((*ProcessIdentifier)(nil), "opencensus.proto.agent.common.v1.ProcessIdentifier") + proto.RegisterType((*LibraryInfo)(nil), "opencensus.proto.agent.common.v1.LibraryInfo") + proto.RegisterType((*ServiceInfo)(nil), "opencensus.proto.agent.common.v1.ServiceInfo") +} + +func init() { + proto.RegisterFile("opencensus/proto/agent/common/v1/common.proto", fileDescriptor_126c72ed8a252c84) +} + +var fileDescriptor_126c72ed8a252c84 = []byte{ + // 590 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0x4f, 0x4f, 0xdb, 0x3e, + 0x1c, 0xc6, 0x7f, 0x69, 0x0a, 0xb4, 0xdf, 0xfc, 0x06, 0x99, 0xc5, 0xa1, 0x62, 0x87, 0xb1, 0xee, + 0xc2, 0x0e, 0x4d, 0x06, 0x48, 0xd3, 0x34, 0x69, 0x87, 0x52, 0x3a, 0x28, 0x42, 0x25, 0x72, 0x01, + 0x89, 0x5d, 0xa2, 0xb4, 0xb8, 0xc1, 0x5a, 0x63, 0x57, 0xb6, 0x53, 0x8d, 0xd3, 0x8e, 0xd3, 0xde, + 0xc0, 0x5e, 0xd4, 0x5e, 0xd5, 0x64, 0x3b, 0x69, 0xa3, 0x71, 0x28, 0xb7, 0xef, 0x9f, 0xe7, 0xf9, + 0x38, 0x7a, 0x6c, 0x05, 0x3a, 0x7c, 0x4e, 0xd8, 0x84, 0x30, 0x99, 0xcb, 0x70, 0x2e, 0xb8, 0xe2, + 0x61, 0x92, 0x12, 0xa6, 0xc2, 0x09, 0xcf, 0x32, 0xce, 0xc2, 0xc5, 0x61, 0x51, 0x05, 0x66, 0x89, + 0xf6, 0x57, 0x72, 0x3b, 0x09, 0x8c, 0x3c, 0x28, 0x44, 0x8b, 0xc3, 0xbd, 0xd7, 0x29, 0xe7, 0xe9, + 0x8c, 0x58, 0xd8, 0x38, 0x9f, 0x86, 0x8a, 0x66, 0x44, 0xaa, 0x24, 0x9b, 0x5b, 0x43, 0xfb, 0xb7, + 0x0b, 0xf5, 0x21, 0xbf, 0x27, 0x68, 0x04, 0x40, 0xef, 0x09, 0x53, 0x74, 0x4a, 0x89, 0x68, 0x39, + 0xfb, 0xce, 0x81, 0x77, 0x74, 0x1c, 0xac, 0x3b, 0x20, 0x88, 0x04, 0x9f, 0x10, 0x29, 0x07, 0x4b, + 0x2b, 0xae, 0x60, 0x50, 0x04, 0xff, 0xcf, 0xe8, 0x58, 0x24, 0xe2, 0x31, 0xa6, 0x6c, 0xca, 0x5b, + 0x35, 0x83, 0xed, 0xac, 0xc7, 0x5e, 0x5a, 0xd7, 0x80, 0x4d, 0x39, 0xf6, 0x66, 0xab, 0x46, 0x13, + 0x25, 0x11, 0x0b, 0x3a, 0x21, 0x96, 0xe8, 0x3e, 0x97, 0x38, 0xb2, 0x2e, 0x4b, 0x94, 0xab, 0x06, + 0xdd, 0x02, 0x24, 0x4a, 0x09, 0x3a, 0xce, 0x15, 0x91, 0xad, 0xfa, 0xbe, 0x7b, 0xe0, 0x1d, 0x7d, + 0x58, 0xcf, 0xd3, 0xa1, 0x05, 0xdd, 0xa5, 0xb1, 0xcf, 0x94, 0x78, 0xc4, 0x15, 0xd2, 0xde, 0x67, + 0xd8, 0xf9, 0x67, 0x8d, 0x7c, 0x70, 0xbf, 0x91, 0x47, 0x13, 0x6e, 0x13, 0xeb, 0x12, 0xed, 0xc2, + 0xc6, 0x22, 0x99, 0xe5, 0xc4, 0x24, 0xd3, 0xc4, 0xb6, 0xf9, 0x54, 0xfb, 0xe8, 0xb4, 0x7f, 0x3a, + 0xf0, 0xf2, 0x49, 0xb8, 0xe8, 0x15, 0x34, 0x1f, 0xb8, 0x54, 0x31, 0x4b, 0x32, 0x52, 0x70, 0x1a, + 0x7a, 0x30, 0x4c, 0x32, 0xa2, 0xf1, 0x73, 0x7a, 0x6f, 0x50, 0x2f, 0xb0, 0x2e, 0x51, 0x0f, 0x76, + 0xa4, 0x4a, 0x84, 0x8a, 0x97, 0xd7, 0x5e, 0x04, 0xb6, 0x17, 0xd8, 0x87, 0x11, 0x94, 0x0f, 0x23, + 0xb8, 0x2e, 0x15, 0x78, 0xdb, 0x58, 0x96, 0x7d, 0xfb, 0x4f, 0x0d, 0xbc, 0xca, 0x7d, 0x20, 0x0c, + 0x8d, 0x59, 0xc2, 0xd2, 0x3c, 0x49, 0xed, 0x27, 0x6c, 0x3f, 0x27, 0xae, 0x0a, 0x20, 0xb8, 0x2c, + 0xdc, 0x78, 0xc9, 0x41, 0xef, 0xc0, 0x27, 0xdf, 0xe7, 0x5c, 0x28, 0x22, 0xe2, 0x05, 0x11, 0x92, + 0x72, 0x56, 0x44, 0xb2, 0x53, 0xce, 0x6f, 0xed, 0x18, 0xbd, 0x87, 0xdd, 0x09, 0x17, 0x24, 0x2e, + 0x1f, 0x56, 0x29, 0x77, 0x8d, 0x1c, 0xe9, 0x5d, 0x71, 0x58, 0xe1, 0x68, 0xff, 0x72, 0xa0, 0x51, + 0x9e, 0x89, 0x5a, 0xb0, 0x7b, 0xd9, 0x1d, 0x9e, 0xdd, 0x74, 0xcf, 0xfa, 0xf1, 0xcd, 0x70, 0x14, + 0xf5, 0x7b, 0x83, 0x2f, 0x83, 0xfe, 0xa9, 0xff, 0x1f, 0xda, 0x02, 0xb7, 0x17, 0x45, 0xbe, 0x83, + 0x3c, 0xd8, 0xea, 0xc5, 0xa3, 0xf3, 0x2e, 0x8e, 0xfc, 0x1a, 0x02, 0xd8, 0xec, 0x63, 0xed, 0xf0, + 0x5d, 0xbd, 0x38, 0xbb, 0x8a, 0x4d, 0x53, 0x47, 0x0d, 0xa8, 0x5f, 0x74, 0x6f, 0xbb, 0xfe, 0x86, + 0x1e, 0x0f, 0xaf, 0x4e, 0xfb, 0xf1, 0xc5, 0xc8, 0xdf, 0xd4, 0x94, 0xe8, 0x3c, 0xf2, 0xb7, 0xb4, + 0x31, 0xba, 0xbb, 0x3e, 0xbf, 0x1a, 0xfa, 0x0d, 0xad, 0xc5, 0x37, 0x27, 0x77, 0x7e, 0xb3, 0xfd, + 0x06, 0xbc, 0xca, 0x4b, 0x44, 0x08, 0xea, 0x95, 0xab, 0x34, 0xf5, 0xc9, 0x0f, 0x78, 0x4b, 0xf9, + 0xda, 0x44, 0x4f, 0xbc, 0x9e, 0x29, 0x23, 0xbd, 0x8c, 0x9c, 0xaf, 0x83, 0x94, 0xaa, 0x87, 0x7c, + 0xac, 0x05, 0xa1, 0xf5, 0x75, 0x28, 0x93, 0x4a, 0xe4, 0x19, 0x61, 0x2a, 0x51, 0x94, 0xb3, 0x70, + 0x85, 0xec, 0xd8, 0x9f, 0x4b, 0x4a, 0x58, 0x27, 0x7d, 0xf2, 0x8f, 0x19, 0x6f, 0x9a, 0xed, 0xf1, + 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0xe5, 0x77, 0x76, 0x8e, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go new file mode 100644 index 00000000..801212d9 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/metrics/v1/metrics_service.pb.go @@ -0,0 +1,264 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/agent/metrics/v1/metrics_service.proto + +package v1 + +import ( + context "context" + fmt "fmt" + v1 "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1" + v11 "github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1" + v12 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +type ExportMetricsServiceRequest struct { + // This is required only in the first message on the stream or if the + // previous sent ExportMetricsServiceRequest message has a different Node (e.g. + // when the same RPC is used to send Metrics from multiple Applications). + Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` + // A list of metrics that belong to the last received Node. + Metrics []*v11.Metric `protobuf:"bytes,2,rep,name=metrics,proto3" json:"metrics,omitempty"` + // The resource for the metrics in this message that do not have an explicit + // resource set. + // If unset, the most recently set resource in the RPC stream applies. It is + // valid to never be set within a stream, e.g. when no resource info is known + // at all or when all sent metrics have an explicit resource set. + Resource *v12.Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportMetricsServiceRequest) Reset() { *m = ExportMetricsServiceRequest{} } +func (m *ExportMetricsServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ExportMetricsServiceRequest) ProtoMessage() {} +func (*ExportMetricsServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_47e253a956287d04, []int{0} +} + +func (m *ExportMetricsServiceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportMetricsServiceRequest.Unmarshal(m, b) +} +func (m *ExportMetricsServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportMetricsServiceRequest.Marshal(b, m, deterministic) +} +func (m *ExportMetricsServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceRequest.Merge(m, src) +} +func (m *ExportMetricsServiceRequest) XXX_Size() int { + return xxx_messageInfo_ExportMetricsServiceRequest.Size(m) +} +func (m *ExportMetricsServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportMetricsServiceRequest proto.InternalMessageInfo + +func (m *ExportMetricsServiceRequest) GetNode() *v1.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *ExportMetricsServiceRequest) GetMetrics() []*v11.Metric { + if m != nil { + return m.Metrics + } + return nil +} + +func (m *ExportMetricsServiceRequest) GetResource() *v12.Resource { + if m != nil { + return m.Resource + } + return nil +} + +type ExportMetricsServiceResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportMetricsServiceResponse) Reset() { *m = ExportMetricsServiceResponse{} } +func (m *ExportMetricsServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ExportMetricsServiceResponse) ProtoMessage() {} +func (*ExportMetricsServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_47e253a956287d04, []int{1} +} + +func (m *ExportMetricsServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportMetricsServiceResponse.Unmarshal(m, b) +} +func (m *ExportMetricsServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportMetricsServiceResponse.Marshal(b, m, deterministic) +} +func (m *ExportMetricsServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportMetricsServiceResponse.Merge(m, src) +} +func (m *ExportMetricsServiceResponse) XXX_Size() int { + return xxx_messageInfo_ExportMetricsServiceResponse.Size(m) +} +func (m *ExportMetricsServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportMetricsServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportMetricsServiceResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*ExportMetricsServiceRequest)(nil), "opencensus.proto.agent.metrics.v1.ExportMetricsServiceRequest") + proto.RegisterType((*ExportMetricsServiceResponse)(nil), "opencensus.proto.agent.metrics.v1.ExportMetricsServiceResponse") +} + +func init() { + proto.RegisterFile("opencensus/proto/agent/metrics/v1/metrics_service.proto", fileDescriptor_47e253a956287d04) +} + +var fileDescriptor_47e253a956287d04 = []byte{ + // 340 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x92, 0xc1, 0x4a, 0xf3, 0x40, + 0x14, 0x85, 0xff, 0xf9, 0x2b, 0x55, 0xa6, 0xe0, 0x62, 0xdc, 0x94, 0x2a, 0x52, 0xab, 0x48, 0x45, + 0x32, 0x63, 0xea, 0x42, 0x10, 0x54, 0x28, 0xb8, 0x11, 0x94, 0x12, 0x77, 0x6e, 0xa4, 0x4d, 0x2f, + 0x71, 0x16, 0x99, 0x1b, 0x67, 0x26, 0xc1, 0x57, 0x70, 0xe5, 0x3b, 0xf8, 0x5c, 0x3e, 0x8c, 0x24, + 0x93, 0xb4, 0x94, 0x18, 0x0b, 0xee, 0x2e, 0x99, 0xf3, 0x9d, 0x9c, 0x33, 0x73, 0xe9, 0x05, 0x26, + 0xa0, 0x42, 0x50, 0x26, 0x35, 0x22, 0xd1, 0x68, 0x51, 0x4c, 0x23, 0x50, 0x56, 0xc4, 0x60, 0xb5, + 0x0c, 0x8d, 0xc8, 0xfc, 0x6a, 0x7c, 0x36, 0xa0, 0x33, 0x19, 0x02, 0x2f, 0x64, 0xec, 0x60, 0x09, + 0xba, 0x2f, 0xbc, 0x00, 0x79, 0xa9, 0xe6, 0x99, 0xdf, 0xf3, 0x1a, 0xbc, 0x43, 0x8c, 0x63, 0x54, + 0xb9, 0xb5, 0x9b, 0x1c, 0xdf, 0x3b, 0xa9, 0xc9, 0xeb, 0x21, 0x4a, 0xe9, 0x69, 0x4d, 0xaa, 0xc1, + 0x60, 0xaa, 0x43, 0xc8, 0xb5, 0xd5, 0xec, 0xc4, 0x83, 0x2f, 0x42, 0x77, 0x6f, 0xdf, 0x12, 0xd4, + 0xf6, 0xde, 0x99, 0x3c, 0xba, 0x22, 0x01, 0xbc, 0xa6, 0x60, 0x2c, 0xbb, 0xa4, 0x1b, 0x0a, 0xe7, + 0xd0, 0x25, 0x7d, 0x32, 0xec, 0x8c, 0x8e, 0x79, 0x43, 0xb1, 0x32, 0x6b, 0xe6, 0xf3, 0x07, 0x9c, + 0x43, 0x50, 0x30, 0xec, 0x8a, 0x6e, 0x96, 0xc9, 0xba, 0xff, 0xfb, 0xad, 0x61, 0x67, 0x74, 0x58, + 0xc7, 0x97, 0x37, 0xc2, 0x5d, 0x80, 0xa0, 0x62, 0xd8, 0x98, 0x6e, 0x55, 0x61, 0xbb, 0xad, 0xa6, + 0xdf, 0x2f, 0xea, 0x64, 0x3e, 0x0f, 0xca, 0x39, 0x58, 0x70, 0x83, 0x7d, 0xba, 0xf7, 0x73, 0x3b, + 0x93, 0xa0, 0x32, 0x30, 0xfa, 0x24, 0x74, 0x7b, 0xf5, 0x88, 0x7d, 0x10, 0xda, 0x76, 0x0c, 0xbb, + 0xe6, 0x6b, 0xdf, 0x91, 0xff, 0x72, 0x79, 0xbd, 0x9b, 0x3f, 0xf3, 0x2e, 0xde, 0xe0, 0xdf, 0x90, + 0x9c, 0x91, 0xf1, 0x3b, 0xa1, 0x47, 0x12, 0xd7, 0x7b, 0x8d, 0x77, 0x56, 0x6d, 0x26, 0xb9, 0x6a, + 0x42, 0x9e, 0xee, 0x22, 0x69, 0x5f, 0xd2, 0x59, 0xfe, 0x48, 0xc2, 0x19, 0x78, 0x52, 0x19, 0xab, + 0xd3, 0x18, 0x94, 0x9d, 0x5a, 0x89, 0x4a, 0x2c, 0xbd, 0x3d, 0xb7, 0x32, 0x11, 0x28, 0x2f, 0xaa, + 0xef, 0xfb, 0xac, 0x5d, 0x1c, 0x9f, 0x7f, 0x07, 0x00, 0x00, 0xff, 0xff, 0x16, 0x61, 0x3b, 0xc3, + 0x1b, 0x03, 0x00, 0x00, +} + +// 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 + +// MetricsServiceClient is the client API for MetricsService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type MetricsServiceClient interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(ctx context.Context, opts ...grpc.CallOption) (MetricsService_ExportClient, error) +} + +type metricsServiceClient struct { + cc *grpc.ClientConn +} + +func NewMetricsServiceClient(cc *grpc.ClientConn) MetricsServiceClient { + return &metricsServiceClient{cc} +} + +func (c *metricsServiceClient) Export(ctx context.Context, opts ...grpc.CallOption) (MetricsService_ExportClient, error) { + stream, err := c.cc.NewStream(ctx, &_MetricsService_serviceDesc.Streams[0], "/opencensus.proto.agent.metrics.v1.MetricsService/Export", opts...) + if err != nil { + return nil, err + } + x := &metricsServiceExportClient{stream} + return x, nil +} + +type MetricsService_ExportClient interface { + Send(*ExportMetricsServiceRequest) error + Recv() (*ExportMetricsServiceResponse, error) + grpc.ClientStream +} + +type metricsServiceExportClient struct { + grpc.ClientStream +} + +func (x *metricsServiceExportClient) Send(m *ExportMetricsServiceRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *metricsServiceExportClient) Recv() (*ExportMetricsServiceResponse, error) { + m := new(ExportMetricsServiceResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// MetricsServiceServer is the server API for MetricsService service. +type MetricsServiceServer interface { + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(MetricsService_ExportServer) error +} + +func RegisterMetricsServiceServer(s *grpc.Server, srv MetricsServiceServer) { + s.RegisterService(&_MetricsService_serviceDesc, srv) +} + +func _MetricsService_Export_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(MetricsServiceServer).Export(&metricsServiceExportServer{stream}) +} + +type MetricsService_ExportServer interface { + Send(*ExportMetricsServiceResponse) error + Recv() (*ExportMetricsServiceRequest, error) + grpc.ServerStream +} + +type metricsServiceExportServer struct { + grpc.ServerStream +} + +func (x *metricsServiceExportServer) Send(m *ExportMetricsServiceResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *metricsServiceExportServer) Recv() (*ExportMetricsServiceRequest, error) { + m := new(ExportMetricsServiceRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _MetricsService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "opencensus.proto.agent.metrics.v1.MetricsService", + HandlerType: (*MetricsServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Export", + Handler: _MetricsService_Export_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "opencensus/proto/agent/metrics/v1/metrics_service.proto", +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go new file mode 100644 index 00000000..e7c49a38 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.go @@ -0,0 +1,443 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/agent/trace/v1/trace_service.proto + +package v1 + +import ( + context "context" + fmt "fmt" + v1 "github.com/census-instrumentation/opencensus-proto/gen-go/agent/common/v1" + v12 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" + v11 "github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1" + proto "github.com/golang/protobuf/proto" + grpc "google.golang.org/grpc" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +type CurrentLibraryConfig struct { + // This is required only in the first message on the stream or if the + // previous sent CurrentLibraryConfig message has a different Node (e.g. + // when the same RPC is used to configure multiple Applications). + Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` + // Current configuration. + Config *v11.TraceConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CurrentLibraryConfig) Reset() { *m = CurrentLibraryConfig{} } +func (m *CurrentLibraryConfig) String() string { return proto.CompactTextString(m) } +func (*CurrentLibraryConfig) ProtoMessage() {} +func (*CurrentLibraryConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_7027f99caf7ac6a5, []int{0} +} + +func (m *CurrentLibraryConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_CurrentLibraryConfig.Unmarshal(m, b) +} +func (m *CurrentLibraryConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CurrentLibraryConfig.Marshal(b, m, deterministic) +} +func (m *CurrentLibraryConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_CurrentLibraryConfig.Merge(m, src) +} +func (m *CurrentLibraryConfig) XXX_Size() int { + return xxx_messageInfo_CurrentLibraryConfig.Size(m) +} +func (m *CurrentLibraryConfig) XXX_DiscardUnknown() { + xxx_messageInfo_CurrentLibraryConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_CurrentLibraryConfig proto.InternalMessageInfo + +func (m *CurrentLibraryConfig) GetNode() *v1.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *CurrentLibraryConfig) GetConfig() *v11.TraceConfig { + if m != nil { + return m.Config + } + return nil +} + +type UpdatedLibraryConfig struct { + // This field is ignored when the RPC is used to configure only one Application. + // This is required only in the first message on the stream or if the + // previous sent UpdatedLibraryConfig message has a different Node. + Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` + // Requested updated configuration. + Config *v11.TraceConfig `protobuf:"bytes,2,opt,name=config,proto3" json:"config,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UpdatedLibraryConfig) Reset() { *m = UpdatedLibraryConfig{} } +func (m *UpdatedLibraryConfig) String() string { return proto.CompactTextString(m) } +func (*UpdatedLibraryConfig) ProtoMessage() {} +func (*UpdatedLibraryConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_7027f99caf7ac6a5, []int{1} +} + +func (m *UpdatedLibraryConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UpdatedLibraryConfig.Unmarshal(m, b) +} +func (m *UpdatedLibraryConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UpdatedLibraryConfig.Marshal(b, m, deterministic) +} +func (m *UpdatedLibraryConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_UpdatedLibraryConfig.Merge(m, src) +} +func (m *UpdatedLibraryConfig) XXX_Size() int { + return xxx_messageInfo_UpdatedLibraryConfig.Size(m) +} +func (m *UpdatedLibraryConfig) XXX_DiscardUnknown() { + xxx_messageInfo_UpdatedLibraryConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_UpdatedLibraryConfig proto.InternalMessageInfo + +func (m *UpdatedLibraryConfig) GetNode() *v1.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *UpdatedLibraryConfig) GetConfig() *v11.TraceConfig { + if m != nil { + return m.Config + } + return nil +} + +type ExportTraceServiceRequest struct { + // This is required only in the first message on the stream or if the + // previous sent ExportTraceServiceRequest message has a different Node (e.g. + // when the same RPC is used to send Spans from multiple Applications). + Node *v1.Node `protobuf:"bytes,1,opt,name=node,proto3" json:"node,omitempty"` + // A list of Spans that belong to the last received Node. + Spans []*v11.Span `protobuf:"bytes,2,rep,name=spans,proto3" json:"spans,omitempty"` + // The resource for the spans in this message that do not have an explicit + // resource set. + // If unset, the most recently set resource in the RPC stream applies. It is + // valid to never be set within a stream, e.g. when no resource info is known. + Resource *v12.Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportTraceServiceRequest) Reset() { *m = ExportTraceServiceRequest{} } +func (m *ExportTraceServiceRequest) String() string { return proto.CompactTextString(m) } +func (*ExportTraceServiceRequest) ProtoMessage() {} +func (*ExportTraceServiceRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_7027f99caf7ac6a5, []int{2} +} + +func (m *ExportTraceServiceRequest) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportTraceServiceRequest.Unmarshal(m, b) +} +func (m *ExportTraceServiceRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportTraceServiceRequest.Marshal(b, m, deterministic) +} +func (m *ExportTraceServiceRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceRequest.Merge(m, src) +} +func (m *ExportTraceServiceRequest) XXX_Size() int { + return xxx_messageInfo_ExportTraceServiceRequest.Size(m) +} +func (m *ExportTraceServiceRequest) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportTraceServiceRequest proto.InternalMessageInfo + +func (m *ExportTraceServiceRequest) GetNode() *v1.Node { + if m != nil { + return m.Node + } + return nil +} + +func (m *ExportTraceServiceRequest) GetSpans() []*v11.Span { + if m != nil { + return m.Spans + } + return nil +} + +func (m *ExportTraceServiceRequest) GetResource() *v12.Resource { + if m != nil { + return m.Resource + } + return nil +} + +type ExportTraceServiceResponse struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExportTraceServiceResponse) Reset() { *m = ExportTraceServiceResponse{} } +func (m *ExportTraceServiceResponse) String() string { return proto.CompactTextString(m) } +func (*ExportTraceServiceResponse) ProtoMessage() {} +func (*ExportTraceServiceResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_7027f99caf7ac6a5, []int{3} +} + +func (m *ExportTraceServiceResponse) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExportTraceServiceResponse.Unmarshal(m, b) +} +func (m *ExportTraceServiceResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExportTraceServiceResponse.Marshal(b, m, deterministic) +} +func (m *ExportTraceServiceResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExportTraceServiceResponse.Merge(m, src) +} +func (m *ExportTraceServiceResponse) XXX_Size() int { + return xxx_messageInfo_ExportTraceServiceResponse.Size(m) +} +func (m *ExportTraceServiceResponse) XXX_DiscardUnknown() { + xxx_messageInfo_ExportTraceServiceResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_ExportTraceServiceResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*CurrentLibraryConfig)(nil), "opencensus.proto.agent.trace.v1.CurrentLibraryConfig") + proto.RegisterType((*UpdatedLibraryConfig)(nil), "opencensus.proto.agent.trace.v1.UpdatedLibraryConfig") + proto.RegisterType((*ExportTraceServiceRequest)(nil), "opencensus.proto.agent.trace.v1.ExportTraceServiceRequest") + proto.RegisterType((*ExportTraceServiceResponse)(nil), "opencensus.proto.agent.trace.v1.ExportTraceServiceResponse") +} + +func init() { + proto.RegisterFile("opencensus/proto/agent/trace/v1/trace_service.proto", fileDescriptor_7027f99caf7ac6a5) +} + +var fileDescriptor_7027f99caf7ac6a5 = []byte{ + // 423 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x54, 0xbf, 0x6b, 0xdb, 0x40, + 0x14, 0xee, 0xd9, 0xad, 0x28, 0xe7, 0x2e, 0x15, 0x1d, 0x54, 0x51, 0xb0, 0x11, 0xb4, 0x18, 0x5a, + 0x9d, 0x2a, 0x1b, 0x2f, 0x2e, 0x74, 0xb0, 0x29, 0x74, 0x28, 0xc5, 0xc8, 0xed, 0x92, 0xc5, 0xc8, + 0xd2, 0x8b, 0xa2, 0xc1, 0x77, 0xca, 0xdd, 0x49, 0x24, 0x90, 0x2d, 0x43, 0xf6, 0x0c, 0xf9, 0xc3, + 0xf2, 0x17, 0x05, 0xdd, 0xc9, 0x3f, 0x12, 0x5b, 0x11, 0x24, 0x4b, 0xb6, 0x87, 0xde, 0xf7, 0x7d, + 0xf7, 0xbd, 0x7b, 0xdf, 0x09, 0x0f, 0x59, 0x06, 0x34, 0x02, 0x2a, 0x72, 0xe1, 0x65, 0x9c, 0x49, + 0xe6, 0x85, 0x09, 0x50, 0xe9, 0x49, 0x1e, 0x46, 0xe0, 0x15, 0xbe, 0x2e, 0x16, 0x02, 0x78, 0x91, + 0x46, 0x40, 0x14, 0xc4, 0xec, 0x6e, 0x49, 0xfa, 0x0b, 0x51, 0x24, 0xa2, 0xb0, 0xa4, 0xf0, 0x6d, + 0xb7, 0x46, 0x35, 0x62, 0xab, 0x15, 0xa3, 0xa5, 0xac, 0xae, 0x34, 0xdb, 0xfe, 0xba, 0x07, 0xe7, + 0x20, 0x58, 0xce, 0xb5, 0x83, 0x75, 0x5d, 0x81, 0x3f, 0xef, 0x81, 0xef, 0x7b, 0xad, 0x60, 0xdf, + 0x1a, 0x60, 0x8b, 0x88, 0xd1, 0xe3, 0x34, 0xd1, 0x68, 0xe7, 0x1a, 0xe1, 0x0f, 0xd3, 0x9c, 0x73, + 0xa0, 0xf2, 0x4f, 0xba, 0xe4, 0x21, 0x3f, 0x9f, 0xaa, 0xb6, 0x39, 0xc6, 0xaf, 0x29, 0x8b, 0xc1, + 0x42, 0x3d, 0xd4, 0xef, 0x0c, 0xbe, 0x90, 0x9a, 0xc9, 0xab, 0x71, 0x0a, 0x9f, 0xfc, 0x65, 0x31, + 0x04, 0x8a, 0x63, 0xfe, 0xc4, 0x86, 0x3e, 0xc4, 0x6a, 0xd5, 0xb1, 0xd7, 0x37, 0x46, 0xfe, 0x95, + 0x85, 0x3e, 0x33, 0xa8, 0x58, 0xca, 0xd4, 0xff, 0x2c, 0x0e, 0x25, 0xc4, 0x2f, 0xc7, 0xd4, 0x2d, + 0xc2, 0x1f, 0x7f, 0x9d, 0x65, 0x8c, 0x4b, 0xd5, 0x9d, 0xeb, 0x60, 0x04, 0x70, 0x9a, 0x83, 0x90, + 0xcf, 0x72, 0x36, 0xc2, 0x6f, 0x44, 0x16, 0x52, 0x61, 0xb5, 0x7a, 0xed, 0x7e, 0x67, 0xd0, 0x7d, + 0xc4, 0xd8, 0x3c, 0x0b, 0x69, 0xa0, 0xd1, 0xe6, 0x04, 0xbf, 0x5d, 0x27, 0xc4, 0x6a, 0xd7, 0x1d, + 0xbb, 0xc9, 0x50, 0xe1, 0x93, 0xa0, 0xaa, 0x83, 0x0d, 0xcf, 0xf9, 0x84, 0xed, 0x43, 0x33, 0x89, + 0x8c, 0x51, 0x01, 0x83, 0x9b, 0x16, 0x7e, 0xb7, 0xdb, 0x30, 0x2f, 0xb0, 0x51, 0x6d, 0x62, 0x44, + 0x1a, 0x9e, 0x02, 0x39, 0x94, 0x2a, 0xbb, 0x99, 0x76, 0x68, 0xef, 0xce, 0xab, 0x3e, 0xfa, 0x8e, + 0xcc, 0x2b, 0x84, 0x0d, 0xed, 0xd6, 0x1c, 0x37, 0xea, 0xd4, 0xae, 0xca, 0xfe, 0xf1, 0x24, 0xae, + 0xbe, 0x12, 0xed, 0x64, 0x72, 0x89, 0xb0, 0x93, 0xb2, 0x26, 0x9d, 0xc9, 0xfb, 0x5d, 0x89, 0x59, + 0x89, 0x98, 0xa1, 0xa3, 0xdf, 0x49, 0x2a, 0x4f, 0xf2, 0x65, 0x19, 0x05, 0x4f, 0x93, 0xdd, 0x94, + 0x0a, 0xc9, 0xf3, 0x15, 0x50, 0x19, 0xca, 0x94, 0x51, 0x6f, 0xab, 0xeb, 0xea, 0x17, 0x9c, 0x00, + 0x75, 0x93, 0x87, 0x7f, 0xa8, 0xa5, 0xa1, 0x9a, 0xc3, 0xbb, 0x00, 0x00, 0x00, 0xff, 0xff, 0xcf, + 0x9c, 0x9b, 0xf7, 0xcb, 0x04, 0x00, 0x00, +} + +// 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 + +// TraceServiceClient is the client API for TraceService service. +// +// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. +type TraceServiceClient interface { + // After initialization, this RPC must be kept alive for the entire life of + // the application. The agent pushes configs down to applications via a + // stream. + Config(ctx context.Context, opts ...grpc.CallOption) (TraceService_ConfigClient, error) + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(ctx context.Context, opts ...grpc.CallOption) (TraceService_ExportClient, error) +} + +type traceServiceClient struct { + cc *grpc.ClientConn +} + +func NewTraceServiceClient(cc *grpc.ClientConn) TraceServiceClient { + return &traceServiceClient{cc} +} + +func (c *traceServiceClient) Config(ctx context.Context, opts ...grpc.CallOption) (TraceService_ConfigClient, error) { + stream, err := c.cc.NewStream(ctx, &_TraceService_serviceDesc.Streams[0], "/opencensus.proto.agent.trace.v1.TraceService/Config", opts...) + if err != nil { + return nil, err + } + x := &traceServiceConfigClient{stream} + return x, nil +} + +type TraceService_ConfigClient interface { + Send(*CurrentLibraryConfig) error + Recv() (*UpdatedLibraryConfig, error) + grpc.ClientStream +} + +type traceServiceConfigClient struct { + grpc.ClientStream +} + +func (x *traceServiceConfigClient) Send(m *CurrentLibraryConfig) error { + return x.ClientStream.SendMsg(m) +} + +func (x *traceServiceConfigClient) Recv() (*UpdatedLibraryConfig, error) { + m := new(UpdatedLibraryConfig) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func (c *traceServiceClient) Export(ctx context.Context, opts ...grpc.CallOption) (TraceService_ExportClient, error) { + stream, err := c.cc.NewStream(ctx, &_TraceService_serviceDesc.Streams[1], "/opencensus.proto.agent.trace.v1.TraceService/Export", opts...) + if err != nil { + return nil, err + } + x := &traceServiceExportClient{stream} + return x, nil +} + +type TraceService_ExportClient interface { + Send(*ExportTraceServiceRequest) error + Recv() (*ExportTraceServiceResponse, error) + grpc.ClientStream +} + +type traceServiceExportClient struct { + grpc.ClientStream +} + +func (x *traceServiceExportClient) Send(m *ExportTraceServiceRequest) error { + return x.ClientStream.SendMsg(m) +} + +func (x *traceServiceExportClient) Recv() (*ExportTraceServiceResponse, error) { + m := new(ExportTraceServiceResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// TraceServiceServer is the server API for TraceService service. +type TraceServiceServer interface { + // After initialization, this RPC must be kept alive for the entire life of + // the application. The agent pushes configs down to applications via a + // stream. + Config(TraceService_ConfigServer) error + // For performance reasons, it is recommended to keep this RPC + // alive for the entire life of the application. + Export(TraceService_ExportServer) error +} + +func RegisterTraceServiceServer(s *grpc.Server, srv TraceServiceServer) { + s.RegisterService(&_TraceService_serviceDesc, srv) +} + +func _TraceService_Config_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TraceServiceServer).Config(&traceServiceConfigServer{stream}) +} + +type TraceService_ConfigServer interface { + Send(*UpdatedLibraryConfig) error + Recv() (*CurrentLibraryConfig, error) + grpc.ServerStream +} + +type traceServiceConfigServer struct { + grpc.ServerStream +} + +func (x *traceServiceConfigServer) Send(m *UpdatedLibraryConfig) error { + return x.ServerStream.SendMsg(m) +} + +func (x *traceServiceConfigServer) Recv() (*CurrentLibraryConfig, error) { + m := new(CurrentLibraryConfig) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +func _TraceService_Export_Handler(srv interface{}, stream grpc.ServerStream) error { + return srv.(TraceServiceServer).Export(&traceServiceExportServer{stream}) +} + +type TraceService_ExportServer interface { + Send(*ExportTraceServiceResponse) error + Recv() (*ExportTraceServiceRequest, error) + grpc.ServerStream +} + +type traceServiceExportServer struct { + grpc.ServerStream +} + +func (x *traceServiceExportServer) Send(m *ExportTraceServiceResponse) error { + return x.ServerStream.SendMsg(m) +} + +func (x *traceServiceExportServer) Recv() (*ExportTraceServiceRequest, error) { + m := new(ExportTraceServiceRequest) + if err := x.ServerStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +var _TraceService_serviceDesc = grpc.ServiceDesc{ + ServiceName: "opencensus.proto.agent.trace.v1.TraceService", + HandlerType: (*TraceServiceServer)(nil), + Methods: []grpc.MethodDesc{}, + Streams: []grpc.StreamDesc{ + { + StreamName: "Config", + Handler: _TraceService_Config_Handler, + ServerStreams: true, + ClientStreams: true, + }, + { + StreamName: "Export", + Handler: _TraceService_Export_Handler, + ServerStreams: true, + ClientStreams: true, + }, + }, + Metadata: "opencensus/proto/agent/trace/v1/trace_service.proto", +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go new file mode 100644 index 00000000..bd4b8a82 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/agent/trace/v1/trace_service.pb.gw.go @@ -0,0 +1,154 @@ +// Code generated by protoc-gen-grpc-gateway. DO NOT EDIT. +// source: opencensus/proto/agent/trace/v1/trace_service.proto + +/* +Package v1 is a reverse proxy. + +It translates gRPC into RESTful JSON APIs. +*/ +package v1 + +import ( + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "golang.org/x/net/context" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +var _ codes.Code +var _ io.Reader +var _ status.Status +var _ = runtime.String +var _ = utilities.NewDoubleArray + +func request_TraceService_Export_0(ctx context.Context, marshaler runtime.Marshaler, client TraceServiceClient, req *http.Request, pathParams map[string]string) (TraceService_ExportClient, runtime.ServerMetadata, error) { + var metadata runtime.ServerMetadata + stream, err := client.Export(ctx) + if err != nil { + grpclog.Infof("Failed to start streaming: %v", err) + return nil, metadata, err + } + newReader, berr := utilities.IOReaderFactory(req.Body) + if berr != nil { + return nil, metadata, berr + } + dec := marshaler.NewDecoder(newReader()) + handleSend := func() error { + var protoReq ExportTraceServiceRequest + err := dec.Decode(&protoReq) + if err == io.EOF { + return err + } + if err != nil { + grpclog.Infof("Failed to decode request: %v", err) + return err + } + if err := stream.Send(&protoReq); err != nil { + grpclog.Infof("Failed to send request: %v", err) + return err + } + return nil + } + if err := handleSend(); err != nil { + if cerr := stream.CloseSend(); cerr != nil { + grpclog.Infof("Failed to terminate client stream: %v", cerr) + } + if err == io.EOF { + return stream, metadata, nil + } + return nil, metadata, err + } + go func() { + for { + if err := handleSend(); err != nil { + break + } + } + if err := stream.CloseSend(); err != nil { + grpclog.Infof("Failed to terminate client stream: %v", err) + } + }() + header, err := stream.Header() + if err != nil { + grpclog.Infof("Failed to get header from client: %v", err) + return nil, metadata, err + } + metadata.HeaderMD = header + return stream, metadata, nil +} + +// RegisterTraceServiceHandlerFromEndpoint is same as RegisterTraceServiceHandler but +// automatically dials to "endpoint" and closes the connection when "ctx" gets done. +func RegisterTraceServiceHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error) { + conn, err := grpc.Dial(endpoint, opts...) + if err != nil { + return err + } + defer func() { + if err != nil { + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + return + } + go func() { + <-ctx.Done() + if cerr := conn.Close(); cerr != nil { + grpclog.Infof("Failed to close conn to %s: %v", endpoint, cerr) + } + }() + }() + + return RegisterTraceServiceHandler(ctx, mux, conn) +} + +// RegisterTraceServiceHandler registers the http handlers for service TraceService to "mux". +// The handlers forward requests to the grpc endpoint over "conn". +func RegisterTraceServiceHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error { + return RegisterTraceServiceHandlerClient(ctx, mux, NewTraceServiceClient(conn)) +} + +// RegisterTraceServiceHandlerClient registers the http handlers for service TraceService +// to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "TraceServiceClient". +// Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "TraceServiceClient" +// doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in +// "TraceServiceClient" to call the correct interceptors. +func RegisterTraceServiceHandlerClient(ctx context.Context, mux *runtime.ServeMux, client TraceServiceClient) error { + + mux.Handle("POST", pattern_TraceService_Export_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_TraceService_Export_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_TraceService_Export_0(ctx, mux, outboundMarshaler, w, req, func() (proto.Message, error) { return resp.Recv() }, mux.GetForwardResponseOptions()...) + + }) + + return nil +} + +var ( + pattern_TraceService_Export_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v1", "trace"}, "")) +) + +var ( + forward_TraceService_Export_0 = runtime.ForwardResponseStream +) diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go new file mode 100644 index 00000000..53b8aa99 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/metrics/v1/metrics.pb.go @@ -0,0 +1,1126 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/metrics/v1/metrics.proto + +package v1 + +import ( + fmt "fmt" + v1 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" + proto "github.com/golang/protobuf/proto" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// The kind of metric. It describes how the data is reported. +// +// A gauge is an instantaneous measurement of a value. +// +// A cumulative measurement is a value accumulated over a time interval. In +// a time series, cumulative measurements should have the same start time, +// increasing values and increasing end times, until an event resets the +// cumulative value to zero and sets a new start time for the following +// points. +type MetricDescriptor_Type int32 + +const ( + // Do not use this default value. + MetricDescriptor_UNSPECIFIED MetricDescriptor_Type = 0 + // Integer gauge. The value can go both up and down. + MetricDescriptor_GAUGE_INT64 MetricDescriptor_Type = 1 + // Floating point gauge. The value can go both up and down. + MetricDescriptor_GAUGE_DOUBLE MetricDescriptor_Type = 2 + // Distribution gauge measurement. The count and sum can go both up and + // down. Recorded values are always >= 0. + // Used in scenarios like a snapshot of time the current items in a queue + // have spent there. + MetricDescriptor_GAUGE_DISTRIBUTION MetricDescriptor_Type = 3 + // Integer cumulative measurement. The value cannot decrease, if resets + // then the start_time should also be reset. + MetricDescriptor_CUMULATIVE_INT64 MetricDescriptor_Type = 4 + // Floating point cumulative measurement. The value cannot decrease, if + // resets then the start_time should also be reset. Recorded values are + // always >= 0. + MetricDescriptor_CUMULATIVE_DOUBLE MetricDescriptor_Type = 5 + // Distribution cumulative measurement. The count and sum cannot decrease, + // if resets then the start_time should also be reset. + MetricDescriptor_CUMULATIVE_DISTRIBUTION MetricDescriptor_Type = 6 + // Some frameworks implemented Histograms as a summary of observations + // (usually things like request durations and response sizes). While it + // also provides a total count of observations and a sum of all observed + // values, it calculates configurable percentiles over a sliding time + // window. This is not recommended, since it cannot be aggregated. + MetricDescriptor_SUMMARY MetricDescriptor_Type = 7 +) + +var MetricDescriptor_Type_name = map[int32]string{ + 0: "UNSPECIFIED", + 1: "GAUGE_INT64", + 2: "GAUGE_DOUBLE", + 3: "GAUGE_DISTRIBUTION", + 4: "CUMULATIVE_INT64", + 5: "CUMULATIVE_DOUBLE", + 6: "CUMULATIVE_DISTRIBUTION", + 7: "SUMMARY", +} + +var MetricDescriptor_Type_value = map[string]int32{ + "UNSPECIFIED": 0, + "GAUGE_INT64": 1, + "GAUGE_DOUBLE": 2, + "GAUGE_DISTRIBUTION": 3, + "CUMULATIVE_INT64": 4, + "CUMULATIVE_DOUBLE": 5, + "CUMULATIVE_DISTRIBUTION": 6, + "SUMMARY": 7, +} + +func (x MetricDescriptor_Type) String() string { + return proto.EnumName(MetricDescriptor_Type_name, int32(x)) +} + +func (MetricDescriptor_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{1, 0} +} + +// Defines a Metric which has one or more timeseries. +type Metric struct { + // The descriptor of the Metric. + // TODO(issue #152): consider only sending the name of descriptor for + // optimization. + MetricDescriptor *MetricDescriptor `protobuf:"bytes,1,opt,name=metric_descriptor,json=metricDescriptor,proto3" json:"metric_descriptor,omitempty"` + // One or more timeseries for a single metric, where each timeseries has + // one or more points. + Timeseries []*TimeSeries `protobuf:"bytes,2,rep,name=timeseries,proto3" json:"timeseries,omitempty"` + // The resource for the metric. If unset, it may be set to a default value + // provided for a sequence of messages in an RPC stream. + Resource *v1.Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Metric) Reset() { *m = Metric{} } +func (m *Metric) String() string { return proto.CompactTextString(m) } +func (*Metric) ProtoMessage() {} +func (*Metric) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{0} +} + +func (m *Metric) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Metric.Unmarshal(m, b) +} +func (m *Metric) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Metric.Marshal(b, m, deterministic) +} +func (m *Metric) XXX_Merge(src proto.Message) { + xxx_messageInfo_Metric.Merge(m, src) +} +func (m *Metric) XXX_Size() int { + return xxx_messageInfo_Metric.Size(m) +} +func (m *Metric) XXX_DiscardUnknown() { + xxx_messageInfo_Metric.DiscardUnknown(m) +} + +var xxx_messageInfo_Metric proto.InternalMessageInfo + +func (m *Metric) GetMetricDescriptor() *MetricDescriptor { + if m != nil { + return m.MetricDescriptor + } + return nil +} + +func (m *Metric) GetTimeseries() []*TimeSeries { + if m != nil { + return m.Timeseries + } + return nil +} + +func (m *Metric) GetResource() *v1.Resource { + if m != nil { + return m.Resource + } + return nil +} + +// Defines a metric type and its schema. +type MetricDescriptor struct { + // The metric type, including its DNS name prefix. It must be unique. + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // A detailed description of the metric, which can be used in documentation. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + // The unit in which the metric value is reported. Follows the format + // described by http://unitsofmeasure.org/ucum.html. + Unit string `protobuf:"bytes,3,opt,name=unit,proto3" json:"unit,omitempty"` + Type MetricDescriptor_Type `protobuf:"varint,4,opt,name=type,proto3,enum=opencensus.proto.metrics.v1.MetricDescriptor_Type" json:"type,omitempty"` + // The label keys associated with the metric descriptor. + LabelKeys []*LabelKey `protobuf:"bytes,5,rep,name=label_keys,json=labelKeys,proto3" json:"label_keys,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MetricDescriptor) Reset() { *m = MetricDescriptor{} } +func (m *MetricDescriptor) String() string { return proto.CompactTextString(m) } +func (*MetricDescriptor) ProtoMessage() {} +func (*MetricDescriptor) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{1} +} + +func (m *MetricDescriptor) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MetricDescriptor.Unmarshal(m, b) +} +func (m *MetricDescriptor) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MetricDescriptor.Marshal(b, m, deterministic) +} +func (m *MetricDescriptor) XXX_Merge(src proto.Message) { + xxx_messageInfo_MetricDescriptor.Merge(m, src) +} +func (m *MetricDescriptor) XXX_Size() int { + return xxx_messageInfo_MetricDescriptor.Size(m) +} +func (m *MetricDescriptor) XXX_DiscardUnknown() { + xxx_messageInfo_MetricDescriptor.DiscardUnknown(m) +} + +var xxx_messageInfo_MetricDescriptor proto.InternalMessageInfo + +func (m *MetricDescriptor) GetName() string { + if m != nil { + return m.Name + } + return "" +} + +func (m *MetricDescriptor) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +func (m *MetricDescriptor) GetUnit() string { + if m != nil { + return m.Unit + } + return "" +} + +func (m *MetricDescriptor) GetType() MetricDescriptor_Type { + if m != nil { + return m.Type + } + return MetricDescriptor_UNSPECIFIED +} + +func (m *MetricDescriptor) GetLabelKeys() []*LabelKey { + if m != nil { + return m.LabelKeys + } + return nil +} + +// Defines a label key associated with a metric descriptor. +type LabelKey struct { + // The key for the label. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // A human-readable description of what this label key represents. + Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LabelKey) Reset() { *m = LabelKey{} } +func (m *LabelKey) String() string { return proto.CompactTextString(m) } +func (*LabelKey) ProtoMessage() {} +func (*LabelKey) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{2} +} + +func (m *LabelKey) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LabelKey.Unmarshal(m, b) +} +func (m *LabelKey) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LabelKey.Marshal(b, m, deterministic) +} +func (m *LabelKey) XXX_Merge(src proto.Message) { + xxx_messageInfo_LabelKey.Merge(m, src) +} +func (m *LabelKey) XXX_Size() int { + return xxx_messageInfo_LabelKey.Size(m) +} +func (m *LabelKey) XXX_DiscardUnknown() { + xxx_messageInfo_LabelKey.DiscardUnknown(m) +} + +var xxx_messageInfo_LabelKey proto.InternalMessageInfo + +func (m *LabelKey) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *LabelKey) GetDescription() string { + if m != nil { + return m.Description + } + return "" +} + +// A collection of data points that describes the time-varying values +// of a metric. +type TimeSeries struct { + // Must be present for cumulative metrics. The time when the cumulative value + // was reset to zero. Exclusive. The cumulative value is over the time interval + // (start_timestamp, timestamp]. If not specified, the backend can use the + // previous recorded value. + StartTimestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=start_timestamp,json=startTimestamp,proto3" json:"start_timestamp,omitempty"` + // The set of label values that uniquely identify this timeseries. Applies to + // all points. The order of label values must match that of label keys in the + // metric descriptor. + LabelValues []*LabelValue `protobuf:"bytes,2,rep,name=label_values,json=labelValues,proto3" json:"label_values,omitempty"` + // The data points of this timeseries. Point.value type MUST match the + // MetricDescriptor.type. + Points []*Point `protobuf:"bytes,3,rep,name=points,proto3" json:"points,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TimeSeries) Reset() { *m = TimeSeries{} } +func (m *TimeSeries) String() string { return proto.CompactTextString(m) } +func (*TimeSeries) ProtoMessage() {} +func (*TimeSeries) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{3} +} + +func (m *TimeSeries) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TimeSeries.Unmarshal(m, b) +} +func (m *TimeSeries) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TimeSeries.Marshal(b, m, deterministic) +} +func (m *TimeSeries) XXX_Merge(src proto.Message) { + xxx_messageInfo_TimeSeries.Merge(m, src) +} +func (m *TimeSeries) XXX_Size() int { + return xxx_messageInfo_TimeSeries.Size(m) +} +func (m *TimeSeries) XXX_DiscardUnknown() { + xxx_messageInfo_TimeSeries.DiscardUnknown(m) +} + +var xxx_messageInfo_TimeSeries proto.InternalMessageInfo + +func (m *TimeSeries) GetStartTimestamp() *timestamp.Timestamp { + if m != nil { + return m.StartTimestamp + } + return nil +} + +func (m *TimeSeries) GetLabelValues() []*LabelValue { + if m != nil { + return m.LabelValues + } + return nil +} + +func (m *TimeSeries) GetPoints() []*Point { + if m != nil { + return m.Points + } + return nil +} + +type LabelValue struct { + // The value for the label. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + // If false the value field is ignored and considered not set. + // This is used to differentiate a missing label from an empty string. + HasValue bool `protobuf:"varint,2,opt,name=has_value,json=hasValue,proto3" json:"has_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *LabelValue) Reset() { *m = LabelValue{} } +func (m *LabelValue) String() string { return proto.CompactTextString(m) } +func (*LabelValue) ProtoMessage() {} +func (*LabelValue) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{4} +} + +func (m *LabelValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_LabelValue.Unmarshal(m, b) +} +func (m *LabelValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_LabelValue.Marshal(b, m, deterministic) +} +func (m *LabelValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_LabelValue.Merge(m, src) +} +func (m *LabelValue) XXX_Size() int { + return xxx_messageInfo_LabelValue.Size(m) +} +func (m *LabelValue) XXX_DiscardUnknown() { + xxx_messageInfo_LabelValue.DiscardUnknown(m) +} + +var xxx_messageInfo_LabelValue proto.InternalMessageInfo + +func (m *LabelValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *LabelValue) GetHasValue() bool { + if m != nil { + return m.HasValue + } + return false +} + +// A timestamped measurement. +type Point struct { + // The moment when this point was recorded. Inclusive. + // If not specified, the timestamp will be decided by the backend. + Timestamp *timestamp.Timestamp `protobuf:"bytes,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // The actual point value. + // + // Types that are valid to be assigned to Value: + // *Point_Int64Value + // *Point_DoubleValue + // *Point_DistributionValue + // *Point_SummaryValue + Value isPoint_Value `protobuf_oneof:"value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Point) Reset() { *m = Point{} } +func (m *Point) String() string { return proto.CompactTextString(m) } +func (*Point) ProtoMessage() {} +func (*Point) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{5} +} + +func (m *Point) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Point.Unmarshal(m, b) +} +func (m *Point) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Point.Marshal(b, m, deterministic) +} +func (m *Point) XXX_Merge(src proto.Message) { + xxx_messageInfo_Point.Merge(m, src) +} +func (m *Point) XXX_Size() int { + return xxx_messageInfo_Point.Size(m) +} +func (m *Point) XXX_DiscardUnknown() { + xxx_messageInfo_Point.DiscardUnknown(m) +} + +var xxx_messageInfo_Point proto.InternalMessageInfo + +func (m *Point) GetTimestamp() *timestamp.Timestamp { + if m != nil { + return m.Timestamp + } + return nil +} + +type isPoint_Value interface { + isPoint_Value() +} + +type Point_Int64Value struct { + Int64Value int64 `protobuf:"varint,2,opt,name=int64_value,json=int64Value,proto3,oneof"` +} + +type Point_DoubleValue struct { + DoubleValue float64 `protobuf:"fixed64,3,opt,name=double_value,json=doubleValue,proto3,oneof"` +} + +type Point_DistributionValue struct { + DistributionValue *DistributionValue `protobuf:"bytes,4,opt,name=distribution_value,json=distributionValue,proto3,oneof"` +} + +type Point_SummaryValue struct { + SummaryValue *SummaryValue `protobuf:"bytes,5,opt,name=summary_value,json=summaryValue,proto3,oneof"` +} + +func (*Point_Int64Value) isPoint_Value() {} + +func (*Point_DoubleValue) isPoint_Value() {} + +func (*Point_DistributionValue) isPoint_Value() {} + +func (*Point_SummaryValue) isPoint_Value() {} + +func (m *Point) GetValue() isPoint_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *Point) GetInt64Value() int64 { + if x, ok := m.GetValue().(*Point_Int64Value); ok { + return x.Int64Value + } + return 0 +} + +func (m *Point) GetDoubleValue() float64 { + if x, ok := m.GetValue().(*Point_DoubleValue); ok { + return x.DoubleValue + } + return 0 +} + +func (m *Point) GetDistributionValue() *DistributionValue { + if x, ok := m.GetValue().(*Point_DistributionValue); ok { + return x.DistributionValue + } + return nil +} + +func (m *Point) GetSummaryValue() *SummaryValue { + if x, ok := m.GetValue().(*Point_SummaryValue); ok { + return x.SummaryValue + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Point) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Point_Int64Value)(nil), + (*Point_DoubleValue)(nil), + (*Point_DistributionValue)(nil), + (*Point_SummaryValue)(nil), + } +} + +// Distribution contains summary statistics for a population of values. It +// optionally contains a histogram representing the distribution of those +// values across a set of buckets. +type DistributionValue struct { + // The number of values in the population. Must be non-negative. This value + // must equal the sum of the values in bucket_counts if a histogram is + // provided. + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // The sum of the values in the population. If count is zero then this field + // must be zero. + Sum float64 `protobuf:"fixed64,2,opt,name=sum,proto3" json:"sum,omitempty"` + // The sum of squared deviations from the mean of the values in the + // population. For values x_i this is: + // + // Sum[i=1..n]((x_i - mean)^2) + // + // Knuth, "The Art of Computer Programming", Vol. 2, page 323, 3rd edition + // describes Welford's method for accumulating this sum in one pass. + // + // If count is zero then this field must be zero. + SumOfSquaredDeviation float64 `protobuf:"fixed64,3,opt,name=sum_of_squared_deviation,json=sumOfSquaredDeviation,proto3" json:"sum_of_squared_deviation,omitempty"` + // Don't change bucket boundaries within a TimeSeries if your backend doesn't + // support this. + // TODO(issue #152): consider not required to send bucket options for + // optimization. + BucketOptions *DistributionValue_BucketOptions `protobuf:"bytes,4,opt,name=bucket_options,json=bucketOptions,proto3" json:"bucket_options,omitempty"` + // If the distribution does not have a histogram, then omit this field. + // If there is a histogram, then the sum of the values in the Bucket counts + // must equal the value in the count field of the distribution. + Buckets []*DistributionValue_Bucket `protobuf:"bytes,5,rep,name=buckets,proto3" json:"buckets,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DistributionValue) Reset() { *m = DistributionValue{} } +func (m *DistributionValue) String() string { return proto.CompactTextString(m) } +func (*DistributionValue) ProtoMessage() {} +func (*DistributionValue) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{6} +} + +func (m *DistributionValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DistributionValue.Unmarshal(m, b) +} +func (m *DistributionValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DistributionValue.Marshal(b, m, deterministic) +} +func (m *DistributionValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_DistributionValue.Merge(m, src) +} +func (m *DistributionValue) XXX_Size() int { + return xxx_messageInfo_DistributionValue.Size(m) +} +func (m *DistributionValue) XXX_DiscardUnknown() { + xxx_messageInfo_DistributionValue.DiscardUnknown(m) +} + +var xxx_messageInfo_DistributionValue proto.InternalMessageInfo + +func (m *DistributionValue) GetCount() int64 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *DistributionValue) GetSum() float64 { + if m != nil { + return m.Sum + } + return 0 +} + +func (m *DistributionValue) GetSumOfSquaredDeviation() float64 { + if m != nil { + return m.SumOfSquaredDeviation + } + return 0 +} + +func (m *DistributionValue) GetBucketOptions() *DistributionValue_BucketOptions { + if m != nil { + return m.BucketOptions + } + return nil +} + +func (m *DistributionValue) GetBuckets() []*DistributionValue_Bucket { + if m != nil { + return m.Buckets + } + return nil +} + +// A Distribution may optionally contain a histogram of the values in the +// population. The bucket boundaries for that histogram are described by +// BucketOptions. +// +// If bucket_options has no type, then there is no histogram associated with +// the Distribution. +type DistributionValue_BucketOptions struct { + // Types that are valid to be assigned to Type: + // *DistributionValue_BucketOptions_Explicit_ + Type isDistributionValue_BucketOptions_Type `protobuf_oneof:"type"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DistributionValue_BucketOptions) Reset() { *m = DistributionValue_BucketOptions{} } +func (m *DistributionValue_BucketOptions) String() string { return proto.CompactTextString(m) } +func (*DistributionValue_BucketOptions) ProtoMessage() {} +func (*DistributionValue_BucketOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{6, 0} +} + +func (m *DistributionValue_BucketOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DistributionValue_BucketOptions.Unmarshal(m, b) +} +func (m *DistributionValue_BucketOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DistributionValue_BucketOptions.Marshal(b, m, deterministic) +} +func (m *DistributionValue_BucketOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_DistributionValue_BucketOptions.Merge(m, src) +} +func (m *DistributionValue_BucketOptions) XXX_Size() int { + return xxx_messageInfo_DistributionValue_BucketOptions.Size(m) +} +func (m *DistributionValue_BucketOptions) XXX_DiscardUnknown() { + xxx_messageInfo_DistributionValue_BucketOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_DistributionValue_BucketOptions proto.InternalMessageInfo + +type isDistributionValue_BucketOptions_Type interface { + isDistributionValue_BucketOptions_Type() +} + +type DistributionValue_BucketOptions_Explicit_ struct { + Explicit *DistributionValue_BucketOptions_Explicit `protobuf:"bytes,1,opt,name=explicit,proto3,oneof"` +} + +func (*DistributionValue_BucketOptions_Explicit_) isDistributionValue_BucketOptions_Type() {} + +func (m *DistributionValue_BucketOptions) GetType() isDistributionValue_BucketOptions_Type { + if m != nil { + return m.Type + } + return nil +} + +func (m *DistributionValue_BucketOptions) GetExplicit() *DistributionValue_BucketOptions_Explicit { + if x, ok := m.GetType().(*DistributionValue_BucketOptions_Explicit_); ok { + return x.Explicit + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*DistributionValue_BucketOptions) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*DistributionValue_BucketOptions_Explicit_)(nil), + } +} + +// Specifies a set of buckets with arbitrary upper-bounds. +// This defines size(bounds) + 1 (= N) buckets. The boundaries for bucket +// index i are: +// +// [0, bucket_bounds[i]) for i == 0 +// [bucket_bounds[i-1], bucket_bounds[i]) for 0 < i < N-1 +// [bucket_bounds[i], +infinity) for i == N-1 +type DistributionValue_BucketOptions_Explicit struct { + // The values must be strictly increasing and > 0. + Bounds []float64 `protobuf:"fixed64,1,rep,packed,name=bounds,proto3" json:"bounds,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DistributionValue_BucketOptions_Explicit) Reset() { + *m = DistributionValue_BucketOptions_Explicit{} +} +func (m *DistributionValue_BucketOptions_Explicit) String() string { return proto.CompactTextString(m) } +func (*DistributionValue_BucketOptions_Explicit) ProtoMessage() {} +func (*DistributionValue_BucketOptions_Explicit) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{6, 0, 0} +} + +func (m *DistributionValue_BucketOptions_Explicit) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DistributionValue_BucketOptions_Explicit.Unmarshal(m, b) +} +func (m *DistributionValue_BucketOptions_Explicit) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DistributionValue_BucketOptions_Explicit.Marshal(b, m, deterministic) +} +func (m *DistributionValue_BucketOptions_Explicit) XXX_Merge(src proto.Message) { + xxx_messageInfo_DistributionValue_BucketOptions_Explicit.Merge(m, src) +} +func (m *DistributionValue_BucketOptions_Explicit) XXX_Size() int { + return xxx_messageInfo_DistributionValue_BucketOptions_Explicit.Size(m) +} +func (m *DistributionValue_BucketOptions_Explicit) XXX_DiscardUnknown() { + xxx_messageInfo_DistributionValue_BucketOptions_Explicit.DiscardUnknown(m) +} + +var xxx_messageInfo_DistributionValue_BucketOptions_Explicit proto.InternalMessageInfo + +func (m *DistributionValue_BucketOptions_Explicit) GetBounds() []float64 { + if m != nil { + return m.Bounds + } + return nil +} + +type DistributionValue_Bucket struct { + // The number of values in each bucket of the histogram, as described in + // bucket_bounds. + Count int64 `protobuf:"varint,1,opt,name=count,proto3" json:"count,omitempty"` + // If the distribution does not have a histogram, then omit this field. + Exemplar *DistributionValue_Exemplar `protobuf:"bytes,2,opt,name=exemplar,proto3" json:"exemplar,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DistributionValue_Bucket) Reset() { *m = DistributionValue_Bucket{} } +func (m *DistributionValue_Bucket) String() string { return proto.CompactTextString(m) } +func (*DistributionValue_Bucket) ProtoMessage() {} +func (*DistributionValue_Bucket) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{6, 1} +} + +func (m *DistributionValue_Bucket) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DistributionValue_Bucket.Unmarshal(m, b) +} +func (m *DistributionValue_Bucket) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DistributionValue_Bucket.Marshal(b, m, deterministic) +} +func (m *DistributionValue_Bucket) XXX_Merge(src proto.Message) { + xxx_messageInfo_DistributionValue_Bucket.Merge(m, src) +} +func (m *DistributionValue_Bucket) XXX_Size() int { + return xxx_messageInfo_DistributionValue_Bucket.Size(m) +} +func (m *DistributionValue_Bucket) XXX_DiscardUnknown() { + xxx_messageInfo_DistributionValue_Bucket.DiscardUnknown(m) +} + +var xxx_messageInfo_DistributionValue_Bucket proto.InternalMessageInfo + +func (m *DistributionValue_Bucket) GetCount() int64 { + if m != nil { + return m.Count + } + return 0 +} + +func (m *DistributionValue_Bucket) GetExemplar() *DistributionValue_Exemplar { + if m != nil { + return m.Exemplar + } + return nil +} + +// Exemplars are example points that may be used to annotate aggregated +// Distribution values. They are metadata that gives information about a +// particular value added to a Distribution bucket. +type DistributionValue_Exemplar struct { + // Value of the exemplar point. It determines which bucket the exemplar + // belongs to. + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` + // The observation (sampling) time of the above value. + Timestamp *timestamp.Timestamp `protobuf:"bytes,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + // Contextual information about the example value. + Attachments map[string]string `protobuf:"bytes,3,rep,name=attachments,proto3" json:"attachments,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DistributionValue_Exemplar) Reset() { *m = DistributionValue_Exemplar{} } +func (m *DistributionValue_Exemplar) String() string { return proto.CompactTextString(m) } +func (*DistributionValue_Exemplar) ProtoMessage() {} +func (*DistributionValue_Exemplar) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{6, 2} +} + +func (m *DistributionValue_Exemplar) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DistributionValue_Exemplar.Unmarshal(m, b) +} +func (m *DistributionValue_Exemplar) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DistributionValue_Exemplar.Marshal(b, m, deterministic) +} +func (m *DistributionValue_Exemplar) XXX_Merge(src proto.Message) { + xxx_messageInfo_DistributionValue_Exemplar.Merge(m, src) +} +func (m *DistributionValue_Exemplar) XXX_Size() int { + return xxx_messageInfo_DistributionValue_Exemplar.Size(m) +} +func (m *DistributionValue_Exemplar) XXX_DiscardUnknown() { + xxx_messageInfo_DistributionValue_Exemplar.DiscardUnknown(m) +} + +var xxx_messageInfo_DistributionValue_Exemplar proto.InternalMessageInfo + +func (m *DistributionValue_Exemplar) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +func (m *DistributionValue_Exemplar) GetTimestamp() *timestamp.Timestamp { + if m != nil { + return m.Timestamp + } + return nil +} + +func (m *DistributionValue_Exemplar) GetAttachments() map[string]string { + if m != nil { + return m.Attachments + } + return nil +} + +// The start_timestamp only applies to the count and sum in the SummaryValue. +type SummaryValue struct { + // The total number of recorded values since start_time. Optional since + // some systems don't expose this. + Count *wrappers.Int64Value `protobuf:"bytes,1,opt,name=count,proto3" json:"count,omitempty"` + // The total sum of recorded values since start_time. Optional since some + // systems don't expose this. If count is zero then this field must be zero. + // This field must be unset if the sum is not available. + Sum *wrappers.DoubleValue `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` + // Values calculated over an arbitrary time window. + Snapshot *SummaryValue_Snapshot `protobuf:"bytes,3,opt,name=snapshot,proto3" json:"snapshot,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SummaryValue) Reset() { *m = SummaryValue{} } +func (m *SummaryValue) String() string { return proto.CompactTextString(m) } +func (*SummaryValue) ProtoMessage() {} +func (*SummaryValue) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{7} +} + +func (m *SummaryValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SummaryValue.Unmarshal(m, b) +} +func (m *SummaryValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SummaryValue.Marshal(b, m, deterministic) +} +func (m *SummaryValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryValue.Merge(m, src) +} +func (m *SummaryValue) XXX_Size() int { + return xxx_messageInfo_SummaryValue.Size(m) +} +func (m *SummaryValue) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryValue.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryValue proto.InternalMessageInfo + +func (m *SummaryValue) GetCount() *wrappers.Int64Value { + if m != nil { + return m.Count + } + return nil +} + +func (m *SummaryValue) GetSum() *wrappers.DoubleValue { + if m != nil { + return m.Sum + } + return nil +} + +func (m *SummaryValue) GetSnapshot() *SummaryValue_Snapshot { + if m != nil { + return m.Snapshot + } + return nil +} + +// The values in this message can be reset at arbitrary unknown times, with +// the requirement that all of them are reset at the same time. +type SummaryValue_Snapshot struct { + // The number of values in the snapshot. Optional since some systems don't + // expose this. + Count *wrappers.Int64Value `protobuf:"bytes,1,opt,name=count,proto3" json:"count,omitempty"` + // The sum of values in the snapshot. Optional since some systems don't + // expose this. If count is zero then this field must be zero or not set + // (if not supported). + Sum *wrappers.DoubleValue `protobuf:"bytes,2,opt,name=sum,proto3" json:"sum,omitempty"` + // A list of values at different percentiles of the distribution calculated + // from the current snapshot. The percentiles must be strictly increasing. + PercentileValues []*SummaryValue_Snapshot_ValueAtPercentile `protobuf:"bytes,3,rep,name=percentile_values,json=percentileValues,proto3" json:"percentile_values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SummaryValue_Snapshot) Reset() { *m = SummaryValue_Snapshot{} } +func (m *SummaryValue_Snapshot) String() string { return proto.CompactTextString(m) } +func (*SummaryValue_Snapshot) ProtoMessage() {} +func (*SummaryValue_Snapshot) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{7, 0} +} + +func (m *SummaryValue_Snapshot) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SummaryValue_Snapshot.Unmarshal(m, b) +} +func (m *SummaryValue_Snapshot) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SummaryValue_Snapshot.Marshal(b, m, deterministic) +} +func (m *SummaryValue_Snapshot) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryValue_Snapshot.Merge(m, src) +} +func (m *SummaryValue_Snapshot) XXX_Size() int { + return xxx_messageInfo_SummaryValue_Snapshot.Size(m) +} +func (m *SummaryValue_Snapshot) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryValue_Snapshot.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryValue_Snapshot proto.InternalMessageInfo + +func (m *SummaryValue_Snapshot) GetCount() *wrappers.Int64Value { + if m != nil { + return m.Count + } + return nil +} + +func (m *SummaryValue_Snapshot) GetSum() *wrappers.DoubleValue { + if m != nil { + return m.Sum + } + return nil +} + +func (m *SummaryValue_Snapshot) GetPercentileValues() []*SummaryValue_Snapshot_ValueAtPercentile { + if m != nil { + return m.PercentileValues + } + return nil +} + +// Represents the value at a given percentile of a distribution. +type SummaryValue_Snapshot_ValueAtPercentile struct { + // The percentile of a distribution. Must be in the interval + // (0.0, 100.0]. + Percentile float64 `protobuf:"fixed64,1,opt,name=percentile,proto3" json:"percentile,omitempty"` + // The value at the given percentile of a distribution. + Value float64 `protobuf:"fixed64,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SummaryValue_Snapshot_ValueAtPercentile) Reset() { + *m = SummaryValue_Snapshot_ValueAtPercentile{} +} +func (m *SummaryValue_Snapshot_ValueAtPercentile) String() string { return proto.CompactTextString(m) } +func (*SummaryValue_Snapshot_ValueAtPercentile) ProtoMessage() {} +func (*SummaryValue_Snapshot_ValueAtPercentile) Descriptor() ([]byte, []int) { + return fileDescriptor_0ee3deb72053811a, []int{7, 0, 0} +} + +func (m *SummaryValue_Snapshot_ValueAtPercentile) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile.Unmarshal(m, b) +} +func (m *SummaryValue_Snapshot_ValueAtPercentile) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile.Marshal(b, m, deterministic) +} +func (m *SummaryValue_Snapshot_ValueAtPercentile) XXX_Merge(src proto.Message) { + xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile.Merge(m, src) +} +func (m *SummaryValue_Snapshot_ValueAtPercentile) XXX_Size() int { + return xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile.Size(m) +} +func (m *SummaryValue_Snapshot_ValueAtPercentile) XXX_DiscardUnknown() { + xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile.DiscardUnknown(m) +} + +var xxx_messageInfo_SummaryValue_Snapshot_ValueAtPercentile proto.InternalMessageInfo + +func (m *SummaryValue_Snapshot_ValueAtPercentile) GetPercentile() float64 { + if m != nil { + return m.Percentile + } + return 0 +} + +func (m *SummaryValue_Snapshot_ValueAtPercentile) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +func init() { + proto.RegisterEnum("opencensus.proto.metrics.v1.MetricDescriptor_Type", MetricDescriptor_Type_name, MetricDescriptor_Type_value) + proto.RegisterType((*Metric)(nil), "opencensus.proto.metrics.v1.Metric") + proto.RegisterType((*MetricDescriptor)(nil), "opencensus.proto.metrics.v1.MetricDescriptor") + proto.RegisterType((*LabelKey)(nil), "opencensus.proto.metrics.v1.LabelKey") + proto.RegisterType((*TimeSeries)(nil), "opencensus.proto.metrics.v1.TimeSeries") + proto.RegisterType((*LabelValue)(nil), "opencensus.proto.metrics.v1.LabelValue") + proto.RegisterType((*Point)(nil), "opencensus.proto.metrics.v1.Point") + proto.RegisterType((*DistributionValue)(nil), "opencensus.proto.metrics.v1.DistributionValue") + proto.RegisterType((*DistributionValue_BucketOptions)(nil), "opencensus.proto.metrics.v1.DistributionValue.BucketOptions") + proto.RegisterType((*DistributionValue_BucketOptions_Explicit)(nil), "opencensus.proto.metrics.v1.DistributionValue.BucketOptions.Explicit") + proto.RegisterType((*DistributionValue_Bucket)(nil), "opencensus.proto.metrics.v1.DistributionValue.Bucket") + proto.RegisterType((*DistributionValue_Exemplar)(nil), "opencensus.proto.metrics.v1.DistributionValue.Exemplar") + proto.RegisterMapType((map[string]string)(nil), "opencensus.proto.metrics.v1.DistributionValue.Exemplar.AttachmentsEntry") + proto.RegisterType((*SummaryValue)(nil), "opencensus.proto.metrics.v1.SummaryValue") + proto.RegisterType((*SummaryValue_Snapshot)(nil), "opencensus.proto.metrics.v1.SummaryValue.Snapshot") + proto.RegisterType((*SummaryValue_Snapshot_ValueAtPercentile)(nil), "opencensus.proto.metrics.v1.SummaryValue.Snapshot.ValueAtPercentile") +} + +func init() { + proto.RegisterFile("opencensus/proto/metrics/v1/metrics.proto", fileDescriptor_0ee3deb72053811a) +} + +var fileDescriptor_0ee3deb72053811a = []byte{ + // 1098 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xbc, 0x56, 0xdd, 0x6e, 0x1b, 0xc5, + 0x17, 0xcf, 0xda, 0x8e, 0xe3, 0x9c, 0x75, 0xdb, 0xf5, 0xa8, 0xed, 0xdf, 0xda, 0xfc, 0x15, 0xc2, + 0x22, 0x20, 0x15, 0xca, 0x5a, 0x31, 0xa5, 0xad, 0x2a, 0x54, 0x14, 0xc7, 0x6e, 0x62, 0xc8, 0x87, + 0x35, 0xb6, 0x2b, 0xd1, 0x1b, 0x6b, 0xbd, 0x9e, 0x24, 0x4b, 0xbc, 0x1f, 0xdd, 0x99, 0x35, 0xf8, + 0x05, 0x78, 0x04, 0xae, 0xb9, 0x45, 0x3c, 0x07, 0x57, 0x3c, 0x01, 0x4f, 0x81, 0x78, 0x03, 0xb4, + 0x33, 0xb3, 0x1f, 0x89, 0xc1, 0xd4, 0x45, 0xe2, 0xee, 0x9c, 0x33, 0xe7, 0xfc, 0xfc, 0x3b, 0x9f, + 0x5e, 0x78, 0xe4, 0x07, 0xc4, 0xb3, 0x89, 0x47, 0x23, 0xda, 0x08, 0x42, 0x9f, 0xf9, 0x0d, 0x97, + 0xb0, 0xd0, 0xb1, 0x69, 0x63, 0xb6, 0x9f, 0x88, 0x26, 0x7f, 0x40, 0x5b, 0x99, 0xab, 0xb0, 0x98, + 0xc9, 0xfb, 0x6c, 0x5f, 0x7f, 0xef, 0xd2, 0xf7, 0x2f, 0xa7, 0x44, 0x60, 0x8c, 0xa3, 0x8b, 0x06, + 0x73, 0x5c, 0x42, 0x99, 0xe5, 0x06, 0xc2, 0x57, 0xdf, 0xbe, 0xed, 0xf0, 0x6d, 0x68, 0x05, 0x01, + 0x09, 0x25, 0x96, 0xfe, 0xc9, 0x02, 0x91, 0x90, 0x50, 0x3f, 0x0a, 0x6d, 0x12, 0x33, 0x49, 0x64, + 0xe1, 0x6c, 0xfc, 0xa1, 0x40, 0xf9, 0x94, 0xff, 0x38, 0x7a, 0x0d, 0x35, 0x41, 0x63, 0x34, 0x21, + 0xd4, 0x0e, 0x9d, 0x80, 0xf9, 0x61, 0x5d, 0xd9, 0x51, 0x76, 0xd5, 0xe6, 0x9e, 0xb9, 0x84, 0xb1, + 0x29, 0xe2, 0xdb, 0x69, 0x10, 0xd6, 0xdc, 0x5b, 0x16, 0x74, 0x04, 0xc0, 0xd3, 0x20, 0xa1, 0x43, + 0x68, 0xbd, 0xb0, 0x53, 0xdc, 0x55, 0x9b, 0x1f, 0x2f, 0x05, 0x1d, 0x38, 0x2e, 0xe9, 0x73, 0x77, + 0x9c, 0x0b, 0x45, 0x2d, 0xa8, 0x24, 0x19, 0xd4, 0x8b, 0x9c, 0xdb, 0x47, 0x8b, 0x30, 0x69, 0x8e, + 0xb3, 0x7d, 0x13, 0x4b, 0x19, 0xa7, 0x71, 0xc6, 0x0f, 0x45, 0xd0, 0x6e, 0x73, 0x46, 0x08, 0x4a, + 0x9e, 0xe5, 0x12, 0x9e, 0xf0, 0x26, 0xe6, 0x32, 0xda, 0x01, 0x35, 0x29, 0x85, 0xe3, 0x7b, 0xf5, + 0x02, 0x7f, 0xca, 0x9b, 0xe2, 0xa8, 0xc8, 0x73, 0x18, 0xa7, 0xb2, 0x89, 0xb9, 0x8c, 0x5e, 0x42, + 0x89, 0xcd, 0x03, 0x52, 0x2f, 0xed, 0x28, 0xbb, 0x77, 0x9b, 0xcd, 0x95, 0x4a, 0x67, 0x0e, 0xe6, + 0x01, 0xc1, 0x3c, 0x1e, 0xb5, 0x01, 0xa6, 0xd6, 0x98, 0x4c, 0x47, 0xd7, 0x64, 0x4e, 0xeb, 0xeb, + 0xbc, 0x66, 0x1f, 0x2e, 0x45, 0x3b, 0x89, 0xdd, 0xbf, 0x22, 0x73, 0xbc, 0x39, 0x95, 0x12, 0x35, + 0x7e, 0x52, 0xa0, 0x14, 0x83, 0xa2, 0x7b, 0xa0, 0x0e, 0xcf, 0xfa, 0xbd, 0xce, 0x61, 0xf7, 0x65, + 0xb7, 0xd3, 0xd6, 0xd6, 0x62, 0xc3, 0xd1, 0xc1, 0xf0, 0xa8, 0x33, 0xea, 0x9e, 0x0d, 0x9e, 0x3c, + 0xd6, 0x14, 0xa4, 0x41, 0x55, 0x18, 0xda, 0xe7, 0xc3, 0xd6, 0x49, 0x47, 0x2b, 0xa0, 0x87, 0x80, + 0xa4, 0xa5, 0xdb, 0x1f, 0xe0, 0x6e, 0x6b, 0x38, 0xe8, 0x9e, 0x9f, 0x69, 0x45, 0x74, 0x1f, 0xb4, + 0xc3, 0xe1, 0xe9, 0xf0, 0xe4, 0x60, 0xd0, 0x7d, 0x95, 0xc4, 0x97, 0xd0, 0x03, 0xa8, 0xe5, 0xac, + 0x12, 0x64, 0x1d, 0x6d, 0xc1, 0xff, 0xf2, 0xe6, 0x3c, 0x52, 0x19, 0xa9, 0xb0, 0xd1, 0x1f, 0x9e, + 0x9e, 0x1e, 0xe0, 0xaf, 0xb5, 0x0d, 0xe3, 0x05, 0x54, 0x92, 0x14, 0x90, 0x06, 0xc5, 0x6b, 0x32, + 0x97, 0xed, 0x88, 0xc5, 0x7f, 0xee, 0x86, 0xf1, 0x9b, 0x02, 0x90, 0xcd, 0x0d, 0x3a, 0x84, 0x7b, + 0x94, 0x59, 0x21, 0x1b, 0xa5, 0x1b, 0x24, 0xc7, 0x59, 0x37, 0xc5, 0x0a, 0x99, 0xc9, 0x0a, 0xf1, + 0x69, 0xe3, 0x1e, 0xf8, 0x2e, 0x0f, 0x49, 0x75, 0xf4, 0x25, 0x54, 0x45, 0x17, 0x66, 0xd6, 0x34, + 0x7a, 0xcb, 0xd9, 0xe5, 0x49, 0xbc, 0x8a, 0xfd, 0xb1, 0x3a, 0x4d, 0x65, 0x8a, 0x9e, 0x43, 0x39, + 0xf0, 0x1d, 0x8f, 0xd1, 0x7a, 0x91, 0xa3, 0x18, 0x4b, 0x51, 0x7a, 0xb1, 0x2b, 0x96, 0x11, 0xc6, + 0x17, 0x00, 0x19, 0x2c, 0xba, 0x0f, 0xeb, 0x9c, 0x8f, 0xac, 0x8f, 0x50, 0xd0, 0x16, 0x6c, 0x5e, + 0x59, 0x54, 0x30, 0xe5, 0xf5, 0xa9, 0xe0, 0xca, 0x95, 0x45, 0x79, 0x88, 0xf1, 0x4b, 0x01, 0xd6, + 0x39, 0x24, 0x7a, 0x06, 0x9b, 0xab, 0x54, 0x24, 0x73, 0x46, 0xef, 0x83, 0xea, 0x78, 0xec, 0xc9, + 0xe3, 0xdc, 0x4f, 0x14, 0x8f, 0xd7, 0x30, 0x70, 0xa3, 0x60, 0xf6, 0x01, 0x54, 0x27, 0x7e, 0x34, + 0x9e, 0x12, 0xe9, 0x13, 0x6f, 0x86, 0x72, 0xbc, 0x86, 0x55, 0x61, 0x15, 0x4e, 0x23, 0x40, 0x13, + 0x87, 0xb2, 0xd0, 0x19, 0x47, 0x71, 0xe3, 0xa4, 0x6b, 0x89, 0x53, 0x31, 0x97, 0x16, 0xa5, 0x9d, + 0x0b, 0xe3, 0x58, 0xc7, 0x6b, 0xb8, 0x36, 0xb9, 0x6d, 0x44, 0x3d, 0xb8, 0x43, 0x23, 0xd7, 0xb5, + 0xc2, 0xb9, 0xc4, 0x5e, 0xe7, 0xd8, 0x8f, 0x96, 0x62, 0xf7, 0x45, 0x44, 0x02, 0x5b, 0xa5, 0x39, + 0xbd, 0xb5, 0x21, 0x2b, 0x6e, 0xfc, 0x5a, 0x86, 0xda, 0x02, 0x8b, 0xb8, 0x21, 0xb6, 0x1f, 0x79, + 0x8c, 0xd7, 0xb3, 0x88, 0x85, 0x12, 0x0f, 0x31, 0x8d, 0x5c, 0x5e, 0x27, 0x05, 0xc7, 0x22, 0x7a, + 0x0a, 0x75, 0x1a, 0xb9, 0x23, 0xff, 0x62, 0x44, 0xdf, 0x44, 0x56, 0x48, 0x26, 0xa3, 0x09, 0x99, + 0x39, 0x16, 0x9f, 0x68, 0x5e, 0x2a, 0xfc, 0x80, 0x46, 0xee, 0xf9, 0x45, 0x5f, 0xbc, 0xb6, 0x93, + 0x47, 0x64, 0xc3, 0xdd, 0x71, 0x64, 0x5f, 0x13, 0x36, 0xf2, 0xf9, 0xb0, 0x53, 0x59, 0xae, 0xcf, + 0x57, 0x2b, 0x97, 0xd9, 0xe2, 0x20, 0xe7, 0x02, 0x03, 0xdf, 0x19, 0xe7, 0x55, 0x74, 0x0e, 0x1b, + 0xc2, 0x90, 0xdc, 0x9b, 0xcf, 0xde, 0x09, 0x1d, 0x27, 0x28, 0xfa, 0x8f, 0x0a, 0xdc, 0xb9, 0xf1, + 0x8b, 0xc8, 0x86, 0x0a, 0xf9, 0x2e, 0x98, 0x3a, 0xb6, 0xc3, 0xe4, 0xec, 0x75, 0xfe, 0x4d, 0x06, + 0x66, 0x47, 0x82, 0x1d, 0xaf, 0xe1, 0x14, 0x58, 0x37, 0xa0, 0x92, 0xd8, 0xd1, 0x43, 0x28, 0x8f, + 0xfd, 0xc8, 0x9b, 0xd0, 0xba, 0xb2, 0x53, 0xdc, 0x55, 0xb0, 0xd4, 0x5a, 0x65, 0x71, 0xa6, 0x75, + 0x0a, 0x65, 0x81, 0xf8, 0x37, 0x3d, 0xec, 0xc7, 0x84, 0x89, 0x1b, 0x4c, 0xad, 0x90, 0x37, 0x52, + 0x6d, 0x3e, 0x5d, 0x91, 0x70, 0x47, 0x86, 0xe3, 0x14, 0x48, 0xff, 0xbe, 0x10, 0x33, 0x14, 0xca, + 0xcd, 0x65, 0x56, 0x92, 0x65, 0xbe, 0xb1, 0xa5, 0x85, 0x55, 0xb6, 0xf4, 0x1b, 0x50, 0x2d, 0xc6, + 0x2c, 0xfb, 0xca, 0x25, 0xd9, 0xad, 0x39, 0x7e, 0x47, 0xd2, 0xe6, 0x41, 0x06, 0xd5, 0xf1, 0x58, + 0x38, 0xc7, 0x79, 0x70, 0xfd, 0x05, 0x68, 0xb7, 0x1d, 0xfe, 0xe2, 0x74, 0xa7, 0x19, 0x16, 0x72, + 0xe7, 0xea, 0x79, 0xe1, 0x99, 0x62, 0xfc, 0x5e, 0x84, 0x6a, 0x7e, 0xef, 0xd0, 0x7e, 0xbe, 0x09, + 0x6a, 0x73, 0x6b, 0x21, 0xe5, 0x6e, 0x7a, 0x6b, 0x92, 0x0e, 0x99, 0xd9, 0x96, 0xa9, 0xcd, 0xff, + 0x2f, 0x04, 0xb4, 0xb3, 0xc3, 0x23, 0x76, 0xf0, 0x0c, 0x2a, 0xd4, 0xb3, 0x02, 0x7a, 0xe5, 0x33, + 0xf9, 0x0d, 0xd1, 0x7c, 0xeb, 0xbb, 0x60, 0xf6, 0x65, 0x24, 0x4e, 0x31, 0xf4, 0x9f, 0x0b, 0x50, + 0x49, 0xcc, 0xff, 0x05, 0xff, 0x37, 0x50, 0x0b, 0x48, 0x68, 0x13, 0x8f, 0x39, 0xc9, 0x99, 0x4d, + 0xba, 0xdc, 0x5e, 0x3d, 0x11, 0x93, 0xab, 0x07, 0xac, 0x97, 0x42, 0x62, 0x2d, 0x83, 0x17, 0xff, + 0x5c, 0x7a, 0x17, 0x6a, 0x0b, 0x6e, 0x68, 0x1b, 0x20, 0x73, 0x94, 0xc3, 0x9b, 0xb3, 0xdc, 0xec, + 0x7a, 0x32, 0xd7, 0xad, 0x19, 0x6c, 0x3b, 0xfe, 0x32, 0x9a, 0xad, 0xaa, 0xf8, 0x2a, 0xa2, 0xbd, + 0xf8, 0xa1, 0xa7, 0xbc, 0x6e, 0x5f, 0x3a, 0xec, 0x2a, 0x1a, 0x9b, 0xb6, 0xef, 0x36, 0x44, 0xcc, + 0x9e, 0xe3, 0x51, 0x16, 0x46, 0xf1, 0xcc, 0xf1, 0xeb, 0xd8, 0xc8, 0xe0, 0xf6, 0xc4, 0x27, 0xef, + 0x25, 0xf1, 0xf6, 0x2e, 0xf3, 0x9f, 0xe0, 0xe3, 0x32, 0x7f, 0xf8, 0xf4, 0xcf, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x8e, 0xfc, 0xd7, 0x46, 0xa8, 0x0b, 0x00, 0x00, +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go new file mode 100644 index 00000000..38faa9fd --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1/resource.pb.go @@ -0,0 +1,99 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/resource/v1/resource.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// Resource information. +type Resource struct { + // Type identifier for the resource. + Type string `protobuf:"bytes,1,opt,name=type,proto3" json:"type,omitempty"` + // Set of labels that describe the resource. + Labels map[string]string `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Resource) Reset() { *m = Resource{} } +func (m *Resource) String() string { return proto.CompactTextString(m) } +func (*Resource) ProtoMessage() {} +func (*Resource) Descriptor() ([]byte, []int) { + return fileDescriptor_584700775a2fc762, []int{0} +} + +func (m *Resource) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Resource.Unmarshal(m, b) +} +func (m *Resource) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Resource.Marshal(b, m, deterministic) +} +func (m *Resource) XXX_Merge(src proto.Message) { + xxx_messageInfo_Resource.Merge(m, src) +} +func (m *Resource) XXX_Size() int { + return xxx_messageInfo_Resource.Size(m) +} +func (m *Resource) XXX_DiscardUnknown() { + xxx_messageInfo_Resource.DiscardUnknown(m) +} + +var xxx_messageInfo_Resource proto.InternalMessageInfo + +func (m *Resource) GetType() string { + if m != nil { + return m.Type + } + return "" +} + +func (m *Resource) GetLabels() map[string]string { + if m != nil { + return m.Labels + } + return nil +} + +func init() { + proto.RegisterType((*Resource)(nil), "opencensus.proto.resource.v1.Resource") + proto.RegisterMapType((map[string]string)(nil), "opencensus.proto.resource.v1.Resource.LabelsEntry") +} + +func init() { + proto.RegisterFile("opencensus/proto/resource/v1/resource.proto", fileDescriptor_584700775a2fc762) +} + +var fileDescriptor_584700775a2fc762 = []byte{ + // 234 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xce, 0x2f, 0x48, 0xcd, + 0x4b, 0x4e, 0xcd, 0x2b, 0x2e, 0x2d, 0xd6, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0xd7, 0x2f, 0x4a, 0x2d, + 0xce, 0x2f, 0x2d, 0x4a, 0x4e, 0xd5, 0x2f, 0x33, 0x84, 0xb3, 0xf5, 0xc0, 0x52, 0x42, 0x32, 0x08, + 0xc5, 0x10, 0x11, 0x3d, 0xb8, 0x82, 0x32, 0x43, 0xa5, 0xa5, 0x8c, 0x5c, 0x1c, 0x41, 0x50, 0xbe, + 0x90, 0x10, 0x17, 0x4b, 0x49, 0x65, 0x41, 0xaa, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x98, + 0x2d, 0xe4, 0xc5, 0xc5, 0x96, 0x93, 0x98, 0x94, 0x9a, 0x53, 0x2c, 0xc1, 0xa4, 0xc0, 0xac, 0xc1, + 0x6d, 0x64, 0xa4, 0x87, 0xcf, 0x3c, 0x3d, 0x98, 0x59, 0x7a, 0x3e, 0x60, 0x4d, 0xae, 0x79, 0x25, + 0x45, 0x95, 0x41, 0x50, 0x13, 0xa4, 0x2c, 0xb9, 0xb8, 0x91, 0x84, 0x85, 0x04, 0xb8, 0x98, 0xb3, + 0x53, 0x2b, 0xa1, 0xb6, 0x81, 0x98, 0x42, 0x22, 0x5c, 0xac, 0x65, 0x89, 0x39, 0xa5, 0xa9, 0x12, + 0x4c, 0x60, 0x31, 0x08, 0xc7, 0x8a, 0xc9, 0x82, 0xd1, 0xa9, 0x92, 0x4b, 0x3e, 0x33, 0x1f, 0xaf, + 0xd5, 0x4e, 0xbc, 0x30, 0xbb, 0x03, 0x40, 0x52, 0x01, 0x8c, 0x51, 0xae, 0xe9, 0x99, 0x25, 0x19, + 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x10, 0x5d, 0xba, 0x99, 0x79, 0xc5, 0x25, 0x45, 0xa5, + 0xb9, 0xa9, 0x79, 0x25, 0x89, 0x25, 0x99, 0xf9, 0x79, 0xfa, 0x08, 0x03, 0x75, 0x21, 0x01, 0x99, + 0x9e, 0x9a, 0xa7, 0x9b, 0x8e, 0x12, 0x9e, 0x49, 0x6c, 0x60, 0x19, 0x63, 0x40, 0x00, 0x00, 0x00, + 0xff, 0xff, 0x8e, 0x11, 0xaf, 0xda, 0x76, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go new file mode 100644 index 00000000..4de05355 --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace.pb.go @@ -0,0 +1,1543 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/trace/v1/trace.proto + +package v1 + +import ( + fmt "fmt" + v1 "github.com/census-instrumentation/opencensus-proto/gen-go/resource/v1" + proto "github.com/golang/protobuf/proto" + timestamp "github.com/golang/protobuf/ptypes/timestamp" + wrappers "github.com/golang/protobuf/ptypes/wrappers" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// Type of span. Can be used to specify additional relationships between spans +// in addition to a parent/child relationship. +type Span_SpanKind int32 + +const ( + // Unspecified. + Span_SPAN_KIND_UNSPECIFIED Span_SpanKind = 0 + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + Span_SERVER Span_SpanKind = 1 + // Indicates that the span covers the client-side wrapper around an RPC or + // other remote request. + Span_CLIENT Span_SpanKind = 2 +) + +var Span_SpanKind_name = map[int32]string{ + 0: "SPAN_KIND_UNSPECIFIED", + 1: "SERVER", + 2: "CLIENT", +} + +var Span_SpanKind_value = map[string]int32{ + "SPAN_KIND_UNSPECIFIED": 0, + "SERVER": 1, + "CLIENT": 2, +} + +func (x Span_SpanKind) String() string { + return proto.EnumName(Span_SpanKind_name, int32(x)) +} + +func (Span_SpanKind) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 0} +} + +// Indicates whether the message was sent or received. +type Span_TimeEvent_MessageEvent_Type int32 + +const ( + // Unknown event type. + Span_TimeEvent_MessageEvent_TYPE_UNSPECIFIED Span_TimeEvent_MessageEvent_Type = 0 + // Indicates a sent message. + Span_TimeEvent_MessageEvent_SENT Span_TimeEvent_MessageEvent_Type = 1 + // Indicates a received message. + Span_TimeEvent_MessageEvent_RECEIVED Span_TimeEvent_MessageEvent_Type = 2 +) + +var Span_TimeEvent_MessageEvent_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "SENT", + 2: "RECEIVED", +} + +var Span_TimeEvent_MessageEvent_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "SENT": 1, + "RECEIVED": 2, +} + +func (x Span_TimeEvent_MessageEvent_Type) String() string { + return proto.EnumName(Span_TimeEvent_MessageEvent_Type_name, int32(x)) +} + +func (Span_TimeEvent_MessageEvent_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 2, 1, 0} +} + +// The relationship of the current span relative to the linked span: child, +// parent, or unspecified. +type Span_Link_Type int32 + +const ( + // The relationship of the two spans is unknown, or known but other + // than parent-child. + Span_Link_TYPE_UNSPECIFIED Span_Link_Type = 0 + // The linked span is a child of the current span. + Span_Link_CHILD_LINKED_SPAN Span_Link_Type = 1 + // The linked span is a parent of the current span. + Span_Link_PARENT_LINKED_SPAN Span_Link_Type = 2 +) + +var Span_Link_Type_name = map[int32]string{ + 0: "TYPE_UNSPECIFIED", + 1: "CHILD_LINKED_SPAN", + 2: "PARENT_LINKED_SPAN", +} + +var Span_Link_Type_value = map[string]int32{ + "TYPE_UNSPECIFIED": 0, + "CHILD_LINKED_SPAN": 1, + "PARENT_LINKED_SPAN": 2, +} + +func (x Span_Link_Type) String() string { + return proto.EnumName(Span_Link_Type_name, int32(x)) +} + +func (Span_Link_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 4, 0} +} + +// A span represents a single operation within a trace. Spans can be +// nested to form a trace tree. Spans may also be linked to other spans +// from the same or different trace. And form graphs. Often, a trace +// contains a root span that describes the end-to-end latency, and one +// or more subspans for its sub-operations. A trace can also contain +// multiple root spans, or none at all. Spans do not need to be +// contiguous - there may be gaps or overlaps between spans in a trace. +// +// The next id is 17. +// TODO(bdrutu): Add an example. +type Span struct { + // A unique identifier for a trace. All spans from the same trace share + // the same `trace_id`. The ID is a 16-byte array. An ID with all zeroes + // is considered invalid. + // + // This field is semantically required. Receiver should generate new + // random trace_id if empty or invalid trace_id was received. + // + // This field is required. + TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + // A unique identifier for a span within a trace, assigned when the span + // is created. The ID is an 8-byte array. An ID with all zeroes is considered + // invalid. + // + // This field is semantically required. Receiver should generate new + // random span_id if empty or invalid span_id was received. + // + // This field is required. + SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + // The Tracestate on the span. + Tracestate *Span_Tracestate `protobuf:"bytes,15,opt,name=tracestate,proto3" json:"tracestate,omitempty"` + // The `span_id` of this span's parent span. If this is a root span, then this + // field must be empty. The ID is an 8-byte array. + ParentSpanId []byte `protobuf:"bytes,3,opt,name=parent_span_id,json=parentSpanId,proto3" json:"parent_span_id,omitempty"` + // A description of the span's operation. + // + // For example, the name can be a qualified method name or a file name + // and a line number where the operation is called. A best practice is to use + // the same display name at the same call point in an application. + // This makes it easier to correlate spans in different traces. + // + // This field is semantically required to be set to non-empty string. + // When null or empty string received - receiver may use string "name" + // as a replacement. There might be smarted algorithms implemented by + // receiver to fix the empty span name. + // + // This field is required. + Name *TruncatableString `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + // Distinguishes between spans generated in a particular context. For example, + // two spans with the same name may be distinguished using `CLIENT` (caller) + // and `SERVER` (callee) to identify queueing latency associated with the span. + Kind Span_SpanKind `protobuf:"varint,14,opt,name=kind,proto3,enum=opencensus.proto.trace.v1.Span_SpanKind" json:"kind,omitempty"` + // The start time of the span. On the client side, this is the time kept by + // the local machine where the span execution starts. On the server side, this + // is the time when the server's application handler starts running. + // + // This field is semantically required. When not set on receive - + // receiver should set it to the value of end_time field if it was + // set. Or to the current time if neither was set. It is important to + // keep end_time > start_time for consistency. + // + // This field is required. + StartTime *timestamp.Timestamp `protobuf:"bytes,5,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"` + // The end time of the span. On the client side, this is the time kept by + // the local machine where the span execution ends. On the server side, this + // is the time when the server application handler stops running. + // + // This field is semantically required. When not set on receive - + // receiver should set it to start_time value. It is important to + // keep end_time > start_time for consistency. + // + // This field is required. + EndTime *timestamp.Timestamp `protobuf:"bytes,6,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"` + // A set of attributes on the span. + Attributes *Span_Attributes `protobuf:"bytes,7,opt,name=attributes,proto3" json:"attributes,omitempty"` + // A stack trace captured at the start of the span. + StackTrace *StackTrace `protobuf:"bytes,8,opt,name=stack_trace,json=stackTrace,proto3" json:"stack_trace,omitempty"` + // The included time events. + TimeEvents *Span_TimeEvents `protobuf:"bytes,9,opt,name=time_events,json=timeEvents,proto3" json:"time_events,omitempty"` + // The included links. + Links *Span_Links `protobuf:"bytes,10,opt,name=links,proto3" json:"links,omitempty"` + // An optional final status for this span. Semantically when Status + // wasn't set it is means span ended without errors and assume + // Status.Ok (code = 0). + Status *Status `protobuf:"bytes,11,opt,name=status,proto3" json:"status,omitempty"` + // An optional resource that is associated with this span. If not set, this span + // should be part of a batch that does include the resource information, unless resource + // information is unknown. + Resource *v1.Resource `protobuf:"bytes,16,opt,name=resource,proto3" json:"resource,omitempty"` + // A highly recommended but not required flag that identifies when a + // trace crosses a process boundary. True when the parent_span belongs + // to the same process as the current span. This flag is most commonly + // used to indicate the need to adjust time as clocks in different + // processes may not be synchronized. + SameProcessAsParentSpan *wrappers.BoolValue `protobuf:"bytes,12,opt,name=same_process_as_parent_span,json=sameProcessAsParentSpan,proto3" json:"same_process_as_parent_span,omitempty"` + // An optional number of child spans that were generated while this span + // was active. If set, allows an implementation to detect missing child spans. + ChildSpanCount *wrappers.UInt32Value `protobuf:"bytes,13,opt,name=child_span_count,json=childSpanCount,proto3" json:"child_span_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span) Reset() { *m = Span{} } +func (m *Span) String() string { return proto.CompactTextString(m) } +func (*Span) ProtoMessage() {} +func (*Span) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0} +} + +func (m *Span) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span.Unmarshal(m, b) +} +func (m *Span) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span.Marshal(b, m, deterministic) +} +func (m *Span) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span.Merge(m, src) +} +func (m *Span) XXX_Size() int { + return xxx_messageInfo_Span.Size(m) +} +func (m *Span) XXX_DiscardUnknown() { + xxx_messageInfo_Span.DiscardUnknown(m) +} + +var xxx_messageInfo_Span proto.InternalMessageInfo + +func (m *Span) GetTraceId() []byte { + if m != nil { + return m.TraceId + } + return nil +} + +func (m *Span) GetSpanId() []byte { + if m != nil { + return m.SpanId + } + return nil +} + +func (m *Span) GetTracestate() *Span_Tracestate { + if m != nil { + return m.Tracestate + } + return nil +} + +func (m *Span) GetParentSpanId() []byte { + if m != nil { + return m.ParentSpanId + } + return nil +} + +func (m *Span) GetName() *TruncatableString { + if m != nil { + return m.Name + } + return nil +} + +func (m *Span) GetKind() Span_SpanKind { + if m != nil { + return m.Kind + } + return Span_SPAN_KIND_UNSPECIFIED +} + +func (m *Span) GetStartTime() *timestamp.Timestamp { + if m != nil { + return m.StartTime + } + return nil +} + +func (m *Span) GetEndTime() *timestamp.Timestamp { + if m != nil { + return m.EndTime + } + return nil +} + +func (m *Span) GetAttributes() *Span_Attributes { + if m != nil { + return m.Attributes + } + return nil +} + +func (m *Span) GetStackTrace() *StackTrace { + if m != nil { + return m.StackTrace + } + return nil +} + +func (m *Span) GetTimeEvents() *Span_TimeEvents { + if m != nil { + return m.TimeEvents + } + return nil +} + +func (m *Span) GetLinks() *Span_Links { + if m != nil { + return m.Links + } + return nil +} + +func (m *Span) GetStatus() *Status { + if m != nil { + return m.Status + } + return nil +} + +func (m *Span) GetResource() *v1.Resource { + if m != nil { + return m.Resource + } + return nil +} + +func (m *Span) GetSameProcessAsParentSpan() *wrappers.BoolValue { + if m != nil { + return m.SameProcessAsParentSpan + } + return nil +} + +func (m *Span) GetChildSpanCount() *wrappers.UInt32Value { + if m != nil { + return m.ChildSpanCount + } + return nil +} + +// This field conveys information about request position in multiple distributed tracing graphs. +// It is a list of Tracestate.Entry with a maximum of 32 members in the list. +// +// See the https://github.com/w3c/distributed-tracing for more details about this field. +type Span_Tracestate struct { + // A list of entries that represent the Tracestate. + Entries []*Span_Tracestate_Entry `protobuf:"bytes,1,rep,name=entries,proto3" json:"entries,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Tracestate) Reset() { *m = Span_Tracestate{} } +func (m *Span_Tracestate) String() string { return proto.CompactTextString(m) } +func (*Span_Tracestate) ProtoMessage() {} +func (*Span_Tracestate) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 0} +} + +func (m *Span_Tracestate) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Tracestate.Unmarshal(m, b) +} +func (m *Span_Tracestate) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Tracestate.Marshal(b, m, deterministic) +} +func (m *Span_Tracestate) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Tracestate.Merge(m, src) +} +func (m *Span_Tracestate) XXX_Size() int { + return xxx_messageInfo_Span_Tracestate.Size(m) +} +func (m *Span_Tracestate) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Tracestate.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Tracestate proto.InternalMessageInfo + +func (m *Span_Tracestate) GetEntries() []*Span_Tracestate_Entry { + if m != nil { + return m.Entries + } + return nil +} + +type Span_Tracestate_Entry struct { + // The key must begin with a lowercase letter, and can only contain + // lowercase letters 'a'-'z', digits '0'-'9', underscores '_', dashes + // '-', asterisks '*', and forward slashes '/'. + Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` + // The value is opaque string up to 256 characters printable ASCII + // RFC0020 characters (i.e., the range 0x20 to 0x7E) except ',' and '='. + // Note that this also excludes tabs, newlines, carriage returns, etc. + Value string `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Tracestate_Entry) Reset() { *m = Span_Tracestate_Entry{} } +func (m *Span_Tracestate_Entry) String() string { return proto.CompactTextString(m) } +func (*Span_Tracestate_Entry) ProtoMessage() {} +func (*Span_Tracestate_Entry) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 0, 0} +} + +func (m *Span_Tracestate_Entry) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Tracestate_Entry.Unmarshal(m, b) +} +func (m *Span_Tracestate_Entry) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Tracestate_Entry.Marshal(b, m, deterministic) +} +func (m *Span_Tracestate_Entry) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Tracestate_Entry.Merge(m, src) +} +func (m *Span_Tracestate_Entry) XXX_Size() int { + return xxx_messageInfo_Span_Tracestate_Entry.Size(m) +} +func (m *Span_Tracestate_Entry) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Tracestate_Entry.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Tracestate_Entry proto.InternalMessageInfo + +func (m *Span_Tracestate_Entry) GetKey() string { + if m != nil { + return m.Key + } + return "" +} + +func (m *Span_Tracestate_Entry) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// A set of attributes, each with a key and a value. +type Span_Attributes struct { + // The set of attributes. The value can be a string, an integer, a double + // or the Boolean values `true` or `false`. Note, global attributes like + // server name can be set as tags using resource API. Examples of attributes: + // + // "/http/user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/71.0.3578.98 Safari/537.36" + // "/http/server_latency": 300 + // "abc.com/myattribute": true + // "abc.com/score": 10.239 + AttributeMap map[string]*AttributeValue `protobuf:"bytes,1,rep,name=attribute_map,json=attributeMap,proto3" json:"attribute_map,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + // The number of attributes that were discarded. Attributes can be discarded + // because their keys are too long or because there are too many attributes. + // If this value is 0, then no attributes were dropped. + DroppedAttributesCount int32 `protobuf:"varint,2,opt,name=dropped_attributes_count,json=droppedAttributesCount,proto3" json:"dropped_attributes_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Attributes) Reset() { *m = Span_Attributes{} } +func (m *Span_Attributes) String() string { return proto.CompactTextString(m) } +func (*Span_Attributes) ProtoMessage() {} +func (*Span_Attributes) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 1} +} + +func (m *Span_Attributes) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Attributes.Unmarshal(m, b) +} +func (m *Span_Attributes) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Attributes.Marshal(b, m, deterministic) +} +func (m *Span_Attributes) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Attributes.Merge(m, src) +} +func (m *Span_Attributes) XXX_Size() int { + return xxx_messageInfo_Span_Attributes.Size(m) +} +func (m *Span_Attributes) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Attributes.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Attributes proto.InternalMessageInfo + +func (m *Span_Attributes) GetAttributeMap() map[string]*AttributeValue { + if m != nil { + return m.AttributeMap + } + return nil +} + +func (m *Span_Attributes) GetDroppedAttributesCount() int32 { + if m != nil { + return m.DroppedAttributesCount + } + return 0 +} + +// A time-stamped annotation or message event in the Span. +type Span_TimeEvent struct { + // The time the event occurred. + Time *timestamp.Timestamp `protobuf:"bytes,1,opt,name=time,proto3" json:"time,omitempty"` + // A `TimeEvent` can contain either an `Annotation` object or a + // `MessageEvent` object, but not both. + // + // Types that are valid to be assigned to Value: + // *Span_TimeEvent_Annotation_ + // *Span_TimeEvent_MessageEvent_ + Value isSpan_TimeEvent_Value `protobuf_oneof:"value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_TimeEvent) Reset() { *m = Span_TimeEvent{} } +func (m *Span_TimeEvent) String() string { return proto.CompactTextString(m) } +func (*Span_TimeEvent) ProtoMessage() {} +func (*Span_TimeEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 2} +} + +func (m *Span_TimeEvent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_TimeEvent.Unmarshal(m, b) +} +func (m *Span_TimeEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_TimeEvent.Marshal(b, m, deterministic) +} +func (m *Span_TimeEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_TimeEvent.Merge(m, src) +} +func (m *Span_TimeEvent) XXX_Size() int { + return xxx_messageInfo_Span_TimeEvent.Size(m) +} +func (m *Span_TimeEvent) XXX_DiscardUnknown() { + xxx_messageInfo_Span_TimeEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_TimeEvent proto.InternalMessageInfo + +func (m *Span_TimeEvent) GetTime() *timestamp.Timestamp { + if m != nil { + return m.Time + } + return nil +} + +type isSpan_TimeEvent_Value interface { + isSpan_TimeEvent_Value() +} + +type Span_TimeEvent_Annotation_ struct { + Annotation *Span_TimeEvent_Annotation `protobuf:"bytes,2,opt,name=annotation,proto3,oneof"` +} + +type Span_TimeEvent_MessageEvent_ struct { + MessageEvent *Span_TimeEvent_MessageEvent `protobuf:"bytes,3,opt,name=message_event,json=messageEvent,proto3,oneof"` +} + +func (*Span_TimeEvent_Annotation_) isSpan_TimeEvent_Value() {} + +func (*Span_TimeEvent_MessageEvent_) isSpan_TimeEvent_Value() {} + +func (m *Span_TimeEvent) GetValue() isSpan_TimeEvent_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *Span_TimeEvent) GetAnnotation() *Span_TimeEvent_Annotation { + if x, ok := m.GetValue().(*Span_TimeEvent_Annotation_); ok { + return x.Annotation + } + return nil +} + +func (m *Span_TimeEvent) GetMessageEvent() *Span_TimeEvent_MessageEvent { + if x, ok := m.GetValue().(*Span_TimeEvent_MessageEvent_); ok { + return x.MessageEvent + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Span_TimeEvent) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Span_TimeEvent_Annotation_)(nil), + (*Span_TimeEvent_MessageEvent_)(nil), + } +} + +// A text annotation with a set of attributes. +type Span_TimeEvent_Annotation struct { + // A user-supplied message describing the event. + Description *TruncatableString `protobuf:"bytes,1,opt,name=description,proto3" json:"description,omitempty"` + // A set of attributes on the annotation. + Attributes *Span_Attributes `protobuf:"bytes,2,opt,name=attributes,proto3" json:"attributes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_TimeEvent_Annotation) Reset() { *m = Span_TimeEvent_Annotation{} } +func (m *Span_TimeEvent_Annotation) String() string { return proto.CompactTextString(m) } +func (*Span_TimeEvent_Annotation) ProtoMessage() {} +func (*Span_TimeEvent_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 2, 0} +} + +func (m *Span_TimeEvent_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_TimeEvent_Annotation.Unmarshal(m, b) +} +func (m *Span_TimeEvent_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_TimeEvent_Annotation.Marshal(b, m, deterministic) +} +func (m *Span_TimeEvent_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_TimeEvent_Annotation.Merge(m, src) +} +func (m *Span_TimeEvent_Annotation) XXX_Size() int { + return xxx_messageInfo_Span_TimeEvent_Annotation.Size(m) +} +func (m *Span_TimeEvent_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_Span_TimeEvent_Annotation.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_TimeEvent_Annotation proto.InternalMessageInfo + +func (m *Span_TimeEvent_Annotation) GetDescription() *TruncatableString { + if m != nil { + return m.Description + } + return nil +} + +func (m *Span_TimeEvent_Annotation) GetAttributes() *Span_Attributes { + if m != nil { + return m.Attributes + } + return nil +} + +// An event describing a message sent/received between Spans. +type Span_TimeEvent_MessageEvent struct { + // The type of MessageEvent. Indicates whether the message was sent or + // received. + Type Span_TimeEvent_MessageEvent_Type `protobuf:"varint,1,opt,name=type,proto3,enum=opencensus.proto.trace.v1.Span_TimeEvent_MessageEvent_Type" json:"type,omitempty"` + // An identifier for the MessageEvent's message that can be used to match + // SENT and RECEIVED MessageEvents. For example, this field could + // represent a sequence ID for a streaming RPC. It is recommended to be + // unique within a Span. + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + // The number of uncompressed bytes sent or received. + UncompressedSize uint64 `protobuf:"varint,3,opt,name=uncompressed_size,json=uncompressedSize,proto3" json:"uncompressed_size,omitempty"` + // The number of compressed bytes sent or received. If zero, assumed to + // be the same size as uncompressed. + CompressedSize uint64 `protobuf:"varint,4,opt,name=compressed_size,json=compressedSize,proto3" json:"compressed_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_TimeEvent_MessageEvent) Reset() { *m = Span_TimeEvent_MessageEvent{} } +func (m *Span_TimeEvent_MessageEvent) String() string { return proto.CompactTextString(m) } +func (*Span_TimeEvent_MessageEvent) ProtoMessage() {} +func (*Span_TimeEvent_MessageEvent) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 2, 1} +} + +func (m *Span_TimeEvent_MessageEvent) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_TimeEvent_MessageEvent.Unmarshal(m, b) +} +func (m *Span_TimeEvent_MessageEvent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_TimeEvent_MessageEvent.Marshal(b, m, deterministic) +} +func (m *Span_TimeEvent_MessageEvent) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_TimeEvent_MessageEvent.Merge(m, src) +} +func (m *Span_TimeEvent_MessageEvent) XXX_Size() int { + return xxx_messageInfo_Span_TimeEvent_MessageEvent.Size(m) +} +func (m *Span_TimeEvent_MessageEvent) XXX_DiscardUnknown() { + xxx_messageInfo_Span_TimeEvent_MessageEvent.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_TimeEvent_MessageEvent proto.InternalMessageInfo + +func (m *Span_TimeEvent_MessageEvent) GetType() Span_TimeEvent_MessageEvent_Type { + if m != nil { + return m.Type + } + return Span_TimeEvent_MessageEvent_TYPE_UNSPECIFIED +} + +func (m *Span_TimeEvent_MessageEvent) GetId() uint64 { + if m != nil { + return m.Id + } + return 0 +} + +func (m *Span_TimeEvent_MessageEvent) GetUncompressedSize() uint64 { + if m != nil { + return m.UncompressedSize + } + return 0 +} + +func (m *Span_TimeEvent_MessageEvent) GetCompressedSize() uint64 { + if m != nil { + return m.CompressedSize + } + return 0 +} + +// A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation +// on the span, consisting of either user-supplied key-value pairs, or +// details of a message sent/received between Spans. +type Span_TimeEvents struct { + // A collection of `TimeEvent`s. + TimeEvent []*Span_TimeEvent `protobuf:"bytes,1,rep,name=time_event,json=timeEvent,proto3" json:"time_event,omitempty"` + // The number of dropped annotations in all the included time events. + // If the value is 0, then no annotations were dropped. + DroppedAnnotationsCount int32 `protobuf:"varint,2,opt,name=dropped_annotations_count,json=droppedAnnotationsCount,proto3" json:"dropped_annotations_count,omitempty"` + // The number of dropped message events in all the included time events. + // If the value is 0, then no message events were dropped. + DroppedMessageEventsCount int32 `protobuf:"varint,3,opt,name=dropped_message_events_count,json=droppedMessageEventsCount,proto3" json:"dropped_message_events_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_TimeEvents) Reset() { *m = Span_TimeEvents{} } +func (m *Span_TimeEvents) String() string { return proto.CompactTextString(m) } +func (*Span_TimeEvents) ProtoMessage() {} +func (*Span_TimeEvents) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 3} +} + +func (m *Span_TimeEvents) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_TimeEvents.Unmarshal(m, b) +} +func (m *Span_TimeEvents) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_TimeEvents.Marshal(b, m, deterministic) +} +func (m *Span_TimeEvents) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_TimeEvents.Merge(m, src) +} +func (m *Span_TimeEvents) XXX_Size() int { + return xxx_messageInfo_Span_TimeEvents.Size(m) +} +func (m *Span_TimeEvents) XXX_DiscardUnknown() { + xxx_messageInfo_Span_TimeEvents.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_TimeEvents proto.InternalMessageInfo + +func (m *Span_TimeEvents) GetTimeEvent() []*Span_TimeEvent { + if m != nil { + return m.TimeEvent + } + return nil +} + +func (m *Span_TimeEvents) GetDroppedAnnotationsCount() int32 { + if m != nil { + return m.DroppedAnnotationsCount + } + return 0 +} + +func (m *Span_TimeEvents) GetDroppedMessageEventsCount() int32 { + if m != nil { + return m.DroppedMessageEventsCount + } + return 0 +} + +// A pointer from the current span to another span in the same trace or in a +// different trace. For example, this can be used in batching operations, +// where a single batch handler processes multiple requests from different +// traces or when the handler receives a request from a different project. +type Span_Link struct { + // A unique identifier of a trace that this linked span is part of. The ID is a + // 16-byte array. + TraceId []byte `protobuf:"bytes,1,opt,name=trace_id,json=traceId,proto3" json:"trace_id,omitempty"` + // A unique identifier for the linked span. The ID is an 8-byte array. + SpanId []byte `protobuf:"bytes,2,opt,name=span_id,json=spanId,proto3" json:"span_id,omitempty"` + // The relationship of the current span relative to the linked span. + Type Span_Link_Type `protobuf:"varint,3,opt,name=type,proto3,enum=opencensus.proto.trace.v1.Span_Link_Type" json:"type,omitempty"` + // A set of attributes on the link. + Attributes *Span_Attributes `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Link) Reset() { *m = Span_Link{} } +func (m *Span_Link) String() string { return proto.CompactTextString(m) } +func (*Span_Link) ProtoMessage() {} +func (*Span_Link) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 4} +} + +func (m *Span_Link) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Link.Unmarshal(m, b) +} +func (m *Span_Link) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Link.Marshal(b, m, deterministic) +} +func (m *Span_Link) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Link.Merge(m, src) +} +func (m *Span_Link) XXX_Size() int { + return xxx_messageInfo_Span_Link.Size(m) +} +func (m *Span_Link) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Link.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Link proto.InternalMessageInfo + +func (m *Span_Link) GetTraceId() []byte { + if m != nil { + return m.TraceId + } + return nil +} + +func (m *Span_Link) GetSpanId() []byte { + if m != nil { + return m.SpanId + } + return nil +} + +func (m *Span_Link) GetType() Span_Link_Type { + if m != nil { + return m.Type + } + return Span_Link_TYPE_UNSPECIFIED +} + +func (m *Span_Link) GetAttributes() *Span_Attributes { + if m != nil { + return m.Attributes + } + return nil +} + +// A collection of links, which are references from this span to a span +// in the same or different trace. +type Span_Links struct { + // A collection of links. + Link []*Span_Link `protobuf:"bytes,1,rep,name=link,proto3" json:"link,omitempty"` + // The number of dropped links after the maximum size was enforced. If + // this value is 0, then no links were dropped. + DroppedLinksCount int32 `protobuf:"varint,2,opt,name=dropped_links_count,json=droppedLinksCount,proto3" json:"dropped_links_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Span_Links) Reset() { *m = Span_Links{} } +func (m *Span_Links) String() string { return proto.CompactTextString(m) } +func (*Span_Links) ProtoMessage() {} +func (*Span_Links) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{0, 5} +} + +func (m *Span_Links) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Span_Links.Unmarshal(m, b) +} +func (m *Span_Links) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Span_Links.Marshal(b, m, deterministic) +} +func (m *Span_Links) XXX_Merge(src proto.Message) { + xxx_messageInfo_Span_Links.Merge(m, src) +} +func (m *Span_Links) XXX_Size() int { + return xxx_messageInfo_Span_Links.Size(m) +} +func (m *Span_Links) XXX_DiscardUnknown() { + xxx_messageInfo_Span_Links.DiscardUnknown(m) +} + +var xxx_messageInfo_Span_Links proto.InternalMessageInfo + +func (m *Span_Links) GetLink() []*Span_Link { + if m != nil { + return m.Link + } + return nil +} + +func (m *Span_Links) GetDroppedLinksCount() int32 { + if m != nil { + return m.DroppedLinksCount + } + return 0 +} + +// The `Status` type defines a logical error model that is suitable for different +// programming environments, including REST APIs and RPC APIs. This proto's fields +// are a subset of those of +// [google.rpc.Status](https://github.com/googleapis/googleapis/blob/master/google/rpc/status.proto), +// which is used by [gRPC](https://github.com/grpc). +type Status struct { + // The status code. This is optional field. It is safe to assume 0 (OK) + // when not set. + Code int32 `protobuf:"varint,1,opt,name=code,proto3" json:"code,omitempty"` + // A developer-facing error message, which should be in English. + Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Status) Reset() { *m = Status{} } +func (m *Status) String() string { return proto.CompactTextString(m) } +func (*Status) ProtoMessage() {} +func (*Status) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{1} +} + +func (m *Status) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Status.Unmarshal(m, b) +} +func (m *Status) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Status.Marshal(b, m, deterministic) +} +func (m *Status) XXX_Merge(src proto.Message) { + xxx_messageInfo_Status.Merge(m, src) +} +func (m *Status) XXX_Size() int { + return xxx_messageInfo_Status.Size(m) +} +func (m *Status) XXX_DiscardUnknown() { + xxx_messageInfo_Status.DiscardUnknown(m) +} + +var xxx_messageInfo_Status proto.InternalMessageInfo + +func (m *Status) GetCode() int32 { + if m != nil { + return m.Code + } + return 0 +} + +func (m *Status) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +// The value of an Attribute. +type AttributeValue struct { + // The type of the value. + // + // Types that are valid to be assigned to Value: + // *AttributeValue_StringValue + // *AttributeValue_IntValue + // *AttributeValue_BoolValue + // *AttributeValue_DoubleValue + Value isAttributeValue_Value `protobuf_oneof:"value"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *AttributeValue) Reset() { *m = AttributeValue{} } +func (m *AttributeValue) String() string { return proto.CompactTextString(m) } +func (*AttributeValue) ProtoMessage() {} +func (*AttributeValue) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{2} +} + +func (m *AttributeValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_AttributeValue.Unmarshal(m, b) +} +func (m *AttributeValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_AttributeValue.Marshal(b, m, deterministic) +} +func (m *AttributeValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_AttributeValue.Merge(m, src) +} +func (m *AttributeValue) XXX_Size() int { + return xxx_messageInfo_AttributeValue.Size(m) +} +func (m *AttributeValue) XXX_DiscardUnknown() { + xxx_messageInfo_AttributeValue.DiscardUnknown(m) +} + +var xxx_messageInfo_AttributeValue proto.InternalMessageInfo + +type isAttributeValue_Value interface { + isAttributeValue_Value() +} + +type AttributeValue_StringValue struct { + StringValue *TruncatableString `protobuf:"bytes,1,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type AttributeValue_IntValue struct { + IntValue int64 `protobuf:"varint,2,opt,name=int_value,json=intValue,proto3,oneof"` +} + +type AttributeValue_BoolValue struct { + BoolValue bool `protobuf:"varint,3,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type AttributeValue_DoubleValue struct { + DoubleValue float64 `protobuf:"fixed64,4,opt,name=double_value,json=doubleValue,proto3,oneof"` +} + +func (*AttributeValue_StringValue) isAttributeValue_Value() {} + +func (*AttributeValue_IntValue) isAttributeValue_Value() {} + +func (*AttributeValue_BoolValue) isAttributeValue_Value() {} + +func (*AttributeValue_DoubleValue) isAttributeValue_Value() {} + +func (m *AttributeValue) GetValue() isAttributeValue_Value { + if m != nil { + return m.Value + } + return nil +} + +func (m *AttributeValue) GetStringValue() *TruncatableString { + if x, ok := m.GetValue().(*AttributeValue_StringValue); ok { + return x.StringValue + } + return nil +} + +func (m *AttributeValue) GetIntValue() int64 { + if x, ok := m.GetValue().(*AttributeValue_IntValue); ok { + return x.IntValue + } + return 0 +} + +func (m *AttributeValue) GetBoolValue() bool { + if x, ok := m.GetValue().(*AttributeValue_BoolValue); ok { + return x.BoolValue + } + return false +} + +func (m *AttributeValue) GetDoubleValue() float64 { + if x, ok := m.GetValue().(*AttributeValue_DoubleValue); ok { + return x.DoubleValue + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*AttributeValue) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*AttributeValue_StringValue)(nil), + (*AttributeValue_IntValue)(nil), + (*AttributeValue_BoolValue)(nil), + (*AttributeValue_DoubleValue)(nil), + } +} + +// The call stack which originated this span. +type StackTrace struct { + // Stack frames in this stack trace. + StackFrames *StackTrace_StackFrames `protobuf:"bytes,1,opt,name=stack_frames,json=stackFrames,proto3" json:"stack_frames,omitempty"` + // The hash ID is used to conserve network bandwidth for duplicate + // stack traces within a single trace. + // + // Often multiple spans will have identical stack traces. + // The first occurrence of a stack trace should contain both + // `stack_frames` and a value in `stack_trace_hash_id`. + // + // Subsequent spans within the same request can refer + // to that stack trace by setting only `stack_trace_hash_id`. + // + // TODO: describe how to deal with the case where stack_trace_hash_id is + // zero because it was not set. + StackTraceHashId uint64 `protobuf:"varint,2,opt,name=stack_trace_hash_id,json=stackTraceHashId,proto3" json:"stack_trace_hash_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StackTrace) Reset() { *m = StackTrace{} } +func (m *StackTrace) String() string { return proto.CompactTextString(m) } +func (*StackTrace) ProtoMessage() {} +func (*StackTrace) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{3} +} + +func (m *StackTrace) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StackTrace.Unmarshal(m, b) +} +func (m *StackTrace) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StackTrace.Marshal(b, m, deterministic) +} +func (m *StackTrace) XXX_Merge(src proto.Message) { + xxx_messageInfo_StackTrace.Merge(m, src) +} +func (m *StackTrace) XXX_Size() int { + return xxx_messageInfo_StackTrace.Size(m) +} +func (m *StackTrace) XXX_DiscardUnknown() { + xxx_messageInfo_StackTrace.DiscardUnknown(m) +} + +var xxx_messageInfo_StackTrace proto.InternalMessageInfo + +func (m *StackTrace) GetStackFrames() *StackTrace_StackFrames { + if m != nil { + return m.StackFrames + } + return nil +} + +func (m *StackTrace) GetStackTraceHashId() uint64 { + if m != nil { + return m.StackTraceHashId + } + return 0 +} + +// A single stack frame in a stack trace. +type StackTrace_StackFrame struct { + // The fully-qualified name that uniquely identifies the function or + // method that is active in this frame. + FunctionName *TruncatableString `protobuf:"bytes,1,opt,name=function_name,json=functionName,proto3" json:"function_name,omitempty"` + // An un-mangled function name, if `function_name` is + // [mangled](http://www.avabodh.com/cxxin/namemangling.html). The name can + // be fully qualified. + OriginalFunctionName *TruncatableString `protobuf:"bytes,2,opt,name=original_function_name,json=originalFunctionName,proto3" json:"original_function_name,omitempty"` + // The name of the source file where the function call appears. + FileName *TruncatableString `protobuf:"bytes,3,opt,name=file_name,json=fileName,proto3" json:"file_name,omitempty"` + // The line number in `file_name` where the function call appears. + LineNumber int64 `protobuf:"varint,4,opt,name=line_number,json=lineNumber,proto3" json:"line_number,omitempty"` + // The column number where the function call appears, if available. + // This is important in JavaScript because of its anonymous functions. + ColumnNumber int64 `protobuf:"varint,5,opt,name=column_number,json=columnNumber,proto3" json:"column_number,omitempty"` + // The binary module from where the code was loaded. + LoadModule *Module `protobuf:"bytes,6,opt,name=load_module,json=loadModule,proto3" json:"load_module,omitempty"` + // The version of the deployed source code. + SourceVersion *TruncatableString `protobuf:"bytes,7,opt,name=source_version,json=sourceVersion,proto3" json:"source_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StackTrace_StackFrame) Reset() { *m = StackTrace_StackFrame{} } +func (m *StackTrace_StackFrame) String() string { return proto.CompactTextString(m) } +func (*StackTrace_StackFrame) ProtoMessage() {} +func (*StackTrace_StackFrame) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{3, 0} +} + +func (m *StackTrace_StackFrame) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StackTrace_StackFrame.Unmarshal(m, b) +} +func (m *StackTrace_StackFrame) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StackTrace_StackFrame.Marshal(b, m, deterministic) +} +func (m *StackTrace_StackFrame) XXX_Merge(src proto.Message) { + xxx_messageInfo_StackTrace_StackFrame.Merge(m, src) +} +func (m *StackTrace_StackFrame) XXX_Size() int { + return xxx_messageInfo_StackTrace_StackFrame.Size(m) +} +func (m *StackTrace_StackFrame) XXX_DiscardUnknown() { + xxx_messageInfo_StackTrace_StackFrame.DiscardUnknown(m) +} + +var xxx_messageInfo_StackTrace_StackFrame proto.InternalMessageInfo + +func (m *StackTrace_StackFrame) GetFunctionName() *TruncatableString { + if m != nil { + return m.FunctionName + } + return nil +} + +func (m *StackTrace_StackFrame) GetOriginalFunctionName() *TruncatableString { + if m != nil { + return m.OriginalFunctionName + } + return nil +} + +func (m *StackTrace_StackFrame) GetFileName() *TruncatableString { + if m != nil { + return m.FileName + } + return nil +} + +func (m *StackTrace_StackFrame) GetLineNumber() int64 { + if m != nil { + return m.LineNumber + } + return 0 +} + +func (m *StackTrace_StackFrame) GetColumnNumber() int64 { + if m != nil { + return m.ColumnNumber + } + return 0 +} + +func (m *StackTrace_StackFrame) GetLoadModule() *Module { + if m != nil { + return m.LoadModule + } + return nil +} + +func (m *StackTrace_StackFrame) GetSourceVersion() *TruncatableString { + if m != nil { + return m.SourceVersion + } + return nil +} + +// A collection of stack frames, which can be truncated. +type StackTrace_StackFrames struct { + // Stack frames in this call stack. + Frame []*StackTrace_StackFrame `protobuf:"bytes,1,rep,name=frame,proto3" json:"frame,omitempty"` + // The number of stack frames that were dropped because there + // were too many stack frames. + // If this value is 0, then no stack frames were dropped. + DroppedFramesCount int32 `protobuf:"varint,2,opt,name=dropped_frames_count,json=droppedFramesCount,proto3" json:"dropped_frames_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StackTrace_StackFrames) Reset() { *m = StackTrace_StackFrames{} } +func (m *StackTrace_StackFrames) String() string { return proto.CompactTextString(m) } +func (*StackTrace_StackFrames) ProtoMessage() {} +func (*StackTrace_StackFrames) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{3, 1} +} + +func (m *StackTrace_StackFrames) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StackTrace_StackFrames.Unmarshal(m, b) +} +func (m *StackTrace_StackFrames) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StackTrace_StackFrames.Marshal(b, m, deterministic) +} +func (m *StackTrace_StackFrames) XXX_Merge(src proto.Message) { + xxx_messageInfo_StackTrace_StackFrames.Merge(m, src) +} +func (m *StackTrace_StackFrames) XXX_Size() int { + return xxx_messageInfo_StackTrace_StackFrames.Size(m) +} +func (m *StackTrace_StackFrames) XXX_DiscardUnknown() { + xxx_messageInfo_StackTrace_StackFrames.DiscardUnknown(m) +} + +var xxx_messageInfo_StackTrace_StackFrames proto.InternalMessageInfo + +func (m *StackTrace_StackFrames) GetFrame() []*StackTrace_StackFrame { + if m != nil { + return m.Frame + } + return nil +} + +func (m *StackTrace_StackFrames) GetDroppedFramesCount() int32 { + if m != nil { + return m.DroppedFramesCount + } + return 0 +} + +// A description of a binary module. +type Module struct { + // TODO: document the meaning of this field. + // For example: main binary, kernel modules, and dynamic libraries + // such as libc.so, sharedlib.so. + Module *TruncatableString `protobuf:"bytes,1,opt,name=module,proto3" json:"module,omitempty"` + // A unique identifier for the module, usually a hash of its + // contents. + BuildId *TruncatableString `protobuf:"bytes,2,opt,name=build_id,json=buildId,proto3" json:"build_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Module) Reset() { *m = Module{} } +func (m *Module) String() string { return proto.CompactTextString(m) } +func (*Module) ProtoMessage() {} +func (*Module) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{4} +} + +func (m *Module) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Module.Unmarshal(m, b) +} +func (m *Module) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Module.Marshal(b, m, deterministic) +} +func (m *Module) XXX_Merge(src proto.Message) { + xxx_messageInfo_Module.Merge(m, src) +} +func (m *Module) XXX_Size() int { + return xxx_messageInfo_Module.Size(m) +} +func (m *Module) XXX_DiscardUnknown() { + xxx_messageInfo_Module.DiscardUnknown(m) +} + +var xxx_messageInfo_Module proto.InternalMessageInfo + +func (m *Module) GetModule() *TruncatableString { + if m != nil { + return m.Module + } + return nil +} + +func (m *Module) GetBuildId() *TruncatableString { + if m != nil { + return m.BuildId + } + return nil +} + +// A string that might be shortened to a specified length. +type TruncatableString struct { + // The shortened string. For example, if the original string was 500 bytes long and + // the limit of the string was 128 bytes, then this value contains the first 128 + // bytes of the 500-byte string. Note that truncation always happens on a + // character boundary, to ensure that a truncated string is still valid UTF-8. + // Because it may contain multi-byte characters, the size of the truncated string + // may be less than the truncation limit. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + // The number of bytes removed from the original string. If this + // value is 0, then the string was not shortened. + TruncatedByteCount int32 `protobuf:"varint,2,opt,name=truncated_byte_count,json=truncatedByteCount,proto3" json:"truncated_byte_count,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TruncatableString) Reset() { *m = TruncatableString{} } +func (m *TruncatableString) String() string { return proto.CompactTextString(m) } +func (*TruncatableString) ProtoMessage() {} +func (*TruncatableString) Descriptor() ([]byte, []int) { + return fileDescriptor_8ea38bbb821bf584, []int{5} +} + +func (m *TruncatableString) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TruncatableString.Unmarshal(m, b) +} +func (m *TruncatableString) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TruncatableString.Marshal(b, m, deterministic) +} +func (m *TruncatableString) XXX_Merge(src proto.Message) { + xxx_messageInfo_TruncatableString.Merge(m, src) +} +func (m *TruncatableString) XXX_Size() int { + return xxx_messageInfo_TruncatableString.Size(m) +} +func (m *TruncatableString) XXX_DiscardUnknown() { + xxx_messageInfo_TruncatableString.DiscardUnknown(m) +} + +var xxx_messageInfo_TruncatableString proto.InternalMessageInfo + +func (m *TruncatableString) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +func (m *TruncatableString) GetTruncatedByteCount() int32 { + if m != nil { + return m.TruncatedByteCount + } + return 0 +} + +func init() { + proto.RegisterEnum("opencensus.proto.trace.v1.Span_SpanKind", Span_SpanKind_name, Span_SpanKind_value) + proto.RegisterEnum("opencensus.proto.trace.v1.Span_TimeEvent_MessageEvent_Type", Span_TimeEvent_MessageEvent_Type_name, Span_TimeEvent_MessageEvent_Type_value) + proto.RegisterEnum("opencensus.proto.trace.v1.Span_Link_Type", Span_Link_Type_name, Span_Link_Type_value) + proto.RegisterType((*Span)(nil), "opencensus.proto.trace.v1.Span") + proto.RegisterType((*Span_Tracestate)(nil), "opencensus.proto.trace.v1.Span.Tracestate") + proto.RegisterType((*Span_Tracestate_Entry)(nil), "opencensus.proto.trace.v1.Span.Tracestate.Entry") + proto.RegisterType((*Span_Attributes)(nil), "opencensus.proto.trace.v1.Span.Attributes") + proto.RegisterMapType((map[string]*AttributeValue)(nil), "opencensus.proto.trace.v1.Span.Attributes.AttributeMapEntry") + proto.RegisterType((*Span_TimeEvent)(nil), "opencensus.proto.trace.v1.Span.TimeEvent") + proto.RegisterType((*Span_TimeEvent_Annotation)(nil), "opencensus.proto.trace.v1.Span.TimeEvent.Annotation") + proto.RegisterType((*Span_TimeEvent_MessageEvent)(nil), "opencensus.proto.trace.v1.Span.TimeEvent.MessageEvent") + proto.RegisterType((*Span_TimeEvents)(nil), "opencensus.proto.trace.v1.Span.TimeEvents") + proto.RegisterType((*Span_Link)(nil), "opencensus.proto.trace.v1.Span.Link") + proto.RegisterType((*Span_Links)(nil), "opencensus.proto.trace.v1.Span.Links") + proto.RegisterType((*Status)(nil), "opencensus.proto.trace.v1.Status") + proto.RegisterType((*AttributeValue)(nil), "opencensus.proto.trace.v1.AttributeValue") + proto.RegisterType((*StackTrace)(nil), "opencensus.proto.trace.v1.StackTrace") + proto.RegisterType((*StackTrace_StackFrame)(nil), "opencensus.proto.trace.v1.StackTrace.StackFrame") + proto.RegisterType((*StackTrace_StackFrames)(nil), "opencensus.proto.trace.v1.StackTrace.StackFrames") + proto.RegisterType((*Module)(nil), "opencensus.proto.trace.v1.Module") + proto.RegisterType((*TruncatableString)(nil), "opencensus.proto.trace.v1.TruncatableString") +} + +func init() { + proto.RegisterFile("opencensus/proto/trace/v1/trace.proto", fileDescriptor_8ea38bbb821bf584) +} + +var fileDescriptor_8ea38bbb821bf584 = []byte{ + // 1557 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x58, 0xeb, 0x52, 0x1b, 0x47, + 0x16, 0x66, 0x74, 0xd7, 0x91, 0x90, 0x45, 0x1b, 0xdb, 0x83, 0xd6, 0xbb, 0x66, 0x65, 0x7b, 0x17, + 0xaf, 0x17, 0x61, 0xb0, 0xd7, 0xe5, 0x6b, 0x79, 0x11, 0x88, 0x48, 0x06, 0x2b, 0x72, 0x4b, 0xa6, + 0x72, 0xa9, 0xd4, 0xd4, 0x48, 0xd3, 0x88, 0x09, 0x52, 0xcf, 0x64, 0xa6, 0x87, 0x14, 0x7e, 0x81, + 0x54, 0x2a, 0xff, 0x52, 0x95, 0xca, 0x0b, 0xe4, 0x47, 0x5e, 0x24, 0x0f, 0x90, 0xca, 0x73, 0xe4, + 0x09, 0xf2, 0x27, 0xd5, 0xdd, 0x73, 0x13, 0xd8, 0xa0, 0xc8, 0x7f, 0xa8, 0x9e, 0xee, 0xf3, 0x7d, + 0x7d, 0x4e, 0x9f, 0x2b, 0x82, 0xdb, 0x96, 0x4d, 0xe8, 0x80, 0x50, 0xd7, 0x73, 0xd7, 0x6c, 0xc7, + 0x62, 0xd6, 0x1a, 0x73, 0xf4, 0x01, 0x59, 0x3b, 0x5e, 0x97, 0x8b, 0x9a, 0xd8, 0x44, 0x4b, 0x91, + 0x98, 0xdc, 0xa9, 0xc9, 0xd3, 0xe3, 0xf5, 0xca, 0xdd, 0x33, 0x0c, 0x0e, 0x71, 0x2d, 0xcf, 0x91, + 0x24, 0xc1, 0x5a, 0xa2, 0x2a, 0x37, 0x86, 0x96, 0x35, 0x1c, 0x11, 0x29, 0xd8, 0xf7, 0x0e, 0xd6, + 0x98, 0x39, 0x26, 0x2e, 0xd3, 0xc7, 0xb6, 0x2f, 0xf0, 0x8f, 0xd3, 0x02, 0x5f, 0x3b, 0xba, 0x6d, + 0x13, 0xc7, 0xbf, 0xb6, 0xfa, 0xcb, 0x15, 0x48, 0x75, 0x6d, 0x9d, 0xa2, 0x25, 0xc8, 0x09, 0x15, + 0x34, 0xd3, 0x50, 0x95, 0x65, 0x65, 0xa5, 0x88, 0xb3, 0xe2, 0xbb, 0x65, 0xa0, 0x6b, 0x90, 0x75, + 0x6d, 0x9d, 0xf2, 0x93, 0x84, 0x38, 0xc9, 0xf0, 0xcf, 0x96, 0x81, 0x5e, 0x02, 0x08, 0x19, 0x97, + 0xe9, 0x8c, 0xa8, 0x97, 0x96, 0x95, 0x95, 0xc2, 0xc6, 0x7f, 0x6a, 0xef, 0x35, 0xad, 0xc6, 0x2f, + 0xaa, 0xf5, 0x42, 0x04, 0x8e, 0xa1, 0xd1, 0x2d, 0x28, 0xd9, 0xba, 0x43, 0x28, 0xd3, 0x82, 0xbb, + 0x92, 0xe2, 0xae, 0xa2, 0xdc, 0xed, 0xca, 0x1b, 0xff, 0x0f, 0x29, 0xaa, 0x8f, 0x89, 0x9a, 0x12, + 0x77, 0xfd, 0xf7, 0x9c, 0xbb, 0x7a, 0x8e, 0x47, 0x07, 0x3a, 0xd3, 0xfb, 0x23, 0xd2, 0x65, 0x8e, + 0x49, 0x87, 0x58, 0x20, 0xd1, 0x33, 0x48, 0x1d, 0x99, 0xd4, 0x50, 0x4b, 0xcb, 0xca, 0x4a, 0x69, + 0x63, 0xe5, 0x22, 0x6d, 0xf9, 0x9f, 0x5d, 0x93, 0x1a, 0x58, 0xa0, 0xd0, 0x63, 0x00, 0x97, 0xe9, + 0x0e, 0xd3, 0xf8, 0x3b, 0xab, 0x69, 0xa1, 0x45, 0xa5, 0x26, 0xdf, 0xb8, 0x16, 0xbc, 0x71, 0xad, + 0x17, 0x38, 0x01, 0xe7, 0x85, 0x34, 0xff, 0x46, 0xff, 0x83, 0x1c, 0xa1, 0x86, 0x04, 0x66, 0x2e, + 0x04, 0x66, 0x09, 0x35, 0x04, 0xec, 0x25, 0x80, 0xce, 0x98, 0x63, 0xf6, 0x3d, 0x46, 0x5c, 0x35, + 0x3b, 0xdd, 0x1b, 0x6f, 0x86, 0x08, 0x1c, 0x43, 0xa3, 0x1d, 0x28, 0xb8, 0x4c, 0x1f, 0x1c, 0x69, + 0x42, 0x5a, 0xcd, 0x09, 0xb2, 0xdb, 0xe7, 0x91, 0x71, 0x69, 0xe1, 0x30, 0x0c, 0x6e, 0xb8, 0x46, + 0xbb, 0x50, 0xe0, 0x66, 0x68, 0xe4, 0x98, 0x50, 0xe6, 0xaa, 0xf9, 0x29, 0x1d, 0x6f, 0x8e, 0x49, + 0x43, 0x20, 0x30, 0xb0, 0x70, 0x8d, 0x9e, 0x42, 0x7a, 0x64, 0xd2, 0x23, 0x57, 0x85, 0x8b, 0xd5, + 0xe1, 0x34, 0x7b, 0x5c, 0x18, 0x4b, 0x0c, 0x7a, 0x0c, 0x19, 0x1e, 0x3e, 0x9e, 0xab, 0x16, 0x04, + 0xfa, 0x9f, 0xe7, 0x1b, 0xc3, 0x3c, 0x17, 0xfb, 0x00, 0x54, 0x87, 0x5c, 0x90, 0x4c, 0x6a, 0x59, + 0x80, 0xff, 0x75, 0x16, 0x1c, 0xa6, 0xdb, 0xf1, 0x7a, 0x0d, 0xfb, 0x6b, 0x1c, 0xe2, 0xd0, 0x27, + 0xf0, 0x37, 0x57, 0x1f, 0x13, 0xcd, 0x76, 0xac, 0x01, 0x71, 0x5d, 0x4d, 0x77, 0xb5, 0x58, 0x10, + 0xab, 0xc5, 0xf7, 0xb8, 0xb9, 0x6e, 0x59, 0xa3, 0x7d, 0x7d, 0xe4, 0x11, 0x7c, 0x8d, 0xc3, 0x3b, + 0x12, 0xbd, 0xe9, 0x76, 0xc2, 0x50, 0x47, 0x3b, 0x50, 0x1e, 0x1c, 0x9a, 0x23, 0x43, 0x66, 0xc3, + 0xc0, 0xf2, 0x28, 0x53, 0xe7, 0x05, 0xdd, 0xf5, 0x33, 0x74, 0x6f, 0x5a, 0x94, 0xdd, 0xdf, 0x90, + 0x84, 0x25, 0x81, 0xe2, 0x14, 0x5b, 0x1c, 0x53, 0xf9, 0x56, 0x01, 0x88, 0x32, 0x0e, 0xbd, 0x84, + 0x2c, 0xa1, 0xcc, 0x31, 0x89, 0xab, 0x2a, 0xcb, 0xc9, 0x95, 0xc2, 0xc6, 0xbd, 0xe9, 0xd3, 0xb5, + 0xd6, 0xa0, 0xcc, 0x39, 0xc1, 0x01, 0x41, 0x65, 0x0d, 0xd2, 0x62, 0x07, 0x95, 0x21, 0x79, 0x44, + 0x4e, 0x44, 0xd5, 0xc8, 0x63, 0xbe, 0x44, 0x8b, 0x90, 0x3e, 0xe6, 0xea, 0x88, 0x7a, 0x91, 0xc7, + 0xf2, 0xa3, 0xf2, 0x43, 0x02, 0x20, 0x8a, 0x4c, 0xa4, 0xc3, 0x7c, 0x18, 0x9b, 0xda, 0x58, 0xb7, + 0x7d, 0x8d, 0x9e, 0x4d, 0x1f, 0xdc, 0xd1, 0xf2, 0x95, 0x6e, 0x4b, 0xed, 0x8a, 0x7a, 0x6c, 0x0b, + 0x3d, 0x02, 0xd5, 0x70, 0x2c, 0xdb, 0x26, 0x86, 0x16, 0xa5, 0x81, 0xff, 0x9a, 0x5c, 0xb5, 0x34, + 0xbe, 0xea, 0x9f, 0x47, 0xa4, 0xf2, 0xdd, 0xbe, 0x84, 0x85, 0x33, 0xe4, 0xef, 0x30, 0xf4, 0x45, + 0xdc, 0xd0, 0xc2, 0xc6, 0x9d, 0x73, 0x74, 0x0f, 0xe9, 0xa4, 0xa3, 0x24, 0xee, 0x49, 0xe2, 0x91, + 0x52, 0xf9, 0x29, 0x0d, 0xf9, 0x30, 0x39, 0x50, 0x0d, 0x52, 0xa2, 0x46, 0x28, 0x17, 0xd6, 0x08, + 0x21, 0x87, 0xf6, 0x01, 0x74, 0x4a, 0x2d, 0xa6, 0x33, 0xd3, 0xa2, 0xbe, 0x1e, 0x0f, 0xa6, 0xce, + 0xc5, 0xda, 0x66, 0x88, 0x6d, 0xce, 0xe1, 0x18, 0x13, 0xfa, 0x02, 0xe6, 0xc7, 0xc4, 0x75, 0xf5, + 0xa1, 0x9f, 0xe7, 0xa2, 0x1e, 0x17, 0x36, 0x1e, 0x4e, 0x4f, 0xfd, 0x4a, 0xc2, 0xc5, 0x47, 0x73, + 0x0e, 0x17, 0xc7, 0xb1, 0xef, 0xca, 0xcf, 0x0a, 0x40, 0x74, 0x37, 0x6a, 0x43, 0xc1, 0x20, 0xee, + 0xc0, 0x31, 0x6d, 0x61, 0x86, 0x32, 0x43, 0x7d, 0x8f, 0x13, 0x9c, 0x2a, 0x9b, 0x89, 0x0f, 0x29, + 0x9b, 0x95, 0x3f, 0x14, 0x28, 0xc6, 0x6d, 0x41, 0x1f, 0x43, 0x8a, 0x9d, 0xd8, 0xd2, 0x45, 0xa5, + 0x8d, 0xa7, 0xb3, 0xbd, 0x48, 0xad, 0x77, 0x62, 0x13, 0x2c, 0x88, 0x50, 0x09, 0x12, 0x7e, 0x73, + 0x4d, 0xe1, 0x84, 0x69, 0xa0, 0xbb, 0xb0, 0xe0, 0xd1, 0x81, 0x35, 0xb6, 0x1d, 0xe2, 0xba, 0xc4, + 0xd0, 0x5c, 0xf3, 0x2d, 0x11, 0xef, 0x9f, 0xc2, 0xe5, 0xf8, 0x41, 0xd7, 0x7c, 0x4b, 0xd0, 0xbf, + 0xe1, 0xd2, 0x69, 0xd1, 0x94, 0x10, 0x2d, 0x4d, 0x0a, 0x56, 0x1f, 0x40, 0x8a, 0xdf, 0x89, 0x16, + 0xa1, 0xdc, 0xfb, 0xb4, 0xd3, 0xd0, 0xde, 0xb4, 0xbb, 0x9d, 0xc6, 0x56, 0x6b, 0xa7, 0xd5, 0xd8, + 0x2e, 0xcf, 0xa1, 0x1c, 0xa4, 0xba, 0x8d, 0x76, 0xaf, 0xac, 0xa0, 0x22, 0xe4, 0x70, 0x63, 0xab, + 0xd1, 0xda, 0x6f, 0x6c, 0x97, 0x13, 0xf5, 0xac, 0x1f, 0xe2, 0x95, 0xdf, 0x78, 0x29, 0x89, 0xea, + 0x76, 0x13, 0x20, 0x6a, 0x02, 0x7e, 0xee, 0xde, 0x99, 0xfa, 0x29, 0x70, 0x3e, 0x6c, 0x01, 0xe8, + 0x09, 0x2c, 0x85, 0x59, 0x1a, 0x46, 0xc4, 0x64, 0x9a, 0x5e, 0x0b, 0xd2, 0x34, 0x3a, 0x17, 0x79, + 0x8a, 0x5e, 0xc0, 0xf5, 0x00, 0x3b, 0x11, 0xad, 0x01, 0x3c, 0x29, 0xe0, 0x01, 0x7f, 0xfc, 0xfd, + 0xfd, 0x44, 0xff, 0x3e, 0x01, 0x29, 0xde, 0x52, 0x66, 0x1a, 0x80, 0x9e, 0xfb, 0x81, 0x90, 0x14, + 0x81, 0x70, 0x67, 0x9a, 0xd6, 0x15, 0x77, 0xfb, 0x64, 0x90, 0xa6, 0x3e, 0x24, 0x48, 0xab, 0xbb, + 0xe7, 0x3a, 0xf7, 0x0a, 0x2c, 0x6c, 0x35, 0x5b, 0x7b, 0xdb, 0xda, 0x5e, 0xab, 0xbd, 0xdb, 0xd8, + 0xd6, 0xba, 0x9d, 0xcd, 0x76, 0x59, 0x41, 0x57, 0x01, 0x75, 0x36, 0x71, 0xa3, 0xdd, 0x9b, 0xd8, + 0x4f, 0x54, 0xbe, 0x82, 0xb4, 0x68, 0xb3, 0xe8, 0x11, 0xa4, 0x78, 0xa3, 0xf5, 0xdd, 0x7b, 0x6b, + 0x1a, 0x03, 0xb1, 0x40, 0xa0, 0x1a, 0x5c, 0x0e, 0x1c, 0x23, 0x5a, 0xf5, 0x84, 0x3b, 0x17, 0xfc, + 0x23, 0x71, 0x89, 0xf0, 0x43, 0xf5, 0x39, 0xe4, 0x82, 0x59, 0x0b, 0x2d, 0xc1, 0x15, 0xae, 0x88, + 0xb6, 0xdb, 0x6a, 0x6f, 0x9f, 0x32, 0x04, 0x20, 0xd3, 0x6d, 0xe0, 0xfd, 0x06, 0x2e, 0x2b, 0x7c, + 0xbd, 0xb5, 0xd7, 0xe2, 0x31, 0x9b, 0xa8, 0x3e, 0x84, 0x8c, 0xec, 0xef, 0x08, 0x41, 0x6a, 0x60, + 0x19, 0x32, 0x39, 0xd3, 0x58, 0xac, 0x91, 0x0a, 0x59, 0x3f, 0x3a, 0xfc, 0x8e, 0x14, 0x7c, 0x56, + 0x7f, 0x55, 0xa0, 0x34, 0x59, 0x99, 0xd1, 0x6b, 0x28, 0xba, 0xa2, 0xa2, 0x68, 0xb2, 0xb4, 0xcf, + 0x50, 0x8b, 0x9a, 0x73, 0xb8, 0x20, 0x39, 0x24, 0xe5, 0xdf, 0x21, 0x6f, 0x52, 0xa6, 0x45, 0xad, + 0x22, 0xd9, 0x9c, 0xc3, 0x39, 0x93, 0x32, 0x79, 0x7c, 0x03, 0xa0, 0x6f, 0x59, 0x23, 0xff, 0x9c, + 0x07, 0x53, 0xae, 0x39, 0x87, 0xf3, 0xfd, 0x60, 0x4c, 0x40, 0x37, 0xa1, 0x68, 0x58, 0x5e, 0x7f, + 0x44, 0x7c, 0x11, 0x1e, 0x2a, 0x0a, 0xbf, 0x44, 0xee, 0x0a, 0xa1, 0x30, 0x51, 0xab, 0xdf, 0x65, + 0x00, 0xa2, 0xc9, 0x0d, 0xf5, 0xb8, 0x3d, 0x7c, 0xea, 0x3b, 0x70, 0xf4, 0xb1, 0x68, 0xfc, 0xdc, + 0x9e, 0xf5, 0xa9, 0xc6, 0x3e, 0xb9, 0xdc, 0x11, 0x40, 0x2c, 0x87, 0x47, 0xf9, 0x81, 0x56, 0xe1, + 0x72, 0x6c, 0x96, 0xd4, 0x0e, 0x75, 0xf7, 0x50, 0x0b, 0x6b, 0x58, 0x39, 0x1a, 0x16, 0x9b, 0xba, + 0x7b, 0xd8, 0x32, 0x2a, 0xbf, 0x27, 0x7d, 0x9d, 0x04, 0x1c, 0xbd, 0x86, 0xf9, 0x03, 0x8f, 0x0e, + 0x78, 0x22, 0x6b, 0x62, 0xa0, 0x9f, 0xa5, 0xe0, 0x17, 0x03, 0x8a, 0x36, 0xa7, 0xec, 0xc3, 0x55, + 0xcb, 0x31, 0x87, 0x26, 0xd5, 0x47, 0xda, 0x24, 0x77, 0x62, 0x06, 0xee, 0xc5, 0x80, 0x6b, 0x27, + 0x7e, 0x47, 0x0b, 0xf2, 0x07, 0xe6, 0x88, 0x48, 0xda, 0xe4, 0x0c, 0xb4, 0x39, 0x0e, 0x17, 0x54, + 0x37, 0xa0, 0x30, 0x32, 0x29, 0xd1, 0xa8, 0x37, 0xee, 0x13, 0x47, 0x78, 0x34, 0x89, 0x81, 0x6f, + 0xb5, 0xc5, 0x0e, 0xba, 0x09, 0xf3, 0x03, 0x6b, 0xe4, 0x8d, 0x69, 0x20, 0x92, 0x16, 0x22, 0x45, + 0xb9, 0xe9, 0x0b, 0xd5, 0xa1, 0x30, 0xb2, 0x74, 0x43, 0x1b, 0x5b, 0x86, 0x37, 0x0a, 0xfe, 0xaf, + 0x38, 0x6f, 0x08, 0x7e, 0x25, 0x04, 0x31, 0x70, 0x94, 0x5c, 0xa3, 0x2e, 0x94, 0xe4, 0x38, 0xab, + 0x1d, 0x13, 0xc7, 0xe5, 0xdd, 0x37, 0x3b, 0x83, 0x65, 0xf3, 0x92, 0x63, 0x5f, 0x52, 0x54, 0xbe, + 0x51, 0xa0, 0x10, 0x8b, 0x1d, 0xb4, 0x03, 0x69, 0x11, 0x7e, 0xd3, 0x8c, 0x9d, 0xef, 0x8a, 0x3e, + 0x2c, 0xe1, 0xe8, 0x1e, 0x2c, 0x06, 0x65, 0x45, 0x86, 0xf3, 0x44, 0x5d, 0x41, 0xfe, 0x99, 0xbc, + 0x54, 0x16, 0x96, 0x1f, 0x15, 0xc8, 0xf8, 0x96, 0x6e, 0x43, 0xc6, 0x7f, 0xa8, 0x59, 0xc2, 0xcd, + 0xc7, 0xa2, 0x8f, 0x20, 0xd7, 0xf7, 0xf8, 0x68, 0xee, 0x87, 0xfb, 0x5f, 0xe5, 0xc9, 0x0a, 0x74, + 0xcb, 0xa8, 0x7e, 0x0e, 0x0b, 0x67, 0x4e, 0xa3, 0xd1, 0x59, 0x89, 0x8d, 0xce, 0xdc, 0x6c, 0x26, + 0x45, 0x89, 0xa1, 0xf5, 0x4f, 0x18, 0x99, 0x34, 0x3b, 0x3c, 0xab, 0x9f, 0x30, 0x22, 0xcc, 0xae, + 0xdb, 0x70, 0xdd, 0xb4, 0xde, 0xaf, 0x57, 0x5d, 0xfe, 0x57, 0xd0, 0xe1, 0x9b, 0x1d, 0xe5, 0xb3, + 0xfa, 0xd0, 0x64, 0x87, 0x5e, 0xbf, 0x36, 0xb0, 0xc6, 0x6b, 0x52, 0x7e, 0xd5, 0xa4, 0x2e, 0x73, + 0xbc, 0x31, 0xa1, 0xb2, 0xdf, 0xae, 0x45, 0x54, 0xab, 0xf2, 0x67, 0x89, 0x21, 0xa1, 0xab, 0xc3, + 0xe8, 0xf7, 0x8d, 0x7e, 0x46, 0x6c, 0xdf, 0xff, 0x33, 0x00, 0x00, 0xff, 0xff, 0x1e, 0xe0, 0x94, + 0x45, 0x03, 0x11, 0x00, 0x00, +} diff --git a/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go new file mode 100644 index 00000000..2ac2d28c --- /dev/null +++ b/vendor/github.com/census-instrumentation/opencensus-proto/gen-go/trace/v1/trace_config.pb.go @@ -0,0 +1,358 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: opencensus/proto/trace/v1/trace_config.proto + +package v1 + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// How spans should be sampled: +// - Always off +// - Always on +// - Always follow the parent Span's decision (off if no parent). +type ConstantSampler_ConstantDecision int32 + +const ( + ConstantSampler_ALWAYS_OFF ConstantSampler_ConstantDecision = 0 + ConstantSampler_ALWAYS_ON ConstantSampler_ConstantDecision = 1 + ConstantSampler_ALWAYS_PARENT ConstantSampler_ConstantDecision = 2 +) + +var ConstantSampler_ConstantDecision_name = map[int32]string{ + 0: "ALWAYS_OFF", + 1: "ALWAYS_ON", + 2: "ALWAYS_PARENT", +} + +var ConstantSampler_ConstantDecision_value = map[string]int32{ + "ALWAYS_OFF": 0, + "ALWAYS_ON": 1, + "ALWAYS_PARENT": 2, +} + +func (x ConstantSampler_ConstantDecision) String() string { + return proto.EnumName(ConstantSampler_ConstantDecision_name, int32(x)) +} + +func (ConstantSampler_ConstantDecision) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_5359209b41ff50c5, []int{2, 0} +} + +// Global configuration of the trace service. All fields must be specified, or +// the default (zero) values will be used for each type. +type TraceConfig struct { + // The global default sampler used to make decisions on span sampling. + // + // Types that are valid to be assigned to Sampler: + // *TraceConfig_ProbabilitySampler + // *TraceConfig_ConstantSampler + // *TraceConfig_RateLimitingSampler + Sampler isTraceConfig_Sampler `protobuf_oneof:"sampler"` + // The global default max number of attributes per span. + MaxNumberOfAttributes int64 `protobuf:"varint,4,opt,name=max_number_of_attributes,json=maxNumberOfAttributes,proto3" json:"max_number_of_attributes,omitempty"` + // The global default max number of annotation events per span. + MaxNumberOfAnnotations int64 `protobuf:"varint,5,opt,name=max_number_of_annotations,json=maxNumberOfAnnotations,proto3" json:"max_number_of_annotations,omitempty"` + // The global default max number of message events per span. + MaxNumberOfMessageEvents int64 `protobuf:"varint,6,opt,name=max_number_of_message_events,json=maxNumberOfMessageEvents,proto3" json:"max_number_of_message_events,omitempty"` + // The global default max number of link entries per span. + MaxNumberOfLinks int64 `protobuf:"varint,7,opt,name=max_number_of_links,json=maxNumberOfLinks,proto3" json:"max_number_of_links,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *TraceConfig) Reset() { *m = TraceConfig{} } +func (m *TraceConfig) String() string { return proto.CompactTextString(m) } +func (*TraceConfig) ProtoMessage() {} +func (*TraceConfig) Descriptor() ([]byte, []int) { + return fileDescriptor_5359209b41ff50c5, []int{0} +} + +func (m *TraceConfig) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_TraceConfig.Unmarshal(m, b) +} +func (m *TraceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_TraceConfig.Marshal(b, m, deterministic) +} +func (m *TraceConfig) XXX_Merge(src proto.Message) { + xxx_messageInfo_TraceConfig.Merge(m, src) +} +func (m *TraceConfig) XXX_Size() int { + return xxx_messageInfo_TraceConfig.Size(m) +} +func (m *TraceConfig) XXX_DiscardUnknown() { + xxx_messageInfo_TraceConfig.DiscardUnknown(m) +} + +var xxx_messageInfo_TraceConfig proto.InternalMessageInfo + +type isTraceConfig_Sampler interface { + isTraceConfig_Sampler() +} + +type TraceConfig_ProbabilitySampler struct { + ProbabilitySampler *ProbabilitySampler `protobuf:"bytes,1,opt,name=probability_sampler,json=probabilitySampler,proto3,oneof"` +} + +type TraceConfig_ConstantSampler struct { + ConstantSampler *ConstantSampler `protobuf:"bytes,2,opt,name=constant_sampler,json=constantSampler,proto3,oneof"` +} + +type TraceConfig_RateLimitingSampler struct { + RateLimitingSampler *RateLimitingSampler `protobuf:"bytes,3,opt,name=rate_limiting_sampler,json=rateLimitingSampler,proto3,oneof"` +} + +func (*TraceConfig_ProbabilitySampler) isTraceConfig_Sampler() {} + +func (*TraceConfig_ConstantSampler) isTraceConfig_Sampler() {} + +func (*TraceConfig_RateLimitingSampler) isTraceConfig_Sampler() {} + +func (m *TraceConfig) GetSampler() isTraceConfig_Sampler { + if m != nil { + return m.Sampler + } + return nil +} + +func (m *TraceConfig) GetProbabilitySampler() *ProbabilitySampler { + if x, ok := m.GetSampler().(*TraceConfig_ProbabilitySampler); ok { + return x.ProbabilitySampler + } + return nil +} + +func (m *TraceConfig) GetConstantSampler() *ConstantSampler { + if x, ok := m.GetSampler().(*TraceConfig_ConstantSampler); ok { + return x.ConstantSampler + } + return nil +} + +func (m *TraceConfig) GetRateLimitingSampler() *RateLimitingSampler { + if x, ok := m.GetSampler().(*TraceConfig_RateLimitingSampler); ok { + return x.RateLimitingSampler + } + return nil +} + +func (m *TraceConfig) GetMaxNumberOfAttributes() int64 { + if m != nil { + return m.MaxNumberOfAttributes + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfAnnotations() int64 { + if m != nil { + return m.MaxNumberOfAnnotations + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfMessageEvents() int64 { + if m != nil { + return m.MaxNumberOfMessageEvents + } + return 0 +} + +func (m *TraceConfig) GetMaxNumberOfLinks() int64 { + if m != nil { + return m.MaxNumberOfLinks + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*TraceConfig) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*TraceConfig_ProbabilitySampler)(nil), + (*TraceConfig_ConstantSampler)(nil), + (*TraceConfig_RateLimitingSampler)(nil), + } +} + +// Sampler that tries to uniformly sample traces with a given probability. +// The probability of sampling a trace is equal to that of the specified probability. +type ProbabilitySampler struct { + // The desired probability of sampling. Must be within [0.0, 1.0]. + SamplingProbability float64 `protobuf:"fixed64,1,opt,name=samplingProbability,proto3" json:"samplingProbability,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ProbabilitySampler) Reset() { *m = ProbabilitySampler{} } +func (m *ProbabilitySampler) String() string { return proto.CompactTextString(m) } +func (*ProbabilitySampler) ProtoMessage() {} +func (*ProbabilitySampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5359209b41ff50c5, []int{1} +} + +func (m *ProbabilitySampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ProbabilitySampler.Unmarshal(m, b) +} +func (m *ProbabilitySampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ProbabilitySampler.Marshal(b, m, deterministic) +} +func (m *ProbabilitySampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ProbabilitySampler.Merge(m, src) +} +func (m *ProbabilitySampler) XXX_Size() int { + return xxx_messageInfo_ProbabilitySampler.Size(m) +} +func (m *ProbabilitySampler) XXX_DiscardUnknown() { + xxx_messageInfo_ProbabilitySampler.DiscardUnknown(m) +} + +var xxx_messageInfo_ProbabilitySampler proto.InternalMessageInfo + +func (m *ProbabilitySampler) GetSamplingProbability() float64 { + if m != nil { + return m.SamplingProbability + } + return 0 +} + +// Sampler that always makes a constant decision on span sampling. +type ConstantSampler struct { + Decision ConstantSampler_ConstantDecision `protobuf:"varint,1,opt,name=decision,proto3,enum=opencensus.proto.trace.v1.ConstantSampler_ConstantDecision" json:"decision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ConstantSampler) Reset() { *m = ConstantSampler{} } +func (m *ConstantSampler) String() string { return proto.CompactTextString(m) } +func (*ConstantSampler) ProtoMessage() {} +func (*ConstantSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5359209b41ff50c5, []int{2} +} + +func (m *ConstantSampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ConstantSampler.Unmarshal(m, b) +} +func (m *ConstantSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ConstantSampler.Marshal(b, m, deterministic) +} +func (m *ConstantSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_ConstantSampler.Merge(m, src) +} +func (m *ConstantSampler) XXX_Size() int { + return xxx_messageInfo_ConstantSampler.Size(m) +} +func (m *ConstantSampler) XXX_DiscardUnknown() { + xxx_messageInfo_ConstantSampler.DiscardUnknown(m) +} + +var xxx_messageInfo_ConstantSampler proto.InternalMessageInfo + +func (m *ConstantSampler) GetDecision() ConstantSampler_ConstantDecision { + if m != nil { + return m.Decision + } + return ConstantSampler_ALWAYS_OFF +} + +// Sampler that tries to sample with a rate per time window. +type RateLimitingSampler struct { + // Rate per second. + Qps int64 `protobuf:"varint,1,opt,name=qps,proto3" json:"qps,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RateLimitingSampler) Reset() { *m = RateLimitingSampler{} } +func (m *RateLimitingSampler) String() string { return proto.CompactTextString(m) } +func (*RateLimitingSampler) ProtoMessage() {} +func (*RateLimitingSampler) Descriptor() ([]byte, []int) { + return fileDescriptor_5359209b41ff50c5, []int{3} +} + +func (m *RateLimitingSampler) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_RateLimitingSampler.Unmarshal(m, b) +} +func (m *RateLimitingSampler) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_RateLimitingSampler.Marshal(b, m, deterministic) +} +func (m *RateLimitingSampler) XXX_Merge(src proto.Message) { + xxx_messageInfo_RateLimitingSampler.Merge(m, src) +} +func (m *RateLimitingSampler) XXX_Size() int { + return xxx_messageInfo_RateLimitingSampler.Size(m) +} +func (m *RateLimitingSampler) XXX_DiscardUnknown() { + xxx_messageInfo_RateLimitingSampler.DiscardUnknown(m) +} + +var xxx_messageInfo_RateLimitingSampler proto.InternalMessageInfo + +func (m *RateLimitingSampler) GetQps() int64 { + if m != nil { + return m.Qps + } + return 0 +} + +func init() { + proto.RegisterEnum("opencensus.proto.trace.v1.ConstantSampler_ConstantDecision", ConstantSampler_ConstantDecision_name, ConstantSampler_ConstantDecision_value) + proto.RegisterType((*TraceConfig)(nil), "opencensus.proto.trace.v1.TraceConfig") + proto.RegisterType((*ProbabilitySampler)(nil), "opencensus.proto.trace.v1.ProbabilitySampler") + proto.RegisterType((*ConstantSampler)(nil), "opencensus.proto.trace.v1.ConstantSampler") + proto.RegisterType((*RateLimitingSampler)(nil), "opencensus.proto.trace.v1.RateLimitingSampler") +} + +func init() { + proto.RegisterFile("opencensus/proto/trace/v1/trace_config.proto", fileDescriptor_5359209b41ff50c5) +} + +var fileDescriptor_5359209b41ff50c5 = []byte{ + // 486 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xc1, 0x4e, 0xdb, 0x40, + 0x10, 0x86, 0x31, 0xa1, 0x50, 0x06, 0x01, 0xee, 0x5a, 0x54, 0x46, 0xe2, 0x80, 0x7c, 0x29, 0xaa, + 0x6a, 0xbb, 0xd0, 0x43, 0x55, 0x55, 0xaa, 0x94, 0x00, 0x51, 0x0f, 0x69, 0x88, 0x0c, 0x52, 0xd4, + 0x5e, 0xdc, 0xb5, 0xd9, 0xb8, 0xab, 0xc6, 0xb3, 0xae, 0x77, 0x1d, 0xd1, 0x77, 0xe9, 0x43, 0xf4, + 0x11, 0xab, 0xac, 0x5d, 0xdb, 0x49, 0x00, 0x71, 0xdb, 0xf9, 0xff, 0xf9, 0x7e, 0xaf, 0xbc, 0x33, + 0xf0, 0x46, 0x64, 0x0c, 0x63, 0x86, 0xb2, 0x90, 0x7e, 0x96, 0x0b, 0x25, 0x7c, 0x95, 0xd3, 0x98, + 0xf9, 0xb3, 0xd3, 0xf2, 0x10, 0xc6, 0x02, 0x27, 0x3c, 0xf1, 0xb4, 0x47, 0x0e, 0x9b, 0xee, 0x52, + 0xf1, 0x74, 0x93, 0x37, 0x3b, 0x75, 0xfe, 0x6c, 0xc0, 0xce, 0xcd, 0xbc, 0x38, 0xd7, 0x00, 0xf9, + 0x0e, 0x56, 0x96, 0x8b, 0x88, 0x46, 0x7c, 0xca, 0xd5, 0xef, 0x50, 0xd2, 0x34, 0x9b, 0xb2, 0xdc, + 0x36, 0x8e, 0x8d, 0x93, 0x9d, 0x33, 0xd7, 0x7b, 0x30, 0xc8, 0x1b, 0x35, 0xd4, 0x75, 0x09, 0x7d, + 0x5e, 0x0b, 0x48, 0xb6, 0xa2, 0x92, 0x31, 0x98, 0xb1, 0x40, 0xa9, 0x28, 0xaa, 0x3a, 0x7e, 0x5d, + 0xc7, 0xbf, 0x7e, 0x24, 0xfe, 0xbc, 0x42, 0x9a, 0xec, 0xfd, 0x78, 0x51, 0x22, 0xb7, 0x70, 0x90, + 0x53, 0xc5, 0xc2, 0x29, 0x4f, 0xb9, 0xe2, 0x98, 0xd4, 0xe9, 0x1d, 0x9d, 0xee, 0x3d, 0x92, 0x1e, + 0x50, 0xc5, 0x06, 0x15, 0xd6, 0x7c, 0xc1, 0xca, 0x57, 0x65, 0xf2, 0x1e, 0xec, 0x94, 0xde, 0x85, + 0x58, 0xa4, 0x11, 0xcb, 0x43, 0x31, 0x09, 0xa9, 0x52, 0x39, 0x8f, 0x0a, 0xc5, 0xa4, 0xbd, 0x71, + 0x6c, 0x9c, 0x74, 0x82, 0x83, 0x94, 0xde, 0x0d, 0xb5, 0x7d, 0x35, 0xe9, 0xd6, 0x26, 0xf9, 0x00, + 0x87, 0x4b, 0x20, 0xa2, 0x50, 0x54, 0x71, 0x81, 0xd2, 0x7e, 0xa6, 0xc9, 0x97, 0x6d, 0xb2, 0x71, + 0xc9, 0x27, 0x38, 0x5a, 0x44, 0x53, 0x26, 0x25, 0x4d, 0x58, 0xc8, 0x66, 0x0c, 0x95, 0xb4, 0x37, + 0x35, 0x6d, 0xb7, 0xe8, 0x2f, 0x65, 0xc3, 0xa5, 0xf6, 0x89, 0x0b, 0xd6, 0x22, 0x3f, 0xe5, 0xf8, + 0x53, 0xda, 0x5b, 0x1a, 0x33, 0x5b, 0xd8, 0x60, 0xae, 0xf7, 0xb6, 0x61, 0xab, 0xfa, 0x75, 0x4e, + 0x1f, 0xc8, 0xea, 0xc3, 0x92, 0xb7, 0x60, 0xe9, 0x06, 0x8e, 0x49, 0xcb, 0xd5, 0x43, 0x62, 0x04, + 0xf7, 0x59, 0xce, 0x5f, 0x03, 0xf6, 0x97, 0x9e, 0x90, 0x8c, 0xe1, 0xf9, 0x2d, 0x8b, 0xb9, 0xe4, + 0x02, 0x35, 0xba, 0x77, 0xf6, 0xf1, 0xe9, 0x03, 0x50, 0xd7, 0x17, 0x55, 0x44, 0x50, 0x87, 0x39, + 0x17, 0x60, 0x2e, 0xbb, 0x64, 0x0f, 0xa0, 0x3b, 0x18, 0x77, 0xbf, 0x5e, 0x87, 0x57, 0xfd, 0xbe, + 0xb9, 0x46, 0x76, 0x61, 0xfb, 0x7f, 0x3d, 0x34, 0x0d, 0xf2, 0x02, 0x76, 0xab, 0x72, 0xd4, 0x0d, + 0x2e, 0x87, 0x37, 0xe6, 0xba, 0xf3, 0x0a, 0xac, 0x7b, 0xc6, 0x82, 0x98, 0xd0, 0xf9, 0x95, 0x49, + 0x7d, 0xe1, 0x4e, 0x30, 0x3f, 0xf6, 0x66, 0x70, 0xc4, 0xc5, 0xc3, 0x37, 0xef, 0x99, 0xad, 0xfd, + 0x1a, 0xcd, 0xad, 0x91, 0xf1, 0xad, 0x97, 0x70, 0xf5, 0xa3, 0x88, 0xbc, 0x58, 0xa4, 0x7e, 0x49, + 0xb9, 0x1c, 0xa5, 0xca, 0x8b, 0x94, 0x61, 0xf9, 0xea, 0x7e, 0x13, 0xe8, 0x96, 0x1b, 0x9e, 0x30, + 0x74, 0x93, 0x66, 0xd1, 0xa3, 0x4d, 0x2d, 0xbf, 0xfb, 0x17, 0x00, 0x00, 0xff, 0xff, 0x13, 0xe2, + 0xd9, 0x56, 0x0c, 0x04, 0x00, 0x00, +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/access_application.go b/vendor/github.com/cloudflare/cloudflare-go/access_application.go new file mode 100644 index 00000000..0893c568 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/access_application.go @@ -0,0 +1,180 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + "time" + + "github.com/pkg/errors" +) + +// AccessApplication represents an Access application. +type AccessApplication struct { + ID string `json:"id,omitempty"` + CreatedAt *time.Time `json:"created_at,omitempty"` + UpdatedAt *time.Time `json:"updated_at,omitempty"` + AUD string `json:"aud,omitempty"` + Name string `json:"name"` + Domain string `json:"domain"` + SessionDuration string `json:"session_duration,omitempty"` +} + +// AccessApplicationListResponse represents the response from the list +// access applications endpoint. +type AccessApplicationListResponse struct { + Result []AccessApplication `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccessApplicationDetailResponse is the API response, containing a single +// access application. +type AccessApplicationDetailResponse struct { + Success bool `json:"success"` + Errors []string `json:"errors"` + Messages []string `json:"messages"` + Result AccessApplication `json:"result"` +} + +// AccessApplications returns all applications within a zone. +// +// API reference: https://api.cloudflare.com/#access-applications-list-access-applications +func (api *API) AccessApplications(zoneID string, pageOpts PaginationOptions) ([]AccessApplication, ResultInfo, error) { + v := url.Values{} + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + uri := "/zones/" + zoneID + "/access/apps" + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []AccessApplication{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError) + } + + var accessApplicationListResponse AccessApplicationListResponse + err = json.Unmarshal(res, &accessApplicationListResponse) + if err != nil { + return []AccessApplication{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError) + } + + return accessApplicationListResponse.Result, accessApplicationListResponse.ResultInfo, nil +} + +// AccessApplication returns a single application based on the +// application ID. +// +// API reference: https://api.cloudflare.com/#access-applications-access-applications-details +func (api *API) AccessApplication(zoneID, applicationID string) (AccessApplication, error) { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s", + zoneID, + applicationID, + ) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var accessApplicationDetailResponse AccessApplicationDetailResponse + err = json.Unmarshal(res, &accessApplicationDetailResponse) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return accessApplicationDetailResponse.Result, nil +} + +// CreateAccessApplication creates a new access application. +// +// API reference: https://api.cloudflare.com/#access-applications-create-access-application +func (api *API) CreateAccessApplication(zoneID string, accessApplication AccessApplication) (AccessApplication, error) { + uri := "/zones/" + zoneID + "/access/apps" + + res, err := api.makeRequest("POST", uri, accessApplication) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var accessApplicationDetailResponse AccessApplicationDetailResponse + err = json.Unmarshal(res, &accessApplicationDetailResponse) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return accessApplicationDetailResponse.Result, nil +} + +// UpdateAccessApplication updates an existing access application. +// +// API reference: https://api.cloudflare.com/#access-applications-update-access-application +func (api *API) UpdateAccessApplication(zoneID string, accessApplication AccessApplication) (AccessApplication, error) { + if accessApplication.ID == "" { + return AccessApplication{}, errors.Errorf("access application ID cannot be empty") + } + + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s", + zoneID, + accessApplication.ID, + ) + + res, err := api.makeRequest("PUT", uri, accessApplication) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var accessApplicationDetailResponse AccessApplicationDetailResponse + err = json.Unmarshal(res, &accessApplicationDetailResponse) + if err != nil { + return AccessApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return accessApplicationDetailResponse.Result, nil +} + +// DeleteAccessApplication deletes an access application. +// +// API reference: https://api.cloudflare.com/#access-applications-delete-access-application +func (api *API) DeleteAccessApplication(zoneID, applicationID string) error { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s", + zoneID, + applicationID, + ) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} + +// RevokeAccessApplicationTokens revokes tokens associated with an +// access application. +// +// API reference: https://api.cloudflare.com/#access-applications-revoke-access-tokens +func (api *API) RevokeAccessApplicationTokens(zoneID, applicationID string) error { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/revoke-tokens", + zoneID, + applicationID, + ) + + _, err := api.makeRequest("POST", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/access_policy.go b/vendor/github.com/cloudflare/cloudflare-go/access_policy.go new file mode 100644 index 00000000..dbf63e49 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/access_policy.go @@ -0,0 +1,221 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + "time" + + "github.com/pkg/errors" +) + +// AccessPolicy defines a policy for allowing or disallowing access to +// one or more Access applications. +type AccessPolicy struct { + ID string `json:"id,omitempty"` + Precedence int `json:"precedence"` + Decision string `json:"decision"` + CreatedAt *time.Time `json:"created_at"` + UpdatedAt *time.Time `json:"updated_at"` + Name string `json:"name"` + + // The include policy works like an OR logical operator. The user must + // satisfy one of the rules. + Include []interface{} `json:"include"` + + // The exclude policy works like a NOT logical operator. The user must + // not satisfy all of the rules in exclude. + Exclude []interface{} `json:"exclude"` + + // The require policy works like a AND logical operator. The user must + // satisfy all of the rules in require. + Require []interface{} `json:"require"` +} + +// AccessPolicyEmail is used for managing access based on the email. +// For example, restrict access to users with the email addresses +// `test@example.com` or `someone@example.com`. +type AccessPolicyEmail struct { + Email struct { + Email string `json:"email"` + } `json:"email"` +} + +// AccessPolicyEmailDomain is used for managing access based on an email +// domain domain such as `example.com` instead of individual addresses. +type AccessPolicyEmailDomain struct { + EmailDomain struct { + Domain string `json:"domain"` + } `json:"email_domain"` +} + +// AccessPolicyIP is used for managing access based in the IP. It +// accepts individual IPs or CIDRs. +type AccessPolicyIP struct { + IP struct { + IP string `json:"ip"` + } `json:"ip"` +} + +// AccessPolicyEveryone is used for managing access to everyone. +type AccessPolicyEveryone struct { + Everyone struct{} `json:"everyone"` +} + +// AccessPolicyAccessGroup is used for managing access based on an +// access group. +type AccessPolicyAccessGroup struct { + Group struct { + ID string `json:"id"` + } `json:"group"` +} + +// AccessPolicyListResponse represents the response from the list +// access polciies endpoint. +type AccessPolicyListResponse struct { + Result []AccessPolicy `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccessPolicyDetailResponse is the API response, containing a single +// access policy. +type AccessPolicyDetailResponse struct { + Success bool `json:"success"` + Errors []string `json:"errors"` + Messages []string `json:"messages"` + Result AccessPolicy `json:"result"` +} + +// AccessPolicies returns all access policies for an access application. +// +// API reference: https://api.cloudflare.com/#access-policy-list-access-policies +func (api *API) AccessPolicies(zoneID, applicationID string, pageOpts PaginationOptions) ([]AccessPolicy, ResultInfo, error) { + v := url.Values{} + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/policies", + zoneID, + applicationID, + ) + + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []AccessPolicy{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError) + } + + var accessPolicyListResponse AccessPolicyListResponse + err = json.Unmarshal(res, &accessPolicyListResponse) + if err != nil { + return []AccessPolicy{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError) + } + + return accessPolicyListResponse.Result, accessPolicyListResponse.ResultInfo, nil +} + +// AccessPolicy returns a single policy based on the policy ID. +// +// API reference: https://api.cloudflare.com/#access-policy-access-policy-details +func (api *API) AccessPolicy(zoneID, applicationID, policyID string) (AccessPolicy, error) { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/policies/%s", + zoneID, + applicationID, + policyID, + ) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errMakeRequestError) + } + + var accessPolicyDetailResponse AccessPolicyDetailResponse + err = json.Unmarshal(res, &accessPolicyDetailResponse) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errUnmarshalError) + } + + return accessPolicyDetailResponse.Result, nil +} + +// CreateAccessPolicy creates a new access policy. +// +// API reference: https://api.cloudflare.com/#access-policy-create-access-policy +func (api *API) CreateAccessPolicy(zoneID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error) { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/policies", + zoneID, + applicationID, + ) + + res, err := api.makeRequest("POST", uri, accessPolicy) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errMakeRequestError) + } + + var accessPolicyDetailResponse AccessPolicyDetailResponse + err = json.Unmarshal(res, &accessPolicyDetailResponse) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errUnmarshalError) + } + + return accessPolicyDetailResponse.Result, nil +} + +// UpdateAccessPolicy updates an existing access policy. +// +// API reference: https://api.cloudflare.com/#access-policy-update-access-policy +func (api *API) UpdateAccessPolicy(zoneID, applicationID string, accessPolicy AccessPolicy) (AccessPolicy, error) { + if accessPolicy.ID == "" { + return AccessPolicy{}, errors.Errorf("access policy ID cannot be empty") + } + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/policies/%s", + zoneID, + applicationID, + accessPolicy.ID, + ) + + res, err := api.makeRequest("PUT", uri, accessPolicy) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errMakeRequestError) + } + + var accessPolicyDetailResponse AccessPolicyDetailResponse + err = json.Unmarshal(res, &accessPolicyDetailResponse) + if err != nil { + return AccessPolicy{}, errors.Wrap(err, errUnmarshalError) + } + + return accessPolicyDetailResponse.Result, nil +} + +// DeleteAccessPolicy deletes an access policy. +// +// API reference: https://api.cloudflare.com/#access-policy-update-access-policy +func (api *API) DeleteAccessPolicy(zoneID, applicationID, accessPolicyID string) error { + uri := fmt.Sprintf( + "/zones/%s/access/apps/%s/policies/%s", + zoneID, + applicationID, + accessPolicyID, + ) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/account_members.go b/vendor/github.com/cloudflare/cloudflare-go/account_members.go new file mode 100644 index 00000000..42166e92 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/account_members.go @@ -0,0 +1,186 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + + "github.com/pkg/errors" +) + +// AccountMember is the definition of a member of an account. +type AccountMember struct { + ID string `json:"id"` + Code string `json:"code"` + User AccountMemberUserDetails `json:"user"` + Status string `json:"status"` + Roles []AccountRole `json:"roles"` +} + +// AccountMemberUserDetails outlines all the personal information about +// a member. +type AccountMemberUserDetails struct { + ID string `json:"id"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Email string `json:"email"` + TwoFactorAuthenticationEnabled bool +} + +// AccountMembersListResponse represents the response from the list +// account members endpoint. +type AccountMembersListResponse struct { + Result []AccountMember `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccountMemberDetailResponse is the API response, containing a single +// account member. +type AccountMemberDetailResponse struct { + Success bool `json:"success"` + Errors []string `json:"errors"` + Messages []string `json:"messages"` + Result AccountMember `json:"result"` +} + +// AccountMemberInvitation represents the invitation for a new member to +// the account. +type AccountMemberInvitation struct { + Email string `json:"email"` + Roles []string `json:"roles"` +} + +// AccountMembers returns all members of an account. +// +// API reference: https://api.cloudflare.com/#accounts-list-accounts +func (api *API) AccountMembers(accountID string, pageOpts PaginationOptions) ([]AccountMember, ResultInfo, error) { + if accountID == "" { + return []AccountMember{}, ResultInfo{}, errors.New(errMissingAccountID) + } + + v := url.Values{} + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + uri := "/accounts/" + accountID + "/members" + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []AccountMember{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError) + } + + var accountMemberListresponse AccountMembersListResponse + err = json.Unmarshal(res, &accountMemberListresponse) + if err != nil { + return []AccountMember{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError) + } + + return accountMemberListresponse.Result, accountMemberListresponse.ResultInfo, nil +} + +// CreateAccountMember invites a new member to join an account. +// +// API reference: https://api.cloudflare.com/#account-members-add-member +func (api *API) CreateAccountMember(accountID string, emailAddress string, roles []string) (AccountMember, error) { + if accountID == "" { + return AccountMember{}, errors.New(errMissingAccountID) + } + + uri := "/accounts/" + accountID + "/members" + + var newMember = AccountMemberInvitation{ + Email: emailAddress, + Roles: roles, + } + res, err := api.makeRequest("POST", uri, newMember) + if err != nil { + return AccountMember{}, errors.Wrap(err, errMakeRequestError) + } + + var accountMemberListResponse AccountMemberDetailResponse + err = json.Unmarshal(res, &accountMemberListResponse) + if err != nil { + return AccountMember{}, errors.Wrap(err, errUnmarshalError) + } + + return accountMemberListResponse.Result, nil +} + +// DeleteAccountMember removes a member from an account. +// +// API reference: https://api.cloudflare.com/#account-members-remove-member +func (api *API) DeleteAccountMember(accountID string, userID string) error { + if accountID == "" { + return errors.New(errMissingAccountID) + } + + uri := fmt.Sprintf("/accounts/%s/members/%s", accountID, userID) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} + +// UpdateAccountMember modifies an existing account member. +// +// API reference: https://api.cloudflare.com/#account-members-update-member +func (api *API) UpdateAccountMember(accountID string, userID string, member AccountMember) (AccountMember, error) { + if accountID == "" { + return AccountMember{}, errors.New(errMissingAccountID) + } + + uri := fmt.Sprintf("/accounts/%s/members/%s", accountID, userID) + + res, err := api.makeRequest("PUT", uri, member) + if err != nil { + return AccountMember{}, errors.Wrap(err, errMakeRequestError) + } + + var accountMemberListResponse AccountMemberDetailResponse + err = json.Unmarshal(res, &accountMemberListResponse) + if err != nil { + return AccountMember{}, errors.Wrap(err, errUnmarshalError) + } + + return accountMemberListResponse.Result, nil +} + +// AccountMember returns details of a single account member. +// +// API reference: https://api.cloudflare.com/#account-members-member-details +func (api *API) AccountMember(accountID string, memberID string) (AccountMember, error) { + if accountID == "" { + return AccountMember{}, errors.New(errMissingAccountID) + } + + uri := fmt.Sprintf( + "/accounts/%s/members/%s", + accountID, + memberID, + ) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AccountMember{}, errors.Wrap(err, errMakeRequestError) + } + + var accountMemberResponse AccountMemberDetailResponse + err = json.Unmarshal(res, &accountMemberResponse) + if err != nil { + return AccountMember{}, errors.Wrap(err, errUnmarshalError) + } + + return accountMemberResponse.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/account_roles.go b/vendor/github.com/cloudflare/cloudflare-go/account_roles.go new file mode 100644 index 00000000..3704313b --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/account_roles.go @@ -0,0 +1,80 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + + "github.com/pkg/errors" +) + +// AccountRole defines the roles that a member can have attached. +type AccountRole struct { + ID string `json:"id"` + Name string `json:"name"` + Description string `json:"description"` + Permissions map[string]AccountRolePermission `json:"permissions"` +} + +// AccountRolePermission is the shared structure for all permissions +// that can be assigned to a member. +type AccountRolePermission struct { + Read bool `json:"read"` + Edit bool `json:"edit"` +} + +// AccountRolesListResponse represents the list response from the +// account roles. +type AccountRolesListResponse struct { + Result []AccountRole `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccountRoleDetailResponse is the API response, containing a single +// account role. +type AccountRoleDetailResponse struct { + Success bool `json:"success"` + Errors []string `json:"errors"` + Messages []string `json:"messages"` + Result AccountRole `json:"result"` +} + +// AccountRoles returns all roles of an account. +// +// API reference: https://api.cloudflare.com/#account-roles-list-roles +func (api *API) AccountRoles(accountID string) ([]AccountRole, error) { + uri := "/accounts/" + accountID + "/roles" + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []AccountRole{}, errors.Wrap(err, errMakeRequestError) + } + + var accountRolesListResponse AccountRolesListResponse + err = json.Unmarshal(res, &accountRolesListResponse) + if err != nil { + return []AccountRole{}, errors.Wrap(err, errUnmarshalError) + } + + return accountRolesListResponse.Result, nil +} + +// AccountRole returns the details of a single account role. +// +// API reference: https://api.cloudflare.com/#account-roles-role-details +func (api *API) AccountRole(accountID string, roleID string) (AccountRole, error) { + uri := fmt.Sprintf("/accounts/%s/roles/%s", accountID, roleID) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AccountRole{}, errors.Wrap(err, errMakeRequestError) + } + + var accountRole AccountRoleDetailResponse + err = json.Unmarshal(res, &accountRole) + if err != nil { + return AccountRole{}, errors.Wrap(err, errUnmarshalError) + } + + return accountRole.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/accounts.go b/vendor/github.com/cloudflare/cloudflare-go/accounts.go new file mode 100644 index 00000000..7d34b7b8 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/accounts.go @@ -0,0 +1,114 @@ +package cloudflare + +import ( + "encoding/json" + "net/url" + "strconv" + + "github.com/pkg/errors" +) + +// AccountSettings outlines the available options for an account. +type AccountSettings struct { + EnforceTwoFactor bool `json:"enforce_twofactor"` +} + +// Account represents the root object that owns resources. +type Account struct { + ID string `json:"id,omitempty"` + Name string `json:"name,omitempty"` + Settings *AccountSettings `json:"settings"` +} + +// AccountResponse represents the response from the accounts endpoint for a +// single account ID. +type AccountResponse struct { + Result Account `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccountListResponse represents the response from the list accounts endpoint. +type AccountListResponse struct { + Result []Account `json:"result"` + Response + ResultInfo `json:"result_info"` +} + +// AccountDetailResponse is the API response, containing a single Account. +type AccountDetailResponse struct { + Success bool `json:"success"` + Errors []string `json:"errors"` + Messages []string `json:"messages"` + Result Account `json:"result"` +} + +// Accounts returns all accounts the logged in user has access to. +// +// API reference: https://api.cloudflare.com/#accounts-list-accounts +func (api *API) Accounts(pageOpts PaginationOptions) ([]Account, ResultInfo, error) { + v := url.Values{} + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + uri := "/accounts" + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []Account{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError) + } + + var accListResponse AccountListResponse + err = json.Unmarshal(res, &accListResponse) + if err != nil { + return []Account{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError) + } + return accListResponse.Result, accListResponse.ResultInfo, nil +} + +// Account returns a single account based on the ID. +// +// API reference: https://api.cloudflare.com/#accounts-account-details +func (api *API) Account(accountID string) (Account, ResultInfo, error) { + uri := "/accounts/" + accountID + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return Account{}, ResultInfo{}, errors.Wrap(err, errMakeRequestError) + } + + var accResponse AccountResponse + err = json.Unmarshal(res, &accResponse) + if err != nil { + return Account{}, ResultInfo{}, errors.Wrap(err, errUnmarshalError) + } + + return accResponse.Result, accResponse.ResultInfo, nil +} + +// UpdateAccount allows management of an account using the account ID. +// +// API reference: https://api.cloudflare.com/#accounts-update-account +func (api *API) UpdateAccount(accountID string, account Account) (Account, error) { + uri := "/accounts/" + accountID + + res, err := api.makeRequest("PUT", uri, account) + if err != nil { + return Account{}, errors.Wrap(err, errMakeRequestError) + } + + var a AccountDetailResponse + err = json.Unmarshal(res, &a) + if err != nil { + return Account{}, errors.Wrap(err, errUnmarshalError) + } + + return a.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/argo.go b/vendor/github.com/cloudflare/cloudflare-go/argo.go new file mode 100644 index 00000000..320c7fc2 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/argo.go @@ -0,0 +1,120 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/pkg/errors" +) + +var validSettingValues = []string{"on", "off"} + +// ArgoFeatureSetting is the structure of the API object for the +// argo smart routing and tiered caching settings. +type ArgoFeatureSetting struct { + Editable bool `json:"editable,omitempty"` + ID string `json:"id,omitempty"` + ModifiedOn time.Time `json:"modified_on,omitempty"` + Value string `json:"value"` +} + +// ArgoDetailsResponse is the API response for the argo smart routing +// and tiered caching response. +type ArgoDetailsResponse struct { + Result ArgoFeatureSetting `json:"result"` + Response +} + +// ArgoSmartRouting returns the current settings for smart routing. +// +// API reference: https://api.cloudflare.com/#argo-smart-routing-get-argo-smart-routing-setting +func (api *API) ArgoSmartRouting(zoneID string) (ArgoFeatureSetting, error) { + uri := "/zones/" + zoneID + "/argo/smart_routing" + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errMakeRequestError) + } + + var argoDetailsResponse ArgoDetailsResponse + err = json.Unmarshal(res, &argoDetailsResponse) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errUnmarshalError) + } + return argoDetailsResponse.Result, nil +} + +// UpdateArgoSmartRouting updates the setting for smart routing. +// +// API reference: https://api.cloudflare.com/#argo-smart-routing-patch-argo-smart-routing-setting +func (api *API) UpdateArgoSmartRouting(zoneID, settingValue string) (ArgoFeatureSetting, error) { + if !contains(validSettingValues, settingValue) { + return ArgoFeatureSetting{}, errors.New(fmt.Sprintf("invalid setting value '%s'. must be 'on' or 'off'", settingValue)) + } + + uri := "/zones/" + zoneID + "/argo/smart_routing" + + res, err := api.makeRequest("PATCH", uri, ArgoFeatureSetting{Value: settingValue}) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errMakeRequestError) + } + + var argoDetailsResponse ArgoDetailsResponse + err = json.Unmarshal(res, &argoDetailsResponse) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errUnmarshalError) + } + return argoDetailsResponse.Result, nil +} + +// ArgoTieredCaching returns the current settings for tiered caching. +// +// API reference: TBA +func (api *API) ArgoTieredCaching(zoneID string) (ArgoFeatureSetting, error) { + uri := "/zones/" + zoneID + "/argo/tiered_caching" + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errMakeRequestError) + } + + var argoDetailsResponse ArgoDetailsResponse + err = json.Unmarshal(res, &argoDetailsResponse) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errUnmarshalError) + } + return argoDetailsResponse.Result, nil +} + +// UpdateArgoTieredCaching updates the setting for tiered caching. +// +// API reference: TBA +func (api *API) UpdateArgoTieredCaching(zoneID, settingValue string) (ArgoFeatureSetting, error) { + if !contains(validSettingValues, settingValue) { + return ArgoFeatureSetting{}, errors.New(fmt.Sprintf("invalid setting value '%s'. must be 'on' or 'off'", settingValue)) + } + + uri := "/zones/" + zoneID + "/argo/tiered_caching" + + res, err := api.makeRequest("PATCH", uri, ArgoFeatureSetting{Value: settingValue}) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errMakeRequestError) + } + + var argoDetailsResponse ArgoDetailsResponse + err = json.Unmarshal(res, &argoDetailsResponse) + if err != nil { + return ArgoFeatureSetting{}, errors.Wrap(err, errUnmarshalError) + } + return argoDetailsResponse.Result, nil +} + +func contains(s []string, e string) bool { + for _, a := range s { + if a == e { + return true + } + } + return false +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/auditlogs.go b/vendor/github.com/cloudflare/cloudflare-go/auditlogs.go new file mode 100644 index 00000000..8cb8eab6 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/auditlogs.go @@ -0,0 +1,143 @@ +package cloudflare + +import ( + "encoding/base64" + "encoding/json" + "fmt" + "time" +) + +// AuditLogAction is a member of AuditLog, the action that was taken. +type AuditLogAction struct { + Result bool `json:"result"` + Type string `json:"type"` +} + +// AuditLogActor is a member of AuditLog, who performed the action. +type AuditLogActor struct { + Email string `json:"email"` + ID string `json:"id"` + IP string `json:"ip"` + Type string `json:"type"` +} + +// AuditLogOwner is a member of AuditLog, who owns this audit log. +type AuditLogOwner struct { + ID string `json:"id"` +} + +// AuditLogResource is a member of AuditLog, what was the action performed on. +type AuditLogResource struct { + ID string `json:"id"` + Type string `json:"type"` +} + +// AuditLog is an resource that represents an update in the cloudflare dash +type AuditLog struct { + Action AuditLogAction `json:"action"` + Actor AuditLogActor `json:"actor"` + ID string `json:"id"` + Metadata map[string]interface{} `json:"metadata"` + NewValue string `json:"newValue"` + OldValue string `json:"oldValue"` + Owner AuditLogOwner `json:"owner"` + Resource AuditLogResource `json:"resource"` + When time.Time `json:"when"` +} + +// AuditLogResponse is the response returned from the cloudflare v4 api +type AuditLogResponse struct { + Response Response + Result []AuditLog `json:"result"` + ResultInfo `json:"result_info"` +} + +// AuditLogFilter is an object for filtering the audit log response from the api. +type AuditLogFilter struct { + ID string + ActorIP string + ActorEmail string + Direction string + ZoneName string + Since string + Before string + PerPage int + Page int +} + +// String turns an audit log filter in to an HTTP Query Param +// list. It will not inclue empty members of the struct in the +// query parameters. +func (a AuditLogFilter) String() string { + params := "?" + if a.ID != "" { + params += "&id=" + a.ID + } + if a.ActorIP != "" { + params += "&actor.ip=" + a.ActorIP + } + if a.ActorEmail != "" { + params += "&actor.email=" + a.ActorEmail + } + if a.ZoneName != "" { + params += "&zone.name=" + a.ZoneName + } + if a.Direction != "" { + params += "&direction=" + a.Direction + } + if a.Since != "" { + params += "&since=" + a.Since + } + if a.Before != "" { + params += "&before=" + a.Before + } + if a.PerPage > 0 { + params += "&per_page=" + fmt.Sprintf("%d", a.PerPage) + } + if a.Page > 0 { + params += "&page=" + fmt.Sprintf("%d", a.Page) + } + return params +} + +// GetOrganizationAuditLogs will return the audit logs of a specific +// organization, based on the ID passed in. The audit logs can be +// filtered based on any argument in the AuditLogFilter +// +// API Reference: https://api.cloudflare.com/#audit-logs-list-organization-audit-logs +func (api *API) GetOrganizationAuditLogs(organizationID string, a AuditLogFilter) (AuditLogResponse, error) { + uri := "/organizations/" + organizationID + "/audit_logs" + fmt.Sprintf("%s", a) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AuditLogResponse{}, err + } + buf, err := base64.RawStdEncoding.DecodeString(string(res)) + if err != nil { + return AuditLogResponse{}, err + } + return unmarshalReturn(buf) +} + +// unmarshalReturn will unmarshal bytes and return an auditlogresponse +func unmarshalReturn(res []byte) (AuditLogResponse, error) { + var auditResponse AuditLogResponse + err := json.Unmarshal(res, &auditResponse) + if err != nil { + return auditResponse, err + } + return auditResponse, nil +} + +// GetUserAuditLogs will return your user's audit logs. The audit logs can be +// filtered based on any argument in the AuditLogFilter +// +// API Reference: https://api.cloudflare.com/#audit-logs-list-user-audit-logs +func (api *API) GetUserAuditLogs(a AuditLogFilter) (AuditLogResponse, error) { + uri := "/user/audit_logs" + fmt.Sprintf("%s", a) + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return AuditLogResponse{}, err + } + return unmarshalReturn(res) +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/cloudflare.go b/vendor/github.com/cloudflare/cloudflare-go/cloudflare.go index 818cdf8a..241473af 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/cloudflare.go +++ b/vendor/github.com/cloudflare/cloudflare-go/cloudflare.go @@ -10,6 +10,8 @@ import ( "log" "math" "net/http" + "net/url" + "strconv" "strings" "time" @@ -32,7 +34,8 @@ type API struct { APIEmail string APIUserServiceKey string BaseURL string - organizationID string + OrganizationID string + UserAgent string headers http.Header httpClient *http.Client authType int @@ -41,20 +44,13 @@ type API struct { logger Logger } -// New creates a new Cloudflare v4 API client. -func New(key, email string, opts ...Option) (*API, error) { - if key == "" || email == "" { - return nil, errors.New(errEmptyCredentials) - } - +// newClient provides shared logic for New and NewWithUserServiceKey +func newClient(opts ...Option) (*API, error) { silentLogger := log.New(ioutil.Discard, "", log.LstdFlags) api := &API{ - APIKey: key, - APIEmail: email, BaseURL: apiURL, headers: make(http.Header), - authType: AuthKeyEmail, rateLimiter: rate.NewLimiter(rate.Limit(4), 1), // 4rps equates to default api limit (1200 req/5 min) retryPolicy: RetryPolicy{ MaxRetries: 3, @@ -78,6 +74,41 @@ func New(key, email string, opts ...Option) (*API, error) { return api, nil } +// New creates a new Cloudflare v4 API client. +func New(key, email string, opts ...Option) (*API, error) { + if key == "" || email == "" { + return nil, errors.New(errEmptyCredentials) + } + + api, err := newClient(opts...) + if err != nil { + return nil, err + } + + api.APIKey = key + api.APIEmail = email + api.authType = AuthKeyEmail + + return api, nil +} + +// NewWithUserServiceKey creates a new Cloudflare v4 API client using service key authentication. +func NewWithUserServiceKey(key string, opts ...Option) (*API, error) { + if key == "" { + return nil, errors.New(errEmptyCredentials) + } + + api, err := newClient(opts...) + if err != nil { + return nil, err + } + + api.APIUserServiceKey = key + api.authType = AuthUserService + + return api, nil +} + // SetAuthType sets the authentication method (AuthyKeyEmail or AuthUserService). func (api *API) SetAuthType(authType int) { api.authType = authType @@ -85,32 +116,61 @@ func (api *API) SetAuthType(authType int) { // ZoneIDByName retrieves a zone's ID from the name. func (api *API) ZoneIDByName(zoneName string) (string, error) { - res, err := api.ListZones(zoneName) + res, err := api.ListZonesContext(context.TODO(), WithZoneFilter(zoneName)) if err != nil { - return "", errors.Wrap(err, "ListZones command failed") + return "", errors.Wrap(err, "ListZonesContext command failed") } - for _, zone := range res { - if zone.Name == zoneName { - return zone.ID, nil + + if len(res.Result) > 1 && api.OrganizationID == "" { + return "", errors.New("ambiguous zone name used without an account ID") + } + + for _, zone := range res.Result { + if api.OrganizationID != "" { + if zone.Name == zoneName && api.OrganizationID == zone.Account.ID { + return zone.ID, nil + } + } else { + if zone.Name == zoneName { + return zone.ID, nil + } } } + return "", errors.New("Zone could not be found") } // makeRequest makes a HTTP request and returns the body as a byte slice, // closing it before returnng. params will be serialized to JSON. func (api *API) makeRequest(method, uri string, params interface{}) ([]byte, error) { - return api.makeRequestWithAuthType(method, uri, params, api.authType) + return api.makeRequestWithAuthType(context.TODO(), method, uri, params, api.authType) } -func (api *API) makeRequestWithAuthType(method, uri string, params interface{}, authType int) ([]byte, error) { +func (api *API) makeRequestContext(ctx context.Context, method, uri string, params interface{}) ([]byte, error) { + return api.makeRequestWithAuthType(ctx, method, uri, params, api.authType) +} + +func (api *API) makeRequestWithHeaders(method, uri string, params interface{}, headers http.Header) ([]byte, error) { + return api.makeRequestWithAuthTypeAndHeaders(context.TODO(), method, uri, params, api.authType, headers) +} + +func (api *API) makeRequestWithAuthType(ctx context.Context, method, uri string, params interface{}, authType int) ([]byte, error) { + return api.makeRequestWithAuthTypeAndHeaders(ctx, method, uri, params, authType, nil) +} + +func (api *API) makeRequestWithAuthTypeAndHeaders(ctx context.Context, method, uri string, params interface{}, authType int, headers http.Header) ([]byte, error) { // Replace nil with a JSON object if needed var jsonBody []byte var err error + if params != nil { - jsonBody, err = json.Marshal(params) - if err != nil { - return nil, errors.Wrap(err, "error marshalling params to JSON") + if paramBytes, ok := params.([]byte); ok { + jsonBody = paramBytes + } else { + jsonBody, err = json.Marshal(params) + if err != nil { + return nil, errors.Wrap(err, "error marshalling params to JSON") + } } } else { jsonBody = nil @@ -124,7 +184,6 @@ func (api *API) makeRequestWithAuthType(method, uri string, params interface{}, if jsonBody != nil { reqBody = bytes.NewReader(jsonBody) } - if i > 0 { // expect the backoff introduced here on errored requests to dominate the effect of rate limiting // dont need a random component here as the rate limiter should do something similar @@ -137,12 +196,13 @@ func (api *API) makeRequestWithAuthType(method, uri string, params interface{}, // useful to do some simple logging here, maybe introduce levels later api.logger.Printf("Sleeping %s before retry attempt number %d for request %s %s", sleepDuration.String(), i, method, uri) time.Sleep(sleepDuration) + } api.rateLimiter.Wait(context.TODO()) if err != nil { return nil, errors.Wrap(err, "Error caused by request rate limiting") } - resp, respErr = api.request(method, uri, reqBody, authType) + resp, respErr = api.request(ctx, method, uri, reqBody, authType, headers) // retry if the server is rate limiting us or if it failed // assumes server operations are rolled back on failure @@ -187,6 +247,11 @@ func (api *API) makeRequestWithAuthType(method, uri string, params interface{}, resp.StatusCode == 523, resp.StatusCode == 524: return nil, errors.Errorf("HTTP status %d: service failure", resp.StatusCode) + // This isn't a great solution due to the way the `default` case is + // a catch all and that the `filters/validate-expr` returns a HTTP 400 + // yet the clients need to use the HTTP body as a JSON string. + case resp.StatusCode == 400 && strings.HasSuffix(resp.Request.URL.Path, "/filters/validate-expr"): + return nil, errors.Errorf("%s", respBody) default: var s string if respBody != nil { @@ -201,14 +266,17 @@ func (api *API) makeRequestWithAuthType(method, uri string, params interface{}, // request makes a HTTP request to the given API endpoint, returning the raw // *http.Response, or an error if one occurred. The caller is responsible for // closing the response body. -func (api *API) request(method, uri string, reqBody io.Reader, authType int) (*http.Response, error) { +func (api *API) request(ctx context.Context, method, uri string, reqBody io.Reader, authType int, headers http.Header) (*http.Response, error) { req, err := http.NewRequest(method, api.BaseURL+uri, reqBody) if err != nil { return nil, errors.Wrap(err, "HTTP request creation failed") } + req.WithContext(ctx) - // Apply any user-defined headers first. - req.Header = cloneHeader(api.headers) + combinedHeaders := make(http.Header) + copyHeader(combinedHeaders, api.headers) + copyHeader(combinedHeaders, headers) + req.Header = combinedHeaders if authType&AuthKeyEmail != 0 { req.Header.Set("X-Auth-Key", api.APIKey) req.Header.Set("X-Auth-Email", api.APIEmail) @@ -216,6 +284,9 @@ func (api *API) request(method, uri string, reqBody io.Reader, authType int) (*h if authType&AuthUserService != 0 { req.Header.Set("X-Auth-User-Service-Key", api.APIUserServiceKey) } + if api.UserAgent != "" { + req.Header.Set("User-Agent", api.UserAgent) + } if req.Header.Get("Content-Type") == "" { req.Header.Set("Content-Type", "application/json") @@ -235,20 +306,18 @@ func (api *API) request(method, uri string, reqBody io.Reader, authType int) (*h // accountBase is the base URL for endpoints referring to the current user. It exists as a // parameter because it is not consistent across APIs. func (api *API) userBaseURL(accountBase string) string { - if api.organizationID != "" { - return "/organizations/" + api.organizationID + if api.OrganizationID != "" { + return "/accounts/" + api.OrganizationID } return accountBase } -// cloneHeader returns a shallow copy of the header. -// copied from https://godoc.org/github.com/golang/gddo/httputil/header#Copy -func cloneHeader(header http.Header) http.Header { - h := make(http.Header) - for k, vs := range header { - h[k] = vs +// copyHeader copies all headers for `source` and sets them on `target`. +// based on https://godoc.org/github.com/golang/gddo/httputil/header#Copy +func copyHeader(target, source http.Header) { + for k, vs := range source { + target[k] = vs } - return h } // ResponseInfo contains a code and message returned by the API as errors or @@ -316,3 +385,24 @@ type RetryPolicy struct { type Logger interface { Printf(format string, v ...interface{}) } + +// ReqOption is a functional option for configuring API requests +type ReqOption func(opt *reqOption) +type reqOption struct { + params url.Values +} + +// WithZoneFilter applies a filter based on zone name. +func WithZoneFilter(zone string) ReqOption { + return func(opt *reqOption) { + opt.params.Set("name", zone) + } +} + +// WithPagination configures the pagination for a response. +func WithPagination(opts PaginationOptions) ReqOption { + return func(opt *reqOption) { + opt.params.Set("page", strconv.Itoa(opts.Page)) + opt.params.Set("per_page", strconv.Itoa(opts.PerPage)) + } +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/cpage.go b/vendor/github.com/cloudflare/cloudflare-go/cpage.go deleted file mode 100644 index 87e50ce8..00000000 --- a/vendor/github.com/cloudflare/cloudflare-go/cpage.go +++ /dev/null @@ -1,29 +0,0 @@ -package cloudflare - -import "time" - -// CustomPage represents a custom page configuration. -type CustomPage struct { - CreatedOn string `json:"created_on"` - ModifiedOn time.Time `json:"modified_on"` - URL string `json:"url"` - State string `json:"state"` - RequiredTokens []string `json:"required_tokens"` - PreviewTarget string `json:"preview_target"` - Description string `json:"description"` -} - -// CustomPageResponse represents the response from the custom pages endpoint. -type CustomPageResponse struct { - Response - Result []CustomPage `json:"result"` -} - -// https://api.cloudflare.com/#custom-pages-for-a-zone-available-custom-pages -// GET /zones/:zone_identifier/custom_pages - -// https://api.cloudflare.com/#custom-pages-for-a-zone-custom-page-details -// GET /zones/:zone_identifier/custom_pages/:identifier - -// https://api.cloudflare.com/#custom-pages-for-a-zone-update-custom-page-url -// PUT /zones/:zone_identifier/custom_pages/:identifier diff --git a/vendor/github.com/cloudflare/cloudflare-go/custom_hostname.go b/vendor/github.com/cloudflare/cloudflare-go/custom_hostname.go index 44dbc406..03216938 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/custom_hostname.go +++ b/vendor/github.com/cloudflare/cloudflare-go/custom_hostname.go @@ -8,13 +8,22 @@ import ( "github.com/pkg/errors" ) +// CustomHostnameSSLSettings represents the SSL settings for a custom hostname. +type CustomHostnameSSLSettings struct { + HTTP2 string `json:"http2,omitempty"` + TLS13 string `json:"tls_1_3,omitempty"` + MinTLSVersion string `json:"min_tls_version,omitempty"` + Ciphers []string `json:"ciphers,omitempty"` +} + // CustomHostnameSSL represents the SSL section in a given custom hostname. type CustomHostnameSSL struct { - Status string `json:"status,omitempty"` - Method string `json:"method,omitempty"` - Type string `json:"type,omitempty"` - CnameTarget string `json:"cname_target,omitempty"` - CnameName string `json:"cname_name,omitempty"` + Status string `json:"status,omitempty"` + Method string `json:"method,omitempty"` + Type string `json:"type,omitempty"` + CnameTarget string `json:"cname_target,omitempty"` + CnameName string `json:"cname,omitempty"` + Settings CustomHostnameSSLSettings `json:"settings,omitempty"` } // CustomMetadata defines custom metadata for the hostname. This requires logic to be implemented by Cloudflare to act on the data provided. @@ -28,7 +37,7 @@ type CustomHostname struct { CustomMetadata CustomMetadata `json:"custom_metadata,omitempty"` } -// CustomHostNameResponse represents a response from the Custom Hostnames endpoints. +// CustomHostnameResponse represents a response from the Custom Hostnames endpoints. type CustomHostnameResponse struct { Result CustomHostname `json:"result"` Response @@ -41,14 +50,16 @@ type CustomHostnameListResponse struct { ResultInfo `json:"result_info"` } -// Modify SSL configuration for the given custom hostname in the given zone. +// UpdateCustomHostnameSSL modifies SSL configuration for the given custom +// hostname in the given zone. // // API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-update-custom-hostname-configuration func (api *API) UpdateCustomHostnameSSL(zoneID string, customHostnameID string, ssl CustomHostnameSSL) (CustomHostname, error) { return CustomHostname{}, errors.New("Not implemented") } -// Delete a custom hostname (and any issued SSL certificates) +// DeleteCustomHostname deletes a custom hostname (and any issued SSL +// certificates). // // API reference: https://api.cloudflare.com/#custom-hostname-for-a-zone-delete-a-custom-hostname-and-any-issued-ssl-certificates- func (api *API) DeleteCustomHostname(zoneID string, customHostnameID string) error { diff --git a/vendor/github.com/cloudflare/cloudflare-go/custom_pages.go b/vendor/github.com/cloudflare/cloudflare-go/custom_pages.go new file mode 100644 index 00000000..d96788fc --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/custom_pages.go @@ -0,0 +1,176 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/pkg/errors" +) + +// CustomPage represents a custom page configuration. +type CustomPage struct { + CreatedOn time.Time `json:"created_on"` + ModifiedOn time.Time `json:"modified_on"` + URL interface{} `json:"url"` + State string `json:"state"` + RequiredTokens []string `json:"required_tokens"` + PreviewTarget string `json:"preview_target"` + Description string `json:"description"` + ID string `json:"id"` +} + +// CustomPageResponse represents the response from the custom pages endpoint. +type CustomPageResponse struct { + Response + Result []CustomPage `json:"result"` +} + +// CustomPageDetailResponse represents the response from the custom page endpoint. +type CustomPageDetailResponse struct { + Response + Result CustomPage `json:"result"` +} + +// CustomPageOptions is used to determine whether or not the operation +// should take place on an account or zone level based on which is +// provided to the function. +// +// A non-empty value denotes desired use. +type CustomPageOptions struct { + AccountID string + ZoneID string +} + +// CustomPageParameters is used to update a particular custom page with +// the values provided. +type CustomPageParameters struct { + URL interface{} `json:"url"` + State string `json:"state"` +} + +// CustomPages lists custom pages for a zone or account. +// +// Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-list-available-custom-pages +// Account API reference: https://api.cloudflare.com/#custom-pages-account--list-custom-pages +func (api *API) CustomPages(options *CustomPageOptions) ([]CustomPage, error) { + var ( + pageType, identifier string + ) + + if options.AccountID == "" && options.ZoneID == "" { + return nil, errors.New("either account ID or zone ID must be provided") + } + + if options.AccountID != "" && options.ZoneID != "" { + return nil, errors.New("account ID and zone ID are mutually exclusive") + } + + // Should the account ID be defined, treat this as an account level operation. + if options.AccountID != "" { + pageType = "accounts" + identifier = options.AccountID + } else { + pageType = "zones" + identifier = options.ZoneID + } + + uri := fmt.Sprintf("/%s/%s/custom_pages", pageType, identifier) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return nil, errors.Wrap(err, errMakeRequestError) + } + + var customPageResponse CustomPageResponse + err = json.Unmarshal(res, &customPageResponse) + if err != nil { + return nil, errors.Wrap(err, errUnmarshalError) + } + + return customPageResponse.Result, nil +} + +// CustomPage lists a single custom page based on the ID. +// +// Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-custom-page-details +// Account API reference: https://api.cloudflare.com/#custom-pages-account--custom-page-details +func (api *API) CustomPage(options *CustomPageOptions, customPageID string) (CustomPage, error) { + var ( + pageType, identifier string + ) + + if options.AccountID == "" && options.ZoneID == "" { + return CustomPage{}, errors.New("either account ID or zone ID must be provided") + } + + if options.AccountID != "" && options.ZoneID != "" { + return CustomPage{}, errors.New("account ID and zone ID are mutually exclusive") + } + + // Should the account ID be defined, treat this as an account level operation. + if options.AccountID != "" { + pageType = "accounts" + identifier = options.AccountID + } else { + pageType = "zones" + identifier = options.ZoneID + } + + uri := fmt.Sprintf("/%s/%s/custom_pages/%s", pageType, identifier, customPageID) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return CustomPage{}, errors.Wrap(err, errMakeRequestError) + } + + var customPageResponse CustomPageDetailResponse + err = json.Unmarshal(res, &customPageResponse) + if err != nil { + return CustomPage{}, errors.Wrap(err, errUnmarshalError) + } + + return customPageResponse.Result, nil +} + +// UpdateCustomPage updates a single custom page setting. +// +// Zone API reference: https://api.cloudflare.com/#custom-pages-for-a-zone-update-custom-page-url +// Account API reference: https://api.cloudflare.com/#custom-pages-account--update-custom-page +func (api *API) UpdateCustomPage(options *CustomPageOptions, customPageID string, pageParameters CustomPageParameters) (CustomPage, error) { + var ( + pageType, identifier string + ) + + if options.AccountID == "" && options.ZoneID == "" { + return CustomPage{}, errors.New("either account ID or zone ID must be provided") + } + + if options.AccountID != "" && options.ZoneID != "" { + return CustomPage{}, errors.New("account ID and zone ID are mutually exclusive") + } + + // Should the account ID be defined, treat this as an account level operation. + if options.AccountID != "" { + pageType = "accounts" + identifier = options.AccountID + } else { + pageType = "zones" + identifier = options.ZoneID + } + + uri := fmt.Sprintf("/%s/%s/custom_pages/%s", pageType, identifier, customPageID) + + res, err := api.makeRequest("PUT", uri, pageParameters) + if err != nil { + return CustomPage{}, errors.Wrap(err, errMakeRequestError) + } + + var customPageResponse CustomPageDetailResponse + err = json.Unmarshal(res, &customPageResponse) + if err != nil { + return CustomPage{}, errors.Wrap(err, errUnmarshalError) + } + + return customPageResponse.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/dns.go b/vendor/github.com/cloudflare/cloudflare-go/dns.go index 3303e9d0..6bcac248 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/dns.go +++ b/vendor/github.com/cloudflare/cloudflare-go/dns.go @@ -16,7 +16,7 @@ type DNSRecord struct { Name string `json:"name,omitempty"` Content string `json:"content,omitempty"` Proxiable bool `json:"proxiable,omitempty"` - Proxied bool `json:"proxied,omitempty"` + Proxied bool `json:"proxied"` TTL int `json:"ttl,omitempty"` Locked bool `json:"locked,omitempty"` ZoneID string `json:"zone_id,omitempty"` @@ -25,7 +25,7 @@ type DNSRecord struct { ModifiedOn time.Time `json:"modified_on,omitempty"` Data interface{} `json:"data,omitempty"` // data returned by: SRV, LOC Meta interface{} `json:"meta,omitempty"` - Priority int `json:"priority,omitempty"` + Priority int `json:"priority"` } // DNSRecordResponse represents the response from the DNS endpoint. @@ -143,7 +143,7 @@ func (api *API) UpdateDNSRecord(zoneID, recordID string, rr DNSRecord) error { } rr.Type = rec.Type uri := "/zones/" + zoneID + "/dns_records/" + recordID - res, err := api.makeRequest("PUT", uri, rr) + res, err := api.makeRequest("PATCH", uri, rr) if err != nil { return errors.Wrap(err, errMakeRequestError) } diff --git a/vendor/github.com/cloudflare/cloudflare-go/duration.go b/vendor/github.com/cloudflare/cloudflare-go/duration.go new file mode 100644 index 00000000..ba2418ac --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/duration.go @@ -0,0 +1,40 @@ +package cloudflare + +import ( + "encoding/json" + "time" +) + +// Duration implements json.Marshaler and json.Unmarshaler for time.Duration +// using the fmt.Stringer interface of time.Duration and time.ParseDuration. +type Duration struct { + time.Duration +} + +// MarshalJSON encodes a Duration as a JSON string formatted using String. +func (d Duration) MarshalJSON() ([]byte, error) { + return json.Marshal(d.Duration.String()) +} + +// UnmarshalJSON decodes a Duration from a JSON string parsed using time.ParseDuration. +func (d *Duration) UnmarshalJSON(buf []byte) error { + var str string + + err := json.Unmarshal(buf, &str) + if err != nil { + return err + } + + dur, err := time.ParseDuration(str) + if err != nil { + return err + } + + d.Duration = dur + return nil +} + +var ( + _ = json.Marshaler((*Duration)(nil)) + _ = json.Unmarshaler((*Duration)(nil)) +) diff --git a/vendor/github.com/cloudflare/cloudflare-go/errors.go b/vendor/github.com/cloudflare/cloudflare-go/errors.go index 2fff3db3..bc23631f 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/errors.go +++ b/vendor/github.com/cloudflare/cloudflare-go/errors.go @@ -6,6 +6,7 @@ const ( errMakeRequestError = "error from makeRequest" errUnmarshalError = "error unmarshalling the JSON response" errRequestNotSuccessful = "error reported by API" + errMissingAccountID = "account ID is empty and must be provided" ) var _ Error = &UserError{} diff --git a/vendor/github.com/cloudflare/cloudflare-go/filter.go b/vendor/github.com/cloudflare/cloudflare-go/filter.go new file mode 100644 index 00000000..cf3ef1c2 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/filter.go @@ -0,0 +1,241 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + "strings" + + "github.com/pkg/errors" +) + +// Filter holds the structure of the filter type. +type Filter struct { + ID string `json:"id,omitempty"` + Expression string `json:"expression"` + Paused bool `json:"paused"` + Description string `json:"description"` + + // Property is mentioned in documentation however isn't populated in + // any of the API requests. For now, let's just omit it unless it's + // provided. + Ref string `json:"ref,omitempty"` +} + +// FiltersDetailResponse is the API response that is returned +// for requesting all filters on a zone. +type FiltersDetailResponse struct { + Result []Filter `json:"result"` + ResultInfo `json:"result_info"` + Response +} + +// FilterDetailResponse is the API response that is returned +// for requesting a single filter on a zone. +type FilterDetailResponse struct { + Result Filter `json:"result"` + ResultInfo `json:"result_info"` + Response +} + +// FilterValidateExpression represents the JSON payload for checking +// an expression. +type FilterValidateExpression struct { + Expression string `json:"expression"` +} + +// FilterValidateExpressionResponse represents the API response for +// checking the expression. It conforms to the JSON API approach however +// we don't need all of the fields exposed. +type FilterValidateExpressionResponse struct { + Success bool `json:"success"` + Errors []FilterValidationExpressionMessage `json:"errors"` +} + +// FilterValidationExpressionMessage represents the API error message. +type FilterValidationExpressionMessage struct { + Message string `json:"message"` +} + +// Filter returns a single filter in a zone based on the filter ID. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/get/#get-by-filter-id +func (api *API) Filter(zoneID, filterID string) (Filter, error) { + uri := fmt.Sprintf("/zones/%s/filters/%s", zoneID, filterID) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return Filter{}, errors.Wrap(err, errMakeRequestError) + } + + var filterResponse FilterDetailResponse + err = json.Unmarshal(res, &filterResponse) + if err != nil { + return Filter{}, errors.Wrap(err, errUnmarshalError) + } + + return filterResponse.Result, nil +} + +// Filters returns all filters for a zone. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/get/#get-all-filters +func (api *API) Filters(zoneID string, pageOpts PaginationOptions) ([]Filter, error) { + uri := "/zones/" + zoneID + "/filters" + v := url.Values{} + + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []Filter{}, errors.Wrap(err, errMakeRequestError) + } + + var filtersResponse FiltersDetailResponse + err = json.Unmarshal(res, &filtersResponse) + if err != nil { + return []Filter{}, errors.Wrap(err, errUnmarshalError) + } + + return filtersResponse.Result, nil +} + +// CreateFilters creates new filters. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/post/ +func (api *API) CreateFilters(zoneID string, filters []Filter) ([]Filter, error) { + uri := "/zones/" + zoneID + "/filters" + + res, err := api.makeRequest("POST", uri, filters) + if err != nil { + return []Filter{}, errors.Wrap(err, errMakeRequestError) + } + + var filtersResponse FiltersDetailResponse + err = json.Unmarshal(res, &filtersResponse) + if err != nil { + return []Filter{}, errors.Wrap(err, errUnmarshalError) + } + + return filtersResponse.Result, nil +} + +// UpdateFilter updates a single filter. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/put/#update-a-single-filter +func (api *API) UpdateFilter(zoneID string, filter Filter) (Filter, error) { + if filter.ID == "" { + return Filter{}, errors.Errorf("filter ID cannot be empty") + } + + uri := fmt.Sprintf("/zones/%s/filters/%s", zoneID, filter.ID) + + res, err := api.makeRequest("PUT", uri, filter) + if err != nil { + return Filter{}, errors.Wrap(err, errMakeRequestError) + } + + var filterResponse FilterDetailResponse + err = json.Unmarshal(res, &filterResponse) + if err != nil { + return Filter{}, errors.Wrap(err, errUnmarshalError) + } + + return filterResponse.Result, nil +} + +// UpdateFilters updates many filters at once. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/put/#update-multiple-filters +func (api *API) UpdateFilters(zoneID string, filters []Filter) ([]Filter, error) { + for _, filter := range filters { + if filter.ID == "" { + return []Filter{}, errors.Errorf("filter ID cannot be empty") + } + } + + uri := "/zones/" + zoneID + "/filters" + + res, err := api.makeRequest("PUT", uri, filters) + if err != nil { + return []Filter{}, errors.Wrap(err, errMakeRequestError) + } + + var filtersResponse FiltersDetailResponse + err = json.Unmarshal(res, &filtersResponse) + if err != nil { + return []Filter{}, errors.Wrap(err, errUnmarshalError) + } + + return filtersResponse.Result, nil +} + +// DeleteFilter deletes a single filter. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/delete/#delete-a-single-filter +func (api *API) DeleteFilter(zoneID, filterID string) error { + if filterID == "" { + return errors.Errorf("filter ID cannot be empty") + } + + uri := fmt.Sprintf("/zones/%s/filters/%s", zoneID, filterID) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} + +// DeleteFilters deletes multiple filters. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/delete/#delete-multiple-filters +func (api *API) DeleteFilters(zoneID string, filterIDs []string) error { + ids := strings.Join(filterIDs, ",") + uri := fmt.Sprintf("/zones/%s/filters?id=%s", zoneID, ids) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} + +// ValidateFilterExpression checks correctness of a filter expression. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-filters/validation/ +func (api *API) ValidateFilterExpression(expression string) error { + uri := fmt.Sprintf("/filters/validate-expr") + expressionPayload := FilterValidateExpression{Expression: expression} + + _, err := api.makeRequest("POST", uri, expressionPayload) + if err != nil { + var filterValidationResponse FilterValidateExpressionResponse + + jsonErr := json.Unmarshal([]byte(err.Error()), &filterValidationResponse) + if jsonErr != nil { + return errors.Wrap(jsonErr, errUnmarshalError) + } + + if filterValidationResponse.Success != true { + // Unsure why but the API returns `errors` as an array but it only + // ever shows the issue with one problem at a time ¯\_(ツ)_/¯ + return errors.Errorf(filterValidationResponse.Errors[0].Message) + } + } + + return nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/firewall.go b/vendor/github.com/cloudflare/cloudflare-go/firewall.go index 9246b7e6..1f1dfe5e 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/firewall.go +++ b/vendor/github.com/cloudflare/cloudflare-go/firewall.go @@ -68,6 +68,13 @@ func (api *API) CreateUserAccessRule(accessRule AccessRule) (*AccessRuleResponse return api.createAccessRule("/user", accessRule) } +// UserAccessRule returns the details of a user's account access rule. +// +// API reference: https://api.cloudflare.com/#user-level-firewall-access-rule-list-access-rules +func (api *API) UserAccessRule(accessRuleID string) (*AccessRuleResponse, error) { + return api.retrieveAccessRule("/user", accessRuleID) +} + // UpdateUserAccessRule updates a single access rule for the logged-in user & // given access rule identifier. // @@ -102,6 +109,13 @@ func (api *API) CreateZoneAccessRule(zoneID string, accessRule AccessRule) (*Acc return api.createAccessRule("/zones/"+zoneID, accessRule) } +// ZoneAccessRule returns the details of a zone's access rule. +// +// API reference: https://api.cloudflare.com/#firewall-access-rule-for-a-zone-list-access-rules +func (api *API) ZoneAccessRule(zoneID string, accessRuleID string) (*AccessRuleResponse, error) { + return api.retrieveAccessRule("/zones/"+zoneID, accessRuleID) +} + // UpdateZoneAccessRule updates a single access rule for the given zone & // access rule identifiers. // @@ -125,7 +139,7 @@ func (api *API) DeleteZoneAccessRule(zoneID, accessRuleID string) (*AccessRuleRe // // API reference: https://api.cloudflare.com/#organization-level-firewall-access-rule-list-access-rules func (api *API) ListOrganizationAccessRules(organizationID string, accessRule AccessRule, page int) (*AccessRuleListResponse, error) { - return api.listAccessRules("/organizations/"+organizationID, accessRule, page) + return api.listAccessRules("/accounts/"+organizationID, accessRule, page) } // CreateOrganizationAccessRule creates a firewall access rule for the given @@ -133,7 +147,14 @@ func (api *API) ListOrganizationAccessRules(organizationID string, accessRule Ac // // API reference: https://api.cloudflare.com/#organization-level-firewall-access-rule-create-access-rule func (api *API) CreateOrganizationAccessRule(organizationID string, accessRule AccessRule) (*AccessRuleResponse, error) { - return api.createAccessRule("/organizations/"+organizationID, accessRule) + return api.createAccessRule("/accounts/"+organizationID, accessRule) +} + +// OrganizationAccessRule returns the details of an organization's access rule. +// +// API reference: https://api.cloudflare.com/#account-level-firewall-access-rule-access-rule-details +func (api *API) OrganizationAccessRule(organizationID string, accessRuleID string) (*AccessRuleResponse, error) { + return api.retrieveAccessRule("/accounts/"+organizationID, accessRuleID) } // UpdateOrganizationAccessRule updates a single access rule for the given @@ -141,7 +162,7 @@ func (api *API) CreateOrganizationAccessRule(organizationID string, accessRule A // // API reference: https://api.cloudflare.com/#organization-level-firewall-access-rule-update-access-rule func (api *API) UpdateOrganizationAccessRule(organizationID, accessRuleID string, accessRule AccessRule) (*AccessRuleResponse, error) { - return api.updateAccessRule("/organizations/"+organizationID, accessRuleID, accessRule) + return api.updateAccessRule("/accounts/"+organizationID, accessRuleID, accessRule) } // DeleteOrganizationAccessRule deletes a single access rule for the given @@ -149,7 +170,7 @@ func (api *API) UpdateOrganizationAccessRule(organizationID, accessRuleID string // // API reference: https://api.cloudflare.com/#organization-level-firewall-access-rule-delete-access-rule func (api *API) DeleteOrganizationAccessRule(organizationID, accessRuleID string) (*AccessRuleResponse, error) { - return api.deleteAccessRule("/organizations/"+organizationID, accessRuleID) + return api.deleteAccessRule("/accounts/"+organizationID, accessRuleID) } func (api *API) listAccessRules(prefix string, accessRule AccessRule, page int) (*AccessRuleListResponse, error) { @@ -209,6 +230,24 @@ func (api *API) createAccessRule(prefix string, accessRule AccessRule) (*AccessR return response, nil } +func (api *API) retrieveAccessRule(prefix, accessRuleID string) (*AccessRuleResponse, error) { + uri := prefix + "/firewall/access_rules/rules/" + accessRuleID + + res, err := api.makeRequest("GET", uri, nil) + + if err != nil { + return nil, errors.Wrap(err, errMakeRequestError) + } + + response := &AccessRuleResponse{} + err = json.Unmarshal(res, &response) + if err != nil { + return nil, errors.Wrap(err, errUnmarshalError) + } + + return response, nil +} + func (api *API) updateAccessRule(prefix, accessRuleID string, accessRule AccessRule) (*AccessRuleResponse, error) { uri := prefix + "/firewall/access_rules/rules/" + accessRuleID res, err := api.makeRequest("PATCH", uri, accessRule) diff --git a/vendor/github.com/cloudflare/cloudflare-go/firewall_rules.go b/vendor/github.com/cloudflare/cloudflare-go/firewall_rules.go new file mode 100644 index 00000000..7a6ce5c7 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/firewall_rules.go @@ -0,0 +1,196 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "net/url" + "strconv" + "strings" + "time" + + "github.com/pkg/errors" +) + +// FirewallRule is the struct of the firewall rule. +type FirewallRule struct { + ID string `json:"id,omitempty"` + Paused bool `json:"paused"` + Description string `json:"description"` + Action string `json:"action"` + Priority interface{} `json:"priority"` + Filter Filter `json:"filter"` + CreatedOn time.Time `json:"created_on,omitempty"` + ModifiedOn time.Time `json:"modified_on,omitempty"` +} + +// FirewallRulesDetailResponse is the API response for the firewall +// rules. +type FirewallRulesDetailResponse struct { + Result []FirewallRule `json:"result"` + ResultInfo `json:"result_info"` + Response +} + +// FirewallRuleResponse is the API response that is returned +// for requesting a single firewall rule on a zone. +type FirewallRuleResponse struct { + Result FirewallRule `json:"result"` + ResultInfo `json:"result_info"` + Response +} + +// FirewallRules returns all firewall rules. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/#get-all-rules +func (api *API) FirewallRules(zoneID string, pageOpts PaginationOptions) ([]FirewallRule, error) { + uri := fmt.Sprintf("/zones/%s/firewall/rules", zoneID) + v := url.Values{} + + if pageOpts.PerPage > 0 { + v.Set("per_page", strconv.Itoa(pageOpts.PerPage)) + } + + if pageOpts.Page > 0 { + v.Set("page", strconv.Itoa(pageOpts.Page)) + } + + if len(v) > 0 { + uri = uri + "?" + v.Encode() + } + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errMakeRequestError) + } + + var firewallDetailResponse FirewallRulesDetailResponse + err = json.Unmarshal(res, &firewallDetailResponse) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errUnmarshalError) + } + + return firewallDetailResponse.Result, nil +} + +// FirewallRule returns a single firewall rule based on the ID. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/get/#get-by-rule-id +func (api *API) FirewallRule(zoneID, firewallRuleID string) (FirewallRule, error) { + uri := fmt.Sprintf("/zones/%s/firewall/rules/%s", zoneID, firewallRuleID) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return FirewallRule{}, errors.Wrap(err, errMakeRequestError) + } + + var firewallRuleResponse FirewallRuleResponse + err = json.Unmarshal(res, &firewallRuleResponse) + if err != nil { + return FirewallRule{}, errors.Wrap(err, errUnmarshalError) + } + + return firewallRuleResponse.Result, nil +} + +// CreateFirewallRules creates new firewall rules. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/post/ +func (api *API) CreateFirewallRules(zoneID string, firewallRules []FirewallRule) ([]FirewallRule, error) { + uri := fmt.Sprintf("/zones/%s/firewall/rules", zoneID) + + res, err := api.makeRequest("POST", uri, firewallRules) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errMakeRequestError) + } + + var firewallRulesDetailResponse FirewallRulesDetailResponse + err = json.Unmarshal(res, &firewallRulesDetailResponse) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errUnmarshalError) + } + + return firewallRulesDetailResponse.Result, nil +} + +// UpdateFirewallRule updates a single firewall rule. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/put/#update-a-single-rule +func (api *API) UpdateFirewallRule(zoneID string, firewallRule FirewallRule) (FirewallRule, error) { + if firewallRule.ID == "" { + return FirewallRule{}, errors.Errorf("firewall rule ID cannot be empty") + } + + uri := fmt.Sprintf("/zones/%s/firewall/rules/%s", zoneID, firewallRule.ID) + + res, err := api.makeRequest("PUT", uri, firewallRule) + if err != nil { + return FirewallRule{}, errors.Wrap(err, errMakeRequestError) + } + + var firewallRuleResponse FirewallRuleResponse + err = json.Unmarshal(res, &firewallRuleResponse) + if err != nil { + return FirewallRule{}, errors.Wrap(err, errUnmarshalError) + } + + return firewallRuleResponse.Result, nil +} + +// UpdateFirewallRules updates a single firewall rule. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/put/#update-multiple-rules +func (api *API) UpdateFirewallRules(zoneID string, firewallRules []FirewallRule) ([]FirewallRule, error) { + for _, firewallRule := range firewallRules { + if firewallRule.ID == "" { + return []FirewallRule{}, errors.Errorf("firewall ID cannot be empty") + } + } + + uri := fmt.Sprintf("/zones/%s/firewall/rules", zoneID) + + res, err := api.makeRequest("PUT", uri, firewallRules) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errMakeRequestError) + } + + var firewallRulesDetailResponse FirewallRulesDetailResponse + err = json.Unmarshal(res, &firewallRulesDetailResponse) + if err != nil { + return []FirewallRule{}, errors.Wrap(err, errUnmarshalError) + } + + return firewallRulesDetailResponse.Result, nil +} + +// DeleteFirewallRule updates a single firewall rule. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/delete/#delete-a-single-rule +func (api *API) DeleteFirewallRule(zoneID, firewallRuleID string) error { + if firewallRuleID == "" { + return errors.Errorf("firewall rule ID cannot be empty") + } + + uri := fmt.Sprintf("/zones/%s/firewall/rules/%s", zoneID, firewallRuleID) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} + +// DeleteFirewallRules updates a single firewall rule. +// +// API reference: https://developers.cloudflare.com/firewall/api/cf-firewall-rules/delete/#delete-multiple-rules +func (api *API) DeleteFirewallRules(zoneID string, firewallRuleIDs []string) error { + ids := strings.Join(firewallRuleIDs, ",") + uri := fmt.Sprintf("/zones/%s/firewall/rules?id=%s", zoneID, ids) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/load_balancing.go b/vendor/github.com/cloudflare/cloudflare-go/load_balancing.go index e1af07b5..8b2f89a6 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/load_balancing.go +++ b/vendor/github.com/cloudflare/cloudflare-go/load_balancing.go @@ -25,6 +25,7 @@ type LoadBalancerPool struct { CheckRegions []string `json:"check_regions"` } +// LoadBalancerOrigin represents a Load Balancer origin's properties. type LoadBalancerOrigin struct { Name string `json:"name"` Address string `json:"address"` @@ -34,35 +35,69 @@ type LoadBalancerOrigin struct { // LoadBalancerMonitor represents a load balancer monitor's properties. type LoadBalancerMonitor struct { - ID string `json:"id,omitempty"` - CreatedOn *time.Time `json:"created_on,omitempty"` - ModifiedOn *time.Time `json:"modified_on,omitempty"` - Type string `json:"type"` - Description string `json:"description"` - Method string `json:"method"` - Path string `json:"path"` - Header map[string][]string `json:"header"` - Timeout int `json:"timeout"` - Retries int `json:"retries"` - Interval int `json:"interval"` - ExpectedBody string `json:"expected_body"` - ExpectedCodes string `json:"expected_codes"` + ID string `json:"id,omitempty"` + CreatedOn *time.Time `json:"created_on,omitempty"` + ModifiedOn *time.Time `json:"modified_on,omitempty"` + Type string `json:"type"` + Description string `json:"description"` + Method string `json:"method"` + Path string `json:"path"` + Header map[string][]string `json:"header"` + Timeout int `json:"timeout"` + Retries int `json:"retries"` + Interval int `json:"interval"` + Port uint16 `json:"port,omitempty"` + ExpectedBody string `json:"expected_body"` + ExpectedCodes string `json:"expected_codes"` + FollowRedirects bool `json:"follow_redirects"` + AllowInsecure bool `json:"allow_insecure"` + ProbeZone string `json:"probe_zone"` } // LoadBalancer represents a load balancer's properties. type LoadBalancer struct { - ID string `json:"id,omitempty"` - CreatedOn *time.Time `json:"created_on,omitempty"` - ModifiedOn *time.Time `json:"modified_on,omitempty"` - Description string `json:"description"` - Name string `json:"name"` - TTL int `json:"ttl,omitempty"` - FallbackPool string `json:"fallback_pool"` - DefaultPools []string `json:"default_pools"` - RegionPools map[string][]string `json:"region_pools"` - PopPools map[string][]string `json:"pop_pools"` - Proxied bool `json:"proxied"` - Persistence string `json:"session_affinity,omitempty"` + ID string `json:"id,omitempty"` + CreatedOn *time.Time `json:"created_on,omitempty"` + ModifiedOn *time.Time `json:"modified_on,omitempty"` + Description string `json:"description"` + Name string `json:"name"` + TTL int `json:"ttl,omitempty"` + FallbackPool string `json:"fallback_pool"` + DefaultPools []string `json:"default_pools"` + RegionPools map[string][]string `json:"region_pools"` + PopPools map[string][]string `json:"pop_pools"` + Proxied bool `json:"proxied"` + Enabled *bool `json:"enabled,omitempty"` + Persistence string `json:"session_affinity,omitempty"` + PersistenceTTL int `json:"session_affinity_ttl,omitempty"` + + // SteeringPolicy controls pool selection logic. + // "off" select pools in DefaultPools order + // "geo" select pools based on RegionPools/PopPools + // "dynamic_latency" select pools based on RTT (requires health checks) + // "random" selects pools in a random order + // "" maps to "geo" if RegionPools or PopPools have entries otherwise "off" + SteeringPolicy string `json:"steering_policy,omitempty"` +} + +// LoadBalancerOriginHealth represents the health of the origin. +type LoadBalancerOriginHealth struct { + Healthy bool `json:"healthy,omitempty"` + RTT Duration `json:"rtt,omitempty"` + FailureReason string `json:"failure_reason,omitempty"` + ResponseCode int `json:"response_code,omitempty"` +} + +// LoadBalancerPoolPopHealth represents the health of the pool for given PoP. +type LoadBalancerPoolPopHealth struct { + Healthy bool `json:"healthy,omitempty"` + Origins []map[string]LoadBalancerOriginHealth `json:"origins,omitempty"` +} + +// LoadBalancerPoolHealth represents the healthchecks from different PoPs for a pool. +type LoadBalancerPoolHealth struct { + ID string `json:"pool_id,omitempty"` + PopHealth map[string]LoadBalancerPoolPopHealth `json:"pop_health,omitempty"` } // loadBalancerPoolResponse represents the response from the load balancer pool endpoints. @@ -104,6 +139,12 @@ type loadBalancerListResponse struct { ResultInfo ResultInfo `json:"result_info"` } +// loadBalancerPoolHealthResponse represents the response from the Pool Health Details endpoint. +type loadBalancerPoolHealthResponse struct { + Response + Result LoadBalancerPoolHealth `json:"result"` +} + // CreateLoadBalancerPool creates a new load balancer pool. // // API reference: https://api.cloudflare.com/#load-balancer-pools-create-a-pool @@ -328,3 +369,19 @@ func (api *API) ModifyLoadBalancer(zoneID string, lb LoadBalancer) (LoadBalancer } return r.Result, nil } + +// PoolHealthDetails fetches the latest healtcheck details for a single pool. +// +// API reference: https://api.cloudflare.com/#load-balancer-pools-pool-health-details +func (api *API) PoolHealthDetails(poolID string) (LoadBalancerPoolHealth, error) { + uri := api.userBaseURL("/user") + "/load_balancers/pools/" + poolID + "/health" + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return LoadBalancerPoolHealth{}, errors.Wrap(err, errMakeRequestError) + } + var r loadBalancerPoolHealthResponse + if err := json.Unmarshal(res, &r); err != nil { + return LoadBalancerPoolHealth{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/lockdown.go b/vendor/github.com/cloudflare/cloudflare-go/lockdown.go index 3dba81c2..164129bc 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/lockdown.go +++ b/vendor/github.com/cloudflare/cloudflare-go/lockdown.go @@ -16,6 +16,7 @@ type ZoneLockdown struct { URLs []string `json:"urls"` Configurations []ZoneLockdownConfig `json:"configurations"` Paused bool `json:"paused"` + Priority int `json:"priority,omitempty"` } // ZoneLockdownConfig represents a Zone Lockdown config, which comprises @@ -65,7 +66,7 @@ func (api *API) CreateZoneLockdown(zoneID string, ld ZoneLockdown) (*ZoneLockdow // // API reference: https://api.cloudflare.com/#zone-ZoneLockdown-update-ZoneLockdown-rule func (api *API) UpdateZoneLockdown(zoneID string, id string, ld ZoneLockdown) (*ZoneLockdownResponse, error) { - uri := "/zones/" + zoneID + "/firewall/lockdowns" + uri := "/zones/" + zoneID + "/firewall/lockdowns/" + id res, err := api.makeRequest("PUT", uri, ld) if err != nil { return nil, errors.Wrap(err, errMakeRequestError) diff --git a/vendor/github.com/cloudflare/cloudflare-go/logpush.go b/vendor/github.com/cloudflare/cloudflare-go/logpush.go new file mode 100644 index 00000000..a0134ade --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/logpush.go @@ -0,0 +1,224 @@ +package cloudflare + +import ( + "encoding/json" + "strconv" + "time" + + "github.com/pkg/errors" +) + +// LogpushJob describes a Logpush job. +type LogpushJob struct { + ID int `json:"id,omitempty"` + Enabled bool `json:"enabled"` + Name string `json:"name"` + LogpullOptions string `json:"logpull_options"` + DestinationConf string `json:"destination_conf"` + OwnershipChallenge string `json:"ownership_challenge,omitempty"` + LastComplete *time.Time `json:"last_complete,omitempty"` + LastError *time.Time `json:"last_error,omitempty"` + ErrorMessage string `json:"error_message,omitempty"` +} + +// LogpushJobsResponse is the API response, containing an array of Logpush Jobs. +type LogpushJobsResponse struct { + Response + Result []LogpushJob `json:"result"` +} + +// LogpushJobDetailsResponse is the API response, containing a single Logpush Job. +type LogpushJobDetailsResponse struct { + Response + Result LogpushJob `json:"result"` +} + +// LogpushGetOwnershipChallenge describes a ownership validation. +type LogpushGetOwnershipChallenge struct { + Filename string `json:"filename"` + Valid bool `json:"valid"` + Message string `json:"message"` +} + +// LogpushGetOwnershipChallengeResponse is the API response, containing a ownership challenge. +type LogpushGetOwnershipChallengeResponse struct { + Response + Result LogpushGetOwnershipChallenge `json:"result"` +} + +// LogpushGetOwnershipChallengeRequest is the API request for get ownership challenge. +type LogpushGetOwnershipChallengeRequest struct { + DestinationConf string `json:"destination_conf"` +} + +// LogpushOwnershipChallangeValidationResponse is the API response, +// containing a ownership challenge validation result. +type LogpushOwnershipChallangeValidationResponse struct { + Response + Result struct { + Valid bool `json:"valid"` + } +} + +// LogpushValidateOwnershipChallengeRequest is the API request for validate ownership challenge. +type LogpushValidateOwnershipChallengeRequest struct { + DestinationConf string `json:"destination_conf"` + OwnershipChallenge string `json:"ownership_challenge"` +} + +// LogpushDestinationExistsResponse is the API response, +// containing a destination exists check result. +type LogpushDestinationExistsResponse struct { + Response + Result struct { + Exists bool `json:"exists"` + } +} + +// LogpushDestinationExistsRequest is the API request for check destination exists. +type LogpushDestinationExistsRequest struct { + DestinationConf string `json:"destination_conf"` +} + +// CreateLogpushJob creates a new LogpushJob for a zone. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-create-logpush-job +func (api *API) CreateLogpushJob(zoneID string, job LogpushJob) (*LogpushJob, error) { + uri := "/zones/" + zoneID + "/logpush/jobs" + res, err := api.makeRequest("POST", uri, job) + if err != nil { + return nil, errors.Wrap(err, errMakeRequestError) + } + var r LogpushJobDetailsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return nil, errors.Wrap(err, errUnmarshalError) + } + return &r.Result, nil +} + +// LogpushJobs returns all Logpush Jobs for a zone. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-list-logpush-jobs +func (api *API) LogpushJobs(zoneID string) ([]LogpushJob, error) { + uri := "/zones/" + zoneID + "/logpush/jobs" + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []LogpushJob{}, errors.Wrap(err, errMakeRequestError) + } + var r LogpushJobsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return []LogpushJob{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// LogpushJob fetches detail about one Logpush Job for a zone. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-logpush-job-details +func (api *API) LogpushJob(zoneID string, jobID int) (LogpushJob, error) { + uri := "/zones/" + zoneID + "/logpush/jobs/" + strconv.Itoa(jobID) + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return LogpushJob{}, errors.Wrap(err, errMakeRequestError) + } + var r LogpushJobDetailsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return LogpushJob{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// UpdateLogpushJob lets you update a Logpush Job. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-update-logpush-job +func (api *API) UpdateLogpushJob(zoneID string, jobID int, job LogpushJob) error { + uri := "/zones/" + zoneID + "/logpush/jobs/" + strconv.Itoa(jobID) + res, err := api.makeRequest("PUT", uri, job) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + var r LogpushJobDetailsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return errors.Wrap(err, errUnmarshalError) + } + return nil +} + +// DeleteLogpushJob deletes a Logpush Job for a zone. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-delete-logpush-job +func (api *API) DeleteLogpushJob(zoneID string, jobID int) error { + uri := "/zones/" + zoneID + "/logpush/jobs/" + strconv.Itoa(jobID) + res, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + var r LogpushJobDetailsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return errors.Wrap(err, errUnmarshalError) + } + return nil +} + +// GetLogpushOwnershipChallenge returns ownership challenge. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-get-ownership-challenge +func (api *API) GetLogpushOwnershipChallenge(zoneID, destinationConf string) (*LogpushGetOwnershipChallenge, error) { + uri := "/zones/" + zoneID + "/logpush/ownership" + res, err := api.makeRequest("POST", uri, LogpushGetOwnershipChallengeRequest{ + DestinationConf: destinationConf, + }) + if err != nil { + return nil, errors.Wrap(err, errMakeRequestError) + } + var r LogpushGetOwnershipChallengeResponse + err = json.Unmarshal(res, &r) + if err != nil { + return nil, errors.Wrap(err, errUnmarshalError) + } + return &r.Result, nil +} + +// ValidateLogpushOwnershipChallenge returns ownership challenge validation result. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-validate-ownership-challenge +func (api *API) ValidateLogpushOwnershipChallenge(zoneID, destinationConf, ownershipChallenge string) (bool, error) { + uri := "/zones/" + zoneID + "/logpush/ownership/validate" + res, err := api.makeRequest("POST", uri, LogpushValidateOwnershipChallengeRequest{ + DestinationConf: destinationConf, + OwnershipChallenge: ownershipChallenge, + }) + if err != nil { + return false, errors.Wrap(err, errMakeRequestError) + } + var r LogpushGetOwnershipChallengeResponse + err = json.Unmarshal(res, &r) + if err != nil { + return false, errors.Wrap(err, errUnmarshalError) + } + return r.Result.Valid, nil +} + +// CheckLogpushDestinationExists returns destination exists check result. +// +// API reference: https://api.cloudflare.com/#logpush-jobs-check-destination-exists +func (api *API) CheckLogpushDestinationExists(zoneID, destinationConf string) (bool, error) { + uri := "/zones/" + zoneID + "/logpush/validate/destination/exists" + res, err := api.makeRequest("POST", uri, LogpushDestinationExistsRequest{ + DestinationConf: destinationConf, + }) + if err != nil { + return false, errors.Wrap(err, errMakeRequestError) + } + var r LogpushDestinationExistsResponse + err = json.Unmarshal(res, &r) + if err != nil { + return false, errors.Wrap(err, errUnmarshalError) + } + return r.Result.Exists, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/options.go b/vendor/github.com/cloudflare/cloudflare-go/options.go index 1a113ee1..6cd6fc11 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/options.go +++ b/vendor/github.com/cloudflare/cloudflare-go/options.go @@ -28,11 +28,11 @@ func Headers(headers http.Header) Option { } } -// Organization allows you to apply account-level changes (Load Balancing, Railguns) -// to an organization instead. +// UsingOrganization allows you to apply account-level changes (Load Balancing, +// Railguns) to an organization instead. func UsingOrganization(orgID string) Option { return func(api *API) error { - api.organizationID = orgID + api.OrganizationID = orgID return nil } } @@ -73,6 +73,17 @@ func UsingLogger(logger Logger) Option { } } +// UserAgent can be set if you want to send a software name and version for HTTP access logs. +// It is recommended to set it in order to help future Customer Support diagnostics +// and prevent collateral damage by sharing generic User-Agent string with abusive users. +// E.g. "my-software/1.2.3". By default generic Go User-Agent is used. +func UserAgent(userAgent string) Option { + return func(api *API) error { + api.UserAgent = userAgent + return nil + } +} + // parseOptions parses the supplied options functions and returns a configured // *API instance. func (api *API) parseOptions(opts ...Option) error { diff --git a/vendor/github.com/cloudflare/cloudflare-go/organizations.go b/vendor/github.com/cloudflare/cloudflare-go/organizations.go index 97a67e77..02765159 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/organizations.go +++ b/vendor/github.com/cloudflare/cloudflare-go/organizations.go @@ -139,7 +139,8 @@ type organizationInvitesResponse struct { ResultInfo `json:"result_info"` } -// OrganizationMembers returns list of invites for specified organization of the logged-in user. +// OrganizationInvites returns list of invites for specified organization of +// the logged-in user. // // API reference: https://api.cloudflare.com/#organization-invites func (api *API) OrganizationInvites(organizationID string) ([]OrganizationInvite, ResultInfo, error) { diff --git a/vendor/github.com/cloudflare/cloudflare-go/origin_ca.go b/vendor/github.com/cloudflare/cloudflare-go/origin_ca.go index 486033af..fdd8c427 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/origin_ca.go +++ b/vendor/github.com/cloudflare/cloudflare-go/origin_ca.go @@ -1,6 +1,7 @@ package cloudflare import ( + "context" "encoding/json" "net/url" "time" @@ -57,7 +58,7 @@ type originCACertificateResponseRevoke struct { // API reference: https://api.cloudflare.com/#cloudflare-ca-create-certificate func (api *API) CreateOriginCertificate(certificate OriginCACertificate) (*OriginCACertificate, error) { uri := "/certificates" - res, err := api.makeRequestWithAuthType("POST", uri, certificate, AuthUserService) + res, err := api.makeRequestWithAuthType(context.TODO(), "POST", uri, certificate, AuthUserService) if err != nil { return nil, errors.Wrap(err, errMakeRequestError) @@ -89,7 +90,7 @@ func (api *API) OriginCertificates(options OriginCACertificateListOptions) ([]Or v.Set("zone_id", options.ZoneID) } uri := "/certificates" + "?" + v.Encode() - res, err := api.makeRequestWithAuthType("GET", uri, nil, AuthUserService) + res, err := api.makeRequestWithAuthType(context.TODO(), "GET", uri, nil, AuthUserService) if err != nil { return nil, errors.Wrap(err, errMakeRequestError) @@ -117,7 +118,7 @@ func (api *API) OriginCertificates(options OriginCACertificateListOptions) ([]Or // API reference: https://api.cloudflare.com/#cloudflare-ca-certificate-details func (api *API) OriginCertificate(certificateID string) (*OriginCACertificate, error) { uri := "/certificates/" + certificateID - res, err := api.makeRequestWithAuthType("GET", uri, nil, AuthUserService) + res, err := api.makeRequestWithAuthType(context.TODO(), "GET", uri, nil, AuthUserService) if err != nil { return nil, errors.Wrap(err, errMakeRequestError) @@ -145,7 +146,7 @@ func (api *API) OriginCertificate(certificateID string) (*OriginCACertificate, e // API reference: https://api.cloudflare.com/#cloudflare-ca-revoke-certificate func (api *API) RevokeOriginCertificate(certificateID string) (*OriginCACertificateID, error) { uri := "/certificates/" + certificateID - res, err := api.makeRequestWithAuthType("DELETE", uri, nil, AuthUserService) + res, err := api.makeRequestWithAuthType(context.TODO(), "DELETE", uri, nil, AuthUserService) if err != nil { return nil, errors.Wrap(err, errMakeRequestError) diff --git a/vendor/github.com/cloudflare/cloudflare-go/page_rules.go b/vendor/github.com/cloudflare/cloudflare-go/page_rules.go index 8749b2c5..36f62e62 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/page_rules.go +++ b/vendor/github.com/cloudflare/cloudflare-go/page_rules.go @@ -23,26 +23,40 @@ type PageRuleTarget struct { PageRuleAction is the action to take when the target is matched. Valid IDs are: - always_online always_use_https + automatic_https_rewrites browser_cache_ttl browser_check + bypass_cache_on_cookie + cache_by_device_type + cache_deception_armor cache_level + cache_on_cookie disable_apps disable_performance disable_railgun disable_security edge_cache_ttl email_obfuscation + explicit_cache_control forwarding_url + host_header_override ip_geolocation + minify mirage + opportunistic_encryption + origin_error_page_pass_thru + polish + resolve_override + respect_strong_etag + response_buffering rocket_loader security_level server_side_exclude - smart_errors + sort_query_string_for_cache ssl + true_client_ip_header waf */ type PageRuleAction struct { @@ -52,26 +66,41 @@ type PageRuleAction struct { // PageRuleActions maps API action IDs to human-readable strings. var PageRuleActions = map[string]string{ - "always_online": "Always Online", // Value of type string - "always_use_https": "Always Use HTTPS", // Value of type interface{} - "browser_cache_ttl": "Browser Cache TTL", // Value of type int - "browser_check": "Browser Integrity Check", // Value of type string - "cache_level": "Cache Level", // Value of type string - "disable_apps": "Disable Apps", // Value of type interface{} - "disable_performance": "Disable Performance", // Value of type interface{} - "disable_railgun": "Disable Railgun", // Value of type string - "disable_security": "Disable Security", // Value of type interface{} - "edge_cache_ttl": "Edge Cache TTL", // Value of type int - "email_obfuscation": "Email Obfuscation", // Value of type string - "forwarding_url": "Forwarding URL", // Value of type map[string]interface - "ip_geolocation": "IP Geolocation Header", // Value of type string - "mirage": "Mirage", // Value of type string - "rocket_loader": "Rocker Loader", // Value of type string - "security_level": "Security Level", // Value of type string - "server_side_exclude": "Server Side Excludes", // Value of type string - "smart_errors": "Smart Errors", // Value of type string - "ssl": "SSL", // Value of type string - "waf": "Web Application Firewall", // Value of type string + "always_online": "Always Online", // Value of type string + "always_use_https": "Always Use HTTPS", // Value of type interface{} + "automatic_https_rewrites": "Automatic HTTPS Rewrites", // Value of type string + "browser_cache_ttl": "Browser Cache TTL", // Value of type int + "browser_check": "Browser Integrity Check", // Value of type string + "bypass_cache_on_cookie": "Bypass Cache on Cookie", // Value of type string + "cache_by_device_type": "Cache By Device Type", // Value of type string + "cache_deception_armor": "Cache Deception Armor", // Value of type string + "cache_level": "Cache Level", // Value of type string + "cache_on_cookie": "Cache On Cookie", // Value of type string + "disable_apps": "Disable Apps", // Value of type interface{} + "disable_performance": "Disable Performance", // Value of type interface{} + "disable_railgun": "Disable Railgun", // Value of type string + "disable_security": "Disable Security", // Value of type interface{} + "edge_cache_ttl": "Edge Cache TTL", // Value of type int + "email_obfuscation": "Email Obfuscation", // Value of type string + "explicit_cache_control": "Origin Cache Control", // Value of type string + "forwarding_url": "Forwarding URL", // Value of type map[string]interface + "host_header_override": "Host Header Override", // Value of type string + "ip_geolocation": "IP Geolocation Header", // Value of type string + "minify": "Minify", // Value of type map[string]interface + "mirage": "Mirage", // Value of type string + "opportunistic_encryption": "Opportunistic Encryption", // Value of type string + "origin_error_page_pass_thru": "Origin Error Page Pass-thru", // Value of type string + "polish": "Polish", // Value of type string + "resolve_override": "Resolve Override", // Value of type string + "respect_strong_etag": "Respect Strong ETags", // Value of type string + "response_buffering": "Response Buffering", // Value of type string + "rocket_loader": "Rocker Loader", // Value of type string + "security_level": "Security Level", // Value of type string + "server_side_exclude": "Server Side Excludes", // Value of type string + "sort_query_string_for_cache": "Query String Sort", // Value of type string + "ssl": "SSL", // Value of type string + "true_client_ip_header": "True Client IP Header", // Value of type string + "waf": "Web Application Firewall", // Value of type string } // PageRule describes a Page Rule. @@ -176,7 +205,7 @@ func (api *API) ChangePageRule(zoneID, ruleID string, rule PageRule) error { // API reference: https://api.cloudflare.com/#page-rules-for-a-zone-update-a-page-rule func (api *API) UpdatePageRule(zoneID, ruleID string, rule PageRule) error { uri := "/zones/" + zoneID + "/pagerules/" + ruleID - res, err := api.makeRequest("PUT", uri, nil) + res, err := api.makeRequest("PUT", uri, rule) if err != nil { return errors.Wrap(err, errMakeRequestError) } diff --git a/vendor/github.com/cloudflare/cloudflare-go/rate_limiting.go b/vendor/github.com/cloudflare/cloudflare-go/rate_limiting.go index 96ad70ee..e3eb3e2e 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/rate_limiting.go +++ b/vendor/github.com/cloudflare/cloudflare-go/rate_limiting.go @@ -18,6 +18,7 @@ type RateLimit struct { Threshold int `json:"threshold"` Period int `json:"period"` Action RateLimitAction `json:"action"` + Correlate *RateLimitCorrelate `json:"correlate,omitempty"` } // RateLimitTrafficMatcher contains the rules that will be used to apply a rate limit to traffic @@ -35,8 +36,17 @@ type RateLimitRequestMatcher struct { // RateLimitResponseMatcher contains the matching rules pertaining to responses type RateLimitResponseMatcher struct { - Statuses []int `json:"status,omitempty"` - OriginTraffic *bool `json:"origin_traffic,omitempty"` // api defaults to true so we need an explicit empty value + Statuses []int `json:"status,omitempty"` + OriginTraffic *bool `json:"origin_traffic,omitempty"` // api defaults to true so we need an explicit empty value + Headers []RateLimitResponseMatcherHeader `json:"headers,omitempty"` +} + +// RateLimitResponseMatcherHeader contains the structure of the origin +// HTTP headers used in request matcher checks. +type RateLimitResponseMatcherHeader struct { + Name string `json:"name"` + Op string `json:"op"` + Value string `json:"value"` } // RateLimitKeyValue is k-v formatted as expected in the rate limit description @@ -58,6 +68,11 @@ type RateLimitActionResponse struct { Body string `json:"body"` } +// RateLimitCorrelate pertainings to NAT support +type RateLimitCorrelate struct { + By string `json:"by"` +} + type rateLimitResponse struct { Response Result RateLimit `json:"result"` diff --git a/vendor/github.com/cloudflare/cloudflare-go/registrar.go b/vendor/github.com/cloudflare/cloudflare-go/registrar.go new file mode 100644 index 00000000..51eacf17 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/registrar.go @@ -0,0 +1,175 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/pkg/errors" +) + +// RegistrarDomain is the structure of the API response for a new +// Cloudflare Registrar domain. +type RegistrarDomain struct { + ID string `json:"id"` + Available bool `json:"available"` + SupportedTLD bool `json:"supported_tld"` + CanRegister bool `json:"can_register"` + TransferIn RegistrarTransferIn `json:"transfer_in"` + CurrentRegistrar string `json:"current_registrar"` + ExpiresAt time.Time `json:"expires_at"` + RegistryStatuses string `json:"registry_statuses"` + Locked bool `json:"locked"` + CreatedAt time.Time `json:"created_at"` + UpdatedAt time.Time `json:"updated_at"` + RegistrantContact RegistrantContact `json:"registrant_contact"` +} + +// RegistrarTransferIn contains the structure for a domain transfer in +// request. +type RegistrarTransferIn struct { + UnlockDomain string `json:"unlock_domain"` + DisablePrivacy string `json:"disable_privacy"` + EnterAuthCode string `json:"enter_auth_code"` + ApproveTransfer string `json:"approve_transfer"` + AcceptFoa string `json:"accept_foa"` + CanCancelTransfer bool `json:"can_cancel_transfer"` +} + +// RegistrantContact is the contact details for the domain registration. +type RegistrantContact struct { + ID string `json:"id"` + FirstName string `json:"first_name"` + LastName string `json:"last_name"` + Organization string `json:"organization"` + Address string `json:"address"` + Address2 string `json:"address2"` + City string `json:"city"` + State string `json:"state"` + Zip string `json:"zip"` + Country string `json:"country"` + Phone string `json:"phone"` + Email string `json:"email"` + Fax string `json:"fax"` +} + +// RegistrarDomainConfiguration is the structure for making updates to +// and existing domain. +type RegistrarDomainConfiguration struct { + NameServers []string `json:"name_servers"` + Privacy bool `json:"privacy"` + Locked bool `json:"locked"` + AutoRenew bool `json:"auto_renew"` +} + +// RegistrarDomainDetailResponse is the structure of the detailed +// response from the API for a single domain. +type RegistrarDomainDetailResponse struct { + Response + Result RegistrarDomain `json:"result"` +} + +// RegistrarDomainsDetailResponse is the structure of the detailed +// response from the API. +type RegistrarDomainsDetailResponse struct { + Response + Result []RegistrarDomain `json:"result"` +} + +// RegistrarDomain returns a single domain based on the account ID and +// domain name. +// +// API reference: https://api.cloudflare.com/#registrar-domains-get-domain +func (api *API) RegistrarDomain(accountID, domainName string) (RegistrarDomain, error) { + uri := fmt.Sprintf("/accounts/%s/registrar/domains/%s", accountID, domainName) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return RegistrarDomain{}, errors.Wrap(err, errMakeRequestError) + } + + var r RegistrarDomainDetailResponse + err = json.Unmarshal(res, &r) + if err != nil { + return RegistrarDomain{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// RegistrarDomains returns all registrar domains based on the account +// ID. +// +// API reference: https://api.cloudflare.com/#registrar-domains-list-domains +func (api *API) RegistrarDomains(accountID string) ([]RegistrarDomain, error) { + uri := "/accounts/" + accountID + "/registrar/domains" + + res, err := api.makeRequest("POST", uri, nil) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errMakeRequestError) + } + + var r RegistrarDomainsDetailResponse + err = json.Unmarshal(res, &r) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// TransferRegistrarDomain initiates the transfer from another registrar +// to Cloudflare Registrar. +// +// API reference: https://api.cloudflare.com/#registrar-domains-transfer-domain +func (api *API) TransferRegistrarDomain(accountID, domainName string) ([]RegistrarDomain, error) { + uri := fmt.Sprintf("/accounts/%s/registrar/domains/%s/transfer", accountID, domainName) + + res, err := api.makeRequest("POST", uri, nil) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errMakeRequestError) + } + + var r RegistrarDomainsDetailResponse + err = json.Unmarshal(res, &r) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// CancelRegistrarDomainTransfer cancels a pending domain transfer. +// +// API reference: https://api.cloudflare.com/#registrar-domains-cancel-transfer +func (api *API) CancelRegistrarDomainTransfer(accountID, domainName string) ([]RegistrarDomain, error) { + uri := fmt.Sprintf("/accounts/%s/registrar/domains/%s/cancel_transfer", accountID, domainName) + + res, err := api.makeRequest("POST", uri, nil) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errMakeRequestError) + } + + var r RegistrarDomainsDetailResponse + err = json.Unmarshal(res, &r) + if err != nil { + return []RegistrarDomain{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// UpdateRegistrarDomain updates an existing Registrar Domain configuration. +// +// API reference: https://api.cloudflare.com/#registrar-domains-update-domain +func (api *API) UpdateRegistrarDomain(accountID, domainName string, domainConfiguration RegistrarDomainConfiguration) (RegistrarDomain, error) { + uri := fmt.Sprintf("/accounts/%s/registrar/domains/%s", accountID, domainName) + + res, err := api.makeRequest("PUT", uri, domainConfiguration) + if err != nil { + return RegistrarDomain{}, errors.Wrap(err, errMakeRequestError) + } + + var r RegistrarDomainDetailResponse + err = json.Unmarshal(res, &r) + if err != nil { + return RegistrarDomain{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/spectrum.go b/vendor/github.com/cloudflare/cloudflare-go/spectrum.go new file mode 100644 index 00000000..a95a2cd7 --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/spectrum.go @@ -0,0 +1,158 @@ +package cloudflare + +import ( + "encoding/json" + "fmt" + "time" + + "github.com/pkg/errors" +) + +// SpectrumApplication defines a single Spectrum Application. +type SpectrumApplication struct { + ID string `json:"id,omitempty"` + Protocol string `json:"protocol,omitempty"` + IPv4 bool `json:"ipv4,omitempty"` + DNS SpectrumApplicationDNS `json:"dns,omitempty"` + OriginDirect []string `json:"origin_direct,omitempty"` + OriginPort int `json:"origin_port,omitempty"` + OriginDNS *SpectrumApplicationOriginDNS `json:"origin_dns,omitempty"` + IPFirewall bool `json:"ip_firewall,omitempty"` + ProxyProtocol bool `json:"proxy_protocol,omitempty"` + TLS string `json:"tls,omitempty"` + CreatedOn *time.Time `json:"created_on,omitempty"` + ModifiedOn *time.Time `json:"modified_on,omitempty"` +} + +// SpectrumApplicationDNS holds the external DNS configuration for a Spectrum +// Application. +type SpectrumApplicationDNS struct { + Type string `json:"type"` + Name string `json:"name"` +} + +// SpectrumApplicationOriginDNS holds the origin DNS configuration for a Spectrum +// Application. +type SpectrumApplicationOriginDNS struct { + Name string `json:"name"` +} + +// SpectrumApplicationDetailResponse is the structure of the detailed response +// from the API. +type SpectrumApplicationDetailResponse struct { + Response + Result SpectrumApplication `json:"result"` +} + +// SpectrumApplicationsDetailResponse is the structure of the detailed response +// from the API. +type SpectrumApplicationsDetailResponse struct { + Response + Result []SpectrumApplication `json:"result"` +} + +// SpectrumApplications fetches all of the Spectrum applications for a zone. +// +// API reference: https://developers.cloudflare.com/spectrum/api-reference/#list-spectrum-applications +func (api *API) SpectrumApplications(zoneID string) ([]SpectrumApplication, error) { + uri := "/zones/" + zoneID + "/spectrum/apps" + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []SpectrumApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var spectrumApplications SpectrumApplicationsDetailResponse + err = json.Unmarshal(res, &spectrumApplications) + if err != nil { + return []SpectrumApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return spectrumApplications.Result, nil +} + +// SpectrumApplication fetches a single Spectrum application based on the ID. +// +// API reference: https://developers.cloudflare.com/spectrum/api-reference/#list-spectrum-applications +func (api *API) SpectrumApplication(zoneID string, applicationID string) (SpectrumApplication, error) { + uri := fmt.Sprintf( + "/zones/%s/spectrum/apps/%s", + zoneID, + applicationID, + ) + + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var spectrumApplication SpectrumApplicationDetailResponse + err = json.Unmarshal(res, &spectrumApplication) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return spectrumApplication.Result, nil +} + +// CreateSpectrumApplication creates a new Spectrum application. +// +// API reference: https://developers.cloudflare.com/spectrum/api-reference/#create-a-spectrum-application +func (api *API) CreateSpectrumApplication(zoneID string, appDetails SpectrumApplication) (SpectrumApplication, error) { + uri := "/zones/" + zoneID + "/spectrum/apps" + + res, err := api.makeRequest("POST", uri, appDetails) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var spectrumApplication SpectrumApplicationDetailResponse + err = json.Unmarshal(res, &spectrumApplication) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return spectrumApplication.Result, nil +} + +// UpdateSpectrumApplication updates an existing Spectrum application. +// +// API reference: https://developers.cloudflare.com/spectrum/api-reference/#update-a-spectrum-application +func (api *API) UpdateSpectrumApplication(zoneID, appID string, appDetails SpectrumApplication) (SpectrumApplication, error) { + uri := fmt.Sprintf( + "/zones/%s/spectrum/apps/%s", + zoneID, + appID, + ) + + res, err := api.makeRequest("PUT", uri, appDetails) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errMakeRequestError) + } + + var spectrumApplication SpectrumApplicationDetailResponse + err = json.Unmarshal(res, &spectrumApplication) + if err != nil { + return SpectrumApplication{}, errors.Wrap(err, errUnmarshalError) + } + + return spectrumApplication.Result, nil +} + +// DeleteSpectrumApplication removes a Spectrum application based on the ID. +// +// API reference: https://developers.cloudflare.com/spectrum/api-reference/#delete-a-spectrum-application +func (api *API) DeleteSpectrumApplication(zoneID string, applicationID string) error { + uri := fmt.Sprintf( + "/zones/%s/spectrum/apps/%s", + zoneID, + applicationID, + ) + + _, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return errors.Wrap(err, errMakeRequestError) + } + + return nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/universal_ssl.go b/vendor/github.com/cloudflare/cloudflare-go/universal_ssl.go new file mode 100644 index 00000000..ae809e5c --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/universal_ssl.go @@ -0,0 +1,50 @@ +package cloudflare + +import ( + "encoding/json" + + "github.com/pkg/errors" +) + +// UniversalSSLSetting represents a universal ssl setting's properties. +type UniversalSSLSetting struct { + Enabled bool `json:"enabled"` +} + +type universalSSLSettingResponse struct { + Response + Result UniversalSSLSetting `json:"result"` +} + +// UniversalSSLSettingDetails returns the details for a universal ssl setting +// +// API reference: https://api.cloudflare.com/#universal-ssl-settings-for-a-zone-universal-ssl-settings-details +func (api *API) UniversalSSLSettingDetails(zoneID string) (UniversalSSLSetting, error) { + uri := "/zones/" + zoneID + "/ssl/universal/settings" + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return UniversalSSLSetting{}, errors.Wrap(err, errMakeRequestError) + } + var r universalSSLSettingResponse + if err := json.Unmarshal(res, &r); err != nil { + return UniversalSSLSetting{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + +// EditUniversalSSLSetting edits the uniersal ssl setting for a zone +// +// API reference: https://api.cloudflare.com/#universal-ssl-settings-for-a-zone-edit-universal-ssl-settings +func (api *API) EditUniversalSSLSetting(zoneID string, setting UniversalSSLSetting) (UniversalSSLSetting, error) { + uri := "/zones/" + zoneID + "/ssl/universal/settings" + res, err := api.makeRequest("PATCH", uri, setting) + if err != nil { + return UniversalSSLSetting{}, errors.Wrap(err, errMakeRequestError) + } + var r universalSSLSettingResponse + if err := json.Unmarshal(res, &r); err != nil { + return UniversalSSLSetting{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil + +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/virtualdns.go b/vendor/github.com/cloudflare/cloudflare-go/virtualdns.go index 6eb7629f..f8082e1f 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/virtualdns.go +++ b/vendor/github.com/cloudflare/cloudflare-go/virtualdns.go @@ -2,6 +2,9 @@ package cloudflare import ( "encoding/json" + "net/url" + "strings" + "time" "github.com/pkg/errors" ) @@ -18,6 +21,32 @@ type VirtualDNS struct { ModifiedOn string `json:"modified_on"` } +// VirtualDNSAnalyticsMetrics respresents a group of aggregated Virtual DNS metrics. +type VirtualDNSAnalyticsMetrics struct { + QueryCount *int64 `json:"queryCount"` + UncachedCount *int64 `json:"uncachedCount"` + StaleCount *int64 `json:"staleCount"` + ResponseTimeAvg *float64 `json:"responseTimeAvg"` + ResponseTimeMedian *float64 `json:"responseTimeMedian"` + ResponseTime90th *float64 `json:"responseTime90th"` + ResponseTime99th *float64 `json:"responseTime99th"` +} + +// VirtualDNSAnalytics represents a set of aggregated Virtual DNS metrics. +// TODO: Add the queried data and not only the aggregated values. +type VirtualDNSAnalytics struct { + Totals VirtualDNSAnalyticsMetrics `json:"totals"` + Min VirtualDNSAnalyticsMetrics `json:"min"` + Max VirtualDNSAnalyticsMetrics `json:"max"` +} + +// VirtualDNSUserAnalyticsOptions represents range and dimension selection on analytics endpoint +type VirtualDNSUserAnalyticsOptions struct { + Metrics []string + Since *time.Time + Until *time.Time +} + // VirtualDNSResponse represents a Virtual DNS response. type VirtualDNSResponse struct { Response @@ -30,6 +59,12 @@ type VirtualDNSListResponse struct { Result []*VirtualDNS `json:"result"` } +// VirtualDNSAnalyticsResponse represents a Virtual DNS analytics response. +type VirtualDNSAnalyticsResponse struct { + Response + Result VirtualDNSAnalytics `json:"result"` +} + // CreateVirtualDNS creates a new Virtual DNS cluster. // // API reference: https://api.cloudflare.com/#virtual-dns-users--create-a-virtual-dns-cluster @@ -123,3 +158,35 @@ func (api *API) DeleteVirtualDNS(virtualDNSID string) error { return nil } + +// encode encodes non-nil fields into URL encoded form. +func (o VirtualDNSUserAnalyticsOptions) encode() string { + v := url.Values{} + if o.Since != nil { + v.Set("since", (*o.Since).UTC().Format(time.RFC3339)) + } + if o.Until != nil { + v.Set("until", (*o.Until).UTC().Format(time.RFC3339)) + } + if o.Metrics != nil { + v.Set("metrics", strings.Join(o.Metrics, ",")) + } + return v.Encode() +} + +// VirtualDNSUserAnalytics retrieves analytics report for a specified dimension and time range +func (api *API) VirtualDNSUserAnalytics(virtualDNSID string, o VirtualDNSUserAnalyticsOptions) (VirtualDNSAnalytics, error) { + uri := "/user/virtual_dns/" + virtualDNSID + "/dns_analytics/report?" + o.encode() + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return VirtualDNSAnalytics{}, errors.Wrap(err, errMakeRequestError) + } + + response := VirtualDNSAnalyticsResponse{} + err = json.Unmarshal(res, &response) + if err != nil { + return VirtualDNSAnalytics{}, errors.Wrap(err, errUnmarshalError) + } + + return response.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/waf.go b/vendor/github.com/cloudflare/cloudflare-go/waf.go index 4ed15623..cc7c5e78 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/waf.go +++ b/vendor/github.com/cloudflare/cloudflare-go/waf.go @@ -39,14 +39,28 @@ type WAFRule struct { AllowedModes []string `json:"allowed_modes"` } -// WAFRulesResponse represents the response from the WAF rule endpoint. +// WAFRulesResponse represents the response from the WAF rules endpoint. type WAFRulesResponse struct { Response Result []WAFRule `json:"result"` ResultInfo ResultInfo `json:"result_info"` } +// WAFRuleResponse represents the response from the WAF rule endpoint. +type WAFRuleResponse struct { + Response + Result WAFRule `json:"result"` + ResultInfo ResultInfo `json:"result_info"` +} + +// WAFRuleOptions is a subset of WAFRule, for editable options. +type WAFRuleOptions struct { + Mode string `json:"mode"` +} + // ListWAFPackages returns a slice of the WAF packages for the given zone. +// +// API Reference: https://api.cloudflare.com/#waf-rule-packages-list-firewall-packages func (api *API) ListWAFPackages(zoneID string) ([]WAFPackage, error) { var p WAFPackagesResponse var packages []WAFPackage @@ -72,26 +86,70 @@ func (api *API) ListWAFPackages(zoneID string) ([]WAFPackage, error) { } // ListWAFRules returns a slice of the WAF rules for the given WAF package. +// +// API Reference: https://api.cloudflare.com/#waf-rules-list-rules func (api *API) ListWAFRules(zoneID, packageID string) ([]WAFRule, error) { - var r WAFRulesResponse var rules []WAFRule var res []byte var err error + uri := "/zones/" + zoneID + "/firewall/waf/packages/" + packageID + "/rules" res, err = api.makeRequest("GET", uri, nil) if err != nil { return []WAFRule{}, errors.Wrap(err, errMakeRequestError) } + + var r WAFRulesResponse err = json.Unmarshal(res, &r) if err != nil { return []WAFRule{}, errors.Wrap(err, errUnmarshalError) } + if !r.Success { // TODO: Provide an actual error message instead of always returning nil return []WAFRule{}, err } + for ri := range r.Result { rules = append(rules, r.Result[ri]) } return rules, nil } + +// WAFRule returns a WAF rule from the given WAF package. +// +// API Reference: https://api.cloudflare.com/#waf-rules-rule-details +func (api *API) WAFRule(zoneID, packageID, ruleID string) (WAFRule, error) { + uri := "/zones/" + zoneID + "/firewall/waf/packages/" + packageID + "/rules/" + ruleID + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return WAFRule{}, errors.Wrap(err, errMakeRequestError) + } + + var r WAFRuleResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WAFRule{}, errors.Wrap(err, errUnmarshalError) + } + + return r.Result, nil +} + +// UpdateWAFRule lets you update the mode of a WAF Rule. +// +// API Reference: https://api.cloudflare.com/#waf-rules-edit-rule +func (api *API) UpdateWAFRule(zoneID, packageID, ruleID, mode string) (WAFRule, error) { + opts := WAFRuleOptions{Mode: mode} + uri := "/zones/" + zoneID + "/firewall/waf/packages/" + packageID + "/rules/" + ruleID + res, err := api.makeRequest("PATCH", uri, opts) + if err != nil { + return WAFRule{}, errors.Wrap(err, errMakeRequestError) + } + + var r WAFRuleResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WAFRule{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/workers.go b/vendor/github.com/cloudflare/cloudflare-go/workers.go new file mode 100644 index 00000000..ee7267ca --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/workers.go @@ -0,0 +1,312 @@ +package cloudflare + +import ( + "encoding/json" + "net/http" + "time" + + "github.com/pkg/errors" +) + +// WorkerRequestParams provides parameters for worker requests for both enterprise and standard requests +type WorkerRequestParams struct { + ZoneID string + ScriptName string +} + +// WorkerRoute aka filters are patterns used to enable or disable workers that match requests. +// +// API reference: https://api.cloudflare.com/#worker-filters-properties +type WorkerRoute struct { + ID string `json:"id,omitempty"` + Pattern string `json:"pattern"` + Enabled bool `json:"enabled"` + Script string `json:"script,omitempty"` +} + +// WorkerRoutesResponse embeds Response struct and slice of WorkerRoutes +type WorkerRoutesResponse struct { + Response + Routes []WorkerRoute `json:"result"` +} + +// WorkerRouteResponse embeds Response struct and a single WorkerRoute +type WorkerRouteResponse struct { + Response + WorkerRoute `json:"result"` +} + +// WorkerScript Cloudflare Worker struct with metadata +type WorkerScript struct { + WorkerMetaData + Script string `json:"script"` +} + +// WorkerMetaData contains worker script information such as size, creation & modification dates +type WorkerMetaData struct { + ID string `json:"id,omitempty"` + ETAG string `json:"etag,omitempty"` + Size int `json:"size,omitempty"` + CreatedOn time.Time `json:"created_on,omitempty"` + ModifiedOn time.Time `json:"modified_on,omitempty"` +} + +// WorkerListResponse wrapper struct for API response to worker script list API call +type WorkerListResponse struct { + Response + WorkerList []WorkerMetaData `json:"result"` +} + +// WorkerScriptResponse wrapper struct for API response to worker script calls +type WorkerScriptResponse struct { + Response + WorkerScript `json:"result"` +} + +// DeleteWorker deletes worker for a zone. +// +// API reference: https://api.cloudflare.com/#worker-script-delete-worker +func (api *API) DeleteWorker(requestParams *WorkerRequestParams) (WorkerScriptResponse, error) { + // if ScriptName is provided we will treat as org request + if requestParams.ScriptName != "" { + return api.deleteWorkerWithName(requestParams.ScriptName) + } + uri := "/zones/" + requestParams.ZoneID + "/workers/script" + res, err := api.makeRequest("DELETE", uri, nil) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + err = json.Unmarshal(res, &r) + if err != nil { + return r, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// DeleteWorkerWithName deletes worker for a zone. +// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise +// organizationID must be specified as api option https://godoc.org/github.com/cloudflare/cloudflare-go#UsingOrganization +// +// API reference: https://api.cloudflare.com/#worker-script-delete-worker +func (api *API) deleteWorkerWithName(scriptName string) (WorkerScriptResponse, error) { + if api.OrganizationID == "" { + return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request") + } + uri := "/accounts/" + api.OrganizationID + "/workers/scripts/" + scriptName + res, err := api.makeRequest("DELETE", uri, nil) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + err = json.Unmarshal(res, &r) + if err != nil { + return r, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// DownloadWorker fetch raw script content for your worker returns []byte containing worker code js +// +// API reference: https://api.cloudflare.com/#worker-script-download-worker +func (api *API) DownloadWorker(requestParams *WorkerRequestParams) (WorkerScriptResponse, error) { + if requestParams.ScriptName != "" { + return api.downloadWorkerWithName(requestParams.ScriptName) + } + uri := "/zones/" + requestParams.ZoneID + "/workers/script" + res, err := api.makeRequest("GET", uri, nil) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + r.Script = string(res) + r.Success = true + return r, nil +} + +// DownloadWorkerWithName fetch raw script content for your worker returns string containing worker code js +// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise/ +// +// API reference: https://api.cloudflare.com/#worker-script-download-worker +func (api *API) downloadWorkerWithName(scriptName string) (WorkerScriptResponse, error) { + if api.OrganizationID == "" { + return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request") + } + uri := "/accounts/" + api.OrganizationID + "/workers/scripts/" + scriptName + res, err := api.makeRequest("GET", uri, nil) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + r.Script = string(res) + r.Success = true + return r, nil +} + +// ListWorkerScripts returns list of worker scripts for given organization +// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise +// +// API reference: https://developers.cloudflare.com/workers/api/config-api-for-enterprise/ +func (api *API) ListWorkerScripts() (WorkerListResponse, error) { + if api.OrganizationID == "" { + return WorkerListResponse{}, errors.New("organization ID required for enterprise only request") + } + uri := "/accounts/" + api.OrganizationID + "/workers/scripts" + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return WorkerListResponse{}, errors.Wrap(err, errMakeRequestError) + } + var r WorkerListResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WorkerListResponse{}, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// UploadWorker push raw script content for your worker +// +// API reference: https://api.cloudflare.com/#worker-script-upload-worker +func (api *API) UploadWorker(requestParams *WorkerRequestParams, data string) (WorkerScriptResponse, error) { + if requestParams.ScriptName != "" { + return api.uploadWorkerWithName(requestParams.ScriptName, data) + } + uri := "/zones/" + requestParams.ZoneID + "/workers/script" + headers := make(http.Header) + headers.Set("Content-Type", "application/javascript") + res, err := api.makeRequestWithHeaders("PUT", uri, []byte(data), headers) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + err = json.Unmarshal(res, &r) + if err != nil { + return r, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// UploadWorkerWithName push raw script content for your worker +// This is an enterprise only feature https://developers.cloudflare.com/workers/api/config-api-for-enterprise/ +// +// API reference: https://api.cloudflare.com/#worker-script-upload-worker +func (api *API) uploadWorkerWithName(scriptName string, data string) (WorkerScriptResponse, error) { + if api.OrganizationID == "" { + return WorkerScriptResponse{}, errors.New("organization ID required for enterprise only request") + } + uri := "/accounts/" + api.OrganizationID + "/workers/scripts/" + scriptName + headers := make(http.Header) + headers.Set("Content-Type", "application/javascript") + res, err := api.makeRequestWithHeaders("PUT", uri, []byte(data), headers) + var r WorkerScriptResponse + if err != nil { + return r, errors.Wrap(err, errMakeRequestError) + } + err = json.Unmarshal(res, &r) + if err != nil { + return r, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// CreateWorkerRoute creates worker route for a zone +// +// API reference: https://api.cloudflare.com/#worker-filters-create-filter +func (api *API) CreateWorkerRoute(zoneID string, route WorkerRoute) (WorkerRouteResponse, error) { + // Check whether a script name is defined in order to determine whether + // to use the single-script or multi-script endpoint. + pathComponent := "filters" + if route.Script != "" { + if api.OrganizationID == "" { + return WorkerRouteResponse{}, errors.New("organization ID required for enterprise only request") + } + pathComponent = "routes" + } + + uri := "/zones/" + zoneID + "/workers/" + pathComponent + res, err := api.makeRequest("POST", uri, route) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError) + } + var r WorkerRouteResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// DeleteWorkerRoute deletes worker route for a zone +// +// API reference: https://api.cloudflare.com/#worker-filters-delete-filter +func (api *API) DeleteWorkerRoute(zoneID string, routeID string) (WorkerRouteResponse, error) { + // For deleting a route, it doesn't matter whether we use the + // single-script or multi-script endpoint + uri := "/zones/" + zoneID + "/workers/filters/" + routeID + res, err := api.makeRequest("DELETE", uri, nil) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError) + } + var r WorkerRouteResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} + +// ListWorkerRoutes returns list of worker routes +// +// API reference: https://api.cloudflare.com/#worker-filters-list-filters +func (api *API) ListWorkerRoutes(zoneID string) (WorkerRoutesResponse, error) { + pathComponent := "filters" + if api.OrganizationID != "" { + pathComponent = "routes" + } + uri := "/zones/" + zoneID + "/workers/" + pathComponent + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return WorkerRoutesResponse{}, errors.Wrap(err, errMakeRequestError) + } + var r WorkerRoutesResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WorkerRoutesResponse{}, errors.Wrap(err, errUnmarshalError) + } + for i := range r.Routes { + route := &r.Routes[i] + // The Enabled flag will not be set in the multi-script API response + // so we manually set it to true if the script name is not empty + // in case any multi-script customers rely on the Enabled field + if route.Script != "" { + route.Enabled = true + } + } + return r, nil +} + +// UpdateWorkerRoute updates worker route for a zone. +// +// API reference: https://api.cloudflare.com/#worker-filters-update-filter +func (api *API) UpdateWorkerRoute(zoneID string, routeID string, route WorkerRoute) (WorkerRouteResponse, error) { + // Check whether a script name is defined in order to determine whether + // to use the single-script or multi-script endpoint. + pathComponent := "filters" + if route.Script != "" { + if api.OrganizationID == "" { + return WorkerRouteResponse{}, errors.New("organization ID required for enterprise only request") + } + pathComponent = "routes" + } + uri := "/zones/" + zoneID + "/workers/" + pathComponent + "/" + routeID + res, err := api.makeRequest("PUT", uri, route) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errMakeRequestError) + } + var r WorkerRouteResponse + err = json.Unmarshal(res, &r) + if err != nil { + return WorkerRouteResponse{}, errors.Wrap(err, errUnmarshalError) + } + return r, nil +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/workers_kv.go b/vendor/github.com/cloudflare/cloudflare-go/workers_kv.go new file mode 100644 index 00000000..f5df6fae --- /dev/null +++ b/vendor/github.com/cloudflare/cloudflare-go/workers_kv.go @@ -0,0 +1,192 @@ +package cloudflare + +import ( + "context" + "encoding/json" + "fmt" + "net/http" + "net/url" + + "github.com/pkg/errors" +) + +// WorkersKVNamespaceRequest provides parameters for creating and updating storage namespaces +type WorkersKVNamespaceRequest struct { + Title string `json:"title"` +} + +// WorkersKVNamespaceResponse is the response received when creating storage namespaces +type WorkersKVNamespaceResponse struct { + Response + Result WorkersKVNamespace `json:"result"` +} + +// WorkersKVNamespace contains the unique identifier and title of a storage namespace +type WorkersKVNamespace struct { + ID string `json:"id"` + Title string `json:"title"` +} + +// ListWorkersKVNamespacesResponse contains a slice of storage namespaces associated with an +// account, pagination information, and an embedded response struct +type ListWorkersKVNamespacesResponse struct { + Response + Result []WorkersKVNamespace `json:"result"` + ResultInfo `json:"result_info"` +} + +// StorageKey is a key name used to identify a storage value +type StorageKey struct { + Name string `json:"name"` +} + +// ListStorageKeysResponse contains a slice of keys belonging to a storage namespace, +// pagination information, and an embedded response struct +type ListStorageKeysResponse struct { + Response + Result []StorageKey `json:"result"` + ResultInfo `json:"result_info"` +} + +// CreateWorkersKVNamespace creates a namespace under the given title. +// A 400 is returned if the account already owns a namespace with this title. +// A namespace must be explicitly deleted to be replaced. +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-create-a-namespace +func (api *API) CreateWorkersKVNamespace(ctx context.Context, req *WorkersKVNamespaceRequest) (WorkersKVNamespaceResponse, error) { + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces", api.OrganizationID) + res, err := api.makeRequestContext(ctx, http.MethodPost, uri, req) + if err != nil { + return WorkersKVNamespaceResponse{}, errors.Wrap(err, errMakeRequestError) + } + + result := WorkersKVNamespaceResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + + return result, err +} + +// ListWorkersKVNamespaces lists storage namespaces +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-list-namespaces +func (api *API) ListWorkersKVNamespaces(ctx context.Context) (ListWorkersKVNamespacesResponse, error) { + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces", api.OrganizationID) + res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return ListWorkersKVNamespacesResponse{}, errors.Wrap(err, errMakeRequestError) + } + + result := ListWorkersKVNamespacesResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + + return result, err +} + +// DeleteWorkersKVNamespace deletes the namespace corresponding to the given ID +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-remove-a-namespace +func (api *API) DeleteWorkersKVNamespace(ctx context.Context, namespaceID string) (Response, error) { + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s", api.OrganizationID, namespaceID) + res, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil) + if err != nil { + return Response{}, errors.Wrap(err, errMakeRequestError) + } + + result := Response{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + + return result, err +} + +// UpdateWorkersKVNamespace modifies a namespace's title +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-rename-a-namespace +func (api *API) UpdateWorkersKVNamespace(ctx context.Context, namespaceID string, req *WorkersKVNamespaceRequest) (Response, error) { + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s", api.OrganizationID, namespaceID) + res, err := api.makeRequestContext(ctx, http.MethodPut, uri, req) + if err != nil { + return Response{}, errors.Wrap(err, errMakeRequestError) + } + + result := Response{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + + return result, err +} + +// WriteWorkersKV writes a value identified by a key. +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-write-key-value-pair +func (api *API) WriteWorkersKV(ctx context.Context, namespaceID, key string, value []byte) (Response, error) { + key = url.PathEscape(key) + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s/values/%s", api.OrganizationID, namespaceID, key) + res, err := api.makeRequestWithAuthTypeAndHeaders( + ctx, http.MethodPut, uri, value, api.authType, http.Header{"Content-Type": []string{"application/octet-stream"}}, + ) + if err != nil { + return Response{}, errors.Wrap(err, errMakeRequestError) + } + + result := Response{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + + return result, err +} + +// ReadWorkersKV returns the value associated with the given key in the given namespace +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-read-key-value-pair +func (api API) ReadWorkersKV(ctx context.Context, namespaceID, key string) ([]byte, error) { + key = url.PathEscape(key) + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s/values/%s", api.OrganizationID, namespaceID, key) + res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return nil, errors.Wrap(err, errMakeRequestError) + } + return res, nil +} + +// DeleteWorkersKV deletes a key and value for a provided storage namespace +// +// API reference: https://api.cloudflare.com/#workers-kv-namespace-delete-key-value-pair +func (api API) DeleteWorkersKV(ctx context.Context, namespaceID, key string) (Response, error) { + key = url.PathEscape(key) + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s/values/%s", api.OrganizationID, namespaceID, key) + res, err := api.makeRequestContext(ctx, http.MethodDelete, uri, nil) + if err != nil { + return Response{}, errors.Wrap(err, errMakeRequestError) + } + + result := Response{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + return result, err +} + +// ListWorkersKVs lists a namespace's keys +// +// API Reference: https://api.cloudflare.com/#workers-kv-namespace-list-a-namespace-s-keys +func (api API) ListWorkersKVs(ctx context.Context, namespaceID string) (ListStorageKeysResponse, error) { + uri := fmt.Sprintf("/accounts/%s/storage/kv/namespaces/%s/keys", api.OrganizationID, namespaceID) + res, err := api.makeRequestContext(ctx, http.MethodGet, uri, nil) + if err != nil { + return ListStorageKeysResponse{}, errors.Wrap(err, errMakeRequestError) + } + + result := ListStorageKeysResponse{} + if err := json.Unmarshal(res, &result); err != nil { + return result, errors.Wrap(err, errUnmarshalError) + } + return result, err +} diff --git a/vendor/github.com/cloudflare/cloudflare-go/zone.go b/vendor/github.com/cloudflare/cloudflare-go/zone.go index fe222d33..b2af877c 100644 --- a/vendor/github.com/cloudflare/cloudflare-go/zone.go +++ b/vendor/github.com/cloudflare/cloudflare-go/zone.go @@ -1,9 +1,11 @@ package cloudflare import ( + "context" "encoding/json" "fmt" "net/url" + "sync" "time" "github.com/pkg/errors" @@ -13,7 +15,8 @@ import ( type Owner struct { ID string `json:"id"` Email string `json:"email"` - OwnerType string `json:"owner_type"` + Name string `json:"name"` + OwnerType string `json:"type"` } // Zone describes a Cloudflare zone. @@ -22,20 +25,20 @@ type Zone struct { Name string `json:"name"` // DevMode contains the time in seconds until development expires (if // positive) or since it expired (if negative). It will be 0 if never used. - DevMode int `json:"development_mode"` - OriginalNS []string `json:"original_name_servers"` - OriginalRegistrar string `json:"original_registrar"` - OriginalDNSHost string `json:"original_dnshost"` - CreatedOn time.Time `json:"created_on"` - ModifiedOn time.Time `json:"modified_on"` - NameServers []string `json:"name_servers"` - Owner Owner `json:"owner"` - Permissions []string `json:"permissions"` - Plan ZoneRatePlan `json:"plan"` - PlanPending ZoneRatePlan `json:"plan_pending,omitempty"` - Status string `json:"status"` - Paused bool `json:"paused"` - Type string `json:"type"` + DevMode int `json:"development_mode"` + OriginalNS []string `json:"original_name_servers"` + OriginalRegistrar string `json:"original_registrar"` + OriginalDNSHost string `json:"original_dnshost"` + CreatedOn time.Time `json:"created_on"` + ModifiedOn time.Time `json:"modified_on"` + NameServers []string `json:"name_servers"` + Owner Owner `json:"owner"` + Permissions []string `json:"permissions"` + Plan ZonePlan `json:"plan"` + PlanPending ZonePlan `json:"plan_pending,omitempty"` + Status string `json:"status"` + Paused bool `json:"paused"` + Type string `json:"type"` Host struct { Name string Website string @@ -44,6 +47,7 @@ type Zone struct { Betas []string `json:"betas"` DeactReason string `json:"deactivation_reason"` Meta ZoneMeta `json:"meta"` + Account Account `json:"account"` } // ZoneMeta describes metadata about a zone. @@ -55,17 +59,31 @@ type ZoneMeta struct { PhishingDetected bool `json:"phishing_detected"` } +// ZonePlan contains the plan information for a zone. +type ZonePlan struct { + ZonePlanCommon + IsSubscribed bool `json:"is_subscribed"` + CanSubscribe bool `json:"can_subscribe"` + LegacyID string `json:"legacy_id"` + LegacyDiscount bool `json:"legacy_discount"` + ExternallyManaged bool `json:"externally_managed"` +} + // ZoneRatePlan contains the plan information for a zone. type ZoneRatePlan struct { - ID string `json:"id"` - Name string `json:"name,omitempty"` - Price int `json:"price,omitempty"` - Currency string `json:"currency,omitempty"` - Duration int `json:"duration,omitempty"` - Frequency string `json:"frequency,omitempty"` + ZonePlanCommon Components []zoneRatePlanComponents `json:"components,omitempty"` } +// ZonePlanCommon contains fields used by various Plan endpoints +type ZonePlanCommon struct { + ID string `json:"id"` + Name string `json:"name,omitempty"` + Price int `json:"price,omitempty"` + Currency string `json:"currency,omitempty"` + Frequency string `json:"frequency,omitempty"` +} + type zoneRatePlanComponents struct { Name string `json:"name"` Default int `json:"Default"` @@ -86,7 +104,8 @@ type ZoneResponse struct { // ZonesResponse represents the response from the Zone endpoint containing an array of zones. type ZonesResponse struct { Response - Result []Zone `json:"result"` + Result []Zone `json:"result"` + ResultInfo `json:"result_info"` } // ZoneIDResponse represents the response from the Zone endpoint, containing only a zone ID. @@ -98,7 +117,14 @@ type ZoneIDResponse struct { // AvailableZoneRatePlansResponse represents the response from the Available Rate Plans endpoint. type AvailableZoneRatePlansResponse struct { Response - Result []ZoneRatePlan `json:"result"` + Result []ZoneRatePlan `json:"result"` + ResultInfo `json:"result_info"` +} + +// AvailableZonePlansResponse represents the response from the Available Plans endpoint. +type AvailableZonePlansResponse struct { + Response + Result []ZonePlan `json:"result"` ResultInfo } @@ -132,7 +158,8 @@ type ZoneSSLSetting struct { CertificateStatus string `json:"certificate_status"` } -// ZoneSettingResponse represents the response from the Zone SSL Setting endpoint. +// ZoneSSLSettingResponse represents the response from the Zone SSL Setting +// endpoint. type ZoneSSLSettingResponse struct { Response Result ZoneSSLSetting `json:"result"` @@ -235,6 +262,7 @@ type PurgeCacheResponse struct { type newZone struct { Name string `json:"name"` JumpStart bool `json:"jump_start"` + Type string `json:"type"` // We use a pointer to get a nil type when the field is empty. // This allows us to completely omit this with json.Marshal(). Organization *Organization `json:"organization,omitempty"` @@ -249,7 +277,7 @@ type newZone struct { // This will add the new zone to the specified multi-user organization. // // API reference: https://api.cloudflare.com/#zone-create-a-zone -func (api *API) CreateZone(name string, jumpstart bool, org Organization) (Zone, error) { +func (api *API) CreateZone(name string, jumpstart bool, org Organization, zoneType string) (Zone, error) { var newzone newZone newzone.Name = name newzone.JumpStart = jumpstart @@ -257,6 +285,12 @@ func (api *API) CreateZone(name string, jumpstart bool, org Organization) (Zone, newzone.Organization = &org } + if zoneType == "partial" { + newzone.Type = "partial" + } else { + newzone.Type = "full" + } + res, err := api.makeRequest("POST", "/zones", newzone) if err != nil { return Zone{}, errors.Wrap(err, errMakeRequestError) @@ -316,10 +350,7 @@ func (api *API) ListZones(z ...string) ([]Zone, error) { } } } else { - // TODO: Paginate here. We only grab the first page of results. - // Could do this concurrently after the first request by creating a - // sync.WaitGroup or just a channel + workers. - res, err = api.makeRequest("GET", "/zones", nil) + res, err = api.makeRequest("GET", "/zones?per_page=50", nil) if err != nil { return []Zone{}, errors.Wrap(err, errMakeRequestError) } @@ -327,12 +358,67 @@ func (api *API) ListZones(z ...string) ([]Zone, error) { if err != nil { return []Zone{}, errors.Wrap(err, errUnmarshalError) } - zones = r.Result + + totalPageCount := r.TotalPages + var wg sync.WaitGroup + wg.Add(totalPageCount) + errc := make(chan error) + + for i := 1; i <= totalPageCount; i++ { + go func(pageNumber int) error { + res, err = api.makeRequest("GET", fmt.Sprintf("/zones?per_page=50&page=%d", pageNumber), nil) + if err != nil { + errc <- err + } + + err = json.Unmarshal(res, &r) + if err != nil { + errc <- err + } + + for _, zone := range r.Result { + zones = append(zones, zone) + } + + select { + case err := <-errc: + return err + default: + wg.Done() + } + + return nil + }(i) + } + + wg.Wait() } return zones, nil } +// ListZonesContext lists zones on an account. Optionally takes a list of ReqOptions. +func (api *API) ListZonesContext(ctx context.Context, opts ...ReqOption) (r ZonesResponse, err error) { + var res []byte + opt := reqOption{ + params: url.Values{}, + } + for _, of := range opts { + of(&opt) + } + + res, err = api.makeRequestContext(ctx, "GET", "/zones?"+opt.params.Encode(), nil) + if err != nil { + return ZonesResponse{}, errors.Wrap(err, errMakeRequestError) + } + err = json.Unmarshal(res, &r) + if err != nil { + return ZonesResponse{}, errors.Wrap(err, errUnmarshalError) + } + + return r, nil +} + // ZoneDetails fetches information about a zone. // // API reference: https://api.cloudflare.com/#zone-zone-details @@ -351,9 +437,9 @@ func (api *API) ZoneDetails(zoneID string) (Zone, error) { // ZoneOptions is a subset of Zone, for editable options. type ZoneOptions struct { - Paused *bool `json:"paused,omitempty"` - VanityNS []string `json:"vanity_name_servers,omitempty"` - Plan *ZoneRatePlan `json:"plan,omitempty"` + Paused *bool `json:"paused,omitempty"` + VanityNS []string `json:"vanity_name_servers,omitempty"` + Plan *ZonePlan `json:"plan,omitempty"` } // ZoneSetPaused pauses Cloudflare service for the entire zone, sending all @@ -380,8 +466,8 @@ func (api *API) ZoneSetVanityNS(zoneID string, ns []string) (Zone, error) { return zone, nil } -// ZoneSetRatePlan changes the zone plan. -func (api *API) ZoneSetRatePlan(zoneID string, plan ZoneRatePlan) (Zone, error) { +// ZoneSetPlan changes the zone plan. +func (api *API) ZoneSetPlan(zoneID string, plan ZonePlan) (Zone, error) { zoneopts := ZoneOptions{Plan: &plan} zone, err := api.EditZone(zoneID, zoneopts) if err != nil { @@ -480,6 +566,23 @@ func (api *API) AvailableZoneRatePlans(zoneID string) ([]ZoneRatePlan, error) { return r.Result, nil } +// AvailableZonePlans returns information about all plans available to the specified zone. +// +// API reference: https://api.cloudflare.com/#zone-rate-plan-list-available-plans +func (api *API) AvailableZonePlans(zoneID string) ([]ZonePlan, error) { + uri := "/zones/" + zoneID + "/available_plans" + res, err := api.makeRequest("GET", uri, nil) + if err != nil { + return []ZonePlan{}, errors.Wrap(err, errMakeRequestError) + } + var r AvailableZonePlansResponse + err = json.Unmarshal(res, &r) + if err != nil { + return []ZonePlan{}, errors.Wrap(err, errUnmarshalError) + } + return r.Result, nil +} + // encode encodes non-nil fields into URL encoded form. func (o ZoneAnalyticsOptions) encode() string { v := url.Values{} diff --git a/vendor/github.com/dimchansky/utfbom/utfbom.go b/vendor/github.com/dimchansky/utfbom/utfbom.go index 648184a1..77a303e5 100644 --- a/vendor/github.com/dimchansky/utfbom/utfbom.go +++ b/vendor/github.com/dimchansky/utfbom/utfbom.go @@ -32,6 +32,24 @@ const ( UTF32LittleEndian ) +// String returns a user-friendly string representation of the encoding. Satisfies fmt.Stringer interface. +func (e Encoding) String() string { + switch e { + case UTF8: + return "UTF8" + case UTF16BigEndian: + return "UTF16BigEndian" + case UTF16LittleEndian: + return "UTF16LittleEndian" + case UTF32BigEndian: + return "UTF32BigEndian" + case UTF32LittleEndian: + return "UTF32LittleEndian" + default: + return "Unknown" + } +} + const maxConsecutiveEmptyReads = 100 // Skip creates Reader which automatically detects BOM (Unicode Byte Order Mark) and removes it as necessary. diff --git a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/dnsimple.go b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/dnsimple.go index b61ddd9f..0738aa03 100644 --- a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/dnsimple.go +++ b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/dnsimple.go @@ -23,7 +23,7 @@ const ( // This is a pro-forma convention given that Go dependencies // tends to be fetched directly from the repo. // It is also used in the user-agent identify the client. - Version = "0.23.0" + Version = "0.30.0" // defaultBaseURL to the DNSimple production API. defaultBaseURL = "https://api.dnsimple.com" diff --git a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar.go b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar.go index 625bbb2d..1013bd60 100644 --- a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar.go +++ b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar.go @@ -62,7 +62,7 @@ type DomainPremiumPriceOptions struct { Action string `url:"action,omitempty"` } -// Gets the premium price for a domain. +// GetDomainPremiumPrice gets the premium price for a domain. // // You must specify an action to get the price for. Valid actions are: // - registration diff --git a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar_whois_privacy.go b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar_whois_privacy.go index 4bd6ffb4..730fd8a4 100644 --- a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar_whois_privacy.go +++ b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/registrar_whois_privacy.go @@ -70,7 +70,7 @@ func (s *RegistrarService) EnableWhoisPrivacy(accountID string, domainName strin return privacyResponse, nil } -// DisablePrivacy disables the whois privacy for the domain. +// DisableWhoisPrivacy disables the whois privacy for the domain. // // See https://developer.dnsimple.com/v2/registrar/whois-privacy/#enable func (s *RegistrarService) DisableWhoisPrivacy(accountID string, domainName string) (*whoisPrivacyResponse, error) { diff --git a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/tlds.go b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/tlds.go index ee0da04f..9c5c250d 100644 --- a/vendor/github.com/dnsimple/dnsimple-go/dnsimple/tlds.go +++ b/vendor/github.com/dnsimple/dnsimple-go/dnsimple/tlds.go @@ -100,7 +100,7 @@ func (s *TldsService) GetTld(tld string) (*tldResponse, error) { return tldResponse, nil } -// GetTld fetches the extended attributes of a TLD. +// GetTldExtendedAttributes fetches the extended attributes of a TLD. // // See https://developer.dnsimple.com/v2/tlds/#get func (s *TldsService) GetTldExtendedAttributes(tld string) (*tldExtendedAttributesResponse, error) { diff --git a/vendor/github.com/exoscale/egoscale/async_jobs.go b/vendor/github.com/exoscale/egoscale/async_jobs.go index d815aabd..ab4b52cf 100644 --- a/vendor/github.com/exoscale/egoscale/async_jobs.go +++ b/vendor/github.com/exoscale/egoscale/async_jobs.go @@ -21,6 +21,48 @@ type AsyncJobResult struct { UserID *UUID `json:"userid,omitempty" doc:"the user that executed the async command"` } +// DeepCopy create a true copy of the receiver. +func (a *AsyncJobResult) DeepCopy() *AsyncJobResult { + if a == nil { + return nil + } + + return &AsyncJobResult{ + AccountID: a.AccountID.DeepCopy(), + Cmd: a.Cmd, + Created: a.Created, + JobID: a.JobID.DeepCopy(), + JobInstanceID: a.JobInstanceID.DeepCopy(), + JobInstanceType: a.JobInstanceType, + JobProcStatus: a.JobProcStatus, + JobResult: a.JobResult, + JobResultCode: a.JobResultCode, + JobResultType: a.JobResultType, + JobStatus: a.JobStatus, + UserID: a.UserID.DeepCopy(), + } +} + +// DeepCopyInto copies the receiver into out. +// +// In (a) must be non nil. out must be non nil +func (a *AsyncJobResult) DeepCopyInto(out *AsyncJobResult) { + *out = AsyncJobResult{ + AccountID: a.AccountID.DeepCopy(), + Cmd: a.Cmd, + Created: a.Created, + JobID: a.JobID.DeepCopy(), + JobInstanceID: a.JobInstanceID.DeepCopy(), + JobInstanceType: a.JobInstanceType, + JobProcStatus: a.JobProcStatus, + JobResult: a.JobResult, + JobResultCode: a.JobResultCode, + JobResultType: a.JobResultType, + JobStatus: a.JobStatus, + UserID: a.UserID.DeepCopy(), + } +} + // ListRequest buils the (empty) ListAsyncJobs request func (a AsyncJobResult) ListRequest() (ListCommand, error) { req := &ListAsyncJobs{ diff --git a/vendor/github.com/exoscale/egoscale/client.go b/vendor/github.com/exoscale/egoscale/client.go index 083deddc..81c5f07b 100644 --- a/vendor/github.com/exoscale/egoscale/client.go +++ b/vendor/github.com/exoscale/egoscale/client.go @@ -9,10 +9,18 @@ import ( "net/http/httputil" "os" "reflect" + "runtime" "strings" "time" ) +// UserAgent is the "User-Agent" HTTP request header added to outgoing HTTP requests. +var UserAgent = fmt.Sprintf("egoscale/%s (%s; %s/%s)", + Version, + runtime.Version(), + runtime.GOOS, + runtime.GOARCH) + // Taggable represents a resource to which tags can be attached // // This is a helper to fill the resourcetype of a CreateTags call diff --git a/vendor/github.com/exoscale/egoscale/dns.go b/vendor/github.com/exoscale/egoscale/dns.go index 6fdca332..3d3af407 100644 --- a/vendor/github.com/exoscale/egoscale/dns.go +++ b/vendor/github.com/exoscale/egoscale/dns.go @@ -329,7 +329,7 @@ func (client *Client) dnsRequest(ctx context.Context, uri string, urlValues url. var hdr = make(http.Header) hdr.Add("X-DNS-TOKEN", client.APIKey+":"+client.apiSecret) - hdr.Add("User-Agent", fmt.Sprintf("exoscale/egoscale (%v)", Version)) + hdr.Add("User-Agent", UserAgent) hdr.Add("Accept", "application/json") if params != "" { hdr.Add("Content-Type", "application/json") diff --git a/vendor/github.com/exoscale/egoscale/request.go b/vendor/github.com/exoscale/egoscale/request.go index f0297147..079c626c 100644 --- a/vendor/github.com/exoscale/egoscale/request.go +++ b/vendor/github.com/exoscale/egoscale/request.go @@ -345,7 +345,7 @@ func (client *Client) request(ctx context.Context, command Command) (json.RawMes return nil, err } request = request.WithContext(ctx) - request.Header.Add("User-Agent", fmt.Sprintf("exoscale/egoscale (%v)", Version)) + request.Header.Add("User-Agent", UserAgent) if method == "POST" { request.Header.Add("Content-Type", "application/x-www-form-urlencoded") diff --git a/vendor/github.com/exoscale/egoscale/runstatus.go b/vendor/github.com/exoscale/egoscale/runstatus.go index 268e36ea..48905962 100644 --- a/vendor/github.com/exoscale/egoscale/runstatus.go +++ b/vendor/github.com/exoscale/egoscale/runstatus.go @@ -82,7 +82,7 @@ func (client *Client) runstatusRequest(ctx context.Context, uri string, structPa hdr.Add("Authorization", fmt.Sprintf("Exoscale-HMAC-SHA256 %s:%s", client.APIKey, signature)) hdr.Add("Exoscale-Date", time) - hdr.Add("User-Agent", fmt.Sprintf("exoscale/egoscale (%v)", Version)) + hdr.Add("User-Agent", UserAgent) hdr.Add("Accept", "application/json") if params != "" { hdr.Add("Content-Type", "application/json") diff --git a/vendor/github.com/exoscale/egoscale/templates.go b/vendor/github.com/exoscale/egoscale/templates.go index 36644466..9f49369d 100644 --- a/vendor/github.com/exoscale/egoscale/templates.go +++ b/vendor/github.com/exoscale/egoscale/templates.go @@ -144,7 +144,6 @@ type RegisterCustomTemplate struct { Checksum string `json:"checksum" doc:"the MD5 checksum value of this template"` Details map[string]string `json:"details,omitempty" doc:"Template details in key/value pairs"` Displaytext string `json:"displaytext" doc:"the display text of the template"` - IsFeatured *bool `json:"isfeatured,omitempty" doc:"true if this template is a featured template, default is false"` Name string `json:"name" doc:"the name of the template"` PasswordEnabled *bool `json:"passwordenabled,omitempty" doc:"true if the template supports the password reset feature; default is false"` SSHKeyEnabled *bool `json:"sshkeyenabled,omitempty" doc:"true if the template supports the sshkey upload feature; default is false"` diff --git a/vendor/github.com/exoscale/egoscale/version.go b/vendor/github.com/exoscale/egoscale/version.go index 6046f5ff..d9694614 100644 --- a/vendor/github.com/exoscale/egoscale/version.go +++ b/vendor/github.com/exoscale/egoscale/version.go @@ -1,4 +1,4 @@ package egoscale // Version of the library -const Version = "0.17.1" +const Version = "0.18.1" diff --git a/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go b/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go new file mode 100644 index 00000000..ada2b78e --- /dev/null +++ b/vendor/github.com/golang/protobuf/jsonpb/jsonpb.go @@ -0,0 +1,1271 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2015 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package jsonpb provides marshaling and unmarshaling between protocol buffers and JSON. +It follows the specification at https://developers.google.com/protocol-buffers/docs/proto3#json. + +This package produces a different output than the standard "encoding/json" package, +which does not operate correctly on protocol buffers. +*/ +package jsonpb + +import ( + "bytes" + "encoding/json" + "errors" + "fmt" + "io" + "math" + "reflect" + "sort" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + + stpb "github.com/golang/protobuf/ptypes/struct" +) + +const secondInNanos = int64(time.Second / time.Nanosecond) + +// Marshaler is a configurable object for converting between +// protocol buffer objects and a JSON representation for them. +type Marshaler struct { + // Whether to render enum values as integers, as opposed to string values. + EnumsAsInts bool + + // Whether to render fields with zero values. + EmitDefaults bool + + // A string to indent each level by. The presence of this field will + // also cause a space to appear between the field separator and + // value, and for newlines to be appear between fields and array + // elements. + Indent string + + // Whether to use the original (.proto) name for fields. + OrigName bool + + // A custom URL resolver to use when marshaling Any messages to JSON. + // If unset, the default resolution strategy is to extract the + // fully-qualified type name from the type URL and pass that to + // proto.MessageType(string). + AnyResolver AnyResolver +} + +// AnyResolver takes a type URL, present in an Any message, and resolves it into +// an instance of the associated message. +type AnyResolver interface { + Resolve(typeUrl string) (proto.Message, error) +} + +func defaultResolveAny(typeUrl string) (proto.Message, error) { + // Only the part of typeUrl after the last slash is relevant. + mname := typeUrl + if slash := strings.LastIndex(mname, "/"); slash >= 0 { + mname = mname[slash+1:] + } + mt := proto.MessageType(mname) + if mt == nil { + return nil, fmt.Errorf("unknown message type %q", mname) + } + return reflect.New(mt.Elem()).Interface().(proto.Message), nil +} + +// JSONPBMarshaler is implemented by protobuf messages that customize the +// way they are marshaled to JSON. Messages that implement this should +// also implement JSONPBUnmarshaler so that the custom format can be +// parsed. +// +// The JSON marshaling must follow the proto to JSON specification: +// https://developers.google.com/protocol-buffers/docs/proto3#json +type JSONPBMarshaler interface { + MarshalJSONPB(*Marshaler) ([]byte, error) +} + +// JSONPBUnmarshaler is implemented by protobuf messages that customize +// the way they are unmarshaled from JSON. Messages that implement this +// should also implement JSONPBMarshaler so that the custom format can be +// produced. +// +// The JSON unmarshaling must follow the JSON to proto specification: +// https://developers.google.com/protocol-buffers/docs/proto3#json +type JSONPBUnmarshaler interface { + UnmarshalJSONPB(*Unmarshaler, []byte) error +} + +// Marshal marshals a protocol buffer into JSON. +func (m *Marshaler) Marshal(out io.Writer, pb proto.Message) error { + v := reflect.ValueOf(pb) + if pb == nil || (v.Kind() == reflect.Ptr && v.IsNil()) { + return errors.New("Marshal called with nil") + } + // Check for unset required fields first. + if err := checkRequiredFields(pb); err != nil { + return err + } + writer := &errWriter{writer: out} + return m.marshalObject(writer, pb, "", "") +} + +// MarshalToString converts a protocol buffer object to JSON string. +func (m *Marshaler) MarshalToString(pb proto.Message) (string, error) { + var buf bytes.Buffer + if err := m.Marshal(&buf, pb); err != nil { + return "", err + } + return buf.String(), nil +} + +type int32Slice []int32 + +var nonFinite = map[string]float64{ + `"NaN"`: math.NaN(), + `"Infinity"`: math.Inf(1), + `"-Infinity"`: math.Inf(-1), +} + +// For sorting extensions ids to ensure stable output. +func (s int32Slice) Len() int { return len(s) } +func (s int32Slice) Less(i, j int) bool { return s[i] < s[j] } +func (s int32Slice) Swap(i, j int) { s[i], s[j] = s[j], s[i] } + +type wkt interface { + XXX_WellKnownType() string +} + +// marshalObject writes a struct to the Writer. +func (m *Marshaler) marshalObject(out *errWriter, v proto.Message, indent, typeURL string) error { + if jsm, ok := v.(JSONPBMarshaler); ok { + b, err := jsm.MarshalJSONPB(m) + if err != nil { + return err + } + if typeURL != "" { + // we are marshaling this object to an Any type + var js map[string]*json.RawMessage + if err = json.Unmarshal(b, &js); err != nil { + return fmt.Errorf("type %T produced invalid JSON: %v", v, err) + } + turl, err := json.Marshal(typeURL) + if err != nil { + return fmt.Errorf("failed to marshal type URL %q to JSON: %v", typeURL, err) + } + js["@type"] = (*json.RawMessage)(&turl) + if b, err = json.Marshal(js); err != nil { + return err + } + } + + out.write(string(b)) + return out.err + } + + s := reflect.ValueOf(v).Elem() + + // Handle well-known types. + if wkt, ok := v.(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + // "Wrappers use the same representation in JSON + // as the wrapped primitive type, ..." + sprop := proto.GetProperties(s.Type()) + return m.marshalValue(out, sprop.Prop[0], s.Field(0), indent) + case "Any": + // Any is a bit more involved. + return m.marshalAny(out, v, indent) + case "Duration": + // "Generated output always contains 0, 3, 6, or 9 fractional digits, + // depending on required precision." + s, ns := s.Field(0).Int(), s.Field(1).Int() + if ns <= -secondInNanos || ns >= secondInNanos { + return fmt.Errorf("ns out of range (%v, %v)", -secondInNanos, secondInNanos) + } + if (s > 0 && ns < 0) || (s < 0 && ns > 0) { + return errors.New("signs of seconds and nanos do not match") + } + if s < 0 { + ns = -ns + } + x := fmt.Sprintf("%d.%09d", s, ns) + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`s"`) + return out.err + case "Struct", "ListValue": + // Let marshalValue handle the `Struct.fields` map or the `ListValue.values` slice. + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, s.Field(0), indent) + case "Timestamp": + // "RFC 3339, where generated output will always be Z-normalized + // and uses 0, 3, 6 or 9 fractional digits." + s, ns := s.Field(0).Int(), s.Field(1).Int() + if ns < 0 || ns >= secondInNanos { + return fmt.Errorf("ns out of range [0, %v)", secondInNanos) + } + t := time.Unix(s, ns).UTC() + // time.RFC3339Nano isn't exactly right (we need to get 3/6/9 fractional digits). + x := t.Format("2006-01-02T15:04:05.000000000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, "000") + x = strings.TrimSuffix(x, ".000") + out.write(`"`) + out.write(x) + out.write(`Z"`) + return out.err + case "Value": + // Value has a single oneof. + kind := s.Field(0) + if kind.IsNil() { + // "absence of any variant indicates an error" + return errors.New("nil Value") + } + // oneof -> *T -> T -> T.F + x := kind.Elem().Elem().Field(0) + // TODO: pass the correct Properties if needed. + return m.marshalValue(out, &proto.Properties{}, x, indent) + } + } + + out.write("{") + if m.Indent != "" { + out.write("\n") + } + + firstField := true + + if typeURL != "" { + if err := m.marshalTypeURL(out, indent, typeURL); err != nil { + return err + } + firstField = false + } + + for i := 0; i < s.NumField(); i++ { + value := s.Field(i) + valueField := s.Type().Field(i) + if strings.HasPrefix(valueField.Name, "XXX_") { + continue + } + + // IsNil will panic on most value kinds. + switch value.Kind() { + case reflect.Chan, reflect.Func, reflect.Interface: + if value.IsNil() { + continue + } + } + + if !m.EmitDefaults { + switch value.Kind() { + case reflect.Bool: + if !value.Bool() { + continue + } + case reflect.Int32, reflect.Int64: + if value.Int() == 0 { + continue + } + case reflect.Uint32, reflect.Uint64: + if value.Uint() == 0 { + continue + } + case reflect.Float32, reflect.Float64: + if value.Float() == 0 { + continue + } + case reflect.String: + if value.Len() == 0 { + continue + } + case reflect.Map, reflect.Ptr, reflect.Slice: + if value.IsNil() { + continue + } + } + } + + // Oneof fields need special handling. + if valueField.Tag.Get("protobuf_oneof") != "" { + // value is an interface containing &T{real_value}. + sv := value.Elem().Elem() // interface -> *T -> T + value = sv.Field(0) + valueField = sv.Type().Field(0) + } + prop := jsonProperties(valueField, m.OrigName) + if !firstField { + m.writeSep(out) + } + if err := m.marshalField(out, prop, value, indent); err != nil { + return err + } + firstField = false + } + + // Handle proto2 extensions. + if ep, ok := v.(proto.Message); ok { + extensions := proto.RegisteredExtensions(v) + // Sort extensions for stable output. + ids := make([]int32, 0, len(extensions)) + for id, desc := range extensions { + if !proto.HasExtension(ep, desc) { + continue + } + ids = append(ids, id) + } + sort.Sort(int32Slice(ids)) + for _, id := range ids { + desc := extensions[id] + if desc == nil { + // unknown extension + continue + } + ext, extErr := proto.GetExtension(ep, desc) + if extErr != nil { + return extErr + } + value := reflect.ValueOf(ext) + var prop proto.Properties + prop.Parse(desc.Tag) + prop.JSONName = fmt.Sprintf("[%s]", desc.Name) + if !firstField { + m.writeSep(out) + } + if err := m.marshalField(out, &prop, value, indent); err != nil { + return err + } + firstField = false + } + + } + + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err +} + +func (m *Marshaler) writeSep(out *errWriter) { + if m.Indent != "" { + out.write(",\n") + } else { + out.write(",") + } +} + +func (m *Marshaler) marshalAny(out *errWriter, any proto.Message, indent string) error { + // "If the Any contains a value that has a special JSON mapping, + // it will be converted as follows: {"@type": xxx, "value": yyy}. + // Otherwise, the value will be converted into a JSON object, + // and the "@type" field will be inserted to indicate the actual data type." + v := reflect.ValueOf(any).Elem() + turl := v.Field(0).String() + val := v.Field(1).Bytes() + + var msg proto.Message + var err error + if m.AnyResolver != nil { + msg, err = m.AnyResolver.Resolve(turl) + } else { + msg, err = defaultResolveAny(turl) + } + if err != nil { + return err + } + + if err := proto.Unmarshal(val, msg); err != nil { + return err + } + + if _, ok := msg.(wkt); ok { + out.write("{") + if m.Indent != "" { + out.write("\n") + } + if err := m.marshalTypeURL(out, indent, turl); err != nil { + return err + } + m.writeSep(out) + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + out.write(`"value": `) + } else { + out.write(`"value":`) + } + if err := m.marshalObject(out, msg, indent+m.Indent, ""); err != nil { + return err + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + } + out.write("}") + return out.err + } + + return m.marshalObject(out, msg, indent, turl) +} + +func (m *Marshaler) marshalTypeURL(out *errWriter, indent, typeURL string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"@type":`) + if m.Indent != "" { + out.write(" ") + } + b, err := json.Marshal(typeURL) + if err != nil { + return err + } + out.write(string(b)) + return out.err +} + +// marshalField writes field description and value to the Writer. +func (m *Marshaler) marshalField(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + if m.Indent != "" { + out.write(indent) + out.write(m.Indent) + } + out.write(`"`) + out.write(prop.JSONName) + out.write(`":`) + if m.Indent != "" { + out.write(" ") + } + if err := m.marshalValue(out, prop, v, indent); err != nil { + return err + } + return nil +} + +// marshalValue writes the value to the Writer. +func (m *Marshaler) marshalValue(out *errWriter, prop *proto.Properties, v reflect.Value, indent string) error { + var err error + v = reflect.Indirect(v) + + // Handle nil pointer + if v.Kind() == reflect.Invalid { + out.write("null") + return out.err + } + + // Handle repeated elements. + if v.Kind() == reflect.Slice && v.Type().Elem().Kind() != reflect.Uint8 { + out.write("[") + comma := "" + for i := 0; i < v.Len(); i++ { + sliceVal := v.Index(i) + out.write(comma) + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + if err := m.marshalValue(out, prop, sliceVal, indent+m.Indent); err != nil { + return err + } + comma = "," + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write("]") + return out.err + } + + // Handle well-known types. + // Most are handled up in marshalObject (because 99% are messages). + if wkt, ok := v.Interface().(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "NullValue": + out.write("null") + return out.err + } + } + + // Handle enumerations. + if !m.EnumsAsInts && prop.Enum != "" { + // Unknown enum values will are stringified by the proto library as their + // value. Such values should _not_ be quoted or they will be interpreted + // as an enum string instead of their value. + enumStr := v.Interface().(fmt.Stringer).String() + var valStr string + if v.Kind() == reflect.Ptr { + valStr = strconv.Itoa(int(v.Elem().Int())) + } else { + valStr = strconv.Itoa(int(v.Int())) + } + isKnownEnum := enumStr != valStr + if isKnownEnum { + out.write(`"`) + } + out.write(enumStr) + if isKnownEnum { + out.write(`"`) + } + return out.err + } + + // Handle nested messages. + if v.Kind() == reflect.Struct { + return m.marshalObject(out, v.Addr().Interface().(proto.Message), indent+m.Indent, "") + } + + // Handle maps. + // Since Go randomizes map iteration, we sort keys for stable output. + if v.Kind() == reflect.Map { + out.write(`{`) + keys := v.MapKeys() + sort.Sort(mapKeys(keys)) + for i, k := range keys { + if i > 0 { + out.write(`,`) + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + out.write(m.Indent) + } + + // TODO handle map key prop properly + b, err := json.Marshal(k.Interface()) + if err != nil { + return err + } + s := string(b) + + // If the JSON is not a string value, encode it again to make it one. + if !strings.HasPrefix(s, `"`) { + b, err := json.Marshal(s) + if err != nil { + return err + } + s = string(b) + } + + out.write(s) + out.write(`:`) + if m.Indent != "" { + out.write(` `) + } + + vprop := prop + if prop != nil && prop.MapValProp != nil { + vprop = prop.MapValProp + } + if err := m.marshalValue(out, vprop, v.MapIndex(k), indent+m.Indent); err != nil { + return err + } + } + if m.Indent != "" { + out.write("\n") + out.write(indent) + out.write(m.Indent) + } + out.write(`}`) + return out.err + } + + // Handle non-finite floats, e.g. NaN, Infinity and -Infinity. + if v.Kind() == reflect.Float32 || v.Kind() == reflect.Float64 { + f := v.Float() + var sval string + switch { + case math.IsInf(f, 1): + sval = `"Infinity"` + case math.IsInf(f, -1): + sval = `"-Infinity"` + case math.IsNaN(f): + sval = `"NaN"` + } + if sval != "" { + out.write(sval) + return out.err + } + } + + // Default handling defers to the encoding/json library. + b, err := json.Marshal(v.Interface()) + if err != nil { + return err + } + needToQuote := string(b[0]) != `"` && (v.Kind() == reflect.Int64 || v.Kind() == reflect.Uint64) + if needToQuote { + out.write(`"`) + } + out.write(string(b)) + if needToQuote { + out.write(`"`) + } + return out.err +} + +// Unmarshaler is a configurable object for converting from a JSON +// representation to a protocol buffer object. +type Unmarshaler struct { + // Whether to allow messages to contain unknown fields, as opposed to + // failing to unmarshal. + AllowUnknownFields bool + + // A custom URL resolver to use when unmarshaling Any messages from JSON. + // If unset, the default resolution strategy is to extract the + // fully-qualified type name from the type URL and pass that to + // proto.MessageType(string). + AnyResolver AnyResolver +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func (u *Unmarshaler) UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + inputValue := json.RawMessage{} + if err := dec.Decode(&inputValue); err != nil { + return err + } + if err := u.unmarshalValue(reflect.ValueOf(pb).Elem(), inputValue, nil); err != nil { + return err + } + return checkRequiredFields(pb) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func (u *Unmarshaler) Unmarshal(r io.Reader, pb proto.Message) error { + dec := json.NewDecoder(r) + return u.UnmarshalNext(dec, pb) +} + +// UnmarshalNext unmarshals the next protocol buffer from a JSON object stream. +// This function is lenient and will decode any options permutations of the +// related Marshaler. +func UnmarshalNext(dec *json.Decoder, pb proto.Message) error { + return new(Unmarshaler).UnmarshalNext(dec, pb) +} + +// Unmarshal unmarshals a JSON object stream into a protocol +// buffer. This function is lenient and will decode any options +// permutations of the related Marshaler. +func Unmarshal(r io.Reader, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(r, pb) +} + +// UnmarshalString will populate the fields of a protocol buffer based +// on a JSON string. This function is lenient and will decode any options +// permutations of the related Marshaler. +func UnmarshalString(str string, pb proto.Message) error { + return new(Unmarshaler).Unmarshal(strings.NewReader(str), pb) +} + +// unmarshalValue converts/copies a value into the target. +// prop may be nil. +func (u *Unmarshaler) unmarshalValue(target reflect.Value, inputValue json.RawMessage, prop *proto.Properties) error { + targetType := target.Type() + + // Allocate memory for pointer fields. + if targetType.Kind() == reflect.Ptr { + // If input value is "null" and target is a pointer type, then the field should be treated as not set + // UNLESS the target is structpb.Value, in which case it should be set to structpb.NullValue. + _, isJSONPBUnmarshaler := target.Interface().(JSONPBUnmarshaler) + if string(inputValue) == "null" && targetType != reflect.TypeOf(&stpb.Value{}) && !isJSONPBUnmarshaler { + return nil + } + target.Set(reflect.New(targetType.Elem())) + + return u.unmarshalValue(target.Elem(), inputValue, prop) + } + + if jsu, ok := target.Addr().Interface().(JSONPBUnmarshaler); ok { + return jsu.UnmarshalJSONPB(u, []byte(inputValue)) + } + + // Handle well-known types that are not pointers. + if w, ok := target.Addr().Interface().(wkt); ok { + switch w.XXX_WellKnownType() { + case "DoubleValue", "FloatValue", "Int64Value", "UInt64Value", + "Int32Value", "UInt32Value", "BoolValue", "StringValue", "BytesValue": + return u.unmarshalValue(target.Field(0), inputValue, prop) + case "Any": + // Use json.RawMessage pointer type instead of value to support pre-1.8 version. + // 1.8 changed RawMessage.MarshalJSON from pointer type to value type, see + // https://github.com/golang/go/issues/14493 + var jsonFields map[string]*json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } + + val, ok := jsonFields["@type"] + if !ok || val == nil { + return errors.New("Any JSON doesn't have '@type'") + } + + var turl string + if err := json.Unmarshal([]byte(*val), &turl); err != nil { + return fmt.Errorf("can't unmarshal Any's '@type': %q", *val) + } + target.Field(0).SetString(turl) + + var m proto.Message + var err error + if u.AnyResolver != nil { + m, err = u.AnyResolver.Resolve(turl) + } else { + m, err = defaultResolveAny(turl) + } + if err != nil { + return err + } + + if _, ok := m.(wkt); ok { + val, ok := jsonFields["value"] + if !ok { + return errors.New("Any JSON doesn't have 'value'") + } + + if err := u.unmarshalValue(reflect.ValueOf(m).Elem(), *val, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) + } + } else { + delete(jsonFields, "@type") + nestedProto, err := json.Marshal(jsonFields) + if err != nil { + return fmt.Errorf("can't generate JSON for Any's nested proto to be unmarshaled: %v", err) + } + + if err = u.unmarshalValue(reflect.ValueOf(m).Elem(), nestedProto, nil); err != nil { + return fmt.Errorf("can't unmarshal Any nested proto %T: %v", m, err) + } + } + + b, err := proto.Marshal(m) + if err != nil { + return fmt.Errorf("can't marshal proto %T into Any.Value: %v", m, err) + } + target.Field(1).SetBytes(b) + + return nil + case "Duration": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } + + d, err := time.ParseDuration(unq) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + target.Field(0).SetInt(s) + target.Field(1).SetInt(ns) + return nil + case "Timestamp": + unq, err := unquote(string(inputValue)) + if err != nil { + return err + } + + t, err := time.Parse(time.RFC3339Nano, unq) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + + target.Field(0).SetInt(t.Unix()) + target.Field(1).SetInt(int64(t.Nanosecond())) + return nil + case "Struct": + var m map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &m); err != nil { + return fmt.Errorf("bad StructValue: %v", err) + } + + target.Field(0).Set(reflect.ValueOf(map[string]*stpb.Value{})) + for k, jv := range m { + pv := &stpb.Value{} + if err := u.unmarshalValue(reflect.ValueOf(pv).Elem(), jv, prop); err != nil { + return fmt.Errorf("bad value in StructValue for key %q: %v", k, err) + } + target.Field(0).SetMapIndex(reflect.ValueOf(k), reflect.ValueOf(pv)) + } + return nil + case "ListValue": + var s []json.RawMessage + if err := json.Unmarshal(inputValue, &s); err != nil { + return fmt.Errorf("bad ListValue: %v", err) + } + + target.Field(0).Set(reflect.ValueOf(make([]*stpb.Value, len(s)))) + for i, sv := range s { + if err := u.unmarshalValue(target.Field(0).Index(i), sv, prop); err != nil { + return err + } + } + return nil + case "Value": + ivStr := string(inputValue) + if ivStr == "null" { + target.Field(0).Set(reflect.ValueOf(&stpb.Value_NullValue{})) + } else if v, err := strconv.ParseFloat(ivStr, 0); err == nil { + target.Field(0).Set(reflect.ValueOf(&stpb.Value_NumberValue{v})) + } else if v, err := unquote(ivStr); err == nil { + target.Field(0).Set(reflect.ValueOf(&stpb.Value_StringValue{v})) + } else if v, err := strconv.ParseBool(ivStr); err == nil { + target.Field(0).Set(reflect.ValueOf(&stpb.Value_BoolValue{v})) + } else if err := json.Unmarshal(inputValue, &[]json.RawMessage{}); err == nil { + lv := &stpb.ListValue{} + target.Field(0).Set(reflect.ValueOf(&stpb.Value_ListValue{lv})) + return u.unmarshalValue(reflect.ValueOf(lv).Elem(), inputValue, prop) + } else if err := json.Unmarshal(inputValue, &map[string]json.RawMessage{}); err == nil { + sv := &stpb.Struct{} + target.Field(0).Set(reflect.ValueOf(&stpb.Value_StructValue{sv})) + return u.unmarshalValue(reflect.ValueOf(sv).Elem(), inputValue, prop) + } else { + return fmt.Errorf("unrecognized type for Value %q", ivStr) + } + return nil + } + } + + // Handle enums, which have an underlying type of int32, + // and may appear as strings. + // The case of an enum appearing as a number is handled + // at the bottom of this function. + if inputValue[0] == '"' && prop != nil && prop.Enum != "" { + vmap := proto.EnumValueMap(prop.Enum) + // Don't need to do unquoting; valid enum names + // are from a limited character set. + s := inputValue[1 : len(inputValue)-1] + n, ok := vmap[string(s)] + if !ok { + return fmt.Errorf("unknown value %q for enum %s", s, prop.Enum) + } + if target.Kind() == reflect.Ptr { // proto2 + target.Set(reflect.New(targetType.Elem())) + target = target.Elem() + } + if targetType.Kind() != reflect.Int32 { + return fmt.Errorf("invalid target %q for enum %s", targetType.Kind(), prop.Enum) + } + target.SetInt(int64(n)) + return nil + } + + // Handle nested messages. + if targetType.Kind() == reflect.Struct { + var jsonFields map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &jsonFields); err != nil { + return err + } + + consumeField := func(prop *proto.Properties) (json.RawMessage, bool) { + // Be liberal in what names we accept; both orig_name and camelName are okay. + fieldNames := acceptedJSONFieldNames(prop) + + vOrig, okOrig := jsonFields[fieldNames.orig] + vCamel, okCamel := jsonFields[fieldNames.camel] + if !okOrig && !okCamel { + return nil, false + } + // If, for some reason, both are present in the data, favour the camelName. + var raw json.RawMessage + if okOrig { + raw = vOrig + delete(jsonFields, fieldNames.orig) + } + if okCamel { + raw = vCamel + delete(jsonFields, fieldNames.camel) + } + return raw, true + } + + sprops := proto.GetProperties(targetType) + for i := 0; i < target.NumField(); i++ { + ft := target.Type().Field(i) + if strings.HasPrefix(ft.Name, "XXX_") { + continue + } + + valueForField, ok := consumeField(sprops.Prop[i]) + if !ok { + continue + } + + if err := u.unmarshalValue(target.Field(i), valueForField, sprops.Prop[i]); err != nil { + return err + } + } + // Check for any oneof fields. + if len(jsonFields) > 0 { + for _, oop := range sprops.OneofTypes { + raw, ok := consumeField(oop.Prop) + if !ok { + continue + } + nv := reflect.New(oop.Type.Elem()) + target.Field(oop.Field).Set(nv) + if err := u.unmarshalValue(nv.Elem().Field(0), raw, oop.Prop); err != nil { + return err + } + } + } + // Handle proto2 extensions. + if len(jsonFields) > 0 { + if ep, ok := target.Addr().Interface().(proto.Message); ok { + for _, ext := range proto.RegisteredExtensions(ep) { + name := fmt.Sprintf("[%s]", ext.Name) + raw, ok := jsonFields[name] + if !ok { + continue + } + delete(jsonFields, name) + nv := reflect.New(reflect.TypeOf(ext.ExtensionType).Elem()) + if err := u.unmarshalValue(nv.Elem(), raw, nil); err != nil { + return err + } + if err := proto.SetExtension(ep, ext, nv.Interface()); err != nil { + return err + } + } + } + } + if !u.AllowUnknownFields && len(jsonFields) > 0 { + // Pick any field to be the scapegoat. + var f string + for fname := range jsonFields { + f = fname + break + } + return fmt.Errorf("unknown field %q in %v", f, targetType) + } + return nil + } + + // Handle arrays (which aren't encoded bytes) + if targetType.Kind() == reflect.Slice && targetType.Elem().Kind() != reflect.Uint8 { + var slc []json.RawMessage + if err := json.Unmarshal(inputValue, &slc); err != nil { + return err + } + if slc != nil { + l := len(slc) + target.Set(reflect.MakeSlice(targetType, l, l)) + for i := 0; i < l; i++ { + if err := u.unmarshalValue(target.Index(i), slc[i], prop); err != nil { + return err + } + } + } + return nil + } + + // Handle maps (whose keys are always strings) + if targetType.Kind() == reflect.Map { + var mp map[string]json.RawMessage + if err := json.Unmarshal(inputValue, &mp); err != nil { + return err + } + if mp != nil { + target.Set(reflect.MakeMap(targetType)) + for ks, raw := range mp { + // Unmarshal map key. The core json library already decoded the key into a + // string, so we handle that specially. Other types were quoted post-serialization. + var k reflect.Value + if targetType.Key().Kind() == reflect.String { + k = reflect.ValueOf(ks) + } else { + k = reflect.New(targetType.Key()).Elem() + var kprop *proto.Properties + if prop != nil && prop.MapKeyProp != nil { + kprop = prop.MapKeyProp + } + if err := u.unmarshalValue(k, json.RawMessage(ks), kprop); err != nil { + return err + } + } + + // Unmarshal map value. + v := reflect.New(targetType.Elem()).Elem() + var vprop *proto.Properties + if prop != nil && prop.MapValProp != nil { + vprop = prop.MapValProp + } + if err := u.unmarshalValue(v, raw, vprop); err != nil { + return err + } + target.SetMapIndex(k, v) + } + } + return nil + } + + // Non-finite numbers can be encoded as strings. + isFloat := targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64 + if isFloat { + if num, ok := nonFinite[string(inputValue)]; ok { + target.SetFloat(num) + return nil + } + } + + // integers & floats can be encoded as strings. In this case we drop + // the quotes and proceed as normal. + isNum := targetType.Kind() == reflect.Int64 || targetType.Kind() == reflect.Uint64 || + targetType.Kind() == reflect.Int32 || targetType.Kind() == reflect.Uint32 || + targetType.Kind() == reflect.Float32 || targetType.Kind() == reflect.Float64 + if isNum && strings.HasPrefix(string(inputValue), `"`) { + inputValue = inputValue[1 : len(inputValue)-1] + } + + // Use the encoding/json for parsing other value types. + return json.Unmarshal(inputValue, target.Addr().Interface()) +} + +func unquote(s string) (string, error) { + var ret string + err := json.Unmarshal([]byte(s), &ret) + return ret, err +} + +// jsonProperties returns parsed proto.Properties for the field and corrects JSONName attribute. +func jsonProperties(f reflect.StructField, origName bool) *proto.Properties { + var prop proto.Properties + prop.Init(f.Type, f.Name, f.Tag.Get("protobuf"), &f) + if origName || prop.JSONName == "" { + prop.JSONName = prop.OrigName + } + return &prop +} + +type fieldNames struct { + orig, camel string +} + +func acceptedJSONFieldNames(prop *proto.Properties) fieldNames { + opts := fieldNames{orig: prop.OrigName, camel: prop.OrigName} + if prop.JSONName != "" { + opts.camel = prop.JSONName + } + return opts +} + +// Writer wrapper inspired by https://blog.golang.org/errors-are-values +type errWriter struct { + writer io.Writer + err error +} + +func (w *errWriter) write(str string) { + if w.err != nil { + return + } + _, w.err = w.writer.Write([]byte(str)) +} + +// Map fields may have key types of non-float scalars, strings and enums. +// The easiest way to sort them in some deterministic order is to use fmt. +// If this turns out to be inefficient we can always consider other options, +// such as doing a Schwartzian transform. +// +// Numeric keys are sorted in numeric order per +// https://developers.google.com/protocol-buffers/docs/proto#maps. +type mapKeys []reflect.Value + +func (s mapKeys) Len() int { return len(s) } +func (s mapKeys) Swap(i, j int) { s[i], s[j] = s[j], s[i] } +func (s mapKeys) Less(i, j int) bool { + if k := s[i].Kind(); k == s[j].Kind() { + switch k { + case reflect.String: + return s[i].String() < s[j].String() + case reflect.Int32, reflect.Int64: + return s[i].Int() < s[j].Int() + case reflect.Uint32, reflect.Uint64: + return s[i].Uint() < s[j].Uint() + } + } + return fmt.Sprint(s[i].Interface()) < fmt.Sprint(s[j].Interface()) +} + +// checkRequiredFields returns an error if any required field in the given proto message is not set. +// This function is used by both Marshal and Unmarshal. While required fields only exist in a +// proto2 message, a proto3 message can contain proto2 message(s). +func checkRequiredFields(pb proto.Message) error { + // Most well-known type messages do not contain required fields. The "Any" type may contain + // a message that has required fields. + // + // When an Any message is being marshaled, the code will invoked proto.Unmarshal on Any.Value + // field in order to transform that into JSON, and that should have returned an error if a + // required field is not set in the embedded message. + // + // When an Any message is being unmarshaled, the code will have invoked proto.Marshal on the + // embedded message to store the serialized message in Any.Value field, and that should have + // returned an error if a required field is not set. + if _, ok := pb.(wkt); ok { + return nil + } + + v := reflect.ValueOf(pb) + // Skip message if it is not a struct pointer. + if v.Kind() != reflect.Ptr { + return nil + } + v = v.Elem() + if v.Kind() != reflect.Struct { + return nil + } + + for i := 0; i < v.NumField(); i++ { + field := v.Field(i) + sfield := v.Type().Field(i) + + if sfield.PkgPath != "" { + // blank PkgPath means the field is exported; skip if not exported + continue + } + + if strings.HasPrefix(sfield.Name, "XXX_") { + continue + } + + // Oneof field is an interface implemented by wrapper structs containing the actual oneof + // field, i.e. an interface containing &T{real_value}. + if sfield.Tag.Get("protobuf_oneof") != "" { + if field.Kind() != reflect.Interface { + continue + } + v := field.Elem() + if v.Kind() != reflect.Ptr || v.IsNil() { + continue + } + v = v.Elem() + if v.Kind() != reflect.Struct || v.NumField() < 1 { + continue + } + field = v.Field(0) + sfield = v.Type().Field(0) + } + + protoTag := sfield.Tag.Get("protobuf") + if protoTag == "" { + continue + } + var prop proto.Properties + prop.Init(sfield.Type, sfield.Name, protoTag, &sfield) + + switch field.Kind() { + case reflect.Map: + if field.IsNil() { + continue + } + // Check each map value. + keys := field.MapKeys() + for _, k := range keys { + v := field.MapIndex(k) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Slice: + // Handle non-repeated type, e.g. bytes. + if !prop.Repeated { + if prop.Required && field.IsNil() { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + + // Handle repeated type. + if field.IsNil() { + continue + } + // Check each slice item. + for i := 0; i < field.Len(); i++ { + v := field.Index(i) + if err := checkRequiredFieldsInValue(v); err != nil { + return err + } + } + case reflect.Ptr: + if field.IsNil() { + if prop.Required { + return fmt.Errorf("required field %q is not set", prop.Name) + } + continue + } + if err := checkRequiredFieldsInValue(field); err != nil { + return err + } + } + } + + // Handle proto2 extensions. + for _, ext := range proto.RegisteredExtensions(pb) { + if !proto.HasExtension(pb, ext) { + continue + } + ep, err := proto.GetExtension(pb, ext) + if err != nil { + return err + } + err = checkRequiredFieldsInValue(reflect.ValueOf(ep)) + if err != nil { + return err + } + } + + return nil +} + +func checkRequiredFieldsInValue(v reflect.Value) error { + if pm, ok := v.Interface().(proto.Message); ok { + return checkRequiredFields(pm) + } + return nil +} diff --git a/vendor/github.com/golang/protobuf/proto/decode.go b/vendor/github.com/golang/protobuf/proto/decode.go index d9aa3c42..63b0f08b 100644 --- a/vendor/github.com/golang/protobuf/proto/decode.go +++ b/vendor/github.com/golang/protobuf/proto/decode.go @@ -186,7 +186,6 @@ func (p *Buffer) DecodeVarint() (x uint64, err error) { if b&0x80 == 0 { goto done } - // x -= 0x80 << 63 // Always zero. return 0, errOverflow diff --git a/vendor/github.com/golang/protobuf/proto/deprecated.go b/vendor/github.com/golang/protobuf/proto/deprecated.go new file mode 100644 index 00000000..35b882c0 --- /dev/null +++ b/vendor/github.com/golang/protobuf/proto/deprecated.go @@ -0,0 +1,63 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2018 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +package proto + +import "errors" + +// Deprecated: do not use. +type Stats struct{ Emalloc, Dmalloc, Encode, Decode, Chit, Cmiss, Size uint64 } + +// Deprecated: do not use. +func GetStats() Stats { return Stats{} } + +// Deprecated: do not use. +func MarshalMessageSet(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSet([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func MarshalMessageSetJSON(interface{}) ([]byte, error) { + return nil, errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func UnmarshalMessageSetJSON([]byte, interface{}) error { + return errors.New("proto: not implemented") +} + +// Deprecated: do not use. +func RegisterMessageSetType(Message, int32, string) {} diff --git a/vendor/github.com/golang/protobuf/proto/equal.go b/vendor/github.com/golang/protobuf/proto/equal.go index d4db5a1c..f9b6e41b 100644 --- a/vendor/github.com/golang/protobuf/proto/equal.go +++ b/vendor/github.com/golang/protobuf/proto/equal.go @@ -246,7 +246,8 @@ func equalExtMap(base reflect.Type, em1, em2 map[int32]Extension) bool { return false } - m1, m2 := e1.value, e2.value + m1 := extensionAsLegacyType(e1.value) + m2 := extensionAsLegacyType(e2.value) if m1 == nil && m2 == nil { // Both have only encoded form. diff --git a/vendor/github.com/golang/protobuf/proto/extensions.go b/vendor/github.com/golang/protobuf/proto/extensions.go index 816a3b9d..fa88add3 100644 --- a/vendor/github.com/golang/protobuf/proto/extensions.go +++ b/vendor/github.com/golang/protobuf/proto/extensions.go @@ -185,9 +185,25 @@ type Extension struct { // extension will have only enc set. When such an extension is // accessed using GetExtension (or GetExtensions) desc and value // will be set. - desc *ExtensionDesc + desc *ExtensionDesc + + // value is a concrete value for the extension field. Let the type of + // desc.ExtensionType be the "API type" and the type of Extension.value + // be the "storage type". The API type and storage type are the same except: + // * For scalars (except []byte), the API type uses *T, + // while the storage type uses T. + // * For repeated fields, the API type uses []T, while the storage type + // uses *[]T. + // + // The reason for the divergence is so that the storage type more naturally + // matches what is expected of when retrieving the values through the + // protobuf reflection APIs. + // + // The value may only be populated if desc is also populated. value interface{} - enc []byte + + // enc is the raw bytes for the extension field. + enc []byte } // SetRawExtension is for testing only. @@ -334,7 +350,7 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // descriptors with the same field number. return nil, errors.New("proto: descriptor conflict") } - return e.value, nil + return extensionAsLegacyType(e.value), nil } if extension.ExtensionType == nil { @@ -349,11 +365,11 @@ func GetExtension(pb Message, extension *ExtensionDesc) (interface{}, error) { // Remember the decoded version and drop the encoded version. // That way it is safe to mutate what we return. - e.value = v + e.value = extensionAsStorageType(v) e.desc = extension e.enc = nil emap[extension.Field] = e - return e.value, nil + return extensionAsLegacyType(e.value), nil } // defaultExtensionValue returns the default value for extension. @@ -488,7 +504,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error } typ := reflect.TypeOf(extension.ExtensionType) if typ != reflect.TypeOf(value) { - return errors.New("proto: bad extension value type") + return fmt.Errorf("proto: bad extension value type. got: %T, want: %T", value, extension.ExtensionType) } // nil extension values need to be caught early, because the // encoder can't distinguish an ErrNil due to a nil extension @@ -500,7 +516,7 @@ func SetExtension(pb Message, extension *ExtensionDesc, value interface{}) error } extmap := epb.extensionsWrite() - extmap[extension.Field] = Extension{desc: extension, value: value} + extmap[extension.Field] = Extension{desc: extension, value: extensionAsStorageType(value)} return nil } @@ -541,3 +557,51 @@ func RegisterExtension(desc *ExtensionDesc) { func RegisteredExtensions(pb Message) map[int32]*ExtensionDesc { return extensionMaps[reflect.TypeOf(pb).Elem()] } + +// extensionAsLegacyType converts an value in the storage type as the API type. +// See Extension.value. +func extensionAsLegacyType(v interface{}) interface{} { + switch rv := reflect.ValueOf(v); rv.Kind() { + case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: + // Represent primitive types as a pointer to the value. + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() + case reflect.Ptr: + // Represent slice types as the value itself. + switch rv.Type().Elem().Kind() { + case reflect.Slice: + if rv.IsNil() { + v = reflect.Zero(rv.Type().Elem()).Interface() + } else { + v = rv.Elem().Interface() + } + } + } + return v +} + +// extensionAsStorageType converts an value in the API type as the storage type. +// See Extension.value. +func extensionAsStorageType(v interface{}) interface{} { + switch rv := reflect.ValueOf(v); rv.Kind() { + case reflect.Ptr: + // Represent slice types as the value itself. + switch rv.Type().Elem().Kind() { + case reflect.Bool, reflect.Int32, reflect.Int64, reflect.Uint32, reflect.Uint64, reflect.Float32, reflect.Float64, reflect.String: + if rv.IsNil() { + v = reflect.Zero(rv.Type().Elem()).Interface() + } else { + v = rv.Elem().Interface() + } + } + case reflect.Slice: + // Represent slice types as a pointer to the value. + if rv.Type().Elem().Kind() != reflect.Uint8 { + rv2 := reflect.New(rv.Type()) + rv2.Elem().Set(rv) + v = rv2.Interface() + } + } + return v +} diff --git a/vendor/github.com/golang/protobuf/proto/lib.go b/vendor/github.com/golang/protobuf/proto/lib.go index 75565cc6..fdd328bb 100644 --- a/vendor/github.com/golang/protobuf/proto/lib.go +++ b/vendor/github.com/golang/protobuf/proto/lib.go @@ -341,26 +341,6 @@ type Message interface { ProtoMessage() } -// Stats records allocation details about the protocol buffer encoders -// and decoders. Useful for tuning the library itself. -type Stats struct { - Emalloc uint64 // mallocs in encode - Dmalloc uint64 // mallocs in decode - Encode uint64 // number of encodes - Decode uint64 // number of decodes - Chit uint64 // number of cache hits - Cmiss uint64 // number of cache misses - Size uint64 // number of sizes -} - -// Set to true to enable stats collection. -const collectStats = false - -var stats Stats - -// GetStats returns a copy of the global Stats structure. -func GetStats() Stats { return stats } - // A Buffer is a buffer manager for marshaling and unmarshaling // protocol buffers. It may be reused between invocations to // reduce memory usage. It is not necessary to use a Buffer; @@ -960,13 +940,19 @@ func isProto3Zero(v reflect.Value) bool { return false } -// ProtoPackageIsVersion2 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion2 = true +const ( + // ProtoPackageIsVersion3 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion3 = true -// ProtoPackageIsVersion1 is referenced from generated protocol buffer files -// to assert that that code is compatible with this version of the proto package. -const ProtoPackageIsVersion1 = true + // ProtoPackageIsVersion2 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion2 = true + + // ProtoPackageIsVersion1 is referenced from generated protocol buffer files + // to assert that that code is compatible with this version of the proto package. + ProtoPackageIsVersion1 = true +) // InternalMessageInfo is a type used internally by generated .pb.go files. // This type is not intended to be used by non-generated code. diff --git a/vendor/github.com/golang/protobuf/proto/message_set.go b/vendor/github.com/golang/protobuf/proto/message_set.go index 3b6ca41d..f48a7567 100644 --- a/vendor/github.com/golang/protobuf/proto/message_set.go +++ b/vendor/github.com/golang/protobuf/proto/message_set.go @@ -36,13 +36,7 @@ package proto */ import ( - "bytes" - "encoding/json" "errors" - "fmt" - "reflect" - "sort" - "sync" ) // errNoMessageTypeID occurs when a protocol buffer does not have a message type ID. @@ -145,46 +139,9 @@ func skipVarint(buf []byte) []byte { return buf[i+1:] } -// MarshalMessageSet encodes the extension map represented by m in the message set wire format. -// It is called by generated Marshal methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSet(exts interface{}) ([]byte, error) { - return marshalMessageSet(exts, false) -} - -// marshaMessageSet implements above function, with the opt to turn on / off deterministic during Marshal. -func marshalMessageSet(exts interface{}, deterministic bool) ([]byte, error) { - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var u marshalInfo - siz := u.sizeMessageSet(exts) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, exts, deterministic) - - case map[int32]Extension: - // This is an old-style extension map. - // Wrap it in a new-style XXX_InternalExtensions. - ie := XXX_InternalExtensions{ - p: &struct { - mu sync.Mutex - extensionMap map[int32]Extension - }{ - extensionMap: exts, - }, - } - - var u marshalInfo - siz := u.sizeMessageSet(&ie) - b := make([]byte, 0, siz) - return u.appendMessageSet(b, &ie, deterministic) - - default: - return nil, errors.New("proto: not an extension map") - } -} - -// UnmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. +// unmarshalMessageSet decodes the extension map encoded in buf in the message set wire format. // It is called by Unmarshal methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSet(buf []byte, exts interface{}) error { +func unmarshalMessageSet(buf []byte, exts interface{}) error { var m map[int32]Extension switch exts := exts.(type) { case *XXX_InternalExtensions: @@ -222,93 +179,3 @@ func UnmarshalMessageSet(buf []byte, exts interface{}) error { } return nil } - -// MarshalMessageSetJSON encodes the extension map represented by m in JSON format. -// It is called by generated MarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func MarshalMessageSetJSON(exts interface{}) ([]byte, error) { - var m map[int32]Extension - switch exts := exts.(type) { - case *XXX_InternalExtensions: - var mu sync.Locker - m, mu = exts.extensionsRead() - if m != nil { - // Keep the extensions map locked until we're done marshaling to prevent - // races between marshaling and unmarshaling the lazily-{en,de}coded - // values. - mu.Lock() - defer mu.Unlock() - } - case map[int32]Extension: - m = exts - default: - return nil, errors.New("proto: not an extension map") - } - var b bytes.Buffer - b.WriteByte('{') - - // Process the map in key order for deterministic output. - ids := make([]int32, 0, len(m)) - for id := range m { - ids = append(ids, id) - } - sort.Sort(int32Slice(ids)) // int32Slice defined in text.go - - for i, id := range ids { - ext := m[id] - msd, ok := messageSetMap[id] - if !ok { - // Unknown type; we can't render it, so skip it. - continue - } - - if i > 0 && b.Len() > 1 { - b.WriteByte(',') - } - - fmt.Fprintf(&b, `"[%s]":`, msd.name) - - x := ext.value - if x == nil { - x = reflect.New(msd.t.Elem()).Interface() - if err := Unmarshal(ext.enc, x.(Message)); err != nil { - return nil, err - } - } - d, err := json.Marshal(x) - if err != nil { - return nil, err - } - b.Write(d) - } - b.WriteByte('}') - return b.Bytes(), nil -} - -// UnmarshalMessageSetJSON decodes the extension map encoded in buf in JSON format. -// It is called by generated UnmarshalJSON methods on protocol buffer messages with the message_set_wire_format option. -func UnmarshalMessageSetJSON(buf []byte, exts interface{}) error { - // Common-case fast path. - if len(buf) == 0 || bytes.Equal(buf, []byte("{}")) { - return nil - } - - // This is fairly tricky, and it's not clear that it is needed. - return errors.New("TODO: UnmarshalMessageSetJSON not yet implemented") -} - -// A global registry of types that can be used in a MessageSet. - -var messageSetMap = make(map[int32]messageSetDesc) - -type messageSetDesc struct { - t reflect.Type // pointer to struct - name string -} - -// RegisterMessageSetType is called from the generated code. -func RegisterMessageSetType(m Message, fieldNum int32, name string) { - messageSetMap[fieldNum] = messageSetDesc{ - t: reflect.TypeOf(m), - name: name, - } -} diff --git a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go index b6cad908..94fa9194 100644 --- a/vendor/github.com/golang/protobuf/proto/pointer_reflect.go +++ b/vendor/github.com/golang/protobuf/proto/pointer_reflect.go @@ -79,10 +79,13 @@ func toPointer(i *Message) pointer { // toAddrPointer converts an interface to a pointer that points to // the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { +func toAddrPointer(i *interface{}, isptr, deref bool) pointer { v := reflect.ValueOf(*i) u := reflect.New(v.Type()) u.Elem().Set(v) + if deref { + u = u.Elem() + } return pointer{v: u} } diff --git a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go index d55a335d..dbfffe07 100644 --- a/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go +++ b/vendor/github.com/golang/protobuf/proto/pointer_unsafe.go @@ -85,16 +85,21 @@ func toPointer(i *Message) pointer { // toAddrPointer converts an interface to a pointer that points to // the interface data. -func toAddrPointer(i *interface{}, isptr bool) pointer { +func toAddrPointer(i *interface{}, isptr, deref bool) (p pointer) { // Super-tricky - read or get the address of data word of interface value. if isptr { // The interface is of pointer type, thus it is a direct interface. // The data word is the pointer data itself. We take its address. - return pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + p = pointer{p: unsafe.Pointer(uintptr(unsafe.Pointer(i)) + ptrSize)} + } else { + // The interface is not of pointer type. The data word is the pointer + // to the data. + p = pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} } - // The interface is not of pointer type. The data word is the pointer - // to the data. - return pointer{p: (*[2]unsafe.Pointer)(unsafe.Pointer(i))[1]} + if deref { + p.p = *(*unsafe.Pointer)(p.p) + } + return p } // valToPointer converts v to a pointer. v must be of pointer type. diff --git a/vendor/github.com/golang/protobuf/proto/properties.go b/vendor/github.com/golang/protobuf/proto/properties.go index 50b99b83..79668ff5 100644 --- a/vendor/github.com/golang/protobuf/proto/properties.go +++ b/vendor/github.com/golang/protobuf/proto/properties.go @@ -334,9 +334,6 @@ func GetProperties(t reflect.Type) *StructProperties { sprop, ok := propertiesMap[t] propertiesMu.RUnlock() if ok { - if collectStats { - stats.Chit++ - } return sprop } @@ -346,17 +343,20 @@ func GetProperties(t reflect.Type) *StructProperties { return sprop } +type ( + oneofFuncsIface interface { + XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + } + oneofWrappersIface interface { + XXX_OneofWrappers() []interface{} + } +) + // getPropertiesLocked requires that propertiesMu is held. func getPropertiesLocked(t reflect.Type) *StructProperties { if prop, ok := propertiesMap[t]; ok { - if collectStats { - stats.Chit++ - } return prop } - if collectStats { - stats.Cmiss++ - } prop := new(StructProperties) // in case of recursive protos, fill this in now. @@ -391,13 +391,14 @@ func getPropertiesLocked(t reflect.Type) *StructProperties { // Re-order prop.order. sort.Sort(prop) - type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) + var oots []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oots = m.XXX_OneofFuncs() + case oneofWrappersIface: + oots = m.XXX_OneofWrappers() } - if om, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { - var oots []interface{} - _, _, _, oots = om.XXX_OneofFuncs() - + if len(oots) > 0 { // Interpret oneof metadata. prop.OneofTypes = make(map[string]*OneofProperties) for _, oot := range oots { diff --git a/vendor/github.com/golang/protobuf/proto/table_marshal.go b/vendor/github.com/golang/protobuf/proto/table_marshal.go index b1679449..5cb11fa9 100644 --- a/vendor/github.com/golang/protobuf/proto/table_marshal.go +++ b/vendor/github.com/golang/protobuf/proto/table_marshal.go @@ -87,6 +87,7 @@ type marshalElemInfo struct { sizer sizer marshaler marshaler isptr bool // elem is pointer typed, thus interface of this type is a direct interface (extension only) + deref bool // dereference the pointer before operating on it; implies isptr } var ( @@ -320,8 +321,11 @@ func (u *marshalInfo) computeMarshalInfo() { // get oneof implementers var oneofImplementers []interface{} - if m, ok := reflect.Zero(reflect.PtrTo(t)).Interface().(oneofMessage); ok { + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() } n := t.NumField() @@ -407,13 +411,22 @@ func (u *marshalInfo) getExtElemInfo(desc *ExtensionDesc) *marshalElemInfo { panic("tag is not an integer") } wt := wiretype(tags[0]) + if t.Kind() == reflect.Ptr && t.Elem().Kind() != reflect.Struct { + t = t.Elem() + } sizer, marshaler := typeMarshaler(t, tags, false, false) + var deref bool + if t.Kind() == reflect.Slice && t.Elem().Kind() != reflect.Uint8 { + t = reflect.PtrTo(t) + deref = true + } e = &marshalElemInfo{ wiretag: uint64(tag)<<3 | wt, tagsize: SizeVarint(uint64(tag) << 3), sizer: sizer, marshaler: marshaler, isptr: t.Kind() == reflect.Ptr, + deref: deref, } // update cache @@ -448,7 +461,7 @@ func (fi *marshalFieldInfo) computeMarshalFieldInfo(f *reflect.StructField) { func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofImplementers []interface{}) { fi.field = toField(f) - fi.wiretag = 1<<31 - 1 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. + fi.wiretag = math.MaxInt32 // Use a large tag number, make oneofs sorted at the end. This tag will not appear on the wire. fi.isPointer = true fi.sizer, fi.marshaler = makeOneOfMarshaler(fi, f) fi.oneofElems = make(map[reflect.Type]*marshalElemInfo) @@ -476,10 +489,6 @@ func (fi *marshalFieldInfo) computeOneofFieldInfo(f *reflect.StructField, oneofI } } -type oneofMessage interface { - XXX_OneofFuncs() (func(Message, *Buffer) error, func(Message, int, int, *Buffer) (bool, error), func(Message) int, []interface{}) -} - // wiretype returns the wire encoding of the type. func wiretype(encoding string) uint64 { switch encoding { @@ -2310,8 +2319,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { for _, k := range m.MapKeys() { ki := k.Interface() vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + kaddr := toAddrPointer(&ki, false, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value siz := keySizer(kaddr, 1) + valSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) n += siz + SizeVarint(uint64(siz)) + tagsize } @@ -2329,8 +2338,8 @@ func makeMapMarshaler(f *reflect.StructField) (sizer, marshaler) { for _, k := range keys { ki := k.Interface() vi := m.MapIndex(k).Interface() - kaddr := toAddrPointer(&ki, false) // pointer to key - vaddr := toAddrPointer(&vi, valIsPtr) // pointer to value + kaddr := toAddrPointer(&ki, false, false) // pointer to key + vaddr := toAddrPointer(&vi, valIsPtr, false) // pointer to value b = appendVarint(b, tag) siz := keySizer(kaddr, 1) + valCachedSizer(vaddr, 1) // tag of key = 1 (size=1), tag of val = 2 (size=1) b = appendVarint(b, uint64(siz)) @@ -2399,7 +2408,7 @@ func (u *marshalInfo) sizeExtensions(ext *XXX_InternalExtensions) int { // the last time this function was called. ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } mu.Unlock() @@ -2434,7 +2443,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2465,7 +2474,7 @@ func (u *marshalInfo) appendExtensions(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err @@ -2510,7 +2519,7 @@ func (u *marshalInfo) sizeMessageSet(ext *XXX_InternalExtensions) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, 1) // message, tag = 3 (size=1) } mu.Unlock() @@ -2553,7 +2562,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) if !nerr.Merge(err) { return b, err @@ -2591,7 +2600,7 @@ func (u *marshalInfo) appendMessageSet(b []byte, ext *XXX_InternalExtensions, de ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, 3<<3|WireBytes, deterministic) b = append(b, 1<<3|WireEndGroup) if !nerr.Merge(err) { @@ -2621,7 +2630,7 @@ func (u *marshalInfo) sizeV1Extensions(m map[int32]Extension) int { ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) n += ei.sizer(p, ei.tagsize) } return n @@ -2656,7 +2665,7 @@ func (u *marshalInfo) appendV1Extensions(b []byte, m map[int32]Extension, determ ei := u.getExtElemInfo(e.desc) v := e.value - p := toAddrPointer(&v, ei.isptr) + p := toAddrPointer(&v, ei.isptr, ei.deref) b, err = ei.marshaler(b, p, ei.wiretag, deterministic) if !nerr.Merge(err) { return b, err diff --git a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go index ebf1caa5..acee2fc5 100644 --- a/vendor/github.com/golang/protobuf/proto/table_unmarshal.go +++ b/vendor/github.com/golang/protobuf/proto/table_unmarshal.go @@ -136,7 +136,7 @@ func (u *unmarshalInfo) unmarshal(m pointer, b []byte) error { u.computeUnmarshalInfo() } if u.isMessageSet { - return UnmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) + return unmarshalMessageSet(b, m.offset(u.extensions).toExtensions()) } var reqMask uint64 // bitmask of required fields we've seen. var errLater error @@ -362,46 +362,48 @@ func (u *unmarshalInfo) computeUnmarshalInfo() { } // Find any types associated with oneof fields. - // TODO: XXX_OneofFuncs returns more info than we need. Get rid of some of it? - fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("XXX_OneofFuncs") - if fn.IsValid() { - res := fn.Call(nil)[3] // last return value from XXX_OneofFuncs: []interface{} - for i := res.Len() - 1; i >= 0; i-- { - v := res.Index(i) // interface{} - tptr := reflect.ValueOf(v.Interface()).Type() // *Msg_X - typ := tptr.Elem() // Msg_X + var oneofImplementers []interface{} + switch m := reflect.Zero(reflect.PtrTo(t)).Interface().(type) { + case oneofFuncsIface: + _, _, _, oneofImplementers = m.XXX_OneofFuncs() + case oneofWrappersIface: + oneofImplementers = m.XXX_OneofWrappers() + } + for _, v := range oneofImplementers { + tptr := reflect.TypeOf(v) // *Msg_X + typ := tptr.Elem() // Msg_X - f := typ.Field(0) // oneof implementers have one field - baseUnmarshal := fieldUnmarshaler(&f) - tags := strings.Split(f.Tag.Get("protobuf"), ",") - fieldNum, err := strconv.Atoi(tags[1]) - if err != nil { - panic("protobuf tag field not an integer: " + tags[1]) - } - var name string - for _, tag := range tags { - if strings.HasPrefix(tag, "name=") { - name = strings.TrimPrefix(tag, "name=") - break - } - } - - // Find the oneof field that this struct implements. - // Might take O(n^2) to process all of the oneofs, but who cares. - for _, of := range oneofFields { - if tptr.Implements(of.ityp) { - // We have found the corresponding interface for this struct. - // That lets us know where this struct should be stored - // when we encounter it during unmarshaling. - unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) - u.setTag(fieldNum, of.field, unmarshal, 0, name) - } + f := typ.Field(0) // oneof implementers have one field + baseUnmarshal := fieldUnmarshaler(&f) + tags := strings.Split(f.Tag.Get("protobuf"), ",") + fieldNum, err := strconv.Atoi(tags[1]) + if err != nil { + panic("protobuf tag field not an integer: " + tags[1]) + } + var name string + for _, tag := range tags { + if strings.HasPrefix(tag, "name=") { + name = strings.TrimPrefix(tag, "name=") + break } } + + // Find the oneof field that this struct implements. + // Might take O(n^2) to process all of the oneofs, but who cares. + for _, of := range oneofFields { + if tptr.Implements(of.ityp) { + // We have found the corresponding interface for this struct. + // That lets us know where this struct should be stored + // when we encounter it during unmarshaling. + unmarshal := makeUnmarshalOneof(typ, of.ityp, baseUnmarshal) + u.setTag(fieldNum, of.field, unmarshal, 0, name) + } + } + } // Get extension ranges, if any. - fn = reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") + fn := reflect.Zero(reflect.PtrTo(t)).MethodByName("ExtensionRangeArray") if fn.IsValid() { if !u.extensions.IsValid() && !u.oldExtensions.IsValid() { panic("a message with extensions, but no extensions field in " + t.Name()) @@ -1948,7 +1950,7 @@ func encodeVarint(b []byte, x uint64) []byte { // If there is an error, it returns 0,0. func decodeVarint(b []byte) (uint64, int) { var x, y uint64 - if len(b) <= 0 { + if len(b) == 0 { goto bad } x = uint64(b[0]) diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go new file mode 100644 index 00000000..1ded05bb --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/descriptor/descriptor.pb.go @@ -0,0 +1,2887 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/descriptor.proto + +package descriptor + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +type FieldDescriptorProto_Type int32 + +const ( + // 0 is reserved for errors. + // Order is weird for historical reasons. + FieldDescriptorProto_TYPE_DOUBLE FieldDescriptorProto_Type = 1 + FieldDescriptorProto_TYPE_FLOAT FieldDescriptorProto_Type = 2 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT64 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT64 FieldDescriptorProto_Type = 3 + FieldDescriptorProto_TYPE_UINT64 FieldDescriptorProto_Type = 4 + // Not ZigZag encoded. Negative numbers take 10 bytes. Use TYPE_SINT32 if + // negative values are likely. + FieldDescriptorProto_TYPE_INT32 FieldDescriptorProto_Type = 5 + FieldDescriptorProto_TYPE_FIXED64 FieldDescriptorProto_Type = 6 + FieldDescriptorProto_TYPE_FIXED32 FieldDescriptorProto_Type = 7 + FieldDescriptorProto_TYPE_BOOL FieldDescriptorProto_Type = 8 + FieldDescriptorProto_TYPE_STRING FieldDescriptorProto_Type = 9 + // Tag-delimited aggregate. + // Group type is deprecated and not supported in proto3. However, Proto3 + // implementations should still be able to parse the group wire format and + // treat group fields as unknown fields. + FieldDescriptorProto_TYPE_GROUP FieldDescriptorProto_Type = 10 + FieldDescriptorProto_TYPE_MESSAGE FieldDescriptorProto_Type = 11 + // New in version 2. + FieldDescriptorProto_TYPE_BYTES FieldDescriptorProto_Type = 12 + FieldDescriptorProto_TYPE_UINT32 FieldDescriptorProto_Type = 13 + FieldDescriptorProto_TYPE_ENUM FieldDescriptorProto_Type = 14 + FieldDescriptorProto_TYPE_SFIXED32 FieldDescriptorProto_Type = 15 + FieldDescriptorProto_TYPE_SFIXED64 FieldDescriptorProto_Type = 16 + FieldDescriptorProto_TYPE_SINT32 FieldDescriptorProto_Type = 17 + FieldDescriptorProto_TYPE_SINT64 FieldDescriptorProto_Type = 18 +) + +var FieldDescriptorProto_Type_name = map[int32]string{ + 1: "TYPE_DOUBLE", + 2: "TYPE_FLOAT", + 3: "TYPE_INT64", + 4: "TYPE_UINT64", + 5: "TYPE_INT32", + 6: "TYPE_FIXED64", + 7: "TYPE_FIXED32", + 8: "TYPE_BOOL", + 9: "TYPE_STRING", + 10: "TYPE_GROUP", + 11: "TYPE_MESSAGE", + 12: "TYPE_BYTES", + 13: "TYPE_UINT32", + 14: "TYPE_ENUM", + 15: "TYPE_SFIXED32", + 16: "TYPE_SFIXED64", + 17: "TYPE_SINT32", + 18: "TYPE_SINT64", +} + +var FieldDescriptorProto_Type_value = map[string]int32{ + "TYPE_DOUBLE": 1, + "TYPE_FLOAT": 2, + "TYPE_INT64": 3, + "TYPE_UINT64": 4, + "TYPE_INT32": 5, + "TYPE_FIXED64": 6, + "TYPE_FIXED32": 7, + "TYPE_BOOL": 8, + "TYPE_STRING": 9, + "TYPE_GROUP": 10, + "TYPE_MESSAGE": 11, + "TYPE_BYTES": 12, + "TYPE_UINT32": 13, + "TYPE_ENUM": 14, + "TYPE_SFIXED32": 15, + "TYPE_SFIXED64": 16, + "TYPE_SINT32": 17, + "TYPE_SINT64": 18, +} + +func (x FieldDescriptorProto_Type) Enum() *FieldDescriptorProto_Type { + p := new(FieldDescriptorProto_Type) + *p = x + return p +} + +func (x FieldDescriptorProto_Type) String() string { + return proto.EnumName(FieldDescriptorProto_Type_name, int32(x)) +} + +func (x *FieldDescriptorProto_Type) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Type_value, data, "FieldDescriptorProto_Type") + if err != nil { + return err + } + *x = FieldDescriptorProto_Type(value) + return nil +} + +func (FieldDescriptorProto_Type) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4, 0} +} + +type FieldDescriptorProto_Label int32 + +const ( + // 0 is reserved for errors + FieldDescriptorProto_LABEL_OPTIONAL FieldDescriptorProto_Label = 1 + FieldDescriptorProto_LABEL_REQUIRED FieldDescriptorProto_Label = 2 + FieldDescriptorProto_LABEL_REPEATED FieldDescriptorProto_Label = 3 +) + +var FieldDescriptorProto_Label_name = map[int32]string{ + 1: "LABEL_OPTIONAL", + 2: "LABEL_REQUIRED", + 3: "LABEL_REPEATED", +} + +var FieldDescriptorProto_Label_value = map[string]int32{ + "LABEL_OPTIONAL": 1, + "LABEL_REQUIRED": 2, + "LABEL_REPEATED": 3, +} + +func (x FieldDescriptorProto_Label) Enum() *FieldDescriptorProto_Label { + p := new(FieldDescriptorProto_Label) + *p = x + return p +} + +func (x FieldDescriptorProto_Label) String() string { + return proto.EnumName(FieldDescriptorProto_Label_name, int32(x)) +} + +func (x *FieldDescriptorProto_Label) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldDescriptorProto_Label_value, data, "FieldDescriptorProto_Label") + if err != nil { + return err + } + *x = FieldDescriptorProto_Label(value) + return nil +} + +func (FieldDescriptorProto_Label) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4, 1} +} + +// Generated classes can be optimized for speed or code size. +type FileOptions_OptimizeMode int32 + +const ( + FileOptions_SPEED FileOptions_OptimizeMode = 1 + // etc. + FileOptions_CODE_SIZE FileOptions_OptimizeMode = 2 + FileOptions_LITE_RUNTIME FileOptions_OptimizeMode = 3 +) + +var FileOptions_OptimizeMode_name = map[int32]string{ + 1: "SPEED", + 2: "CODE_SIZE", + 3: "LITE_RUNTIME", +} + +var FileOptions_OptimizeMode_value = map[string]int32{ + "SPEED": 1, + "CODE_SIZE": 2, + "LITE_RUNTIME": 3, +} + +func (x FileOptions_OptimizeMode) Enum() *FileOptions_OptimizeMode { + p := new(FileOptions_OptimizeMode) + *p = x + return p +} + +func (x FileOptions_OptimizeMode) String() string { + return proto.EnumName(FileOptions_OptimizeMode_name, int32(x)) +} + +func (x *FileOptions_OptimizeMode) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FileOptions_OptimizeMode_value, data, "FileOptions_OptimizeMode") + if err != nil { + return err + } + *x = FileOptions_OptimizeMode(value) + return nil +} + +func (FileOptions_OptimizeMode) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{10, 0} +} + +type FieldOptions_CType int32 + +const ( + // Default mode. + FieldOptions_STRING FieldOptions_CType = 0 + FieldOptions_CORD FieldOptions_CType = 1 + FieldOptions_STRING_PIECE FieldOptions_CType = 2 +) + +var FieldOptions_CType_name = map[int32]string{ + 0: "STRING", + 1: "CORD", + 2: "STRING_PIECE", +} + +var FieldOptions_CType_value = map[string]int32{ + "STRING": 0, + "CORD": 1, + "STRING_PIECE": 2, +} + +func (x FieldOptions_CType) Enum() *FieldOptions_CType { + p := new(FieldOptions_CType) + *p = x + return p +} + +func (x FieldOptions_CType) String() string { + return proto.EnumName(FieldOptions_CType_name, int32(x)) +} + +func (x *FieldOptions_CType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_CType_value, data, "FieldOptions_CType") + if err != nil { + return err + } + *x = FieldOptions_CType(value) + return nil +} + +func (FieldOptions_CType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12, 0} +} + +type FieldOptions_JSType int32 + +const ( + // Use the default type. + FieldOptions_JS_NORMAL FieldOptions_JSType = 0 + // Use JavaScript strings. + FieldOptions_JS_STRING FieldOptions_JSType = 1 + // Use JavaScript numbers. + FieldOptions_JS_NUMBER FieldOptions_JSType = 2 +) + +var FieldOptions_JSType_name = map[int32]string{ + 0: "JS_NORMAL", + 1: "JS_STRING", + 2: "JS_NUMBER", +} + +var FieldOptions_JSType_value = map[string]int32{ + "JS_NORMAL": 0, + "JS_STRING": 1, + "JS_NUMBER": 2, +} + +func (x FieldOptions_JSType) Enum() *FieldOptions_JSType { + p := new(FieldOptions_JSType) + *p = x + return p +} + +func (x FieldOptions_JSType) String() string { + return proto.EnumName(FieldOptions_JSType_name, int32(x)) +} + +func (x *FieldOptions_JSType) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(FieldOptions_JSType_value, data, "FieldOptions_JSType") + if err != nil { + return err + } + *x = FieldOptions_JSType(value) + return nil +} + +func (FieldOptions_JSType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12, 1} +} + +// Is this method side-effect-free (or safe in HTTP parlance), or idempotent, +// or neither? HTTP based RPC implementation may choose GET verb for safe +// methods, and PUT verb for idempotent methods instead of the default POST. +type MethodOptions_IdempotencyLevel int32 + +const ( + MethodOptions_IDEMPOTENCY_UNKNOWN MethodOptions_IdempotencyLevel = 0 + MethodOptions_NO_SIDE_EFFECTS MethodOptions_IdempotencyLevel = 1 + MethodOptions_IDEMPOTENT MethodOptions_IdempotencyLevel = 2 +) + +var MethodOptions_IdempotencyLevel_name = map[int32]string{ + 0: "IDEMPOTENCY_UNKNOWN", + 1: "NO_SIDE_EFFECTS", + 2: "IDEMPOTENT", +} + +var MethodOptions_IdempotencyLevel_value = map[string]int32{ + "IDEMPOTENCY_UNKNOWN": 0, + "NO_SIDE_EFFECTS": 1, + "IDEMPOTENT": 2, +} + +func (x MethodOptions_IdempotencyLevel) Enum() *MethodOptions_IdempotencyLevel { + p := new(MethodOptions_IdempotencyLevel) + *p = x + return p +} + +func (x MethodOptions_IdempotencyLevel) String() string { + return proto.EnumName(MethodOptions_IdempotencyLevel_name, int32(x)) +} + +func (x *MethodOptions_IdempotencyLevel) UnmarshalJSON(data []byte) error { + value, err := proto.UnmarshalJSONEnum(MethodOptions_IdempotencyLevel_value, data, "MethodOptions_IdempotencyLevel") + if err != nil { + return err + } + *x = MethodOptions_IdempotencyLevel(value) + return nil +} + +func (MethodOptions_IdempotencyLevel) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{17, 0} +} + +// The protocol compiler can output a FileDescriptorSet containing the .proto +// files it parses. +type FileDescriptorSet struct { + File []*FileDescriptorProto `protobuf:"bytes,1,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorSet) Reset() { *m = FileDescriptorSet{} } +func (m *FileDescriptorSet) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorSet) ProtoMessage() {} +func (*FileDescriptorSet) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{0} +} + +func (m *FileDescriptorSet) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorSet.Unmarshal(m, b) +} +func (m *FileDescriptorSet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorSet.Marshal(b, m, deterministic) +} +func (m *FileDescriptorSet) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorSet.Merge(m, src) +} +func (m *FileDescriptorSet) XXX_Size() int { + return xxx_messageInfo_FileDescriptorSet.Size(m) +} +func (m *FileDescriptorSet) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorSet.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorSet proto.InternalMessageInfo + +func (m *FileDescriptorSet) GetFile() []*FileDescriptorProto { + if m != nil { + return m.File + } + return nil +} + +// Describes a complete .proto file. +type FileDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Package *string `protobuf:"bytes,2,opt,name=package" json:"package,omitempty"` + // Names of files imported by this file. + Dependency []string `protobuf:"bytes,3,rep,name=dependency" json:"dependency,omitempty"` + // Indexes of the public imported files in the dependency list above. + PublicDependency []int32 `protobuf:"varint,10,rep,name=public_dependency,json=publicDependency" json:"public_dependency,omitempty"` + // Indexes of the weak imported files in the dependency list. + // For Google-internal migration only. Do not use. + WeakDependency []int32 `protobuf:"varint,11,rep,name=weak_dependency,json=weakDependency" json:"weak_dependency,omitempty"` + // All top-level definitions in this file. + MessageType []*DescriptorProto `protobuf:"bytes,4,rep,name=message_type,json=messageType" json:"message_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,5,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + Service []*ServiceDescriptorProto `protobuf:"bytes,6,rep,name=service" json:"service,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,7,rep,name=extension" json:"extension,omitempty"` + Options *FileOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + // This field contains optional information about the original source code. + // You may safely remove this entire field without harming runtime + // functionality of the descriptors -- the information is needed only by + // development tools. + SourceCodeInfo *SourceCodeInfo `protobuf:"bytes,9,opt,name=source_code_info,json=sourceCodeInfo" json:"source_code_info,omitempty"` + // The syntax of the proto file. + // The supported values are "proto2" and "proto3". + Syntax *string `protobuf:"bytes,12,opt,name=syntax" json:"syntax,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileDescriptorProto) Reset() { *m = FileDescriptorProto{} } +func (m *FileDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FileDescriptorProto) ProtoMessage() {} +func (*FileDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{1} +} + +func (m *FileDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileDescriptorProto.Unmarshal(m, b) +} +func (m *FileDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileDescriptorProto.Marshal(b, m, deterministic) +} +func (m *FileDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileDescriptorProto.Merge(m, src) +} +func (m *FileDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FileDescriptorProto.Size(m) +} +func (m *FileDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FileDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FileDescriptorProto proto.InternalMessageInfo + +func (m *FileDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FileDescriptorProto) GetPackage() string { + if m != nil && m.Package != nil { + return *m.Package + } + return "" +} + +func (m *FileDescriptorProto) GetDependency() []string { + if m != nil { + return m.Dependency + } + return nil +} + +func (m *FileDescriptorProto) GetPublicDependency() []int32 { + if m != nil { + return m.PublicDependency + } + return nil +} + +func (m *FileDescriptorProto) GetWeakDependency() []int32 { + if m != nil { + return m.WeakDependency + } + return nil +} + +func (m *FileDescriptorProto) GetMessageType() []*DescriptorProto { + if m != nil { + return m.MessageType + } + return nil +} + +func (m *FileDescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *FileDescriptorProto) GetService() []*ServiceDescriptorProto { + if m != nil { + return m.Service + } + return nil +} + +func (m *FileDescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *FileDescriptorProto) GetOptions() *FileOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *FileDescriptorProto) GetSourceCodeInfo() *SourceCodeInfo { + if m != nil { + return m.SourceCodeInfo + } + return nil +} + +func (m *FileDescriptorProto) GetSyntax() string { + if m != nil && m.Syntax != nil { + return *m.Syntax + } + return "" +} + +// Describes a message type. +type DescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Field []*FieldDescriptorProto `protobuf:"bytes,2,rep,name=field" json:"field,omitempty"` + Extension []*FieldDescriptorProto `protobuf:"bytes,6,rep,name=extension" json:"extension,omitempty"` + NestedType []*DescriptorProto `protobuf:"bytes,3,rep,name=nested_type,json=nestedType" json:"nested_type,omitempty"` + EnumType []*EnumDescriptorProto `protobuf:"bytes,4,rep,name=enum_type,json=enumType" json:"enum_type,omitempty"` + ExtensionRange []*DescriptorProto_ExtensionRange `protobuf:"bytes,5,rep,name=extension_range,json=extensionRange" json:"extension_range,omitempty"` + OneofDecl []*OneofDescriptorProto `protobuf:"bytes,8,rep,name=oneof_decl,json=oneofDecl" json:"oneof_decl,omitempty"` + Options *MessageOptions `protobuf:"bytes,7,opt,name=options" json:"options,omitempty"` + ReservedRange []*DescriptorProto_ReservedRange `protobuf:"bytes,9,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved field names, which may not be used by fields in the same message. + // A given name may only be reserved once. + ReservedName []string `protobuf:"bytes,10,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto) Reset() { *m = DescriptorProto{} } +func (m *DescriptorProto) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto) ProtoMessage() {} +func (*DescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2} +} + +func (m *DescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto.Unmarshal(m, b) +} +func (m *DescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto.Marshal(b, m, deterministic) +} +func (m *DescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto.Merge(m, src) +} +func (m *DescriptorProto) XXX_Size() int { + return xxx_messageInfo_DescriptorProto.Size(m) +} +func (m *DescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto proto.InternalMessageInfo + +func (m *DescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *DescriptorProto) GetField() []*FieldDescriptorProto { + if m != nil { + return m.Field + } + return nil +} + +func (m *DescriptorProto) GetExtension() []*FieldDescriptorProto { + if m != nil { + return m.Extension + } + return nil +} + +func (m *DescriptorProto) GetNestedType() []*DescriptorProto { + if m != nil { + return m.NestedType + } + return nil +} + +func (m *DescriptorProto) GetEnumType() []*EnumDescriptorProto { + if m != nil { + return m.EnumType + } + return nil +} + +func (m *DescriptorProto) GetExtensionRange() []*DescriptorProto_ExtensionRange { + if m != nil { + return m.ExtensionRange + } + return nil +} + +func (m *DescriptorProto) GetOneofDecl() []*OneofDescriptorProto { + if m != nil { + return m.OneofDecl + } + return nil +} + +func (m *DescriptorProto) GetOptions() *MessageOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *DescriptorProto) GetReservedRange() []*DescriptorProto_ReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *DescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +type DescriptorProto_ExtensionRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + Options *ExtensionRangeOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ExtensionRange) Reset() { *m = DescriptorProto_ExtensionRange{} } +func (m *DescriptorProto_ExtensionRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ExtensionRange) ProtoMessage() {} +func (*DescriptorProto_ExtensionRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2, 0} +} + +func (m *DescriptorProto_ExtensionRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ExtensionRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Marshal(b, m, deterministic) +} +func (m *DescriptorProto_ExtensionRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ExtensionRange.Merge(m, src) +} +func (m *DescriptorProto_ExtensionRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ExtensionRange.Size(m) +} +func (m *DescriptorProto_ExtensionRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ExtensionRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ExtensionRange proto.InternalMessageInfo + +func (m *DescriptorProto_ExtensionRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func (m *DescriptorProto_ExtensionRange) GetOptions() *ExtensionRangeOptions { + if m != nil { + return m.Options + } + return nil +} + +// Range of reserved tag numbers. Reserved tag numbers may not be used by +// fields or extension ranges in the same message. Reserved ranges may +// not overlap. +type DescriptorProto_ReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DescriptorProto_ReservedRange) Reset() { *m = DescriptorProto_ReservedRange{} } +func (m *DescriptorProto_ReservedRange) String() string { return proto.CompactTextString(m) } +func (*DescriptorProto_ReservedRange) ProtoMessage() {} +func (*DescriptorProto_ReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{2, 1} +} + +func (m *DescriptorProto_ReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DescriptorProto_ReservedRange.Unmarshal(m, b) +} +func (m *DescriptorProto_ReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DescriptorProto_ReservedRange.Marshal(b, m, deterministic) +} +func (m *DescriptorProto_ReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_DescriptorProto_ReservedRange.Merge(m, src) +} +func (m *DescriptorProto_ReservedRange) XXX_Size() int { + return xxx_messageInfo_DescriptorProto_ReservedRange.Size(m) +} +func (m *DescriptorProto_ReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_DescriptorProto_ReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_DescriptorProto_ReservedRange proto.InternalMessageInfo + +func (m *DescriptorProto_ReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *DescriptorProto_ReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +type ExtensionRangeOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ExtensionRangeOptions) Reset() { *m = ExtensionRangeOptions{} } +func (m *ExtensionRangeOptions) String() string { return proto.CompactTextString(m) } +func (*ExtensionRangeOptions) ProtoMessage() {} +func (*ExtensionRangeOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{3} +} + +var extRange_ExtensionRangeOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ExtensionRangeOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ExtensionRangeOptions +} + +func (m *ExtensionRangeOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ExtensionRangeOptions.Unmarshal(m, b) +} +func (m *ExtensionRangeOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ExtensionRangeOptions.Marshal(b, m, deterministic) +} +func (m *ExtensionRangeOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExtensionRangeOptions.Merge(m, src) +} +func (m *ExtensionRangeOptions) XXX_Size() int { + return xxx_messageInfo_ExtensionRangeOptions.Size(m) +} +func (m *ExtensionRangeOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ExtensionRangeOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ExtensionRangeOptions proto.InternalMessageInfo + +func (m *ExtensionRangeOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// Describes a field within a message. +type FieldDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,3,opt,name=number" json:"number,omitempty"` + Label *FieldDescriptorProto_Label `protobuf:"varint,4,opt,name=label,enum=google.protobuf.FieldDescriptorProto_Label" json:"label,omitempty"` + // If type_name is set, this need not be set. If both this and type_name + // are set, this must be one of TYPE_ENUM, TYPE_MESSAGE or TYPE_GROUP. + Type *FieldDescriptorProto_Type `protobuf:"varint,5,opt,name=type,enum=google.protobuf.FieldDescriptorProto_Type" json:"type,omitempty"` + // For message and enum types, this is the name of the type. If the name + // starts with a '.', it is fully-qualified. Otherwise, C++-like scoping + // rules are used to find the type (i.e. first the nested types within this + // message are searched, then within the parent, on up to the root + // namespace). + TypeName *string `protobuf:"bytes,6,opt,name=type_name,json=typeName" json:"type_name,omitempty"` + // For extensions, this is the name of the type being extended. It is + // resolved in the same manner as type_name. + Extendee *string `protobuf:"bytes,2,opt,name=extendee" json:"extendee,omitempty"` + // For numeric types, contains the original text representation of the value. + // For booleans, "true" or "false". + // For strings, contains the default text contents (not escaped in any way). + // For bytes, contains the C escaped value. All bytes >= 128 are escaped. + // TODO(kenton): Base-64 encode? + DefaultValue *string `protobuf:"bytes,7,opt,name=default_value,json=defaultValue" json:"default_value,omitempty"` + // If set, gives the index of a oneof in the containing type's oneof_decl + // list. This field is a member of that oneof. + OneofIndex *int32 `protobuf:"varint,9,opt,name=oneof_index,json=oneofIndex" json:"oneof_index,omitempty"` + // JSON name of this field. The value is set by protocol compiler. If the + // user has set a "json_name" option on this field, that option's value + // will be used. Otherwise, it's deduced from the field's name by converting + // it to camelCase. + JsonName *string `protobuf:"bytes,10,opt,name=json_name,json=jsonName" json:"json_name,omitempty"` + Options *FieldOptions `protobuf:"bytes,8,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldDescriptorProto) Reset() { *m = FieldDescriptorProto{} } +func (m *FieldDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*FieldDescriptorProto) ProtoMessage() {} +func (*FieldDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{4} +} + +func (m *FieldDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldDescriptorProto.Unmarshal(m, b) +} +func (m *FieldDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldDescriptorProto.Marshal(b, m, deterministic) +} +func (m *FieldDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldDescriptorProto.Merge(m, src) +} +func (m *FieldDescriptorProto) XXX_Size() int { + return xxx_messageInfo_FieldDescriptorProto.Size(m) +} +func (m *FieldDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_FieldDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldDescriptorProto proto.InternalMessageInfo + +func (m *FieldDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *FieldDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *FieldDescriptorProto) GetLabel() FieldDescriptorProto_Label { + if m != nil && m.Label != nil { + return *m.Label + } + return FieldDescriptorProto_LABEL_OPTIONAL +} + +func (m *FieldDescriptorProto) GetType() FieldDescriptorProto_Type { + if m != nil && m.Type != nil { + return *m.Type + } + return FieldDescriptorProto_TYPE_DOUBLE +} + +func (m *FieldDescriptorProto) GetTypeName() string { + if m != nil && m.TypeName != nil { + return *m.TypeName + } + return "" +} + +func (m *FieldDescriptorProto) GetExtendee() string { + if m != nil && m.Extendee != nil { + return *m.Extendee + } + return "" +} + +func (m *FieldDescriptorProto) GetDefaultValue() string { + if m != nil && m.DefaultValue != nil { + return *m.DefaultValue + } + return "" +} + +func (m *FieldDescriptorProto) GetOneofIndex() int32 { + if m != nil && m.OneofIndex != nil { + return *m.OneofIndex + } + return 0 +} + +func (m *FieldDescriptorProto) GetJsonName() string { + if m != nil && m.JsonName != nil { + return *m.JsonName + } + return "" +} + +func (m *FieldDescriptorProto) GetOptions() *FieldOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a oneof. +type OneofDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Options *OneofOptions `protobuf:"bytes,2,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofDescriptorProto) Reset() { *m = OneofDescriptorProto{} } +func (m *OneofDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*OneofDescriptorProto) ProtoMessage() {} +func (*OneofDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{5} +} + +func (m *OneofDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofDescriptorProto.Unmarshal(m, b) +} +func (m *OneofDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofDescriptorProto.Marshal(b, m, deterministic) +} +func (m *OneofDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofDescriptorProto.Merge(m, src) +} +func (m *OneofDescriptorProto) XXX_Size() int { + return xxx_messageInfo_OneofDescriptorProto.Size(m) +} +func (m *OneofDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_OneofDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofDescriptorProto proto.InternalMessageInfo + +func (m *OneofDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *OneofDescriptorProto) GetOptions() *OneofOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes an enum type. +type EnumDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Value []*EnumValueDescriptorProto `protobuf:"bytes,2,rep,name=value" json:"value,omitempty"` + Options *EnumOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + // Range of reserved numeric values. Reserved numeric values may not be used + // by enum values in the same enum declaration. Reserved ranges may not + // overlap. + ReservedRange []*EnumDescriptorProto_EnumReservedRange `protobuf:"bytes,4,rep,name=reserved_range,json=reservedRange" json:"reserved_range,omitempty"` + // Reserved enum value names, which may not be reused. A given name may only + // be reserved once. + ReservedName []string `protobuf:"bytes,5,rep,name=reserved_name,json=reservedName" json:"reserved_name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto) Reset() { *m = EnumDescriptorProto{} } +func (m *EnumDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto) ProtoMessage() {} +func (*EnumDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{6} +} + +func (m *EnumDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto.Unmarshal(m, b) +} +func (m *EnumDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto.Marshal(b, m, deterministic) +} +func (m *EnumDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto.Merge(m, src) +} +func (m *EnumDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto.Size(m) +} +func (m *EnumDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto proto.InternalMessageInfo + +func (m *EnumDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumDescriptorProto) GetValue() []*EnumValueDescriptorProto { + if m != nil { + return m.Value + } + return nil +} + +func (m *EnumDescriptorProto) GetOptions() *EnumOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedRange() []*EnumDescriptorProto_EnumReservedRange { + if m != nil { + return m.ReservedRange + } + return nil +} + +func (m *EnumDescriptorProto) GetReservedName() []string { + if m != nil { + return m.ReservedName + } + return nil +} + +// Range of reserved numeric values. Reserved values may not be used by +// entries in the same enum. Reserved ranges may not overlap. +// +// Note that this is distinct from DescriptorProto.ReservedRange in that it +// is inclusive such that it can appropriately represent the entire int32 +// domain. +type EnumDescriptorProto_EnumReservedRange struct { + Start *int32 `protobuf:"varint,1,opt,name=start" json:"start,omitempty"` + End *int32 `protobuf:"varint,2,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumDescriptorProto_EnumReservedRange) Reset() { *m = EnumDescriptorProto_EnumReservedRange{} } +func (m *EnumDescriptorProto_EnumReservedRange) String() string { return proto.CompactTextString(m) } +func (*EnumDescriptorProto_EnumReservedRange) ProtoMessage() {} +func (*EnumDescriptorProto_EnumReservedRange) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{6, 0} +} + +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Unmarshal(m, b) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Marshal(b, m, deterministic) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Merge(m, src) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_Size() int { + return xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.Size(m) +} +func (m *EnumDescriptorProto_EnumReservedRange) XXX_DiscardUnknown() { + xxx_messageInfo_EnumDescriptorProto_EnumReservedRange.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumDescriptorProto_EnumReservedRange proto.InternalMessageInfo + +func (m *EnumDescriptorProto_EnumReservedRange) GetStart() int32 { + if m != nil && m.Start != nil { + return *m.Start + } + return 0 +} + +func (m *EnumDescriptorProto_EnumReservedRange) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +// Describes a value within an enum. +type EnumValueDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Number *int32 `protobuf:"varint,2,opt,name=number" json:"number,omitempty"` + Options *EnumValueOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueDescriptorProto) Reset() { *m = EnumValueDescriptorProto{} } +func (m *EnumValueDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*EnumValueDescriptorProto) ProtoMessage() {} +func (*EnumValueDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{7} +} + +func (m *EnumValueDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueDescriptorProto.Unmarshal(m, b) +} +func (m *EnumValueDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueDescriptorProto.Marshal(b, m, deterministic) +} +func (m *EnumValueDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueDescriptorProto.Merge(m, src) +} +func (m *EnumValueDescriptorProto) XXX_Size() int { + return xxx_messageInfo_EnumValueDescriptorProto.Size(m) +} +func (m *EnumValueDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueDescriptorProto proto.InternalMessageInfo + +func (m *EnumValueDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *EnumValueDescriptorProto) GetNumber() int32 { + if m != nil && m.Number != nil { + return *m.Number + } + return 0 +} + +func (m *EnumValueDescriptorProto) GetOptions() *EnumValueOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a service. +type ServiceDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + Method []*MethodDescriptorProto `protobuf:"bytes,2,rep,name=method" json:"method,omitempty"` + Options *ServiceOptions `protobuf:"bytes,3,opt,name=options" json:"options,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceDescriptorProto) Reset() { *m = ServiceDescriptorProto{} } +func (m *ServiceDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*ServiceDescriptorProto) ProtoMessage() {} +func (*ServiceDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{8} +} + +func (m *ServiceDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceDescriptorProto.Unmarshal(m, b) +} +func (m *ServiceDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceDescriptorProto.Marshal(b, m, deterministic) +} +func (m *ServiceDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceDescriptorProto.Merge(m, src) +} +func (m *ServiceDescriptorProto) XXX_Size() int { + return xxx_messageInfo_ServiceDescriptorProto.Size(m) +} +func (m *ServiceDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceDescriptorProto proto.InternalMessageInfo + +func (m *ServiceDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *ServiceDescriptorProto) GetMethod() []*MethodDescriptorProto { + if m != nil { + return m.Method + } + return nil +} + +func (m *ServiceDescriptorProto) GetOptions() *ServiceOptions { + if m != nil { + return m.Options + } + return nil +} + +// Describes a method of a service. +type MethodDescriptorProto struct { + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // Input and output type names. These are resolved in the same way as + // FieldDescriptorProto.type_name, but must refer to a message type. + InputType *string `protobuf:"bytes,2,opt,name=input_type,json=inputType" json:"input_type,omitempty"` + OutputType *string `protobuf:"bytes,3,opt,name=output_type,json=outputType" json:"output_type,omitempty"` + Options *MethodOptions `protobuf:"bytes,4,opt,name=options" json:"options,omitempty"` + // Identifies if client streams multiple client messages + ClientStreaming *bool `protobuf:"varint,5,opt,name=client_streaming,json=clientStreaming,def=0" json:"client_streaming,omitempty"` + // Identifies if server streams multiple server messages + ServerStreaming *bool `protobuf:"varint,6,opt,name=server_streaming,json=serverStreaming,def=0" json:"server_streaming,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodDescriptorProto) Reset() { *m = MethodDescriptorProto{} } +func (m *MethodDescriptorProto) String() string { return proto.CompactTextString(m) } +func (*MethodDescriptorProto) ProtoMessage() {} +func (*MethodDescriptorProto) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{9} +} + +func (m *MethodDescriptorProto) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodDescriptorProto.Unmarshal(m, b) +} +func (m *MethodDescriptorProto) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodDescriptorProto.Marshal(b, m, deterministic) +} +func (m *MethodDescriptorProto) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodDescriptorProto.Merge(m, src) +} +func (m *MethodDescriptorProto) XXX_Size() int { + return xxx_messageInfo_MethodDescriptorProto.Size(m) +} +func (m *MethodDescriptorProto) XXX_DiscardUnknown() { + xxx_messageInfo_MethodDescriptorProto.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodDescriptorProto proto.InternalMessageInfo + +const Default_MethodDescriptorProto_ClientStreaming bool = false +const Default_MethodDescriptorProto_ServerStreaming bool = false + +func (m *MethodDescriptorProto) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *MethodDescriptorProto) GetInputType() string { + if m != nil && m.InputType != nil { + return *m.InputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOutputType() string { + if m != nil && m.OutputType != nil { + return *m.OutputType + } + return "" +} + +func (m *MethodDescriptorProto) GetOptions() *MethodOptions { + if m != nil { + return m.Options + } + return nil +} + +func (m *MethodDescriptorProto) GetClientStreaming() bool { + if m != nil && m.ClientStreaming != nil { + return *m.ClientStreaming + } + return Default_MethodDescriptorProto_ClientStreaming +} + +func (m *MethodDescriptorProto) GetServerStreaming() bool { + if m != nil && m.ServerStreaming != nil { + return *m.ServerStreaming + } + return Default_MethodDescriptorProto_ServerStreaming +} + +type FileOptions struct { + // Sets the Java package where classes generated from this .proto will be + // placed. By default, the proto package is used, but this is often + // inappropriate because proto packages do not normally start with backwards + // domain names. + JavaPackage *string `protobuf:"bytes,1,opt,name=java_package,json=javaPackage" json:"java_package,omitempty"` + // If set, all the classes from the .proto file are wrapped in a single + // outer class with the given name. This applies to both Proto1 + // (equivalent to the old "--one_java_file" option) and Proto2 (where + // a .proto always translates to a single class, but you may want to + // explicitly choose the class name). + JavaOuterClassname *string `protobuf:"bytes,8,opt,name=java_outer_classname,json=javaOuterClassname" json:"java_outer_classname,omitempty"` + // If set true, then the Java code generator will generate a separate .java + // file for each top-level message, enum, and service defined in the .proto + // file. Thus, these types will *not* be nested inside the outer class + // named by java_outer_classname. However, the outer class will still be + // generated to contain the file's getDescriptor() method as well as any + // top-level extensions defined in the file. + JavaMultipleFiles *bool `protobuf:"varint,10,opt,name=java_multiple_files,json=javaMultipleFiles,def=0" json:"java_multiple_files,omitempty"` + // This option does nothing. + JavaGenerateEqualsAndHash *bool `protobuf:"varint,20,opt,name=java_generate_equals_and_hash,json=javaGenerateEqualsAndHash" json:"java_generate_equals_and_hash,omitempty"` // Deprecated: Do not use. + // If set true, then the Java2 code generator will generate code that + // throws an exception whenever an attempt is made to assign a non-UTF-8 + // byte sequence to a string field. + // Message reflection will do the same. + // However, an extension field still accepts non-UTF-8 byte sequences. + // This option has no effect on when used with the lite runtime. + JavaStringCheckUtf8 *bool `protobuf:"varint,27,opt,name=java_string_check_utf8,json=javaStringCheckUtf8,def=0" json:"java_string_check_utf8,omitempty"` + OptimizeFor *FileOptions_OptimizeMode `protobuf:"varint,9,opt,name=optimize_for,json=optimizeFor,enum=google.protobuf.FileOptions_OptimizeMode,def=1" json:"optimize_for,omitempty"` + // Sets the Go package where structs generated from this .proto will be + // placed. If omitted, the Go package will be derived from the following: + // - The basename of the package import path, if provided. + // - Otherwise, the package statement in the .proto file, if present. + // - Otherwise, the basename of the .proto file, without extension. + GoPackage *string `protobuf:"bytes,11,opt,name=go_package,json=goPackage" json:"go_package,omitempty"` + // Should generic services be generated in each language? "Generic" services + // are not specific to any particular RPC system. They are generated by the + // main code generators in each language (without additional plugins). + // Generic services were the only kind of service generation supported by + // early versions of google.protobuf. + // + // Generic services are now considered deprecated in favor of using plugins + // that generate code specific to your particular RPC system. Therefore, + // these default to false. Old code which depends on generic services should + // explicitly set them to true. + CcGenericServices *bool `protobuf:"varint,16,opt,name=cc_generic_services,json=ccGenericServices,def=0" json:"cc_generic_services,omitempty"` + JavaGenericServices *bool `protobuf:"varint,17,opt,name=java_generic_services,json=javaGenericServices,def=0" json:"java_generic_services,omitempty"` + PyGenericServices *bool `protobuf:"varint,18,opt,name=py_generic_services,json=pyGenericServices,def=0" json:"py_generic_services,omitempty"` + PhpGenericServices *bool `protobuf:"varint,42,opt,name=php_generic_services,json=phpGenericServices,def=0" json:"php_generic_services,omitempty"` + // Is this file deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for everything in the file, or it will be completely ignored; in the very + // least, this is a formalization for deprecating files. + Deprecated *bool `protobuf:"varint,23,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Enables the use of arenas for the proto messages in this file. This applies + // only to generated classes for C++. + CcEnableArenas *bool `protobuf:"varint,31,opt,name=cc_enable_arenas,json=ccEnableArenas,def=0" json:"cc_enable_arenas,omitempty"` + // Sets the objective c class prefix which is prepended to all objective c + // generated classes from this .proto. There is no default. + ObjcClassPrefix *string `protobuf:"bytes,36,opt,name=objc_class_prefix,json=objcClassPrefix" json:"objc_class_prefix,omitempty"` + // Namespace for generated classes; defaults to the package. + CsharpNamespace *string `protobuf:"bytes,37,opt,name=csharp_namespace,json=csharpNamespace" json:"csharp_namespace,omitempty"` + // By default Swift generators will take the proto package and CamelCase it + // replacing '.' with underscore and use that to prefix the types/symbols + // defined. When this options is provided, they will use this value instead + // to prefix the types/symbols defined. + SwiftPrefix *string `protobuf:"bytes,39,opt,name=swift_prefix,json=swiftPrefix" json:"swift_prefix,omitempty"` + // Sets the php class prefix which is prepended to all php generated classes + // from this .proto. Default is empty. + PhpClassPrefix *string `protobuf:"bytes,40,opt,name=php_class_prefix,json=phpClassPrefix" json:"php_class_prefix,omitempty"` + // Use this option to change the namespace of php generated classes. Default + // is empty. When this option is empty, the package name will be used for + // determining the namespace. + PhpNamespace *string `protobuf:"bytes,41,opt,name=php_namespace,json=phpNamespace" json:"php_namespace,omitempty"` + // Use this option to change the namespace of php generated metadata classes. + // Default is empty. When this option is empty, the proto file name will be used + // for determining the namespace. + PhpMetadataNamespace *string `protobuf:"bytes,44,opt,name=php_metadata_namespace,json=phpMetadataNamespace" json:"php_metadata_namespace,omitempty"` + // Use this option to change the package of ruby generated classes. Default + // is empty. When this option is not set, the package name will be used for + // determining the ruby package. + RubyPackage *string `protobuf:"bytes,45,opt,name=ruby_package,json=rubyPackage" json:"ruby_package,omitempty"` + // The parser stores options it doesn't recognize here. + // See the documentation for the "Options" section above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FileOptions) Reset() { *m = FileOptions{} } +func (m *FileOptions) String() string { return proto.CompactTextString(m) } +func (*FileOptions) ProtoMessage() {} +func (*FileOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{10} +} + +var extRange_FileOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FileOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FileOptions +} + +func (m *FileOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FileOptions.Unmarshal(m, b) +} +func (m *FileOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FileOptions.Marshal(b, m, deterministic) +} +func (m *FileOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FileOptions.Merge(m, src) +} +func (m *FileOptions) XXX_Size() int { + return xxx_messageInfo_FileOptions.Size(m) +} +func (m *FileOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FileOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FileOptions proto.InternalMessageInfo + +const Default_FileOptions_JavaMultipleFiles bool = false +const Default_FileOptions_JavaStringCheckUtf8 bool = false +const Default_FileOptions_OptimizeFor FileOptions_OptimizeMode = FileOptions_SPEED +const Default_FileOptions_CcGenericServices bool = false +const Default_FileOptions_JavaGenericServices bool = false +const Default_FileOptions_PyGenericServices bool = false +const Default_FileOptions_PhpGenericServices bool = false +const Default_FileOptions_Deprecated bool = false +const Default_FileOptions_CcEnableArenas bool = false + +func (m *FileOptions) GetJavaPackage() string { + if m != nil && m.JavaPackage != nil { + return *m.JavaPackage + } + return "" +} + +func (m *FileOptions) GetJavaOuterClassname() string { + if m != nil && m.JavaOuterClassname != nil { + return *m.JavaOuterClassname + } + return "" +} + +func (m *FileOptions) GetJavaMultipleFiles() bool { + if m != nil && m.JavaMultipleFiles != nil { + return *m.JavaMultipleFiles + } + return Default_FileOptions_JavaMultipleFiles +} + +// Deprecated: Do not use. +func (m *FileOptions) GetJavaGenerateEqualsAndHash() bool { + if m != nil && m.JavaGenerateEqualsAndHash != nil { + return *m.JavaGenerateEqualsAndHash + } + return false +} + +func (m *FileOptions) GetJavaStringCheckUtf8() bool { + if m != nil && m.JavaStringCheckUtf8 != nil { + return *m.JavaStringCheckUtf8 + } + return Default_FileOptions_JavaStringCheckUtf8 +} + +func (m *FileOptions) GetOptimizeFor() FileOptions_OptimizeMode { + if m != nil && m.OptimizeFor != nil { + return *m.OptimizeFor + } + return Default_FileOptions_OptimizeFor +} + +func (m *FileOptions) GetGoPackage() string { + if m != nil && m.GoPackage != nil { + return *m.GoPackage + } + return "" +} + +func (m *FileOptions) GetCcGenericServices() bool { + if m != nil && m.CcGenericServices != nil { + return *m.CcGenericServices + } + return Default_FileOptions_CcGenericServices +} + +func (m *FileOptions) GetJavaGenericServices() bool { + if m != nil && m.JavaGenericServices != nil { + return *m.JavaGenericServices + } + return Default_FileOptions_JavaGenericServices +} + +func (m *FileOptions) GetPyGenericServices() bool { + if m != nil && m.PyGenericServices != nil { + return *m.PyGenericServices + } + return Default_FileOptions_PyGenericServices +} + +func (m *FileOptions) GetPhpGenericServices() bool { + if m != nil && m.PhpGenericServices != nil { + return *m.PhpGenericServices + } + return Default_FileOptions_PhpGenericServices +} + +func (m *FileOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FileOptions_Deprecated +} + +func (m *FileOptions) GetCcEnableArenas() bool { + if m != nil && m.CcEnableArenas != nil { + return *m.CcEnableArenas + } + return Default_FileOptions_CcEnableArenas +} + +func (m *FileOptions) GetObjcClassPrefix() string { + if m != nil && m.ObjcClassPrefix != nil { + return *m.ObjcClassPrefix + } + return "" +} + +func (m *FileOptions) GetCsharpNamespace() string { + if m != nil && m.CsharpNamespace != nil { + return *m.CsharpNamespace + } + return "" +} + +func (m *FileOptions) GetSwiftPrefix() string { + if m != nil && m.SwiftPrefix != nil { + return *m.SwiftPrefix + } + return "" +} + +func (m *FileOptions) GetPhpClassPrefix() string { + if m != nil && m.PhpClassPrefix != nil { + return *m.PhpClassPrefix + } + return "" +} + +func (m *FileOptions) GetPhpNamespace() string { + if m != nil && m.PhpNamespace != nil { + return *m.PhpNamespace + } + return "" +} + +func (m *FileOptions) GetPhpMetadataNamespace() string { + if m != nil && m.PhpMetadataNamespace != nil { + return *m.PhpMetadataNamespace + } + return "" +} + +func (m *FileOptions) GetRubyPackage() string { + if m != nil && m.RubyPackage != nil { + return *m.RubyPackage + } + return "" +} + +func (m *FileOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MessageOptions struct { + // Set true to use the old proto1 MessageSet wire format for extensions. + // This is provided for backwards-compatibility with the MessageSet wire + // format. You should not use this for any other reason: It's less + // efficient, has fewer features, and is more complicated. + // + // The message must be defined exactly as follows: + // message Foo { + // option message_set_wire_format = true; + // extensions 4 to max; + // } + // Note that the message cannot have any defined fields; MessageSets only + // have extensions. + // + // All extensions of your type must be singular messages; e.g. they cannot + // be int32s, enums, or repeated messages. + // + // Because this is an option, the above two restrictions are not enforced by + // the protocol compiler. + MessageSetWireFormat *bool `protobuf:"varint,1,opt,name=message_set_wire_format,json=messageSetWireFormat,def=0" json:"message_set_wire_format,omitempty"` + // Disables the generation of the standard "descriptor()" accessor, which can + // conflict with a field of the same name. This is meant to make migration + // from proto1 easier; new code should avoid fields named "descriptor". + NoStandardDescriptorAccessor *bool `protobuf:"varint,2,opt,name=no_standard_descriptor_accessor,json=noStandardDescriptorAccessor,def=0" json:"no_standard_descriptor_accessor,omitempty"` + // Is this message deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the message, or it will be completely ignored; in the very least, + // this is a formalization for deprecating messages. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // Whether the message is an automatically generated map entry type for the + // maps field. + // + // For maps fields: + // map map_field = 1; + // The parsed descriptor looks like: + // message MapFieldEntry { + // option map_entry = true; + // optional KeyType key = 1; + // optional ValueType value = 2; + // } + // repeated MapFieldEntry map_field = 1; + // + // Implementations may choose not to generate the map_entry=true message, but + // use a native map in the target language to hold the keys and values. + // The reflection APIs in such implementions still need to work as + // if the field is a repeated message field. + // + // NOTE: Do not set the option in .proto files. Always use the maps syntax + // instead. The option should only be implicitly set by the proto compiler + // parser. + MapEntry *bool `protobuf:"varint,7,opt,name=map_entry,json=mapEntry" json:"map_entry,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MessageOptions) Reset() { *m = MessageOptions{} } +func (m *MessageOptions) String() string { return proto.CompactTextString(m) } +func (*MessageOptions) ProtoMessage() {} +func (*MessageOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{11} +} + +var extRange_MessageOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MessageOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MessageOptions +} + +func (m *MessageOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MessageOptions.Unmarshal(m, b) +} +func (m *MessageOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MessageOptions.Marshal(b, m, deterministic) +} +func (m *MessageOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MessageOptions.Merge(m, src) +} +func (m *MessageOptions) XXX_Size() int { + return xxx_messageInfo_MessageOptions.Size(m) +} +func (m *MessageOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MessageOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MessageOptions proto.InternalMessageInfo + +const Default_MessageOptions_MessageSetWireFormat bool = false +const Default_MessageOptions_NoStandardDescriptorAccessor bool = false +const Default_MessageOptions_Deprecated bool = false + +func (m *MessageOptions) GetMessageSetWireFormat() bool { + if m != nil && m.MessageSetWireFormat != nil { + return *m.MessageSetWireFormat + } + return Default_MessageOptions_MessageSetWireFormat +} + +func (m *MessageOptions) GetNoStandardDescriptorAccessor() bool { + if m != nil && m.NoStandardDescriptorAccessor != nil { + return *m.NoStandardDescriptorAccessor + } + return Default_MessageOptions_NoStandardDescriptorAccessor +} + +func (m *MessageOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MessageOptions_Deprecated +} + +func (m *MessageOptions) GetMapEntry() bool { + if m != nil && m.MapEntry != nil { + return *m.MapEntry + } + return false +} + +func (m *MessageOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type FieldOptions struct { + // The ctype option instructs the C++ code generator to use a different + // representation of the field than it normally would. See the specific + // options below. This option is not yet implemented in the open source + // release -- sorry, we'll try to include it in a future version! + Ctype *FieldOptions_CType `protobuf:"varint,1,opt,name=ctype,enum=google.protobuf.FieldOptions_CType,def=0" json:"ctype,omitempty"` + // The packed option can be enabled for repeated primitive fields to enable + // a more efficient representation on the wire. Rather than repeatedly + // writing the tag and type for each element, the entire array is encoded as + // a single length-delimited blob. In proto3, only explicit setting it to + // false will avoid using packed encoding. + Packed *bool `protobuf:"varint,2,opt,name=packed" json:"packed,omitempty"` + // The jstype option determines the JavaScript type used for values of the + // field. The option is permitted only for 64 bit integral and fixed types + // (int64, uint64, sint64, fixed64, sfixed64). A field with jstype JS_STRING + // is represented as JavaScript string, which avoids loss of precision that + // can happen when a large value is converted to a floating point JavaScript. + // Specifying JS_NUMBER for the jstype causes the generated JavaScript code to + // use the JavaScript "number" type. The behavior of the default option + // JS_NORMAL is implementation dependent. + // + // This option is an enum to permit additional types to be added, e.g. + // goog.math.Integer. + Jstype *FieldOptions_JSType `protobuf:"varint,6,opt,name=jstype,enum=google.protobuf.FieldOptions_JSType,def=0" json:"jstype,omitempty"` + // Should this field be parsed lazily? Lazy applies only to message-type + // fields. It means that when the outer message is initially parsed, the + // inner message's contents will not be parsed but instead stored in encoded + // form. The inner message will actually be parsed when it is first accessed. + // + // This is only a hint. Implementations are free to choose whether to use + // eager or lazy parsing regardless of the value of this option. However, + // setting this option true suggests that the protocol author believes that + // using lazy parsing on this field is worth the additional bookkeeping + // overhead typically needed to implement it. + // + // This option does not affect the public interface of any generated code; + // all method signatures remain the same. Furthermore, thread-safety of the + // interface is not affected by this option; const methods remain safe to + // call from multiple threads concurrently, while non-const methods continue + // to require exclusive access. + // + // + // Note that implementations may choose not to check required fields within + // a lazy sub-message. That is, calling IsInitialized() on the outer message + // may return true even if the inner message has missing required fields. + // This is necessary because otherwise the inner message would have to be + // parsed in order to perform the check, defeating the purpose of lazy + // parsing. An implementation which chooses not to check required fields + // must be consistent about it. That is, for any particular sub-message, the + // implementation must either *always* check its required fields, or *never* + // check its required fields, regardless of whether or not the message has + // been parsed. + Lazy *bool `protobuf:"varint,5,opt,name=lazy,def=0" json:"lazy,omitempty"` + // Is this field deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for accessors, or it will be completely ignored; in the very least, this + // is a formalization for deprecating fields. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // For Google-internal migration only. Do not use. + Weak *bool `protobuf:"varint,10,opt,name=weak,def=0" json:"weak,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldOptions) Reset() { *m = FieldOptions{} } +func (m *FieldOptions) String() string { return proto.CompactTextString(m) } +func (*FieldOptions) ProtoMessage() {} +func (*FieldOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{12} +} + +var extRange_FieldOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*FieldOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_FieldOptions +} + +func (m *FieldOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldOptions.Unmarshal(m, b) +} +func (m *FieldOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldOptions.Marshal(b, m, deterministic) +} +func (m *FieldOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldOptions.Merge(m, src) +} +func (m *FieldOptions) XXX_Size() int { + return xxx_messageInfo_FieldOptions.Size(m) +} +func (m *FieldOptions) XXX_DiscardUnknown() { + xxx_messageInfo_FieldOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldOptions proto.InternalMessageInfo + +const Default_FieldOptions_Ctype FieldOptions_CType = FieldOptions_STRING +const Default_FieldOptions_Jstype FieldOptions_JSType = FieldOptions_JS_NORMAL +const Default_FieldOptions_Lazy bool = false +const Default_FieldOptions_Deprecated bool = false +const Default_FieldOptions_Weak bool = false + +func (m *FieldOptions) GetCtype() FieldOptions_CType { + if m != nil && m.Ctype != nil { + return *m.Ctype + } + return Default_FieldOptions_Ctype +} + +func (m *FieldOptions) GetPacked() bool { + if m != nil && m.Packed != nil { + return *m.Packed + } + return false +} + +func (m *FieldOptions) GetJstype() FieldOptions_JSType { + if m != nil && m.Jstype != nil { + return *m.Jstype + } + return Default_FieldOptions_Jstype +} + +func (m *FieldOptions) GetLazy() bool { + if m != nil && m.Lazy != nil { + return *m.Lazy + } + return Default_FieldOptions_Lazy +} + +func (m *FieldOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_FieldOptions_Deprecated +} + +func (m *FieldOptions) GetWeak() bool { + if m != nil && m.Weak != nil { + return *m.Weak + } + return Default_FieldOptions_Weak +} + +func (m *FieldOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type OneofOptions struct { + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OneofOptions) Reset() { *m = OneofOptions{} } +func (m *OneofOptions) String() string { return proto.CompactTextString(m) } +func (*OneofOptions) ProtoMessage() {} +func (*OneofOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{13} +} + +var extRange_OneofOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*OneofOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_OneofOptions +} + +func (m *OneofOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_OneofOptions.Unmarshal(m, b) +} +func (m *OneofOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_OneofOptions.Marshal(b, m, deterministic) +} +func (m *OneofOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_OneofOptions.Merge(m, src) +} +func (m *OneofOptions) XXX_Size() int { + return xxx_messageInfo_OneofOptions.Size(m) +} +func (m *OneofOptions) XXX_DiscardUnknown() { + xxx_messageInfo_OneofOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_OneofOptions proto.InternalMessageInfo + +func (m *OneofOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumOptions struct { + // Set this option to true to allow mapping different tag names to the same + // value. + AllowAlias *bool `protobuf:"varint,2,opt,name=allow_alias,json=allowAlias" json:"allow_alias,omitempty"` + // Is this enum deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum, or it will be completely ignored; in the very least, this + // is a formalization for deprecating enums. + Deprecated *bool `protobuf:"varint,3,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumOptions) Reset() { *m = EnumOptions{} } +func (m *EnumOptions) String() string { return proto.CompactTextString(m) } +func (*EnumOptions) ProtoMessage() {} +func (*EnumOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{14} +} + +var extRange_EnumOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumOptions +} + +func (m *EnumOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumOptions.Unmarshal(m, b) +} +func (m *EnumOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumOptions.Marshal(b, m, deterministic) +} +func (m *EnumOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumOptions.Merge(m, src) +} +func (m *EnumOptions) XXX_Size() int { + return xxx_messageInfo_EnumOptions.Size(m) +} +func (m *EnumOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumOptions proto.InternalMessageInfo + +const Default_EnumOptions_Deprecated bool = false + +func (m *EnumOptions) GetAllowAlias() bool { + if m != nil && m.AllowAlias != nil { + return *m.AllowAlias + } + return false +} + +func (m *EnumOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumOptions_Deprecated +} + +func (m *EnumOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type EnumValueOptions struct { + // Is this enum value deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the enum value, or it will be completely ignored; in the very least, + // this is a formalization for deprecating enum values. + Deprecated *bool `protobuf:"varint,1,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *EnumValueOptions) Reset() { *m = EnumValueOptions{} } +func (m *EnumValueOptions) String() string { return proto.CompactTextString(m) } +func (*EnumValueOptions) ProtoMessage() {} +func (*EnumValueOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{15} +} + +var extRange_EnumValueOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*EnumValueOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_EnumValueOptions +} + +func (m *EnumValueOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_EnumValueOptions.Unmarshal(m, b) +} +func (m *EnumValueOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_EnumValueOptions.Marshal(b, m, deterministic) +} +func (m *EnumValueOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_EnumValueOptions.Merge(m, src) +} +func (m *EnumValueOptions) XXX_Size() int { + return xxx_messageInfo_EnumValueOptions.Size(m) +} +func (m *EnumValueOptions) XXX_DiscardUnknown() { + xxx_messageInfo_EnumValueOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_EnumValueOptions proto.InternalMessageInfo + +const Default_EnumValueOptions_Deprecated bool = false + +func (m *EnumValueOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_EnumValueOptions_Deprecated +} + +func (m *EnumValueOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type ServiceOptions struct { + // Is this service deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the service, or it will be completely ignored; in the very least, + // this is a formalization for deprecating services. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ServiceOptions) Reset() { *m = ServiceOptions{} } +func (m *ServiceOptions) String() string { return proto.CompactTextString(m) } +func (*ServiceOptions) ProtoMessage() {} +func (*ServiceOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{16} +} + +var extRange_ServiceOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*ServiceOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_ServiceOptions +} + +func (m *ServiceOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ServiceOptions.Unmarshal(m, b) +} +func (m *ServiceOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ServiceOptions.Marshal(b, m, deterministic) +} +func (m *ServiceOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_ServiceOptions.Merge(m, src) +} +func (m *ServiceOptions) XXX_Size() int { + return xxx_messageInfo_ServiceOptions.Size(m) +} +func (m *ServiceOptions) XXX_DiscardUnknown() { + xxx_messageInfo_ServiceOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_ServiceOptions proto.InternalMessageInfo + +const Default_ServiceOptions_Deprecated bool = false + +func (m *ServiceOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_ServiceOptions_Deprecated +} + +func (m *ServiceOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +type MethodOptions struct { + // Is this method deprecated? + // Depending on the target platform, this can emit Deprecated annotations + // for the method, or it will be completely ignored; in the very least, + // this is a formalization for deprecating methods. + Deprecated *bool `protobuf:"varint,33,opt,name=deprecated,def=0" json:"deprecated,omitempty"` + IdempotencyLevel *MethodOptions_IdempotencyLevel `protobuf:"varint,34,opt,name=idempotency_level,json=idempotencyLevel,enum=google.protobuf.MethodOptions_IdempotencyLevel,def=0" json:"idempotency_level,omitempty"` + // The parser stores options it doesn't recognize here. See above. + UninterpretedOption []*UninterpretedOption `protobuf:"bytes,999,rep,name=uninterpreted_option,json=uninterpretedOption" json:"uninterpreted_option,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + proto.XXX_InternalExtensions `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *MethodOptions) Reset() { *m = MethodOptions{} } +func (m *MethodOptions) String() string { return proto.CompactTextString(m) } +func (*MethodOptions) ProtoMessage() {} +func (*MethodOptions) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{17} +} + +var extRange_MethodOptions = []proto.ExtensionRange{ + {Start: 1000, End: 536870911}, +} + +func (*MethodOptions) ExtensionRangeArray() []proto.ExtensionRange { + return extRange_MethodOptions +} + +func (m *MethodOptions) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_MethodOptions.Unmarshal(m, b) +} +func (m *MethodOptions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_MethodOptions.Marshal(b, m, deterministic) +} +func (m *MethodOptions) XXX_Merge(src proto.Message) { + xxx_messageInfo_MethodOptions.Merge(m, src) +} +func (m *MethodOptions) XXX_Size() int { + return xxx_messageInfo_MethodOptions.Size(m) +} +func (m *MethodOptions) XXX_DiscardUnknown() { + xxx_messageInfo_MethodOptions.DiscardUnknown(m) +} + +var xxx_messageInfo_MethodOptions proto.InternalMessageInfo + +const Default_MethodOptions_Deprecated bool = false +const Default_MethodOptions_IdempotencyLevel MethodOptions_IdempotencyLevel = MethodOptions_IDEMPOTENCY_UNKNOWN + +func (m *MethodOptions) GetDeprecated() bool { + if m != nil && m.Deprecated != nil { + return *m.Deprecated + } + return Default_MethodOptions_Deprecated +} + +func (m *MethodOptions) GetIdempotencyLevel() MethodOptions_IdempotencyLevel { + if m != nil && m.IdempotencyLevel != nil { + return *m.IdempotencyLevel + } + return Default_MethodOptions_IdempotencyLevel +} + +func (m *MethodOptions) GetUninterpretedOption() []*UninterpretedOption { + if m != nil { + return m.UninterpretedOption + } + return nil +} + +// A message representing a option the parser does not recognize. This only +// appears in options protos created by the compiler::Parser class. +// DescriptorPool resolves these when building Descriptor objects. Therefore, +// options protos in descriptor objects (e.g. returned by Descriptor::options(), +// or produced by Descriptor::CopyTo()) will never have UninterpretedOptions +// in them. +type UninterpretedOption struct { + Name []*UninterpretedOption_NamePart `protobuf:"bytes,2,rep,name=name" json:"name,omitempty"` + // The value of the uninterpreted option, in whatever type the tokenizer + // identified it as during parsing. Exactly one of these should be set. + IdentifierValue *string `protobuf:"bytes,3,opt,name=identifier_value,json=identifierValue" json:"identifier_value,omitempty"` + PositiveIntValue *uint64 `protobuf:"varint,4,opt,name=positive_int_value,json=positiveIntValue" json:"positive_int_value,omitempty"` + NegativeIntValue *int64 `protobuf:"varint,5,opt,name=negative_int_value,json=negativeIntValue" json:"negative_int_value,omitempty"` + DoubleValue *float64 `protobuf:"fixed64,6,opt,name=double_value,json=doubleValue" json:"double_value,omitempty"` + StringValue []byte `protobuf:"bytes,7,opt,name=string_value,json=stringValue" json:"string_value,omitempty"` + AggregateValue *string `protobuf:"bytes,8,opt,name=aggregate_value,json=aggregateValue" json:"aggregate_value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption) Reset() { *m = UninterpretedOption{} } +func (m *UninterpretedOption) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption) ProtoMessage() {} +func (*UninterpretedOption) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{18} +} + +func (m *UninterpretedOption) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption.Unmarshal(m, b) +} +func (m *UninterpretedOption) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption.Marshal(b, m, deterministic) +} +func (m *UninterpretedOption) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption.Merge(m, src) +} +func (m *UninterpretedOption) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption.Size(m) +} +func (m *UninterpretedOption) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption proto.InternalMessageInfo + +func (m *UninterpretedOption) GetName() []*UninterpretedOption_NamePart { + if m != nil { + return m.Name + } + return nil +} + +func (m *UninterpretedOption) GetIdentifierValue() string { + if m != nil && m.IdentifierValue != nil { + return *m.IdentifierValue + } + return "" +} + +func (m *UninterpretedOption) GetPositiveIntValue() uint64 { + if m != nil && m.PositiveIntValue != nil { + return *m.PositiveIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetNegativeIntValue() int64 { + if m != nil && m.NegativeIntValue != nil { + return *m.NegativeIntValue + } + return 0 +} + +func (m *UninterpretedOption) GetDoubleValue() float64 { + if m != nil && m.DoubleValue != nil { + return *m.DoubleValue + } + return 0 +} + +func (m *UninterpretedOption) GetStringValue() []byte { + if m != nil { + return m.StringValue + } + return nil +} + +func (m *UninterpretedOption) GetAggregateValue() string { + if m != nil && m.AggregateValue != nil { + return *m.AggregateValue + } + return "" +} + +// The name of the uninterpreted option. Each string represents a segment in +// a dot-separated name. is_extension is true iff a segment represents an +// extension (denoted with parentheses in options specs in .proto files). +// E.g.,{ ["foo", false], ["bar.baz", true], ["qux", false] } represents +// "foo.(bar.baz).qux". +type UninterpretedOption_NamePart struct { + NamePart *string `protobuf:"bytes,1,req,name=name_part,json=namePart" json:"name_part,omitempty"` + IsExtension *bool `protobuf:"varint,2,req,name=is_extension,json=isExtension" json:"is_extension,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UninterpretedOption_NamePart) Reset() { *m = UninterpretedOption_NamePart{} } +func (m *UninterpretedOption_NamePart) String() string { return proto.CompactTextString(m) } +func (*UninterpretedOption_NamePart) ProtoMessage() {} +func (*UninterpretedOption_NamePart) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{18, 0} +} + +func (m *UninterpretedOption_NamePart) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UninterpretedOption_NamePart.Unmarshal(m, b) +} +func (m *UninterpretedOption_NamePart) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UninterpretedOption_NamePart.Marshal(b, m, deterministic) +} +func (m *UninterpretedOption_NamePart) XXX_Merge(src proto.Message) { + xxx_messageInfo_UninterpretedOption_NamePart.Merge(m, src) +} +func (m *UninterpretedOption_NamePart) XXX_Size() int { + return xxx_messageInfo_UninterpretedOption_NamePart.Size(m) +} +func (m *UninterpretedOption_NamePart) XXX_DiscardUnknown() { + xxx_messageInfo_UninterpretedOption_NamePart.DiscardUnknown(m) +} + +var xxx_messageInfo_UninterpretedOption_NamePart proto.InternalMessageInfo + +func (m *UninterpretedOption_NamePart) GetNamePart() string { + if m != nil && m.NamePart != nil { + return *m.NamePart + } + return "" +} + +func (m *UninterpretedOption_NamePart) GetIsExtension() bool { + if m != nil && m.IsExtension != nil { + return *m.IsExtension + } + return false +} + +// Encapsulates information about the original source file from which a +// FileDescriptorProto was generated. +type SourceCodeInfo struct { + // A Location identifies a piece of source code in a .proto file which + // corresponds to a particular definition. This information is intended + // to be useful to IDEs, code indexers, documentation generators, and similar + // tools. + // + // For example, say we have a file like: + // message Foo { + // optional string foo = 1; + // } + // Let's look at just the field definition: + // optional string foo = 1; + // ^ ^^ ^^ ^ ^^^ + // a bc de f ghi + // We have the following locations: + // span path represents + // [a,i) [ 4, 0, 2, 0 ] The whole field definition. + // [a,b) [ 4, 0, 2, 0, 4 ] The label (optional). + // [c,d) [ 4, 0, 2, 0, 5 ] The type (string). + // [e,f) [ 4, 0, 2, 0, 1 ] The name (foo). + // [g,h) [ 4, 0, 2, 0, 3 ] The number (1). + // + // Notes: + // - A location may refer to a repeated field itself (i.e. not to any + // particular index within it). This is used whenever a set of elements are + // logically enclosed in a single code segment. For example, an entire + // extend block (possibly containing multiple extension definitions) will + // have an outer location whose path refers to the "extensions" repeated + // field without an index. + // - Multiple locations may have the same path. This happens when a single + // logical declaration is spread out across multiple places. The most + // obvious example is the "extend" block again -- there may be multiple + // extend blocks in the same scope, each of which will have the same path. + // - A location's span is not always a subset of its parent's span. For + // example, the "extendee" of an extension declaration appears at the + // beginning of the "extend" block and is shared by all extensions within + // the block. + // - Just because a location's span is a subset of some other location's span + // does not mean that it is a descendent. For example, a "group" defines + // both a type and a field in a single declaration. Thus, the locations + // corresponding to the type and field and their components will overlap. + // - Code which tries to interpret locations should probably be designed to + // ignore those that it doesn't understand, as more types of locations could + // be recorded in the future. + Location []*SourceCodeInfo_Location `protobuf:"bytes,1,rep,name=location" json:"location,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo) Reset() { *m = SourceCodeInfo{} } +func (m *SourceCodeInfo) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo) ProtoMessage() {} +func (*SourceCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{19} +} + +func (m *SourceCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo.Unmarshal(m, b) +} +func (m *SourceCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo.Marshal(b, m, deterministic) +} +func (m *SourceCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo.Merge(m, src) +} +func (m *SourceCodeInfo) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo.Size(m) +} +func (m *SourceCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo proto.InternalMessageInfo + +func (m *SourceCodeInfo) GetLocation() []*SourceCodeInfo_Location { + if m != nil { + return m.Location + } + return nil +} + +type SourceCodeInfo_Location struct { + // Identifies which part of the FileDescriptorProto was defined at this + // location. + // + // Each element is a field number or an index. They form a path from + // the root FileDescriptorProto to the place where the definition. For + // example, this path: + // [ 4, 3, 2, 7, 1 ] + // refers to: + // file.message_type(3) // 4, 3 + // .field(7) // 2, 7 + // .name() // 1 + // This is because FileDescriptorProto.message_type has field number 4: + // repeated DescriptorProto message_type = 4; + // and DescriptorProto.field has field number 2: + // repeated FieldDescriptorProto field = 2; + // and FieldDescriptorProto.name has field number 1: + // optional string name = 1; + // + // Thus, the above path gives the location of a field name. If we removed + // the last element: + // [ 4, 3, 2, 7 ] + // this path refers to the whole field declaration (from the beginning + // of the label to the terminating semicolon). + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Always has exactly three or four elements: start line, start column, + // end line (optional, otherwise assumed same as start line), end column. + // These are packed into a single field for efficiency. Note that line + // and column numbers are zero-based -- typically you will want to add + // 1 to each before displaying to a user. + Span []int32 `protobuf:"varint,2,rep,packed,name=span" json:"span,omitempty"` + // If this SourceCodeInfo represents a complete declaration, these are any + // comments appearing before and after the declaration which appear to be + // attached to the declaration. + // + // A series of line comments appearing on consecutive lines, with no other + // tokens appearing on those lines, will be treated as a single comment. + // + // leading_detached_comments will keep paragraphs of comments that appear + // before (but not connected to) the current element. Each paragraph, + // separated by empty lines, will be one comment element in the repeated + // field. + // + // Only the comment content is provided; comment markers (e.g. //) are + // stripped out. For block comments, leading whitespace and an asterisk + // will be stripped from the beginning of each line other than the first. + // Newlines are included in the output. + // + // Examples: + // + // optional int32 foo = 1; // Comment attached to foo. + // // Comment attached to bar. + // optional int32 bar = 2; + // + // optional string baz = 3; + // // Comment attached to baz. + // // Another line attached to baz. + // + // // Comment attached to qux. + // // + // // Another line attached to qux. + // optional double qux = 4; + // + // // Detached comment for corge. This is not leading or trailing comments + // // to qux or corge because there are blank lines separating it from + // // both. + // + // // Detached comment for corge paragraph 2. + // + // optional string corge = 5; + // /* Block comment attached + // * to corge. Leading asterisks + // * will be removed. */ + // /* Block comment attached to + // * grault. */ + // optional int32 grault = 6; + // + // // ignored detached comments. + LeadingComments *string `protobuf:"bytes,3,opt,name=leading_comments,json=leadingComments" json:"leading_comments,omitempty"` + TrailingComments *string `protobuf:"bytes,4,opt,name=trailing_comments,json=trailingComments" json:"trailing_comments,omitempty"` + LeadingDetachedComments []string `protobuf:"bytes,6,rep,name=leading_detached_comments,json=leadingDetachedComments" json:"leading_detached_comments,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SourceCodeInfo_Location) Reset() { *m = SourceCodeInfo_Location{} } +func (m *SourceCodeInfo_Location) String() string { return proto.CompactTextString(m) } +func (*SourceCodeInfo_Location) ProtoMessage() {} +func (*SourceCodeInfo_Location) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{19, 0} +} + +func (m *SourceCodeInfo_Location) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_SourceCodeInfo_Location.Unmarshal(m, b) +} +func (m *SourceCodeInfo_Location) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_SourceCodeInfo_Location.Marshal(b, m, deterministic) +} +func (m *SourceCodeInfo_Location) XXX_Merge(src proto.Message) { + xxx_messageInfo_SourceCodeInfo_Location.Merge(m, src) +} +func (m *SourceCodeInfo_Location) XXX_Size() int { + return xxx_messageInfo_SourceCodeInfo_Location.Size(m) +} +func (m *SourceCodeInfo_Location) XXX_DiscardUnknown() { + xxx_messageInfo_SourceCodeInfo_Location.DiscardUnknown(m) +} + +var xxx_messageInfo_SourceCodeInfo_Location proto.InternalMessageInfo + +func (m *SourceCodeInfo_Location) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *SourceCodeInfo_Location) GetSpan() []int32 { + if m != nil { + return m.Span + } + return nil +} + +func (m *SourceCodeInfo_Location) GetLeadingComments() string { + if m != nil && m.LeadingComments != nil { + return *m.LeadingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetTrailingComments() string { + if m != nil && m.TrailingComments != nil { + return *m.TrailingComments + } + return "" +} + +func (m *SourceCodeInfo_Location) GetLeadingDetachedComments() []string { + if m != nil { + return m.LeadingDetachedComments + } + return nil +} + +// Describes the relationship between generated code and its original source +// file. A GeneratedCodeInfo message is associated with only one generated +// source file, but may contain references to different source .proto files. +type GeneratedCodeInfo struct { + // An Annotation connects some span of text in generated code to an element + // of its generating .proto file. + Annotation []*GeneratedCodeInfo_Annotation `protobuf:"bytes,1,rep,name=annotation" json:"annotation,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo) Reset() { *m = GeneratedCodeInfo{} } +func (m *GeneratedCodeInfo) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo) ProtoMessage() {} +func (*GeneratedCodeInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{20} +} + +func (m *GeneratedCodeInfo) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo.Marshal(b, m, deterministic) +} +func (m *GeneratedCodeInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo.Merge(m, src) +} +func (m *GeneratedCodeInfo) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo.Size(m) +} +func (m *GeneratedCodeInfo) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo proto.InternalMessageInfo + +func (m *GeneratedCodeInfo) GetAnnotation() []*GeneratedCodeInfo_Annotation { + if m != nil { + return m.Annotation + } + return nil +} + +type GeneratedCodeInfo_Annotation struct { + // Identifies the element in the original source .proto file. This field + // is formatted the same as SourceCodeInfo.Location.path. + Path []int32 `protobuf:"varint,1,rep,packed,name=path" json:"path,omitempty"` + // Identifies the filesystem path to the original source .proto. + SourceFile *string `protobuf:"bytes,2,opt,name=source_file,json=sourceFile" json:"source_file,omitempty"` + // Identifies the starting offset in bytes in the generated code + // that relates to the identified object. + Begin *int32 `protobuf:"varint,3,opt,name=begin" json:"begin,omitempty"` + // Identifies the ending offset in bytes in the generated code that + // relates to the identified offset. The end offset should be one past + // the last relevant byte (so the length of the text = end - begin). + End *int32 `protobuf:"varint,4,opt,name=end" json:"end,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GeneratedCodeInfo_Annotation) Reset() { *m = GeneratedCodeInfo_Annotation{} } +func (m *GeneratedCodeInfo_Annotation) String() string { return proto.CompactTextString(m) } +func (*GeneratedCodeInfo_Annotation) ProtoMessage() {} +func (*GeneratedCodeInfo_Annotation) Descriptor() ([]byte, []int) { + return fileDescriptor_e5baabe45344a177, []int{20, 0} +} + +func (m *GeneratedCodeInfo_Annotation) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Unmarshal(m, b) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Marshal(b, m, deterministic) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Merge(src proto.Message) { + xxx_messageInfo_GeneratedCodeInfo_Annotation.Merge(m, src) +} +func (m *GeneratedCodeInfo_Annotation) XXX_Size() int { + return xxx_messageInfo_GeneratedCodeInfo_Annotation.Size(m) +} +func (m *GeneratedCodeInfo_Annotation) XXX_DiscardUnknown() { + xxx_messageInfo_GeneratedCodeInfo_Annotation.DiscardUnknown(m) +} + +var xxx_messageInfo_GeneratedCodeInfo_Annotation proto.InternalMessageInfo + +func (m *GeneratedCodeInfo_Annotation) GetPath() []int32 { + if m != nil { + return m.Path + } + return nil +} + +func (m *GeneratedCodeInfo_Annotation) GetSourceFile() string { + if m != nil && m.SourceFile != nil { + return *m.SourceFile + } + return "" +} + +func (m *GeneratedCodeInfo_Annotation) GetBegin() int32 { + if m != nil && m.Begin != nil { + return *m.Begin + } + return 0 +} + +func (m *GeneratedCodeInfo_Annotation) GetEnd() int32 { + if m != nil && m.End != nil { + return *m.End + } + return 0 +} + +func init() { + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Type", FieldDescriptorProto_Type_name, FieldDescriptorProto_Type_value) + proto.RegisterEnum("google.protobuf.FieldDescriptorProto_Label", FieldDescriptorProto_Label_name, FieldDescriptorProto_Label_value) + proto.RegisterEnum("google.protobuf.FileOptions_OptimizeMode", FileOptions_OptimizeMode_name, FileOptions_OptimizeMode_value) + proto.RegisterEnum("google.protobuf.FieldOptions_CType", FieldOptions_CType_name, FieldOptions_CType_value) + proto.RegisterEnum("google.protobuf.FieldOptions_JSType", FieldOptions_JSType_name, FieldOptions_JSType_value) + proto.RegisterEnum("google.protobuf.MethodOptions_IdempotencyLevel", MethodOptions_IdempotencyLevel_name, MethodOptions_IdempotencyLevel_value) + proto.RegisterType((*FileDescriptorSet)(nil), "google.protobuf.FileDescriptorSet") + proto.RegisterType((*FileDescriptorProto)(nil), "google.protobuf.FileDescriptorProto") + proto.RegisterType((*DescriptorProto)(nil), "google.protobuf.DescriptorProto") + proto.RegisterType((*DescriptorProto_ExtensionRange)(nil), "google.protobuf.DescriptorProto.ExtensionRange") + proto.RegisterType((*DescriptorProto_ReservedRange)(nil), "google.protobuf.DescriptorProto.ReservedRange") + proto.RegisterType((*ExtensionRangeOptions)(nil), "google.protobuf.ExtensionRangeOptions") + proto.RegisterType((*FieldDescriptorProto)(nil), "google.protobuf.FieldDescriptorProto") + proto.RegisterType((*OneofDescriptorProto)(nil), "google.protobuf.OneofDescriptorProto") + proto.RegisterType((*EnumDescriptorProto)(nil), "google.protobuf.EnumDescriptorProto") + proto.RegisterType((*EnumDescriptorProto_EnumReservedRange)(nil), "google.protobuf.EnumDescriptorProto.EnumReservedRange") + proto.RegisterType((*EnumValueDescriptorProto)(nil), "google.protobuf.EnumValueDescriptorProto") + proto.RegisterType((*ServiceDescriptorProto)(nil), "google.protobuf.ServiceDescriptorProto") + proto.RegisterType((*MethodDescriptorProto)(nil), "google.protobuf.MethodDescriptorProto") + proto.RegisterType((*FileOptions)(nil), "google.protobuf.FileOptions") + proto.RegisterType((*MessageOptions)(nil), "google.protobuf.MessageOptions") + proto.RegisterType((*FieldOptions)(nil), "google.protobuf.FieldOptions") + proto.RegisterType((*OneofOptions)(nil), "google.protobuf.OneofOptions") + proto.RegisterType((*EnumOptions)(nil), "google.protobuf.EnumOptions") + proto.RegisterType((*EnumValueOptions)(nil), "google.protobuf.EnumValueOptions") + proto.RegisterType((*ServiceOptions)(nil), "google.protobuf.ServiceOptions") + proto.RegisterType((*MethodOptions)(nil), "google.protobuf.MethodOptions") + proto.RegisterType((*UninterpretedOption)(nil), "google.protobuf.UninterpretedOption") + proto.RegisterType((*UninterpretedOption_NamePart)(nil), "google.protobuf.UninterpretedOption.NamePart") + proto.RegisterType((*SourceCodeInfo)(nil), "google.protobuf.SourceCodeInfo") + proto.RegisterType((*SourceCodeInfo_Location)(nil), "google.protobuf.SourceCodeInfo.Location") + proto.RegisterType((*GeneratedCodeInfo)(nil), "google.protobuf.GeneratedCodeInfo") + proto.RegisterType((*GeneratedCodeInfo_Annotation)(nil), "google.protobuf.GeneratedCodeInfo.Annotation") +} + +func init() { proto.RegisterFile("google/protobuf/descriptor.proto", fileDescriptor_e5baabe45344a177) } + +var fileDescriptor_e5baabe45344a177 = []byte{ + // 2589 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x59, 0xdd, 0x8e, 0xdb, 0xc6, + 0x15, 0x0e, 0xf5, 0xb7, 0xd2, 0x91, 0x56, 0x3b, 0x3b, 0xbb, 0xb1, 0xe9, 0xcd, 0x8f, 0xd7, 0xca, + 0x8f, 0xd7, 0x4e, 0xac, 0x0d, 0x1c, 0xdb, 0x71, 0xd6, 0x45, 0x5a, 0xad, 0x44, 0x6f, 0xe4, 0xee, + 0x4a, 0x2a, 0xa5, 0x6d, 0x7e, 0x80, 0x82, 0x98, 0x25, 0x47, 0x12, 0x6d, 0x8a, 0x64, 0x48, 0xca, + 0xf6, 0x06, 0xbd, 0x30, 0xd0, 0xab, 0x5e, 0x15, 0xe8, 0x55, 0x51, 0x14, 0xbd, 0xe8, 0x4d, 0x80, + 0x3e, 0x40, 0x81, 0xde, 0xf5, 0x09, 0x0a, 0xe4, 0x0d, 0x8a, 0xb6, 0x40, 0xfb, 0x08, 0xbd, 0x2c, + 0x66, 0x86, 0xa4, 0x48, 0x49, 0x1b, 0x6f, 0x02, 0xc4, 0xb9, 0x92, 0xe6, 0x3b, 0xdf, 0x39, 0x73, + 0xe6, 0xcc, 0x99, 0x99, 0x33, 0x43, 0xd8, 0x1e, 0x39, 0xce, 0xc8, 0xa2, 0xbb, 0xae, 0xe7, 0x04, + 0xce, 0xc9, 0x74, 0xb8, 0x6b, 0x50, 0x5f, 0xf7, 0x4c, 0x37, 0x70, 0xbc, 0x3a, 0xc7, 0xf0, 0x9a, + 0x60, 0xd4, 0x23, 0x46, 0xed, 0x08, 0xd6, 0xef, 0x9b, 0x16, 0x6d, 0xc5, 0xc4, 0x3e, 0x0d, 0xf0, + 0x5d, 0xc8, 0x0d, 0x4d, 0x8b, 0xca, 0xd2, 0x76, 0x76, 0xa7, 0x7c, 0xf3, 0xcd, 0xfa, 0x9c, 0x52, + 0x3d, 0xad, 0xd1, 0x63, 0xb0, 0xca, 0x35, 0x6a, 0xff, 0xce, 0xc1, 0xc6, 0x12, 0x29, 0xc6, 0x90, + 0xb3, 0xc9, 0x84, 0x59, 0x94, 0x76, 0x4a, 0x2a, 0xff, 0x8f, 0x65, 0x58, 0x71, 0x89, 0xfe, 0x88, + 0x8c, 0xa8, 0x9c, 0xe1, 0x70, 0xd4, 0xc4, 0xaf, 0x03, 0x18, 0xd4, 0xa5, 0xb6, 0x41, 0x6d, 0xfd, + 0x54, 0xce, 0x6e, 0x67, 0x77, 0x4a, 0x6a, 0x02, 0xc1, 0xef, 0xc0, 0xba, 0x3b, 0x3d, 0xb1, 0x4c, + 0x5d, 0x4b, 0xd0, 0x60, 0x3b, 0xbb, 0x93, 0x57, 0x91, 0x10, 0xb4, 0x66, 0xe4, 0xab, 0xb0, 0xf6, + 0x84, 0x92, 0x47, 0x49, 0x6a, 0x99, 0x53, 0xab, 0x0c, 0x4e, 0x10, 0x9b, 0x50, 0x99, 0x50, 0xdf, + 0x27, 0x23, 0xaa, 0x05, 0xa7, 0x2e, 0x95, 0x73, 0x7c, 0xf4, 0xdb, 0x0b, 0xa3, 0x9f, 0x1f, 0x79, + 0x39, 0xd4, 0x1a, 0x9c, 0xba, 0x14, 0x37, 0xa0, 0x44, 0xed, 0xe9, 0x44, 0x58, 0xc8, 0x9f, 0x11, + 0x3f, 0xc5, 0x9e, 0x4e, 0xe6, 0xad, 0x14, 0x99, 0x5a, 0x68, 0x62, 0xc5, 0xa7, 0xde, 0x63, 0x53, + 0xa7, 0x72, 0x81, 0x1b, 0xb8, 0xba, 0x60, 0xa0, 0x2f, 0xe4, 0xf3, 0x36, 0x22, 0x3d, 0xdc, 0x84, + 0x12, 0x7d, 0x1a, 0x50, 0xdb, 0x37, 0x1d, 0x5b, 0x5e, 0xe1, 0x46, 0xde, 0x5a, 0x32, 0x8b, 0xd4, + 0x32, 0xe6, 0x4d, 0xcc, 0xf4, 0xf0, 0x1d, 0x58, 0x71, 0xdc, 0xc0, 0x74, 0x6c, 0x5f, 0x2e, 0x6e, + 0x4b, 0x3b, 0xe5, 0x9b, 0xaf, 0x2e, 0x4d, 0x84, 0xae, 0xe0, 0xa8, 0x11, 0x19, 0xb7, 0x01, 0xf9, + 0xce, 0xd4, 0xd3, 0xa9, 0xa6, 0x3b, 0x06, 0xd5, 0x4c, 0x7b, 0xe8, 0xc8, 0x25, 0x6e, 0xe0, 0xf2, + 0xe2, 0x40, 0x38, 0xb1, 0xe9, 0x18, 0xb4, 0x6d, 0x0f, 0x1d, 0xb5, 0xea, 0xa7, 0xda, 0xf8, 0x02, + 0x14, 0xfc, 0x53, 0x3b, 0x20, 0x4f, 0xe5, 0x0a, 0xcf, 0x90, 0xb0, 0x55, 0xfb, 0x6b, 0x01, 0xd6, + 0xce, 0x93, 0x62, 0xf7, 0x20, 0x3f, 0x64, 0xa3, 0x94, 0x33, 0xdf, 0x26, 0x06, 0x42, 0x27, 0x1d, + 0xc4, 0xc2, 0x77, 0x0c, 0x62, 0x03, 0xca, 0x36, 0xf5, 0x03, 0x6a, 0x88, 0x8c, 0xc8, 0x9e, 0x33, + 0xa7, 0x40, 0x28, 0x2d, 0xa6, 0x54, 0xee, 0x3b, 0xa5, 0xd4, 0xa7, 0xb0, 0x16, 0xbb, 0xa4, 0x79, + 0xc4, 0x1e, 0x45, 0xb9, 0xb9, 0xfb, 0x3c, 0x4f, 0xea, 0x4a, 0xa4, 0xa7, 0x32, 0x35, 0xb5, 0x4a, + 0x53, 0x6d, 0xdc, 0x02, 0x70, 0x6c, 0xea, 0x0c, 0x35, 0x83, 0xea, 0x96, 0x5c, 0x3c, 0x23, 0x4a, + 0x5d, 0x46, 0x59, 0x88, 0x92, 0x23, 0x50, 0xdd, 0xc2, 0x1f, 0xce, 0x52, 0x6d, 0xe5, 0x8c, 0x4c, + 0x39, 0x12, 0x8b, 0x6c, 0x21, 0xdb, 0x8e, 0xa1, 0xea, 0x51, 0x96, 0xf7, 0xd4, 0x08, 0x47, 0x56, + 0xe2, 0x4e, 0xd4, 0x9f, 0x3b, 0x32, 0x35, 0x54, 0x13, 0x03, 0x5b, 0xf5, 0x92, 0x4d, 0xfc, 0x06, + 0xc4, 0x80, 0xc6, 0xd3, 0x0a, 0xf8, 0x2e, 0x54, 0x89, 0xc0, 0x0e, 0x99, 0xd0, 0xad, 0x2f, 0xa1, + 0x9a, 0x0e, 0x0f, 0xde, 0x84, 0xbc, 0x1f, 0x10, 0x2f, 0xe0, 0x59, 0x98, 0x57, 0x45, 0x03, 0x23, + 0xc8, 0x52, 0xdb, 0xe0, 0xbb, 0x5c, 0x5e, 0x65, 0x7f, 0xf1, 0x4f, 0x66, 0x03, 0xce, 0xf2, 0x01, + 0xbf, 0xbd, 0x38, 0xa3, 0x29, 0xcb, 0xf3, 0xe3, 0xde, 0xfa, 0x00, 0x56, 0x53, 0x03, 0x38, 0x6f, + 0xd7, 0xb5, 0x5f, 0xc2, 0xcb, 0x4b, 0x4d, 0xe3, 0x4f, 0x61, 0x73, 0x6a, 0x9b, 0x76, 0x40, 0x3d, + 0xd7, 0xa3, 0x2c, 0x63, 0x45, 0x57, 0xf2, 0x7f, 0x56, 0xce, 0xc8, 0xb9, 0xe3, 0x24, 0x5b, 0x58, + 0x51, 0x37, 0xa6, 0x8b, 0xe0, 0xf5, 0x52, 0xf1, 0xbf, 0x2b, 0xe8, 0xd9, 0xb3, 0x67, 0xcf, 0x32, + 0xb5, 0xdf, 0x15, 0x60, 0x73, 0xd9, 0x9a, 0x59, 0xba, 0x7c, 0x2f, 0x40, 0xc1, 0x9e, 0x4e, 0x4e, + 0xa8, 0xc7, 0x83, 0x94, 0x57, 0xc3, 0x16, 0x6e, 0x40, 0xde, 0x22, 0x27, 0xd4, 0x92, 0x73, 0xdb, + 0xd2, 0x4e, 0xf5, 0xe6, 0x3b, 0xe7, 0x5a, 0x95, 0xf5, 0x43, 0xa6, 0xa2, 0x0a, 0x4d, 0xfc, 0x11, + 0xe4, 0xc2, 0x2d, 0x9a, 0x59, 0xb8, 0x7e, 0x3e, 0x0b, 0x6c, 0x2d, 0xa9, 0x5c, 0x0f, 0xbf, 0x02, + 0x25, 0xf6, 0x2b, 0x72, 0xa3, 0xc0, 0x7d, 0x2e, 0x32, 0x80, 0xe5, 0x05, 0xde, 0x82, 0x22, 0x5f, + 0x26, 0x06, 0x8d, 0x8e, 0xb6, 0xb8, 0xcd, 0x12, 0xcb, 0xa0, 0x43, 0x32, 0xb5, 0x02, 0xed, 0x31, + 0xb1, 0xa6, 0x94, 0x27, 0x7c, 0x49, 0xad, 0x84, 0xe0, 0xcf, 0x19, 0x86, 0x2f, 0x43, 0x59, 0xac, + 0x2a, 0xd3, 0x36, 0xe8, 0x53, 0xbe, 0x7b, 0xe6, 0x55, 0xb1, 0xd0, 0xda, 0x0c, 0x61, 0xdd, 0x3f, + 0xf4, 0x1d, 0x3b, 0x4a, 0x4d, 0xde, 0x05, 0x03, 0x78, 0xf7, 0x1f, 0xcc, 0x6f, 0xdc, 0xaf, 0x2d, + 0x1f, 0xde, 0x7c, 0x4e, 0xd5, 0xfe, 0x92, 0x81, 0x1c, 0xdf, 0x2f, 0xd6, 0xa0, 0x3c, 0xf8, 0xac, + 0xa7, 0x68, 0xad, 0xee, 0xf1, 0xfe, 0xa1, 0x82, 0x24, 0x5c, 0x05, 0xe0, 0xc0, 0xfd, 0xc3, 0x6e, + 0x63, 0x80, 0x32, 0x71, 0xbb, 0xdd, 0x19, 0xdc, 0xb9, 0x85, 0xb2, 0xb1, 0xc2, 0xb1, 0x00, 0x72, + 0x49, 0xc2, 0xfb, 0x37, 0x51, 0x1e, 0x23, 0xa8, 0x08, 0x03, 0xed, 0x4f, 0x95, 0xd6, 0x9d, 0x5b, + 0xa8, 0x90, 0x46, 0xde, 0xbf, 0x89, 0x56, 0xf0, 0x2a, 0x94, 0x38, 0xb2, 0xdf, 0xed, 0x1e, 0xa2, + 0x62, 0x6c, 0xb3, 0x3f, 0x50, 0xdb, 0x9d, 0x03, 0x54, 0x8a, 0x6d, 0x1e, 0xa8, 0xdd, 0xe3, 0x1e, + 0x82, 0xd8, 0xc2, 0x91, 0xd2, 0xef, 0x37, 0x0e, 0x14, 0x54, 0x8e, 0x19, 0xfb, 0x9f, 0x0d, 0x94, + 0x3e, 0xaa, 0xa4, 0xdc, 0x7a, 0xff, 0x26, 0x5a, 0x8d, 0xbb, 0x50, 0x3a, 0xc7, 0x47, 0xa8, 0x8a, + 0xd7, 0x61, 0x55, 0x74, 0x11, 0x39, 0xb1, 0x36, 0x07, 0xdd, 0xb9, 0x85, 0xd0, 0xcc, 0x11, 0x61, + 0x65, 0x3d, 0x05, 0xdc, 0xb9, 0x85, 0x70, 0xad, 0x09, 0x79, 0x9e, 0x5d, 0x18, 0x43, 0xf5, 0xb0, + 0xb1, 0xaf, 0x1c, 0x6a, 0xdd, 0xde, 0xa0, 0xdd, 0xed, 0x34, 0x0e, 0x91, 0x34, 0xc3, 0x54, 0xe5, + 0x67, 0xc7, 0x6d, 0x55, 0x69, 0xa1, 0x4c, 0x12, 0xeb, 0x29, 0x8d, 0x81, 0xd2, 0x42, 0xd9, 0x9a, + 0x0e, 0x9b, 0xcb, 0xf6, 0xc9, 0xa5, 0x2b, 0x23, 0x31, 0xc5, 0x99, 0x33, 0xa6, 0x98, 0xdb, 0x5a, + 0x98, 0xe2, 0x7f, 0x65, 0x60, 0x63, 0xc9, 0x59, 0xb1, 0xb4, 0x93, 0x1f, 0x43, 0x5e, 0xa4, 0xa8, + 0x38, 0x3d, 0xaf, 0x2d, 0x3d, 0x74, 0x78, 0xc2, 0x2e, 0x9c, 0xa0, 0x5c, 0x2f, 0x59, 0x41, 0x64, + 0xcf, 0xa8, 0x20, 0x98, 0x89, 0x85, 0x3d, 0xfd, 0x17, 0x0b, 0x7b, 0xba, 0x38, 0xf6, 0xee, 0x9c, + 0xe7, 0xd8, 0xe3, 0xd8, 0xb7, 0xdb, 0xdb, 0xf3, 0x4b, 0xf6, 0xf6, 0x7b, 0xb0, 0xbe, 0x60, 0xe8, + 0xdc, 0x7b, 0xec, 0xaf, 0x24, 0x90, 0xcf, 0x0a, 0xce, 0x73, 0x76, 0xba, 0x4c, 0x6a, 0xa7, 0xbb, + 0x37, 0x1f, 0xc1, 0x2b, 0x67, 0x4f, 0xc2, 0xc2, 0x5c, 0x7f, 0x25, 0xc1, 0x85, 0xe5, 0x95, 0xe2, + 0x52, 0x1f, 0x3e, 0x82, 0xc2, 0x84, 0x06, 0x63, 0x27, 0xaa, 0x96, 0xde, 0x5e, 0x72, 0x06, 0x33, + 0xf1, 0xfc, 0x64, 0x87, 0x5a, 0xc9, 0x43, 0x3c, 0x7b, 0x56, 0xb9, 0x27, 0xbc, 0x59, 0xf0, 0xf4, + 0xd7, 0x19, 0x78, 0x79, 0xa9, 0xf1, 0xa5, 0x8e, 0xbe, 0x06, 0x60, 0xda, 0xee, 0x34, 0x10, 0x15, + 0x91, 0xd8, 0x60, 0x4b, 0x1c, 0xe1, 0x9b, 0x17, 0xdb, 0x3c, 0xa7, 0x41, 0x2c, 0xcf, 0x72, 0x39, + 0x08, 0x88, 0x13, 0xee, 0xce, 0x1c, 0xcd, 0x71, 0x47, 0x5f, 0x3f, 0x63, 0xa4, 0x0b, 0x89, 0xf9, + 0x1e, 0x20, 0xdd, 0x32, 0xa9, 0x1d, 0x68, 0x7e, 0xe0, 0x51, 0x32, 0x31, 0xed, 0x11, 0x3f, 0x41, + 0x8a, 0x7b, 0xf9, 0x21, 0xb1, 0x7c, 0xaa, 0xae, 0x09, 0x71, 0x3f, 0x92, 0x32, 0x0d, 0x9e, 0x40, + 0x5e, 0x42, 0xa3, 0x90, 0xd2, 0x10, 0xe2, 0x58, 0xa3, 0xf6, 0xdb, 0x12, 0x94, 0x13, 0x75, 0x35, + 0xbe, 0x02, 0x95, 0x87, 0xe4, 0x31, 0xd1, 0xa2, 0xbb, 0x92, 0x88, 0x44, 0x99, 0x61, 0xbd, 0xf0, + 0xbe, 0xf4, 0x1e, 0x6c, 0x72, 0x8a, 0x33, 0x0d, 0xa8, 0xa7, 0xe9, 0x16, 0xf1, 0x7d, 0x1e, 0xb4, + 0x22, 0xa7, 0x62, 0x26, 0xeb, 0x32, 0x51, 0x33, 0x92, 0xe0, 0xdb, 0xb0, 0xc1, 0x35, 0x26, 0x53, + 0x2b, 0x30, 0x5d, 0x8b, 0x6a, 0xec, 0xf6, 0xe6, 0xf3, 0x93, 0x24, 0xf6, 0x6c, 0x9d, 0x31, 0x8e, + 0x42, 0x02, 0xf3, 0xc8, 0xc7, 0x2d, 0x78, 0x8d, 0xab, 0x8d, 0xa8, 0x4d, 0x3d, 0x12, 0x50, 0x8d, + 0x7e, 0x31, 0x25, 0x96, 0xaf, 0x11, 0xdb, 0xd0, 0xc6, 0xc4, 0x1f, 0xcb, 0x9b, 0xcc, 0xc0, 0x7e, + 0x46, 0x96, 0xd4, 0x4b, 0x8c, 0x78, 0x10, 0xf2, 0x14, 0x4e, 0x6b, 0xd8, 0xc6, 0xc7, 0xc4, 0x1f, + 0xe3, 0x3d, 0xb8, 0xc0, 0xad, 0xf8, 0x81, 0x67, 0xda, 0x23, 0x4d, 0x1f, 0x53, 0xfd, 0x91, 0x36, + 0x0d, 0x86, 0x77, 0xe5, 0x57, 0x92, 0xfd, 0x73, 0x0f, 0xfb, 0x9c, 0xd3, 0x64, 0x94, 0xe3, 0x60, + 0x78, 0x17, 0xf7, 0xa1, 0xc2, 0x26, 0x63, 0x62, 0x7e, 0x49, 0xb5, 0xa1, 0xe3, 0xf1, 0xa3, 0xb1, + 0xba, 0x64, 0x6b, 0x4a, 0x44, 0xb0, 0xde, 0x0d, 0x15, 0x8e, 0x1c, 0x83, 0xee, 0xe5, 0xfb, 0x3d, + 0x45, 0x69, 0xa9, 0xe5, 0xc8, 0xca, 0x7d, 0xc7, 0x63, 0x09, 0x35, 0x72, 0xe2, 0x00, 0x97, 0x45, + 0x42, 0x8d, 0x9c, 0x28, 0xbc, 0xb7, 0x61, 0x43, 0xd7, 0xc5, 0x98, 0x4d, 0x5d, 0x0b, 0xef, 0x58, + 0xbe, 0x8c, 0x52, 0xc1, 0xd2, 0xf5, 0x03, 0x41, 0x08, 0x73, 0xdc, 0xc7, 0x1f, 0xc2, 0xcb, 0xb3, + 0x60, 0x25, 0x15, 0xd7, 0x17, 0x46, 0x39, 0xaf, 0x7a, 0x1b, 0x36, 0xdc, 0xd3, 0x45, 0x45, 0x9c, + 0xea, 0xd1, 0x3d, 0x9d, 0x57, 0xfb, 0x00, 0x36, 0xdd, 0xb1, 0xbb, 0xa8, 0x77, 0x3d, 0xa9, 0x87, + 0xdd, 0xb1, 0x3b, 0xaf, 0xf8, 0x16, 0xbf, 0x70, 0x7b, 0x54, 0x27, 0x01, 0x35, 0xe4, 0x8b, 0x49, + 0x7a, 0x42, 0x80, 0x77, 0x01, 0xe9, 0xba, 0x46, 0x6d, 0x72, 0x62, 0x51, 0x8d, 0x78, 0xd4, 0x26, + 0xbe, 0x7c, 0x39, 0x49, 0xae, 0xea, 0xba, 0xc2, 0xa5, 0x0d, 0x2e, 0xc4, 0xd7, 0x61, 0xdd, 0x39, + 0x79, 0xa8, 0x8b, 0x94, 0xd4, 0x5c, 0x8f, 0x0e, 0xcd, 0xa7, 0xf2, 0x9b, 0x3c, 0xbe, 0x6b, 0x4c, + 0xc0, 0x13, 0xb2, 0xc7, 0x61, 0x7c, 0x0d, 0x90, 0xee, 0x8f, 0x89, 0xe7, 0xf2, 0x3d, 0xd9, 0x77, + 0x89, 0x4e, 0xe5, 0xb7, 0x04, 0x55, 0xe0, 0x9d, 0x08, 0x66, 0x4b, 0xc2, 0x7f, 0x62, 0x0e, 0x83, + 0xc8, 0xe2, 0x55, 0xb1, 0x24, 0x38, 0x16, 0x5a, 0xdb, 0x01, 0xc4, 0x42, 0x91, 0xea, 0x78, 0x87, + 0xd3, 0xaa, 0xee, 0xd8, 0x4d, 0xf6, 0xfb, 0x06, 0xac, 0x32, 0xe6, 0xac, 0xd3, 0x6b, 0xa2, 0x20, + 0x73, 0xc7, 0x89, 0x1e, 0x6f, 0xc1, 0x05, 0x46, 0x9a, 0xd0, 0x80, 0x18, 0x24, 0x20, 0x09, 0xf6, + 0xbb, 0x9c, 0xcd, 0xe2, 0x7e, 0x14, 0x0a, 0x53, 0x7e, 0x7a, 0xd3, 0x93, 0xd3, 0x38, 0xb3, 0x6e, + 0x08, 0x3f, 0x19, 0x16, 0xe5, 0xd6, 0xf7, 0x56, 0x74, 0xd7, 0xf6, 0xa0, 0x92, 0x4c, 0x7c, 0x5c, + 0x02, 0x91, 0xfa, 0x48, 0x62, 0x55, 0x50, 0xb3, 0xdb, 0x62, 0xf5, 0xcb, 0xe7, 0x0a, 0xca, 0xb0, + 0x3a, 0xea, 0xb0, 0x3d, 0x50, 0x34, 0xf5, 0xb8, 0x33, 0x68, 0x1f, 0x29, 0x28, 0x9b, 0x28, 0xd8, + 0x1f, 0xe4, 0x8a, 0x6f, 0xa3, 0xab, 0xb5, 0xaf, 0x33, 0x50, 0x4d, 0xdf, 0xc0, 0xf0, 0x8f, 0xe0, + 0x62, 0xf4, 0x5c, 0xe2, 0xd3, 0x40, 0x7b, 0x62, 0x7a, 0x7c, 0x45, 0x4e, 0x88, 0x38, 0x1d, 0xe3, + 0x9c, 0xd8, 0x0c, 0x59, 0x7d, 0x1a, 0x7c, 0x62, 0x7a, 0x6c, 0xbd, 0x4d, 0x48, 0x80, 0x0f, 0xe1, + 0xb2, 0xed, 0x68, 0x7e, 0x40, 0x6c, 0x83, 0x78, 0x86, 0x36, 0x7b, 0xa8, 0xd2, 0x88, 0xae, 0x53, + 0xdf, 0x77, 0xc4, 0x49, 0x18, 0x5b, 0x79, 0xd5, 0x76, 0xfa, 0x21, 0x79, 0x76, 0x44, 0x34, 0x42, + 0xea, 0x5c, 0xfe, 0x66, 0xcf, 0xca, 0xdf, 0x57, 0xa0, 0x34, 0x21, 0xae, 0x46, 0xed, 0xc0, 0x3b, + 0xe5, 0x75, 0x77, 0x51, 0x2d, 0x4e, 0x88, 0xab, 0xb0, 0xf6, 0x0b, 0xb9, 0xfe, 0x3c, 0xc8, 0x15, + 0x8b, 0xa8, 0xf4, 0x20, 0x57, 0x2c, 0x21, 0xa8, 0xfd, 0x33, 0x0b, 0x95, 0x64, 0x1d, 0xce, 0xae, + 0x35, 0x3a, 0x3f, 0xb2, 0x24, 0xbe, 0xa9, 0xbd, 0xf1, 0x8d, 0x55, 0x7b, 0xbd, 0xc9, 0xce, 0xb2, + 0xbd, 0x82, 0xa8, 0x8e, 0x55, 0xa1, 0xc9, 0xea, 0x08, 0x96, 0x6c, 0x54, 0x54, 0x23, 0x45, 0x35, + 0x6c, 0xe1, 0x03, 0x28, 0x3c, 0xf4, 0xb9, 0xed, 0x02, 0xb7, 0xfd, 0xe6, 0x37, 0xdb, 0x7e, 0xd0, + 0xe7, 0xc6, 0x4b, 0x0f, 0xfa, 0x5a, 0xa7, 0xab, 0x1e, 0x35, 0x0e, 0xd5, 0x50, 0x1d, 0x5f, 0x82, + 0x9c, 0x45, 0xbe, 0x3c, 0x4d, 0x9f, 0x7a, 0x1c, 0x3a, 0xef, 0x24, 0x5c, 0x82, 0xdc, 0x13, 0x4a, + 0x1e, 0xa5, 0xcf, 0x1a, 0x0e, 0x7d, 0x8f, 0x8b, 0x61, 0x17, 0xf2, 0x3c, 0x5e, 0x18, 0x20, 0x8c, + 0x18, 0x7a, 0x09, 0x17, 0x21, 0xd7, 0xec, 0xaa, 0x6c, 0x41, 0x20, 0xa8, 0x08, 0x54, 0xeb, 0xb5, + 0x95, 0xa6, 0x82, 0x32, 0xb5, 0xdb, 0x50, 0x10, 0x41, 0x60, 0x8b, 0x25, 0x0e, 0x03, 0x7a, 0x29, + 0x6c, 0x86, 0x36, 0xa4, 0x48, 0x7a, 0x7c, 0xb4, 0xaf, 0xa8, 0x28, 0x93, 0x9e, 0xea, 0x1c, 0xca, + 0xd7, 0x7c, 0xa8, 0x24, 0x0b, 0xf1, 0x17, 0x73, 0xc9, 0xfe, 0x9b, 0x04, 0xe5, 0x44, 0x61, 0xcd, + 0x2a, 0x22, 0x62, 0x59, 0xce, 0x13, 0x8d, 0x58, 0x26, 0xf1, 0xc3, 0xd4, 0x00, 0x0e, 0x35, 0x18, + 0x72, 0xde, 0xa9, 0x7b, 0x41, 0x4b, 0x24, 0x8f, 0x0a, 0xb5, 0x3f, 0x4a, 0x80, 0xe6, 0x2b, 0xdb, + 0x39, 0x37, 0xa5, 0x1f, 0xd2, 0xcd, 0xda, 0x1f, 0x24, 0xa8, 0xa6, 0xcb, 0xd9, 0x39, 0xf7, 0xae, + 0xfc, 0xa0, 0xee, 0xfd, 0x23, 0x03, 0xab, 0xa9, 0x22, 0xf6, 0xbc, 0xde, 0x7d, 0x01, 0xeb, 0xa6, + 0x41, 0x27, 0xae, 0x13, 0x50, 0x5b, 0x3f, 0xd5, 0x2c, 0xfa, 0x98, 0x5a, 0x72, 0x8d, 0x6f, 0x1a, + 0xbb, 0xdf, 0x5c, 0x26, 0xd7, 0xdb, 0x33, 0xbd, 0x43, 0xa6, 0xb6, 0xb7, 0xd1, 0x6e, 0x29, 0x47, + 0xbd, 0xee, 0x40, 0xe9, 0x34, 0x3f, 0xd3, 0x8e, 0x3b, 0x3f, 0xed, 0x74, 0x3f, 0xe9, 0xa8, 0xc8, + 0x9c, 0xa3, 0x7d, 0x8f, 0xcb, 0xbe, 0x07, 0x68, 0xde, 0x29, 0x7c, 0x11, 0x96, 0xb9, 0x85, 0x5e, + 0xc2, 0x1b, 0xb0, 0xd6, 0xe9, 0x6a, 0xfd, 0x76, 0x4b, 0xd1, 0x94, 0xfb, 0xf7, 0x95, 0xe6, 0xa0, + 0x2f, 0x1e, 0x3e, 0x62, 0xf6, 0x20, 0xb5, 0xc0, 0x6b, 0xbf, 0xcf, 0xc2, 0xc6, 0x12, 0x4f, 0x70, + 0x23, 0xbc, 0xb2, 0x88, 0x5b, 0xd4, 0x8d, 0xf3, 0x78, 0x5f, 0x67, 0x35, 0x43, 0x8f, 0x78, 0x41, + 0x78, 0xc3, 0xb9, 0x06, 0x2c, 0x4a, 0x76, 0x60, 0x0e, 0x4d, 0xea, 0x85, 0xef, 0x44, 0xe2, 0x1e, + 0xb3, 0x36, 0xc3, 0xc5, 0x53, 0xd1, 0xbb, 0x80, 0x5d, 0xc7, 0x37, 0x03, 0xf3, 0x31, 0xd5, 0x4c, + 0x3b, 0x7a, 0x54, 0x62, 0xf7, 0x9a, 0x9c, 0x8a, 0x22, 0x49, 0xdb, 0x0e, 0x62, 0xb6, 0x4d, 0x47, + 0x64, 0x8e, 0xcd, 0x36, 0xf3, 0xac, 0x8a, 0x22, 0x49, 0xcc, 0xbe, 0x02, 0x15, 0xc3, 0x99, 0xb2, + 0x62, 0x4f, 0xf0, 0xd8, 0xd9, 0x21, 0xa9, 0x65, 0x81, 0xc5, 0x94, 0xb0, 0x8c, 0x9f, 0xbd, 0x66, + 0x55, 0xd4, 0xb2, 0xc0, 0x04, 0xe5, 0x2a, 0xac, 0x91, 0xd1, 0xc8, 0x63, 0xc6, 0x23, 0x43, 0xe2, + 0x62, 0x52, 0x8d, 0x61, 0x4e, 0xdc, 0x7a, 0x00, 0xc5, 0x28, 0x0e, 0xec, 0xa8, 0x66, 0x91, 0xd0, + 0x5c, 0x71, 0xdb, 0xce, 0xec, 0x94, 0xd4, 0xa2, 0x1d, 0x09, 0xaf, 0x40, 0xc5, 0xf4, 0xb5, 0xd9, + 0xe3, 0x7c, 0x66, 0x3b, 0xb3, 0x53, 0x54, 0xcb, 0xa6, 0x1f, 0x3f, 0x6c, 0xd6, 0xbe, 0xca, 0x40, + 0x35, 0xfd, 0x71, 0x01, 0xb7, 0xa0, 0x68, 0x39, 0x3a, 0xe1, 0xa9, 0x25, 0xbe, 0x6c, 0xed, 0x3c, + 0xe7, 0x7b, 0x44, 0xfd, 0x30, 0xe4, 0xab, 0xb1, 0xe6, 0xd6, 0xdf, 0x25, 0x28, 0x46, 0x30, 0xbe, + 0x00, 0x39, 0x97, 0x04, 0x63, 0x6e, 0x2e, 0xbf, 0x9f, 0x41, 0x92, 0xca, 0xdb, 0x0c, 0xf7, 0x5d, + 0x62, 0xf3, 0x14, 0x08, 0x71, 0xd6, 0x66, 0xf3, 0x6a, 0x51, 0x62, 0xf0, 0x5b, 0x8f, 0x33, 0x99, + 0x50, 0x3b, 0xf0, 0xa3, 0x79, 0x0d, 0xf1, 0x66, 0x08, 0xe3, 0x77, 0x60, 0x3d, 0xf0, 0x88, 0x69, + 0xa5, 0xb8, 0x39, 0xce, 0x45, 0x91, 0x20, 0x26, 0xef, 0xc1, 0xa5, 0xc8, 0xae, 0x41, 0x03, 0xa2, + 0x8f, 0xa9, 0x31, 0x53, 0x2a, 0xf0, 0xd7, 0x8d, 0x8b, 0x21, 0xa1, 0x15, 0xca, 0x23, 0xdd, 0xda, + 0xd7, 0x12, 0xac, 0x47, 0xf7, 0x34, 0x23, 0x0e, 0xd6, 0x11, 0x00, 0xb1, 0x6d, 0x27, 0x48, 0x86, + 0x6b, 0x31, 0x95, 0x17, 0xf4, 0xea, 0x8d, 0x58, 0x49, 0x4d, 0x18, 0xd8, 0x9a, 0x00, 0xcc, 0x24, + 0x67, 0x86, 0xed, 0x32, 0x94, 0xc3, 0x2f, 0x47, 0xfc, 0xf3, 0xa3, 0xb8, 0xd9, 0x83, 0x80, 0xd8, + 0x85, 0x0e, 0x6f, 0x42, 0xfe, 0x84, 0x8e, 0x4c, 0x3b, 0x7c, 0x0f, 0x16, 0x8d, 0xe8, 0xfd, 0x25, + 0x17, 0xbf, 0xbf, 0xec, 0xff, 0x46, 0x82, 0x0d, 0xdd, 0x99, 0xcc, 0xfb, 0xbb, 0x8f, 0xe6, 0x9e, + 0x17, 0xfc, 0x8f, 0xa5, 0xcf, 0x3f, 0x1a, 0x99, 0xc1, 0x78, 0x7a, 0x52, 0xd7, 0x9d, 0xc9, 0xee, + 0xc8, 0xb1, 0x88, 0x3d, 0x9a, 0x7d, 0x3f, 0xe5, 0x7f, 0xf4, 0x1b, 0x23, 0x6a, 0xdf, 0x18, 0x39, + 0x89, 0xaf, 0xa9, 0xf7, 0x66, 0x7f, 0xff, 0x27, 0x49, 0x7f, 0xca, 0x64, 0x0f, 0x7a, 0xfb, 0x7f, + 0xce, 0x6c, 0x1d, 0x88, 0xee, 0x7a, 0x51, 0x78, 0x54, 0x3a, 0xb4, 0xa8, 0xce, 0x86, 0xfc, 0xff, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x3e, 0xe8, 0xef, 0xc4, 0x9b, 0x1d, 0x00, 0x00, +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go new file mode 100644 index 00000000..6f4a902b --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/generator.go @@ -0,0 +1,2806 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2010 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* + The code generator for the plugin for the Google protocol buffer compiler. + It generates Go code from the protocol buffer description files read by the + main routine. +*/ +package generator + +import ( + "bufio" + "bytes" + "compress/gzip" + "crypto/sha256" + "encoding/hex" + "fmt" + "go/ast" + "go/build" + "go/parser" + "go/printer" + "go/token" + "log" + "os" + "path" + "sort" + "strconv" + "strings" + "unicode" + "unicode/utf8" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/protoc-gen-go/generator/internal/remap" + + "github.com/golang/protobuf/protoc-gen-go/descriptor" + plugin "github.com/golang/protobuf/protoc-gen-go/plugin" +) + +// generatedCodeVersion indicates a version of the generated code. +// It is incremented whenever an incompatibility between the generated code and +// proto package is introduced; the generated code references +// a constant, proto.ProtoPackageIsVersionN (where N is generatedCodeVersion). +const generatedCodeVersion = 3 + +// A Plugin provides functionality to add to the output during Go code generation, +// such as to produce RPC stubs. +type Plugin interface { + // Name identifies the plugin. + Name() string + // Init is called once after data structures are built but before + // code generation begins. + Init(g *Generator) + // Generate produces the code generated by the plugin for this file, + // except for the imports, by calling the generator's methods P, In, and Out. + Generate(file *FileDescriptor) + // GenerateImports produces the import declarations for this file. + // It is called after Generate. + GenerateImports(file *FileDescriptor) +} + +var plugins []Plugin + +// RegisterPlugin installs a (second-order) plugin to be run when the Go output is generated. +// It is typically called during initialization. +func RegisterPlugin(p Plugin) { + plugins = append(plugins, p) +} + +// A GoImportPath is the import path of a Go package. e.g., "google.golang.org/genproto/protobuf". +type GoImportPath string + +func (p GoImportPath) String() string { return strconv.Quote(string(p)) } + +// A GoPackageName is the name of a Go package. e.g., "protobuf". +type GoPackageName string + +// Each type we import as a protocol buffer (other than FileDescriptorProto) needs +// a pointer to the FileDescriptorProto that represents it. These types achieve that +// wrapping by placing each Proto inside a struct with the pointer to its File. The +// structs have the same names as their contents, with "Proto" removed. +// FileDescriptor is used to store the things that it points to. + +// The file and package name method are common to messages and enums. +type common struct { + file *FileDescriptor // File this object comes from. +} + +// GoImportPath is the import path of the Go package containing the type. +func (c *common) GoImportPath() GoImportPath { + return c.file.importPath +} + +func (c *common) File() *FileDescriptor { return c.file } + +func fileIsProto3(file *descriptor.FileDescriptorProto) bool { + return file.GetSyntax() == "proto3" +} + +func (c *common) proto3() bool { return fileIsProto3(c.file.FileDescriptorProto) } + +// Descriptor represents a protocol buffer message. +type Descriptor struct { + common + *descriptor.DescriptorProto + parent *Descriptor // The containing message, if any. + nested []*Descriptor // Inner messages, if any. + enums []*EnumDescriptor // Inner enums, if any. + ext []*ExtensionDescriptor // Extensions, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or another message. + path string // The SourceCodeInfo path as comma-separated integers. + group bool +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (d *Descriptor) TypeName() []string { + if d.typename != nil { + return d.typename + } + n := 0 + for parent := d; parent != nil; parent = parent.parent { + n++ + } + s := make([]string, n) + for parent := d; parent != nil; parent = parent.parent { + n-- + s[n] = parent.GetName() + } + d.typename = s + return s +} + +// EnumDescriptor describes an enum. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type EnumDescriptor struct { + common + *descriptor.EnumDescriptorProto + parent *Descriptor // The containing message, if any. + typename []string // Cached typename vector. + index int // The index into the container, whether the file or a message. + path string // The SourceCodeInfo path as comma-separated integers. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *EnumDescriptor) TypeName() (s []string) { + if e.typename != nil { + return e.typename + } + name := e.GetName() + if e.parent == nil { + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + e.typename = s + return s +} + +// Everything but the last element of the full type name, CamelCased. +// The values of type Foo.Bar are call Foo_value1... not Foo_Bar_value1... . +func (e *EnumDescriptor) prefix() string { + if e.parent == nil { + // If the enum is not part of a message, the prefix is just the type name. + return CamelCase(*e.Name) + "_" + } + typeName := e.TypeName() + return CamelCaseSlice(typeName[0:len(typeName)-1]) + "_" +} + +// The integer value of the named constant in this enumerated type. +func (e *EnumDescriptor) integerValueAsString(name string) string { + for _, c := range e.Value { + if c.GetName() == name { + return fmt.Sprint(c.GetNumber()) + } + } + log.Fatal("cannot find value for enum constant") + return "" +} + +// ExtensionDescriptor describes an extension. If it's at top level, its parent will be nil. +// Otherwise it will be the descriptor of the message in which it is defined. +type ExtensionDescriptor struct { + common + *descriptor.FieldDescriptorProto + parent *Descriptor // The containing message, if any. +} + +// TypeName returns the elements of the dotted type name. +// The package name is not part of this name. +func (e *ExtensionDescriptor) TypeName() (s []string) { + name := e.GetName() + if e.parent == nil { + // top-level extension + s = make([]string, 1) + } else { + pname := e.parent.TypeName() + s = make([]string, len(pname)+1) + copy(s, pname) + } + s[len(s)-1] = name + return s +} + +// DescName returns the variable name used for the generated descriptor. +func (e *ExtensionDescriptor) DescName() string { + // The full type name. + typeName := e.TypeName() + // Each scope of the extension is individually CamelCased, and all are joined with "_" with an "E_" prefix. + for i, s := range typeName { + typeName[i] = CamelCase(s) + } + return "E_" + strings.Join(typeName, "_") +} + +// ImportedDescriptor describes a type that has been publicly imported from another file. +type ImportedDescriptor struct { + common + o Object +} + +func (id *ImportedDescriptor) TypeName() []string { return id.o.TypeName() } + +// FileDescriptor describes an protocol buffer descriptor file (.proto). +// It includes slices of all the messages and enums defined within it. +// Those slices are constructed by WrapTypes. +type FileDescriptor struct { + *descriptor.FileDescriptorProto + desc []*Descriptor // All the messages defined in this file. + enum []*EnumDescriptor // All the enums defined in this file. + ext []*ExtensionDescriptor // All the top-level extensions defined in this file. + imp []*ImportedDescriptor // All types defined in files publicly imported by this file. + + // Comments, stored as a map of path (comma-separated integers) to the comment. + comments map[string]*descriptor.SourceCodeInfo_Location + + // The full list of symbols that are exported, + // as a map from the exported object to its symbols. + // This is used for supporting public imports. + exported map[Object][]symbol + + importPath GoImportPath // Import path of this file's package. + packageName GoPackageName // Name of this file's Go package. + + proto3 bool // whether to generate proto3 code for this file +} + +// VarName is the variable name we'll use in the generated code to refer +// to the compressed bytes of this descriptor. It is not exported, so +// it is only valid inside the generated package. +func (d *FileDescriptor) VarName() string { + h := sha256.Sum256([]byte(d.GetName())) + return fmt.Sprintf("fileDescriptor_%s", hex.EncodeToString(h[:8])) +} + +// goPackageOption interprets the file's go_package option. +// If there is no go_package, it returns ("", "", false). +// If there's a simple name, it returns ("", pkg, true). +// If the option implies an import path, it returns (impPath, pkg, true). +func (d *FileDescriptor) goPackageOption() (impPath GoImportPath, pkg GoPackageName, ok bool) { + opt := d.GetOptions().GetGoPackage() + if opt == "" { + return "", "", false + } + // A semicolon-delimited suffix delimits the import path and package name. + sc := strings.Index(opt, ";") + if sc >= 0 { + return GoImportPath(opt[:sc]), cleanPackageName(opt[sc+1:]), true + } + // The presence of a slash implies there's an import path. + slash := strings.LastIndex(opt, "/") + if slash >= 0 { + return GoImportPath(opt), cleanPackageName(opt[slash+1:]), true + } + return "", cleanPackageName(opt), true +} + +// goFileName returns the output name for the generated Go file. +func (d *FileDescriptor) goFileName(pathType pathType) string { + name := *d.Name + if ext := path.Ext(name); ext == ".proto" || ext == ".protodevel" { + name = name[:len(name)-len(ext)] + } + name += ".pb.go" + + if pathType == pathTypeSourceRelative { + return name + } + + // Does the file have a "go_package" option? + // If it does, it may override the filename. + if impPath, _, ok := d.goPackageOption(); ok && impPath != "" { + // Replace the existing dirname with the declared import path. + _, name = path.Split(name) + name = path.Join(string(impPath), name) + return name + } + + return name +} + +func (d *FileDescriptor) addExport(obj Object, sym symbol) { + d.exported[obj] = append(d.exported[obj], sym) +} + +// symbol is an interface representing an exported Go symbol. +type symbol interface { + // GenerateAlias should generate an appropriate alias + // for the symbol from the named package. + GenerateAlias(g *Generator, filename string, pkg GoPackageName) +} + +type messageSymbol struct { + sym string + hasExtensions, isMessageSet bool + oneofTypes []string +} + +type getterSymbol struct { + name string + typ string + typeName string // canonical name in proto world; empty for proto.Message and similar + genType bool // whether typ contains a generated type (message/group/enum) +} + +func (ms *messageSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + g.P("// ", ms.sym, " from public import ", filename) + g.P("type ", ms.sym, " = ", pkg, ".", ms.sym) + for _, name := range ms.oneofTypes { + g.P("type ", name, " = ", pkg, ".", name) + } +} + +type enumSymbol struct { + name string + proto3 bool // Whether this came from a proto3 file. +} + +func (es enumSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + s := es.name + g.P("// ", s, " from public import ", filename) + g.P("type ", s, " = ", pkg, ".", s) + g.P("var ", s, "_name = ", pkg, ".", s, "_name") + g.P("var ", s, "_value = ", pkg, ".", s, "_value") +} + +type constOrVarSymbol struct { + sym string + typ string // either "const" or "var" + cast string // if non-empty, a type cast is required (used for enums) +} + +func (cs constOrVarSymbol) GenerateAlias(g *Generator, filename string, pkg GoPackageName) { + v := string(pkg) + "." + cs.sym + if cs.cast != "" { + v = cs.cast + "(" + v + ")" + } + g.P(cs.typ, " ", cs.sym, " = ", v) +} + +// Object is an interface abstracting the abilities shared by enums, messages, extensions and imported objects. +type Object interface { + GoImportPath() GoImportPath + TypeName() []string + File() *FileDescriptor +} + +// Generator is the type whose methods generate the output, stored in the associated response structure. +type Generator struct { + *bytes.Buffer + + Request *plugin.CodeGeneratorRequest // The input. + Response *plugin.CodeGeneratorResponse // The output. + + Param map[string]string // Command-line parameters. + PackageImportPath string // Go import path of the package we're generating code for + ImportPrefix string // String to prefix to imported package file names. + ImportMap map[string]string // Mapping from .proto file name to import path + + Pkg map[string]string // The names under which we import support packages + + outputImportPath GoImportPath // Package we're generating code for. + allFiles []*FileDescriptor // All files in the tree + allFilesByName map[string]*FileDescriptor // All files by filename. + genFiles []*FileDescriptor // Those files we will generate output for. + file *FileDescriptor // The file we are compiling now. + packageNames map[GoImportPath]GoPackageName // Imported package names in the current file. + usedPackages map[GoImportPath]bool // Packages used in current file. + usedPackageNames map[GoPackageName]bool // Package names used in the current file. + addedImports map[GoImportPath]bool // Additional imports to emit. + typeNameToObject map[string]Object // Key is a fully-qualified name in input syntax. + init []string // Lines to emit in the init function. + indent string + pathType pathType // How to generate output filenames. + writeOutput bool + annotateCode bool // whether to store annotations + annotations []*descriptor.GeneratedCodeInfo_Annotation // annotations to store +} + +type pathType int + +const ( + pathTypeImport pathType = iota + pathTypeSourceRelative +) + +// New creates a new generator and allocates the request and response protobufs. +func New() *Generator { + g := new(Generator) + g.Buffer = new(bytes.Buffer) + g.Request = new(plugin.CodeGeneratorRequest) + g.Response = new(plugin.CodeGeneratorResponse) + return g +} + +// Error reports a problem, including an error, and exits the program. +func (g *Generator) Error(err error, msgs ...string) { + s := strings.Join(msgs, " ") + ":" + err.Error() + log.Print("protoc-gen-go: error:", s) + os.Exit(1) +} + +// Fail reports a problem and exits the program. +func (g *Generator) Fail(msgs ...string) { + s := strings.Join(msgs, " ") + log.Print("protoc-gen-go: error:", s) + os.Exit(1) +} + +// CommandLineParameters breaks the comma-separated list of key=value pairs +// in the parameter (a member of the request protobuf) into a key/value map. +// It then sets file name mappings defined by those entries. +func (g *Generator) CommandLineParameters(parameter string) { + g.Param = make(map[string]string) + for _, p := range strings.Split(parameter, ",") { + if i := strings.Index(p, "="); i < 0 { + g.Param[p] = "" + } else { + g.Param[p[0:i]] = p[i+1:] + } + } + + g.ImportMap = make(map[string]string) + pluginList := "none" // Default list of plugin names to enable (empty means all). + for k, v := range g.Param { + switch k { + case "import_prefix": + g.ImportPrefix = v + case "import_path": + g.PackageImportPath = v + case "paths": + switch v { + case "import": + g.pathType = pathTypeImport + case "source_relative": + g.pathType = pathTypeSourceRelative + default: + g.Fail(fmt.Sprintf(`Unknown path type %q: want "import" or "source_relative".`, v)) + } + case "plugins": + pluginList = v + case "annotate_code": + if v == "true" { + g.annotateCode = true + } + default: + if len(k) > 0 && k[0] == 'M' { + g.ImportMap[k[1:]] = v + } + } + } + if pluginList != "" { + // Amend the set of plugins. + enabled := make(map[string]bool) + for _, name := range strings.Split(pluginList, "+") { + enabled[name] = true + } + var nplugins []Plugin + for _, p := range plugins { + if enabled[p.Name()] { + nplugins = append(nplugins, p) + } + } + plugins = nplugins + } +} + +// DefaultPackageName returns the package name printed for the object. +// If its file is in a different package, it returns the package name we're using for this file, plus ".". +// Otherwise it returns the empty string. +func (g *Generator) DefaultPackageName(obj Object) string { + importPath := obj.GoImportPath() + if importPath == g.outputImportPath { + return "" + } + return string(g.GoPackageName(importPath)) + "." +} + +// GoPackageName returns the name used for a package. +func (g *Generator) GoPackageName(importPath GoImportPath) GoPackageName { + if name, ok := g.packageNames[importPath]; ok { + return name + } + name := cleanPackageName(baseName(string(importPath))) + for i, orig := 1, name; g.usedPackageNames[name] || isGoPredeclaredIdentifier[string(name)]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) + } + g.packageNames[importPath] = name + g.usedPackageNames[name] = true + return name +} + +// AddImport adds a package to the generated file's import section. +// It returns the name used for the package. +func (g *Generator) AddImport(importPath GoImportPath) GoPackageName { + g.addedImports[importPath] = true + return g.GoPackageName(importPath) +} + +var globalPackageNames = map[GoPackageName]bool{ + "fmt": true, + "math": true, + "proto": true, +} + +// Create and remember a guaranteed unique package name. Pkg is the candidate name. +// The FileDescriptor parameter is unused. +func RegisterUniquePackageName(pkg string, f *FileDescriptor) string { + name := cleanPackageName(pkg) + for i, orig := 1, name; globalPackageNames[name]; i++ { + name = orig + GoPackageName(strconv.Itoa(i)) + } + globalPackageNames[name] = true + return string(name) +} + +var isGoKeyword = map[string]bool{ + "break": true, + "case": true, + "chan": true, + "const": true, + "continue": true, + "default": true, + "else": true, + "defer": true, + "fallthrough": true, + "for": true, + "func": true, + "go": true, + "goto": true, + "if": true, + "import": true, + "interface": true, + "map": true, + "package": true, + "range": true, + "return": true, + "select": true, + "struct": true, + "switch": true, + "type": true, + "var": true, +} + +var isGoPredeclaredIdentifier = map[string]bool{ + "append": true, + "bool": true, + "byte": true, + "cap": true, + "close": true, + "complex": true, + "complex128": true, + "complex64": true, + "copy": true, + "delete": true, + "error": true, + "false": true, + "float32": true, + "float64": true, + "imag": true, + "int": true, + "int16": true, + "int32": true, + "int64": true, + "int8": true, + "iota": true, + "len": true, + "make": true, + "new": true, + "nil": true, + "panic": true, + "print": true, + "println": true, + "real": true, + "recover": true, + "rune": true, + "string": true, + "true": true, + "uint": true, + "uint16": true, + "uint32": true, + "uint64": true, + "uint8": true, + "uintptr": true, +} + +func cleanPackageName(name string) GoPackageName { + name = strings.Map(badToUnderscore, name) + // Identifier must not be keyword or predeclared identifier: insert _. + if isGoKeyword[name] { + name = "_" + name + } + // Identifier must not begin with digit: insert _. + if r, _ := utf8.DecodeRuneInString(name); unicode.IsDigit(r) { + name = "_" + name + } + return GoPackageName(name) +} + +// defaultGoPackage returns the package name to use, +// derived from the import path of the package we're building code for. +func (g *Generator) defaultGoPackage() GoPackageName { + p := g.PackageImportPath + if i := strings.LastIndex(p, "/"); i >= 0 { + p = p[i+1:] + } + return cleanPackageName(p) +} + +// SetPackageNames sets the package name for this run. +// The package name must agree across all files being generated. +// It also defines unique package names for all imported files. +func (g *Generator) SetPackageNames() { + g.outputImportPath = g.genFiles[0].importPath + + defaultPackageNames := make(map[GoImportPath]GoPackageName) + for _, f := range g.genFiles { + if _, p, ok := f.goPackageOption(); ok { + defaultPackageNames[f.importPath] = p + } + } + for _, f := range g.genFiles { + if _, p, ok := f.goPackageOption(); ok { + // Source file: option go_package = "quux/bar"; + f.packageName = p + } else if p, ok := defaultPackageNames[f.importPath]; ok { + // A go_package option in another file in the same package. + // + // This is a poor choice in general, since every source file should + // contain a go_package option. Supported mainly for historical + // compatibility. + f.packageName = p + } else if p := g.defaultGoPackage(); p != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets a package name for files which don't + // contain a go_package option. + f.packageName = p + } else if p := f.GetPackage(); p != "" { + // Source file: package quux.bar; + f.packageName = cleanPackageName(p) + } else { + // Source filename. + f.packageName = cleanPackageName(baseName(f.GetName())) + } + } + + // Check that all files have a consistent package name and import path. + for _, f := range g.genFiles[1:] { + if a, b := g.genFiles[0].importPath, f.importPath; a != b { + g.Fail(fmt.Sprintf("inconsistent package import paths: %v, %v", a, b)) + } + if a, b := g.genFiles[0].packageName, f.packageName; a != b { + g.Fail(fmt.Sprintf("inconsistent package names: %v, %v", a, b)) + } + } + + // Names of support packages. These never vary (if there are conflicts, + // we rename the conflicting package), so this could be removed someday. + g.Pkg = map[string]string{ + "fmt": "fmt", + "math": "math", + "proto": "proto", + } +} + +// WrapTypes walks the incoming data, wrapping DescriptorProtos, EnumDescriptorProtos +// and FileDescriptorProtos into file-referenced objects within the Generator. +// It also creates the list of files to generate and so should be called before GenerateAllFiles. +func (g *Generator) WrapTypes() { + g.allFiles = make([]*FileDescriptor, 0, len(g.Request.ProtoFile)) + g.allFilesByName = make(map[string]*FileDescriptor, len(g.allFiles)) + genFileNames := make(map[string]bool) + for _, n := range g.Request.FileToGenerate { + genFileNames[n] = true + } + for _, f := range g.Request.ProtoFile { + fd := &FileDescriptor{ + FileDescriptorProto: f, + exported: make(map[Object][]symbol), + proto3: fileIsProto3(f), + } + // The import path may be set in a number of ways. + if substitution, ok := g.ImportMap[f.GetName()]; ok { + // Command-line: M=foo.proto=quux/bar. + // + // Explicit mapping of source file to import path. + fd.importPath = GoImportPath(substitution) + } else if genFileNames[f.GetName()] && g.PackageImportPath != "" { + // Command-line: import_path=quux/bar. + // + // The import_path flag sets the import path for every file that + // we generate code for. + fd.importPath = GoImportPath(g.PackageImportPath) + } else if p, _, _ := fd.goPackageOption(); p != "" { + // Source file: option go_package = "quux/bar"; + // + // The go_package option sets the import path. Most users should use this. + fd.importPath = p + } else { + // Source filename. + // + // Last resort when nothing else is available. + fd.importPath = GoImportPath(path.Dir(f.GetName())) + } + // We must wrap the descriptors before we wrap the enums + fd.desc = wrapDescriptors(fd) + g.buildNestedDescriptors(fd.desc) + fd.enum = wrapEnumDescriptors(fd, fd.desc) + g.buildNestedEnums(fd.desc, fd.enum) + fd.ext = wrapExtensions(fd) + extractComments(fd) + g.allFiles = append(g.allFiles, fd) + g.allFilesByName[f.GetName()] = fd + } + for _, fd := range g.allFiles { + fd.imp = wrapImported(fd, g) + } + + g.genFiles = make([]*FileDescriptor, 0, len(g.Request.FileToGenerate)) + for _, fileName := range g.Request.FileToGenerate { + fd := g.allFilesByName[fileName] + if fd == nil { + g.Fail("could not find file named", fileName) + } + g.genFiles = append(g.genFiles, fd) + } +} + +// Scan the descriptors in this file. For each one, build the slice of nested descriptors +func (g *Generator) buildNestedDescriptors(descs []*Descriptor) { + for _, desc := range descs { + if len(desc.NestedType) != 0 { + for _, nest := range descs { + if nest.parent == desc { + desc.nested = append(desc.nested, nest) + } + } + if len(desc.nested) != len(desc.NestedType) { + g.Fail("internal error: nesting failure for", desc.GetName()) + } + } + } +} + +func (g *Generator) buildNestedEnums(descs []*Descriptor, enums []*EnumDescriptor) { + for _, desc := range descs { + if len(desc.EnumType) != 0 { + for _, enum := range enums { + if enum.parent == desc { + desc.enums = append(desc.enums, enum) + } + } + if len(desc.enums) != len(desc.EnumType) { + g.Fail("internal error: enum nesting failure for", desc.GetName()) + } + } + } +} + +// Construct the Descriptor +func newDescriptor(desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *Descriptor { + d := &Descriptor{ + common: common{file}, + DescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + d.path = fmt.Sprintf("%d,%d", messagePath, index) + } else { + d.path = fmt.Sprintf("%s,%d,%d", parent.path, messageMessagePath, index) + } + + // The only way to distinguish a group from a message is whether + // the containing message has a TYPE_GROUP field that matches. + if parent != nil { + parts := d.TypeName() + if file.Package != nil { + parts = append([]string{*file.Package}, parts...) + } + exp := "." + strings.Join(parts, ".") + for _, field := range parent.Field { + if field.GetType() == descriptor.FieldDescriptorProto_TYPE_GROUP && field.GetTypeName() == exp { + d.group = true + break + } + } + } + + for _, field := range desc.Extension { + d.ext = append(d.ext, &ExtensionDescriptor{common{file}, field, d}) + } + + return d +} + +// Return a slice of all the Descriptors defined within this file +func wrapDescriptors(file *FileDescriptor) []*Descriptor { + sl := make([]*Descriptor, 0, len(file.MessageType)+10) + for i, desc := range file.MessageType { + sl = wrapThisDescriptor(sl, desc, nil, file, i) + } + return sl +} + +// Wrap this Descriptor, recursively +func wrapThisDescriptor(sl []*Descriptor, desc *descriptor.DescriptorProto, parent *Descriptor, file *FileDescriptor, index int) []*Descriptor { + sl = append(sl, newDescriptor(desc, parent, file, index)) + me := sl[len(sl)-1] + for i, nested := range desc.NestedType { + sl = wrapThisDescriptor(sl, nested, me, file, i) + } + return sl +} + +// Construct the EnumDescriptor +func newEnumDescriptor(desc *descriptor.EnumDescriptorProto, parent *Descriptor, file *FileDescriptor, index int) *EnumDescriptor { + ed := &EnumDescriptor{ + common: common{file}, + EnumDescriptorProto: desc, + parent: parent, + index: index, + } + if parent == nil { + ed.path = fmt.Sprintf("%d,%d", enumPath, index) + } else { + ed.path = fmt.Sprintf("%s,%d,%d", parent.path, messageEnumPath, index) + } + return ed +} + +// Return a slice of all the EnumDescriptors defined within this file +func wrapEnumDescriptors(file *FileDescriptor, descs []*Descriptor) []*EnumDescriptor { + sl := make([]*EnumDescriptor, 0, len(file.EnumType)+10) + // Top-level enums. + for i, enum := range file.EnumType { + sl = append(sl, newEnumDescriptor(enum, nil, file, i)) + } + // Enums within messages. Enums within embedded messages appear in the outer-most message. + for _, nested := range descs { + for i, enum := range nested.EnumType { + sl = append(sl, newEnumDescriptor(enum, nested, file, i)) + } + } + return sl +} + +// Return a slice of all the top-level ExtensionDescriptors defined within this file. +func wrapExtensions(file *FileDescriptor) []*ExtensionDescriptor { + var sl []*ExtensionDescriptor + for _, field := range file.Extension { + sl = append(sl, &ExtensionDescriptor{common{file}, field, nil}) + } + return sl +} + +// Return a slice of all the types that are publicly imported into this file. +func wrapImported(file *FileDescriptor, g *Generator) (sl []*ImportedDescriptor) { + for _, index := range file.PublicDependency { + df := g.fileByName(file.Dependency[index]) + for _, d := range df.desc { + if d.GetOptions().GetMapEntry() { + continue + } + sl = append(sl, &ImportedDescriptor{common{file}, d}) + } + for _, e := range df.enum { + sl = append(sl, &ImportedDescriptor{common{file}, e}) + } + for _, ext := range df.ext { + sl = append(sl, &ImportedDescriptor{common{file}, ext}) + } + } + return +} + +func extractComments(file *FileDescriptor) { + file.comments = make(map[string]*descriptor.SourceCodeInfo_Location) + for _, loc := range file.GetSourceCodeInfo().GetLocation() { + if loc.LeadingComments == nil { + continue + } + var p []string + for _, n := range loc.Path { + p = append(p, strconv.Itoa(int(n))) + } + file.comments[strings.Join(p, ",")] = loc + } +} + +// BuildTypeNameMap builds the map from fully qualified type names to objects. +// The key names for the map come from the input data, which puts a period at the beginning. +// It should be called after SetPackageNames and before GenerateAllFiles. +func (g *Generator) BuildTypeNameMap() { + g.typeNameToObject = make(map[string]Object) + for _, f := range g.allFiles { + // The names in this loop are defined by the proto world, not us, so the + // package name may be empty. If so, the dotted package name of X will + // be ".X"; otherwise it will be ".pkg.X". + dottedPkg := "." + f.GetPackage() + if dottedPkg != "." { + dottedPkg += "." + } + for _, enum := range f.enum { + name := dottedPkg + dottedSlice(enum.TypeName()) + g.typeNameToObject[name] = enum + } + for _, desc := range f.desc { + name := dottedPkg + dottedSlice(desc.TypeName()) + g.typeNameToObject[name] = desc + } + } +} + +// ObjectNamed, given a fully-qualified input type name as it appears in the input data, +// returns the descriptor for the message or enum with that name. +func (g *Generator) ObjectNamed(typeName string) Object { + o, ok := g.typeNameToObject[typeName] + if !ok { + g.Fail("can't find object with type", typeName) + } + return o +} + +// AnnotatedAtoms is a list of atoms (as consumed by P) that records the file name and proto AST path from which they originated. +type AnnotatedAtoms struct { + source string + path string + atoms []interface{} +} + +// Annotate records the file name and proto AST path of a list of atoms +// so that a later call to P can emit a link from each atom to its origin. +func Annotate(file *FileDescriptor, path string, atoms ...interface{}) *AnnotatedAtoms { + return &AnnotatedAtoms{source: *file.Name, path: path, atoms: atoms} +} + +// printAtom prints the (atomic, non-annotation) argument to the generated output. +func (g *Generator) printAtom(v interface{}) { + switch v := v.(type) { + case string: + g.WriteString(v) + case *string: + g.WriteString(*v) + case bool: + fmt.Fprint(g, v) + case *bool: + fmt.Fprint(g, *v) + case int: + fmt.Fprint(g, v) + case *int32: + fmt.Fprint(g, *v) + case *int64: + fmt.Fprint(g, *v) + case float64: + fmt.Fprint(g, v) + case *float64: + fmt.Fprint(g, *v) + case GoPackageName: + g.WriteString(string(v)) + case GoImportPath: + g.WriteString(strconv.Quote(string(v))) + default: + g.Fail(fmt.Sprintf("unknown type in printer: %T", v)) + } +} + +// P prints the arguments to the generated output. It handles strings and int32s, plus +// handling indirections because they may be *string, etc. Any inputs of type AnnotatedAtoms may emit +// annotations in a .meta file in addition to outputting the atoms themselves (if g.annotateCode +// is true). +func (g *Generator) P(str ...interface{}) { + if !g.writeOutput { + return + } + g.WriteString(g.indent) + for _, v := range str { + switch v := v.(type) { + case *AnnotatedAtoms: + begin := int32(g.Len()) + for _, v := range v.atoms { + g.printAtom(v) + } + if g.annotateCode { + end := int32(g.Len()) + var path []int32 + for _, token := range strings.Split(v.path, ",") { + val, err := strconv.ParseInt(token, 10, 32) + if err != nil { + g.Fail("could not parse proto AST path: ", err.Error()) + } + path = append(path, int32(val)) + } + g.annotations = append(g.annotations, &descriptor.GeneratedCodeInfo_Annotation{ + Path: path, + SourceFile: &v.source, + Begin: &begin, + End: &end, + }) + } + default: + g.printAtom(v) + } + } + g.WriteByte('\n') +} + +// addInitf stores the given statement to be printed inside the file's init function. +// The statement is given as a format specifier and arguments. +func (g *Generator) addInitf(stmt string, a ...interface{}) { + g.init = append(g.init, fmt.Sprintf(stmt, a...)) +} + +// In Indents the output one tab stop. +func (g *Generator) In() { g.indent += "\t" } + +// Out unindents the output one tab stop. +func (g *Generator) Out() { + if len(g.indent) > 0 { + g.indent = g.indent[1:] + } +} + +// GenerateAllFiles generates the output for all the files we're outputting. +func (g *Generator) GenerateAllFiles() { + // Initialize the plugins + for _, p := range plugins { + p.Init(g) + } + // Generate the output. The generator runs for every file, even the files + // that we don't generate output for, so that we can collate the full list + // of exported symbols to support public imports. + genFileMap := make(map[*FileDescriptor]bool, len(g.genFiles)) + for _, file := range g.genFiles { + genFileMap[file] = true + } + for _, file := range g.allFiles { + g.Reset() + g.annotations = nil + g.writeOutput = genFileMap[file] + g.generate(file) + if !g.writeOutput { + continue + } + fname := file.goFileName(g.pathType) + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(fname), + Content: proto.String(g.String()), + }) + if g.annotateCode { + // Store the generated code annotations in text, as the protoc plugin protocol requires that + // strings contain valid UTF-8. + g.Response.File = append(g.Response.File, &plugin.CodeGeneratorResponse_File{ + Name: proto.String(file.goFileName(g.pathType) + ".meta"), + Content: proto.String(proto.CompactTextString(&descriptor.GeneratedCodeInfo{Annotation: g.annotations})), + }) + } + } +} + +// Run all the plugins associated with the file. +func (g *Generator) runPlugins(file *FileDescriptor) { + for _, p := range plugins { + p.Generate(file) + } +} + +// Fill the response protocol buffer with the generated output for all the files we're +// supposed to generate. +func (g *Generator) generate(file *FileDescriptor) { + g.file = file + g.usedPackages = make(map[GoImportPath]bool) + g.packageNames = make(map[GoImportPath]GoPackageName) + g.usedPackageNames = make(map[GoPackageName]bool) + g.addedImports = make(map[GoImportPath]bool) + for name := range globalPackageNames { + g.usedPackageNames[name] = true + } + + g.P("// This is a compile-time assertion to ensure that this generated file") + g.P("// is compatible with the proto package it is being compiled against.") + g.P("// A compilation error at this line likely means your copy of the") + g.P("// proto package needs to be updated.") + g.P("const _ = ", g.Pkg["proto"], ".ProtoPackageIsVersion", generatedCodeVersion, " // please upgrade the proto package") + g.P() + + for _, td := range g.file.imp { + g.generateImported(td) + } + for _, enum := range g.file.enum { + g.generateEnum(enum) + } + for _, desc := range g.file.desc { + // Don't generate virtual messages for maps. + if desc.GetOptions().GetMapEntry() { + continue + } + g.generateMessage(desc) + } + for _, ext := range g.file.ext { + g.generateExtension(ext) + } + g.generateInitFunction() + g.generateFileDescriptor(file) + + // Run the plugins before the imports so we know which imports are necessary. + g.runPlugins(file) + + // Generate header and imports last, though they appear first in the output. + rem := g.Buffer + remAnno := g.annotations + g.Buffer = new(bytes.Buffer) + g.annotations = nil + g.generateHeader() + g.generateImports() + if !g.writeOutput { + return + } + // Adjust the offsets for annotations displaced by the header and imports. + for _, anno := range remAnno { + *anno.Begin += int32(g.Len()) + *anno.End += int32(g.Len()) + g.annotations = append(g.annotations, anno) + } + g.Write(rem.Bytes()) + + // Reformat generated code and patch annotation locations. + fset := token.NewFileSet() + original := g.Bytes() + if g.annotateCode { + // make a copy independent of g; we'll need it after Reset. + original = append([]byte(nil), original...) + } + fileAST, err := parser.ParseFile(fset, "", original, parser.ParseComments) + if err != nil { + // Print out the bad code with line numbers. + // This should never happen in practice, but it can while changing generated code, + // so consider this a debugging aid. + var src bytes.Buffer + s := bufio.NewScanner(bytes.NewReader(original)) + for line := 1; s.Scan(); line++ { + fmt.Fprintf(&src, "%5d\t%s\n", line, s.Bytes()) + } + g.Fail("bad Go source code was generated:", err.Error(), "\n"+src.String()) + } + ast.SortImports(fset, fileAST) + g.Reset() + err = (&printer.Config{Mode: printer.TabIndent | printer.UseSpaces, Tabwidth: 8}).Fprint(g, fset, fileAST) + if err != nil { + g.Fail("generated Go source code could not be reformatted:", err.Error()) + } + if g.annotateCode { + m, err := remap.Compute(original, g.Bytes()) + if err != nil { + g.Fail("formatted generated Go source code could not be mapped back to the original code:", err.Error()) + } + for _, anno := range g.annotations { + new, ok := m.Find(int(*anno.Begin), int(*anno.End)) + if !ok { + g.Fail("span in formatted generated Go source code could not be mapped back to the original code") + } + *anno.Begin = int32(new.Pos) + *anno.End = int32(new.End) + } + } +} + +// Generate the header, including package definition +func (g *Generator) generateHeader() { + g.P("// Code generated by protoc-gen-go. DO NOT EDIT.") + if g.file.GetOptions().GetDeprecated() { + g.P("// ", g.file.Name, " is a deprecated file.") + } else { + g.P("// source: ", g.file.Name) + } + g.P() + g.PrintComments(strconv.Itoa(packagePath)) + g.P() + g.P("package ", g.file.packageName) + g.P() +} + +// deprecationComment is the standard comment added to deprecated +// messages, fields, enums, and enum values. +var deprecationComment = "// Deprecated: Do not use." + +// PrintComments prints any comments from the source .proto file. +// The path is a comma-separated list of integers. +// It returns an indication of whether any comments were printed. +// See descriptor.proto for its format. +func (g *Generator) PrintComments(path string) bool { + if !g.writeOutput { + return false + } + if c, ok := g.makeComments(path); ok { + g.P(c) + return true + } + return false +} + +// makeComments generates the comment string for the field, no "\n" at the end +func (g *Generator) makeComments(path string) (string, bool) { + loc, ok := g.file.comments[path] + if !ok { + return "", false + } + w := new(bytes.Buffer) + nl := "" + for _, line := range strings.Split(strings.TrimSuffix(loc.GetLeadingComments(), "\n"), "\n") { + fmt.Fprintf(w, "%s//%s", nl, line) + nl = "\n" + } + return w.String(), true +} + +func (g *Generator) fileByName(filename string) *FileDescriptor { + return g.allFilesByName[filename] +} + +// weak returns whether the ith import of the current file is a weak import. +func (g *Generator) weak(i int32) bool { + for _, j := range g.file.WeakDependency { + if j == i { + return true + } + } + return false +} + +// Generate the imports +func (g *Generator) generateImports() { + imports := make(map[GoImportPath]GoPackageName) + for i, s := range g.file.Dependency { + fd := g.fileByName(s) + importPath := fd.importPath + // Do not import our own package. + if importPath == g.file.importPath { + continue + } + // Do not import weak imports. + if g.weak(int32(i)) { + continue + } + // Do not import a package twice. + if _, ok := imports[importPath]; ok { + continue + } + // We need to import all the dependencies, even if we don't reference them, + // because other code and tools depend on having the full transitive closure + // of protocol buffer types in the binary. + packageName := g.GoPackageName(importPath) + if _, ok := g.usedPackages[importPath]; !ok { + packageName = "_" + } + imports[importPath] = packageName + } + for importPath := range g.addedImports { + imports[importPath] = g.GoPackageName(importPath) + } + // We almost always need a proto import. Rather than computing when we + // do, which is tricky when there's a plugin, just import it and + // reference it later. The same argument applies to the fmt and math packages. + g.P("import (") + g.P(g.Pkg["fmt"] + ` "fmt"`) + g.P(g.Pkg["math"] + ` "math"`) + g.P(g.Pkg["proto"]+" ", GoImportPath(g.ImportPrefix)+"github.com/golang/protobuf/proto") + for importPath, packageName := range imports { + g.P(packageName, " ", GoImportPath(g.ImportPrefix)+importPath) + } + g.P(")") + g.P() + // TODO: may need to worry about uniqueness across plugins + for _, p := range plugins { + p.GenerateImports(g.file) + g.P() + } + g.P("// Reference imports to suppress errors if they are not otherwise used.") + g.P("var _ = ", g.Pkg["proto"], ".Marshal") + g.P("var _ = ", g.Pkg["fmt"], ".Errorf") + g.P("var _ = ", g.Pkg["math"], ".Inf") + g.P() +} + +func (g *Generator) generateImported(id *ImportedDescriptor) { + df := id.o.File() + filename := *df.Name + if df.importPath == g.file.importPath { + // Don't generate type aliases for files in the same Go package as this one. + return + } + if !supportTypeAliases { + g.Fail(fmt.Sprintf("%s: public imports require at least go1.9", filename)) + } + g.usedPackages[df.importPath] = true + + for _, sym := range df.exported[id.o] { + sym.GenerateAlias(g, filename, g.GoPackageName(df.importPath)) + } + + g.P() +} + +// Generate the enum definitions for this EnumDescriptor. +func (g *Generator) generateEnum(enum *EnumDescriptor) { + // The full type name + typeName := enum.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + ccPrefix := enum.prefix() + + deprecatedEnum := "" + if enum.GetOptions().GetDeprecated() { + deprecatedEnum = deprecationComment + } + g.PrintComments(enum.path) + g.P("type ", Annotate(enum.file, enum.path, ccTypeName), " int32", deprecatedEnum) + g.file.addExport(enum, enumSymbol{ccTypeName, enum.proto3()}) + g.P("const (") + for i, e := range enum.Value { + etorPath := fmt.Sprintf("%s,%d,%d", enum.path, enumValuePath, i) + g.PrintComments(etorPath) + + deprecatedValue := "" + if e.GetOptions().GetDeprecated() { + deprecatedValue = deprecationComment + } + + name := ccPrefix + *e.Name + g.P(Annotate(enum.file, etorPath, name), " ", ccTypeName, " = ", e.Number, " ", deprecatedValue) + g.file.addExport(enum, constOrVarSymbol{name, "const", ccTypeName}) + } + g.P(")") + g.P() + g.P("var ", ccTypeName, "_name = map[int32]string{") + generated := make(map[int32]bool) // avoid duplicate values + for _, e := range enum.Value { + duplicate := "" + if _, present := generated[*e.Number]; present { + duplicate = "// Duplicate value: " + } + g.P(duplicate, e.Number, ": ", strconv.Quote(*e.Name), ",") + generated[*e.Number] = true + } + g.P("}") + g.P() + g.P("var ", ccTypeName, "_value = map[string]int32{") + for _, e := range enum.Value { + g.P(strconv.Quote(*e.Name), ": ", e.Number, ",") + } + g.P("}") + g.P() + + if !enum.proto3() { + g.P("func (x ", ccTypeName, ") Enum() *", ccTypeName, " {") + g.P("p := new(", ccTypeName, ")") + g.P("*p = x") + g.P("return p") + g.P("}") + g.P() + } + + g.P("func (x ", ccTypeName, ") String() string {") + g.P("return ", g.Pkg["proto"], ".EnumName(", ccTypeName, "_name, int32(x))") + g.P("}") + g.P() + + if !enum.proto3() { + g.P("func (x *", ccTypeName, ") UnmarshalJSON(data []byte) error {") + g.P("value, err := ", g.Pkg["proto"], ".UnmarshalJSONEnum(", ccTypeName, `_value, data, "`, ccTypeName, `")`) + g.P("if err != nil {") + g.P("return err") + g.P("}") + g.P("*x = ", ccTypeName, "(value)") + g.P("return nil") + g.P("}") + g.P() + } + + var indexes []string + for m := enum.parent; m != nil; m = m.parent { + // XXX: skip groups? + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + indexes = append(indexes, strconv.Itoa(enum.index)) + g.P("func (", ccTypeName, ") EnumDescriptor() ([]byte, []int) {") + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.P("}") + g.P() + if enum.file.GetPackage() == "google.protobuf" && enum.GetName() == "NullValue" { + g.P("func (", ccTypeName, `) XXX_WellKnownType() string { return "`, enum.GetName(), `" }`) + g.P() + } + + g.generateEnumRegistration(enum) +} + +// The tag is a string like "varint,2,opt,name=fieldname,def=7" that +// identifies details of the field for the protocol buffer marshaling and unmarshaling +// code. The fields are: +// wire encoding +// protocol tag number +// opt,req,rep for optional, required, or repeated +// packed whether the encoding is "packed" (optional; repeated primitives only) +// name= the original declared name +// enum= the name of the enum type if it is an enum-typed field. +// proto3 if this field is in a proto3 message +// def= string representation of the default value, if any. +// The default value must be in a representation that can be used at run-time +// to generate the default value. Thus bools become 0 and 1, for instance. +func (g *Generator) goTag(message *Descriptor, field *descriptor.FieldDescriptorProto, wiretype string) string { + optrepreq := "" + switch { + case isOptional(field): + optrepreq = "opt" + case isRequired(field): + optrepreq = "req" + case isRepeated(field): + optrepreq = "rep" + } + var defaultValue string + if dv := field.DefaultValue; dv != nil { // set means an explicit default + defaultValue = *dv + // Some types need tweaking. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + if defaultValue == "true" { + defaultValue = "1" + } else { + defaultValue = "0" + } + case descriptor.FieldDescriptorProto_TYPE_STRING, + descriptor.FieldDescriptorProto_TYPE_BYTES: + // Nothing to do. Quoting is done for the whole tag. + case descriptor.FieldDescriptorProto_TYPE_ENUM: + // For enums we need to provide the integer constant. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + // It is an enum that was publicly imported. + // We need the underlying type. + obj = id.o + } + enum, ok := obj.(*EnumDescriptor) + if !ok { + log.Printf("obj is a %T", obj) + if id, ok := obj.(*ImportedDescriptor); ok { + log.Printf("id.o is a %T", id.o) + } + g.Fail("unknown enum type", CamelCaseSlice(obj.TypeName())) + } + defaultValue = enum.integerValueAsString(defaultValue) + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 32); err == nil { + defaultValue = fmt.Sprint(float32(f)) + } + } + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if def := defaultValue; def != "inf" && def != "-inf" && def != "nan" { + if f, err := strconv.ParseFloat(defaultValue, 64); err == nil { + defaultValue = fmt.Sprint(f) + } + } + } + defaultValue = ",def=" + defaultValue + } + enum := "" + if *field.Type == descriptor.FieldDescriptorProto_TYPE_ENUM { + // We avoid using obj.GoPackageName(), because we want to use the + // original (proto-world) package name. + obj := g.ObjectNamed(field.GetTypeName()) + if id, ok := obj.(*ImportedDescriptor); ok { + obj = id.o + } + enum = ",enum=" + if pkg := obj.File().GetPackage(); pkg != "" { + enum += pkg + "." + } + enum += CamelCaseSlice(obj.TypeName()) + } + packed := "" + if (field.Options != nil && field.Options.GetPacked()) || + // Per https://developers.google.com/protocol-buffers/docs/proto3#simple: + // "In proto3, repeated fields of scalar numeric types use packed encoding by default." + (message.proto3() && (field.Options == nil || field.Options.Packed == nil) && + isRepeated(field) && isScalar(field)) { + packed = ",packed" + } + fieldName := field.GetName() + name := fieldName + if *field.Type == descriptor.FieldDescriptorProto_TYPE_GROUP { + // We must use the type name for groups instead of + // the field name to preserve capitalization. + // type_name in FieldDescriptorProto is fully-qualified, + // but we only want the local part. + name = *field.TypeName + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[i+1:] + } + } + if json := field.GetJsonName(); field.Extendee == nil && json != "" && json != name { + // TODO: escaping might be needed, in which case + // perhaps this should be in its own "json" tag. + name += ",json=" + json + } + name = ",name=" + name + if message.proto3() { + name += ",proto3" + } + oneof := "" + if field.OneofIndex != nil { + oneof = ",oneof" + } + return strconv.Quote(fmt.Sprintf("%s,%d,%s%s%s%s%s%s", + wiretype, + field.GetNumber(), + optrepreq, + packed, + name, + enum, + oneof, + defaultValue)) +} + +func needsStar(typ descriptor.FieldDescriptorProto_Type) bool { + switch typ { + case descriptor.FieldDescriptorProto_TYPE_GROUP: + return false + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + return false + case descriptor.FieldDescriptorProto_TYPE_BYTES: + return false + } + return true +} + +// TypeName is the printed name appropriate for an item. If the object is in the current file, +// TypeName drops the package name and underscores the rest. +// Otherwise the object is from another package; and the result is the underscored +// package name followed by the item name. +// The result always has an initial capital. +func (g *Generator) TypeName(obj Object) string { + return g.DefaultPackageName(obj) + CamelCaseSlice(obj.TypeName()) +} + +// GoType returns a string representing the type name, and the wire type +func (g *Generator) GoType(message *Descriptor, field *descriptor.FieldDescriptorProto) (typ string, wire string) { + // TODO: Options. + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE: + typ, wire = "float64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FLOAT: + typ, wire = "float32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_INT64: + typ, wire = "int64", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT64: + typ, wire = "uint64", "varint" + case descriptor.FieldDescriptorProto_TYPE_INT32: + typ, wire = "int32", "varint" + case descriptor.FieldDescriptorProto_TYPE_UINT32: + typ, wire = "uint32", "varint" + case descriptor.FieldDescriptorProto_TYPE_FIXED64: + typ, wire = "uint64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_FIXED32: + typ, wire = "uint32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_BOOL: + typ, wire = "bool", "varint" + case descriptor.FieldDescriptorProto_TYPE_STRING: + typ, wire = "string", "bytes" + case descriptor.FieldDescriptorProto_TYPE_GROUP: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = "*"+g.TypeName(desc), "group" + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = "*"+g.TypeName(desc), "bytes" + case descriptor.FieldDescriptorProto_TYPE_BYTES: + typ, wire = "[]byte", "bytes" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + desc := g.ObjectNamed(field.GetTypeName()) + typ, wire = g.TypeName(desc), "varint" + case descriptor.FieldDescriptorProto_TYPE_SFIXED32: + typ, wire = "int32", "fixed32" + case descriptor.FieldDescriptorProto_TYPE_SFIXED64: + typ, wire = "int64", "fixed64" + case descriptor.FieldDescriptorProto_TYPE_SINT32: + typ, wire = "int32", "zigzag32" + case descriptor.FieldDescriptorProto_TYPE_SINT64: + typ, wire = "int64", "zigzag64" + default: + g.Fail("unknown type for", field.GetName()) + } + if isRepeated(field) { + typ = "[]" + typ + } else if message != nil && message.proto3() { + return + } else if field.OneofIndex != nil && message != nil { + return + } else if needsStar(*field.Type) { + typ = "*" + typ + } + return +} + +func (g *Generator) RecordTypeUse(t string) { + if _, ok := g.typeNameToObject[t]; !ok { + return + } + importPath := g.ObjectNamed(t).GoImportPath() + if importPath == g.outputImportPath { + // Don't record use of objects in our package. + return + } + g.AddImport(importPath) + g.usedPackages[importPath] = true +} + +// Method names that may be generated. Fields with these names get an +// underscore appended. Any change to this set is a potential incompatible +// API change because it changes generated field names. +var methodNames = [...]string{ + "Reset", + "String", + "ProtoMessage", + "Marshal", + "Unmarshal", + "ExtensionRangeArray", + "ExtensionMap", + "Descriptor", +} + +// Names of messages in the `google.protobuf` package for which +// we will generate XXX_WellKnownType methods. +var wellKnownTypes = map[string]bool{ + "Any": true, + "Duration": true, + "Empty": true, + "Struct": true, + "Timestamp": true, + + "Value": true, + "ListValue": true, + "DoubleValue": true, + "FloatValue": true, + "Int64Value": true, + "UInt64Value": true, + "Int32Value": true, + "UInt32Value": true, + "BoolValue": true, + "StringValue": true, + "BytesValue": true, +} + +// getterDefault finds the default value for the field to return from a getter, +// regardless of if it's a built in default or explicit from the source. Returns e.g. "nil", `""`, "Default_MessageType_FieldName" +func (g *Generator) getterDefault(field *descriptor.FieldDescriptorProto, goMessageType string) string { + if isRepeated(field) { + return "nil" + } + if def := field.GetDefaultValue(); def != "" { + defaultConstant := g.defaultConstantName(goMessageType, field.GetName()) + if *field.Type != descriptor.FieldDescriptorProto_TYPE_BYTES { + return defaultConstant + } + return "append([]byte(nil), " + defaultConstant + "...)" + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_BOOL: + return "false" + case descriptor.FieldDescriptorProto_TYPE_STRING: + return `""` + case descriptor.FieldDescriptorProto_TYPE_GROUP, descriptor.FieldDescriptorProto_TYPE_MESSAGE, descriptor.FieldDescriptorProto_TYPE_BYTES: + return "nil" + case descriptor.FieldDescriptorProto_TYPE_ENUM: + obj := g.ObjectNamed(field.GetTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate getter for %s", field.GetName()) + return "nil" + } + if len(enum.Value) == 0 { + return "0 // empty enum" + } + first := enum.Value[0].GetName() + return g.DefaultPackageName(obj) + enum.prefix() + first + default: + return "0" + } +} + +// defaultConstantName builds the name of the default constant from the message +// type name and the untouched field name, e.g. "Default_MessageType_FieldName" +func (g *Generator) defaultConstantName(goMessageType, protoFieldName string) string { + return "Default_" + goMessageType + "_" + CamelCase(protoFieldName) +} + +// The different types of fields in a message and how to actually print them +// Most of the logic for generateMessage is in the methods of these types. +// +// Note that the content of the field is irrelevant, a simpleField can contain +// anything from a scalar to a group (which is just a message). +// +// Extension fields (and message sets) are however handled separately. +// +// simpleField - a field that is neiter weak nor oneof, possibly repeated +// oneofField - field containing list of subfields: +// - oneofSubField - a field within the oneof + +// msgCtx contains the context for the generator functions. +type msgCtx struct { + goName string // Go struct name of the message, e.g. MessageName + message *Descriptor // The descriptor for the message +} + +// fieldCommon contains data common to all types of fields. +type fieldCommon struct { + goName string // Go name of field, e.g. "FieldName" or "Descriptor_" + protoName string // Name of field in proto language, e.g. "field_name" or "descriptor" + getterName string // Name of the getter, e.g. "GetFieldName" or "GetDescriptor_" + goType string // The Go type as a string, e.g. "*int32" or "*OtherMessage" + tags string // The tag string/annotation for the type, e.g. `protobuf:"varint,8,opt,name=region_id,json=regionId"` + fullPath string // The full path of the field as used by Annotate etc, e.g. "4,0,2,0" +} + +// getProtoName gets the proto name of a field, e.g. "field_name" or "descriptor". +func (f *fieldCommon) getProtoName() string { + return f.protoName +} + +// getGoType returns the go type of the field as a string, e.g. "*int32". +func (f *fieldCommon) getGoType() string { + return f.goType +} + +// simpleField is not weak, not a oneof, not an extension. Can be required, optional or repeated. +type simpleField struct { + fieldCommon + protoTypeName string // Proto type name, empty if primitive, e.g. ".google.protobuf.Duration" + protoType descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 + deprecated string // Deprecation comment, if any, e.g. "// Deprecated: Do not use." + getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" + protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" + comment string // The full comment for the field, e.g. "// Useful information" +} + +// decl prints the declaration of the field in the struct (if any). +func (f *simpleField) decl(g *Generator, mc *msgCtx) { + g.P(f.comment, Annotate(mc.message.file, f.fullPath, f.goName), "\t", f.goType, "\t`", f.tags, "`", f.deprecated) +} + +// getter prints the getter for the field. +func (f *simpleField) getter(g *Generator, mc *msgCtx) { + star := "" + tname := f.goType + if needsStar(f.protoType) && tname[0] == '*' { + tname = tname[1:] + star = "*" + } + if f.deprecated != "" { + g.P(f.deprecated) + } + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, f.fullPath, f.getterName), "() "+tname+" {") + if f.getterDef == "nil" { // Simpler getter + g.P("if m != nil {") + g.P("return m." + f.goName) + g.P("}") + g.P("return nil") + g.P("}") + g.P() + return + } + if mc.message.proto3() { + g.P("if m != nil {") + } else { + g.P("if m != nil && m." + f.goName + " != nil {") + } + g.P("return " + star + "m." + f.goName) + g.P("}") + g.P("return ", f.getterDef) + g.P("}") + g.P() +} + +// setter prints the setter method of the field. +func (f *simpleField) setter(g *Generator, mc *msgCtx) { + // No setter for regular fields yet +} + +// getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". +func (f *simpleField) getProtoDef() string { + return f.protoDef +} + +// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. ".google.protobuf.Duration". +func (f *simpleField) getProtoTypeName() string { + return f.protoTypeName +} + +// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64. +func (f *simpleField) getProtoType() descriptor.FieldDescriptorProto_Type { + return f.protoType +} + +// oneofSubFields are kept slize held by each oneofField. They do not appear in the top level slize of fields for the message. +type oneofSubField struct { + fieldCommon + protoTypeName string // Proto type name, empty if primitive, e.g. ".google.protobuf.Duration" + protoType descriptor.FieldDescriptorProto_Type // Actual type enum value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 + oneofTypeName string // Type name of the enclosing struct, e.g. "MessageName_FieldName" + fieldNumber int // Actual field number, as defined in proto, e.g. 12 + getterDef string // Default for getters, e.g. "nil", `""` or "Default_MessageType_FieldName" + protoDef string // Default value as defined in the proto file, e.g "yoshi" or "5" + deprecated string // Deprecation comment, if any. +} + +// typedNil prints a nil casted to the pointer to this field. +// - for XXX_OneofWrappers +func (f *oneofSubField) typedNil(g *Generator) { + g.P("(*", f.oneofTypeName, ")(nil),") +} + +// getProtoDef returns the default value explicitly stated in the proto file, e.g "yoshi" or "5". +func (f *oneofSubField) getProtoDef() string { + return f.protoDef +} + +// getProtoTypeName returns the protobuf type name for the field as returned by field.GetTypeName(), e.g. ".google.protobuf.Duration". +func (f *oneofSubField) getProtoTypeName() string { + return f.protoTypeName +} + +// getProtoType returns the *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64. +func (f *oneofSubField) getProtoType() descriptor.FieldDescriptorProto_Type { + return f.protoType +} + +// oneofField represents the oneof on top level. +// The alternative fields within the oneof are represented by oneofSubField. +type oneofField struct { + fieldCommon + subFields []*oneofSubField // All the possible oneof fields + comment string // The full comment for the field, e.g. "// Types that are valid to be assigned to MyOneof:\n\\" +} + +// decl prints the declaration of the field in the struct (if any). +func (f *oneofField) decl(g *Generator, mc *msgCtx) { + comment := f.comment + for _, sf := range f.subFields { + comment += "//\t*" + sf.oneofTypeName + "\n" + } + g.P(comment, Annotate(mc.message.file, f.fullPath, f.goName), " ", f.goType, " `", f.tags, "`") +} + +// getter for a oneof field will print additional discriminators and interfaces for the oneof, +// also it prints all the getters for the sub fields. +func (f *oneofField) getter(g *Generator, mc *msgCtx) { + // The discriminator type + g.P("type ", f.goType, " interface {") + g.P(f.goType, "()") + g.P("}") + g.P() + // The subField types, fulfilling the discriminator type contract + for _, sf := range f.subFields { + g.P("type ", Annotate(mc.message.file, sf.fullPath, sf.oneofTypeName), " struct {") + g.P(Annotate(mc.message.file, sf.fullPath, sf.goName), " ", sf.goType, " `", sf.tags, "`") + g.P("}") + g.P() + } + for _, sf := range f.subFields { + g.P("func (*", sf.oneofTypeName, ") ", f.goType, "() {}") + g.P() + } + // Getter for the oneof field + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, f.fullPath, f.getterName), "() ", f.goType, " {") + g.P("if m != nil { return m.", f.goName, " }") + g.P("return nil") + g.P("}") + g.P() + // Getters for each oneof + for _, sf := range f.subFields { + if sf.deprecated != "" { + g.P(sf.deprecated) + } + g.P("func (m *", mc.goName, ") ", Annotate(mc.message.file, sf.fullPath, sf.getterName), "() "+sf.goType+" {") + g.P("if x, ok := m.", f.getterName, "().(*", sf.oneofTypeName, "); ok {") + g.P("return x.", sf.goName) + g.P("}") + g.P("return ", sf.getterDef) + g.P("}") + g.P() + } +} + +// setter prints the setter method of the field. +func (f *oneofField) setter(g *Generator, mc *msgCtx) { + // No setters for oneof yet +} + +// topLevelField interface implemented by all types of fields on the top level (not oneofSubField). +type topLevelField interface { + decl(g *Generator, mc *msgCtx) // print declaration within the struct + getter(g *Generator, mc *msgCtx) // print getter + setter(g *Generator, mc *msgCtx) // print setter if applicable +} + +// defField interface implemented by all types of fields that can have defaults (not oneofField, but instead oneofSubField). +type defField interface { + getProtoDef() string // default value explicitly stated in the proto file, e.g "yoshi" or "5" + getProtoName() string // proto name of a field, e.g. "field_name" or "descriptor" + getGoType() string // go type of the field as a string, e.g. "*int32" + getProtoTypeName() string // protobuf type name for the field, e.g. ".google.protobuf.Duration" + getProtoType() descriptor.FieldDescriptorProto_Type // *field.Type value, e.g. descriptor.FieldDescriptorProto_TYPE_FIXED64 +} + +// generateDefaultConstants adds constants for default values if needed, which is only if the default value is. +// explicit in the proto. +func (g *Generator) generateDefaultConstants(mc *msgCtx, topLevelFields []topLevelField) { + // Collect fields that can have defaults + dFields := []defField{} + for _, pf := range topLevelFields { + if f, ok := pf.(*oneofField); ok { + for _, osf := range f.subFields { + dFields = append(dFields, osf) + } + continue + } + dFields = append(dFields, pf.(defField)) + } + for _, df := range dFields { + def := df.getProtoDef() + if def == "" { + continue + } + fieldname := g.defaultConstantName(mc.goName, df.getProtoName()) + typename := df.getGoType() + if typename[0] == '*' { + typename = typename[1:] + } + kind := "const " + switch { + case typename == "bool": + case typename == "string": + def = strconv.Quote(def) + case typename == "[]byte": + def = "[]byte(" + strconv.Quote(unescape(def)) + ")" + kind = "var " + case def == "inf", def == "-inf", def == "nan": + // These names are known to, and defined by, the protocol language. + switch def { + case "inf": + def = "math.Inf(1)" + case "-inf": + def = "math.Inf(-1)" + case "nan": + def = "math.NaN()" + } + if df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT { + def = "float32(" + def + ")" + } + kind = "var " + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_FLOAT: + if f, err := strconv.ParseFloat(def, 32); err == nil { + def = fmt.Sprint(float32(f)) + } + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_DOUBLE: + if f, err := strconv.ParseFloat(def, 64); err == nil { + def = fmt.Sprint(f) + } + case df.getProtoType() == descriptor.FieldDescriptorProto_TYPE_ENUM: + // Must be an enum. Need to construct the prefixed name. + obj := g.ObjectNamed(df.getProtoTypeName()) + var enum *EnumDescriptor + if id, ok := obj.(*ImportedDescriptor); ok { + // The enum type has been publicly imported. + enum, _ = id.o.(*EnumDescriptor) + } else { + enum, _ = obj.(*EnumDescriptor) + } + if enum == nil { + log.Printf("don't know how to generate constant for %s", fieldname) + continue + } + def = g.DefaultPackageName(obj) + enum.prefix() + def + } + g.P(kind, fieldname, " ", typename, " = ", def) + g.file.addExport(mc.message, constOrVarSymbol{fieldname, kind, ""}) + } + g.P() +} + +// generateInternalStructFields just adds the XXX_ fields to the message struct. +func (g *Generator) generateInternalStructFields(mc *msgCtx, topLevelFields []topLevelField) { + g.P("XXX_NoUnkeyedLiteral\tstruct{} `json:\"-\"`") // prevent unkeyed struct literals + if len(mc.message.ExtensionRange) > 0 { + messageset := "" + if opts := mc.message.Options; opts != nil && opts.GetMessageSetWireFormat() { + messageset = "protobuf_messageset:\"1\" " + } + g.P(g.Pkg["proto"], ".XXX_InternalExtensions `", messageset, "json:\"-\"`") + } + g.P("XXX_unrecognized\t[]byte `json:\"-\"`") + g.P("XXX_sizecache\tint32 `json:\"-\"`") + +} + +// generateOneofFuncs adds all the utility functions for oneof, including marshalling, unmarshalling and sizer. +func (g *Generator) generateOneofFuncs(mc *msgCtx, topLevelFields []topLevelField) { + ofields := []*oneofField{} + for _, f := range topLevelFields { + if o, ok := f.(*oneofField); ok { + ofields = append(ofields, o) + } + } + if len(ofields) == 0 { + return + } + + // OneofFuncs + g.P("// XXX_OneofWrappers is for the internal use of the proto package.") + g.P("func (*", mc.goName, ") XXX_OneofWrappers() []interface{} {") + g.P("return []interface{}{") + for _, of := range ofields { + for _, sf := range of.subFields { + sf.typedNil(g) + } + } + g.P("}") + g.P("}") + g.P() +} + +// generateMessageStruct adds the actual struct with it's members (but not methods) to the output. +func (g *Generator) generateMessageStruct(mc *msgCtx, topLevelFields []topLevelField) { + comments := g.PrintComments(mc.message.path) + + // Guarantee deprecation comments appear after user-provided comments. + if mc.message.GetOptions().GetDeprecated() { + if comments { + // Convention: Separate deprecation comments from original + // comments with an empty line. + g.P("//") + } + g.P(deprecationComment) + } + + g.P("type ", Annotate(mc.message.file, mc.message.path, mc.goName), " struct {") + for _, pf := range topLevelFields { + pf.decl(g, mc) + } + g.generateInternalStructFields(mc, topLevelFields) + g.P("}") +} + +// generateGetters adds getters for all fields, including oneofs and weak fields when applicable. +func (g *Generator) generateGetters(mc *msgCtx, topLevelFields []topLevelField) { + for _, pf := range topLevelFields { + pf.getter(g, mc) + } +} + +// generateSetters add setters for all fields, including oneofs and weak fields when applicable. +func (g *Generator) generateSetters(mc *msgCtx, topLevelFields []topLevelField) { + for _, pf := range topLevelFields { + pf.setter(g, mc) + } +} + +// generateCommonMethods adds methods to the message that are not on a per field basis. +func (g *Generator) generateCommonMethods(mc *msgCtx) { + // Reset, String and ProtoMessage methods. + g.P("func (m *", mc.goName, ") Reset() { *m = ", mc.goName, "{} }") + g.P("func (m *", mc.goName, ") String() string { return ", g.Pkg["proto"], ".CompactTextString(m) }") + g.P("func (*", mc.goName, ") ProtoMessage() {}") + var indexes []string + for m := mc.message; m != nil; m = m.parent { + indexes = append([]string{strconv.Itoa(m.index)}, indexes...) + } + g.P("func (*", mc.goName, ") Descriptor() ([]byte, []int) {") + g.P("return ", g.file.VarName(), ", []int{", strings.Join(indexes, ", "), "}") + g.P("}") + g.P() + // TODO: Revisit the decision to use a XXX_WellKnownType method + // if we change proto.MessageName to work with multiple equivalents. + if mc.message.file.GetPackage() == "google.protobuf" && wellKnownTypes[mc.message.GetName()] { + g.P("func (*", mc.goName, `) XXX_WellKnownType() string { return "`, mc.message.GetName(), `" }`) + g.P() + } + + // Extension support methods + if len(mc.message.ExtensionRange) > 0 { + g.P() + g.P("var extRange_", mc.goName, " = []", g.Pkg["proto"], ".ExtensionRange{") + for _, r := range mc.message.ExtensionRange { + end := fmt.Sprint(*r.End - 1) // make range inclusive on both ends + g.P("{Start: ", r.Start, ", End: ", end, "},") + } + g.P("}") + g.P("func (*", mc.goName, ") ExtensionRangeArray() []", g.Pkg["proto"], ".ExtensionRange {") + g.P("return extRange_", mc.goName) + g.P("}") + g.P() + } + + // TODO: It does not scale to keep adding another method for every + // operation on protos that we want to switch over to using the + // table-driven approach. Instead, we should only add a single method + // that allows getting access to the *InternalMessageInfo struct and then + // calling Unmarshal, Marshal, Merge, Size, and Discard directly on that. + + // Wrapper for table-driven marshaling and unmarshaling. + g.P("func (m *", mc.goName, ") XXX_Unmarshal(b []byte) error {") + g.P("return xxx_messageInfo_", mc.goName, ".Unmarshal(m, b)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {") + g.P("return xxx_messageInfo_", mc.goName, ".Marshal(b, m, deterministic)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Merge(src ", g.Pkg["proto"], ".Message) {") + g.P("xxx_messageInfo_", mc.goName, ".Merge(m, src)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_Size() int {") // avoid name clash with "Size" field in some message + g.P("return xxx_messageInfo_", mc.goName, ".Size(m)") + g.P("}") + + g.P("func (m *", mc.goName, ") XXX_DiscardUnknown() {") + g.P("xxx_messageInfo_", mc.goName, ".DiscardUnknown(m)") + g.P("}") + + g.P("var xxx_messageInfo_", mc.goName, " ", g.Pkg["proto"], ".InternalMessageInfo") + g.P() +} + +// Generate the type, methods and default constant definitions for this Descriptor. +func (g *Generator) generateMessage(message *Descriptor) { + topLevelFields := []topLevelField{} + oFields := make(map[int32]*oneofField) + // The full type name + typeName := message.TypeName() + // The full type name, CamelCased. + goTypeName := CamelCaseSlice(typeName) + + usedNames := make(map[string]bool) + for _, n := range methodNames { + usedNames[n] = true + } + + // allocNames finds a conflict-free variation of the given strings, + // consistently mutating their suffixes. + // It returns the same number of strings. + allocNames := func(ns ...string) []string { + Loop: + for { + for _, n := range ns { + if usedNames[n] { + for i := range ns { + ns[i] += "_" + } + continue Loop + } + } + for _, n := range ns { + usedNames[n] = true + } + return ns + } + } + + mapFieldTypes := make(map[*descriptor.FieldDescriptorProto]string) // keep track of the map fields to be added later + + // Build a structure more suitable for generating the text in one pass + for i, field := range message.Field { + // Allocate the getter and the field at the same time so name + // collisions create field/method consistent names. + // TODO: This allocation occurs based on the order of the fields + // in the proto file, meaning that a change in the field + // ordering can change generated Method/Field names. + base := CamelCase(*field.Name) + ns := allocNames(base, "Get"+base) + fieldName, fieldGetterName := ns[0], ns[1] + typename, wiretype := g.GoType(message, field) + jsonName := *field.Name + tag := fmt.Sprintf("protobuf:%s json:%q", g.goTag(message, field, wiretype), jsonName+",omitempty") + + oneof := field.OneofIndex != nil + if oneof && oFields[*field.OneofIndex] == nil { + odp := message.OneofDecl[int(*field.OneofIndex)] + base := CamelCase(odp.GetName()) + fname := allocNames(base)[0] + + // This is the first field of a oneof we haven't seen before. + // Generate the union field. + oneofFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageOneofPath, *field.OneofIndex) + c, ok := g.makeComments(oneofFullPath) + if ok { + c += "\n//\n" + } + c += "// Types that are valid to be assigned to " + fname + ":\n" + // Generate the rest of this comment later, + // when we've computed any disambiguation. + + dname := "is" + goTypeName + "_" + fname + tag := `protobuf_oneof:"` + odp.GetName() + `"` + of := oneofField{ + fieldCommon: fieldCommon{ + goName: fname, + getterName: "Get"+fname, + goType: dname, + tags: tag, + protoName: odp.GetName(), + fullPath: oneofFullPath, + }, + comment: c, + } + topLevelFields = append(topLevelFields, &of) + oFields[*field.OneofIndex] = &of + } + + if *field.Type == descriptor.FieldDescriptorProto_TYPE_MESSAGE { + desc := g.ObjectNamed(field.GetTypeName()) + if d, ok := desc.(*Descriptor); ok && d.GetOptions().GetMapEntry() { + // Figure out the Go types and tags for the key and value types. + keyField, valField := d.Field[0], d.Field[1] + keyType, keyWire := g.GoType(d, keyField) + valType, valWire := g.GoType(d, valField) + keyTag, valTag := g.goTag(d, keyField, keyWire), g.goTag(d, valField, valWire) + + // We don't use stars, except for message-typed values. + // Message and enum types are the only two possibly foreign types used in maps, + // so record their use. They are not permitted as map keys. + keyType = strings.TrimPrefix(keyType, "*") + switch *valField.Type { + case descriptor.FieldDescriptorProto_TYPE_ENUM: + valType = strings.TrimPrefix(valType, "*") + g.RecordTypeUse(valField.GetTypeName()) + case descriptor.FieldDescriptorProto_TYPE_MESSAGE: + g.RecordTypeUse(valField.GetTypeName()) + default: + valType = strings.TrimPrefix(valType, "*") + } + + typename = fmt.Sprintf("map[%s]%s", keyType, valType) + mapFieldTypes[field] = typename // record for the getter generation + + tag += fmt.Sprintf(" protobuf_key:%s protobuf_val:%s", keyTag, valTag) + } + } + + fieldDeprecated := "" + if field.GetOptions().GetDeprecated() { + fieldDeprecated = deprecationComment + } + + dvalue := g.getterDefault(field, goTypeName) + if oneof { + tname := goTypeName + "_" + fieldName + // It is possible for this to collide with a message or enum + // nested in this message. Check for collisions. + for { + ok := true + for _, desc := range message.nested { + if CamelCaseSlice(desc.TypeName()) == tname { + ok = false + break + } + } + for _, enum := range message.enums { + if CamelCaseSlice(enum.TypeName()) == tname { + ok = false + break + } + } + if !ok { + tname += "_" + continue + } + break + } + + oneofField := oFields[*field.OneofIndex] + tag := "protobuf:" + g.goTag(message, field, wiretype) + sf := oneofSubField{ + fieldCommon: fieldCommon{ + goName: fieldName, + getterName: fieldGetterName, + goType: typename, + tags: tag, + protoName: field.GetName(), + fullPath: fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i), + }, + protoTypeName: field.GetTypeName(), + fieldNumber: int(*field.Number), + protoType: *field.Type, + getterDef: dvalue, + protoDef: field.GetDefaultValue(), + oneofTypeName: tname, + deprecated: fieldDeprecated, + } + oneofField.subFields = append(oneofField.subFields, &sf) + g.RecordTypeUse(field.GetTypeName()) + continue + } + + fieldFullPath := fmt.Sprintf("%s,%d,%d", message.path, messageFieldPath, i) + c, ok := g.makeComments(fieldFullPath) + if ok { + c += "\n" + } + rf := simpleField{ + fieldCommon: fieldCommon{ + goName: fieldName, + getterName: fieldGetterName, + goType: typename, + tags: tag, + protoName: field.GetName(), + fullPath: fieldFullPath, + }, + protoTypeName: field.GetTypeName(), + protoType: *field.Type, + deprecated: fieldDeprecated, + getterDef: dvalue, + protoDef: field.GetDefaultValue(), + comment: c, + } + var pf topLevelField = &rf + + topLevelFields = append(topLevelFields, pf) + g.RecordTypeUse(field.GetTypeName()) + } + + mc := &msgCtx{ + goName: goTypeName, + message: message, + } + + g.generateMessageStruct(mc, topLevelFields) + g.P() + g.generateCommonMethods(mc) + g.P() + g.generateDefaultConstants(mc, topLevelFields) + g.P() + g.generateGetters(mc, topLevelFields) + g.P() + g.generateSetters(mc, topLevelFields) + g.P() + g.generateOneofFuncs(mc, topLevelFields) + g.P() + + var oneofTypes []string + for _, f := range topLevelFields { + if of, ok := f.(*oneofField); ok { + for _, osf := range of.subFields { + oneofTypes = append(oneofTypes, osf.oneofTypeName) + } + } + } + + opts := message.Options + ms := &messageSymbol{ + sym: goTypeName, + hasExtensions: len(message.ExtensionRange) > 0, + isMessageSet: opts != nil && opts.GetMessageSetWireFormat(), + oneofTypes: oneofTypes, + } + g.file.addExport(message, ms) + + for _, ext := range message.ext { + g.generateExtension(ext) + } + + fullName := strings.Join(message.TypeName(), ".") + if g.file.Package != nil { + fullName = *g.file.Package + "." + fullName + } + + g.addInitf("%s.RegisterType((*%s)(nil), %q)", g.Pkg["proto"], goTypeName, fullName) + // Register types for native map types. + for _, k := range mapFieldKeys(mapFieldTypes) { + fullName := strings.TrimPrefix(*k.TypeName, ".") + g.addInitf("%s.RegisterMapType((%s)(nil), %q)", g.Pkg["proto"], mapFieldTypes[k], fullName) + } + +} + +type byTypeName []*descriptor.FieldDescriptorProto + +func (a byTypeName) Len() int { return len(a) } +func (a byTypeName) Swap(i, j int) { a[i], a[j] = a[j], a[i] } +func (a byTypeName) Less(i, j int) bool { return *a[i].TypeName < *a[j].TypeName } + +// mapFieldKeys returns the keys of m in a consistent order. +func mapFieldKeys(m map[*descriptor.FieldDescriptorProto]string) []*descriptor.FieldDescriptorProto { + keys := make([]*descriptor.FieldDescriptorProto, 0, len(m)) + for k := range m { + keys = append(keys, k) + } + sort.Sort(byTypeName(keys)) + return keys +} + +var escapeChars = [256]byte{ + 'a': '\a', 'b': '\b', 'f': '\f', 'n': '\n', 'r': '\r', 't': '\t', 'v': '\v', '\\': '\\', '"': '"', '\'': '\'', '?': '?', +} + +// unescape reverses the "C" escaping that protoc does for default values of bytes fields. +// It is best effort in that it effectively ignores malformed input. Seemingly invalid escape +// sequences are conveyed, unmodified, into the decoded result. +func unescape(s string) string { + // NB: Sadly, we can't use strconv.Unquote because protoc will escape both + // single and double quotes, but strconv.Unquote only allows one or the + // other (based on actual surrounding quotes of its input argument). + + var out []byte + for len(s) > 0 { + // regular character, or too short to be valid escape + if s[0] != '\\' || len(s) < 2 { + out = append(out, s[0]) + s = s[1:] + } else if c := escapeChars[s[1]]; c != 0 { + // escape sequence + out = append(out, c) + s = s[2:] + } else if s[1] == 'x' || s[1] == 'X' { + // hex escape, e.g. "\x80 + if len(s) < 4 { + // too short to be valid + out = append(out, s[:2]...) + s = s[2:] + continue + } + v, err := strconv.ParseUint(s[2:4], 16, 8) + if err != nil { + out = append(out, s[:4]...) + } else { + out = append(out, byte(v)) + } + s = s[4:] + } else if '0' <= s[1] && s[1] <= '7' { + // octal escape, can vary from 1 to 3 octal digits; e.g., "\0" "\40" or "\164" + // so consume up to 2 more bytes or up to end-of-string + n := len(s[1:]) - len(strings.TrimLeft(s[1:], "01234567")) + if n > 3 { + n = 3 + } + v, err := strconv.ParseUint(s[1:1+n], 8, 8) + if err != nil { + out = append(out, s[:1+n]...) + } else { + out = append(out, byte(v)) + } + s = s[1+n:] + } else { + // bad escape, just propagate the slash as-is + out = append(out, s[0]) + s = s[1:] + } + } + + return string(out) +} + +func (g *Generator) generateExtension(ext *ExtensionDescriptor) { + ccTypeName := ext.DescName() + + extObj := g.ObjectNamed(*ext.Extendee) + var extDesc *Descriptor + if id, ok := extObj.(*ImportedDescriptor); ok { + // This is extending a publicly imported message. + // We need the underlying type for goTag. + extDesc = id.o.(*Descriptor) + } else { + extDesc = extObj.(*Descriptor) + } + extendedType := "*" + g.TypeName(extObj) // always use the original + field := ext.FieldDescriptorProto + fieldType, wireType := g.GoType(ext.parent, field) + tag := g.goTag(extDesc, field, wireType) + g.RecordTypeUse(*ext.Extendee) + if n := ext.FieldDescriptorProto.TypeName; n != nil { + // foreign extension type + g.RecordTypeUse(*n) + } + + typeName := ext.TypeName() + + // Special case for proto2 message sets: If this extension is extending + // proto2.bridge.MessageSet, and its final name component is "message_set_extension", + // then drop that last component. + // + // TODO: This should be implemented in the text formatter rather than the generator. + // In addition, the situation for when to apply this special case is implemented + // differently in other languages: + // https://github.com/google/protobuf/blob/aff10976/src/google/protobuf/text_format.cc#L1560 + if extDesc.GetOptions().GetMessageSetWireFormat() && typeName[len(typeName)-1] == "message_set_extension" { + typeName = typeName[:len(typeName)-1] + } + + // For text formatting, the package must be exactly what the .proto file declares, + // ignoring overrides such as the go_package option, and with no dot/underscore mapping. + extName := strings.Join(typeName, ".") + if g.file.Package != nil { + extName = *g.file.Package + "." + extName + } + + g.P("var ", ccTypeName, " = &", g.Pkg["proto"], ".ExtensionDesc{") + g.P("ExtendedType: (", extendedType, ")(nil),") + g.P("ExtensionType: (", fieldType, ")(nil),") + g.P("Field: ", field.Number, ",") + g.P(`Name: "`, extName, `",`) + g.P("Tag: ", tag, ",") + g.P(`Filename: "`, g.file.GetName(), `",`) + + g.P("}") + g.P() + + g.addInitf("%s.RegisterExtension(%s)", g.Pkg["proto"], ext.DescName()) + + g.file.addExport(ext, constOrVarSymbol{ccTypeName, "var", ""}) +} + +func (g *Generator) generateInitFunction() { + if len(g.init) == 0 { + return + } + g.P("func init() {") + for _, l := range g.init { + g.P(l) + } + g.P("}") + g.init = nil +} + +func (g *Generator) generateFileDescriptor(file *FileDescriptor) { + // Make a copy and trim source_code_info data. + // TODO: Trim this more when we know exactly what we need. + pb := proto.Clone(file.FileDescriptorProto).(*descriptor.FileDescriptorProto) + pb.SourceCodeInfo = nil + + b, err := proto.Marshal(pb) + if err != nil { + g.Fail(err.Error()) + } + + var buf bytes.Buffer + w, _ := gzip.NewWriterLevel(&buf, gzip.BestCompression) + w.Write(b) + w.Close() + b = buf.Bytes() + + v := file.VarName() + g.P() + g.P("func init() { ", g.Pkg["proto"], ".RegisterFile(", strconv.Quote(*file.Name), ", ", v, ") }") + g.P("var ", v, " = []byte{") + g.P("// ", len(b), " bytes of a gzipped FileDescriptorProto") + for len(b) > 0 { + n := 16 + if n > len(b) { + n = len(b) + } + + s := "" + for _, c := range b[:n] { + s += fmt.Sprintf("0x%02x,", c) + } + g.P(s) + + b = b[n:] + } + g.P("}") +} + +func (g *Generator) generateEnumRegistration(enum *EnumDescriptor) { + // // We always print the full (proto-world) package name here. + pkg := enum.File().GetPackage() + if pkg != "" { + pkg += "." + } + // The full type name + typeName := enum.TypeName() + // The full type name, CamelCased. + ccTypeName := CamelCaseSlice(typeName) + g.addInitf("%s.RegisterEnum(%q, %[3]s_name, %[3]s_value)", g.Pkg["proto"], pkg+ccTypeName, ccTypeName) +} + +// And now lots of helper functions. + +// Is c an ASCII lower-case letter? +func isASCIILower(c byte) bool { + return 'a' <= c && c <= 'z' +} + +// Is c an ASCII digit? +func isASCIIDigit(c byte) bool { + return '0' <= c && c <= '9' +} + +// CamelCase returns the CamelCased name. +// If there is an interior underscore followed by a lower case letter, +// drop the underscore and convert the letter to upper case. +// There is a remote possibility of this rewrite causing a name collision, +// but it's so remote we're prepared to pretend it's nonexistent - since the +// C++ generator lowercases names, it's extremely unlikely to have two fields +// with different capitalizations. +// In short, _my_field_name_2 becomes XMyFieldName_2. +func CamelCase(s string) string { + if s == "" { + return "" + } + t := make([]byte, 0, 32) + i := 0 + if s[0] == '_' { + // Need a capital letter; drop the '_'. + t = append(t, 'X') + i++ + } + // Invariant: if the next letter is lower case, it must be converted + // to upper case. + // That is, we process a word at a time, where words are marked by _ or + // upper case letter. Digits are treated as words. + for ; i < len(s); i++ { + c := s[i] + if c == '_' && i+1 < len(s) && isASCIILower(s[i+1]) { + continue // Skip the underscore in s. + } + if isASCIIDigit(c) { + t = append(t, c) + continue + } + // Assume we have a letter now - if not, it's a bogus identifier. + // The next word is a sequence of characters that must start upper case. + if isASCIILower(c) { + c ^= ' ' // Make it a capital letter. + } + t = append(t, c) // Guaranteed not lower case. + // Accept lower case sequence that follows. + for i+1 < len(s) && isASCIILower(s[i+1]) { + i++ + t = append(t, s[i]) + } + } + return string(t) +} + +// CamelCaseSlice is like CamelCase, but the argument is a slice of strings to +// be joined with "_". +func CamelCaseSlice(elem []string) string { return CamelCase(strings.Join(elem, "_")) } + +// dottedSlice turns a sliced name into a dotted name. +func dottedSlice(elem []string) string { return strings.Join(elem, ".") } + +// Is this field optional? +func isOptional(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_OPTIONAL +} + +// Is this field required? +func isRequired(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REQUIRED +} + +// Is this field repeated? +func isRepeated(field *descriptor.FieldDescriptorProto) bool { + return field.Label != nil && *field.Label == descriptor.FieldDescriptorProto_LABEL_REPEATED +} + +// Is this field a scalar numeric type? +func isScalar(field *descriptor.FieldDescriptorProto) bool { + if field.Type == nil { + return false + } + switch *field.Type { + case descriptor.FieldDescriptorProto_TYPE_DOUBLE, + descriptor.FieldDescriptorProto_TYPE_FLOAT, + descriptor.FieldDescriptorProto_TYPE_INT64, + descriptor.FieldDescriptorProto_TYPE_UINT64, + descriptor.FieldDescriptorProto_TYPE_INT32, + descriptor.FieldDescriptorProto_TYPE_FIXED64, + descriptor.FieldDescriptorProto_TYPE_FIXED32, + descriptor.FieldDescriptorProto_TYPE_BOOL, + descriptor.FieldDescriptorProto_TYPE_UINT32, + descriptor.FieldDescriptorProto_TYPE_ENUM, + descriptor.FieldDescriptorProto_TYPE_SFIXED32, + descriptor.FieldDescriptorProto_TYPE_SFIXED64, + descriptor.FieldDescriptorProto_TYPE_SINT32, + descriptor.FieldDescriptorProto_TYPE_SINT64: + return true + default: + return false + } +} + +// badToUnderscore is the mapping function used to generate Go names from package names, +// which can be dotted in the input .proto file. It replaces non-identifier characters such as +// dot or dash with underscore. +func badToUnderscore(r rune) rune { + if unicode.IsLetter(r) || unicode.IsDigit(r) || r == '_' { + return r + } + return '_' +} + +// baseName returns the last path element of the name, with the last dotted suffix removed. +func baseName(name string) string { + // First, find the last element + if i := strings.LastIndex(name, "/"); i >= 0 { + name = name[i+1:] + } + // Now drop the suffix + if i := strings.LastIndex(name, "."); i >= 0 { + name = name[0:i] + } + return name +} + +// The SourceCodeInfo message describes the location of elements of a parsed +// .proto file by way of a "path", which is a sequence of integers that +// describe the route from a FileDescriptorProto to the relevant submessage. +// The path alternates between a field number of a repeated field, and an index +// into that repeated field. The constants below define the field numbers that +// are used. +// +// See descriptor.proto for more information about this. +const ( + // tag numbers in FileDescriptorProto + packagePath = 2 // package + messagePath = 4 // message_type + enumPath = 5 // enum_type + // tag numbers in DescriptorProto + messageFieldPath = 2 // field + messageMessagePath = 3 // nested_type + messageEnumPath = 4 // enum_type + messageOneofPath = 8 // oneof_decl + // tag numbers in EnumDescriptorProto + enumValuePath = 2 // value +) + +var supportTypeAliases bool + +func init() { + for _, tag := range build.Default.ReleaseTags { + if tag == "go1.9" { + supportTypeAliases = true + return + } + } +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go new file mode 100644 index 00000000..a9b61036 --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/generator/internal/remap/remap.go @@ -0,0 +1,117 @@ +// Go support for Protocol Buffers - Google's data interchange format +// +// Copyright 2017 The Go Authors. All rights reserved. +// https://github.com/golang/protobuf +// +// 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. + +/* +Package remap handles tracking the locations of Go tokens in a source text +across a rewrite by the Go formatter. +*/ +package remap + +import ( + "fmt" + "go/scanner" + "go/token" +) + +// A Location represents a span of byte offsets in the source text. +type Location struct { + Pos, End int // End is exclusive +} + +// A Map represents a mapping between token locations in an input source text +// and locations in the correspnding output text. +type Map map[Location]Location + +// Find reports whether the specified span is recorded by m, and if so returns +// the new location it was mapped to. If the input span was not found, the +// returned location is the same as the input. +func (m Map) Find(pos, end int) (Location, bool) { + key := Location{ + Pos: pos, + End: end, + } + if loc, ok := m[key]; ok { + return loc, true + } + return key, false +} + +func (m Map) add(opos, oend, npos, nend int) { + m[Location{Pos: opos, End: oend}] = Location{Pos: npos, End: nend} +} + +// Compute constructs a location mapping from input to output. An error is +// reported if any of the tokens of output cannot be mapped. +func Compute(input, output []byte) (Map, error) { + itok := tokenize(input) + otok := tokenize(output) + if len(itok) != len(otok) { + return nil, fmt.Errorf("wrong number of tokens, %d ≠ %d", len(itok), len(otok)) + } + m := make(Map) + for i, ti := range itok { + to := otok[i] + if ti.Token != to.Token { + return nil, fmt.Errorf("token %d type mismatch: %s ≠ %s", i+1, ti, to) + } + m.add(ti.pos, ti.end, to.pos, to.end) + } + return m, nil +} + +// tokinfo records the span and type of a source token. +type tokinfo struct { + pos, end int + token.Token +} + +func tokenize(src []byte) []tokinfo { + fs := token.NewFileSet() + var s scanner.Scanner + s.Init(fs.AddFile("src", fs.Base(), len(src)), src, nil, scanner.ScanComments) + var info []tokinfo + for { + pos, next, lit := s.Scan() + switch next { + case token.SEMICOLON: + continue + } + info = append(info, tokinfo{ + pos: int(pos - 1), + end: int(pos + token.Pos(len(lit)) - 1), + Token: next, + }) + if next == token.EOF { + break + } + } + return info +} diff --git a/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go new file mode 100644 index 00000000..61bfc10e --- /dev/null +++ b/vendor/github.com/golang/protobuf/protoc-gen-go/plugin/plugin.pb.go @@ -0,0 +1,369 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/compiler/plugin.proto + +/* +Package plugin_go is a generated protocol buffer package. + +It is generated from these files: + google/protobuf/compiler/plugin.proto + +It has these top-level messages: + Version + CodeGeneratorRequest + CodeGeneratorResponse +*/ +package plugin_go + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import google_protobuf "github.com/golang/protobuf/protoc-gen-go/descriptor" + +// 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 + +// The version number of protocol compiler. +type Version struct { + Major *int32 `protobuf:"varint,1,opt,name=major" json:"major,omitempty"` + Minor *int32 `protobuf:"varint,2,opt,name=minor" json:"minor,omitempty"` + Patch *int32 `protobuf:"varint,3,opt,name=patch" json:"patch,omitempty"` + // A suffix for alpha, beta or rc release, e.g., "alpha-1", "rc2". It should + // be empty for mainline stable releases. + Suffix *string `protobuf:"bytes,4,opt,name=suffix" json:"suffix,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Version) Reset() { *m = Version{} } +func (m *Version) String() string { return proto.CompactTextString(m) } +func (*Version) ProtoMessage() {} +func (*Version) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } +func (m *Version) Unmarshal(b []byte) error { + return xxx_messageInfo_Version.Unmarshal(m, b) +} +func (m *Version) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Version.Marshal(b, m, deterministic) +} +func (dst *Version) XXX_Merge(src proto.Message) { + xxx_messageInfo_Version.Merge(dst, src) +} +func (m *Version) XXX_Size() int { + return xxx_messageInfo_Version.Size(m) +} +func (m *Version) XXX_DiscardUnknown() { + xxx_messageInfo_Version.DiscardUnknown(m) +} + +var xxx_messageInfo_Version proto.InternalMessageInfo + +func (m *Version) GetMajor() int32 { + if m != nil && m.Major != nil { + return *m.Major + } + return 0 +} + +func (m *Version) GetMinor() int32 { + if m != nil && m.Minor != nil { + return *m.Minor + } + return 0 +} + +func (m *Version) GetPatch() int32 { + if m != nil && m.Patch != nil { + return *m.Patch + } + return 0 +} + +func (m *Version) GetSuffix() string { + if m != nil && m.Suffix != nil { + return *m.Suffix + } + return "" +} + +// An encoded CodeGeneratorRequest is written to the plugin's stdin. +type CodeGeneratorRequest struct { + // The .proto files that were explicitly listed on the command-line. The + // code generator should generate code only for these files. Each file's + // descriptor will be included in proto_file, below. + FileToGenerate []string `protobuf:"bytes,1,rep,name=file_to_generate,json=fileToGenerate" json:"file_to_generate,omitempty"` + // The generator parameter passed on the command-line. + Parameter *string `protobuf:"bytes,2,opt,name=parameter" json:"parameter,omitempty"` + // FileDescriptorProtos for all files in files_to_generate and everything + // they import. The files will appear in topological order, so each file + // appears before any file that imports it. + // + // protoc guarantees that all proto_files will be written after + // the fields above, even though this is not technically guaranteed by the + // protobuf wire format. This theoretically could allow a plugin to stream + // in the FileDescriptorProtos and handle them one by one rather than read + // the entire set into memory at once. However, as of this writing, this + // is not similarly optimized on protoc's end -- it will store all fields in + // memory at once before sending them to the plugin. + // + // Type names of fields and extensions in the FileDescriptorProto are always + // fully qualified. + ProtoFile []*google_protobuf.FileDescriptorProto `protobuf:"bytes,15,rep,name=proto_file,json=protoFile" json:"proto_file,omitempty"` + // The version number of protocol compiler. + CompilerVersion *Version `protobuf:"bytes,3,opt,name=compiler_version,json=compilerVersion" json:"compiler_version,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CodeGeneratorRequest) Reset() { *m = CodeGeneratorRequest{} } +func (m *CodeGeneratorRequest) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorRequest) ProtoMessage() {} +func (*CodeGeneratorRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } +func (m *CodeGeneratorRequest) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorRequest.Unmarshal(m, b) +} +func (m *CodeGeneratorRequest) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorRequest.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorRequest.Merge(dst, src) +} +func (m *CodeGeneratorRequest) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorRequest.Size(m) +} +func (m *CodeGeneratorRequest) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorRequest proto.InternalMessageInfo + +func (m *CodeGeneratorRequest) GetFileToGenerate() []string { + if m != nil { + return m.FileToGenerate + } + return nil +} + +func (m *CodeGeneratorRequest) GetParameter() string { + if m != nil && m.Parameter != nil { + return *m.Parameter + } + return "" +} + +func (m *CodeGeneratorRequest) GetProtoFile() []*google_protobuf.FileDescriptorProto { + if m != nil { + return m.ProtoFile + } + return nil +} + +func (m *CodeGeneratorRequest) GetCompilerVersion() *Version { + if m != nil { + return m.CompilerVersion + } + return nil +} + +// The plugin writes an encoded CodeGeneratorResponse to stdout. +type CodeGeneratorResponse struct { + // Error message. If non-empty, code generation failed. The plugin process + // should exit with status code zero even if it reports an error in this way. + // + // This should be used to indicate errors in .proto files which prevent the + // code generator from generating correct code. Errors which indicate a + // problem in protoc itself -- such as the input CodeGeneratorRequest being + // unparseable -- should be reported by writing a message to stderr and + // exiting with a non-zero status code. + Error *string `protobuf:"bytes,1,opt,name=error" json:"error,omitempty"` + File []*CodeGeneratorResponse_File `protobuf:"bytes,15,rep,name=file" json:"file,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CodeGeneratorResponse) Reset() { *m = CodeGeneratorResponse{} } +func (m *CodeGeneratorResponse) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorResponse) ProtoMessage() {} +func (*CodeGeneratorResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } +func (m *CodeGeneratorResponse) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorResponse.Unmarshal(m, b) +} +func (m *CodeGeneratorResponse) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorResponse.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorResponse.Merge(dst, src) +} +func (m *CodeGeneratorResponse) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorResponse.Size(m) +} +func (m *CodeGeneratorResponse) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorResponse proto.InternalMessageInfo + +func (m *CodeGeneratorResponse) GetError() string { + if m != nil && m.Error != nil { + return *m.Error + } + return "" +} + +func (m *CodeGeneratorResponse) GetFile() []*CodeGeneratorResponse_File { + if m != nil { + return m.File + } + return nil +} + +// Represents a single generated file. +type CodeGeneratorResponse_File struct { + // The file name, relative to the output directory. The name must not + // contain "." or ".." components and must be relative, not be absolute (so, + // the file cannot lie outside the output directory). "/" must be used as + // the path separator, not "\". + // + // If the name is omitted, the content will be appended to the previous + // file. This allows the generator to break large files into small chunks, + // and allows the generated text to be streamed back to protoc so that large + // files need not reside completely in memory at one time. Note that as of + // this writing protoc does not optimize for this -- it will read the entire + // CodeGeneratorResponse before writing files to disk. + Name *string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // If non-empty, indicates that the named file should already exist, and the + // content here is to be inserted into that file at a defined insertion + // point. This feature allows a code generator to extend the output + // produced by another code generator. The original generator may provide + // insertion points by placing special annotations in the file that look + // like: + // @@protoc_insertion_point(NAME) + // The annotation can have arbitrary text before and after it on the line, + // which allows it to be placed in a comment. NAME should be replaced with + // an identifier naming the point -- this is what other generators will use + // as the insertion_point. Code inserted at this point will be placed + // immediately above the line containing the insertion point (thus multiple + // insertions to the same point will come out in the order they were added). + // The double-@ is intended to make it unlikely that the generated code + // could contain things that look like insertion points by accident. + // + // For example, the C++ code generator places the following line in the + // .pb.h files that it generates: + // // @@protoc_insertion_point(namespace_scope) + // This line appears within the scope of the file's package namespace, but + // outside of any particular class. Another plugin can then specify the + // insertion_point "namespace_scope" to generate additional classes or + // other declarations that should be placed in this scope. + // + // Note that if the line containing the insertion point begins with + // whitespace, the same whitespace will be added to every line of the + // inserted text. This is useful for languages like Python, where + // indentation matters. In these languages, the insertion point comment + // should be indented the same amount as any inserted code will need to be + // in order to work correctly in that context. + // + // The code generator that generates the initial file and the one which + // inserts into it must both run as part of a single invocation of protoc. + // Code generators are executed in the order in which they appear on the + // command line. + // + // If |insertion_point| is present, |name| must also be present. + InsertionPoint *string `protobuf:"bytes,2,opt,name=insertion_point,json=insertionPoint" json:"insertion_point,omitempty"` + // The file contents. + Content *string `protobuf:"bytes,15,opt,name=content" json:"content,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *CodeGeneratorResponse_File) Reset() { *m = CodeGeneratorResponse_File{} } +func (m *CodeGeneratorResponse_File) String() string { return proto.CompactTextString(m) } +func (*CodeGeneratorResponse_File) ProtoMessage() {} +func (*CodeGeneratorResponse_File) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } +func (m *CodeGeneratorResponse_File) Unmarshal(b []byte) error { + return xxx_messageInfo_CodeGeneratorResponse_File.Unmarshal(m, b) +} +func (m *CodeGeneratorResponse_File) Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_CodeGeneratorResponse_File.Marshal(b, m, deterministic) +} +func (dst *CodeGeneratorResponse_File) XXX_Merge(src proto.Message) { + xxx_messageInfo_CodeGeneratorResponse_File.Merge(dst, src) +} +func (m *CodeGeneratorResponse_File) XXX_Size() int { + return xxx_messageInfo_CodeGeneratorResponse_File.Size(m) +} +func (m *CodeGeneratorResponse_File) XXX_DiscardUnknown() { + xxx_messageInfo_CodeGeneratorResponse_File.DiscardUnknown(m) +} + +var xxx_messageInfo_CodeGeneratorResponse_File proto.InternalMessageInfo + +func (m *CodeGeneratorResponse_File) GetName() string { + if m != nil && m.Name != nil { + return *m.Name + } + return "" +} + +func (m *CodeGeneratorResponse_File) GetInsertionPoint() string { + if m != nil && m.InsertionPoint != nil { + return *m.InsertionPoint + } + return "" +} + +func (m *CodeGeneratorResponse_File) GetContent() string { + if m != nil && m.Content != nil { + return *m.Content + } + return "" +} + +func init() { + proto.RegisterType((*Version)(nil), "google.protobuf.compiler.Version") + proto.RegisterType((*CodeGeneratorRequest)(nil), "google.protobuf.compiler.CodeGeneratorRequest") + proto.RegisterType((*CodeGeneratorResponse)(nil), "google.protobuf.compiler.CodeGeneratorResponse") + proto.RegisterType((*CodeGeneratorResponse_File)(nil), "google.protobuf.compiler.CodeGeneratorResponse.File") +} + +func init() { proto.RegisterFile("google/protobuf/compiler/plugin.proto", fileDescriptor0) } + +var fileDescriptor0 = []byte{ + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0xcf, 0x6a, 0x14, 0x41, + 0x10, 0xc6, 0x19, 0x77, 0x63, 0x98, 0x8a, 0x64, 0x43, 0x13, 0xa5, 0x09, 0x39, 0x8c, 0x8b, 0xe2, + 0x5c, 0x32, 0x0b, 0xc1, 0x8b, 0x78, 0x4b, 0x44, 0x3d, 0x78, 0x58, 0x1a, 0xf1, 0x20, 0xc8, 0x30, + 0x99, 0xd4, 0x74, 0x5a, 0x66, 0xba, 0xc6, 0xee, 0x1e, 0xf1, 0x49, 0x7d, 0x0f, 0xdf, 0x40, 0xfa, + 0xcf, 0x24, 0xb2, 0xb8, 0xa7, 0xee, 0xef, 0x57, 0xd5, 0xd5, 0x55, 0x1f, 0x05, 0x2f, 0x25, 0x91, + 0xec, 0x71, 0x33, 0x1a, 0x72, 0x74, 0x33, 0x75, 0x9b, 0x96, 0x86, 0x51, 0xf5, 0x68, 0x36, 0x63, + 0x3f, 0x49, 0xa5, 0xab, 0x10, 0x60, 0x3c, 0xa6, 0x55, 0x73, 0x5a, 0x35, 0xa7, 0x9d, 0x15, 0xbb, + 0x05, 0x6e, 0xd1, 0xb6, 0x46, 0x8d, 0x8e, 0x4c, 0xcc, 0x5e, 0xb7, 0x70, 0xf8, 0x05, 0x8d, 0x55, + 0xa4, 0xd9, 0x29, 0x1c, 0x0c, 0xcd, 0x77, 0x32, 0x3c, 0x2b, 0xb2, 0xf2, 0x40, 0x44, 0x11, 0xa8, + 0xd2, 0x64, 0xf8, 0xa3, 0x44, 0xbd, 0xf0, 0x74, 0x6c, 0x5c, 0x7b, 0xc7, 0x17, 0x91, 0x06, 0xc1, + 0x9e, 0xc1, 0x63, 0x3b, 0x75, 0x9d, 0xfa, 0xc5, 0x97, 0x45, 0x56, 0xe6, 0x22, 0xa9, 0xf5, 0x9f, + 0x0c, 0x4e, 0xaf, 0xe9, 0x16, 0x3f, 0xa0, 0x46, 0xd3, 0x38, 0x32, 0x02, 0x7f, 0x4c, 0x68, 0x1d, + 0x2b, 0xe1, 0xa4, 0x53, 0x3d, 0xd6, 0x8e, 0x6a, 0x19, 0x63, 0xc8, 0xb3, 0x62, 0x51, 0xe6, 0xe2, + 0xd8, 0xf3, 0xcf, 0x94, 0x5e, 0x20, 0x3b, 0x87, 0x7c, 0x6c, 0x4c, 0x33, 0xa0, 0xc3, 0xd8, 0x4a, + 0x2e, 0x1e, 0x00, 0xbb, 0x06, 0x08, 0xe3, 0xd4, 0xfe, 0x15, 0x5f, 0x15, 0x8b, 0xf2, 0xe8, 0xf2, + 0x45, 0xb5, 0x6b, 0xcb, 0x7b, 0xd5, 0xe3, 0xbb, 0x7b, 0x03, 0xb6, 0x1e, 0x8b, 0x3c, 0x44, 0x7d, + 0x84, 0x7d, 0x82, 0x93, 0xd9, 0xb8, 0xfa, 0x67, 0xf4, 0x24, 0x8c, 0x77, 0x74, 0xf9, 0xbc, 0xda, + 0xe7, 0x70, 0x95, 0xcc, 0x13, 0xab, 0x99, 0x24, 0xb0, 0xfe, 0x9d, 0xc1, 0xd3, 0x9d, 0x99, 0xed, + 0x48, 0xda, 0xa2, 0xf7, 0x0e, 0x8d, 0x49, 0x3e, 0xe7, 0x22, 0x0a, 0xf6, 0x11, 0x96, 0xff, 0x34, + 0xff, 0x7a, 0xff, 0x8f, 0xff, 0x2d, 0x1a, 0x66, 0x13, 0xa1, 0xc2, 0xd9, 0x37, 0x58, 0x86, 0x79, + 0x18, 0x2c, 0x75, 0x33, 0x60, 0xfa, 0x26, 0xdc, 0xd9, 0x2b, 0x58, 0x29, 0x6d, 0xd1, 0x38, 0x45, + 0xba, 0x1e, 0x49, 0x69, 0x97, 0xcc, 0x3c, 0xbe, 0xc7, 0x5b, 0x4f, 0x19, 0x87, 0xc3, 0x96, 0xb4, + 0x43, 0xed, 0xf8, 0x2a, 0x24, 0xcc, 0xf2, 0x4a, 0xc2, 0x79, 0x4b, 0xc3, 0xde, 0xfe, 0xae, 0x9e, + 0x6c, 0xc3, 0x6e, 0x06, 0x7b, 0xed, 0xd7, 0x37, 0x52, 0xb9, 0xbb, 0xe9, 0xc6, 0x87, 0x37, 0x92, + 0xfa, 0x46, 0xcb, 0x87, 0x65, 0x0c, 0x97, 0xf6, 0x42, 0xa2, 0xbe, 0x90, 0x94, 0x56, 0xfa, 0x6d, + 0x3c, 0x6a, 0x49, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, 0xf7, 0x15, 0x40, 0xc5, 0xfe, 0x02, 0x00, + 0x00, +} diff --git a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go index e3c56d3f..78ee5233 100644 --- a/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/any/any.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/any.proto -package any // import "github.com/golang/protobuf/ptypes/any" +package any -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // `Any` contains an arbitrary serialized protocol buffer message along with a // URL that describes the type of the serialized message. @@ -99,17 +101,18 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // } // type Any struct { - // A URL/resource name whose content describes the type of the - // serialized protocol buffer message. + // A URL/resource name that uniquely identifies the type of the serialized + // protocol buffer message. The last segment of the URL's path must represent + // the fully qualified name of the type (as in + // `path/google.protobuf.Duration`). The name should be in a canonical form + // (e.g., leading "." is not accepted). // - // For URLs which use the scheme `http`, `https`, or no scheme, the - // following restrictions and interpretations apply: + // In practice, teams usually precompile into the binary all types that they + // expect it to use in the context of Any. However, for URLs which use the + // scheme `http`, `https`, or no scheme, one can optionally set up a type + // server that maps type URLs to message definitions as follows: // // * If no scheme is provided, `https` is assumed. - // * The last segment of the URL's path must represent the fully - // qualified name of the type (as in `path/google.protobuf.Duration`). - // The name should be in a canonical form (e.g., leading "." is - // not accepted). // * An HTTP GET on the URL must yield a [google.protobuf.Type][] // value in binary format, or produce an error. // * Applications are allowed to cache lookup results based on the @@ -118,6 +121,10 @@ type Any struct { // on changes to types. (Use versioned type names to manage // breaking changes.) // + // Note: this functionality is not currently available in the official + // protobuf release, and it is not used for type URLs beginning with + // type.googleapis.com. + // // Schemes other than `http`, `https` (or the empty scheme) might be // used with implementation specific semantics. // @@ -133,17 +140,19 @@ func (m *Any) Reset() { *m = Any{} } func (m *Any) String() string { return proto.CompactTextString(m) } func (*Any) ProtoMessage() {} func (*Any) Descriptor() ([]byte, []int) { - return fileDescriptor_any_744b9ca530f228db, []int{0} + return fileDescriptor_b53526c13ae22eb4, []int{0} } + func (*Any) XXX_WellKnownType() string { return "Any" } + func (m *Any) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Any.Unmarshal(m, b) } func (m *Any) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Any.Marshal(b, m, deterministic) } -func (dst *Any) XXX_Merge(src proto.Message) { - xxx_messageInfo_Any.Merge(dst, src) +func (m *Any) XXX_Merge(src proto.Message) { + xxx_messageInfo_Any.Merge(m, src) } func (m *Any) XXX_Size() int { return xxx_messageInfo_Any.Size(m) @@ -172,9 +181,9 @@ func init() { proto.RegisterType((*Any)(nil), "google.protobuf.Any") } -func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_any_744b9ca530f228db) } +func init() { proto.RegisterFile("google/protobuf/any.proto", fileDescriptor_b53526c13ae22eb4) } -var fileDescriptor_any_744b9ca530f228db = []byte{ +var fileDescriptor_b53526c13ae22eb4 = []byte{ // 185 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4c, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcc, 0xab, 0xd4, diff --git a/vendor/github.com/golang/protobuf/ptypes/duration.go b/vendor/github.com/golang/protobuf/ptypes/duration.go index 65cb0f8e..26d1ca2f 100644 --- a/vendor/github.com/golang/protobuf/ptypes/duration.go +++ b/vendor/github.com/golang/protobuf/ptypes/duration.go @@ -82,7 +82,7 @@ func Duration(p *durpb.Duration) (time.Duration, error) { return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) } if p.Nanos != 0 { - d += time.Duration(p.Nanos) + d += time.Duration(p.Nanos) * time.Nanosecond if (d < 0) != (p.Nanos < 0) { return 0, fmt.Errorf("duration: %v is out of range for time.Duration", p) } diff --git a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go index a7beb2c4..0d681ee2 100644 --- a/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/duration/duration.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/duration.proto -package duration // import "github.com/golang/protobuf/ptypes/duration" +package duration -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A Duration represents a signed, fixed-length span of time represented // as a count of seconds and fractions of seconds at nanosecond @@ -99,17 +101,19 @@ func (m *Duration) Reset() { *m = Duration{} } func (m *Duration) String() string { return proto.CompactTextString(m) } func (*Duration) ProtoMessage() {} func (*Duration) Descriptor() ([]byte, []int) { - return fileDescriptor_duration_e7d612259e3f0613, []int{0} + return fileDescriptor_23597b2ebd7ac6c5, []int{0} } + func (*Duration) XXX_WellKnownType() string { return "Duration" } + func (m *Duration) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Duration.Unmarshal(m, b) } func (m *Duration) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Duration.Marshal(b, m, deterministic) } -func (dst *Duration) XXX_Merge(src proto.Message) { - xxx_messageInfo_Duration.Merge(dst, src) +func (m *Duration) XXX_Merge(src proto.Message) { + xxx_messageInfo_Duration.Merge(m, src) } func (m *Duration) XXX_Size() int { return xxx_messageInfo_Duration.Size(m) @@ -138,11 +142,9 @@ func init() { proto.RegisterType((*Duration)(nil), "google.protobuf.Duration") } -func init() { - proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_duration_e7d612259e3f0613) -} +func init() { proto.RegisterFile("google/protobuf/duration.proto", fileDescriptor_23597b2ebd7ac6c5) } -var fileDescriptor_duration_e7d612259e3f0613 = []byte{ +var fileDescriptor_23597b2ebd7ac6c5 = []byte{ // 190 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0x29, 0x2d, 0x4a, diff --git a/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go b/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go new file mode 100644 index 00000000..33daa73d --- /dev/null +++ b/vendor/github.com/golang/protobuf/ptypes/struct/struct.pb.go @@ -0,0 +1,336 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/struct.proto + +package structpb + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// `NullValue` is a singleton enumeration to represent the null value for the +// `Value` type union. +// +// The JSON representation for `NullValue` is JSON `null`. +type NullValue int32 + +const ( + // Null value. + NullValue_NULL_VALUE NullValue = 0 +) + +var NullValue_name = map[int32]string{ + 0: "NULL_VALUE", +} + +var NullValue_value = map[string]int32{ + "NULL_VALUE": 0, +} + +func (x NullValue) String() string { + return proto.EnumName(NullValue_name, int32(x)) +} + +func (NullValue) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_df322afd6c9fb402, []int{0} +} + +func (NullValue) XXX_WellKnownType() string { return "NullValue" } + +// `Struct` represents a structured data value, consisting of fields +// which map to dynamically typed values. In some languages, `Struct` +// might be supported by a native representation. For example, in +// scripting languages like JS a struct is represented as an +// object. The details of that representation are described together +// with the proto support for the language. +// +// The JSON representation for `Struct` is JSON object. +type Struct struct { + // Unordered map of dynamically typed values. + Fields map[string]*Value `protobuf:"bytes,1,rep,name=fields,proto3" json:"fields,omitempty" protobuf_key:"bytes,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Struct) Reset() { *m = Struct{} } +func (m *Struct) String() string { return proto.CompactTextString(m) } +func (*Struct) ProtoMessage() {} +func (*Struct) Descriptor() ([]byte, []int) { + return fileDescriptor_df322afd6c9fb402, []int{0} +} + +func (*Struct) XXX_WellKnownType() string { return "Struct" } + +func (m *Struct) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Struct.Unmarshal(m, b) +} +func (m *Struct) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Struct.Marshal(b, m, deterministic) +} +func (m *Struct) XXX_Merge(src proto.Message) { + xxx_messageInfo_Struct.Merge(m, src) +} +func (m *Struct) XXX_Size() int { + return xxx_messageInfo_Struct.Size(m) +} +func (m *Struct) XXX_DiscardUnknown() { + xxx_messageInfo_Struct.DiscardUnknown(m) +} + +var xxx_messageInfo_Struct proto.InternalMessageInfo + +func (m *Struct) GetFields() map[string]*Value { + if m != nil { + return m.Fields + } + return nil +} + +// `Value` represents a dynamically typed value which can be either +// null, a number, a string, a boolean, a recursive struct value, or a +// list of values. A producer of value is expected to set one of that +// variants, absence of any variant indicates an error. +// +// The JSON representation for `Value` is JSON value. +type Value struct { + // The kind of value. + // + // Types that are valid to be assigned to Kind: + // *Value_NullValue + // *Value_NumberValue + // *Value_StringValue + // *Value_BoolValue + // *Value_StructValue + // *Value_ListValue + Kind isValue_Kind `protobuf_oneof:"kind"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Value) Reset() { *m = Value{} } +func (m *Value) String() string { return proto.CompactTextString(m) } +func (*Value) ProtoMessage() {} +func (*Value) Descriptor() ([]byte, []int) { + return fileDescriptor_df322afd6c9fb402, []int{1} +} + +func (*Value) XXX_WellKnownType() string { return "Value" } + +func (m *Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Value.Unmarshal(m, b) +} +func (m *Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Value.Marshal(b, m, deterministic) +} +func (m *Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Value.Merge(m, src) +} +func (m *Value) XXX_Size() int { + return xxx_messageInfo_Value.Size(m) +} +func (m *Value) XXX_DiscardUnknown() { + xxx_messageInfo_Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Value proto.InternalMessageInfo + +type isValue_Kind interface { + isValue_Kind() +} + +type Value_NullValue struct { + NullValue NullValue `protobuf:"varint,1,opt,name=null_value,json=nullValue,proto3,enum=google.protobuf.NullValue,oneof"` +} + +type Value_NumberValue struct { + NumberValue float64 `protobuf:"fixed64,2,opt,name=number_value,json=numberValue,proto3,oneof"` +} + +type Value_StringValue struct { + StringValue string `protobuf:"bytes,3,opt,name=string_value,json=stringValue,proto3,oneof"` +} + +type Value_BoolValue struct { + BoolValue bool `protobuf:"varint,4,opt,name=bool_value,json=boolValue,proto3,oneof"` +} + +type Value_StructValue struct { + StructValue *Struct `protobuf:"bytes,5,opt,name=struct_value,json=structValue,proto3,oneof"` +} + +type Value_ListValue struct { + ListValue *ListValue `protobuf:"bytes,6,opt,name=list_value,json=listValue,proto3,oneof"` +} + +func (*Value_NullValue) isValue_Kind() {} + +func (*Value_NumberValue) isValue_Kind() {} + +func (*Value_StringValue) isValue_Kind() {} + +func (*Value_BoolValue) isValue_Kind() {} + +func (*Value_StructValue) isValue_Kind() {} + +func (*Value_ListValue) isValue_Kind() {} + +func (m *Value) GetKind() isValue_Kind { + if m != nil { + return m.Kind + } + return nil +} + +func (m *Value) GetNullValue() NullValue { + if x, ok := m.GetKind().(*Value_NullValue); ok { + return x.NullValue + } + return NullValue_NULL_VALUE +} + +func (m *Value) GetNumberValue() float64 { + if x, ok := m.GetKind().(*Value_NumberValue); ok { + return x.NumberValue + } + return 0 +} + +func (m *Value) GetStringValue() string { + if x, ok := m.GetKind().(*Value_StringValue); ok { + return x.StringValue + } + return "" +} + +func (m *Value) GetBoolValue() bool { + if x, ok := m.GetKind().(*Value_BoolValue); ok { + return x.BoolValue + } + return false +} + +func (m *Value) GetStructValue() *Struct { + if x, ok := m.GetKind().(*Value_StructValue); ok { + return x.StructValue + } + return nil +} + +func (m *Value) GetListValue() *ListValue { + if x, ok := m.GetKind().(*Value_ListValue); ok { + return x.ListValue + } + return nil +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*Value) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*Value_NullValue)(nil), + (*Value_NumberValue)(nil), + (*Value_StringValue)(nil), + (*Value_BoolValue)(nil), + (*Value_StructValue)(nil), + (*Value_ListValue)(nil), + } +} + +// `ListValue` is a wrapper around a repeated field of values. +// +// The JSON representation for `ListValue` is JSON array. +type ListValue struct { + // Repeated field of dynamically typed values. + Values []*Value `protobuf:"bytes,1,rep,name=values,proto3" json:"values,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *ListValue) Reset() { *m = ListValue{} } +func (m *ListValue) String() string { return proto.CompactTextString(m) } +func (*ListValue) ProtoMessage() {} +func (*ListValue) Descriptor() ([]byte, []int) { + return fileDescriptor_df322afd6c9fb402, []int{2} +} + +func (*ListValue) XXX_WellKnownType() string { return "ListValue" } + +func (m *ListValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_ListValue.Unmarshal(m, b) +} +func (m *ListValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_ListValue.Marshal(b, m, deterministic) +} +func (m *ListValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_ListValue.Merge(m, src) +} +func (m *ListValue) XXX_Size() int { + return xxx_messageInfo_ListValue.Size(m) +} +func (m *ListValue) XXX_DiscardUnknown() { + xxx_messageInfo_ListValue.DiscardUnknown(m) +} + +var xxx_messageInfo_ListValue proto.InternalMessageInfo + +func (m *ListValue) GetValues() []*Value { + if m != nil { + return m.Values + } + return nil +} + +func init() { + proto.RegisterEnum("google.protobuf.NullValue", NullValue_name, NullValue_value) + proto.RegisterType((*Struct)(nil), "google.protobuf.Struct") + proto.RegisterMapType((map[string]*Value)(nil), "google.protobuf.Struct.FieldsEntry") + proto.RegisterType((*Value)(nil), "google.protobuf.Value") + proto.RegisterType((*ListValue)(nil), "google.protobuf.ListValue") +} + +func init() { proto.RegisterFile("google/protobuf/struct.proto", fileDescriptor_df322afd6c9fb402) } + +var fileDescriptor_df322afd6c9fb402 = []byte{ + // 417 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x8b, 0xd3, 0x40, + 0x14, 0xc7, 0x3b, 0xc9, 0x36, 0x98, 0x17, 0x59, 0x97, 0x11, 0xb4, 0xac, 0xa2, 0xa1, 0x7b, 0x09, + 0x22, 0x29, 0xd6, 0x8b, 0x18, 0x2f, 0x06, 0xd6, 0x5d, 0x30, 0x2c, 0x31, 0xba, 0x15, 0xbc, 0x94, + 0x26, 0x4d, 0x63, 0xe8, 0x74, 0x26, 0x24, 0x33, 0x4a, 0x8f, 0x7e, 0x0b, 0xcf, 0x1e, 0x3d, 0xfa, + 0xe9, 0x3c, 0xca, 0xcc, 0x24, 0xa9, 0xb4, 0xf4, 0x94, 0xbc, 0xf7, 0x7e, 0xef, 0x3f, 0xef, 0xff, + 0x66, 0xe0, 0x71, 0xc1, 0x58, 0x41, 0xf2, 0x49, 0x55, 0x33, 0xce, 0x52, 0xb1, 0x9a, 0x34, 0xbc, + 0x16, 0x19, 0xf7, 0x55, 0x8c, 0xef, 0xe9, 0xaa, 0xdf, 0x55, 0xc7, 0x3f, 0x11, 0x58, 0x1f, 0x15, + 0x81, 0x03, 0xb0, 0x56, 0x65, 0x4e, 0x96, 0xcd, 0x08, 0xb9, 0xa6, 0xe7, 0x4c, 0x2f, 0xfc, 0x3d, + 0xd8, 0xd7, 0xa0, 0xff, 0x4e, 0x51, 0x97, 0x94, 0xd7, 0xdb, 0xa4, 0x6d, 0x39, 0xff, 0x00, 0xce, + 0x7f, 0x69, 0x7c, 0x06, 0xe6, 0x3a, 0xdf, 0x8e, 0x90, 0x8b, 0x3c, 0x3b, 0x91, 0xbf, 0xf8, 0x39, + 0x0c, 0xbf, 0x2d, 0x88, 0xc8, 0x47, 0x86, 0x8b, 0x3c, 0x67, 0xfa, 0xe0, 0x40, 0x7c, 0x26, 0xab, + 0x89, 0x86, 0x5e, 0x1b, 0xaf, 0xd0, 0xf8, 0x8f, 0x01, 0x43, 0x95, 0xc4, 0x01, 0x00, 0x15, 0x84, + 0xcc, 0xb5, 0x80, 0x14, 0x3d, 0x9d, 0x9e, 0x1f, 0x08, 0xdc, 0x08, 0x42, 0x14, 0x7f, 0x3d, 0x48, + 0x6c, 0xda, 0x05, 0xf8, 0x02, 0xee, 0x52, 0xb1, 0x49, 0xf3, 0x7a, 0xbe, 0x3b, 0x1f, 0x5d, 0x0f, + 0x12, 0x47, 0x67, 0x7b, 0xa8, 0xe1, 0x75, 0x49, 0x8b, 0x16, 0x32, 0xe5, 0xe0, 0x12, 0xd2, 0x59, + 0x0d, 0x3d, 0x05, 0x48, 0x19, 0xeb, 0xc6, 0x38, 0x71, 0x91, 0x77, 0x47, 0x1e, 0x25, 0x73, 0x1a, + 0x78, 0xa3, 0x54, 0x44, 0xc6, 0x5b, 0x64, 0xa8, 0xac, 0x3e, 0x3c, 0xb2, 0xc7, 0x56, 0x5e, 0x64, + 0xbc, 0x77, 0x49, 0xca, 0xa6, 0xeb, 0xb5, 0x54, 0xef, 0xa1, 0xcb, 0xa8, 0x6c, 0x78, 0xef, 0x92, + 0x74, 0x41, 0x68, 0xc1, 0xc9, 0xba, 0xa4, 0xcb, 0x71, 0x00, 0x76, 0x4f, 0x60, 0x1f, 0x2c, 0x25, + 0xd6, 0xdd, 0xe8, 0xb1, 0xa5, 0xb7, 0xd4, 0xb3, 0x47, 0x60, 0xf7, 0x4b, 0xc4, 0xa7, 0x00, 0x37, + 0xb7, 0x51, 0x34, 0x9f, 0xbd, 0x8d, 0x6e, 0x2f, 0xcf, 0x06, 0xe1, 0x0f, 0x04, 0xf7, 0x33, 0xb6, + 0xd9, 0x97, 0x08, 0x1d, 0xed, 0x26, 0x96, 0x71, 0x8c, 0xbe, 0xbc, 0x28, 0x4a, 0xfe, 0x55, 0xa4, + 0x7e, 0xc6, 0x36, 0x93, 0x82, 0x91, 0x05, 0x2d, 0x76, 0x4f, 0xb1, 0xe2, 0xdb, 0x2a, 0x6f, 0xda, + 0x17, 0x19, 0xe8, 0x4f, 0x95, 0xfe, 0x45, 0xe8, 0x97, 0x61, 0x5e, 0xc5, 0xe1, 0x6f, 0xe3, 0xc9, + 0x95, 0x16, 0x8f, 0xbb, 0xf9, 0x3e, 0xe7, 0x84, 0xbc, 0xa7, 0xec, 0x3b, 0xfd, 0x24, 0x3b, 0x53, + 0x4b, 0x49, 0xbd, 0xfc, 0x17, 0x00, 0x00, 0xff, 0xff, 0xe8, 0x1b, 0x59, 0xf8, 0xe5, 0x02, 0x00, + 0x00, +} diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp.go b/vendor/github.com/golang/protobuf/ptypes/timestamp.go index 47f10dbc..8da0df01 100644 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp.go +++ b/vendor/github.com/golang/protobuf/ptypes/timestamp.go @@ -111,11 +111,9 @@ func TimestampNow() *tspb.Timestamp { // TimestampProto converts the time.Time to a google.protobuf.Timestamp proto. // It returns an error if the resulting Timestamp is invalid. func TimestampProto(t time.Time) (*tspb.Timestamp, error) { - seconds := t.Unix() - nanos := int32(t.Sub(time.Unix(seconds, 0))) ts := &tspb.Timestamp{ - Seconds: seconds, - Nanos: nanos, + Seconds: t.Unix(), + Nanos: int32(t.Nanosecond()), } if err := validateTimestamp(ts); err != nil { return nil, err diff --git a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go index 8e76ae97..31cd846d 100644 --- a/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go +++ b/vendor/github.com/golang/protobuf/ptypes/timestamp/timestamp.pb.go @@ -1,11 +1,13 @@ // Code generated by protoc-gen-go. DO NOT EDIT. // source: google/protobuf/timestamp.proto -package timestamp // import "github.com/golang/protobuf/ptypes/timestamp" +package timestamp -import proto "github.com/golang/protobuf/proto" -import fmt "fmt" -import math "math" +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -16,7 +18,7 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package // A Timestamp represents a point in time independent of any time zone // or calendar, represented as seconds and fractions of seconds at @@ -81,7 +83,9 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // {hour}, {min}, and {sec} are zero-padded to two digits each. The fractional // seconds, which can go up to 9 digits (i.e. up to 1 nanosecond resolution), // are optional. The "Z" suffix indicates the timezone ("UTC"); the timezone -// is required, though only UTC (as indicated by "Z") is presently supported. +// is required. A proto3 JSON serializer should always use UTC (as indicated by +// "Z") when printing the Timestamp type and a proto3 JSON parser should be +// able to accept both UTC and other timezones (as indicated by an offset). // // For example, "2017-01-15T01:30:15.01Z" encodes 15.01 seconds past // 01:30 UTC on January 15, 2017. @@ -92,8 +96,8 @@ const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package // to this format using [`strftime`](https://docs.python.org/2/library/time.html#time.strftime) // with the time format spec '%Y-%m-%dT%H:%M:%S.%fZ'. Likewise, in Java, one // can use the Joda Time's [`ISODateTimeFormat.dateTime()`]( -// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime--) -// to obtain a formatter capable of generating timestamps in this format. +// http://www.joda.org/joda-time/apidocs/org/joda/time/format/ISODateTimeFormat.html#dateTime-- +// ) to obtain a formatter capable of generating timestamps in this format. // // type Timestamp struct { @@ -115,17 +119,19 @@ func (m *Timestamp) Reset() { *m = Timestamp{} } func (m *Timestamp) String() string { return proto.CompactTextString(m) } func (*Timestamp) ProtoMessage() {} func (*Timestamp) Descriptor() ([]byte, []int) { - return fileDescriptor_timestamp_b826e8e5fba671a8, []int{0} + return fileDescriptor_292007bbfe81227e, []int{0} } + func (*Timestamp) XXX_WellKnownType() string { return "Timestamp" } + func (m *Timestamp) XXX_Unmarshal(b []byte) error { return xxx_messageInfo_Timestamp.Unmarshal(m, b) } func (m *Timestamp) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { return xxx_messageInfo_Timestamp.Marshal(b, m, deterministic) } -func (dst *Timestamp) XXX_Merge(src proto.Message) { - xxx_messageInfo_Timestamp.Merge(dst, src) +func (m *Timestamp) XXX_Merge(src proto.Message) { + xxx_messageInfo_Timestamp.Merge(m, src) } func (m *Timestamp) XXX_Size() int { return xxx_messageInfo_Timestamp.Size(m) @@ -154,11 +160,9 @@ func init() { proto.RegisterType((*Timestamp)(nil), "google.protobuf.Timestamp") } -func init() { - proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_timestamp_b826e8e5fba671a8) -} +func init() { proto.RegisterFile("google/protobuf/timestamp.proto", fileDescriptor_292007bbfe81227e) } -var fileDescriptor_timestamp_b826e8e5fba671a8 = []byte{ +var fileDescriptor_292007bbfe81227e = []byte{ // 191 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4f, 0xcf, 0xcf, 0x4f, 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0xc9, 0xcc, 0x4d, diff --git a/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go b/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go new file mode 100644 index 00000000..add19a1a --- /dev/null +++ b/vendor/github.com/golang/protobuf/ptypes/wrappers/wrappers.pb.go @@ -0,0 +1,461 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/wrappers.proto + +package wrappers + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + 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.ProtoPackageIsVersion3 // please upgrade the proto package + +// Wrapper message for `double`. +// +// The JSON representation for `DoubleValue` is JSON number. +type DoubleValue struct { + // The double value. + Value float64 `protobuf:"fixed64,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *DoubleValue) Reset() { *m = DoubleValue{} } +func (m *DoubleValue) String() string { return proto.CompactTextString(m) } +func (*DoubleValue) ProtoMessage() {} +func (*DoubleValue) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{0} +} + +func (*DoubleValue) XXX_WellKnownType() string { return "DoubleValue" } + +func (m *DoubleValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_DoubleValue.Unmarshal(m, b) +} +func (m *DoubleValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_DoubleValue.Marshal(b, m, deterministic) +} +func (m *DoubleValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_DoubleValue.Merge(m, src) +} +func (m *DoubleValue) XXX_Size() int { + return xxx_messageInfo_DoubleValue.Size(m) +} +func (m *DoubleValue) XXX_DiscardUnknown() { + xxx_messageInfo_DoubleValue.DiscardUnknown(m) +} + +var xxx_messageInfo_DoubleValue proto.InternalMessageInfo + +func (m *DoubleValue) GetValue() float64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `float`. +// +// The JSON representation for `FloatValue` is JSON number. +type FloatValue struct { + // The float value. + Value float32 `protobuf:"fixed32,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FloatValue) Reset() { *m = FloatValue{} } +func (m *FloatValue) String() string { return proto.CompactTextString(m) } +func (*FloatValue) ProtoMessage() {} +func (*FloatValue) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{1} +} + +func (*FloatValue) XXX_WellKnownType() string { return "FloatValue" } + +func (m *FloatValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FloatValue.Unmarshal(m, b) +} +func (m *FloatValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FloatValue.Marshal(b, m, deterministic) +} +func (m *FloatValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_FloatValue.Merge(m, src) +} +func (m *FloatValue) XXX_Size() int { + return xxx_messageInfo_FloatValue.Size(m) +} +func (m *FloatValue) XXX_DiscardUnknown() { + xxx_messageInfo_FloatValue.DiscardUnknown(m) +} + +var xxx_messageInfo_FloatValue proto.InternalMessageInfo + +func (m *FloatValue) GetValue() float32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `int64`. +// +// The JSON representation for `Int64Value` is JSON string. +type Int64Value struct { + // The int64 value. + Value int64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int64Value) Reset() { *m = Int64Value{} } +func (m *Int64Value) String() string { return proto.CompactTextString(m) } +func (*Int64Value) ProtoMessage() {} +func (*Int64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{2} +} + +func (*Int64Value) XXX_WellKnownType() string { return "Int64Value" } + +func (m *Int64Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int64Value.Unmarshal(m, b) +} +func (m *Int64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int64Value.Marshal(b, m, deterministic) +} +func (m *Int64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int64Value.Merge(m, src) +} +func (m *Int64Value) XXX_Size() int { + return xxx_messageInfo_Int64Value.Size(m) +} +func (m *Int64Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int64Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int64Value proto.InternalMessageInfo + +func (m *Int64Value) GetValue() int64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `uint64`. +// +// The JSON representation for `UInt64Value` is JSON string. +type UInt64Value struct { + // The uint64 value. + Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt64Value) Reset() { *m = UInt64Value{} } +func (m *UInt64Value) String() string { return proto.CompactTextString(m) } +func (*UInt64Value) ProtoMessage() {} +func (*UInt64Value) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{3} +} + +func (*UInt64Value) XXX_WellKnownType() string { return "UInt64Value" } + +func (m *UInt64Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt64Value.Unmarshal(m, b) +} +func (m *UInt64Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt64Value.Marshal(b, m, deterministic) +} +func (m *UInt64Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt64Value.Merge(m, src) +} +func (m *UInt64Value) XXX_Size() int { + return xxx_messageInfo_UInt64Value.Size(m) +} +func (m *UInt64Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt64Value.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt64Value proto.InternalMessageInfo + +func (m *UInt64Value) GetValue() uint64 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `int32`. +// +// The JSON representation for `Int32Value` is JSON number. +type Int32Value struct { + // The int32 value. + Value int32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Int32Value) Reset() { *m = Int32Value{} } +func (m *Int32Value) String() string { return proto.CompactTextString(m) } +func (*Int32Value) ProtoMessage() {} +func (*Int32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{4} +} + +func (*Int32Value) XXX_WellKnownType() string { return "Int32Value" } + +func (m *Int32Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_Int32Value.Unmarshal(m, b) +} +func (m *Int32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_Int32Value.Marshal(b, m, deterministic) +} +func (m *Int32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_Int32Value.Merge(m, src) +} +func (m *Int32Value) XXX_Size() int { + return xxx_messageInfo_Int32Value.Size(m) +} +func (m *Int32Value) XXX_DiscardUnknown() { + xxx_messageInfo_Int32Value.DiscardUnknown(m) +} + +var xxx_messageInfo_Int32Value proto.InternalMessageInfo + +func (m *Int32Value) GetValue() int32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `uint32`. +// +// The JSON representation for `UInt32Value` is JSON number. +type UInt32Value struct { + // The uint32 value. + Value uint32 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UInt32Value) Reset() { *m = UInt32Value{} } +func (m *UInt32Value) String() string { return proto.CompactTextString(m) } +func (*UInt32Value) ProtoMessage() {} +func (*UInt32Value) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{5} +} + +func (*UInt32Value) XXX_WellKnownType() string { return "UInt32Value" } + +func (m *UInt32Value) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_UInt32Value.Unmarshal(m, b) +} +func (m *UInt32Value) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_UInt32Value.Marshal(b, m, deterministic) +} +func (m *UInt32Value) XXX_Merge(src proto.Message) { + xxx_messageInfo_UInt32Value.Merge(m, src) +} +func (m *UInt32Value) XXX_Size() int { + return xxx_messageInfo_UInt32Value.Size(m) +} +func (m *UInt32Value) XXX_DiscardUnknown() { + xxx_messageInfo_UInt32Value.DiscardUnknown(m) +} + +var xxx_messageInfo_UInt32Value proto.InternalMessageInfo + +func (m *UInt32Value) GetValue() uint32 { + if m != nil { + return m.Value + } + return 0 +} + +// Wrapper message for `bool`. +// +// The JSON representation for `BoolValue` is JSON `true` and `false`. +type BoolValue struct { + // The bool value. + Value bool `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BoolValue) Reset() { *m = BoolValue{} } +func (m *BoolValue) String() string { return proto.CompactTextString(m) } +func (*BoolValue) ProtoMessage() {} +func (*BoolValue) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{6} +} + +func (*BoolValue) XXX_WellKnownType() string { return "BoolValue" } + +func (m *BoolValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BoolValue.Unmarshal(m, b) +} +func (m *BoolValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BoolValue.Marshal(b, m, deterministic) +} +func (m *BoolValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BoolValue.Merge(m, src) +} +func (m *BoolValue) XXX_Size() int { + return xxx_messageInfo_BoolValue.Size(m) +} +func (m *BoolValue) XXX_DiscardUnknown() { + xxx_messageInfo_BoolValue.DiscardUnknown(m) +} + +var xxx_messageInfo_BoolValue proto.InternalMessageInfo + +func (m *BoolValue) GetValue() bool { + if m != nil { + return m.Value + } + return false +} + +// Wrapper message for `string`. +// +// The JSON representation for `StringValue` is JSON string. +type StringValue struct { + // The string value. + Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StringValue) Reset() { *m = StringValue{} } +func (m *StringValue) String() string { return proto.CompactTextString(m) } +func (*StringValue) ProtoMessage() {} +func (*StringValue) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{7} +} + +func (*StringValue) XXX_WellKnownType() string { return "StringValue" } + +func (m *StringValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StringValue.Unmarshal(m, b) +} +func (m *StringValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StringValue.Marshal(b, m, deterministic) +} +func (m *StringValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_StringValue.Merge(m, src) +} +func (m *StringValue) XXX_Size() int { + return xxx_messageInfo_StringValue.Size(m) +} +func (m *StringValue) XXX_DiscardUnknown() { + xxx_messageInfo_StringValue.DiscardUnknown(m) +} + +var xxx_messageInfo_StringValue proto.InternalMessageInfo + +func (m *StringValue) GetValue() string { + if m != nil { + return m.Value + } + return "" +} + +// Wrapper message for `bytes`. +// +// The JSON representation for `BytesValue` is JSON string. +type BytesValue struct { + // The bytes value. + Value []byte `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *BytesValue) Reset() { *m = BytesValue{} } +func (m *BytesValue) String() string { return proto.CompactTextString(m) } +func (*BytesValue) ProtoMessage() {} +func (*BytesValue) Descriptor() ([]byte, []int) { + return fileDescriptor_5377b62bda767935, []int{8} +} + +func (*BytesValue) XXX_WellKnownType() string { return "BytesValue" } + +func (m *BytesValue) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_BytesValue.Unmarshal(m, b) +} +func (m *BytesValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_BytesValue.Marshal(b, m, deterministic) +} +func (m *BytesValue) XXX_Merge(src proto.Message) { + xxx_messageInfo_BytesValue.Merge(m, src) +} +func (m *BytesValue) XXX_Size() int { + return xxx_messageInfo_BytesValue.Size(m) +} +func (m *BytesValue) XXX_DiscardUnknown() { + xxx_messageInfo_BytesValue.DiscardUnknown(m) +} + +var xxx_messageInfo_BytesValue proto.InternalMessageInfo + +func (m *BytesValue) GetValue() []byte { + if m != nil { + return m.Value + } + return nil +} + +func init() { + proto.RegisterType((*DoubleValue)(nil), "google.protobuf.DoubleValue") + proto.RegisterType((*FloatValue)(nil), "google.protobuf.FloatValue") + proto.RegisterType((*Int64Value)(nil), "google.protobuf.Int64Value") + proto.RegisterType((*UInt64Value)(nil), "google.protobuf.UInt64Value") + proto.RegisterType((*Int32Value)(nil), "google.protobuf.Int32Value") + proto.RegisterType((*UInt32Value)(nil), "google.protobuf.UInt32Value") + proto.RegisterType((*BoolValue)(nil), "google.protobuf.BoolValue") + proto.RegisterType((*StringValue)(nil), "google.protobuf.StringValue") + proto.RegisterType((*BytesValue)(nil), "google.protobuf.BytesValue") +} + +func init() { proto.RegisterFile("google/protobuf/wrappers.proto", fileDescriptor_5377b62bda767935) } + +var fileDescriptor_5377b62bda767935 = []byte{ + // 259 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x2f, 0x2f, 0x4a, 0x2c, + 0x28, 0x48, 0x2d, 0x2a, 0xd6, 0x03, 0x8b, 0x08, 0xf1, 0x43, 0xe4, 0xf5, 0x60, 0xf2, 0x4a, 0xca, + 0x5c, 0xdc, 0x2e, 0xf9, 0xa5, 0x49, 0x39, 0xa9, 0x61, 0x89, 0x39, 0xa5, 0xa9, 0x42, 0x22, 0x5c, + 0xac, 0x65, 0x20, 0x86, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x63, 0x10, 0x84, 0xa3, 0xa4, 0xc4, 0xc5, + 0xe5, 0x96, 0x93, 0x9f, 0x58, 0x82, 0x45, 0x0d, 0x13, 0x92, 0x1a, 0xcf, 0xbc, 0x12, 0x33, 0x13, + 0x2c, 0x6a, 0x98, 0x61, 0x6a, 0x94, 0xb9, 0xb8, 0x43, 0x71, 0x29, 0x62, 0x41, 0x35, 0xc8, 0xd8, + 0x08, 0x8b, 0x1a, 0x56, 0x34, 0x83, 0xb0, 0x2a, 0xe2, 0x85, 0x29, 0x52, 0xe4, 0xe2, 0x74, 0xca, + 0xcf, 0xcf, 0xc1, 0xa2, 0x84, 0x03, 0xc9, 0x9c, 0xe0, 0x92, 0xa2, 0xcc, 0xbc, 0x74, 0x2c, 0x8a, + 0x38, 0x91, 0x1c, 0xe4, 0x54, 0x59, 0x92, 0x5a, 0x8c, 0x45, 0x0d, 0x0f, 0x54, 0x8d, 0x53, 0x0d, + 0x97, 0x70, 0x72, 0x7e, 0xae, 0x1e, 0x5a, 0xe8, 0x3a, 0xf1, 0x86, 0x43, 0x83, 0x3f, 0x00, 0x24, + 0x12, 0xc0, 0x18, 0xa5, 0x95, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0xab, 0x9f, + 0x9e, 0x9f, 0x93, 0x98, 0x97, 0x8e, 0x88, 0xaa, 0x82, 0x92, 0xca, 0x82, 0xd4, 0x62, 0x78, 0x8c, + 0xfd, 0x60, 0x64, 0x5c, 0xc4, 0xc4, 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x6e, + 0x00, 0x54, 0xa9, 0x5e, 0x78, 0x6a, 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x08, 0x48, 0x4b, + 0x12, 0x1b, 0xd8, 0x0c, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x19, 0x6c, 0xb9, 0xb8, 0xfe, + 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt b/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt new file mode 100644 index 00000000..36451625 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/LICENSE.txt @@ -0,0 +1,27 @@ +Copyright (c) 2015, Gengo, Inc. +All rights reserved. + +Redistribution and use in source and binary forms, with or without modification, +are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + + * Neither the name of Gengo, 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/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go new file mode 100644 index 00000000..8858f069 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/internal/stream_chunk.pb.go @@ -0,0 +1,118 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: internal/stream_chunk.proto + +package internal + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import any "github.com/golang/protobuf/ptypes/any" + +// 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 + +// StreamError is a response type which is returned when +// streaming rpc returns an error. +type StreamError struct { + GrpcCode int32 `protobuf:"varint,1,opt,name=grpc_code,json=grpcCode,proto3" json:"grpc_code,omitempty"` + HttpCode int32 `protobuf:"varint,2,opt,name=http_code,json=httpCode,proto3" json:"http_code,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message,proto3" json:"message,omitempty"` + HttpStatus string `protobuf:"bytes,4,opt,name=http_status,json=httpStatus,proto3" json:"http_status,omitempty"` + Details []*any.Any `protobuf:"bytes,5,rep,name=details,proto3" json:"details,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *StreamError) Reset() { *m = StreamError{} } +func (m *StreamError) String() string { return proto.CompactTextString(m) } +func (*StreamError) ProtoMessage() {} +func (*StreamError) Descriptor() ([]byte, []int) { + return fileDescriptor_stream_chunk_a2afb657504565d7, []int{0} +} +func (m *StreamError) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_StreamError.Unmarshal(m, b) +} +func (m *StreamError) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_StreamError.Marshal(b, m, deterministic) +} +func (dst *StreamError) XXX_Merge(src proto.Message) { + xxx_messageInfo_StreamError.Merge(dst, src) +} +func (m *StreamError) XXX_Size() int { + return xxx_messageInfo_StreamError.Size(m) +} +func (m *StreamError) XXX_DiscardUnknown() { + xxx_messageInfo_StreamError.DiscardUnknown(m) +} + +var xxx_messageInfo_StreamError proto.InternalMessageInfo + +func (m *StreamError) GetGrpcCode() int32 { + if m != nil { + return m.GrpcCode + } + return 0 +} + +func (m *StreamError) GetHttpCode() int32 { + if m != nil { + return m.HttpCode + } + return 0 +} + +func (m *StreamError) GetMessage() string { + if m != nil { + return m.Message + } + return "" +} + +func (m *StreamError) GetHttpStatus() string { + if m != nil { + return m.HttpStatus + } + return "" +} + +func (m *StreamError) GetDetails() []*any.Any { + if m != nil { + return m.Details + } + return nil +} + +func init() { + proto.RegisterType((*StreamError)(nil), "grpc.gateway.runtime.StreamError") +} + +func init() { + proto.RegisterFile("internal/stream_chunk.proto", fileDescriptor_stream_chunk_a2afb657504565d7) +} + +var fileDescriptor_stream_chunk_a2afb657504565d7 = []byte{ + // 223 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x34, 0x90, 0x41, 0x4e, 0xc3, 0x30, + 0x10, 0x45, 0x15, 0x4a, 0x69, 0x3b, 0xd9, 0x45, 0x5d, 0x18, 0xba, 0x20, 0x62, 0x95, 0x95, 0x23, + 0xc1, 0x09, 0x00, 0x71, 0x81, 0x74, 0xc7, 0xa6, 0x9a, 0x26, 0x83, 0x13, 0x91, 0xd8, 0xd1, 0x78, + 0x22, 0x94, 0x6b, 0x71, 0xc2, 0xca, 0x8e, 0xb2, 0xf4, 0x7b, 0x7f, 0xbe, 0xbe, 0x0c, 0xa7, 0xce, + 0x0a, 0xb1, 0xc5, 0xbe, 0xf4, 0xc2, 0x84, 0xc3, 0xa5, 0x6e, 0x27, 0xfb, 0xab, 0x47, 0x76, 0xe2, + 0xb2, 0xa3, 0xe1, 0xb1, 0xd6, 0x06, 0x85, 0xfe, 0x70, 0xd6, 0x3c, 0x59, 0xe9, 0x06, 0x7a, 0x7a, + 0x34, 0xce, 0x99, 0x9e, 0xca, 0x98, 0xb9, 0x4e, 0x3f, 0x25, 0xda, 0x79, 0x39, 0x78, 0xf9, 0x4f, + 0x20, 0x3d, 0xc7, 0x9e, 0x2f, 0x66, 0xc7, 0xd9, 0x09, 0x0e, 0xa1, 0xe2, 0x52, 0xbb, 0x86, 0x54, + 0x92, 0x27, 0xc5, 0xb6, 0xda, 0x07, 0xf0, 0xe9, 0x1a, 0x0a, 0xb2, 0x15, 0x19, 0x17, 0x79, 0xb7, + 0xc8, 0x00, 0xa2, 0x54, 0xb0, 0x1b, 0xc8, 0x7b, 0x34, 0xa4, 0x36, 0x79, 0x52, 0x1c, 0xaa, 0xf5, + 0x99, 0x3d, 0x43, 0x1a, 0xcf, 0xbc, 0xa0, 0x4c, 0x5e, 0xdd, 0x47, 0x0b, 0x01, 0x9d, 0x23, 0xc9, + 0x34, 0xec, 0x1a, 0x12, 0xec, 0x7a, 0xaf, 0xb6, 0xf9, 0xa6, 0x48, 0x5f, 0x8f, 0x7a, 0x59, 0xac, + 0xd7, 0xc5, 0xfa, 0xdd, 0xce, 0xd5, 0x1a, 0xfa, 0x80, 0xef, 0xfd, 0xfa, 0x09, 0xd7, 0x87, 0x18, + 0x79, 0xbb, 0x05, 0x00, 0x00, 0xff, 0xff, 0x0d, 0x7d, 0xa5, 0x18, 0x17, 0x01, 0x00, 0x00, +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go new file mode 100644 index 00000000..896057e1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/context.go @@ -0,0 +1,210 @@ +package runtime + +import ( + "context" + "encoding/base64" + "fmt" + "net" + "net/http" + "net/textproto" + "strconv" + "strings" + "time" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// MetadataHeaderPrefix is the http prefix that represents custom metadata +// parameters to or from a gRPC call. +const MetadataHeaderPrefix = "Grpc-Metadata-" + +// MetadataPrefix is prepended to permanent HTTP header keys (as specified +// by the IANA) when added to the gRPC context. +const MetadataPrefix = "grpcgateway-" + +// MetadataTrailerPrefix is prepended to gRPC metadata as it is converted to +// HTTP headers in a response handled by grpc-gateway +const MetadataTrailerPrefix = "Grpc-Trailer-" + +const metadataGrpcTimeout = "Grpc-Timeout" +const metadataHeaderBinarySuffix = "-Bin" + +const xForwardedFor = "X-Forwarded-For" +const xForwardedHost = "X-Forwarded-Host" + +var ( + // DefaultContextTimeout is used for gRPC call context.WithTimeout whenever a Grpc-Timeout inbound + // header isn't present. If the value is 0 the sent `context` will not have a timeout. + DefaultContextTimeout = 0 * time.Second +) + +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) +} + +/* +AnnotateContext adds context information such as metadata from the request. + +At a minimum, the RemoteAddr is included in the fashion of "X-Forwarded-For", +except that the forwarded destination is not another HTTP service but rather +a gRPC service. +*/ +func AnnotateContext(ctx context.Context, mux *ServeMux, req *http.Request) (context.Context, error) { + var pairs []string + timeout := DefaultContextTimeout + if tm := req.Header.Get(metadataGrpcTimeout); tm != "" { + var err error + timeout, err = timeoutDecode(tm) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid grpc-timeout: %s", tm) + } + } + + for key, vals := range req.Header { + for _, val := range vals { + key = textproto.CanonicalMIMEHeaderKey(key) + // For backwards-compatibility, pass through 'authorization' header with no prefix. + if key == "Authorization" { + pairs = append(pairs, "authorization", val) + } + if h, ok := mux.incomingHeaderMatcher(key); ok { + // Handles "-bin" metadata in grpc, since grpc will do another base64 + // encode before sending to server, we need to decode it first. + if strings.HasSuffix(key, metadataHeaderBinarySuffix) { + b, err := decodeBinHeader(val) + if err != nil { + return nil, status.Errorf(codes.InvalidArgument, "invalid binary header %s: %s", key, err) + } + + val = string(b) + } + pairs = append(pairs, h, val) + } + } + } + if host := req.Header.Get(xForwardedHost); host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), host) + } else if req.Host != "" { + pairs = append(pairs, strings.ToLower(xForwardedHost), req.Host) + } + + if addr := req.RemoteAddr; addr != "" { + if remoteIP, _, err := net.SplitHostPort(addr); err == nil { + if fwd := req.Header.Get(xForwardedFor); fwd == "" { + pairs = append(pairs, strings.ToLower(xForwardedFor), remoteIP) + } else { + pairs = append(pairs, strings.ToLower(xForwardedFor), fmt.Sprintf("%s, %s", fwd, remoteIP)) + } + } else { + grpclog.Infof("invalid remote addr: %s", addr) + } + } + + if timeout != 0 { + ctx, _ = context.WithTimeout(ctx, timeout) + } + if len(pairs) == 0 { + return ctx, nil + } + md := metadata.Pairs(pairs...) + for _, mda := range mux.metadataAnnotators { + md = metadata.Join(md, mda(ctx, req)) + } + return metadata.NewOutgoingContext(ctx, md), nil +} + +// ServerMetadata consists of metadata sent from gRPC server. +type ServerMetadata struct { + HeaderMD metadata.MD + TrailerMD metadata.MD +} + +type serverMetadataKey struct{} + +// NewServerMetadataContext creates a new context with ServerMetadata +func NewServerMetadataContext(ctx context.Context, md ServerMetadata) context.Context { + return context.WithValue(ctx, serverMetadataKey{}, md) +} + +// ServerMetadataFromContext returns the ServerMetadata in ctx +func ServerMetadataFromContext(ctx context.Context) (md ServerMetadata, ok bool) { + md, ok = ctx.Value(serverMetadataKey{}).(ServerMetadata) + return +} + +func timeoutDecode(s string) (time.Duration, error) { + size := len(s) + if size < 2 { + return 0, fmt.Errorf("timeout string is too short: %q", s) + } + d, ok := timeoutUnitToDuration(s[size-1]) + if !ok { + return 0, fmt.Errorf("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 +} + +func timeoutUnitToDuration(u uint8) (d time.Duration, ok bool) { + switch u { + case 'H': + return time.Hour, true + case 'M': + return time.Minute, true + case 'S': + return time.Second, true + case 'm': + return time.Millisecond, true + case 'u': + return time.Microsecond, true + case 'n': + return time.Nanosecond, true + default: + } + return +} + +// isPermanentHTTPHeader checks whether hdr belongs to the list of +// permenant request headers maintained by IANA. +// http://www.iana.org/assignments/message-headers/message-headers.xml +func isPermanentHTTPHeader(hdr string) bool { + switch hdr { + case + "Accept", + "Accept-Charset", + "Accept-Language", + "Accept-Ranges", + "Authorization", + "Cache-Control", + "Content-Type", + "Cookie", + "Date", + "Expect", + "From", + "Host", + "If-Match", + "If-Modified-Since", + "If-None-Match", + "If-Schedule-Tag-Match", + "If-Unmodified-Since", + "Max-Forwards", + "Origin", + "Pragma", + "Referer", + "User-Agent", + "Via", + "Warning": + return true + } + return false +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go new file mode 100644 index 00000000..a5b3bd6a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/convert.go @@ -0,0 +1,312 @@ +package runtime + +import ( + "encoding/base64" + "fmt" + "strconv" + "strings" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/ptypes/duration" + "github.com/golang/protobuf/ptypes/timestamp" + "github.com/golang/protobuf/ptypes/wrappers" +) + +// String just returns the given string. +// It is just for compatibility to other types. +func String(val string) (string, error) { + return val, nil +} + +// StringSlice converts 'val' where individual strings are separated by +// 'sep' into a string slice. +func StringSlice(val, sep string) ([]string, error) { + return strings.Split(val, sep), nil +} + +// Bool converts the given string representation of a boolean value into bool. +func Bool(val string) (bool, error) { + return strconv.ParseBool(val) +} + +// BoolSlice converts 'val' where individual booleans are separated by +// 'sep' into a bool slice. +func BoolSlice(val, sep string) ([]bool, error) { + s := strings.Split(val, sep) + values := make([]bool, len(s)) + for i, v := range s { + value, err := Bool(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Float64 converts the given string representation into representation of a floating point number into float64. +func Float64(val string) (float64, error) { + return strconv.ParseFloat(val, 64) +} + +// Float64Slice converts 'val' where individual floating point numbers are separated by +// 'sep' into a float64 slice. +func Float64Slice(val, sep string) ([]float64, error) { + s := strings.Split(val, sep) + values := make([]float64, len(s)) + for i, v := range s { + value, err := Float64(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Float32 converts the given string representation of a floating point number into float32. +func Float32(val string) (float32, error) { + f, err := strconv.ParseFloat(val, 32) + if err != nil { + return 0, err + } + return float32(f), nil +} + +// Float32Slice converts 'val' where individual floating point numbers are separated by +// 'sep' into a float32 slice. +func Float32Slice(val, sep string) ([]float32, error) { + s := strings.Split(val, sep) + values := make([]float32, len(s)) + for i, v := range s { + value, err := Float32(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Int64 converts the given string representation of an integer into int64. +func Int64(val string) (int64, error) { + return strconv.ParseInt(val, 0, 64) +} + +// Int64Slice converts 'val' where individual integers are separated by +// 'sep' into a int64 slice. +func Int64Slice(val, sep string) ([]int64, error) { + s := strings.Split(val, sep) + values := make([]int64, len(s)) + for i, v := range s { + value, err := Int64(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Int32 converts the given string representation of an integer into int32. +func Int32(val string) (int32, error) { + i, err := strconv.ParseInt(val, 0, 32) + if err != nil { + return 0, err + } + return int32(i), nil +} + +// Int32Slice converts 'val' where individual integers are separated by +// 'sep' into a int32 slice. +func Int32Slice(val, sep string) ([]int32, error) { + s := strings.Split(val, sep) + values := make([]int32, len(s)) + for i, v := range s { + value, err := Int32(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Uint64 converts the given string representation of an integer into uint64. +func Uint64(val string) (uint64, error) { + return strconv.ParseUint(val, 0, 64) +} + +// Uint64Slice converts 'val' where individual integers are separated by +// 'sep' into a uint64 slice. +func Uint64Slice(val, sep string) ([]uint64, error) { + s := strings.Split(val, sep) + values := make([]uint64, len(s)) + for i, v := range s { + value, err := Uint64(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Uint32 converts the given string representation of an integer into uint32. +func Uint32(val string) (uint32, error) { + i, err := strconv.ParseUint(val, 0, 32) + if err != nil { + return 0, err + } + return uint32(i), nil +} + +// Uint32Slice converts 'val' where individual integers are separated by +// 'sep' into a uint32 slice. +func Uint32Slice(val, sep string) ([]uint32, error) { + s := strings.Split(val, sep) + values := make([]uint32, len(s)) + for i, v := range s { + value, err := Uint32(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Bytes converts the given string representation of a byte sequence into a slice of bytes +// A bytes sequence is encoded in URL-safe base64 without padding +func Bytes(val string) ([]byte, error) { + b, err := base64.StdEncoding.DecodeString(val) + if err != nil { + b, err = base64.URLEncoding.DecodeString(val) + if err != nil { + return nil, err + } + } + return b, nil +} + +// BytesSlice converts 'val' where individual bytes sequences, encoded in URL-safe +// base64 without padding, are separated by 'sep' into a slice of bytes slices slice. +func BytesSlice(val, sep string) ([][]byte, error) { + s := strings.Split(val, sep) + values := make([][]byte, len(s)) + for i, v := range s { + value, err := Bytes(v) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +// Timestamp converts the given RFC3339 formatted string into a timestamp.Timestamp. +func Timestamp(val string) (*timestamp.Timestamp, error) { + var r *timestamp.Timestamp + err := jsonpb.UnmarshalString(val, r) + return r, err +} + +// Duration converts the given string into a timestamp.Duration. +func Duration(val string) (*duration.Duration, error) { + var r *duration.Duration + err := jsonpb.UnmarshalString(val, r) + return r, err +} + +// Enum converts the given string into an int32 that should be type casted into the +// correct enum proto type. +func Enum(val string, enumValMap map[string]int32) (int32, error) { + e, ok := enumValMap[val] + if ok { + return e, nil + } + + i, err := Int32(val) + if err != nil { + return 0, fmt.Errorf("%s is not valid", val) + } + for _, v := range enumValMap { + if v == i { + return i, nil + } + } + return 0, fmt.Errorf("%s is not valid", val) +} + +// EnumSlice converts 'val' where individual enums are separated by 'sep' +// into a int32 slice. Each individual int32 should be type casted into the +// correct enum proto type. +func EnumSlice(val, sep string, enumValMap map[string]int32) ([]int32, error) { + s := strings.Split(val, sep) + values := make([]int32, len(s)) + for i, v := range s { + value, err := Enum(v, enumValMap) + if err != nil { + return values, err + } + values[i] = value + } + return values, nil +} + +/* + Support fot google.protobuf.wrappers on top of primitive types +*/ + +// StringValue well-known type support as wrapper around string type +func StringValue(val string) (*wrappers.StringValue, error) { + return &wrappers.StringValue{Value: val}, nil +} + +// FloatValue well-known type support as wrapper around float32 type +func FloatValue(val string) (*wrappers.FloatValue, error) { + parsedVal, err := Float32(val) + return &wrappers.FloatValue{Value: parsedVal}, err +} + +// DoubleValue well-known type support as wrapper around float64 type +func DoubleValue(val string) (*wrappers.DoubleValue, error) { + parsedVal, err := Float64(val) + return &wrappers.DoubleValue{Value: parsedVal}, err +} + +// BoolValue well-known type support as wrapper around bool type +func BoolValue(val string) (*wrappers.BoolValue, error) { + parsedVal, err := Bool(val) + return &wrappers.BoolValue{Value: parsedVal}, err +} + +// Int32Value well-known type support as wrapper around int32 type +func Int32Value(val string) (*wrappers.Int32Value, error) { + parsedVal, err := Int32(val) + return &wrappers.Int32Value{Value: parsedVal}, err +} + +// UInt32Value well-known type support as wrapper around uint32 type +func UInt32Value(val string) (*wrappers.UInt32Value, error) { + parsedVal, err := Uint32(val) + return &wrappers.UInt32Value{Value: parsedVal}, err +} + +// Int64Value well-known type support as wrapper around int64 type +func Int64Value(val string) (*wrappers.Int64Value, error) { + parsedVal, err := Int64(val) + return &wrappers.Int64Value{Value: parsedVal}, err +} + +// UInt64Value well-known type support as wrapper around uint64 type +func UInt64Value(val string) (*wrappers.UInt64Value, error) { + parsedVal, err := Uint64(val) + return &wrappers.UInt64Value{Value: parsedVal}, err +} + +// BytesValue well-known type support as wrapper around bytes[] type +func BytesValue(val string) (*wrappers.BytesValue, error) { + parsedVal, err := Bytes(val) + return &wrappers.BytesValue{Value: parsedVal}, err +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go new file mode 100644 index 00000000..b6e5ddf7 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/doc.go @@ -0,0 +1,5 @@ +/* +Package runtime contains runtime helper functions used by +servers which protoc-gen-grpc-gateway generates. +*/ +package runtime diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go new file mode 100644 index 00000000..41d54ef9 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/errors.go @@ -0,0 +1,145 @@ +package runtime + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/proto" + "github.com/golang/protobuf/ptypes/any" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// HTTPStatusFromCode converts a gRPC error code into the corresponding HTTP response status. +// See: https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto +func HTTPStatusFromCode(code codes.Code) int { + switch code { + case codes.OK: + return http.StatusOK + case codes.Canceled: + return http.StatusRequestTimeout + case codes.Unknown: + return http.StatusInternalServerError + case codes.InvalidArgument: + return http.StatusBadRequest + case codes.DeadlineExceeded: + return http.StatusGatewayTimeout + case codes.NotFound: + return http.StatusNotFound + case codes.AlreadyExists: + return http.StatusConflict + case codes.PermissionDenied: + return http.StatusForbidden + case codes.Unauthenticated: + return http.StatusUnauthorized + case codes.ResourceExhausted: + return http.StatusTooManyRequests + case codes.FailedPrecondition: + return http.StatusPreconditionFailed + case codes.Aborted: + return http.StatusConflict + case codes.OutOfRange: + return http.StatusBadRequest + case codes.Unimplemented: + return http.StatusNotImplemented + case codes.Internal: + return http.StatusInternalServerError + case codes.Unavailable: + return http.StatusServiceUnavailable + case codes.DataLoss: + return http.StatusInternalServerError + } + + grpclog.Infof("Unknown gRPC error code: %v", code) + return http.StatusInternalServerError +} + +var ( + // HTTPError replies to the request with the error. + // You can set a custom function to this variable to customize error format. + HTTPError = DefaultHTTPError + // OtherErrorHandler handles the following error used by the gateway: StatusMethodNotAllowed StatusNotFound and StatusBadRequest + OtherErrorHandler = DefaultOtherErrorHandler +) + +type errorBody struct { + Error string `protobuf:"bytes,1,name=error" json:"error"` + // This is to make the error more compatible with users that expect errors to be Status objects: + // https://github.com/grpc/grpc/blob/master/src/proto/grpc/status/status.proto + // It should be the exact same message as the Error field. + Message string `protobuf:"bytes,1,name=message" json:"message"` + Code int32 `protobuf:"varint,2,name=code" json:"code"` + Details []*any.Any `protobuf:"bytes,3,rep,name=details" json:"details,omitempty"` +} + +// Make this also conform to proto.Message for builtin JSONPb Marshaler +func (e *errorBody) Reset() { *e = errorBody{} } +func (e *errorBody) String() string { return proto.CompactTextString(e) } +func (*errorBody) ProtoMessage() {} + +// DefaultHTTPError is the default implementation of HTTPError. +// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. +// If otherwise, it replies with http.StatusInternalServerError. +// +// The response body returned by this function is a JSON object, +// which contains a member whose key is "error" and whose value is err.Error(). +func DefaultHTTPError(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { + const fallback = `{"error": "failed to marshal error message"}` + + s, ok := status.FromError(err) + if !ok { + s = status.New(codes.Unknown, err.Error()) + } + + w.Header().Del("Trailer") + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + pb := s.Proto() + contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + } + w.Header().Set("Content-Type", contentType) + + body := &errorBody{ + Error: s.Message(), + Message: s.Message(), + Code: int32(s.Code()), + Details: s.Proto().GetDetails(), + } + + buf, merr := marshaler.Marshal(body) + if merr != nil { + grpclog.Infof("Failed to marshal error message %q: %v", body, merr) + w.WriteHeader(http.StatusInternalServerError) + if _, err := io.WriteString(w, fallback); err != nil { + grpclog.Infof("Failed to write response: %v", err) + } + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Infof("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, mux, md) + handleForwardResponseTrailerHeader(w, md) + st := HTTPStatusFromCode(s.Code()) + w.WriteHeader(st) + if _, err := w.Write(buf); err != nil { + grpclog.Infof("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} + +// DefaultOtherErrorHandler is the default implementation of OtherErrorHandler. +// It simply writes a string representation of the given error into "w". +func DefaultOtherErrorHandler(w http.ResponseWriter, _ *http.Request, msg string, code int) { + http.Error(w, msg, code) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go new file mode 100644 index 00000000..e1cf7a91 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/fieldmask.go @@ -0,0 +1,70 @@ +package runtime + +import ( + "encoding/json" + "io" + "strings" + + "github.com/golang/protobuf/protoc-gen-go/generator" + "google.golang.org/genproto/protobuf/field_mask" +) + +// FieldMaskFromRequestBody creates a FieldMask printing all complete paths from the JSON body. +func FieldMaskFromRequestBody(r io.Reader) (*field_mask.FieldMask, error) { + fm := &field_mask.FieldMask{} + var root interface{} + if err := json.NewDecoder(r).Decode(&root); err != nil { + if err == io.EOF { + return fm, nil + } + return nil, err + } + + queue := []fieldMaskPathItem{{node: root}} + for len(queue) > 0 { + // dequeue an item + item := queue[0] + queue = queue[1:] + + if m, ok := item.node.(map[string]interface{}); ok { + // if the item is an object, then enqueue all of its children + for k, v := range m { + queue = append(queue, fieldMaskPathItem{path: append(item.path, generator.CamelCase(k)), node: v}) + } + } else if len(item.path) > 0 { + // otherwise, it's a leaf node so print its path + fm.Paths = append(fm.Paths, strings.Join(item.path, ".")) + } + } + + return fm, nil +} + +// fieldMaskPathItem stores a in-progress deconstruction of a path for a fieldmask +type fieldMaskPathItem struct { + // the list of prior fields leading up to node + path []string + + // a generic decoded json object the current item to inspect for further path extraction + node interface{} +} + +// CamelCaseFieldMask updates the given FieldMask by converting all of its paths to CamelCase, using the same heuristic +// that's used for naming protobuf fields in Go. +func CamelCaseFieldMask(mask *field_mask.FieldMask) { + if mask == nil || mask.Paths == nil { + return + } + + var newPaths []string + for _, path := range mask.Paths { + lowerCasedParts := strings.Split(path, ".") + var camelCasedParts []string + for _, part := range lowerCasedParts { + camelCasedParts = append(camelCasedParts, generator.CamelCase(part)) + } + newPaths = append(newPaths, strings.Join(camelCasedParts, ".")) + } + + mask.Paths = newPaths +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go new file mode 100644 index 00000000..2af90065 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/handler.go @@ -0,0 +1,209 @@ +package runtime + +import ( + "errors" + "fmt" + "io" + "net/http" + "net/textproto" + + "context" + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/internal" + "google.golang.org/grpc/grpclog" +) + +var errEmptyResponse = errors.New("empty response") + +// ForwardResponseStream forwards the stream from gRPC server to REST client. +func ForwardResponseStream(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, recv func() (proto.Message, error), opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { + f, ok := w.(http.Flusher) + if !ok { + grpclog.Infof("Flush not supported in %T", w) + http.Error(w, "unexpected type of web server", http.StatusInternalServerError) + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Infof("Failed to extract ServerMetadata from context") + http.Error(w, "unexpected error", http.StatusInternalServerError) + return + } + handleForwardResponseServerMetadata(w, mux, md) + + w.Header().Set("Transfer-Encoding", "chunked") + w.Header().Set("Content-Type", marshaler.ContentType()) + if err := handleForwardResponseOptions(ctx, w, nil, opts); err != nil { + HTTPError(ctx, mux, marshaler, w, req, err) + return + } + + var delimiter []byte + if d, ok := marshaler.(Delimited); ok { + delimiter = d.Delimiter() + } else { + delimiter = []byte("\n") + } + + var wroteHeader bool + for { + resp, err := recv() + if err == io.EOF { + return + } + if err != nil { + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + return + } + if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + return + } + + buf, err := marshaler.Marshal(streamChunk(ctx, resp, mux.streamErrorHandler)) + if err != nil { + grpclog.Infof("Failed to marshal response chunk: %v", err) + handleForwardResponseStreamError(ctx, wroteHeader, marshaler, w, req, mux, err) + return + } + if _, err = w.Write(buf); err != nil { + grpclog.Infof("Failed to send response chunk: %v", err) + return + } + wroteHeader = true + if _, err = w.Write(delimiter); err != nil { + grpclog.Infof("Failed to send delimiter chunk: %v", err) + return + } + f.Flush() + } +} + +func handleForwardResponseServerMetadata(w http.ResponseWriter, mux *ServeMux, md ServerMetadata) { + for k, vs := range md.HeaderMD { + if h, ok := mux.outgoingHeaderMatcher(k); ok { + for _, v := range vs { + w.Header().Add(h, v) + } + } + } +} + +func handleForwardResponseTrailerHeader(w http.ResponseWriter, md ServerMetadata) { + for k := range md.TrailerMD { + tKey := textproto.CanonicalMIMEHeaderKey(fmt.Sprintf("%s%s", MetadataTrailerPrefix, k)) + w.Header().Add("Trailer", tKey) + } +} + +func handleForwardResponseTrailer(w http.ResponseWriter, md ServerMetadata) { + for k, vs := range md.TrailerMD { + tKey := fmt.Sprintf("%s%s", MetadataTrailerPrefix, k) + for _, v := range vs { + w.Header().Add(tKey, v) + } + } +} + +// responseBody interface contains method for getting field for marshaling to the response body +// this method is generated for response struct from the value of `response_body` in the `google.api.HttpRule` +type responseBody interface { + XXX_ResponseBody() interface{} +} + +// ForwardResponseMessage forwards the message "resp" from gRPC server to REST client. +func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) { + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Infof("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, mux, md) + handleForwardResponseTrailerHeader(w, md) + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + contentType = httpBodyMarshaler.ContentTypeFromMessage(resp) + } + w.Header().Set("Content-Type", contentType) + + if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil { + HTTPError(ctx, mux, marshaler, w, req, err) + return + } + var buf []byte + var err error + if rb, ok := resp.(responseBody); ok { + buf, err = marshaler.Marshal(rb.XXX_ResponseBody()) + } else { + buf, err = marshaler.Marshal(resp) + } + if err != nil { + grpclog.Infof("Marshal error: %v", err) + HTTPError(ctx, mux, marshaler, w, req, err) + return + } + + if _, err = w.Write(buf); err != nil { + grpclog.Infof("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} + +func handleForwardResponseOptions(ctx context.Context, w http.ResponseWriter, resp proto.Message, opts []func(context.Context, http.ResponseWriter, proto.Message) error) error { + if len(opts) == 0 { + return nil + } + for _, opt := range opts { + if err := opt(ctx, w, resp); err != nil { + grpclog.Infof("Error handling ForwardResponseOptions: %v", err) + return err + } + } + return nil +} + +func handleForwardResponseStreamError(ctx context.Context, wroteHeader bool, marshaler Marshaler, w http.ResponseWriter, req *http.Request, mux *ServeMux, err error) { + serr := streamError(ctx, mux.streamErrorHandler, err) + if !wroteHeader { + w.WriteHeader(int(serr.HttpCode)) + } + buf, merr := marshaler.Marshal(errorChunk(serr)) + if merr != nil { + grpclog.Infof("Failed to marshal an error: %v", merr) + return + } + if _, werr := w.Write(buf); werr != nil { + grpclog.Infof("Failed to notify error to client: %v", werr) + return + } +} + +// streamChunk returns a chunk in a response stream for the given result. The +// given errHandler is used to render an error chunk if result is nil. +func streamChunk(ctx context.Context, result proto.Message, errHandler StreamErrorHandlerFunc) map[string]proto.Message { + if result == nil { + return errorChunk(streamError(ctx, errHandler, errEmptyResponse)) + } + return map[string]proto.Message{"result": result} +} + +// streamError returns the payload for the final message in a response stream +// that represents the given err. +func streamError(ctx context.Context, errHandler StreamErrorHandlerFunc, err error) *StreamError { + serr := errHandler(ctx, err) + if serr != nil { + return serr + } + // TODO: log about misbehaving stream error handler? + return DefaultHTTPStreamErrorHandler(ctx, err) +} + +func errorChunk(err *StreamError) map[string]proto.Message { + return map[string]proto.Message{"error": (*internal.StreamError)(err)} +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_httpbodyproto.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_httpbodyproto.go new file mode 100644 index 00000000..f55285b5 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_httpbodyproto.go @@ -0,0 +1,43 @@ +package runtime + +import ( + "google.golang.org/genproto/googleapis/api/httpbody" +) + +// SetHTTPBodyMarshaler overwrite the default marshaler with the HTTPBodyMarshaler +func SetHTTPBodyMarshaler(serveMux *ServeMux) { + serveMux.marshalers.mimeMap[MIMEWildcard] = &HTTPBodyMarshaler{ + Marshaler: &JSONPb{OrigName: true}, + } +} + +// HTTPBodyMarshaler is a Marshaler which supports marshaling of a +// google.api.HttpBody message as the full response body if it is +// the actual message used as the response. If not, then this will +// simply fallback to the Marshaler specified as its default Marshaler. +type HTTPBodyMarshaler struct { + Marshaler +} + +// ContentType implementation to keep backwards compatability with marshal interface +func (h *HTTPBodyMarshaler) ContentType() string { + return h.ContentTypeFromMessage(nil) +} + +// ContentTypeFromMessage in case v is a google.api.HttpBody message it returns +// its specified content type otherwise fall back to the default Marshaler. +func (h *HTTPBodyMarshaler) ContentTypeFromMessage(v interface{}) string { + if httpBody, ok := v.(*httpbody.HttpBody); ok { + return httpBody.GetContentType() + } + return h.Marshaler.ContentType() +} + +// Marshal marshals "v" by returning the body bytes if v is a +// google.api.HttpBody message, otherwise it falls back to the default Marshaler. +func (h *HTTPBodyMarshaler) Marshal(v interface{}) ([]byte, error) { + if httpBody, ok := v.(*httpbody.HttpBody); ok { + return httpBody.Data, nil + } + return h.Marshaler.Marshal(v) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go new file mode 100644 index 00000000..f9d3a585 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_json.go @@ -0,0 +1,45 @@ +package runtime + +import ( + "encoding/json" + "io" +) + +// JSONBuiltin is a Marshaler which marshals/unmarshals into/from JSON +// with the standard "encoding/json" package of Golang. +// Although it is generally faster for simple proto messages than JSONPb, +// it does not support advanced features of protobuf, e.g. map, oneof, .... +// +// The NewEncoder and NewDecoder types return *json.Encoder and +// *json.Decoder respectively. +type JSONBuiltin struct{} + +// ContentType always Returns "application/json". +func (*JSONBuiltin) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON +func (j *JSONBuiltin) Marshal(v interface{}) ([]byte, error) { + return json.Marshal(v) +} + +// Unmarshal unmarshals JSON data into "v". +func (j *JSONBuiltin) Unmarshal(data []byte, v interface{}) error { + return json.Unmarshal(data, v) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONBuiltin) NewDecoder(r io.Reader) Decoder { + return json.NewDecoder(r) +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONBuiltin) NewEncoder(w io.Writer) Encoder { + return json.NewEncoder(w) +} + +// Delimiter for newline encoded JSON streams. +func (j *JSONBuiltin) Delimiter() []byte { + return []byte("\n") +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go new file mode 100644 index 00000000..f0de351b --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_jsonpb.go @@ -0,0 +1,262 @@ +package runtime + +import ( + "bytes" + "encoding/json" + "fmt" + "io" + "reflect" + + "github.com/golang/protobuf/jsonpb" + "github.com/golang/protobuf/proto" +) + +// JSONPb is a Marshaler which marshals/unmarshals into/from JSON +// with the "github.com/golang/protobuf/jsonpb". +// It supports fully functionality of protobuf unlike JSONBuiltin. +// +// The NewDecoder method returns a DecoderWrapper, so the underlying +// *json.Decoder methods can be used. +type JSONPb jsonpb.Marshaler + +// ContentType always returns "application/json". +func (*JSONPb) ContentType() string { + return "application/json" +} + +// Marshal marshals "v" into JSON. +func (j *JSONPb) Marshal(v interface{}) ([]byte, error) { + if _, ok := v.(proto.Message); !ok { + return j.marshalNonProtoField(v) + } + + var buf bytes.Buffer + if err := j.marshalTo(&buf, v); err != nil { + return nil, err + } + return buf.Bytes(), nil +} + +func (j *JSONPb) marshalTo(w io.Writer, v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + buf, err := j.marshalNonProtoField(v) + if err != nil { + return err + } + _, err = w.Write(buf) + return err + } + return (*jsonpb.Marshaler)(j).Marshal(w, p) +} + +var ( + // protoMessageType is stored to prevent constant lookup of the same type at runtime. + protoMessageType = reflect.TypeOf((*proto.Message)(nil)).Elem() +) + +// marshalNonProto marshals a non-message field of a protobuf message. +// This function does not correctly marshals arbitrary data structure into JSON, +// but it is only capable of marshaling non-message field values of protobuf, +// i.e. primitive types, enums; pointers to primitives or enums; maps from +// integer/string types to primitives/enums/pointers to messages. +func (j *JSONPb) marshalNonProtoField(v interface{}) ([]byte, error) { + if v == nil { + return []byte("null"), nil + } + rv := reflect.ValueOf(v) + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + return []byte("null"), nil + } + rv = rv.Elem() + } + + if rv.Kind() == reflect.Slice { + if rv.IsNil() { + if j.EmitDefaults { + return []byte("[]"), nil + } + return []byte("null"), nil + } + + if rv.Type().Elem().Implements(protoMessageType) { + var buf bytes.Buffer + err := buf.WriteByte('[') + if err != nil { + return nil, err + } + for i := 0; i < rv.Len(); i++ { + if i != 0 { + err = buf.WriteByte(',') + if err != nil { + return nil, err + } + } + if err = (*jsonpb.Marshaler)(j).Marshal(&buf, rv.Index(i).Interface().(proto.Message)); err != nil { + return nil, err + } + } + err = buf.WriteByte(']') + if err != nil { + return nil, err + } + + return buf.Bytes(), nil + } + } + + if rv.Kind() == reflect.Map { + m := make(map[string]*json.RawMessage) + for _, k := range rv.MapKeys() { + buf, err := j.Marshal(rv.MapIndex(k).Interface()) + if err != nil { + return nil, err + } + m[fmt.Sprintf("%v", k.Interface())] = (*json.RawMessage)(&buf) + } + if j.Indent != "" { + return json.MarshalIndent(m, "", j.Indent) + } + return json.Marshal(m) + } + if enum, ok := rv.Interface().(protoEnum); ok && !j.EnumsAsInts { + return json.Marshal(enum.String()) + } + return json.Marshal(rv.Interface()) +} + +// Unmarshal unmarshals JSON "data" into "v" +func (j *JSONPb) Unmarshal(data []byte, v interface{}) error { + return unmarshalJSONPb(data, v) +} + +// NewDecoder returns a Decoder which reads JSON stream from "r". +func (j *JSONPb) NewDecoder(r io.Reader) Decoder { + d := json.NewDecoder(r) + return DecoderWrapper{Decoder: d} +} + +// DecoderWrapper is a wrapper around a *json.Decoder that adds +// support for protos to the Decode method. +type DecoderWrapper struct { + *json.Decoder +} + +// Decode wraps the embedded decoder's Decode method to support +// protos using a jsonpb.Unmarshaler. +func (d DecoderWrapper) Decode(v interface{}) error { + return decodeJSONPb(d.Decoder, v) +} + +// NewEncoder returns an Encoder which writes JSON stream into "w". +func (j *JSONPb) NewEncoder(w io.Writer) Encoder { + return EncoderFunc(func(v interface{}) error { + if err := j.marshalTo(w, v); err != nil { + return err + } + // mimic json.Encoder by adding a newline (makes output + // easier to read when it contains multiple encoded items) + _, err := w.Write(j.Delimiter()) + return err + }) +} + +func unmarshalJSONPb(data []byte, v interface{}) error { + d := json.NewDecoder(bytes.NewReader(data)) + return decodeJSONPb(d, v) +} + +func decodeJSONPb(d *json.Decoder, v interface{}) error { + p, ok := v.(proto.Message) + if !ok { + return decodeNonProtoField(d, v) + } + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: allowUnknownFields} + return unmarshaler.UnmarshalNext(d, p) +} + +func decodeNonProtoField(d *json.Decoder, v interface{}) error { + rv := reflect.ValueOf(v) + if rv.Kind() != reflect.Ptr { + return fmt.Errorf("%T is not a pointer", v) + } + for rv.Kind() == reflect.Ptr { + if rv.IsNil() { + rv.Set(reflect.New(rv.Type().Elem())) + } + if rv.Type().ConvertibleTo(typeProtoMessage) { + unmarshaler := &jsonpb.Unmarshaler{AllowUnknownFields: allowUnknownFields} + return unmarshaler.UnmarshalNext(d, rv.Interface().(proto.Message)) + } + rv = rv.Elem() + } + if rv.Kind() == reflect.Map { + if rv.IsNil() { + rv.Set(reflect.MakeMap(rv.Type())) + } + conv, ok := convFromType[rv.Type().Key().Kind()] + if !ok { + return fmt.Errorf("unsupported type of map field key: %v", rv.Type().Key()) + } + + m := make(map[string]*json.RawMessage) + if err := d.Decode(&m); err != nil { + return err + } + for k, v := range m { + result := conv.Call([]reflect.Value{reflect.ValueOf(k)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + bk := result[0] + bv := reflect.New(rv.Type().Elem()) + if err := unmarshalJSONPb([]byte(*v), bv.Interface()); err != nil { + return err + } + rv.SetMapIndex(bk, bv.Elem()) + } + return nil + } + if _, ok := rv.Interface().(protoEnum); ok { + var repr interface{} + if err := d.Decode(&repr); err != nil { + return err + } + switch repr.(type) { + case string: + // TODO(yugui) Should use proto.StructProperties? + return fmt.Errorf("unmarshaling of symbolic enum %q not supported: %T", repr, rv.Interface()) + case float64: + rv.Set(reflect.ValueOf(int32(repr.(float64))).Convert(rv.Type())) + return nil + default: + return fmt.Errorf("cannot assign %#v into Go type %T", repr, rv.Interface()) + } + } + return d.Decode(v) +} + +type protoEnum interface { + fmt.Stringer + EnumDescriptor() ([]byte, []int) +} + +var typeProtoMessage = reflect.TypeOf((*proto.Message)(nil)).Elem() + +// Delimiter for newline encoded JSON streams. +func (j *JSONPb) Delimiter() []byte { + return []byte("\n") +} + +// allowUnknownFields helps not to return an error when the destination +// is a struct and the input contains object keys which do not match any +// non-ignored, exported fields in the destination. +var allowUnknownFields = true + +// DisallowUnknownFields enables option in decoder (unmarshaller) to +// return an error when it finds an unknown field. This function must be +// called before using the JSON marshaller. +func DisallowUnknownFields() { + allowUnknownFields = false +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go new file mode 100644 index 00000000..f65d1a26 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshal_proto.go @@ -0,0 +1,62 @@ +package runtime + +import ( + "io" + + "errors" + "github.com/golang/protobuf/proto" + "io/ioutil" +) + +// ProtoMarshaller is a Marshaller which marshals/unmarshals into/from serialize proto bytes +type ProtoMarshaller struct{} + +// ContentType always returns "application/octet-stream". +func (*ProtoMarshaller) ContentType() string { + return "application/octet-stream" +} + +// Marshal marshals "value" into Proto +func (*ProtoMarshaller) Marshal(value interface{}) ([]byte, error) { + message, ok := value.(proto.Message) + if !ok { + return nil, errors.New("unable to marshal non proto field") + } + return proto.Marshal(message) +} + +// Unmarshal unmarshals proto "data" into "value" +func (*ProtoMarshaller) Unmarshal(data []byte, value interface{}) error { + message, ok := value.(proto.Message) + if !ok { + return errors.New("unable to unmarshal non proto field") + } + return proto.Unmarshal(data, message) +} + +// NewDecoder returns a Decoder which reads proto stream from "reader". +func (marshaller *ProtoMarshaller) NewDecoder(reader io.Reader) Decoder { + return DecoderFunc(func(value interface{}) error { + buffer, err := ioutil.ReadAll(reader) + if err != nil { + return err + } + return marshaller.Unmarshal(buffer, value) + }) +} + +// NewEncoder returns an Encoder which writes proto stream into "writer". +func (marshaller *ProtoMarshaller) NewEncoder(writer io.Writer) Encoder { + return EncoderFunc(func(value interface{}) error { + buffer, err := marshaller.Marshal(value) + if err != nil { + return err + } + _, err = writer.Write(buffer) + if err != nil { + return err + } + + return nil + }) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go new file mode 100644 index 00000000..98fe6e88 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler.go @@ -0,0 +1,48 @@ +package runtime + +import ( + "io" +) + +// Marshaler defines a conversion between byte sequence and gRPC payloads / fields. +type Marshaler interface { + // Marshal marshals "v" into byte sequence. + Marshal(v interface{}) ([]byte, error) + // Unmarshal unmarshals "data" into "v". + // "v" must be a pointer value. + Unmarshal(data []byte, v interface{}) error + // NewDecoder returns a Decoder which reads byte sequence from "r". + NewDecoder(r io.Reader) Decoder + // NewEncoder returns an Encoder which writes bytes sequence into "w". + NewEncoder(w io.Writer) Encoder + // ContentType returns the Content-Type which this marshaler is responsible for. + ContentType() string +} + +// Decoder decodes a byte sequence +type Decoder interface { + Decode(v interface{}) error +} + +// Encoder encodes gRPC payloads / fields into byte sequence. +type Encoder interface { + Encode(v interface{}) error +} + +// DecoderFunc adapts an decoder function into Decoder. +type DecoderFunc func(v interface{}) error + +// Decode delegates invocations to the underlying function itself. +func (f DecoderFunc) Decode(v interface{}) error { return f(v) } + +// EncoderFunc adapts an encoder function into Encoder +type EncoderFunc func(v interface{}) error + +// Encode delegates invocations to the underlying function itself. +func (f EncoderFunc) Encode(v interface{}) error { return f(v) } + +// Delimited defines the streaming delimiter. +type Delimited interface { + // Delimiter returns the record seperator for the stream. + Delimiter() []byte +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go new file mode 100644 index 00000000..5cc53ae4 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/marshaler_registry.go @@ -0,0 +1,91 @@ +package runtime + +import ( + "errors" + "net/http" +) + +// MIMEWildcard is the fallback MIME type used for requests which do not match +// a registered MIME type. +const MIMEWildcard = "*" + +var ( + acceptHeader = http.CanonicalHeaderKey("Accept") + contentTypeHeader = http.CanonicalHeaderKey("Content-Type") + + defaultMarshaler = &JSONPb{OrigName: true} +) + +// MarshalerForRequest returns the inbound/outbound marshalers for this request. +// It checks the registry on the ServeMux for the MIME type set by the Content-Type header. +// If it isn't set (or the request Content-Type is empty), checks for "*". +// If there are multiple Content-Type headers set, choose the first one that it can +// exactly match in the registry. +// Otherwise, it follows the above logic for "*"/InboundMarshaler/OutboundMarshaler. +func MarshalerForRequest(mux *ServeMux, r *http.Request) (inbound Marshaler, outbound Marshaler) { + for _, acceptVal := range r.Header[acceptHeader] { + if m, ok := mux.marshalers.mimeMap[acceptVal]; ok { + outbound = m + break + } + } + + for _, contentTypeVal := range r.Header[contentTypeHeader] { + if m, ok := mux.marshalers.mimeMap[contentTypeVal]; ok { + inbound = m + break + } + } + + if inbound == nil { + inbound = mux.marshalers.mimeMap[MIMEWildcard] + } + if outbound == nil { + outbound = inbound + } + + return inbound, outbound +} + +// marshalerRegistry is a mapping from MIME types to Marshalers. +type marshalerRegistry struct { + mimeMap map[string]Marshaler +} + +// add adds a marshaler for a case-sensitive MIME type string ("*" to match any +// MIME type). +func (m marshalerRegistry) add(mime string, marshaler Marshaler) error { + if len(mime) == 0 { + return errors.New("empty MIME type") + } + + m.mimeMap[mime] = marshaler + + return nil +} + +// makeMarshalerMIMERegistry returns a new registry of marshalers. +// It allows for a mapping of case-sensitive Content-Type MIME type string to runtime.Marshaler interfaces. +// +// For example, you could allow the client to specify the use of the runtime.JSONPb marshaler +// with a "application/jsonpb" Content-Type and the use of the runtime.JSONBuiltin marshaler +// with a "application/json" Content-Type. +// "*" can be used to match any Content-Type. +// This can be attached to a ServerMux with the marshaler option. +func makeMarshalerMIMERegistry() marshalerRegistry { + return marshalerRegistry{ + mimeMap: map[string]Marshaler{ + MIMEWildcard: defaultMarshaler, + }, + } +} + +// WithMarshalerOption returns a ServeMuxOption which associates inbound and outbound +// Marshalers to a MIME type in mux. +func WithMarshalerOption(mime string, marshaler Marshaler) ServeMuxOption { + return func(mux *ServeMux) { + if err := mux.marshalers.add(mime, marshaler); err != nil { + panic(err) + } + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go new file mode 100644 index 00000000..1da3a588 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/mux.go @@ -0,0 +1,303 @@ +package runtime + +import ( + "context" + "fmt" + "net/http" + "net/textproto" + "strings" + + "github.com/golang/protobuf/proto" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/status" +) + +// A HandlerFunc handles a specific pair of path pattern and HTTP method. +type HandlerFunc func(w http.ResponseWriter, r *http.Request, pathParams map[string]string) + +// ErrUnknownURI is the error supplied to a custom ProtoErrorHandlerFunc when +// a request is received with a URI path that does not match any registered +// service method. +// +// Since gRPC servers return an "Unimplemented" code for requests with an +// unrecognized URI path, this error also has a gRPC "Unimplemented" code. +var ErrUnknownURI = status.Error(codes.Unimplemented, http.StatusText(http.StatusNotImplemented)) + +// ServeMux is a request multiplexer for grpc-gateway. +// It matches http requests to patterns and invokes the corresponding handler. +type ServeMux struct { + // handlers maps HTTP method to a list of handlers. + handlers map[string][]handler + forwardResponseOptions []func(context.Context, http.ResponseWriter, proto.Message) error + marshalers marshalerRegistry + incomingHeaderMatcher HeaderMatcherFunc + outgoingHeaderMatcher HeaderMatcherFunc + metadataAnnotators []func(context.Context, *http.Request) metadata.MD + streamErrorHandler StreamErrorHandlerFunc + protoErrorHandler ProtoErrorHandlerFunc + disablePathLengthFallback bool + lastMatchWins bool +} + +// ServeMuxOption is an option that can be given to a ServeMux on construction. +type ServeMuxOption func(*ServeMux) + +// WithForwardResponseOption returns a ServeMuxOption representing the forwardResponseOption. +// +// forwardResponseOption is an option that will be called on the relevant context.Context, +// http.ResponseWriter, and proto.Message before every forwarded response. +// +// The message may be nil in the case where just a header is being sent. +func WithForwardResponseOption(forwardResponseOption func(context.Context, http.ResponseWriter, proto.Message) error) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.forwardResponseOptions = append(serveMux.forwardResponseOptions, forwardResponseOption) + } +} + +// HeaderMatcherFunc checks whether a header key should be forwarded to/from gRPC context. +type HeaderMatcherFunc func(string) (string, bool) + +// DefaultHeaderMatcher is used to pass http request headers to/from gRPC context. This adds permanent HTTP header +// keys (as specified by the IANA) to gRPC context with grpcgateway- prefix. HTTP headers that start with +// 'Grpc-Metadata-' are mapped to gRPC metadata after removing prefix 'Grpc-Metadata-'. +func DefaultHeaderMatcher(key string) (string, bool) { + key = textproto.CanonicalMIMEHeaderKey(key) + if isPermanentHTTPHeader(key) { + return MetadataPrefix + key, true + } else if strings.HasPrefix(key, MetadataHeaderPrefix) { + return key[len(MetadataHeaderPrefix):], true + } + return "", false +} + +// WithIncomingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for incoming request to gateway. +// +// This matcher will be called with each header in http.Request. If matcher returns true, that header will be +// passed to gRPC context. To transform the header before passing to gRPC context, matcher should return modified header. +func WithIncomingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { + return func(mux *ServeMux) { + mux.incomingHeaderMatcher = fn + } +} + +// WithOutgoingHeaderMatcher returns a ServeMuxOption representing a headerMatcher for outgoing response from gateway. +// +// This matcher will be called with each header in response header metadata. If matcher returns true, that header will be +// passed to http response returned from gateway. To transform the header before passing to response, +// matcher should return modified header. +func WithOutgoingHeaderMatcher(fn HeaderMatcherFunc) ServeMuxOption { + return func(mux *ServeMux) { + mux.outgoingHeaderMatcher = fn + } +} + +// WithMetadata returns a ServeMuxOption for passing metadata to a gRPC context. +// +// This can be used by services that need to read from http.Request and modify gRPC context. A common use case +// is reading token from cookie and adding it in gRPC context. +func WithMetadata(annotator func(context.Context, *http.Request) metadata.MD) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.metadataAnnotators = append(serveMux.metadataAnnotators, annotator) + } +} + +// WithProtoErrorHandler returns a ServeMuxOption for passing metadata to a gRPC context. +// +// This can be used to handle an error as general proto message defined by gRPC. +// The response including body and status is not backward compatible with the default error handler. +// When this option is used, HTTPError and OtherErrorHandler are overwritten on initialization. +func WithProtoErrorHandler(fn ProtoErrorHandlerFunc) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.protoErrorHandler = fn + } +} + +// WithDisablePathLengthFallback returns a ServeMuxOption for disable path length fallback. +func WithDisablePathLengthFallback() ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.disablePathLengthFallback = true + } +} + +// WithStreamErrorHandler returns a ServeMuxOption that will use the given custom stream +// error handler, which allows for customizing the error trailer for server-streaming +// calls. +// +// For stream errors that occur before any response has been written, the mux's +// ProtoErrorHandler will be invoked. However, once data has been written, the errors must +// be handled differently: they must be included in the response body. The response body's +// final message will include the error details returned by the stream error handler. +func WithStreamErrorHandler(fn StreamErrorHandlerFunc) ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.streamErrorHandler = fn + } +} + +// WithLastMatchWins returns a ServeMuxOption that will enable "last +// match wins" behavior, where if multiple path patterns match a +// request path, the last one defined in the .proto file will be used. +func WithLastMatchWins() ServeMuxOption { + return func(serveMux *ServeMux) { + serveMux.lastMatchWins = true + } +} + +// NewServeMux returns a new ServeMux whose internal mapping is empty. +func NewServeMux(opts ...ServeMuxOption) *ServeMux { + serveMux := &ServeMux{ + handlers: make(map[string][]handler), + forwardResponseOptions: make([]func(context.Context, http.ResponseWriter, proto.Message) error, 0), + marshalers: makeMarshalerMIMERegistry(), + streamErrorHandler: DefaultHTTPStreamErrorHandler, + } + + for _, opt := range opts { + opt(serveMux) + } + + if serveMux.protoErrorHandler != nil { + HTTPError = serveMux.protoErrorHandler + // OtherErrorHandler is no longer used when protoErrorHandler is set. + // Overwritten by a special error handler to return Unknown. + OtherErrorHandler = func(w http.ResponseWriter, r *http.Request, _ string, _ int) { + ctx := context.Background() + _, outboundMarshaler := MarshalerForRequest(serveMux, r) + sterr := status.Error(codes.Unknown, "unexpected use of OtherErrorHandler") + serveMux.protoErrorHandler(ctx, serveMux, outboundMarshaler, w, r, sterr) + } + } + + if serveMux.incomingHeaderMatcher == nil { + serveMux.incomingHeaderMatcher = DefaultHeaderMatcher + } + + if serveMux.outgoingHeaderMatcher == nil { + serveMux.outgoingHeaderMatcher = func(key string) (string, bool) { + return fmt.Sprintf("%s%s", MetadataHeaderPrefix, key), true + } + } + + return serveMux +} + +// Handle associates "h" to the pair of HTTP method and path pattern. +func (s *ServeMux) Handle(meth string, pat Pattern, h HandlerFunc) { + if s.lastMatchWins { + s.handlers[meth] = append([]handler{handler{pat: pat, h: h}}, s.handlers[meth]...) + } else { + s.handlers[meth] = append(s.handlers[meth], handler{pat: pat, h: h}) + } +} + +// ServeHTTP dispatches the request to the first handler whose pattern matches to r.Method and r.Path. +func (s *ServeMux) ServeHTTP(w http.ResponseWriter, r *http.Request) { + ctx := r.Context() + + path := r.URL.Path + if !strings.HasPrefix(path, "/") { + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, http.StatusText(http.StatusBadRequest)) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusBadRequest), http.StatusBadRequest) + } + return + } + + components := strings.Split(path[1:], "/") + l := len(components) + var verb string + if idx := strings.LastIndex(components[l-1], ":"); idx == 0 { + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + } + return + } else if idx > 0 { + c := components[l-1] + components[l-1], verb = c[:idx], c[idx+1:] + } + + if override := r.Header.Get("X-HTTP-Method-Override"); override != "" && s.isPathLengthFallback(r) { + r.Method = strings.ToUpper(override) + if err := r.ParseForm(); err != nil { + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, err.Error()) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + } + return + } + } + for _, h := range s.handlers[r.Method] { + pathParams, err := h.pat.Match(components, verb) + if err != nil { + continue + } + h.h(w, r, pathParams) + return + } + + // lookup other methods to handle fallback from GET to POST and + // to determine if it is MethodNotAllowed or NotFound. + for m, handlers := range s.handlers { + if m == r.Method { + continue + } + for _, h := range handlers { + pathParams, err := h.pat.Match(components, verb) + if err != nil { + continue + } + // X-HTTP-Method-Override is optional. Always allow fallback to POST. + if s.isPathLengthFallback(r) { + if err := r.ParseForm(); err != nil { + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + sterr := status.Error(codes.InvalidArgument, err.Error()) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, sterr) + } else { + OtherErrorHandler(w, r, err.Error(), http.StatusBadRequest) + } + return + } + h.h(w, r, pathParams) + return + } + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusMethodNotAllowed), http.StatusMethodNotAllowed) + } + return + } + } + + if s.protoErrorHandler != nil { + _, outboundMarshaler := MarshalerForRequest(s, r) + s.protoErrorHandler(ctx, s, outboundMarshaler, w, r, ErrUnknownURI) + } else { + OtherErrorHandler(w, r, http.StatusText(http.StatusNotFound), http.StatusNotFound) + } +} + +// GetForwardResponseOptions returns the ForwardResponseOptions associated with this ServeMux. +func (s *ServeMux) GetForwardResponseOptions() []func(context.Context, http.ResponseWriter, proto.Message) error { + return s.forwardResponseOptions +} + +func (s *ServeMux) isPathLengthFallback(r *http.Request) bool { + return !s.disablePathLengthFallback && r.Method == "POST" && r.Header.Get("Content-Type") == "application/x-www-form-urlencoded" +} + +type handler struct { + pat Pattern + h HandlerFunc +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go new file mode 100644 index 00000000..09053695 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/pattern.go @@ -0,0 +1,262 @@ +package runtime + +import ( + "errors" + "fmt" + "strings" + + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc/grpclog" +) + +var ( + // ErrNotMatch indicates that the given HTTP request path does not match to the pattern. + ErrNotMatch = errors.New("not match to the path pattern") + // ErrInvalidPattern indicates that the given definition of Pattern is not valid. + ErrInvalidPattern = errors.New("invalid pattern") +) + +type op struct { + code utilities.OpCode + operand int +} + +// Pattern is a template pattern of http request paths defined in github.com/googleapis/googleapis/google/api/http.proto. +type Pattern struct { + // ops is a list of operations + ops []op + // pool is a constant pool indexed by the operands or vars. + pool []string + // vars is a list of variables names to be bound by this pattern + vars []string + // stacksize is the max depth of the stack + stacksize int + // tailLen is the length of the fixed-size segments after a deep wildcard + tailLen int + // verb is the VERB part of the path pattern. It is empty if the pattern does not have VERB part. + verb string + // assumeColonVerb indicates whether a path suffix after a final + // colon may only be interpreted as a verb. + assumeColonVerb bool +} + +type patternOptions struct { + assumeColonVerb bool +} + +// PatternOpt is an option for creating Patterns. +type PatternOpt func(*patternOptions) + +// NewPattern returns a new Pattern from the given definition values. +// "ops" is a sequence of op codes. "pool" is a constant pool. +// "verb" is the verb part of the pattern. It is empty if the pattern does not have the part. +// "version" must be 1 for now. +// It returns an error if the given definition is invalid. +func NewPattern(version int, ops []int, pool []string, verb string, opts ...PatternOpt) (Pattern, error) { + options := patternOptions{ + assumeColonVerb: true, + } + for _, o := range opts { + o(&options) + } + + if version != 1 { + grpclog.Infof("unsupported version: %d", version) + return Pattern{}, ErrInvalidPattern + } + + l := len(ops) + if l%2 != 0 { + grpclog.Infof("odd number of ops codes: %d", l) + return Pattern{}, ErrInvalidPattern + } + + var ( + typedOps []op + stack, maxstack int + tailLen int + pushMSeen bool + vars []string + ) + for i := 0; i < l; i += 2 { + op := op{code: utilities.OpCode(ops[i]), operand: ops[i+1]} + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush: + if pushMSeen { + tailLen++ + } + stack++ + case utilities.OpPushM: + if pushMSeen { + grpclog.Infof("pushM appears twice") + return Pattern{}, ErrInvalidPattern + } + pushMSeen = true + stack++ + case utilities.OpLitPush: + if op.operand < 0 || len(pool) <= op.operand { + grpclog.Infof("negative literal index: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + if pushMSeen { + tailLen++ + } + stack++ + case utilities.OpConcatN: + if op.operand <= 0 { + grpclog.Infof("negative concat size: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + stack -= op.operand + if stack < 0 { + grpclog.Print("stack underflow") + return Pattern{}, ErrInvalidPattern + } + stack++ + case utilities.OpCapture: + if op.operand < 0 || len(pool) <= op.operand { + grpclog.Infof("variable name index out of bound: %d", op.operand) + return Pattern{}, ErrInvalidPattern + } + v := pool[op.operand] + op.operand = len(vars) + vars = append(vars, v) + stack-- + if stack < 0 { + grpclog.Infof("stack underflow") + return Pattern{}, ErrInvalidPattern + } + default: + grpclog.Infof("invalid opcode: %d", op.code) + return Pattern{}, ErrInvalidPattern + } + + if maxstack < stack { + maxstack = stack + } + typedOps = append(typedOps, op) + } + return Pattern{ + ops: typedOps, + pool: pool, + vars: vars, + stacksize: maxstack, + tailLen: tailLen, + verb: verb, + assumeColonVerb: options.assumeColonVerb, + }, nil +} + +// MustPattern is a helper function which makes it easier to call NewPattern in variable initialization. +func MustPattern(p Pattern, err error) Pattern { + if err != nil { + grpclog.Fatalf("Pattern initialization failed: %v", err) + } + return p +} + +// Match examines components if it matches to the Pattern. +// If it matches, the function returns a mapping from field paths to their captured values. +// If otherwise, the function returns an error. +func (p Pattern) Match(components []string, verb string) (map[string]string, error) { + if p.verb != verb { + if p.assumeColonVerb || p.verb != "" { + return nil, ErrNotMatch + } + if len(components) == 0 { + components = []string{":" + verb} + } else { + components = append([]string{}, components...) + components[len(components)-1] += ":" + verb + } + verb = "" + } + + var pos int + stack := make([]string, 0, p.stacksize) + captured := make([]string, len(p.vars)) + l := len(components) + for _, op := range p.ops { + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush, utilities.OpLitPush: + if pos >= l { + return nil, ErrNotMatch + } + c := components[pos] + if op.code == utilities.OpLitPush { + if lit := p.pool[op.operand]; c != lit { + return nil, ErrNotMatch + } + } + stack = append(stack, c) + pos++ + case utilities.OpPushM: + end := len(components) + if end < pos+p.tailLen { + return nil, ErrNotMatch + } + end -= p.tailLen + stack = append(stack, strings.Join(components[pos:end], "/")) + pos = end + case utilities.OpConcatN: + n := op.operand + l := len(stack) - n + stack = append(stack[:l], strings.Join(stack[l:], "/")) + case utilities.OpCapture: + n := len(stack) - 1 + captured[op.operand] = stack[n] + stack = stack[:n] + } + } + if pos < l { + return nil, ErrNotMatch + } + bindings := make(map[string]string) + for i, val := range captured { + bindings[p.vars[i]] = val + } + return bindings, nil +} + +// Verb returns the verb part of the Pattern. +func (p Pattern) Verb() string { return p.verb } + +func (p Pattern) String() string { + var stack []string + for _, op := range p.ops { + switch op.code { + case utilities.OpNop: + continue + case utilities.OpPush: + stack = append(stack, "*") + case utilities.OpLitPush: + stack = append(stack, p.pool[op.operand]) + case utilities.OpPushM: + stack = append(stack, "**") + case utilities.OpConcatN: + n := op.operand + l := len(stack) - n + stack = append(stack[:l], strings.Join(stack[l:], "/")) + case utilities.OpCapture: + n := len(stack) - 1 + stack[n] = fmt.Sprintf("{%s=%s}", p.vars[op.operand], stack[n]) + } + } + segs := strings.Join(stack, "/") + if p.verb != "" { + return fmt.Sprintf("/%s:%s", segs, p.verb) + } + return "/" + segs +} + +// AssumeColonVerbOpt indicates whether a path suffix after a final +// colon may only be interpreted as a verb. +func AssumeColonVerbOpt(val bool) PatternOpt { + return PatternOpt(func(o *patternOptions) { + o.assumeColonVerb = val + }) +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go new file mode 100644 index 00000000..a3151e2a --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto2_convert.go @@ -0,0 +1,80 @@ +package runtime + +import ( + "github.com/golang/protobuf/proto" +) + +// StringP returns a pointer to a string whose pointee is same as the given string value. +func StringP(val string) (*string, error) { + return proto.String(val), nil +} + +// BoolP parses the given string representation of a boolean value, +// and returns a pointer to a bool whose value is same as the parsed value. +func BoolP(val string) (*bool, error) { + b, err := Bool(val) + if err != nil { + return nil, err + } + return proto.Bool(b), nil +} + +// Float64P parses the given string representation of a floating point number, +// and returns a pointer to a float64 whose value is same as the parsed number. +func Float64P(val string) (*float64, error) { + f, err := Float64(val) + if err != nil { + return nil, err + } + return proto.Float64(f), nil +} + +// Float32P parses the given string representation of a floating point number, +// and returns a pointer to a float32 whose value is same as the parsed number. +func Float32P(val string) (*float32, error) { + f, err := Float32(val) + if err != nil { + return nil, err + } + return proto.Float32(f), nil +} + +// Int64P parses the given string representation of an integer +// and returns a pointer to a int64 whose value is same as the parsed integer. +func Int64P(val string) (*int64, error) { + i, err := Int64(val) + if err != nil { + return nil, err + } + return proto.Int64(i), nil +} + +// Int32P parses the given string representation of an integer +// and returns a pointer to a int32 whose value is same as the parsed integer. +func Int32P(val string) (*int32, error) { + i, err := Int32(val) + if err != nil { + return nil, err + } + return proto.Int32(i), err +} + +// Uint64P parses the given string representation of an integer +// and returns a pointer to a uint64 whose value is same as the parsed integer. +func Uint64P(val string) (*uint64, error) { + i, err := Uint64(val) + if err != nil { + return nil, err + } + return proto.Uint64(i), err +} + +// Uint32P parses the given string representation of an integer +// and returns a pointer to a uint32 whose value is same as the parsed integer. +func Uint32P(val string) (*uint32, error) { + i, err := Uint32(val) + if err != nil { + return nil, err + } + return proto.Uint32(i), err +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go new file mode 100644 index 00000000..ca76324e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/proto_errors.go @@ -0,0 +1,106 @@ +package runtime + +import ( + "context" + "io" + "net/http" + + "github.com/golang/protobuf/ptypes/any" + "github.com/grpc-ecosystem/grpc-gateway/internal" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/status" +) + +// StreamErrorHandlerFunc accepts an error as a gRPC error generated via status package and translates it into a +// a proto struct used to represent error at the end of a stream. +type StreamErrorHandlerFunc func(context.Context, error) *StreamError + +// StreamError is the payload for the final message in a server stream in the event that the server returns an +// error after a response message has already been sent. +type StreamError internal.StreamError + +// ProtoErrorHandlerFunc handles the error as a gRPC error generated via status package and replies to the request. +type ProtoErrorHandlerFunc func(context.Context, *ServeMux, Marshaler, http.ResponseWriter, *http.Request, error) + +var _ ProtoErrorHandlerFunc = DefaultHTTPProtoErrorHandler + +// DefaultHTTPProtoErrorHandler is an implementation of HTTPError. +// If "err" is an error from gRPC system, the function replies with the status code mapped by HTTPStatusFromCode. +// If otherwise, it replies with http.StatusInternalServerError. +// +// The response body returned by this function is a Status message marshaled by a Marshaler. +// +// Do not set this function to HTTPError variable directly, use WithProtoErrorHandler option instead. +func DefaultHTTPProtoErrorHandler(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, _ *http.Request, err error) { + // return Internal when Marshal failed + const fallback = `{"code": 13, "message": "failed to marshal error message"}` + + s, ok := status.FromError(err) + if !ok { + s = status.New(codes.Unknown, err.Error()) + } + + w.Header().Del("Trailer") + + contentType := marshaler.ContentType() + // Check marshaler on run time in order to keep backwards compatability + // An interface param needs to be added to the ContentType() function on + // the Marshal interface to be able to remove this check + if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok { + pb := s.Proto() + contentType = httpBodyMarshaler.ContentTypeFromMessage(pb) + } + w.Header().Set("Content-Type", contentType) + + buf, merr := marshaler.Marshal(s.Proto()) + if merr != nil { + grpclog.Infof("Failed to marshal error message %q: %v", s.Proto(), merr) + w.WriteHeader(http.StatusInternalServerError) + if _, err := io.WriteString(w, fallback); err != nil { + grpclog.Infof("Failed to write response: %v", err) + } + return + } + + md, ok := ServerMetadataFromContext(ctx) + if !ok { + grpclog.Infof("Failed to extract ServerMetadata from context") + } + + handleForwardResponseServerMetadata(w, mux, md) + handleForwardResponseTrailerHeader(w, md) + st := HTTPStatusFromCode(s.Code()) + w.WriteHeader(st) + if _, err := w.Write(buf); err != nil { + grpclog.Infof("Failed to write response: %v", err) + } + + handleForwardResponseTrailer(w, md) +} + +// DefaultHTTPStreamErrorHandler converts the given err into a *StreamError via +// default logic. +// +// It extracts the gRPC status from err if possible. The fields of the status are +// used to populate the returned StreamError, and the HTTP status code is derived +// from the gRPC code via HTTPStatusFromCode. If the given err does not contain a +// gRPC status, an "Unknown" gRPC code is used and "Internal Server Error" HTTP code. +func DefaultHTTPStreamErrorHandler(_ context.Context, err error) *StreamError { + grpcCode := codes.Unknown + grpcMessage := err.Error() + var grpcDetails []*any.Any + if s, ok := status.FromError(err); ok { + grpcCode = s.Code() + grpcMessage = s.Message() + grpcDetails = s.Proto().GetDetails() + } + httpCode := HTTPStatusFromCode(grpcCode) + return &StreamError{ + GrpcCode: int32(grpcCode), + HttpCode: int32(httpCode), + Message: grpcMessage, + HttpStatus: http.StatusText(httpCode), + Details: grpcDetails, + } +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go new file mode 100644 index 00000000..bb9359f1 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/runtime/query.go @@ -0,0 +1,392 @@ +package runtime + +import ( + "encoding/base64" + "fmt" + "net/url" + "reflect" + "regexp" + "strconv" + "strings" + "time" + + "github.com/golang/protobuf/proto" + "github.com/grpc-ecosystem/grpc-gateway/utilities" + "google.golang.org/grpc/grpclog" +) + +// PopulateQueryParameters populates "values" into "msg". +// A value is ignored if its key starts with one of the elements in "filter". +func PopulateQueryParameters(msg proto.Message, values url.Values, filter *utilities.DoubleArray) error { + for key, values := range values { + re, err := regexp.Compile("^(.*)\\[(.*)\\]$") + if err != nil { + return err + } + match := re.FindStringSubmatch(key) + if len(match) == 3 { + key = match[1] + values = append([]string{match[2]}, values...) + } + fieldPath := strings.Split(key, ".") + if filter.HasCommonPrefix(fieldPath) { + continue + } + if err := populateFieldValueFromPath(msg, fieldPath, values); err != nil { + return err + } + } + return nil +} + +// PopulateFieldFromPath sets a value in a nested Protobuf structure. +// It instantiates missing protobuf fields as it goes. +func PopulateFieldFromPath(msg proto.Message, fieldPathString string, value string) error { + fieldPath := strings.Split(fieldPathString, ".") + return populateFieldValueFromPath(msg, fieldPath, []string{value}) +} + +func populateFieldValueFromPath(msg proto.Message, fieldPath []string, values []string) error { + m := reflect.ValueOf(msg) + if m.Kind() != reflect.Ptr { + return fmt.Errorf("unexpected type %T: %v", msg, msg) + } + var props *proto.Properties + m = m.Elem() + for i, fieldName := range fieldPath { + isLast := i == len(fieldPath)-1 + if !isLast && m.Kind() != reflect.Struct { + return fmt.Errorf("non-aggregate type in the mid of path: %s", strings.Join(fieldPath, ".")) + } + var f reflect.Value + var err error + f, props, err = fieldByProtoName(m, fieldName) + if err != nil { + return err + } else if !f.IsValid() { + grpclog.Infof("field not found in %T: %s", msg, strings.Join(fieldPath, ".")) + return nil + } + + switch f.Kind() { + case reflect.Bool, reflect.Float32, reflect.Float64, reflect.Int32, reflect.Int64, reflect.String, reflect.Uint32, reflect.Uint64: + if !isLast { + return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], ".")) + } + m = f + case reflect.Slice: + if !isLast { + return fmt.Errorf("unexpected repeated field in %s", strings.Join(fieldPath, ".")) + } + // Handle []byte + if f.Type().Elem().Kind() == reflect.Uint8 { + m = f + break + } + return populateRepeatedField(f, values, props) + case reflect.Ptr: + if f.IsNil() { + m = reflect.New(f.Type().Elem()) + f.Set(m.Convert(f.Type())) + } + m = f.Elem() + continue + case reflect.Struct: + m = f + continue + case reflect.Map: + if !isLast { + return fmt.Errorf("unexpected nested field %s in %s", fieldPath[i+1], strings.Join(fieldPath[:i+1], ".")) + } + return populateMapField(f, values, props) + default: + return fmt.Errorf("unexpected type %s in %T", f.Type(), msg) + } + } + switch len(values) { + case 0: + return fmt.Errorf("no value of field: %s", strings.Join(fieldPath, ".")) + case 1: + default: + grpclog.Infof("too many field values: %s", strings.Join(fieldPath, ".")) + } + return populateField(m, values[0], props) +} + +// fieldByProtoName looks up a field whose corresponding protobuf field name is "name". +// "m" must be a struct value. It returns zero reflect.Value if no such field found. +func fieldByProtoName(m reflect.Value, name string) (reflect.Value, *proto.Properties, error) { + props := proto.GetProperties(m.Type()) + + // look up field name in oneof map + if op, ok := props.OneofTypes[name]; ok { + v := reflect.New(op.Type.Elem()) + field := m.Field(op.Field) + if !field.IsNil() { + return reflect.Value{}, nil, fmt.Errorf("field already set for %s oneof", props.Prop[op.Field].OrigName) + } + field.Set(v) + return v.Elem().Field(0), op.Prop, nil + } + + for _, p := range props.Prop { + if p.OrigName == name { + return m.FieldByName(p.Name), p, nil + } + if p.JSONName == name { + return m.FieldByName(p.Name), p, nil + } + } + return reflect.Value{}, nil, nil +} + +func populateMapField(f reflect.Value, values []string, props *proto.Properties) error { + if len(values) != 2 { + return fmt.Errorf("more than one value provided for key %s in map %s", values[0], props.Name) + } + + key, value := values[0], values[1] + keyType := f.Type().Key() + valueType := f.Type().Elem() + if f.IsNil() { + f.Set(reflect.MakeMap(f.Type())) + } + + keyConv, ok := convFromType[keyType.Kind()] + if !ok { + return fmt.Errorf("unsupported key type %s in map %s", keyType, props.Name) + } + valueConv, ok := convFromType[valueType.Kind()] + if !ok { + return fmt.Errorf("unsupported value type %s in map %s", valueType, props.Name) + } + + keyV := keyConv.Call([]reflect.Value{reflect.ValueOf(key)}) + if err := keyV[1].Interface(); err != nil { + return err.(error) + } + valueV := valueConv.Call([]reflect.Value{reflect.ValueOf(value)}) + if err := valueV[1].Interface(); err != nil { + return err.(error) + } + + f.SetMapIndex(keyV[0].Convert(keyType), valueV[0].Convert(valueType)) + + return nil +} + +func populateRepeatedField(f reflect.Value, values []string, props *proto.Properties) error { + elemType := f.Type().Elem() + + // is the destination field a slice of an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnumRepeated(f, values, enumValMap) + } + + conv, ok := convFromType[elemType.Kind()] + if !ok { + return fmt.Errorf("unsupported field type %s", elemType) + } + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result := conv.Call([]reflect.Value{reflect.ValueOf(v)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + f.Index(i).Set(result[0].Convert(f.Index(i).Type())) + } + return nil +} + +func populateField(f reflect.Value, value string, props *proto.Properties) error { + i := f.Addr().Interface() + + // Handle protobuf well known types + type wkt interface { + XXX_WellKnownType() string + } + if wkt, ok := i.(wkt); ok { + switch wkt.XXX_WellKnownType() { + case "Timestamp": + if value == "null" { + f.Field(0).SetInt(0) + f.Field(1).SetInt(0) + return nil + } + + t, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + f.Field(0).SetInt(int64(t.Unix())) + f.Field(1).SetInt(int64(t.Nanosecond())) + return nil + case "Duration": + if value == "null" { + f.Field(0).SetInt(0) + f.Field(1).SetInt(0) + return nil + } + d, err := time.ParseDuration(value) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + + ns := d.Nanoseconds() + s := ns / 1e9 + ns %= 1e9 + f.Field(0).SetInt(s) + f.Field(1).SetInt(ns) + return nil + case "DoubleValue": + fallthrough + case "FloatValue": + float64Val, err := strconv.ParseFloat(value, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetFloat(float64Val) + return nil + case "Int64Value": + fallthrough + case "Int32Value": + int64Val, err := strconv.ParseInt(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetInt(int64Val) + return nil + case "UInt64Value": + fallthrough + case "UInt32Value": + uint64Val, err := strconv.ParseUint(value, 10, 64) + if err != nil { + return fmt.Errorf("bad DoubleValue: %s", value) + } + f.Field(0).SetUint(uint64Val) + return nil + case "BoolValue": + if value == "true" { + f.Field(0).SetBool(true) + } else if value == "false" { + f.Field(0).SetBool(false) + } else { + return fmt.Errorf("bad BoolValue: %s", value) + } + return nil + case "StringValue": + f.Field(0).SetString(value) + return nil + case "BytesValue": + bytesVal, err := base64.StdEncoding.DecodeString(value) + if err != nil { + return fmt.Errorf("bad BytesValue: %s", value) + } + f.Field(0).SetBytes(bytesVal) + return nil + } + } + + // Handle google well known types + if gwkt, ok := i.(proto.Message); ok { + switch proto.MessageName(gwkt) { + case "google.protobuf.FieldMask": + p := f.Field(0) + for _, v := range strings.Split(value, ",") { + if v != "" { + p.Set(reflect.Append(p, reflect.ValueOf(v))) + } + } + return nil + } + } + + // Handle Time and Duration stdlib types + switch t := i.(type) { + case *time.Time: + pt, err := time.Parse(time.RFC3339Nano, value) + if err != nil { + return fmt.Errorf("bad Timestamp: %v", err) + } + *t = pt + return nil + case *time.Duration: + d, err := time.ParseDuration(value) + if err != nil { + return fmt.Errorf("bad Duration: %v", err) + } + *t = d + return nil + } + + // is the destination field an enumeration type? + if enumValMap := proto.EnumValueMap(props.Enum); enumValMap != nil { + return populateFieldEnum(f, value, enumValMap) + } + + conv, ok := convFromType[f.Kind()] + if !ok { + return fmt.Errorf("field type %T is not supported in query parameters", i) + } + result := conv.Call([]reflect.Value{reflect.ValueOf(value)}) + if err := result[1].Interface(); err != nil { + return err.(error) + } + f.Set(result[0].Convert(f.Type())) + return nil +} + +func convertEnum(value string, t reflect.Type, enumValMap map[string]int32) (reflect.Value, error) { + // see if it's an enumeration string + if enumVal, ok := enumValMap[value]; ok { + return reflect.ValueOf(enumVal).Convert(t), nil + } + + // check for an integer that matches an enumeration value + eVal, err := strconv.Atoi(value) + if err != nil { + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) + } + for _, v := range enumValMap { + if v == int32(eVal) { + return reflect.ValueOf(eVal).Convert(t), nil + } + } + return reflect.Value{}, fmt.Errorf("%s is not a valid %s", value, t) +} + +func populateFieldEnum(f reflect.Value, value string, enumValMap map[string]int32) error { + cval, err := convertEnum(value, f.Type(), enumValMap) + if err != nil { + return err + } + f.Set(cval) + return nil +} + +func populateFieldEnumRepeated(f reflect.Value, values []string, enumValMap map[string]int32) error { + elemType := f.Type().Elem() + f.Set(reflect.MakeSlice(f.Type(), len(values), len(values)).Convert(f.Type())) + for i, v := range values { + result, err := convertEnum(v, elemType, enumValMap) + if err != nil { + return err + } + f.Index(i).Set(result) + } + return nil +} + +var ( + convFromType = map[reflect.Kind]reflect.Value{ + reflect.String: reflect.ValueOf(String), + reflect.Bool: reflect.ValueOf(Bool), + reflect.Float64: reflect.ValueOf(Float64), + reflect.Float32: reflect.ValueOf(Float32), + reflect.Int64: reflect.ValueOf(Int64), + reflect.Int32: reflect.ValueOf(Int32), + reflect.Uint64: reflect.ValueOf(Uint64), + reflect.Uint32: reflect.ValueOf(Uint32), + reflect.Slice: reflect.ValueOf(Bytes), + } +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE new file mode 100644 index 00000000..261eeb9e --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis/LICENSE @@ -0,0 +1,201 @@ + 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/grpc-ecosystem/grpc-gateway/utilities/doc.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go new file mode 100644 index 00000000..cf79a4d5 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/doc.go @@ -0,0 +1,2 @@ +// Package utilities provides members for internal use in grpc-gateway. +package utilities diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go new file mode 100644 index 00000000..dfe7de48 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/pattern.go @@ -0,0 +1,22 @@ +package utilities + +// An OpCode is a opcode of compiled path patterns. +type OpCode int + +// These constants are the valid values of OpCode. +const ( + // OpNop does nothing + OpNop = OpCode(iota) + // OpPush pushes a component to stack + OpPush + // OpLitPush pushes a component to stack if it matches to the literal + OpLitPush + // OpPushM concatenates the remaining components and pushes it to stack + OpPushM + // OpConcatN pops N items from stack, concatenates them and pushes it back to stack + OpConcatN + // OpCapture pops an item and binds it to the variable + OpCapture + // OpEnd is the least positive invalid opcode. + OpEnd +) diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/readerfactory.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/readerfactory.go new file mode 100644 index 00000000..6dd38546 --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/readerfactory.go @@ -0,0 +1,20 @@ +package utilities + +import ( + "bytes" + "io" + "io/ioutil" +) + +// IOReaderFactory takes in an io.Reader and returns a function that will allow you to create a new reader that begins +// at the start of the stream +func IOReaderFactory(r io.Reader) (func() io.Reader, error) { + b, err := ioutil.ReadAll(r) + if err != nil { + return nil, err + } + + return func() io.Reader { + return bytes.NewReader(b) + }, nil +} diff --git a/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go new file mode 100644 index 00000000..c2b7b30d --- /dev/null +++ b/vendor/github.com/grpc-ecosystem/grpc-gateway/utilities/trie.go @@ -0,0 +1,177 @@ +package utilities + +import ( + "sort" +) + +// DoubleArray is a Double Array implementation of trie on sequences of strings. +type DoubleArray struct { + // Encoding keeps an encoding from string to int + Encoding map[string]int + // Base is the base array of Double Array + Base []int + // Check is the check array of Double Array + Check []int +} + +// NewDoubleArray builds a DoubleArray from a set of sequences of strings. +func NewDoubleArray(seqs [][]string) *DoubleArray { + da := &DoubleArray{Encoding: make(map[string]int)} + if len(seqs) == 0 { + return da + } + + encoded := registerTokens(da, seqs) + sort.Sort(byLex(encoded)) + + root := node{row: -1, col: -1, left: 0, right: len(encoded)} + addSeqs(da, encoded, 0, root) + + for i := len(da.Base); i > 0; i-- { + if da.Check[i-1] != 0 { + da.Base = da.Base[:i] + da.Check = da.Check[:i] + break + } + } + return da +} + +func registerTokens(da *DoubleArray, seqs [][]string) [][]int { + var result [][]int + for _, seq := range seqs { + var encoded []int + for _, token := range seq { + if _, ok := da.Encoding[token]; !ok { + da.Encoding[token] = len(da.Encoding) + } + encoded = append(encoded, da.Encoding[token]) + } + result = append(result, encoded) + } + for i := range result { + result[i] = append(result[i], len(da.Encoding)) + } + return result +} + +type node struct { + row, col int + left, right int +} + +func (n node) value(seqs [][]int) int { + return seqs[n.row][n.col] +} + +func (n node) children(seqs [][]int) []*node { + var result []*node + lastVal := int(-1) + last := new(node) + for i := n.left; i < n.right; i++ { + if lastVal == seqs[i][n.col+1] { + continue + } + last.right = i + last = &node{ + row: i, + col: n.col + 1, + left: i, + } + result = append(result, last) + } + last.right = n.right + return result +} + +func addSeqs(da *DoubleArray, seqs [][]int, pos int, n node) { + ensureSize(da, pos) + + children := n.children(seqs) + var i int + for i = 1; ; i++ { + ok := func() bool { + for _, child := range children { + code := child.value(seqs) + j := i + code + ensureSize(da, j) + if da.Check[j] != 0 { + return false + } + } + return true + }() + if ok { + break + } + } + da.Base[pos] = i + for _, child := range children { + code := child.value(seqs) + j := i + code + da.Check[j] = pos + 1 + } + terminator := len(da.Encoding) + for _, child := range children { + code := child.value(seqs) + if code == terminator { + continue + } + j := i + code + addSeqs(da, seqs, j, *child) + } +} + +func ensureSize(da *DoubleArray, i int) { + for i >= len(da.Base) { + da.Base = append(da.Base, make([]int, len(da.Base)+1)...) + da.Check = append(da.Check, make([]int, len(da.Check)+1)...) + } +} + +type byLex [][]int + +func (l byLex) Len() int { return len(l) } +func (l byLex) Swap(i, j int) { l[i], l[j] = l[j], l[i] } +func (l byLex) Less(i, j int) bool { + si := l[i] + sj := l[j] + var k int + for k = 0; k < len(si) && k < len(sj); k++ { + if si[k] < sj[k] { + return true + } + if si[k] > sj[k] { + return false + } + } + if k < len(sj) { + return true + } + return false +} + +// HasCommonPrefix determines if any sequence in the DoubleArray is a prefix of the given sequence. +func (da *DoubleArray) HasCommonPrefix(seq []string) bool { + if len(da.Base) == 0 { + return false + } + + var i int + for _, t := range seq { + code, ok := da.Encoding[t] + if !ok { + break + } + j := da.Base[i] + code + if len(da.Check) <= j || da.Check[j] != i+1 { + break + } + i = j + } + j := da.Base[i] + len(da.Encoding) + if len(da.Check) <= j || da.Check[j] != i+1 { + return false + } + return true +} diff --git a/vendor/github.com/jmespath/go-jmespath/api.go b/vendor/github.com/jmespath/go-jmespath/api.go index 9cfa988b..8e26ffee 100644 --- a/vendor/github.com/jmespath/go-jmespath/api.go +++ b/vendor/github.com/jmespath/go-jmespath/api.go @@ -2,7 +2,7 @@ package jmespath import "strconv" -// JmesPath is the epresentation of a compiled JMES path query. A JmesPath is +// JMESPath is the epresentation of a compiled JMES path query. A JMESPath is // safe for concurrent use by multiple goroutines. type JMESPath struct { ast ASTNode diff --git a/vendor/github.com/linode/linodego/account_events.go b/vendor/github.com/linode/linodego/account_events.go index e2365c35..8820966b 100644 --- a/vendor/github.com/linode/linodego/account_events.go +++ b/vendor/github.com/linode/linodego/account_events.go @@ -54,59 +54,80 @@ type EventAction string // EventAction constants represent the actions that cause an Event. New actions may be added in the future. const ( + ActionAccountUpdate EventAction = "account_update" + ActionAccountSettingsUpdate EventAction = "account_settings_update" ActionBackupsEnable EventAction = "backups_enable" ActionBackupsCancel EventAction = "backups_cancel" ActionBackupsRestore EventAction = "backups_restore" ActionCommunityQuestionReply EventAction = "community_question_reply" + ActionCommunityLike EventAction = "community_like" ActionCreateCardUpdated EventAction = "credit_card_updated" ActionDiskCreate EventAction = "disk_create" ActionDiskDelete EventAction = "disk_delete" + ActionDiskUpdate EventAction = "disk_update" ActionDiskDuplicate EventAction = "disk_duplicate" ActionDiskImagize EventAction = "disk_imagize" ActionDiskResize EventAction = "disk_resize" ActionDNSRecordCreate EventAction = "dns_record_create" ActionDNSRecordDelete EventAction = "dns_record_delete" + ActionDNSRecordUpdate EventAction = "dns_record_update" ActionDNSZoneCreate EventAction = "dns_zone_create" ActionDNSZoneDelete EventAction = "dns_zone_delete" + ActionDNSZoneUpdate EventAction = "dns_zone_update" + ActionHostReboot EventAction = "host_reboot" ActionImageDelete EventAction = "image_delete" + ActionImageUpdate EventAction = "image_update" + ActionLassieReboot EventAction = "lassie_reboot" ActionLinodeAddIP EventAction = "linode_addip" ActionLinodeBoot EventAction = "linode_boot" ActionLinodeClone EventAction = "linode_clone" ActionLinodeCreate EventAction = "linode_create" ActionLinodeDelete EventAction = "linode_delete" + ActionLinodeUpdate EventAction = "linode_update" ActionLinodeDeleteIP EventAction = "linode_deleteip" ActionLinodeMigrate EventAction = "linode_migrate" ActionLinodeMutate EventAction = "linode_mutate" + ActionLinodeMutateCreate EventAction = "linode_mutate_create" ActionLinodeReboot EventAction = "linode_reboot" ActionLinodeRebuild EventAction = "linode_rebuild" ActionLinodeResize EventAction = "linode_resize" + ActionLinodeResizeCreate EventAction = "linode_resize_create" ActionLinodeShutdown EventAction = "linode_shutdown" ActionLinodeSnapshot EventAction = "linode_snapshot" + ActionLinodeConfigCreate EventAction = "linode_config_create" + ActionLinodeConfigDelete EventAction = "linode_config_delete" + ActionLinodeConfigUpdate EventAction = "linode_config_update" + ActionLishBoot EventAction = "lish_boot" ActionLongviewClientCreate EventAction = "longviewclient_create" ActionLongviewClientDelete EventAction = "longviewclient_delete" + ActionLongviewClientUpdate EventAction = "longviewclient_update" ActionManagedDisabled EventAction = "managed_disabled" ActionManagedEnabled EventAction = "managed_enabled" ActionManagedServiceCreate EventAction = "managed_service_create" ActionManagedServiceDelete EventAction = "managed_service_delete" ActionNodebalancerCreate EventAction = "nodebalancer_create" ActionNodebalancerDelete EventAction = "nodebalancer_delete" + ActionNodebalancerUpdate EventAction = "nodebalancer_update" ActionNodebalancerConfigCreate EventAction = "nodebalancer_config_create" ActionNodebalancerConfigDelete EventAction = "nodebalancer_config_delete" + ActionNodebalancerConfigUpdate EventAction = "nodebalancer_config_update" ActionPasswordReset EventAction = "password_reset" ActionPaymentSubmitted EventAction = "payment_submitted" ActionStackScriptCreate EventAction = "stackscript_create" ActionStackScriptDelete EventAction = "stackscript_delete" + ActionStackScriptUpdate EventAction = "stackscript_update" ActionStackScriptPublicize EventAction = "stackscript_publicize" ActionStackScriptRevise EventAction = "stackscript_revise" ActionTFADisabled EventAction = "tfa_disabled" ActionTFAEnabled EventAction = "tfa_enabled" ActionTicketAttachmentUpload EventAction = "ticket_attachment_upload" ActionTicketCreate EventAction = "ticket_create" - ActionTicketReply EventAction = "ticket_reply" + ActionTicketUpdate EventAction = "ticket_update" ActionVolumeAttach EventAction = "volume_attach" ActionVolumeClone EventAction = "volume_clone" ActionVolumeCreate EventAction = "volume_create" ActionVolumeDelte EventAction = "volume_delete" + ActionVolumeUpdate EventAction = "volume_update" ActionVolumeDetach EventAction = "volume_detach" ActionVolumeResize EventAction = "volume_resize" ) @@ -114,10 +135,12 @@ const ( // EntityType constants start with Entity and include Linode API Event Entity Types type EntityType string -// EntityType contants are the entities an Event can be related to +// EntityType contants are the entities an Event can be related to. const ( - EntityLinode EntityType = "linode" - EntityDisk EntityType = "disk" + EntityLinode EntityType = "linode" + EntityDisk EntityType = "disk" + EntityDomain EntityType = "domain" + EntityNodebalancer EntityType = "nodebalancer" ) // EventStatus constants start with Event and include Linode API Event Status values diff --git a/vendor/github.com/linode/linodego/account_oauth_client.go b/vendor/github.com/linode/linodego/account_oauth_client.go new file mode 100644 index 00000000..a351ce93 --- /dev/null +++ b/vendor/github.com/linode/linodego/account_oauth_client.go @@ -0,0 +1,190 @@ +package linodego + +import ( + "context" + "encoding/json" + "fmt" +) + +// OAuthClientStatus constants start with OAuthClient and include Linode API Instance Status values +type OAuthClientStatus string + +// OAuthClientStatus constants reflect the current status of an OAuth Client +const ( + OAuthClientActive OAuthClientStatus = "active" + OAuthClientDisabled OAuthClientStatus = "disabled" + OAuthClientSuspended OAuthClientStatus = "suspended" +) + +// OAuthClient represents a OAuthClient object +type OAuthClient struct { + // The unique ID of this OAuth Client. + ID string `json:"id"` + + // The location a successful log in from https://login.linode.com should be redirected to for this client. The receiver of this redirect should be ready to accept an OAuth exchange code and finish the OAuth exchange. + RedirectURI string `json:"redirect_uri"` + + // The name of this application. This will be presented to users when they are asked to grant it access to their Account. + Label string `json:"label"` + + // Current status of the OAuth Client, Enum: "active" "disabled" "suspended" + Status OAuthClientStatus `json:"status"` + + // The OAuth Client secret, used in the OAuth exchange. This is returned as except when an OAuth Client is created or its secret is reset. This is a secret, and should not be shared or disclosed publicly. + Secret string `json:"secret"` + + // If this OAuth Client is public or private. + Public bool `json:"public"` + + // The URL where this client's thumbnail may be viewed, or nil if this client does not have a thumbnail set. + ThumbnailURL *string `json:"thumbnail_url"` +} + +// OAuthClientCreateOptions fields are those accepted by CreateOAuthClient +type OAuthClientCreateOptions struct { + // The location a successful log in from https://login.linode.com should be redirected to for this client. The receiver of this redirect should be ready to accept an OAuth exchange code and finish the OAuth exchange. + RedirectURI string `json:"redirect_uri"` + + // The name of this application. This will be presented to users when they are asked to grant it access to their Account. + Label string `json:"label"` + + // If this OAuth Client is public or private. + Public bool `json:"public"` +} + +// OAuthClientUpdateOptions fields are those accepted by UpdateOAuthClient +type OAuthClientUpdateOptions struct { + // The location a successful log in from https://login.linode.com should be redirected to for this client. The receiver of this redirect should be ready to accept an OAuth exchange code and finish the OAuth exchange. + RedirectURI string `json:"redirect_uri"` + + // The name of this application. This will be presented to users when they are asked to grant it access to their Account. + Label string `json:"label"` + + // If this OAuth Client is public or private. + Public bool `json:"public"` +} + +// GetCreateOptions converts a OAuthClient to OAuthClientCreateOptions for use in CreateOAuthClient +func (i OAuthClient) GetCreateOptions() (o OAuthClientCreateOptions) { + o.RedirectURI = i.RedirectURI + o.Label = i.Label + o.Public = i.Public + return +} + +// GetUpdateOptions converts a OAuthClient to OAuthClientUpdateOptions for use in UpdateOAuthClient +func (i OAuthClient) GetUpdateOptions() (o OAuthClientUpdateOptions) { + o.RedirectURI = i.RedirectURI + o.Label = i.Label + o.Public = i.Public + return +} + +// OAuthClientsPagedResponse represents a paginated OAuthClient API response +type OAuthClientsPagedResponse struct { + *PageOptions + Data []OAuthClient `json:"data"` +} + +// endpoint gets the endpoint URL for OAuthClient +func (OAuthClientsPagedResponse) endpoint(c *Client) string { + endpoint, err := c.OAuthClients.Endpoint() + if err != nil { + panic(err) + } + return endpoint +} + +// appendData appends OAuthClients when processing paginated OAuthClient responses +func (resp *OAuthClientsPagedResponse) appendData(r *OAuthClientsPagedResponse) { + resp.Data = append(resp.Data, r.Data...) +} + +// ListOAuthClients lists OAuthClients +func (c *Client) ListOAuthClients(ctx context.Context, opts *ListOptions) ([]OAuthClient, error) { + response := OAuthClientsPagedResponse{} + err := c.listHelper(ctx, &response, opts) + if err != nil { + return nil, err + } + return response.Data, nil +} + +// GetOAuthClient gets the OAuthClient with the provided ID +func (c *Client) GetOAuthClient(ctx context.Context, id string) (*OAuthClient, error) { + e, err := c.OAuthClients.Endpoint() + if err != nil { + return nil, err + } + e = fmt.Sprintf("%s/%s", e, id) + r, err := coupleAPIErrors(c.R(ctx).SetResult(&OAuthClient{}).Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*OAuthClient), nil +} + +// CreateOAuthClient creates an OAuthClient +func (c *Client) CreateOAuthClient(ctx context.Context, createOpts OAuthClientCreateOptions) (*OAuthClient, error) { + var body string + e, err := c.OAuthClients.Endpoint() + if err != nil { + return nil, err + } + + req := c.R(ctx).SetResult(&OAuthClient{}) + + if bodyData, err := json.Marshal(createOpts); err == nil { + body = string(bodyData) + } else { + return nil, NewError(err) + } + + r, err := coupleAPIErrors(req. + SetBody(body). + Post(e)) + + if err != nil { + return nil, err + } + return r.Result().(*OAuthClient), nil +} + +// UpdateOAuthClient updates the OAuthClient with the specified id +func (c *Client) UpdateOAuthClient(ctx context.Context, id string, updateOpts OAuthClientUpdateOptions) (*OAuthClient, error) { + var body string + e, err := c.OAuthClients.Endpoint() + if err != nil { + return nil, err + } + e = fmt.Sprintf("%s/%s", e, id) + + req := c.R(ctx).SetResult(&OAuthClient{}) + + if bodyData, err := json.Marshal(updateOpts); err == nil { + body = string(bodyData) + } else { + return nil, NewError(err) + } + + r, err := coupleAPIErrors(req. + SetBody(body). + Put(e)) + + if err != nil { + return nil, err + } + return r.Result().(*OAuthClient), nil +} + +// DeleteOAuthClient deletes the OAuthClient with the specified id +func (c *Client) DeleteOAuthClient(ctx context.Context, id string) error { + e, err := c.OAuthClients.Endpoint() + if err != nil { + return err + } + e = fmt.Sprintf("%s/%s", e, id) + + _, err = coupleAPIErrors(c.R(ctx).Delete(e)) + return err +} diff --git a/vendor/github.com/linode/linodego/account_payments.go b/vendor/github.com/linode/linodego/account_payments.go new file mode 100644 index 00000000..bf00862e --- /dev/null +++ b/vendor/github.com/linode/linodego/account_payments.go @@ -0,0 +1,115 @@ +package linodego + +import ( + "context" + "encoding/json" + "fmt" + "time" +) + +// Payment represents a Payment object +type Payment struct { + // The unique ID of the Payment + ID int `json:"id"` + + // The amount, in US dollars, of the Payment. + USD json.Number `json:"usd,Number"` + + // When the Payment was made. + DateStr string `json:"date"` + Date *time.Time `json:"-"` +} + +// PaymentCreateOptions fields are those accepted by CreatePayment +type PaymentCreateOptions struct { + // CVV (Card Verification Value) of the credit card to be used for the Payment + CVV string `json:"cvv,omitempty"` + + // The amount, in US dollars, of the Payment + USD json.Number `json:"usd,Number"` +} + +// GetCreateOptions converts a Payment to PaymentCreateOptions for use in CreatePayment +func (i Payment) GetCreateOptions() (o PaymentCreateOptions) { + o.USD = i.USD + return +} + +// PaymentsPagedResponse represents a paginated Payment API response +type PaymentsPagedResponse struct { + *PageOptions + Data []Payment `json:"data"` +} + +// endpoint gets the endpoint URL for Payment +func (PaymentsPagedResponse) endpoint(c *Client) string { + endpoint, err := c.Payments.Endpoint() + if err != nil { + panic(err) + } + return endpoint +} + +// appendData appends Payments when processing paginated Payment responses +func (resp *PaymentsPagedResponse) appendData(r *PaymentsPagedResponse) { + resp.Data = append(resp.Data, r.Data...) +} + +// ListPayments lists Payments +func (c *Client) ListPayments(ctx context.Context, opts *ListOptions) ([]Payment, error) { + response := PaymentsPagedResponse{} + err := c.listHelper(ctx, &response, opts) + for i := range response.Data { + response.Data[i].fixDates() + } + if err != nil { + return nil, err + } + return response.Data, nil +} + +// fixDates converts JSON timestamps to Go time.Time values +func (i *Payment) fixDates() *Payment { + i.Date, _ = parseDates(i.DateStr) + return i +} + +// GetPayment gets the payment with the provided ID +func (c *Client) GetPayment(ctx context.Context, id int) (*Payment, error) { + e, err := c.Payments.Endpoint() + if err != nil { + return nil, err + } + e = fmt.Sprintf("%s/%d", e, id) + r, err := coupleAPIErrors(c.R(ctx).SetResult(&Payment{}).Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*Payment).fixDates(), nil +} + +// CreatePayment creates a Payment +func (c *Client) CreatePayment(ctx context.Context, createOpts PaymentCreateOptions) (*Payment, error) { + var body string + e, err := c.Payments.Endpoint() + if err != nil { + return nil, err + } + + req := c.R(ctx).SetResult(&Payment{}) + + if bodyData, err := json.Marshal(createOpts); err == nil { + body = string(bodyData) + } else { + return nil, NewError(err) + } + + r, err := coupleAPIErrors(req. + SetBody(body). + Post(e)) + + if err != nil { + return nil, err + } + return r.Result().(*Payment).fixDates(), nil +} diff --git a/vendor/github.com/linode/linodego/account_settings.go b/vendor/github.com/linode/linodego/account_settings.go new file mode 100644 index 00000000..7a494659 --- /dev/null +++ b/vendor/github.com/linode/linodego/account_settings.go @@ -0,0 +1,72 @@ +package linodego + +import ( + "context" + "encoding/json" +) + +// AccountSettings are the account wide flags or plans that effect new resources +type AccountSettings struct { + // The default backups enrollment status for all new Linodes for all users on the account. When enabled, backups are mandatory per instance. + BackupsEnabled bool `json:"backups_enabled"` + + // Wether or not Linode Managed service is enabled for the account. + Managed bool `json:"managed"` + + // Wether or not the Network Helper is enabled for all new Linode Instance Configs on the account. + NetworkHelper bool `json:"network_helper"` + + // A plan name like "longview-3"..."longview-100", or a nil value for to cancel any existing subscription plan. + LongviewSubscription *string `json:"longview_subscription"` +} + +// AccountSettingsUpdateOptions are the updateable account wide flags or plans that effect new resources. +type AccountSettingsUpdateOptions struct { + // The default backups enrollment status for all new Linodes for all users on the account. When enabled, backups are mandatory per instance. + BackupsEnabled *bool `json:"backups_enabled,omitempty"` + + // A plan name like "longview-3"..."longview-100", or a nil value for to cancel any existing subscription plan. + LongviewSubscription *string `json:"longview_subscription,omitempty"` + + // The default network helper setting for all new Linodes and Linode Configs for all users on the account. + NetworkHelper *bool `json:"network_helper,omitempty"` +} + +// GetAccountSettings gets the account wide flags or plans that effect new resources +func (c *Client) GetAccountSettings(ctx context.Context) (*AccountSettings, error) { + e, err := c.AccountSettings.Endpoint() + if err != nil { + return nil, err + } + r, err := coupleAPIErrors(c.R(ctx).SetResult(&AccountSettings{}).Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*AccountSettings), nil +} + +// UpdateAccountSettings updates the settings associated with the account +func (c *Client) UpdateAccountSettings(ctx context.Context, settings AccountSettingsUpdateOptions) (*AccountSettings, error) { + var body string + e, err := c.AccountSettings.Endpoint() + if err != nil { + return nil, err + } + + req := c.R(ctx).SetResult(&AccountSettings{}) + + if bodyData, err := json.Marshal(settings); err == nil { + body = string(bodyData) + } else { + return nil, NewError(err) + } + + r, err := coupleAPIErrors(req. + SetBody(body). + Put(e)) + + if err != nil { + return nil, err + } + return r.Result().(*AccountSettings), nil +} diff --git a/vendor/github.com/linode/linodego/client.go b/vendor/github.com/linode/linodego/client.go index 224a496d..7d87dc76 100644 --- a/vendor/github.com/linode/linodego/client.go +++ b/vendor/github.com/linode/linodego/client.go @@ -3,6 +3,7 @@ package linodego import ( "context" "fmt" + "io/ioutil" "log" "net/http" "os" @@ -15,12 +16,16 @@ import ( const ( // APIHost Linode API hostname APIHost = "api.linode.com" + // APIHostVar environment var to check for alternate API URL + APIHostVar = "LINODE_URL" + // APIHostCert environment var containing path to CA cert to validate against + APIHostCert = "LINODE_CA" // APIVersion Linode API version APIVersion = "v4" // APIProto connect to API with http(s) APIProto = "https" // Version of linodego - Version = "0.7.0" + Version = "0.10.0" // APIEnvVar environment var to check for API token APIEnvVar = "LINODE_TOKEN" // APISecondsPerPoll how frequently to poll for new Events or Status in WaitFor functions @@ -48,6 +53,7 @@ type Client struct { InstanceSnapshots *Resource InstanceIPs *Resource InstanceVolumes *Resource + InstanceStats *Resource Instances *Resource IPAddresses *Resource IPv6Pools *Resource @@ -70,14 +76,17 @@ type Client struct { Tokens *Resource Token *Resource Account *Resource + AccountSettings *Resource Invoices *Resource InvoiceItems *Resource Events *Resource Notifications *Resource + OAuthClients *Resource Profile *Resource Managed *Resource Tags *Resource Users *Resource + Payments *Resource } func init() { @@ -123,6 +132,18 @@ func (c *Client) SetBaseURL(url string) *Client { return c } +func (c *Client) SetRootCertificate(path string) *Client { + c.resty.SetRootCertificate(path) + return c +} + +// SetToken sets the API token for all requests from this client +// Only necessary if you haven't already provided an http client to NewClient() configured with the token. +func (c *Client) SetToken(token string) *Client { + c.resty.SetHeader("Authorization", fmt.Sprintf("Bearer %s", token)) + return c +} + // SetPollDelay sets the number of milliseconds to wait between events or status polls. // Affects all WaitFor* functions. func (c *Client) SetPollDelay(delay time.Duration) *Client { @@ -141,10 +162,29 @@ func (c Client) Resource(resourceName string) *Resource { // NewClient factory to create new Client struct func NewClient(hc *http.Client) (client Client) { - restyClient := resty.NewWithClient(hc) - client.resty = restyClient + if hc != nil { + client.resty = resty.NewWithClient(hc) + } else { + client.resty = resty.New() + } client.SetUserAgent(DefaultUserAgent) - client.SetBaseURL(fmt.Sprintf("%s://%s/%s", APIProto, APIHost, APIVersion)) + baseURL, baseURLExists := os.LookupEnv(APIHostVar) + if baseURLExists { + client.SetBaseURL(baseURL) + } else { + client.SetBaseURL(fmt.Sprintf("%s://%s/%s", APIProto, APIHost, APIVersion)) + } + certPath, certPathExists := os.LookupEnv(APIHostCert) + if certPathExists { + cert, err := ioutil.ReadFile(certPath) + if err != nil { + log.Fatalf("[ERROR] Error when reading cert at %s: %s\n", certPath, err.Error()) + } + client.SetRootCertificate(certPath) + if envDebug { + log.Printf("[DEBUG] Set API root certificate to %s with contents %s\n", certPath, cert) + } + } client.SetPollDelay(1000 * APISecondsPerPoll) resources := map[string]*Resource{ @@ -156,8 +196,9 @@ func NewClient(hc *http.Client) (client Client) { instanceSnapshotsName: NewResource(&client, instanceSnapshotsName, instanceSnapshotsEndpoint, true, InstanceSnapshot{}, nil), instanceIPsName: NewResource(&client, instanceIPsName, instanceIPsEndpoint, true, InstanceIP{}, nil), // really? instanceVolumesName: NewResource(&client, instanceVolumesName, instanceVolumesEndpoint, true, nil, InstanceVolumesPagedResponse{}), // really? - ipaddressesName: NewResource(&client, ipaddressesName, ipaddressesEndpoint, false, nil, IPAddressesPagedResponse{}), // really? - ipv6poolsName: NewResource(&client, ipv6poolsName, ipv6poolsEndpoint, false, nil, IPv6PoolsPagedResponse{}), // really? + instanceStatsName: NewResource(&client, instanceStatsName, instanceStatsEndpoint, true, InstanceStats{}, nil), + ipaddressesName: NewResource(&client, ipaddressesName, ipaddressesEndpoint, false, nil, IPAddressesPagedResponse{}), // really? + ipv6poolsName: NewResource(&client, ipv6poolsName, ipv6poolsEndpoint, false, nil, IPv6PoolsPagedResponse{}), // really? ipv6rangesName: NewResource(&client, ipv6rangesName, ipv6rangesEndpoint, false, IPv6Range{}, IPv6RangesPagedResponse{}), regionsName: NewResource(&client, regionsName, regionsEndpoint, false, Region{}, RegionsPagedResponse{}), volumesName: NewResource(&client, volumesName, volumesEndpoint, false, Volume{}, VolumesPagedResponse{}), @@ -172,10 +213,12 @@ func NewClient(hc *http.Client) (client Client) { nodebalancerconfigsName: NewResource(&client, nodebalancerconfigsName, nodebalancerconfigsEndpoint, true, NodeBalancerConfig{}, NodeBalancerConfigsPagedResponse{}), nodebalancernodesName: NewResource(&client, nodebalancernodesName, nodebalancernodesEndpoint, true, NodeBalancerNode{}, NodeBalancerNodesPagedResponse{}), notificationsName: NewResource(&client, notificationsName, notificationsEndpoint, false, Notification{}, NotificationsPagedResponse{}), + oauthClientsName: NewResource(&client, oauthClientsName, oauthClientsEndpoint, false, OAuthClient{}, OAuthClientsPagedResponse{}), sshkeysName: NewResource(&client, sshkeysName, sshkeysEndpoint, false, SSHKey{}, SSHKeysPagedResponse{}), ticketsName: NewResource(&client, ticketsName, ticketsEndpoint, false, Ticket{}, TicketsPagedResponse{}), tokensName: NewResource(&client, tokensName, tokensEndpoint, false, Token{}, TokensPagedResponse{}), - accountName: NewResource(&client, accountName, accountEndpoint, false, Account{}, nil), // really? + accountName: NewResource(&client, accountName, accountEndpoint, false, Account{}, nil), // really? + accountSettingsName: NewResource(&client, accountSettingsName, accountSettingsEndpoint, false, AccountSettings{}, nil), // really? eventsName: NewResource(&client, eventsName, eventsEndpoint, false, Event{}, EventsPagedResponse{}), invoicesName: NewResource(&client, invoicesName, invoicesEndpoint, false, Invoice{}, InvoicesPagedResponse{}), invoiceItemsName: NewResource(&client, invoiceItemsName, invoiceItemsEndpoint, true, InvoiceItem{}, InvoiceItemsPagedResponse{}), @@ -183,6 +226,7 @@ func NewClient(hc *http.Client) (client Client) { managedName: NewResource(&client, managedName, managedEndpoint, false, nil, nil), // really? tagsName: NewResource(&client, tagsName, tagsEndpoint, false, Tag{}, TagsPagedResponse{}), usersName: NewResource(&client, usersName, usersEndpoint, false, User{}, UsersPagedResponse{}), + paymentsName: NewResource(&client, paymentsName, paymentsEndpoint, false, Payment{}, PaymentsPagedResponse{}), } client.resources = resources @@ -197,6 +241,7 @@ func NewClient(hc *http.Client) (client Client) { client.InstanceSnapshots = resources[instanceSnapshotsName] client.InstanceIPs = resources[instanceIPsName] client.InstanceVolumes = resources[instanceVolumesName] + client.InstanceStats = resources[instanceStatsName] client.IPAddresses = resources[ipaddressesName] client.IPv6Pools = resources[ipv6poolsName] client.IPv6Ranges = resources[ipv6rangesName] @@ -211,6 +256,7 @@ func NewClient(hc *http.Client) (client Client) { client.NodeBalancerConfigs = resources[nodebalancerconfigsName] client.NodeBalancerNodes = resources[nodebalancernodesName] client.Notifications = resources[notificationsName] + client.OAuthClients = resources[oauthClientsName] client.SSHKeys = resources[sshkeysName] client.Tickets = resources[ticketsName] client.Tokens = resources[tokensName] @@ -221,6 +267,7 @@ func NewClient(hc *http.Client) (client Client) { client.Managed = resources[managedName] client.Tags = resources[tagsName] client.Users = resources[usersName] + client.Payments = resources[paymentsName] return } diff --git a/vendor/github.com/linode/linodego/errors.go b/vendor/github.com/linode/linodego/errors.go index 9ceb881a..feacc2cb 100644 --- a/vendor/github.com/linode/linodego/errors.go +++ b/vendor/github.com/linode/linodego/errors.go @@ -60,7 +60,7 @@ func coupleAPIErrors(r *resty.Response, err error) (*resty.Response, error) { } func (e APIError) Error() string { - var x []string + x := []string{} for _, msg := range e.Errors { x = append(x, msg.Error()) } diff --git a/vendor/github.com/linode/linodego/instance_ips.go b/vendor/github.com/linode/linodego/instance_ips.go index a30d04f1..6df20604 100644 --- a/vendor/github.com/linode/linodego/instance_ips.go +++ b/vendor/github.com/linode/linodego/instance_ips.go @@ -14,22 +14,23 @@ type InstanceIPAddressResponse struct { // InstanceIPv4Response contains the details of all IPv4 addresses associated with an Instance type InstanceIPv4Response struct { - Public []*InstanceIP `json:"public"` - Private []*InstanceIP `json:"private"` - Shared []*InstanceIP `json:"shared"` + Public []*InstanceIP `json:"public"` + Private []*InstanceIP `json:"private"` + Shared []*InstanceIP `json:"shared"` + Reserved []*InstanceIP `json:"reserved"` } // InstanceIP represents an Instance IP with additional DNS and networking details type InstanceIP struct { - Address string `json:"address"` - Gateway string `json:"gateway"` - SubnetMask string `json:"subnet_mask"` - Prefix int `json:"prefix"` - Type string `json:"type"` - Public bool `json:"public"` - RDNS string `json:"rdns"` - LinodeID int `json:"linode_id"` - Region string `json:"region"` + Address string `json:"address"` + Gateway string `json:"gateway"` + SubnetMask string `json:"subnet_mask"` + Prefix int `json:"prefix"` + Type InstanceIPType `json:"type"` + Public bool `json:"public"` + RDNS string `json:"rdns"` + LinodeID int `json:"linode_id"` + Region string `json:"region"` } // InstanceIPv6Response contains the IPv6 addresses and ranges for an Instance @@ -43,8 +44,20 @@ type InstanceIPv6Response struct { type IPv6Range struct { Range string `json:"range"` Region string `json:"region"` + Prefix int `json:"prefix"` } +// InstanceIPType constants start with IPType and include Linode Instance IP Types +type InstanceIPType string + +// InstanceIPType constants represent the IP types an Instance IP may be +const ( + IPTypeIPv4 InstanceIPType = "ipv4" + IPTypeIPv6 InstanceIPType = "ipv6" + IPTypeIPv6Pool InstanceIPType = "ipv6/pool" + IPTypeIPv6Range InstanceIPType = "ipv6/range" +) + // GetInstanceIPAddresses gets the IPAddresses for a Linode instance func (c *Client) GetInstanceIPAddresses(ctx context.Context, linodeID int) (*InstanceIPAddressResponse, error) { e, err := c.InstanceIPs.endpointWithID(linodeID) @@ -104,3 +117,30 @@ func (c *Client) AddInstanceIPAddress(ctx context.Context, linodeID int, public return r.Result().(*InstanceIP), nil } + +// UpdateInstanceIPAddress updates the IPAddress with the specified instance id and IP address +func (c *Client) UpdateInstanceIPAddress(ctx context.Context, linodeID int, ipAddress string, updateOpts IPAddressUpdateOptions) (*InstanceIP, error) { + var body string + e, err := c.InstanceIPs.endpointWithID(linodeID) + if err != nil { + return nil, err + } + e = fmt.Sprintf("%s/%s", e, ipAddress) + + req := c.R(ctx).SetResult(&InstanceIP{}) + + if bodyData, err := json.Marshal(updateOpts); err == nil { + body = string(bodyData) + } else { + return nil, NewError(err) + } + + r, err := coupleAPIErrors(req. + SetBody(body). + Put(e)) + + if err != nil { + return nil, err + } + return r.Result().(*InstanceIP), nil +} diff --git a/vendor/github.com/linode/linodego/instance_stats.go b/vendor/github.com/linode/linodego/instance_stats.go new file mode 100644 index 00000000..609b9518 --- /dev/null +++ b/vendor/github.com/linode/linodego/instance_stats.go @@ -0,0 +1,68 @@ +package linodego + +import ( + "context" + "fmt" +) + +// StatsNet represents a network stats object +type StatsNet struct { + In [][]float64 `json:"in"` + Out [][]float64 `json:"out"` + PrivateIn [][]float64 `json:"private_in"` + PrivateOut [][]float64 `json:"private_out"` +} + +// StatsIO represents an IO stats object +type StatsIO struct { + IO [][]float64 `json:"io"` + Swap [][]float64 `json:"swap"` +} + +// InstanceStatsData represents an instance stats data object +type InstanceStatsData struct { + CPU [][]float64 `json:"cpu"` + IO StatsIO `json:"io"` + NetV4 StatsNet `json:"netv4"` + NetV6 StatsNet `json:"netv6"` +} + +// InstanceStats represents an instance stats object +type InstanceStats struct { + Title string `json:"title"` + Data InstanceStatsData `json:"data"` +} + +// endpointWithIDAndDate gets the endpoint URL for InstanceStats of a given Instance and Year/Month +func endpointWithIDAndDate(c *Client, id int, year int, month int) string { + endpoint, err := c.InstanceStats.endpointWithID(id) + if err != nil { + panic(err) + } + + endpoint = fmt.Sprintf("%s/%d/%d", endpoint, year, month) + return endpoint +} + +// GetInstanceStats gets the template with the provided ID +func (c *Client) GetInstanceStats(ctx context.Context, linodeID int) (*InstanceStats, error) { + e, err := c.InstanceStats.endpointWithID(linodeID) + if err != nil { + return nil, err + } + r, err := coupleAPIErrors(c.R(ctx).SetResult(&InstanceStats{}).Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*InstanceStats), nil +} + +// GetInstanceStatsByDate gets the template with the provided ID, year, and month +func (c *Client) GetInstanceStatsByDate(ctx context.Context, linodeID int, year int, month int) (*InstanceStats, error) { + e := endpointWithIDAndDate(c, linodeID, year, month) + r, err := coupleAPIErrors(c.R(ctx).SetResult(&InstanceStats{}).Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*InstanceStats), nil +} diff --git a/vendor/github.com/linode/linodego/instances.go b/vendor/github.com/linode/linodego/instances.go index 85775508..d990ed07 100644 --- a/vendor/github.com/linode/linodego/instances.go +++ b/vendor/github.com/linode/linodego/instances.go @@ -81,6 +81,18 @@ type InstanceBackup struct { } } +// InstanceTransfer pool stats for a Linode Instance during the current billing month +type InstanceTransfer struct { + // Bytes of transfer this instance has consumed + Used int `json:"used"` + + // GB of billable transfer this instance has consumed + Billable int `json:"billable"` + + // GB of transfer this instance adds to the Transfer pool + Quota int `json:"quota"` +} + // InstanceCreateOptions require only Region and Type type InstanceCreateOptions struct { Region string `json:"region"` @@ -139,6 +151,14 @@ type InstanceCloneOptions struct { Configs []int `json:"configs,omitempty"` } +// InstanceResizeOptions +type InstanceResizeOptions struct { + Type string `json:"type"` + + // When enabled, an instance resize will also resize a data disk if the instance has no more than one data disk and one swap disk + AllowAutoDiskResize *bool `json:"allow_auto_disk_resize,omitempty"` +} + func (l *Instance) fixDates() *Instance { l.Created, _ = parseDates(l.CreatedStr) l.Updated, _ = parseDates(l.UpdatedStr) @@ -194,6 +214,22 @@ func (c *Client) GetInstance(ctx context.Context, linodeID int) (*Instance, erro return r.Result().(*Instance).fixDates(), nil } +// GetInstance gets the instance with the provided ID +func (c *Client) GetInstanceTransfer(ctx context.Context, linodeID int) (*InstanceTransfer, error) { + e, err := c.Instances.Endpoint() + if err != nil { + return nil, err + } + e = fmt.Sprintf("%s/%d/transfer", e, linodeID) + r, err := coupleAPIErrors(c.R(ctx). + SetResult(InstanceTransfer{}). + Get(e)) + if err != nil { + return nil, err + } + return r.Result().(*InstanceTransfer), nil +} + // CreateInstance creates a Linode instance func (c *Client) CreateInstance(ctx context.Context, instance InstanceCreateOptions) (*Instance, error) { var body string @@ -347,8 +383,8 @@ func (c *Client) RebootInstance(ctx context.Context, id int, configID int) error return err } -// RebuildInstanceOptions is a struct representing the options to send to the rebuild linode endpoint -type RebuildInstanceOptions struct { +// InstanceRebuildOptions is a struct representing the options to send to the rebuild linode endpoint +type InstanceRebuildOptions struct { Image string `json:"image"` RootPass string `json:"root_pass"` AuthorizedKeys []string `json:"authorized_keys"` @@ -360,7 +396,7 @@ type RebuildInstanceOptions struct { // RebuildInstance Deletes all Disks and Configs on this Linode, // then deploys a new Image to this Linode with the given attributes. -func (c *Client) RebuildInstance(ctx context.Context, id int, opts RebuildInstanceOptions) (*Instance, error) { +func (c *Client) RebuildInstance(ctx context.Context, id int, opts InstanceRebuildOptions) (*Instance, error) { o, err := json.Marshal(opts) if err != nil { return nil, NewError(err) @@ -381,8 +417,8 @@ func (c *Client) RebuildInstance(ctx context.Context, id int, opts RebuildInstan return r.Result().(*Instance).fixDates(), nil } -// RescueInstanceOptions fields are those accepted by RescueInstance -type RescueInstanceOptions struct { +// InstanceRescueOptions fields are those accepted by RescueInstance +type InstanceRescueOptions struct { Devices InstanceConfigDeviceMap `json:"devices"` } @@ -390,7 +426,7 @@ type RescueInstanceOptions struct { // Rescue Mode is based on the Finnix recovery distribution, a self-contained and bootable Linux distribution. // You can also use Rescue Mode for tasks other than disaster recovery, such as formatting disks to use different filesystems, // copying data between disks, and downloading files from a disk via SSH and SFTP. -func (c *Client) RescueInstance(ctx context.Context, id int, opts RescueInstanceOptions) error { +func (c *Client) RescueInstance(ctx context.Context, id int, opts InstanceRescueOptions) error { o, err := json.Marshal(opts) if err != nil { return NewError(err) @@ -410,9 +446,12 @@ func (c *Client) RescueInstance(ctx context.Context, id int, opts RescueInstance } // ResizeInstance resizes an instance to new Linode type -func (c *Client) ResizeInstance(ctx context.Context, id int, linodeType string) error { - body := fmt.Sprintf("{\"type\":\"%s\"}", linodeType) - +func (c *Client) ResizeInstance(ctx context.Context, id int, opts InstanceResizeOptions) error { + o, err := json.Marshal(opts) + if err != nil { + return NewError(err) + } + body := string(o) e, err := c.Instances.Endpoint() if err != nil { return err diff --git a/vendor/github.com/linode/linodego/pagination.go b/vendor/github.com/linode/linodego/pagination.go index bfe6de3b..7ca52e2f 100644 --- a/vendor/github.com/linode/linodego/pagination.go +++ b/vendor/github.com/linode/linodego/pagination.go @@ -28,8 +28,8 @@ type ListOptions struct { // NewListOptions simplified construction of ListOptions using only // the two writable properties, Page and Filter -func NewListOptions(Page int, Filter string) *ListOptions { - return &ListOptions{PageOptions: &PageOptions{Page: Page}, Filter: Filter} +func NewListOptions(page int, filter string) *ListOptions { + return &ListOptions{PageOptions: &PageOptions{Page: page}, Filter: filter} } @@ -102,7 +102,7 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption if r, err = coupleAPIErrors(req.SetResult(DomainsPagedResponse{}).Get(v.endpoint(c))); err == nil { response, ok := r.Result().(*DomainsPagedResponse) if !ok { - return fmt.Errorf("Response is not a *DomainsPagedResponse") + return fmt.Errorf("response is not a *DomainsPagedResponse") } pages = response.Pages results = response.Results @@ -149,7 +149,7 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption if r, err = coupleAPIErrors(req.SetResult(SSHKeysPagedResponse{}).Get(v.endpoint(c))); err == nil { response, ok := r.Result().(*SSHKeysPagedResponse) if !ok { - return fmt.Errorf("Response is not a *SSHKeysPagedResponse") + return fmt.Errorf("response is not a *SSHKeysPagedResponse") } pages = response.Pages results = response.Results @@ -173,6 +173,18 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption results = r.Result().(*NotificationsPagedResponse).Results v.appendData(r.Result().(*NotificationsPagedResponse)) } + case *OAuthClientsPagedResponse: + if r, err = coupleAPIErrors(req.SetResult(OAuthClientsPagedResponse{}).Get(v.endpoint(c))); err == nil { + pages = r.Result().(*OAuthClientsPagedResponse).Pages + results = r.Result().(*OAuthClientsPagedResponse).Results + v.appendData(r.Result().(*OAuthClientsPagedResponse)) + } + case *PaymentsPagedResponse: + if r, err = coupleAPIErrors(req.SetResult(PaymentsPagedResponse{}).Get(v.endpoint(c))); err == nil { + pages = r.Result().(*PaymentsPagedResponse).Pages + results = r.Result().(*PaymentsPagedResponse).Results + v.appendData(r.Result().(*PaymentsPagedResponse)) + } case *NodeBalancersPagedResponse: if r, err = coupleAPIErrors(req.SetResult(NodeBalancersPagedResponse{}).Get(v.endpoint(c))); err == nil { pages = r.Result().(*NodeBalancersPagedResponse).Pages @@ -198,8 +210,6 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption v.appendData(r.Result().(*UsersPagedResponse)) } /** - case AccountOauthClientsPagedResponse: - case AccountPaymentsPagedResponse: case ProfileAppsPagedResponse: case ProfileWhitelistPagedResponse: case ManagedContactsPagedResponse: @@ -217,7 +227,7 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption } if opts == nil { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { if err := c.listHelper(ctx, i, &ListOptions{PageOptions: &PageOptions{Page: page}}); err != nil { return err } @@ -228,7 +238,7 @@ func (c *Client) listHelper(ctx context.Context, i interface{}, opts *ListOption } if opts.Page == 0 { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { opts.Page = page if err := c.listHelper(ctx, i, opts); err != nil { return err @@ -277,7 +287,7 @@ func (c *Client) listHelperWithID(ctx context.Context, i interface{}, idRaw inte if r, err = coupleAPIErrors(req.SetResult(DomainRecordsPagedResponse{}).Get(v.endpointWithID(c, id))); err == nil { response, ok := r.Result().(*DomainRecordsPagedResponse) if !ok { - return fmt.Errorf("Response is not a *DomainRecordsPagedResponse") + return fmt.Errorf("response is not a *DomainRecordsPagedResponse") } pages = response.Pages results = response.Results @@ -342,7 +352,7 @@ func (c *Client) listHelperWithID(ctx context.Context, i interface{}, idRaw inte } if opts == nil { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { if err := c.listHelperWithID(ctx, i, id, &ListOptions{PageOptions: &PageOptions{Page: page}}); err != nil { return err } @@ -352,7 +362,7 @@ func (c *Client) listHelperWithID(ctx context.Context, i interface{}, idRaw inte opts.PageOptions = &PageOptions{} } if opts.Page == 0 { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { opts.Page = page if err := c.listHelperWithID(ctx, i, id, opts); err != nil { return err @@ -405,7 +415,7 @@ func (c *Client) listHelperWithTwoIDs(ctx context.Context, i interface{}, firstI } if opts == nil { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { if err := c.listHelper(ctx, i, &ListOptions{PageOptions: &PageOptions{Page: page}}); err != nil { return err } @@ -415,7 +425,7 @@ func (c *Client) listHelperWithTwoIDs(ctx context.Context, i interface{}, firstI opts.PageOptions = &PageOptions{} } if opts.Page == 0 { - for page := 2; page <= pages; page = page + 1 { + for page := 2; page <= pages; page++ { opts.Page = page if err := c.listHelperWithTwoIDs(ctx, i, firstID, secondID, opts); err != nil { return err diff --git a/vendor/github.com/linode/linodego/profile.go b/vendor/github.com/linode/linodego/profile.go index 3d29b2a5..36c50b0e 100644 --- a/vendor/github.com/linode/linodego/profile.go +++ b/vendor/github.com/linode/linodego/profile.go @@ -76,7 +76,7 @@ func (i Profile) GetUpdateOptions() (o ProfileUpdateOptions) { return } -// GetProfile gets the profile with the provided ID +// GetProfile returns the Profile of the authenticated user func (c *Client) GetProfile(ctx context.Context) (*Profile, error) { e, err := c.Profile.Endpoint() if err != nil { diff --git a/vendor/github.com/linode/linodego/resources.go b/vendor/github.com/linode/linodego/resources.go index fe0c258c..705ec9ac 100644 --- a/vendor/github.com/linode/linodego/resources.go +++ b/vendor/github.com/linode/linodego/resources.go @@ -18,6 +18,7 @@ const ( instanceIPsName = "ips" instanceSnapshotsName = "snapshots" instanceVolumesName = "instancevolumes" + instanceStatsName = "instancestats" ipaddressesName = "ipaddresses" ipv6poolsName = "ipv6pools" ipv6rangesName = "ipv6ranges" @@ -34,10 +35,12 @@ const ( nodebalancerconfigsName = "nodebalancerconfigs" nodebalancernodesName = "nodebalancernodes" notificationsName = "notifications" + oauthClientsName = "oauthClients" sshkeysName = "sshkeys" ticketsName = "tickets" tokensName = "tokens" accountName = "account" + accountSettingsName = "accountsettings" eventsName = "events" invoicesName = "invoices" invoiceItemsName = "invoiceitems" @@ -45,7 +48,7 @@ const ( managedName = "managed" tagsName = "tags" usersName = "users" - // notificationsName = "notifications" + paymentsName = "payments" stackscriptsEndpoint = "linode/stackscripts" imagesEndpoint = "images" @@ -55,6 +58,7 @@ const ( instanceSnapshotsEndpoint = "linode/instances/{{ .ID }}/backups" instanceIPsEndpoint = "linode/instances/{{ .ID }}/ips" instanceVolumesEndpoint = "linode/instances/{{ .ID }}/volumes" + instanceStatsEndpoint = "linode/instances/{{ .ID }}/stats" ipaddressesEndpoint = "networking/ips" ipv6poolsEndpoint = "networking/ipv6/pools" ipv6rangesEndpoint = "networking/ipv6/ranges" @@ -78,6 +82,7 @@ const ( ticketsEndpoint = "support/tickets" tokensEndpoint = "profile/tokens" accountEndpoint = "account" + accountSettingsEndpoint = "account/settings" eventsEndpoint = "account/events" invoicesEndpoint = "account/invoices" invoiceItemsEndpoint = "account/invoices/{{ .ID }}/items" @@ -86,6 +91,8 @@ const ( tagsEndpoint = "tags" usersEndpoint = "account/users" notificationsEndpoint = "account/notifications" + oauthClientsEndpoint = "account/oauth-clients" + paymentsEndpoint = "account/payments" ) // Resource represents a linode API resource @@ -125,14 +132,15 @@ func (r Resource) render(data ...interface{}) (string, error) { buf := bytes.NewBufferString(out) var substitutions interface{} - if len(data) == 1 { + switch len(data) { + case 1: substitutions = struct{ ID interface{} }{data[0]} - } else if len(data) == 2 { + case 2: substitutions = struct { ID interface{} SecondID interface{} }{data[0], data[1]} - } else { + default: return "", NewError("Too many arguments to render template (expected 1 or 2)") } if err := r.endpointTemplate.Execute(buf, substitutions); err != nil { diff --git a/vendor/github.com/linode/linodego/stackscripts.go b/vendor/github.com/linode/linodego/stackscripts.go index daf339b2..e6c2d82f 100644 --- a/vendor/github.com/linode/linodego/stackscripts.go +++ b/vendor/github.com/linode/linodego/stackscripts.go @@ -16,6 +16,8 @@ type Stackscript struct { Username string `json:"username"` Label string `json:"label"` Description string `json:"description"` + Ordinal int `json:"ordinal"` + LogoURL string `json:"logo_url"` Images []string `json:"images"` DeploymentsTotal int `json:"deployments_total"` DeploymentsActive int `json:"deployments_active"` diff --git a/vendor/github.com/linode/linodego/tags.go b/vendor/github.com/linode/linodego/tags.go index 2cb44272..be66774e 100644 --- a/vendor/github.com/linode/linodego/tags.go +++ b/vendor/github.com/linode/linodego/tags.go @@ -155,25 +155,25 @@ func (t TaggedObjectList) SortedObjects() (SortedObjects, error) { if instance, ok := o.Data.(Instance); ok { so.Instances = append(so.Instances, instance) } else { - return so, errors.New("Expected an Instance when Type was \"linode\"") + return so, errors.New("expected an Instance when Type was \"linode\"") } case "domain": if domain, ok := o.Data.(Domain); ok { so.Domains = append(so.Domains, domain) } else { - return so, errors.New("Expected a Domain when Type was \"domain\"") + return so, errors.New("expected a Domain when Type was \"domain\"") } case "volume": if volume, ok := o.Data.(Volume); ok { so.Volumes = append(so.Volumes, volume) } else { - return so, errors.New("Expected an Volume when Type was \"volume\"") + return so, errors.New("expected an Volume when Type was \"volume\"") } case "nodebalancer": if nodebalancer, ok := o.Data.(NodeBalancer); ok { so.NodeBalancers = append(so.NodeBalancers, nodebalancer) } else { - return so, errors.New("Expected an NodeBalancer when Type was \"nodebalancer\"") + return so, errors.New("expected an NodeBalancer when Type was \"nodebalancer\"") } } } diff --git a/vendor/github.com/linode/linodego/volumes.go b/vendor/github.com/linode/linodego/volumes.go index 0a528b54..603f3d2f 100644 --- a/vendor/github.com/linode/linodego/volumes.go +++ b/vendor/github.com/linode/linodego/volumes.go @@ -50,7 +50,8 @@ type VolumeCreateOptions struct { // The Volume's size, in GiB. Minimum size is 10GiB, maximum size is 10240GiB. A "0" value will result in the default size. Size int `json:"size,omitempty"` // An array of tags applied to this object. Tags are for organizational purposes only. - Tags []string `json:"tags"` + Tags []string `json:"tags"` + PersistAcrossBoots *bool `json:"persist_across_boots,omitempty"` } // VolumeUpdateOptions fields are those accepted by UpdateVolume @@ -61,8 +62,9 @@ type VolumeUpdateOptions struct { // VolumeAttachOptions fields are those accepted by AttachVolume type VolumeAttachOptions struct { - LinodeID int `json:"linode_id"` - ConfigID int `json:"config_id,omitempty"` + LinodeID int `json:"linode_id"` + ConfigID int `json:"config_id,omitempty"` + PersistAcrossBoots *bool `json:"persist_across_boots,omitempty"` } // VolumesPagedResponse represents a linode API response for listing of volumes diff --git a/vendor/github.com/linode/linodego/waitfor.go b/vendor/github.com/linode/linodego/waitfor.go index 8f29a415..b34ea3d7 100644 --- a/vendor/github.com/linode/linodego/waitfor.go +++ b/vendor/github.com/linode/linodego/waitfor.go @@ -54,6 +54,7 @@ func (client Client) WaitForInstanceDiskStatus(ctx context.Context, instanceID i return nil, err } for _, disk := range disks { + disk := disk if disk.ID == diskID { complete := (disk.Status == status) if complete { @@ -139,11 +140,12 @@ func (client Client) WaitForVolumeLinodeID(ctx context.Context, volumeID int, li return volume, err } - if linodeID == nil && volume.LinodeID == nil { + switch { + case linodeID == nil && volume.LinodeID == nil: return volume, nil - } else if linodeID == nil || volume.LinodeID == nil { + case linodeID == nil || volume.LinodeID == nil: // continue waiting - } else if *volume.LinodeID == *linodeID { + case *volume.LinodeID == *linodeID: return volume, nil } @@ -158,15 +160,7 @@ func (client Client) WaitForVolumeLinodeID(ctx context.Context, volumeID int, li // If the event indicates a failure both the failed event and the error will be returned. func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, entityType EntityType, action EventAction, minStart time.Time, timeoutSeconds int) (*Event, error) { titledEntityType := strings.Title(string(entityType)) - filter, _ := json.Marshal(map[string]interface{}{ - // Entity is not filtered by the API - // Perhaps one day they will permit Entity ID/Type filtering. - // We'll have to verify these values manually, for now. - //"entity": map[string]interface{}{ - // "id": fmt.Sprintf("%v", id), - // "type": entityType, - //}, - + filterStruct := map[string]interface{}{ // Nor is action //"action": action, @@ -177,16 +171,33 @@ func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, e //}, // With potentially 1000+ events coming back, we should filter on something + // Warning: This optimization has the potential to break if users are clearing + // events before we see them. "seen": false, // Float the latest events to page 1 "+order_by": "created", "+order": "desc", - }) + } // Optimistically restrict results to page 1. We should remove this when more // precise filtering options exist. - listOptions := NewListOptions(1, string(filter)) + pages := 1 + + // The API has limitted filtering support for Event ID and Event Type + // Optimize the list, if possible + switch entityType { + case EntityDisk, EntityLinode, EntityDomain, EntityNodebalancer: + // All of the filter supported types have int ids + filterableEntityID, err := strconv.Atoi(fmt.Sprintf("%v", id)) + if err != nil { + return nil, fmt.Errorf("Error parsing Entity ID %q for optimized WaitForEventFinished EventType %q: %s", id, entityType, err) + } + filterStruct["entity.id"] = filterableEntityID + filterStruct["entity.type"] = entityType + + // TODO: are we conformatable with pages = 0 with the event type and id filter? + } ctx, cancel := context.WithTimeout(ctx, time.Duration(timeoutSeconds)*time.Second) defer cancel() @@ -197,10 +208,27 @@ func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, e } ticker := time.NewTicker(client.millisecondsPerPoll * time.Millisecond) + + // avoid repeating log messages + nextLog := "" + lastLog := "" + lastEventID := 0 + defer ticker.Stop() for { select { case <-ticker.C: + if lastEventID > 0 { + filterStruct["id"] = map[string]interface{}{ + "+gte": lastEventID, + } + } + + filter, err := json.Marshal(filterStruct) + if err != nil { + return nil, err + } + listOptions := NewListOptions(pages, string(filter)) events, err := client.ListEvents(ctx, listOptions) if err != nil { @@ -209,6 +237,8 @@ func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, e // If there are events for this instance + action, inspect them for _, event := range events { + event := event + if event.Action != action { // log.Println("action mismatch", event.Action, action) continue @@ -220,21 +250,21 @@ func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, e var entID string - switch event.Entity.ID.(type) { + switch id := event.Entity.ID.(type) { case float64, float32: - entID = fmt.Sprintf("%.f", event.Entity.ID) + entID = fmt.Sprintf("%.f", id) case int: - entID = strconv.Itoa(event.Entity.ID.(int)) + entID = strconv.Itoa(id) default: - entID = fmt.Sprintf("%v", event.Entity.ID) + entID = fmt.Sprintf("%v", id) } var findID string - switch id.(type) { + switch id := id.(type) { case float64, float32: findID = fmt.Sprintf("%.f", id) case int: - findID = strconv.Itoa(id.(int)) + findID = strconv.Itoa(id) default: findID = fmt.Sprintf("%v", id) } @@ -252,19 +282,28 @@ func (client Client) WaitForEventFinished(ctx context.Context, id interface{}, e // Not the event we were looking for // log.Println(event.Created, "is not >=", minStart) continue - } - if event.Status == EventFailed { + // This is the event we are looking for. Save our place. + if lastEventID == 0 { + lastEventID = event.ID + } + + switch event.Status { + case EventFailed: return &event, fmt.Errorf("%s %v action %s failed", titledEntityType, id, action) - } else if event.Status == EventScheduled { - log.Printf("[INFO] %s %v action %s is scheduled", titledEntityType, id, action) - } else if event.Status == EventFinished { + case EventFinished: log.Printf("[INFO] %s %v action %s is finished", titledEntityType, id, action) return &event, nil } // TODO(displague) can we bump the ticker to TimeRemaining/2 (>=1) when non-nil? - log.Printf("[INFO] %s %v action %s is %s", titledEntityType, id, action, event.Status) + nextLog = fmt.Sprintf("[INFO] %s %v action %s is %s", titledEntityType, id, action, event.Status) + } + + // de-dupe logging statements + if nextLog != lastLog { + log.Print(nextLog) + lastLog = nextLog } case <-ctx.Done(): return nil, fmt.Errorf("Error waiting for Event Status '%s' of %s %v action '%s': %s", EventFinished, titledEntityType, id, action, ctx.Err()) diff --git a/vendor/github.com/miekg/dns/acceptfunc.go b/vendor/github.com/miekg/dns/acceptfunc.go index 78c076c2..c6920f79 100644 --- a/vendor/github.com/miekg/dns/acceptfunc.go +++ b/vendor/github.com/miekg/dns/acceptfunc.go @@ -19,9 +19,10 @@ var DefaultMsgAcceptFunc MsgAcceptFunc = defaultMsgAcceptFunc type MsgAcceptAction int const ( - MsgAccept MsgAcceptAction = iota // Accept the message - MsgReject // Reject the message with a RcodeFormatError - MsgIgnore // Ignore the error and send nothing back. + MsgAccept MsgAcceptAction = iota // Accept the message + MsgReject // Reject the message with a RcodeFormatError + MsgIgnore // Ignore the error and send nothing back. + MsgRejectNotImplemented // Reject the message with a RcodeNotImplemented ) func defaultMsgAcceptFunc(dh Header) MsgAcceptAction { @@ -32,12 +33,9 @@ func defaultMsgAcceptFunc(dh Header) MsgAcceptAction { // Don't allow dynamic updates, because then the sections can contain a whole bunch of RRs. opcode := int(dh.Bits>>11) & 0xF if opcode != OpcodeQuery && opcode != OpcodeNotify { - return MsgReject + return MsgRejectNotImplemented } - if isZero := dh.Bits&_Z != 0; isZero { - return MsgReject - } if dh.Qdcount != 1 { return MsgReject } diff --git a/vendor/github.com/miekg/dns/client.go b/vendor/github.com/miekg/dns/client.go index b14c8d90..db2761d4 100644 --- a/vendor/github.com/miekg/dns/client.go +++ b/vendor/github.com/miekg/dns/client.go @@ -215,8 +215,15 @@ func (co *Conn) ReadMsgHeader(hdr *Header) ([]byte, error) { n int err error ) - switch co.Conn.(type) { - case *net.TCPConn, *tls.Conn: + + if _, ok := co.Conn.(net.PacketConn); ok { + if co.UDPSize > MinMsgSize { + p = make([]byte, co.UDPSize) + } else { + p = make([]byte, MinMsgSize) + } + n, err = co.Read(p) + } else { var length uint16 if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil { return nil, err @@ -224,13 +231,6 @@ func (co *Conn) ReadMsgHeader(hdr *Header) ([]byte, error) { p = make([]byte, length) n, err = io.ReadFull(co.Conn, p) - default: - if co.UDPSize > MinMsgSize { - p = make([]byte, co.UDPSize) - } else { - p = make([]byte, MinMsgSize) - } - n, err = co.Read(p) } if err != nil { @@ -256,21 +256,20 @@ func (co *Conn) Read(p []byte) (n int, err error) { return 0, ErrConnEmpty } - switch co.Conn.(type) { - case *net.TCPConn, *tls.Conn: - var length uint16 - if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil { - return 0, err - } - if int(length) > len(p) { - return 0, io.ErrShortBuffer - } - - return io.ReadFull(co.Conn, p[:length]) + if _, ok := co.Conn.(net.PacketConn); ok { + // UDP connection + return co.Conn.Read(p) } - // UDP connection - return co.Conn.Read(p) + var length uint16 + if err := binary.Read(co.Conn, binary.BigEndian, &length); err != nil { + return 0, err + } + if int(length) > len(p) { + return 0, io.ErrShortBuffer + } + + return io.ReadFull(co.Conn, p[:length]) } // WriteMsg sends a message through the connection co. @@ -297,21 +296,20 @@ func (co *Conn) WriteMsg(m *Msg) (err error) { } // Write implements the net.Conn Write method. -func (co *Conn) Write(p []byte) (n int, err error) { - switch co.Conn.(type) { - case *net.TCPConn, *tls.Conn: - if len(p) > MaxMsgSize { - return 0, &Error{err: "message too large"} - } - - l := make([]byte, 2) - binary.BigEndian.PutUint16(l, uint16(len(p))) - - n, err := (&net.Buffers{l, p}).WriteTo(co.Conn) - return int(n), err +func (co *Conn) Write(p []byte) (int, error) { + if len(p) > MaxMsgSize { + return 0, &Error{err: "message too large"} } - return co.Conn.Write(p) + if _, ok := co.Conn.(net.PacketConn); ok { + return co.Conn.Write(p) + } + + l := make([]byte, 2) + binary.BigEndian.PutUint16(l, uint16(len(p))) + + n, err := (&net.Buffers{l, p}).WriteTo(co.Conn) + return int(n), err } // Return the appropriate timeout for a specific request diff --git a/vendor/github.com/miekg/dns/dns.go b/vendor/github.com/miekg/dns/dns.go index f57337b8..ad83a27e 100644 --- a/vendor/github.com/miekg/dns/dns.go +++ b/vendor/github.com/miekg/dns/dns.go @@ -54,7 +54,7 @@ type RR interface { // parse parses an RR from zone file format. // // This will only be called on a new and empty RR type with only the header populated. - parse(c *zlexer, origin, file string) *ParseError + parse(c *zlexer, origin string) *ParseError // isDuplicate returns whether the two RRs are duplicates. isDuplicate(r2 RR) bool @@ -105,7 +105,7 @@ func (h *RR_Header) unpack(msg []byte, off int) (int, error) { panic("dns: internal error: unpack should never be called on RR_Header") } -func (h *RR_Header) parse(c *zlexer, origin, file string) *ParseError { +func (h *RR_Header) parse(c *zlexer, origin string) *ParseError { panic("dns: internal error: parse should never be called on RR_Header") } diff --git a/vendor/github.com/miekg/dns/dnssec.go b/vendor/github.com/miekg/dns/dnssec.go index faf1dc65..12a693f9 100644 --- a/vendor/github.com/miekg/dns/dnssec.go +++ b/vendor/github.com/miekg/dns/dnssec.go @@ -141,8 +141,8 @@ func (k *DNSKEY) KeyTag() uint16 { switch k.Algorithm { case RSAMD5: // Look at the bottom two bytes of the modules, which the last - // item in the pubkey. We could do this faster by looking directly - // at the base64 values. But I'm lazy. + // item in the pubkey. + // This algorithm has been deprecated, but keep this key-tag calculation. modulus, _ := fromBase64([]byte(k.PublicKey)) if len(modulus) > 1 { x := binary.BigEndian.Uint16(modulus[len(modulus)-2:]) @@ -318,6 +318,9 @@ func (rr *RRSIG) Sign(k crypto.Signer, rrset []RR) error { } rr.Signature = toBase64(signature) + case RSAMD5, DSA, DSANSEC3SHA1: + // See RFC 6944. + return ErrAlg default: h := hash.New() h.Write(signdata) diff --git a/vendor/github.com/miekg/dns/dnssec_keygen.go b/vendor/github.com/miekg/dns/dnssec_keygen.go index 33e913ac..60737e5b 100644 --- a/vendor/github.com/miekg/dns/dnssec_keygen.go +++ b/vendor/github.com/miekg/dns/dnssec_keygen.go @@ -2,7 +2,6 @@ package dns import ( "crypto" - "crypto/dsa" "crypto/ecdsa" "crypto/elliptic" "crypto/rand" @@ -20,11 +19,9 @@ import ( // bits should be set to the size of the algorithm. func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) { switch k.Algorithm { - case DSA, DSANSEC3SHA1: - if bits != 1024 { - return nil, ErrKeySize - } - case RSAMD5, RSASHA1, RSASHA256, RSASHA1NSEC3SHA1: + case RSAMD5, DSA, DSANSEC3SHA1: + return nil, ErrAlg + case RSASHA1, RSASHA256, RSASHA1NSEC3SHA1: if bits < 512 || bits > 4096 { return nil, ErrKeySize } @@ -47,20 +44,7 @@ func (k *DNSKEY) Generate(bits int) (crypto.PrivateKey, error) { } switch k.Algorithm { - case DSA, DSANSEC3SHA1: - params := new(dsa.Parameters) - if err := dsa.GenerateParameters(params, rand.Reader, dsa.L1024N160); err != nil { - return nil, err - } - priv := new(dsa.PrivateKey) - priv.PublicKey.Parameters = *params - err := dsa.GenerateKey(priv, rand.Reader) - if err != nil { - return nil, err - } - k.setPublicKeyDSA(params.Q, params.P, params.G, priv.PublicKey.Y) - return priv, nil - case RSAMD5, RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1: + case RSASHA1, RSASHA256, RSASHA512, RSASHA1NSEC3SHA1: priv, err := rsa.GenerateKey(rand.Reader, bits) if err != nil { return nil, err @@ -120,16 +104,6 @@ func (k *DNSKEY) setPublicKeyECDSA(_X, _Y *big.Int) bool { return true } -// Set the public key for DSA -func (k *DNSKEY) setPublicKeyDSA(_Q, _P, _G, _Y *big.Int) bool { - if _Q == nil || _P == nil || _G == nil || _Y == nil { - return false - } - buf := dsaToBuf(_Q, _P, _G, _Y) - k.PublicKey = toBase64(buf) - return true -} - // Set the public key for Ed25519 func (k *DNSKEY) setPublicKeyED25519(_K ed25519.PublicKey) bool { if _K == nil { @@ -164,15 +138,3 @@ func curveToBuf(_X, _Y *big.Int, intlen int) []byte { buf = append(buf, intToBytes(_Y, intlen)...) return buf } - -// Set the public key for X and Y for Curve. The two -// values are just concatenated. -func dsaToBuf(_Q, _P, _G, _Y *big.Int) []byte { - t := divRoundUp(divRoundUp(_G.BitLen(), 8)-64, 8) - buf := []byte{byte(t)} - buf = append(buf, intToBytes(_Q, 20)...) - buf = append(buf, intToBytes(_P, 64+t*8)...) - buf = append(buf, intToBytes(_G, 64+t*8)...) - buf = append(buf, intToBytes(_Y, 64+t*8)...) - return buf -} diff --git a/vendor/github.com/miekg/dns/dnssec_keyscan.go b/vendor/github.com/miekg/dns/dnssec_keyscan.go index e9dd6957..0e6f3201 100644 --- a/vendor/github.com/miekg/dns/dnssec_keyscan.go +++ b/vendor/github.com/miekg/dns/dnssec_keyscan.go @@ -3,7 +3,6 @@ package dns import ( "bufio" "crypto" - "crypto/dsa" "crypto/ecdsa" "crypto/rsa" "io" @@ -44,19 +43,8 @@ func (k *DNSKEY) ReadPrivateKey(q io.Reader, file string) (crypto.PrivateKey, er return nil, ErrPrivKey } switch uint8(algo) { - case DSA: - priv, err := readPrivateKeyDSA(m) - if err != nil { - return nil, err - } - pub := k.publicKeyDSA() - if pub == nil { - return nil, ErrKey - } - priv.PublicKey = *pub - return priv, nil - case RSAMD5: - fallthrough + case RSAMD5, DSA, DSANSEC3SHA1: + return nil, ErrAlg case RSASHA1: fallthrough case RSASHA1NSEC3SHA1: @@ -129,24 +117,6 @@ func readPrivateKeyRSA(m map[string]string) (*rsa.PrivateKey, error) { return p, nil } -func readPrivateKeyDSA(m map[string]string) (*dsa.PrivateKey, error) { - p := new(dsa.PrivateKey) - p.X = new(big.Int) - for k, v := range m { - switch k { - case "private_value(x)": - v1, err := fromBase64([]byte(v)) - if err != nil { - return nil, err - } - p.X.SetBytes(v1) - case "created", "publish", "activate": - /* not used in Go (yet) */ - } - } - return p, nil -} - func readPrivateKeyECDSA(m map[string]string) (*ecdsa.PrivateKey, error) { p := new(ecdsa.PrivateKey) p.D = new(big.Int) diff --git a/vendor/github.com/miekg/dns/edns.go b/vendor/github.com/miekg/dns/edns.go index ca8873e1..8cdbfb0b 100644 --- a/vendor/github.com/miekg/dns/edns.go +++ b/vendor/github.com/miekg/dns/edns.go @@ -88,7 +88,7 @@ func (rr *OPT) len(off int, compression map[string]struct{}) int { return l } -func (rr *OPT) parse(c *zlexer, origin, file string) *ParseError { +func (rr *OPT) parse(c *zlexer, origin string) *ParseError { panic("dns: internal error: parse should never be called on OPT") } diff --git a/vendor/github.com/miekg/dns/msg_helpers.go b/vendor/github.com/miekg/dns/msg_helpers.go index ecd9280f..cb4ae764 100644 --- a/vendor/github.com/miekg/dns/msg_helpers.go +++ b/vendor/github.com/miekg/dns/msg_helpers.go @@ -495,7 +495,7 @@ Option: func packDataOpt(options []EDNS0, msg []byte, off int) (int, error) { for _, el := range options { b, err := el.pack() - if err != nil || off+3 > len(msg) { + if err != nil || off+4 > len(msg) { return len(msg), &Error{err: "overflow packing opt"} } binary.BigEndian.PutUint16(msg[off:], el.Option()) // Option code @@ -587,6 +587,29 @@ func unpackDataNsec(msg []byte, off int) ([]uint16, int, error) { return nsec, off, nil } +// typeBitMapLen is a helper function which computes the "maximum" length of +// a the NSEC Type BitMap field. +func typeBitMapLen(bitmap []uint16) int { + var l int + var lastwindow, lastlength uint16 + for _, t := range bitmap { + window := t / 256 + length := (t-window*256)/8 + 1 + if window > lastwindow && lastlength != 0 { // New window, jump to the new offset + l += int(lastlength) + 2 + lastlength = 0 + } + if window < lastwindow || length < lastlength { + // packDataNsec would return Error{err: "nsec bits out of order"} here, but + // when computing the length, we want do be liberal. + continue + } + lastwindow, lastlength = window, length + } + l += int(lastlength) + 2 + return l +} + func packDataNsec(bitmap []uint16, msg []byte, off int) (int, error) { if len(bitmap) == 0 { return off, nil diff --git a/vendor/github.com/miekg/dns/msg_truncate.go b/vendor/github.com/miekg/dns/msg_truncate.go index 4763fc61..89d40757 100644 --- a/vendor/github.com/miekg/dns/msg_truncate.go +++ b/vendor/github.com/miekg/dns/msg_truncate.go @@ -4,12 +4,17 @@ package dns // size by removing records that exceed the requested size. // // It will first check if the reply fits without compression and then with -// compression. If it won't fit with compression, Scrub then walks the +// compression. If it won't fit with compression, Truncate then walks the // record adding as many records as possible without exceeding the // requested buffer size. // -// The TC bit will be set if any answer records were excluded from the -// message. This indicates to that the client should retry over TCP. +// The TC bit will be set if any records were excluded from the message. +// This indicates to that the client should retry over TCP. +// +// According to RFC 2181, the TC bit should only be set if not all of the +// "required" RRs can be included in the response. Unfortunately, we have +// no way of knowing which RRs are required so we set the TC bit if any RR +// had to be omitted from the response. // // The appropriate buffer size can be retrieved from the requests OPT // record, if present, and is transport specific otherwise. dns.MinMsgSize @@ -71,9 +76,9 @@ func (dns *Msg) Truncate(size int) { l, numExtra = truncateLoop(dns.Extra, size, l, compression) } - // According to RFC 2181, the TC bit should only be set if not all - // of the answer RRs can be included in the response. - dns.Truncated = len(dns.Answer) > numAnswer + // See the function documentation for when we set this. + dns.Truncated = len(dns.Answer) > numAnswer || + len(dns.Ns) > numNS || len(dns.Extra) > numExtra dns.Answer = dns.Answer[:numAnswer] dns.Ns = dns.Ns[:numNS] diff --git a/vendor/github.com/miekg/dns/privaterr.go b/vendor/github.com/miekg/dns/privaterr.go index d9c0d267..e28f0663 100644 --- a/vendor/github.com/miekg/dns/privaterr.go +++ b/vendor/github.com/miekg/dns/privaterr.go @@ -1,9 +1,6 @@ package dns -import ( - "fmt" - "strings" -) +import "strings" // PrivateRdata is an interface used for implementing "Private Use" RR types, see // RFC 6895. This allows one to experiment with new RR types, without requesting an @@ -18,7 +15,7 @@ type PrivateRdata interface { // Unpack is used when unpacking a private RR from a buffer. // TODO(miek): diff. signature than Pack, see edns0.go for instance. Unpack([]byte) (int, error) - // Copy copies the Rdata. + // Copy copies the Rdata into the PrivateRdata argument. Copy(PrivateRdata) error // Len returns the length in octets of the Rdata. Len() int @@ -29,22 +26,8 @@ type PrivateRdata interface { type PrivateRR struct { Hdr RR_Header Data PrivateRdata -} -func mkPrivateRR(rrtype uint16) *PrivateRR { - // Panics if RR is not an instance of PrivateRR. - rrfunc, ok := TypeToRR[rrtype] - if !ok { - panic(fmt.Sprintf("dns: invalid operation with Private RR type %d", rrtype)) - } - - anyrr := rrfunc() - rr, ok := anyrr.(*PrivateRR) - if !ok { - panic(fmt.Sprintf("dns: RR is not a PrivateRR, TypeToRR[%d] generator returned %T", rrtype, anyrr)) - } - - return rr + generator func() PrivateRdata // for copy } // Header return the RR header of r. @@ -61,13 +44,12 @@ func (r *PrivateRR) len(off int, compression map[string]struct{}) int { func (r *PrivateRR) copy() RR { // make new RR like this: - rr := mkPrivateRR(r.Hdr.Rrtype) - rr.Hdr = r.Hdr + rr := &PrivateRR{r.Hdr, r.generator(), r.generator} - err := r.Data.Copy(rr.Data) - if err != nil { - panic("dns: got value that could not be used to copy Private rdata") + if err := r.Data.Copy(rr.Data); err != nil { + panic("dns: got value that could not be used to copy Private rdata: " + err.Error()) } + return rr } @@ -86,7 +68,7 @@ func (r *PrivateRR) unpack(msg []byte, off int) (int, error) { return off, err } -func (r *PrivateRR) parse(c *zlexer, origin, file string) *ParseError { +func (r *PrivateRR) parse(c *zlexer, origin string) *ParseError { var l lex text := make([]string, 0, 2) // could be 0..N elements, median is probably 1 Fetch: @@ -103,7 +85,7 @@ Fetch: err := r.Data.Parse(text) if err != nil { - return &ParseError{file, err.Error(), l} + return &ParseError{"", err.Error(), l} } return nil @@ -116,7 +98,7 @@ func (r1 *PrivateRR) isDuplicate(r2 RR) bool { return false } func PrivateHandle(rtypestr string, rtype uint16, generator func() PrivateRdata) { rtypestr = strings.ToUpper(rtypestr) - TypeToRR[rtype] = func() RR { return &PrivateRR{RR_Header{}, generator()} } + TypeToRR[rtype] = func() RR { return &PrivateRR{RR_Header{}, generator(), generator} } TypeToString[rtype] = rtypestr StringToType[rtypestr] = rtype } diff --git a/vendor/github.com/miekg/dns/scan.go b/vendor/github.com/miekg/dns/scan.go index a8691bca..7da14c88 100644 --- a/vendor/github.com/miekg/dns/scan.go +++ b/vendor/github.com/miekg/dns/scan.go @@ -503,9 +503,8 @@ func (zp *ZoneParser) Next() (RR, bool) { return zp.setParseError("expecting $TTL value, not this...", l) } - if e := slurpRemainder(zp.c, zp.file); e != nil { - zp.parseErr = e - return nil, false + if err := slurpRemainder(zp.c); err != nil { + return zp.setParseError(err.err, err.lex) } ttl, ok := stringToTTL(l.token) @@ -527,9 +526,8 @@ func (zp *ZoneParser) Next() (RR, bool) { return zp.setParseError("expecting $ORIGIN value, not this...", l) } - if e := slurpRemainder(zp.c, zp.file); e != nil { - zp.parseErr = e - return nil, false + if err := slurpRemainder(zp.c); err != nil { + return zp.setParseError(err.err, err.lex) } name, ok := toAbsoluteName(l.token, zp.origin) @@ -650,19 +648,44 @@ func (zp *ZoneParser) Next() (RR, bool) { st = zExpectRdata case zExpectRdata: - r, e := setRR(*h, zp.c, zp.origin, zp.file) - if e != nil { - // If e.lex is nil than we have encounter a unknown RR type - // in that case we substitute our current lex token - if e.lex.token == "" && e.lex.value == 0 { - e.lex = l // Uh, dirty - } - - zp.parseErr = e - return nil, false + var rr RR + if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) { + rr = newFn() + *rr.Header() = *h + } else { + rr = &RFC3597{Hdr: *h} } - return r, true + _, isPrivate := rr.(*PrivateRR) + if !isPrivate && zp.c.Peek().token == "" { + // This is a dynamic update rr. + + // TODO(tmthrgd): Previously slurpRemainder was only called + // for certain RR types, which may have been important. + if err := slurpRemainder(zp.c); err != nil { + return zp.setParseError(err.err, err.lex) + } + + return rr, true + } else if l.value == zNewline { + return zp.setParseError("unexpected newline", l) + } + + if err := rr.parse(zp.c, zp.origin); err != nil { + // err is a concrete *ParseError without the file field set. + // The setParseError call below will construct a new + // *ParseError with file set to zp.file. + + // If err.lex is nil than we have encounter an unknown RR type + // in that case we substitute our current lex token. + if err.lex == (lex{}) { + return zp.setParseError(err.err, l) + } + + return zp.setParseError(err.err, err.lex) + } + + return rr, true } } @@ -671,6 +694,18 @@ func (zp *ZoneParser) Next() (RR, bool) { return nil, false } +// canParseAsRR returns true if the record type can be parsed as a +// concrete RR. It blacklists certain record types that must be parsed +// according to RFC 3597 because they lack a presentation format. +func canParseAsRR(rrtype uint16) bool { + switch rrtype { + case TypeANY, TypeNULL, TypeOPT, TypeTSIG: + return false + default: + return true + } +} + type zlexer struct { br io.ByteReader @@ -682,7 +717,8 @@ type zlexer struct { comBuf string comment string - l lex + l lex + cachedL *lex brace int quote bool @@ -748,13 +784,37 @@ func (zl *zlexer) readByte() (byte, bool) { return c, true } +func (zl *zlexer) Peek() lex { + if zl.nextL { + return zl.l + } + + l, ok := zl.Next() + if !ok { + return l + } + + if zl.nextL { + // Cache l. Next returns zl.cachedL then zl.l. + zl.cachedL = &l + } else { + // In this case l == zl.l, so we just tell Next to return zl.l. + zl.nextL = true + } + + return l +} + func (zl *zlexer) Next() (lex, bool) { l := &zl.l - if zl.nextL { + switch { + case zl.cachedL != nil: + l, zl.cachedL = zl.cachedL, nil + return *l, true + case zl.nextL: zl.nextL = false return *l, true - } - if l.err { + case l.err: // Parsing errors should be sticky. return lex{value: zEOF}, false } @@ -1302,18 +1362,18 @@ func locCheckEast(token string, longitude uint32) (uint32, bool) { } // "Eat" the rest of the "line" -func slurpRemainder(c *zlexer, f string) *ParseError { +func slurpRemainder(c *zlexer) *ParseError { l, _ := c.Next() switch l.value { case zBlank: l, _ = c.Next() if l.value != zNewline && l.value != zEOF { - return &ParseError{f, "garbage after rdata", l} + return &ParseError{"", "garbage after rdata", l} } case zNewline: case zEOF: default: - return &ParseError{f, "garbage after rdata", l} + return &ParseError{"", "garbage after rdata", l} } return nil } diff --git a/vendor/github.com/miekg/dns/scan_rr.go b/vendor/github.com/miekg/dns/scan_rr.go index 6096f9b0..93b24a69 100644 --- a/vendor/github.com/miekg/dns/scan_rr.go +++ b/vendor/github.com/miekg/dns/scan_rr.go @@ -7,55 +7,21 @@ import ( "strings" ) -// Parse the rdata of each rrtype. -// All data from the channel c is either zString or zBlank. -// After the rdata there may come a zBlank and then a zNewline -// or immediately a zNewline. If this is not the case we flag -// an *ParseError: garbage after rdata. -func setRR(h RR_Header, c *zlexer, o, f string) (RR, *ParseError) { - var rr RR - if newFn, ok := TypeToRR[h.Rrtype]; ok && canParseAsRR(h.Rrtype) { - rr = newFn() - *rr.Header() = h - } else { - rr = &RFC3597{Hdr: h} - } - - err := rr.parse(c, o, f) - if err != nil { - return nil, err - } - - return rr, nil -} - -// canParseAsRR returns true if the record type can be parsed as a -// concrete RR. It blacklists certain record types that must be parsed -// according to RFC 3597 because they lack a presentation format. -func canParseAsRR(rrtype uint16) bool { - switch rrtype { - case TypeANY, TypeNULL, TypeOPT, TypeTSIG: - return false - default: - return true - } -} - // A remainder of the rdata with embedded spaces, return the parsed string (sans the spaces) // or an error -func endingToString(c *zlexer, errstr, f string) (string, *ParseError) { +func endingToString(c *zlexer, errstr string) (string, *ParseError) { var s string l, _ := c.Next() // zString for l.value != zNewline && l.value != zEOF { if l.err { - return s, &ParseError{f, errstr, l} + return s, &ParseError{"", errstr, l} } switch l.value { case zString: s += l.token case zBlank: // Ok default: - return "", &ParseError{f, errstr, l} + return "", &ParseError{"", errstr, l} } l, _ = c.Next() } @@ -65,11 +31,11 @@ func endingToString(c *zlexer, errstr, f string) (string, *ParseError) { // A remainder of the rdata with embedded spaces, split on unquoted whitespace // and return the parsed string slice or an error -func endingToTxtSlice(c *zlexer, errstr, f string) ([]string, *ParseError) { +func endingToTxtSlice(c *zlexer, errstr string) ([]string, *ParseError) { // Get the remaining data until we see a zNewline l, _ := c.Next() if l.err { - return nil, &ParseError{f, errstr, l} + return nil, &ParseError{"", errstr, l} } // Build the slice @@ -78,7 +44,7 @@ func endingToTxtSlice(c *zlexer, errstr, f string) ([]string, *ParseError) { empty := false for l.value != zNewline && l.value != zEOF { if l.err { - return nil, &ParseError{f, errstr, l} + return nil, &ParseError{"", errstr, l} } switch l.value { case zString: @@ -105,7 +71,7 @@ func endingToTxtSlice(c *zlexer, errstr, f string) ([]string, *ParseError) { case zBlank: if quote { // zBlank can only be seen in between txt parts. - return nil, &ParseError{f, errstr, l} + return nil, &ParseError{"", errstr, l} } case zQuote: if empty && quote { @@ -114,24 +80,20 @@ func endingToTxtSlice(c *zlexer, errstr, f string) ([]string, *ParseError) { quote = !quote empty = true default: - return nil, &ParseError{f, errstr, l} + return nil, &ParseError{"", errstr, l} } l, _ = c.Next() } if quote { - return nil, &ParseError{f, errstr, l} + return nil, &ParseError{"", errstr, l} } return s, nil } -func (rr *A) parse(c *zlexer, o, f string) *ParseError { +func (rr *A) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - rr.A = net.ParseIP(l.token) // IPv4 addresses cannot include ":". // We do this rather than use net.IP's To4() because @@ -139,82 +101,58 @@ func (rr *A) parse(c *zlexer, o, f string) *ParseError { // IPv4. isIPv4 := !strings.Contains(l.token, ":") if rr.A == nil || !isIPv4 || l.err { - return &ParseError{f, "bad A A", l} + return &ParseError{"", "bad A A", l} } - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *AAAA) parse(c *zlexer, o, f string) *ParseError { +func (rr *AAAA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - rr.AAAA = net.ParseIP(l.token) // IPv6 addresses must include ":", and IPv4 // addresses cannot include ":". isIPv6 := strings.Contains(l.token, ":") if rr.AAAA == nil || !isIPv6 || l.err { - return &ParseError{f, "bad AAAA AAAA", l} + return &ParseError{"", "bad AAAA AAAA", l} } - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *NS) parse(c *zlexer, o, f string) *ParseError { +func (rr *NS) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Ns = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad NS Ns", l} + return &ParseError{"", "bad NS Ns", l} } rr.Ns = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *PTR) parse(c *zlexer, o, f string) *ParseError { +func (rr *PTR) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Ptr = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad PTR Ptr", l} + return &ParseError{"", "bad PTR Ptr", l} } rr.Ptr = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *NSAPPTR) parse(c *zlexer, o, f string) *ParseError { +func (rr *NSAPPTR) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Ptr = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad NSAP-PTR Ptr", l} + return &ParseError{"", "bad NSAP-PTR Ptr", l} } rr.Ptr = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *RP) parse(c *zlexer, o, f string) *ParseError { +func (rr *RP) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Mbox = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - mbox, mboxOk := toAbsoluteName(l.token, o) if l.err || !mboxOk { - return &ParseError{f, "bad RP Mbox", l} + return &ParseError{"", "bad RP Mbox", l} } rr.Mbox = mbox @@ -224,60 +162,45 @@ func (rr *RP) parse(c *zlexer, o, f string) *ParseError { txt, txtOk := toAbsoluteName(l.token, o) if l.err || !txtOk { - return &ParseError{f, "bad RP Txt", l} + return &ParseError{"", "bad RP Txt", l} } rr.Txt = txt - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MR) parse(c *zlexer, o, f string) *ParseError { +func (rr *MR) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Mr = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MR Mr", l} + return &ParseError{"", "bad MR Mr", l} } rr.Mr = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MB) parse(c *zlexer, o, f string) *ParseError { +func (rr *MB) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Mb = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MB Mb", l} + return &ParseError{"", "bad MB Mb", l} } rr.Mb = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MG) parse(c *zlexer, o, f string) *ParseError { +func (rr *MG) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Mg = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MG Mg", l} + return &ParseError{"", "bad MG Mg", l} } rr.Mg = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *HINFO) parse(c *zlexer, o, f string) *ParseError { - chunks, e := endingToTxtSlice(c, "bad HINFO Fields", f) +func (rr *HINFO) parse(c *zlexer, o string) *ParseError { + chunks, e := endingToTxtSlice(c, "bad HINFO Fields") if e != nil { return e } @@ -299,16 +222,11 @@ func (rr *HINFO) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *MINFO) parse(c *zlexer, o, f string) *ParseError { +func (rr *MINFO) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Rmail = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - rmail, rmailOk := toAbsoluteName(l.token, o) if l.err || !rmailOk { - return &ParseError{f, "bad MINFO Rmail", l} + return &ParseError{"", "bad MINFO Rmail", l} } rr.Rmail = rmail @@ -318,52 +236,38 @@ func (rr *MINFO) parse(c *zlexer, o, f string) *ParseError { email, emailOk := toAbsoluteName(l.token, o) if l.err || !emailOk { - return &ParseError{f, "bad MINFO Email", l} + return &ParseError{"", "bad MINFO Email", l} } rr.Email = email - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MF) parse(c *zlexer, o, f string) *ParseError { +func (rr *MF) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Mf = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MF Mf", l} + return &ParseError{"", "bad MF Mf", l} } rr.Mf = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MD) parse(c *zlexer, o, f string) *ParseError { +func (rr *MD) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Md = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MD Md", l} + return &ParseError{"", "bad MD Md", l} } rr.Md = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *MX) parse(c *zlexer, o, f string) *ParseError { +func (rr *MX) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad MX Pref", l} + return &ParseError{"", "bad MX Pref", l} } rr.Preference = uint16(i) @@ -373,22 +277,18 @@ func (rr *MX) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad MX Mx", l} + return &ParseError{"", "bad MX Mx", l} } rr.Mx = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *RT) parse(c *zlexer, o, f string) *ParseError { +func (rr *RT) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil { - return &ParseError{f, "bad RT Preference", l} + return &ParseError{"", "bad RT Preference", l} } rr.Preference = uint16(i) @@ -398,22 +298,18 @@ func (rr *RT) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad RT Host", l} + return &ParseError{"", "bad RT Host", l} } rr.Host = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *AFSDB) parse(c *zlexer, o, f string) *ParseError { +func (rr *AFSDB) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad AFSDB Subtype", l} + return &ParseError{"", "bad AFSDB Subtype", l} } rr.Subtype = uint16(i) @@ -423,34 +319,26 @@ func (rr *AFSDB) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad AFSDB Hostname", l} + return &ParseError{"", "bad AFSDB Hostname", l} } rr.Hostname = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *X25) parse(c *zlexer, o, f string) *ParseError { +func (rr *X25) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - if l.err { - return &ParseError{f, "bad X25 PSDNAddress", l} + return &ParseError{"", "bad X25 PSDNAddress", l} } rr.PSDNAddress = l.token - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *KX) parse(c *zlexer, o, f string) *ParseError { +func (rr *KX) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad KX Pref", l} + return &ParseError{"", "bad KX Pref", l} } rr.Preference = uint16(i) @@ -460,52 +348,37 @@ func (rr *KX) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad KX Exchanger", l} + return &ParseError{"", "bad KX Exchanger", l} } rr.Exchanger = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *CNAME) parse(c *zlexer, o, f string) *ParseError { +func (rr *CNAME) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Target = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad CNAME Target", l} + return &ParseError{"", "bad CNAME Target", l} } rr.Target = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *DNAME) parse(c *zlexer, o, f string) *ParseError { +func (rr *DNAME) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Target = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad DNAME Target", l} + return &ParseError{"", "bad DNAME Target", l} } rr.Target = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *SOA) parse(c *zlexer, o, f string) *ParseError { +func (rr *SOA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.Ns = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - ns, nsOk := toAbsoluteName(l.token, o) if l.err || !nsOk { - return &ParseError{f, "bad SOA Ns", l} + return &ParseError{"", "bad SOA Ns", l} } rr.Ns = ns @@ -515,7 +388,7 @@ func (rr *SOA) parse(c *zlexer, o, f string) *ParseError { mbox, mboxOk := toAbsoluteName(l.token, o) if l.err || !mboxOk { - return &ParseError{f, "bad SOA Mbox", l} + return &ParseError{"", "bad SOA Mbox", l} } rr.Mbox = mbox @@ -528,16 +401,16 @@ func (rr *SOA) parse(c *zlexer, o, f string) *ParseError { for i := 0; i < 5; i++ { l, _ = c.Next() if l.err { - return &ParseError{f, "bad SOA zone parameter", l} + return &ParseError{"", "bad SOA zone parameter", l} } if j, e := strconv.ParseUint(l.token, 10, 32); e != nil { if i == 0 { // Serial must be a number - return &ParseError{f, "bad SOA zone parameter", l} + return &ParseError{"", "bad SOA zone parameter", l} } // We allow other fields to be unitful duration strings if v, ok = stringToTTL(l.token); !ok { - return &ParseError{f, "bad SOA zone parameter", l} + return &ParseError{"", "bad SOA zone parameter", l} } } else { @@ -560,18 +433,14 @@ func (rr *SOA) parse(c *zlexer, o, f string) *ParseError { rr.Minttl = v } } - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *SRV) parse(c *zlexer, o, f string) *ParseError { +func (rr *SRV) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad SRV Priority", l} + return &ParseError{"", "bad SRV Priority", l} } rr.Priority = uint16(i) @@ -579,7 +448,7 @@ func (rr *SRV) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad SRV Weight", l} + return &ParseError{"", "bad SRV Weight", l} } rr.Weight = uint16(i) @@ -587,7 +456,7 @@ func (rr *SRV) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad SRV Port", l} + return &ParseError{"", "bad SRV Port", l} } rr.Port = uint16(i) @@ -597,21 +466,17 @@ func (rr *SRV) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad SRV Target", l} + return &ParseError{"", "bad SRV Target", l} } rr.Target = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *NAPTR) parse(c *zlexer, o, f string) *ParseError { +func (rr *NAPTR) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad NAPTR Order", l} + return &ParseError{"", "bad NAPTR Order", l} } rr.Order = uint16(i) @@ -619,7 +484,7 @@ func (rr *NAPTR) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad NAPTR Preference", l} + return &ParseError{"", "bad NAPTR Preference", l} } rr.Preference = uint16(i) @@ -627,57 +492,57 @@ func (rr *NAPTR) parse(c *zlexer, o, f string) *ParseError { c.Next() // zBlank l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Flags", l} + return &ParseError{"", "bad NAPTR Flags", l} } l, _ = c.Next() // Either String or Quote if l.value == zString { rr.Flags = l.token l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Flags", l} + return &ParseError{"", "bad NAPTR Flags", l} } } else if l.value == zQuote { rr.Flags = "" } else { - return &ParseError{f, "bad NAPTR Flags", l} + return &ParseError{"", "bad NAPTR Flags", l} } // Service c.Next() // zBlank l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Service", l} + return &ParseError{"", "bad NAPTR Service", l} } l, _ = c.Next() // Either String or Quote if l.value == zString { rr.Service = l.token l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Service", l} + return &ParseError{"", "bad NAPTR Service", l} } } else if l.value == zQuote { rr.Service = "" } else { - return &ParseError{f, "bad NAPTR Service", l} + return &ParseError{"", "bad NAPTR Service", l} } // Regexp c.Next() // zBlank l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Regexp", l} + return &ParseError{"", "bad NAPTR Regexp", l} } l, _ = c.Next() // Either String or Quote if l.value == zString { rr.Regexp = l.token l, _ = c.Next() // _QUOTE if l.value != zQuote { - return &ParseError{f, "bad NAPTR Regexp", l} + return &ParseError{"", "bad NAPTR Regexp", l} } } else if l.value == zQuote { rr.Regexp = "" } else { - return &ParseError{f, "bad NAPTR Regexp", l} + return &ParseError{"", "bad NAPTR Regexp", l} } // After quote no space?? @@ -687,22 +552,17 @@ func (rr *NAPTR) parse(c *zlexer, o, f string) *ParseError { name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad NAPTR Replacement", l} + return &ParseError{"", "bad NAPTR Replacement", l} } rr.Replacement = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *TALINK) parse(c *zlexer, o, f string) *ParseError { +func (rr *TALINK) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.PreviousName = l.token - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - previousName, previousNameOk := toAbsoluteName(l.token, o) if l.err || !previousNameOk { - return &ParseError{f, "bad TALINK PreviousName", l} + return &ParseError{"", "bad TALINK PreviousName", l} } rr.PreviousName = previousName @@ -712,14 +572,14 @@ func (rr *TALINK) parse(c *zlexer, o, f string) *ParseError { nextName, nextNameOk := toAbsoluteName(l.token, o) if l.err || !nextNameOk { - return &ParseError{f, "bad TALINK NextName", l} + return &ParseError{"", "bad TALINK NextName", l} } rr.NextName = nextName - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *LOC) parse(c *zlexer, o, f string) *ParseError { +func (rr *LOC) parse(c *zlexer, o string) *ParseError { // Non zero defaults for LOC record, see RFC 1876, Section 3. rr.HorizPre = 165 // 10000 rr.VertPre = 162 // 10 @@ -728,12 +588,9 @@ func (rr *LOC) parse(c *zlexer, o, f string) *ParseError { // North l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } i, e := strconv.ParseUint(l.token, 10, 32) if e != nil || l.err { - return &ParseError{f, "bad LOC Latitude", l} + return &ParseError{"", "bad LOC Latitude", l} } rr.Latitude = 1000 * 60 * 60 * uint32(i) @@ -745,14 +602,14 @@ func (rr *LOC) parse(c *zlexer, o, f string) *ParseError { } i, e = strconv.ParseUint(l.token, 10, 32) if e != nil || l.err { - return &ParseError{f, "bad LOC Latitude minutes", l} + return &ParseError{"", "bad LOC Latitude minutes", l} } rr.Latitude += 1000 * 60 * uint32(i) c.Next() // zBlank l, _ = c.Next() if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { - return &ParseError{f, "bad LOC Latitude seconds", l} + return &ParseError{"", "bad LOC Latitude seconds", l} } else { rr.Latitude += uint32(1000 * i) } @@ -763,14 +620,14 @@ func (rr *LOC) parse(c *zlexer, o, f string) *ParseError { goto East } // If still alive, flag an error - return &ParseError{f, "bad LOC Latitude North/South", l} + return &ParseError{"", "bad LOC Latitude North/South", l} East: // East c.Next() // zBlank l, _ = c.Next() if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err { - return &ParseError{f, "bad LOC Longitude", l} + return &ParseError{"", "bad LOC Longitude", l} } else { rr.Longitude = 1000 * 60 * 60 * uint32(i) } @@ -781,14 +638,14 @@ East: goto Altitude } if i, e := strconv.ParseUint(l.token, 10, 32); e != nil || l.err { - return &ParseError{f, "bad LOC Longitude minutes", l} + return &ParseError{"", "bad LOC Longitude minutes", l} } else { rr.Longitude += 1000 * 60 * uint32(i) } c.Next() // zBlank l, _ = c.Next() if i, e := strconv.ParseFloat(l.token, 32); e != nil || l.err { - return &ParseError{f, "bad LOC Longitude seconds", l} + return &ParseError{"", "bad LOC Longitude seconds", l} } else { rr.Longitude += uint32(1000 * i) } @@ -799,19 +656,19 @@ East: goto Altitude } // If still alive, flag an error - return &ParseError{f, "bad LOC Longitude East/West", l} + return &ParseError{"", "bad LOC Longitude East/West", l} Altitude: c.Next() // zBlank l, _ = c.Next() if len(l.token) == 0 || l.err { - return &ParseError{f, "bad LOC Altitude", l} + return &ParseError{"", "bad LOC Altitude", l} } if l.token[len(l.token)-1] == 'M' || l.token[len(l.token)-1] == 'm' { l.token = l.token[0 : len(l.token)-1] } if i, e := strconv.ParseFloat(l.token, 32); e != nil { - return &ParseError{f, "bad LOC Altitude", l} + return &ParseError{"", "bad LOC Altitude", l} } else { rr.Altitude = uint32(i*100.0 + 10000000.0 + 0.5) } @@ -826,19 +683,19 @@ Altitude: case 0: // Size e, m, ok := stringToCm(l.token) if !ok { - return &ParseError{f, "bad LOC Size", l} + return &ParseError{"", "bad LOC Size", l} } rr.Size = e&0x0f | m<<4&0xf0 case 1: // HorizPre e, m, ok := stringToCm(l.token) if !ok { - return &ParseError{f, "bad LOC HorizPre", l} + return &ParseError{"", "bad LOC HorizPre", l} } rr.HorizPre = e&0x0f | m<<4&0xf0 case 2: // VertPre e, m, ok := stringToCm(l.token) if !ok { - return &ParseError{f, "bad LOC VertPre", l} + return &ParseError{"", "bad LOC VertPre", l} } rr.VertPre = e&0x0f | m<<4&0xf0 } @@ -846,30 +703,26 @@ Altitude: case zBlank: // Ok default: - return &ParseError{f, "bad LOC Size, HorizPre or VertPre", l} + return &ParseError{"", "bad LOC Size, HorizPre or VertPre", l} } l, _ = c.Next() } return nil } -func (rr *HIP) parse(c *zlexer, o, f string) *ParseError { +func (rr *HIP) parse(c *zlexer, o string) *ParseError { // HitLength is not represented l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad HIP PublicKeyAlgorithm", l} + return &ParseError{"", "bad HIP PublicKeyAlgorithm", l} } rr.PublicKeyAlgorithm = uint8(i) c.Next() // zBlank l, _ = c.Next() // zString if len(l.token) == 0 || l.err { - return &ParseError{f, "bad HIP Hit", l} + return &ParseError{"", "bad HIP Hit", l} } rr.Hit = l.token // This can not contain spaces, see RFC 5205 Section 6. rr.HitLength = uint8(len(rr.Hit)) / 2 @@ -877,7 +730,7 @@ func (rr *HIP) parse(c *zlexer, o, f string) *ParseError { c.Next() // zBlank l, _ = c.Next() // zString if len(l.token) == 0 || l.err { - return &ParseError{f, "bad HIP PublicKey", l} + return &ParseError{"", "bad HIP PublicKey", l} } rr.PublicKey = l.token // This cannot contain spaces rr.PublicKeyLength = uint16(base64.StdEncoding.DecodedLen(len(rr.PublicKey))) @@ -890,13 +743,13 @@ func (rr *HIP) parse(c *zlexer, o, f string) *ParseError { case zString: name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad HIP RendezvousServers", l} + return &ParseError{"", "bad HIP RendezvousServers", l} } xs = append(xs, name) case zBlank: // Ok default: - return &ParseError{f, "bad HIP RendezvousServers", l} + return &ParseError{"", "bad HIP RendezvousServers", l} } l, _ = c.Next() } @@ -905,16 +758,12 @@ func (rr *HIP) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *CERT) parse(c *zlexer, o, f string) *ParseError { +func (rr *CERT) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - if v, ok := StringToCertType[l.token]; ok { rr.Type = v } else if i, e := strconv.ParseUint(l.token, 10, 16); e != nil { - return &ParseError{f, "bad CERT Type", l} + return &ParseError{"", "bad CERT Type", l} } else { rr.Type = uint16(i) } @@ -922,7 +771,7 @@ func (rr *CERT) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() // zString i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad CERT KeyTag", l} + return &ParseError{"", "bad CERT KeyTag", l} } rr.KeyTag = uint16(i) c.Next() // zBlank @@ -930,11 +779,11 @@ func (rr *CERT) parse(c *zlexer, o, f string) *ParseError { if v, ok := StringToAlgorithm[l.token]; ok { rr.Algorithm = v } else if i, e := strconv.ParseUint(l.token, 10, 8); e != nil { - return &ParseError{f, "bad CERT Algorithm", l} + return &ParseError{"", "bad CERT Algorithm", l} } else { rr.Algorithm = uint8(i) } - s, e1 := endingToString(c, "bad CERT Certificate", f) + s, e1 := endingToString(c, "bad CERT Certificate") if e1 != nil { return e1 } @@ -942,8 +791,8 @@ func (rr *CERT) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *OPENPGPKEY) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToString(c, "bad OPENPGPKEY PublicKey", f) +func (rr *OPENPGPKEY) parse(c *zlexer, o string) *ParseError { + s, e := endingToString(c, "bad OPENPGPKEY PublicKey") if e != nil { return e } @@ -951,15 +800,12 @@ func (rr *OPENPGPKEY) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *CSYNC) parse(c *zlexer, o, f string) *ParseError { +func (rr *CSYNC) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } j, e := strconv.ParseUint(l.token, 10, 32) if e != nil { // Serial must be a number - return &ParseError{f, "bad CSYNC serial", l} + return &ParseError{"", "bad CSYNC serial", l} } rr.Serial = uint32(j) @@ -969,7 +815,7 @@ func (rr *CSYNC) parse(c *zlexer, o, f string) *ParseError { j, e = strconv.ParseUint(l.token, 10, 16) if e != nil { // Serial must be a number - return &ParseError{f, "bad CSYNC flags", l} + return &ParseError{"", "bad CSYNC flags", l} } rr.Flags = uint16(j) @@ -987,38 +833,34 @@ func (rr *CSYNC) parse(c *zlexer, o, f string) *ParseError { tokenUpper := strings.ToUpper(l.token) if k, ok = StringToType[tokenUpper]; !ok { if k, ok = typeToInt(l.token); !ok { - return &ParseError{f, "bad CSYNC TypeBitMap", l} + return &ParseError{"", "bad CSYNC TypeBitMap", l} } } rr.TypeBitMap = append(rr.TypeBitMap, k) default: - return &ParseError{f, "bad CSYNC TypeBitMap", l} + return &ParseError{"", "bad CSYNC TypeBitMap", l} } l, _ = c.Next() } return nil } -func (rr *SIG) parse(c *zlexer, o, f string) *ParseError { - return rr.RRSIG.parse(c, o, f) +func (rr *SIG) parse(c *zlexer, o string) *ParseError { + return rr.RRSIG.parse(c, o) } -func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { +func (rr *RRSIG) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - tokenUpper := strings.ToUpper(l.token) if t, ok := StringToType[tokenUpper]; !ok { if strings.HasPrefix(tokenUpper, "TYPE") { t, ok = typeToInt(l.token) if !ok { - return &ParseError{f, "bad RRSIG Typecovered", l} + return &ParseError{"", "bad RRSIG Typecovered", l} } rr.TypeCovered = t } else { - return &ParseError{f, "bad RRSIG Typecovered", l} + return &ParseError{"", "bad RRSIG Typecovered", l} } } else { rr.TypeCovered = t @@ -1028,7 +870,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err := strconv.ParseUint(l.token, 10, 8) if err != nil || l.err { - return &ParseError{f, "bad RRSIG Algorithm", l} + return &ParseError{"", "bad RRSIG Algorithm", l} } rr.Algorithm = uint8(i) @@ -1036,7 +878,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err = strconv.ParseUint(l.token, 10, 8) if err != nil || l.err { - return &ParseError{f, "bad RRSIG Labels", l} + return &ParseError{"", "bad RRSIG Labels", l} } rr.Labels = uint8(i) @@ -1044,7 +886,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err = strconv.ParseUint(l.token, 10, 32) if err != nil || l.err { - return &ParseError{f, "bad RRSIG OrigTtl", l} + return &ParseError{"", "bad RRSIG OrigTtl", l} } rr.OrigTtl = uint32(i) @@ -1056,7 +898,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { // TODO(miek): error out on > MAX_UINT32, same below rr.Expiration = uint32(i) } else { - return &ParseError{f, "bad RRSIG Expiration", l} + return &ParseError{"", "bad RRSIG Expiration", l} } } else { rr.Expiration = i @@ -1068,7 +910,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { if i, err := strconv.ParseInt(l.token, 10, 64); err == nil { rr.Inception = uint32(i) } else { - return &ParseError{f, "bad RRSIG Inception", l} + return &ParseError{"", "bad RRSIG Inception", l} } } else { rr.Inception = i @@ -1078,7 +920,7 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err = strconv.ParseUint(l.token, 10, 16) if err != nil || l.err { - return &ParseError{f, "bad RRSIG KeyTag", l} + return &ParseError{"", "bad RRSIG KeyTag", l} } rr.KeyTag = uint16(i) @@ -1087,11 +929,11 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { rr.SignerName = l.token name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad RRSIG SignerName", l} + return &ParseError{"", "bad RRSIG SignerName", l} } rr.SignerName = name - s, e := endingToString(c, "bad RRSIG Signature", f) + s, e := endingToString(c, "bad RRSIG Signature") if e != nil { return e } @@ -1100,16 +942,11 @@ func (rr *RRSIG) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *NSEC) parse(c *zlexer, o, f string) *ParseError { +func (rr *NSEC) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - rr.NextDomain = l.token - if len(l.token) == 0 { // dynamic update rr. - return nil - } - name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad NSEC NextDomain", l} + return &ParseError{"", "bad NSEC NextDomain", l} } rr.NextDomain = name @@ -1127,47 +964,43 @@ func (rr *NSEC) parse(c *zlexer, o, f string) *ParseError { tokenUpper := strings.ToUpper(l.token) if k, ok = StringToType[tokenUpper]; !ok { if k, ok = typeToInt(l.token); !ok { - return &ParseError{f, "bad NSEC TypeBitMap", l} + return &ParseError{"", "bad NSEC TypeBitMap", l} } } rr.TypeBitMap = append(rr.TypeBitMap, k) default: - return &ParseError{f, "bad NSEC TypeBitMap", l} + return &ParseError{"", "bad NSEC TypeBitMap", l} } l, _ = c.Next() } return nil } -func (rr *NSEC3) parse(c *zlexer, o, f string) *ParseError { +func (rr *NSEC3) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad NSEC3 Hash", l} + return &ParseError{"", "bad NSEC3 Hash", l} } rr.Hash = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad NSEC3 Flags", l} + return &ParseError{"", "bad NSEC3 Flags", l} } rr.Flags = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad NSEC3 Iterations", l} + return &ParseError{"", "bad NSEC3 Iterations", l} } rr.Iterations = uint16(i) c.Next() l, _ = c.Next() if len(l.token) == 0 || l.err { - return &ParseError{f, "bad NSEC3 Salt", l} + return &ParseError{"", "bad NSEC3 Salt", l} } if l.token != "-" { rr.SaltLength = uint8(len(l.token)) / 2 @@ -1177,7 +1010,7 @@ func (rr *NSEC3) parse(c *zlexer, o, f string) *ParseError { c.Next() l, _ = c.Next() if len(l.token) == 0 || l.err { - return &ParseError{f, "bad NSEC3 NextDomain", l} + return &ParseError{"", "bad NSEC3 NextDomain", l} } rr.HashLength = 20 // Fix for NSEC3 (sha1 160 bits) rr.NextDomain = l.token @@ -1196,41 +1029,37 @@ func (rr *NSEC3) parse(c *zlexer, o, f string) *ParseError { tokenUpper := strings.ToUpper(l.token) if k, ok = StringToType[tokenUpper]; !ok { if k, ok = typeToInt(l.token); !ok { - return &ParseError{f, "bad NSEC3 TypeBitMap", l} + return &ParseError{"", "bad NSEC3 TypeBitMap", l} } } rr.TypeBitMap = append(rr.TypeBitMap, k) default: - return &ParseError{f, "bad NSEC3 TypeBitMap", l} + return &ParseError{"", "bad NSEC3 TypeBitMap", l} } l, _ = c.Next() } return nil } -func (rr *NSEC3PARAM) parse(c *zlexer, o, f string) *ParseError { +func (rr *NSEC3PARAM) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad NSEC3PARAM Hash", l} + return &ParseError{"", "bad NSEC3PARAM Hash", l} } rr.Hash = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad NSEC3PARAM Flags", l} + return &ParseError{"", "bad NSEC3PARAM Flags", l} } rr.Flags = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad NSEC3PARAM Iterations", l} + return &ParseError{"", "bad NSEC3PARAM Iterations", l} } rr.Iterations = uint16(i) c.Next() @@ -1239,17 +1068,13 @@ func (rr *NSEC3PARAM) parse(c *zlexer, o, f string) *ParseError { rr.SaltLength = uint8(len(l.token)) rr.Salt = l.token } - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *EUI48) parse(c *zlexer, o, f string) *ParseError { +func (rr *EUI48) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - if len(l.token) != 17 || l.err { - return &ParseError{f, "bad EUI48 Address", l} + return &ParseError{"", "bad EUI48 Address", l} } addr := make([]byte, 12) dash := 0 @@ -1258,7 +1083,7 @@ func (rr *EUI48) parse(c *zlexer, o, f string) *ParseError { addr[i+1] = l.token[i+1+dash] dash++ if l.token[i+1+dash] != '-' { - return &ParseError{f, "bad EUI48 Address", l} + return &ParseError{"", "bad EUI48 Address", l} } } addr[10] = l.token[15] @@ -1266,20 +1091,16 @@ func (rr *EUI48) parse(c *zlexer, o, f string) *ParseError { i, e := strconv.ParseUint(string(addr), 16, 48) if e != nil { - return &ParseError{f, "bad EUI48 Address", l} + return &ParseError{"", "bad EUI48 Address", l} } rr.Address = i - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *EUI64) parse(c *zlexer, o, f string) *ParseError { +func (rr *EUI64) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - if len(l.token) != 23 || l.err { - return &ParseError{f, "bad EUI64 Address", l} + return &ParseError{"", "bad EUI64 Address", l} } addr := make([]byte, 16) dash := 0 @@ -1288,7 +1109,7 @@ func (rr *EUI64) parse(c *zlexer, o, f string) *ParseError { addr[i+1] = l.token[i+1+dash] dash++ if l.token[i+1+dash] != '-' { - return &ParseError{f, "bad EUI64 Address", l} + return &ParseError{"", "bad EUI64 Address", l} } } addr[14] = l.token[21] @@ -1296,32 +1117,28 @@ func (rr *EUI64) parse(c *zlexer, o, f string) *ParseError { i, e := strconv.ParseUint(string(addr), 16, 64) if e != nil { - return &ParseError{f, "bad EUI68 Address", l} + return &ParseError{"", "bad EUI68 Address", l} } rr.Address = i - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *SSHFP) parse(c *zlexer, o, f string) *ParseError { +func (rr *SSHFP) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad SSHFP Algorithm", l} + return &ParseError{"", "bad SSHFP Algorithm", l} } rr.Algorithm = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad SSHFP Type", l} + return &ParseError{"", "bad SSHFP Type", l} } rr.Type = uint8(i) c.Next() // zBlank - s, e1 := endingToString(c, "bad SSHFP Fingerprint", f) + s, e1 := endingToString(c, "bad SSHFP Fingerprint") if e1 != nil { return e1 } @@ -1329,32 +1146,28 @@ func (rr *SSHFP) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, f, typ string) *ParseError { +func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, typ string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad " + typ + " Flags", l} + return &ParseError{"", "bad " + typ + " Flags", l} } rr.Flags = uint16(i) c.Next() // zBlank l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad " + typ + " Protocol", l} + return &ParseError{"", "bad " + typ + " Protocol", l} } rr.Protocol = uint8(i) c.Next() // zBlank l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad " + typ + " Algorithm", l} + return &ParseError{"", "bad " + typ + " Algorithm", l} } rr.Algorithm = uint8(i) - s, e1 := endingToString(c, "bad "+typ+" PublicKey", f) + s, e1 := endingToString(c, "bad "+typ+" PublicKey") if e1 != nil { return e1 } @@ -1362,44 +1175,40 @@ func (rr *DNSKEY) parseDNSKEY(c *zlexer, o, f, typ string) *ParseError { return nil } -func (rr *DNSKEY) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDNSKEY(c, o, f, "DNSKEY") +func (rr *DNSKEY) parse(c *zlexer, o string) *ParseError { + return rr.parseDNSKEY(c, o, "DNSKEY") } -func (rr *KEY) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDNSKEY(c, o, f, "KEY") +func (rr *KEY) parse(c *zlexer, o string) *ParseError { + return rr.parseDNSKEY(c, o, "KEY") } -func (rr *CDNSKEY) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDNSKEY(c, o, f, "CDNSKEY") +func (rr *CDNSKEY) parse(c *zlexer, o string) *ParseError { + return rr.parseDNSKEY(c, o, "CDNSKEY") } -func (rr *RKEY) parse(c *zlexer, o, f string) *ParseError { +func (rr *RKEY) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad RKEY Flags", l} + return &ParseError{"", "bad RKEY Flags", l} } rr.Flags = uint16(i) c.Next() // zBlank l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad RKEY Protocol", l} + return &ParseError{"", "bad RKEY Protocol", l} } rr.Protocol = uint8(i) c.Next() // zBlank l, _ = c.Next() // zString i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad RKEY Algorithm", l} + return &ParseError{"", "bad RKEY Algorithm", l} } rr.Algorithm = uint8(i) - s, e1 := endingToString(c, "bad RKEY PublicKey", f) + s, e1 := endingToString(c, "bad RKEY PublicKey") if e1 != nil { return e1 } @@ -1407,8 +1216,8 @@ func (rr *RKEY) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *EID) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToString(c, "bad EID Endpoint", f) +func (rr *EID) parse(c *zlexer, o string) *ParseError { + s, e := endingToString(c, "bad EID Endpoint") if e != nil { return e } @@ -1416,8 +1225,8 @@ func (rr *EID) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *NIMLOC) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToString(c, "bad NIMLOC Locator", f) +func (rr *NIMLOC) parse(c *zlexer, o string) *ParseError { + s, e := endingToString(c, "bad NIMLOC Locator") if e != nil { return e } @@ -1425,43 +1234,35 @@ func (rr *NIMLOC) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *GPOS) parse(c *zlexer, o, f string) *ParseError { +func (rr *GPOS) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - _, e := strconv.ParseFloat(l.token, 64) if e != nil || l.err { - return &ParseError{f, "bad GPOS Longitude", l} + return &ParseError{"", "bad GPOS Longitude", l} } rr.Longitude = l.token c.Next() // zBlank l, _ = c.Next() _, e = strconv.ParseFloat(l.token, 64) if e != nil || l.err { - return &ParseError{f, "bad GPOS Latitude", l} + return &ParseError{"", "bad GPOS Latitude", l} } rr.Latitude = l.token c.Next() // zBlank l, _ = c.Next() _, e = strconv.ParseFloat(l.token, 64) if e != nil || l.err { - return &ParseError{f, "bad GPOS Altitude", l} + return &ParseError{"", "bad GPOS Altitude", l} } rr.Altitude = l.token - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *DS) parseDS(c *zlexer, o, f, typ string) *ParseError { +func (rr *DS) parseDS(c *zlexer, o, typ string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad " + typ + " KeyTag", l} + return &ParseError{"", "bad " + typ + " KeyTag", l} } rr.KeyTag = uint16(i) c.Next() // zBlank @@ -1470,7 +1271,7 @@ func (rr *DS) parseDS(c *zlexer, o, f, typ string) *ParseError { tokenUpper := strings.ToUpper(l.token) i, ok := StringToAlgorithm[tokenUpper] if !ok || l.err { - return &ParseError{f, "bad " + typ + " Algorithm", l} + return &ParseError{"", "bad " + typ + " Algorithm", l} } rr.Algorithm = i } else { @@ -1480,10 +1281,10 @@ func (rr *DS) parseDS(c *zlexer, o, f, typ string) *ParseError { l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad " + typ + " DigestType", l} + return &ParseError{"", "bad " + typ + " DigestType", l} } rr.DigestType = uint8(i) - s, e1 := endingToString(c, "bad "+typ+" Digest", f) + s, e1 := endingToString(c, "bad "+typ+" Digest") if e1 != nil { return e1 } @@ -1491,27 +1292,23 @@ func (rr *DS) parseDS(c *zlexer, o, f, typ string) *ParseError { return nil } -func (rr *DS) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDS(c, o, f, "DS") +func (rr *DS) parse(c *zlexer, o string) *ParseError { + return rr.parseDS(c, o, "DS") } -func (rr *DLV) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDS(c, o, f, "DLV") +func (rr *DLV) parse(c *zlexer, o string) *ParseError { + return rr.parseDS(c, o, "DLV") } -func (rr *CDS) parse(c *zlexer, o, f string) *ParseError { - return rr.parseDS(c, o, f, "CDS") +func (rr *CDS) parse(c *zlexer, o string) *ParseError { + return rr.parseDS(c, o, "CDS") } -func (rr *TA) parse(c *zlexer, o, f string) *ParseError { +func (rr *TA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad TA KeyTag", l} + return &ParseError{"", "bad TA KeyTag", l} } rr.KeyTag = uint16(i) c.Next() // zBlank @@ -1520,7 +1317,7 @@ func (rr *TA) parse(c *zlexer, o, f string) *ParseError { tokenUpper := strings.ToUpper(l.token) i, ok := StringToAlgorithm[tokenUpper] if !ok || l.err { - return &ParseError{f, "bad TA Algorithm", l} + return &ParseError{"", "bad TA Algorithm", l} } rr.Algorithm = i } else { @@ -1530,10 +1327,10 @@ func (rr *TA) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad TA DigestType", l} + return &ParseError{"", "bad TA DigestType", l} } rr.DigestType = uint8(i) - s, err := endingToString(c, "bad TA Digest", f) + s, err := endingToString(c, "bad TA Digest") if err != nil { return err } @@ -1541,33 +1338,29 @@ func (rr *TA) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *TLSA) parse(c *zlexer, o, f string) *ParseError { +func (rr *TLSA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad TLSA Usage", l} + return &ParseError{"", "bad TLSA Usage", l} } rr.Usage = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad TLSA Selector", l} + return &ParseError{"", "bad TLSA Selector", l} } rr.Selector = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad TLSA MatchingType", l} + return &ParseError{"", "bad TLSA MatchingType", l} } rr.MatchingType = uint8(i) // So this needs be e2 (i.e. different than e), because...??t - s, e2 := endingToString(c, "bad TLSA Certificate", f) + s, e2 := endingToString(c, "bad TLSA Certificate") if e2 != nil { return e2 } @@ -1575,33 +1368,29 @@ func (rr *TLSA) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *SMIMEA) parse(c *zlexer, o, f string) *ParseError { +func (rr *SMIMEA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad SMIMEA Usage", l} + return &ParseError{"", "bad SMIMEA Usage", l} } rr.Usage = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad SMIMEA Selector", l} + return &ParseError{"", "bad SMIMEA Selector", l} } rr.Selector = uint8(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 8) if e != nil || l.err { - return &ParseError{f, "bad SMIMEA MatchingType", l} + return &ParseError{"", "bad SMIMEA MatchingType", l} } rr.MatchingType = uint8(i) // So this needs be e2 (i.e. different than e), because...??t - s, e2 := endingToString(c, "bad SMIMEA Certificate", f) + s, e2 := endingToString(c, "bad SMIMEA Certificate") if e2 != nil { return e2 } @@ -1609,32 +1398,32 @@ func (rr *SMIMEA) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *RFC3597) parse(c *zlexer, o, f string) *ParseError { +func (rr *RFC3597) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() if l.token != "\\#" { - return &ParseError{f, "bad RFC3597 Rdata", l} + return &ParseError{"", "bad RFC3597 Rdata", l} } c.Next() // zBlank l, _ = c.Next() rdlength, e := strconv.Atoi(l.token) if e != nil || l.err { - return &ParseError{f, "bad RFC3597 Rdata ", l} + return &ParseError{"", "bad RFC3597 Rdata ", l} } - s, e1 := endingToString(c, "bad RFC3597 Rdata", f) + s, e1 := endingToString(c, "bad RFC3597 Rdata") if e1 != nil { return e1 } if rdlength*2 != len(s) { - return &ParseError{f, "bad RFC3597 Rdata", l} + return &ParseError{"", "bad RFC3597 Rdata", l} } rr.Rdata = s return nil } -func (rr *SPF) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToTxtSlice(c, "bad SPF Txt", f) +func (rr *SPF) parse(c *zlexer, o string) *ParseError { + s, e := endingToTxtSlice(c, "bad SPF Txt") if e != nil { return e } @@ -1642,8 +1431,8 @@ func (rr *SPF) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *AVC) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToTxtSlice(c, "bad AVC Txt", f) +func (rr *AVC) parse(c *zlexer, o string) *ParseError { + s, e := endingToTxtSlice(c, "bad AVC Txt") if e != nil { return e } @@ -1651,9 +1440,9 @@ func (rr *AVC) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *TXT) parse(c *zlexer, o, f string) *ParseError { +func (rr *TXT) parse(c *zlexer, o string) *ParseError { // no zBlank reading here, because all this rdata is TXT - s, e := endingToTxtSlice(c, "bad TXT Txt", f) + s, e := endingToTxtSlice(c, "bad TXT Txt") if e != nil { return e } @@ -1662,8 +1451,8 @@ func (rr *TXT) parse(c *zlexer, o, f string) *ParseError { } // identical to setTXT -func (rr *NINFO) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToTxtSlice(c, "bad NINFO ZSData", f) +func (rr *NINFO) parse(c *zlexer, o string) *ParseError { + s, e := endingToTxtSlice(c, "bad NINFO ZSData") if e != nil { return e } @@ -1671,40 +1460,36 @@ func (rr *NINFO) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *URI) parse(c *zlexer, o, f string) *ParseError { +func (rr *URI) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad URI Priority", l} + return &ParseError{"", "bad URI Priority", l} } rr.Priority = uint16(i) c.Next() // zBlank l, _ = c.Next() i, e = strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad URI Weight", l} + return &ParseError{"", "bad URI Weight", l} } rr.Weight = uint16(i) c.Next() // zBlank - s, err := endingToTxtSlice(c, "bad URI Target", f) + s, err := endingToTxtSlice(c, "bad URI Target") if err != nil { return err } if len(s) != 1 { - return &ParseError{f, "bad URI Target", l} + return &ParseError{"", "bad URI Target", l} } rr.Target = s[0] return nil } -func (rr *DHCID) parse(c *zlexer, o, f string) *ParseError { +func (rr *DHCID) parse(c *zlexer, o string) *ParseError { // awesome record to parse! - s, e := endingToString(c, "bad DHCID Digest", f) + s, e := endingToString(c, "bad DHCID Digest") if e != nil { return e } @@ -1712,15 +1497,11 @@ func (rr *DHCID) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *NID) parse(c *zlexer, o, f string) *ParseError { +func (rr *NID) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad NID Preference", l} + return &ParseError{"", "bad NID Preference", l} } rr.Preference = uint16(i) c.Next() // zBlank @@ -1730,38 +1511,30 @@ func (rr *NID) parse(c *zlexer, o, f string) *ParseError { return err } rr.NodeID = u - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *L32) parse(c *zlexer, o, f string) *ParseError { +func (rr *L32) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad L32 Preference", l} + return &ParseError{"", "bad L32 Preference", l} } rr.Preference = uint16(i) c.Next() // zBlank l, _ = c.Next() // zString rr.Locator32 = net.ParseIP(l.token) if rr.Locator32 == nil || l.err { - return &ParseError{f, "bad L32 Locator", l} + return &ParseError{"", "bad L32 Locator", l} } - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *LP) parse(c *zlexer, o, f string) *ParseError { +func (rr *LP) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad LP Preference", l} + return &ParseError{"", "bad LP Preference", l} } rr.Preference = uint16(i) @@ -1770,22 +1543,18 @@ func (rr *LP) parse(c *zlexer, o, f string) *ParseError { rr.Fqdn = l.token name, nameOk := toAbsoluteName(l.token, o) if l.err || !nameOk { - return &ParseError{f, "bad LP Fqdn", l} + return &ParseError{"", "bad LP Fqdn", l} } rr.Fqdn = name - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *L64) parse(c *zlexer, o, f string) *ParseError { +func (rr *L64) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad L64 Preference", l} + return &ParseError{"", "bad L64 Preference", l} } rr.Preference = uint16(i) c.Next() // zBlank @@ -1795,39 +1564,31 @@ func (rr *L64) parse(c *zlexer, o, f string) *ParseError { return err } rr.Locator64 = u - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *UID) parse(c *zlexer, o, f string) *ParseError { +func (rr *UID) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 32) if e != nil || l.err { - return &ParseError{f, "bad UID Uid", l} + return &ParseError{"", "bad UID Uid", l} } rr.Uid = uint32(i) - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *GID) parse(c *zlexer, o, f string) *ParseError { +func (rr *GID) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 32) if e != nil || l.err { - return &ParseError{f, "bad GID Gid", l} + return &ParseError{"", "bad GID Gid", l} } rr.Gid = uint32(i) - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *UINFO) parse(c *zlexer, o, f string) *ParseError { - s, e := endingToTxtSlice(c, "bad UINFO Uinfo", f) +func (rr *UINFO) parse(c *zlexer, o string) *ParseError { + s, e := endingToTxtSlice(c, "bad UINFO Uinfo") if e != nil { return e } @@ -1838,15 +1599,11 @@ func (rr *UINFO) parse(c *zlexer, o, f string) *ParseError { return nil } -func (rr *PX) parse(c *zlexer, o, f string) *ParseError { +func (rr *PX) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return slurpRemainder(c, f) - } - i, e := strconv.ParseUint(l.token, 10, 16) if e != nil || l.err { - return &ParseError{f, "bad PX Preference", l} + return &ParseError{"", "bad PX Preference", l} } rr.Preference = uint16(i) @@ -1855,7 +1612,7 @@ func (rr *PX) parse(c *zlexer, o, f string) *ParseError { rr.Map822 = l.token map822, map822Ok := toAbsoluteName(l.token, o) if l.err || !map822Ok { - return &ParseError{f, "bad PX Map822", l} + return &ParseError{"", "bad PX Map822", l} } rr.Map822 = map822 @@ -1864,50 +1621,46 @@ func (rr *PX) parse(c *zlexer, o, f string) *ParseError { rr.Mapx400 = l.token mapx400, mapx400Ok := toAbsoluteName(l.token, o) if l.err || !mapx400Ok { - return &ParseError{f, "bad PX Mapx400", l} + return &ParseError{"", "bad PX Mapx400", l} } rr.Mapx400 = mapx400 - return slurpRemainder(c, f) + return slurpRemainder(c) } -func (rr *CAA) parse(c *zlexer, o, f string) *ParseError { +func (rr *CAA) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() - if len(l.token) == 0 { // dynamic update rr. - return nil - } - i, err := strconv.ParseUint(l.token, 10, 8) if err != nil || l.err { - return &ParseError{f, "bad CAA Flag", l} + return &ParseError{"", "bad CAA Flag", l} } rr.Flag = uint8(i) c.Next() // zBlank l, _ = c.Next() // zString if l.value != zString { - return &ParseError{f, "bad CAA Tag", l} + return &ParseError{"", "bad CAA Tag", l} } rr.Tag = l.token c.Next() // zBlank - s, e := endingToTxtSlice(c, "bad CAA Value", f) + s, e := endingToTxtSlice(c, "bad CAA Value") if e != nil { return e } if len(s) != 1 { - return &ParseError{f, "bad CAA Value", l} + return &ParseError{"", "bad CAA Value", l} } rr.Value = s[0] return nil } -func (rr *TKEY) parse(c *zlexer, o, f string) *ParseError { +func (rr *TKEY) parse(c *zlexer, o string) *ParseError { l, _ := c.Next() // Algorithm if l.value != zString { - return &ParseError{f, "bad TKEY algorithm", l} + return &ParseError{"", "bad TKEY algorithm", l} } rr.Algorithm = l.token c.Next() // zBlank @@ -1916,13 +1669,13 @@ func (rr *TKEY) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err := strconv.ParseUint(l.token, 10, 8) if err != nil || l.err { - return &ParseError{f, "bad TKEY key length", l} + return &ParseError{"", "bad TKEY key length", l} } rr.KeySize = uint16(i) c.Next() // zBlank l, _ = c.Next() if l.value != zString { - return &ParseError{f, "bad TKEY key", l} + return &ParseError{"", "bad TKEY key", l} } rr.Key = l.token c.Next() // zBlank @@ -1931,13 +1684,13 @@ func (rr *TKEY) parse(c *zlexer, o, f string) *ParseError { l, _ = c.Next() i, err = strconv.ParseUint(l.token, 10, 8) if err != nil || l.err { - return &ParseError{f, "bad TKEY otherdata length", l} + return &ParseError{"", "bad TKEY otherdata length", l} } rr.OtherLen = uint16(i) c.Next() // zBlank l, _ = c.Next() if l.value != zString { - return &ParseError{f, "bad TKEY otherday", l} + return &ParseError{"", "bad TKEY otherday", l} } rr.OtherData = l.token diff --git a/vendor/github.com/miekg/dns/server.go b/vendor/github.com/miekg/dns/server.go index 97cc87a7..3cf1a024 100644 --- a/vendor/github.com/miekg/dns/server.go +++ b/vendor/github.com/miekg/dns/server.go @@ -560,15 +560,22 @@ func (srv *Server) serveDNS(m []byte, w *response) { req := new(Msg) req.setHdr(dh) - switch srv.MsgAcceptFunc(dh) { + switch action := srv.MsgAcceptFunc(dh); action { case MsgAccept: if req.unpack(dh, m, off) == nil { break } fallthrough - case MsgReject: + case MsgReject, MsgRejectNotImplemented: + opcode := req.Opcode req.SetRcodeFormatError(req) + req.Zero = false + if action == MsgRejectNotImplemented { + req.Opcode = opcode + req.Rcode = RcodeNotImplemented + } + // Are we allowed to delete any OPT records here? req.Ns, req.Answer, req.Extra = nil, nil, nil diff --git a/vendor/github.com/miekg/dns/tsig.go b/vendor/github.com/miekg/dns/tsig.go index afa462fa..2c4ef03b 100644 --- a/vendor/github.com/miekg/dns/tsig.go +++ b/vendor/github.com/miekg/dns/tsig.go @@ -54,7 +54,7 @@ func (rr *TSIG) String() string { return s } -func (rr *TSIG) parse(c *zlexer, origin, file string) *ParseError { +func (rr *TSIG) parse(c *zlexer, origin string) *ParseError { panic("dns: internal error: parse should never be called on TSIG") } diff --git a/vendor/github.com/miekg/dns/types.go b/vendor/github.com/miekg/dns/types.go index 835f2fe7..6f79038b 100644 --- a/vendor/github.com/miekg/dns/types.go +++ b/vendor/github.com/miekg/dns/types.go @@ -238,7 +238,7 @@ type ANY struct { func (rr *ANY) String() string { return rr.Hdr.String() } -func (rr *ANY) parse(c *zlexer, origin, file string) *ParseError { +func (rr *ANY) parse(c *zlexer, origin string) *ParseError { panic("dns: internal error: parse should never be called on ANY") } @@ -253,7 +253,7 @@ func (rr *NULL) String() string { return ";" + rr.Hdr.String() + rr.Data } -func (rr *NULL) parse(c *zlexer, origin, file string) *ParseError { +func (rr *NULL) parse(c *zlexer, origin string) *ParseError { panic("dns: internal error: parse should never be called on NULL") } @@ -854,14 +854,7 @@ func (rr *NSEC) String() string { func (rr *NSEC) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) l += domainNameLen(rr.NextDomain, off+l, compression, false) - lastwindow := uint32(2 ^ 32 + 1) - for _, t := range rr.TypeBitMap { - window := t / 256 - if uint32(window) != lastwindow { - l += 1 + 32 - } - lastwindow = uint32(window) - } + l += typeBitMapLen(rr.TypeBitMap) return l } @@ -1020,14 +1013,7 @@ func (rr *NSEC3) String() string { func (rr *NSEC3) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) l += 6 + len(rr.Salt)/2 + 1 + len(rr.NextDomain) + 1 - lastwindow := uint32(2 ^ 32 + 1) - for _, t := range rr.TypeBitMap { - window := t / 256 - if uint32(window) != lastwindow { - l += 1 + 32 - } - lastwindow = uint32(window) - } + l += typeBitMapLen(rr.TypeBitMap) return l } @@ -1344,14 +1330,7 @@ func (rr *CSYNC) String() string { func (rr *CSYNC) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) l += 4 + 2 - lastwindow := uint32(2 ^ 32 + 1) - for _, t := range rr.TypeBitMap { - window := t / 256 - if uint32(window) != lastwindow { - l += 1 + 32 - } - lastwindow = uint32(window) - } + l += typeBitMapLen(rr.TypeBitMap) return l } diff --git a/vendor/github.com/miekg/dns/types_generate.go b/vendor/github.com/miekg/dns/types_generate.go index cbb4a00c..8cda2a74 100644 --- a/vendor/github.com/miekg/dns/types_generate.go +++ b/vendor/github.com/miekg/dns/types_generate.go @@ -189,10 +189,8 @@ func main() { o("l += base64.StdEncoding.DecodedLen(len(rr.%s))\n") case strings.HasPrefix(st.Tag(i), `dns:"size-hex:`): // this has an extra field where the length is stored o("l += len(rr.%s)/2\n") - case strings.HasPrefix(st.Tag(i), `dns:"size-hex`): - fallthrough case st.Tag(i) == `dns:"hex"`: - o("l += len(rr.%s)/2 + 1\n") + o("l += len(rr.%s)/2\n") case st.Tag(i) == `dns:"any"`: o("l += len(rr.%s)\n") case st.Tag(i) == `dns:"a"`: diff --git a/vendor/github.com/miekg/dns/version.go b/vendor/github.com/miekg/dns/version.go index a25162fc..2e0292ef 100644 --- a/vendor/github.com/miekg/dns/version.go +++ b/vendor/github.com/miekg/dns/version.go @@ -3,7 +3,7 @@ package dns import "fmt" // Version is current version of this library. -var Version = V{1, 1, 9} +var Version = V{1, 1, 15} // V holds the version of this library. type V struct { diff --git a/vendor/github.com/miekg/dns/xfr.go b/vendor/github.com/miekg/dns/xfr.go index 82afc52e..bb4ca3d8 100644 --- a/vendor/github.com/miekg/dns/xfr.go +++ b/vendor/github.com/miekg/dns/xfr.go @@ -198,11 +198,14 @@ func (t *Transfer) Out(w ResponseWriter, q *Msg, ch chan *Envelope) error { r.Authoritative = true // assume it fits TODO(miek): fix r.Answer = append(r.Answer, x.RR...) + if tsig := q.IsTsig(); tsig != nil && w.TsigStatus() == nil { + r.SetTsig(tsig.Hdr.Name, tsig.Algorithm, tsig.Fudge, time.Now().Unix()) + } if err := w.WriteMsg(r); err != nil { return err } + w.TsigTimersOnly(true) } - w.TsigTimersOnly(true) return nil } diff --git a/vendor/github.com/miekg/dns/ztypes.go b/vendor/github.com/miekg/dns/ztypes.go index 495a83e3..f7ec8352 100644 --- a/vendor/github.com/miekg/dns/ztypes.go +++ b/vendor/github.com/miekg/dns/ztypes.go @@ -312,12 +312,12 @@ func (rr *DS) len(off int, compression map[string]struct{}) int { l += 2 // KeyTag l++ // Algorithm l++ // DigestType - l += len(rr.Digest)/2 + 1 + l += len(rr.Digest) / 2 return l } func (rr *EID) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) - l += len(rr.Endpoint)/2 + 1 + l += len(rr.Endpoint) / 2 return l } func (rr *EUI48) len(off int, compression map[string]struct{}) int { @@ -452,7 +452,7 @@ func (rr *NID) len(off int, compression map[string]struct{}) int { } func (rr *NIMLOC) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) - l += len(rr.Locator)/2 + 1 + l += len(rr.Locator) / 2 return l } func (rr *NINFO) len(off int, compression map[string]struct{}) int { @@ -505,7 +505,7 @@ func (rr *PX) len(off int, compression map[string]struct{}) int { } func (rr *RFC3597) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) - l += len(rr.Rdata)/2 + 1 + l += len(rr.Rdata) / 2 return l } func (rr *RKEY) len(off int, compression map[string]struct{}) int { @@ -546,7 +546,7 @@ func (rr *SMIMEA) len(off int, compression map[string]struct{}) int { l++ // Usage l++ // Selector l++ // MatchingType - l += len(rr.Certificate)/2 + 1 + l += len(rr.Certificate) / 2 return l } func (rr *SOA) len(off int, compression map[string]struct{}) int { @@ -579,7 +579,7 @@ func (rr *SSHFP) len(off int, compression map[string]struct{}) int { l := rr.Hdr.len(off, compression) l++ // Algorithm l++ // Type - l += len(rr.FingerPrint)/2 + 1 + l += len(rr.FingerPrint) / 2 return l } func (rr *TA) len(off int, compression map[string]struct{}) int { @@ -587,7 +587,7 @@ func (rr *TA) len(off int, compression map[string]struct{}) int { l += 2 // KeyTag l++ // Algorithm l++ // DigestType - l += len(rr.Digest)/2 + 1 + l += len(rr.Digest) / 2 return l } func (rr *TALINK) len(off int, compression map[string]struct{}) int { @@ -614,7 +614,7 @@ func (rr *TLSA) len(off int, compression map[string]struct{}) int { l++ // Usage l++ // Selector l++ // MatchingType - l += len(rr.Certificate)/2 + 1 + l += len(rr.Certificate) / 2 return l } func (rr *TSIG) len(off int, compression map[string]struct{}) int { diff --git a/vendor/github.com/oracle/oci-go-sdk/common/common.go b/vendor/github.com/oracle/oci-go-sdk/common/common.go index 897c0d9f..2f686b14 100644 --- a/vendor/github.com/oracle/oci-go-sdk/common/common.go +++ b/vendor/github.com/oracle/oci-go-sdk/common/common.go @@ -24,6 +24,10 @@ const ( RegionFRA Region = "eu-frankfurt-1" //RegionLHR region LHR RegionLHR Region = "uk-london-1" + //RegionAPTokyo1 region for tokyo + RegionAPTokyo1 Region = "ap-tokyo-1" + //RegionAPSeoul1 region for seoul + RegionAPSeoul1 Region = "ap-seoul-1" //RegionUSLangley1 region for langley RegionUSLangley1 Region = "us-langley-1" @@ -50,10 +54,11 @@ var regionRealm = map[Region]string{ RegionFRA: "oc1", RegionLHR: "oc1", RegionCAToronto1: "oc1", + RegionAPTokyo1: "oc1", + RegionAPSeoul1: "oc1", - RegionUSLangley1: "oc2", - RegionUSLuke1: "oc2", - + RegionUSLangley1: "oc2", + RegionUSLuke1: "oc2", RegionUSGovAshburn1: "oc3", RegionUSGovChicago1: "oc3", RegionUSGovPhoenix1: "oc3", @@ -108,6 +113,10 @@ func StringToRegion(stringRegion string) (r Region) { r = RegionFRA case "lhr", "uk-london-1": r = RegionLHR + case "ap-tokyo-1": + r = RegionAPTokyo1 + case "ap-seoul-1": + r = RegionAPSeoul1 case "us-langley-1": r = RegionUSLangley1 case "us-luke-1": diff --git a/vendor/github.com/oracle/oci-go-sdk/common/configuration.go b/vendor/github.com/oracle/oci-go-sdk/common/configuration.go index 8d077085..58c6b33d 100644 --- a/vendor/github.com/oracle/oci-go-sdk/common/configuration.go +++ b/vendor/github.com/oracle/oci-go-sdk/common/configuration.go @@ -51,7 +51,7 @@ type rawConfigurationProvider struct { privateKeyPassphrase *string } -// NewRawConfigurationProvider will create a rawConfigurationProvider +// NewRawConfigurationProvider will create a ConfigurationProvider with the arguments of the function func NewRawConfigurationProvider(tenancy, user, region, fingerprint, privateKey string, privateKeyPassphrase *string) ConfigurationProvider { return rawConfigurationProvider{tenancy, user, region, fingerprint, privateKey, privateKeyPassphrase} } diff --git a/vendor/github.com/oracle/oci-go-sdk/common/http.go b/vendor/github.com/oracle/oci-go-sdk/common/http.go index 08b1d1f2..4087ce18 100644 --- a/vendor/github.com/oracle/oci-go-sdk/common/http.go +++ b/vendor/github.com/oracle/oci-go-sdk/common/http.go @@ -66,10 +66,15 @@ func toStringValue(v reflect.Value, field reflect.StructField) (string, error) { } } -func addBinaryBody(request *http.Request, value reflect.Value) (e error) { +func addBinaryBody(request *http.Request, value reflect.Value, field reflect.StructField) (e error) { readCloser, ok := value.Interface().(io.ReadCloser) - if !ok { - e = fmt.Errorf("body of the request needs to be an io.ReadCloser interface. Can not marshal body of binary request") + isMandatory, err := strconv.ParseBool(field.Tag.Get("mandatory")) + if err != nil { + return fmt.Errorf("mandatory tag is not valid for field %s", field.Name) + } + + if isMandatory && !ok { + e = fmt.Errorf("body of the request is mandatory and needs to be an io.ReadCloser interface. Can not marshal body of binary request") return } @@ -252,7 +257,7 @@ func addToBody(request *http.Request, value reflect.Value, field reflect.StructF encoding := tag.Get("encoding") if encoding == "binary" { - return addBinaryBody(request, value) + return addBinaryBody(request, value, field) } rawJSON, e := json.Marshal(value.Interface()) diff --git a/vendor/github.com/oracle/oci-go-sdk/common/version.go b/vendor/github.com/oracle/oci-go-sdk/common/version.go index 49b976dc..5489ed65 100644 --- a/vendor/github.com/oracle/oci-go-sdk/common/version.go +++ b/vendor/github.com/oracle/oci-go-sdk/common/version.go @@ -11,7 +11,7 @@ import ( const ( major = "5" - minor = "4" + minor = "13" patch = "0" tag = "" ) diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_details.go index bae1514c..c600d9ab 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_request_response.go index 0a232d93..1c97aa91 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_attachment_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_details.go index 1e6329c3..f7d6ff8d 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_request_response.go index 18a217d6..9f5cfc27 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_steering_policy_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_details.go index 12f60ca0..b0429eac 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_request_response.go index 480f46e9..00a9f7f1 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/create_zone_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/delete_domain_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/delete_domain_records_request_response.go index 4f96cfc1..34153495 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/delete_domain_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/delete_domain_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/delete_r_r_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/delete_r_r_set_request_response.go index 4f9a4f24..dd166858 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/delete_r_r_set_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/delete_r_r_set_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_attachment_request_response.go index 5b6befe4..5ff2ca9c 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_attachment_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_attachment_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_request_response.go index 67ce75ef..9b61fd0e 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/delete_steering_policy_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/delete_zone_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/delete_zone_request_response.go index 6583fcc9..06ddf279 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/delete_zone_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/delete_zone_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/dns_client.go b/vendor/github.com/oracle/oci-go-sdk/dns/dns_client.go index 7aeadd79..771b0090 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/dns_client.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/dns_client.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/external_master.go b/vendor/github.com/oracle/oci-go-sdk/dns/external_master.go index fef1ce5d..83cbfea8 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/external_master.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/external_master.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_domain_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_domain_records_request_response.go index 4cb4d638..6eb47d79 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_domain_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_domain_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_r_r_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_r_r_set_request_response.go index 088f2fc6..13c1a984 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_r_r_set_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_r_r_set_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_attachment_request_response.go index 12b1c6f8..033dfe45 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_attachment_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_attachment_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_request_response.go index 4628e798..826ef7e1 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_steering_policy_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_records_request_response.go index 943e3753..ff5e23a6 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_request_response.go index 2ba1b7c8..b9f3b308 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/get_zone_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policies_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policies_request_response.go index 00060038..0e54aa3c 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policies_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policies_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policy_attachments_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policy_attachments_request_response.go index 41886b3b..3cf44a7a 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policy_attachments_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/list_steering_policy_attachments_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/list_zones_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/list_zones_request_response.go index d5f86241..629070eb 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/list_zones_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/list_zones_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/nameserver.go b/vendor/github.com/oracle/oci-go-sdk/dns/nameserver.go index 7c89f37b..e2318948 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/nameserver.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/nameserver.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_details.go index 839ef76e..6fbfa48d 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_request_response.go index a36f6b87..5e93c006 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_domain_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_r_r_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_r_r_set_request_response.go index c809072e..749b808f 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_r_r_set_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_r_r_set_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_rr_set_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_rr_set_details.go index 34a4fcaa..8753b37e 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_rr_set_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_rr_set_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_details.go index 6f9c3362..8d3424c9 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_request_response.go index a31f2fd0..1d4e2ef4 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/patch_zone_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/record.go b/vendor/github.com/oracle/oci-go-sdk/dns/record.go index a3c60e17..ef70159b 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/record.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/record.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/record_collection.go b/vendor/github.com/oracle/oci-go-sdk/dns/record_collection.go index b94fd1af..a1933adc 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/record_collection.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/record_collection.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/record_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/record_details.go index 6ef371f2..93c26cfe 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/record_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/record_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/record_operation.go b/vendor/github.com/oracle/oci-go-sdk/dns/record_operation.go index 82e5ffaa..e851b8d5 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/record_operation.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/record_operation.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/rr_set.go b/vendor/github.com/oracle/oci-go-sdk/dns/rr_set.go index dd37bbe7..67c5f83b 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/rr_set.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/rr_set.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/sort_order.go b/vendor/github.com/oracle/oci-go-sdk/dns/sort_order.go index adb330ff..5b855e81 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/sort_order.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/sort_order.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy.go index 7b8dcfeb..5bc21af9 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_answer.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_answer.go index ced1e441..3cc1e1a9 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_answer.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_answer.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment.go index c63718ee..a5d4a0c4 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment_summary.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment_summary.go index 68d2bdcb..28191b83 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment_summary.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_attachment_summary.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_answer_data.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_answer_data.go index 7af1046c..765e2db9 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_answer_data.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_answer_data.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule.go index db9829da..3a114c42 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule_case.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule_case.go index 092890b0..feb8faf2 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule_case.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_filter_rule_case.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule.go index 2f04d2be..4994fffc 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule_case.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule_case.go index 9578bdeb..a4cf30ab 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule_case.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_health_rule_case.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule.go index 06562ab2..22723f50 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule_case.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule_case.go index 3e0c7ea0..c890c875 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule_case.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_limit_rule_case.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_answer_data.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_answer_data.go index 81f2aae3..5ff25e46 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_answer_data.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_answer_data.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule.go index 6e48dad5..5396f2af 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule_case.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule_case.go index ec73f45f..3b496d2a 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule_case.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_priority_rule_case.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_rule.go index 1f209a8a..78a5d7e8 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_summary.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_summary.go index c6541b1e..3618ea57 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_summary.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_summary.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_answer_data.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_answer_data.go index 1c0704fb..2e72de96 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_answer_data.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_answer_data.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule.go index e6af1d5b..71bacfc4 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule_case.go b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule_case.go index d1820d0d..9f344f28 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule_case.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/steering_policy_weighted_rule_case.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/tsig.go b/vendor/github.com/oracle/oci-go-sdk/dns/tsig.go index f5c36813..42cfbb5a 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/tsig.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/tsig.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_details.go index f243b866..873c84e3 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_request_response.go index 64a872ff..c406f04e 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_domain_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_r_r_set_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_r_r_set_request_response.go index e8a829e8..08fd5e42 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_r_r_set_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_r_r_set_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_rr_set_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_rr_set_details.go index 1229d638..11b0a851 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_rr_set_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_rr_set_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_details.go index 8f1adf13..e200d7c9 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_request_response.go index e504e07d..e3b36d21 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_attachment_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_details.go index 2aec2006..6555898c 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_request_response.go index 67f838b2..2f4e4048 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_steering_policy_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_details.go index f74c4342..0ca6d796 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_details.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_details.go index a6b5701d..09409129 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_details.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_details.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_request_response.go index 451aeceb..90d54888 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_records_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_request_response.go b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_request_response.go index d691af0b..bc29323b 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_request_response.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/update_zone_request_response.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. package dns diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/zone.go b/vendor/github.com/oracle/oci-go-sdk/dns/zone.go index f3c0aa3a..78667b9f 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/zone.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/zone.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/oracle/oci-go-sdk/dns/zone_summary.go b/vendor/github.com/oracle/oci-go-sdk/dns/zone_summary.go index cabec76d..e99ee9d4 100644 --- a/vendor/github.com/oracle/oci-go-sdk/dns/zone_summary.go +++ b/vendor/github.com/oracle/oci-go-sdk/dns/zone_summary.go @@ -1,4 +1,4 @@ -// Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved. +// Copyright (c) 2016, 2018, 2019, Oracle and/or its affiliates. All rights reserved. // Code generated. DO NOT EDIT. // DNS API diff --git a/vendor/github.com/sacloud/libsacloud/api/archive.go b/vendor/github.com/sacloud/libsacloud/api/archive.go index be13faa7..6421936a 100644 --- a/vendor/github.com/sacloud/libsacloud/api/archive.go +++ b/vendor/github.com/sacloud/libsacloud/api/archive.go @@ -20,17 +20,14 @@ var ( archiveLatestStableCentOS6Tags = []string{"distro-centos", "distro-ver-6.10"} archiveLatestStableUbuntuTags = []string{"current-stable", "distro-ubuntu"} archiveLatestStableDebianTags = []string{"current-stable", "distro-debian"} - archiveLatestStableVyOSTags = []string{"current-stable", "distro-vyos"} archiveLatestStableCoreOSTags = []string{"current-stable", "distro-coreos"} archiveLatestStableRancherOSTags = []string{"current-stable", "distro-rancheros"} + archiveLatestStableK3OSTags = []string{"current-stable", "distro-k3os"} archiveLatestStableKusanagiTags = []string{"current-stable", "pkg-kusanagi"} archiveLatestStableSophosUTMTags = []string{"current-stable", "pkg-sophosutm"} archiveLatestStableFreeBSDTags = []string{"current-stable", "distro-freebsd"} archiveLatestStableNetwiserTags = []string{"current-stable", "pkg-netwiserve"} archiveLatestStableOPNsenseTags = []string{"current-stable", "distro-opnsense"} - archiveLatestStableWindows2012Tags = []string{"os-windows", "distro-ver-2012.2"} - archiveLatestStableWindows2012RDSTags = []string{"os-windows", "distro-ver-2012.2", "windows-rds"} - archiveLatestStableWindows2012RDSOfficeTags = []string{"os-windows", "distro-ver-2012.2", "windows-rds", "with-office"} archiveLatestStableWindows2016Tags = []string{"os-windows", "distro-ver-2016"} archiveLatestStableWindows2016RDSTags = []string{"os-windows", "distro-ver-2016", "windows-rds"} archiveLatestStableWindows2016RDSOfficeTags = []string{"os-windows", "distro-ver-2016", "windows-rds", "with-office"} @@ -58,17 +55,14 @@ func NewArchiveAPI(client *Client) *ArchiveAPI { ostype.CentOS6: api.FindLatestStableCentOS6, ostype.Ubuntu: api.FindLatestStableUbuntu, ostype.Debian: api.FindLatestStableDebian, - ostype.VyOS: api.FindLatestStableVyOS, ostype.CoreOS: api.FindLatestStableCoreOS, ostype.RancherOS: api.FindLatestStableRancherOS, + ostype.K3OS: api.FindLatestStableK3OS, ostype.Kusanagi: api.FindLatestStableKusanagi, ostype.SophosUTM: api.FindLatestStableSophosUTM, ostype.FreeBSD: api.FindLatestStableFreeBSD, ostype.Netwiser: api.FindLatestStableNetwiser, ostype.OPNsense: api.FindLatestStableOPNsense, - ostype.Windows2012: api.FindLatestStableWindows2012, - ostype.Windows2012RDS: api.FindLatestStableWindows2012RDS, - ostype.Windows2012RDSOffice: api.FindLatestStableWindows2012RDSOffice, ostype.Windows2016: api.FindLatestStableWindows2016, ostype.Windows2016RDS: api.FindLatestStableWindows2016RDS, ostype.Windows2016RDSOffice: api.FindLatestStableWindows2016RDSOffice, @@ -245,11 +239,6 @@ func (api *ArchiveAPI) FindLatestStableUbuntu() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableUbuntuTags) } -// FindLatestStableVyOS 安定版最新のVyOSパブリックアーカイブを取得 -func (api *ArchiveAPI) FindLatestStableVyOS() (*sacloud.Archive, error) { - return api.findByOSTags(archiveLatestStableVyOSTags) -} - // FindLatestStableCoreOS 安定版最新のCoreOSパブリックアーカイブを取得 func (api *ArchiveAPI) FindLatestStableCoreOS() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableCoreOSTags) @@ -260,6 +249,11 @@ func (api *ArchiveAPI) FindLatestStableRancherOS() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableRancherOSTags) } +// FindLatestStableK3OS 安定版最新のk3OSパブリックアーカイブを取得 +func (api *ArchiveAPI) FindLatestStableK3OS() (*sacloud.Archive, error) { + return api.findByOSTags(archiveLatestStableK3OSTags) +} + // FindLatestStableKusanagi 安定版最新のKusanagiパブリックアーカイブを取得 func (api *ArchiveAPI) FindLatestStableKusanagi() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableKusanagiTags) @@ -285,27 +279,6 @@ func (api *ArchiveAPI) FindLatestStableOPNsense() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableOPNsenseTags) } -// FindLatestStableWindows2012 安定版最新のWindows2012パブリックアーカイブを取得 -func (api *ArchiveAPI) FindLatestStableWindows2012() (*sacloud.Archive, error) { - return api.findByOSTags(archiveLatestStableWindows2012Tags, map[string]interface{}{ - "Name": "Windows Server 2012 R2 Datacenter Edition", - }) -} - -// FindLatestStableWindows2012RDS 安定版最新のWindows2012RDSパブリックアーカイブを取得 -func (api *ArchiveAPI) FindLatestStableWindows2012RDS() (*sacloud.Archive, error) { - return api.findByOSTags(archiveLatestStableWindows2012RDSTags, map[string]interface{}{ - "Name": "Windows Server 2012 R2 for RDS", - }) -} - -// FindLatestStableWindows2012RDSOffice 安定版最新のWindows2012RDS(Office)パブリックアーカイブを取得 -func (api *ArchiveAPI) FindLatestStableWindows2012RDSOffice() (*sacloud.Archive, error) { - return api.findByOSTags(archiveLatestStableWindows2012RDSOfficeTags, map[string]interface{}{ - "Name": "Windows Server 2012 R2 for RDS(MS Office付)", - }) -} - // FindLatestStableWindows2016 安定版最新のWindows2016パブリックアーカイブを取得 func (api *ArchiveAPI) FindLatestStableWindows2016() (*sacloud.Archive, error) { return api.findByOSTags(archiveLatestStableWindows2016Tags, map[string]interface{}{ diff --git a/vendor/github.com/sacloud/libsacloud/api/client.go b/vendor/github.com/sacloud/libsacloud/api/client.go index 19977429..7837161e 100644 --- a/vendor/github.com/sacloud/libsacloud/api/client.go +++ b/vendor/github.com/sacloud/libsacloud/api/client.go @@ -108,6 +108,7 @@ func (c *Client) isOkStatus(code int) bool { 411: false, 413: false, 415: false, + 423: false, 500: false, 503: false, } @@ -257,7 +258,7 @@ func (c *retryableHTTPClient) Do(req *request) (*http.Response, error) { } res, err := c.Client.Do(req.Request) - if res != nil && res.StatusCode != 503 { + if res != nil && res.StatusCode != 503 && res.StatusCode != 423 { return res, err } if res != nil && res.Body != nil { diff --git a/vendor/github.com/sacloud/libsacloud/api/product_server.go b/vendor/github.com/sacloud/libsacloud/api/product_server.go index 63807eee..9dd74b6f 100644 --- a/vendor/github.com/sacloud/libsacloud/api/product_server.go +++ b/vendor/github.com/sacloud/libsacloud/api/product_server.go @@ -25,7 +25,12 @@ func NewProductServerAPI(client *Client) *ProductServerAPI { } // GetBySpec 指定のコア数/メモリサイズ/世代のプランを取得 -func (api *ProductServerAPI) GetBySpec(core int, memGB int, gen sacloud.PlanGenerations) (*sacloud.ProductServer, error) { +func (api *ProductServerAPI) GetBySpec(core, memGB int, gen sacloud.PlanGenerations) (*sacloud.ProductServer, error) { + return api.GetBySpecCommitment(core, memGB, gen, sacloud.ECommitmentStandard) +} + +// GetBySpecCommitment 指定のコア数/メモリサイズ/世代のプランを取得 +func (api *ProductServerAPI) GetBySpecCommitment(core, memGB int, gen sacloud.PlanGenerations, commitment sacloud.ECommitment) (*sacloud.ProductServer, error) { plans, err := api.Reset().Find() if err != nil { return nil, err @@ -33,7 +38,7 @@ func (api *ProductServerAPI) GetBySpec(core int, memGB int, gen sacloud.PlanGene var res sacloud.ProductServer var found bool for _, plan := range plans.ServerPlans { - if plan.CPU == core && plan.GetMemoryGB() == memGB { + if plan.CPU == core && plan.GetMemoryGB() == memGB && plan.Commitment == commitment { if gen == sacloud.PlanDefault || gen == plan.Generation { // PlanDefaultの場合は複数ヒットしうる。 // この場合より新しい世代を優先する。 diff --git a/vendor/github.com/sacloud/libsacloud/api/proxylb.go b/vendor/github.com/sacloud/libsacloud/api/proxylb.go index 9e45596f..2c02017e 100644 --- a/vendor/github.com/sacloud/libsacloud/api/proxylb.go +++ b/vendor/github.com/sacloud/libsacloud/api/proxylb.go @@ -196,6 +196,15 @@ func (api *ProxyLBAPI) DeleteCertificates(id int64) (bool, error) { return api.baseAPI.modify(method, uri, nil) } +// RenewLetsEncryptCert 証明書更新 +func (api *ProxyLBAPI) RenewLetsEncryptCert(id int64) (bool, error) { + var ( + method = "PUT" + uri = fmt.Sprintf("%s/%d/proxylb/letsencryptrenew", api.getResourceURL(), id) + ) + return api.baseAPI.modify(method, uri, nil) +} + type proxyLBHealthResponse struct { *sacloud.ResultFlagValue ProxyLB *sacloud.ProxyLBStatus `json:",omitempty"` diff --git a/vendor/github.com/sacloud/libsacloud/api/server.go b/vendor/github.com/sacloud/libsacloud/api/server.go index 4572c6bd..8ad08bd9 100644 --- a/vendor/github.com/sacloud/libsacloud/api/server.go +++ b/vendor/github.com/sacloud/libsacloud/api/server.go @@ -160,6 +160,7 @@ func (api *ServerAPI) ChangePlan(serverID int64, plan *sacloud.ProductServer) (* body.CPU = plan.CPU body.MemoryMB = plan.MemoryMB body.Generation = plan.Generation + body.Commitment = plan.Commitment return api.request(func(res *sacloud.Response) error { return api.baseAPI.request(method, uri, body, res) diff --git a/vendor/github.com/sacloud/libsacloud/libsacloud.go b/vendor/github.com/sacloud/libsacloud/libsacloud.go index ff67288d..ce9b767d 100644 --- a/vendor/github.com/sacloud/libsacloud/libsacloud.go +++ b/vendor/github.com/sacloud/libsacloud/libsacloud.go @@ -2,4 +2,4 @@ package libsacloud // Version バージョン -const Version = "1.21.1" +const Version = "1.25.1" diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/common_types.go b/vendor/github.com/sacloud/libsacloud/sacloud/common_types.go index 042b861d..a4c6446a 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/common_types.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/common_types.go @@ -168,6 +168,16 @@ var ( } ) +// ECommitment サーバプランCPUコミットメント +type ECommitment string + +var ( + // ECommitmentStandard 通常 + ECommitmentStandard = ECommitment("standard") + // ECommitmentDedicatedCPU コア専有 + ECommitmentDedicatedCPU = ECommitment("dedicatedcpu") +) + // SakuraCloudResources さくらのクラウド上のリソース種別一覧 type SakuraCloudResources struct { Server *Server `json:",omitempty"` // サーバー diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/database.go b/vendor/github.com/sacloud/libsacloud/sacloud/database.go index 4d1b3ad6..68e2efdf 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/database.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/database.go @@ -260,7 +260,7 @@ type SlaveDatabaseValue struct { func NewCreatePostgreSQLDatabaseValue() *CreateDatabaseValue { return &CreateDatabaseValue{ DatabaseName: "postgres", - DatabaseVersion: "10", + DatabaseVersion: "11", } } @@ -268,7 +268,7 @@ func NewCreatePostgreSQLDatabaseValue() *CreateDatabaseValue { func NewCreateMariaDBDatabaseValue() *CreateDatabaseValue { return &CreateDatabaseValue{ DatabaseName: "MariaDB", - DatabaseVersion: "10.2", + DatabaseVersion: "10.3", } } @@ -442,7 +442,7 @@ func NewSlaveDatabaseValue(values *SlaveDatabaseValue) *Database { }, }, // Plan - propPlanID: propPlanID{Plan: &Resource{ID: int64(values.Plan)}}, + propPlanID: propPlanID{Plan: &Resource{ID: int64(values.Plan) + 1}}, }, // Settings Settings: &DatabaseSettings{ diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/dns.go b/vendor/github.com/sacloud/libsacloud/sacloud/dns.go index 35182573..b1d0fb8f 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/dns.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/dns.go @@ -59,7 +59,7 @@ func CreateNewDNS(zoneName string) *DNS { // AllowDNSTypes DNSレコード種別リスト func AllowDNSTypes() []string { - return []string{"A", "AAAA", "CNAME", "NS", "MX", "TXT", "SRV"} + return []string{"A", "AAAA", "CNAME", "NS", "MX", "TXT", "SRV", "CAA"} } // SetZone DNSゾーン名 設定 diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archive_ostype.go b/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archive_ostype.go index 29d75485..f7654e54 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archive_ostype.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archive_ostype.go @@ -15,12 +15,12 @@ const ( Ubuntu // Debian OS種別:Debian Debian - // VyOS OS種別:VyOS - VyOS // CoreOS OS種別:CoreOS CoreOS // RancherOS OS種別:RancherOS RancherOS + // K3OS OS種別: k3OS + K3OS // Kusanagi OS種別:Kusanagi(CentOS) Kusanagi // SophosUTM OS種別:Sophos UTM @@ -31,12 +31,6 @@ const ( Netwiser // OPNsense OS種別: OPNsense OPNsense - // Windows2012 OS種別:Windows Server 2012 R2 Datacenter Edition - Windows2012 - // Windows2012RDS OS種別:Windows Server 2012 R2 for RDS - Windows2012RDS - // Windows2012RDSOffice OS種別:Windows Server 2012 R2 for RDS(Office) - Windows2012RDSOffice // Windows2016 OS種別:Windows Server 2016 Datacenter Edition Windows2016 // Windows2016RDS OS種別:Windows Server 2016 RDS @@ -61,10 +55,9 @@ const ( // OSTypeShortNames OSTypeとして利用できる文字列のリスト var OSTypeShortNames = []string{ - "centos", "centos6", "ubuntu", "debian", "vyos", "coreos", - "rancheros", "kusanagi", "sophos-utm", "freebsd", + "centos", "centos6", "ubuntu", "debian", "coreos", + "rancheros", "k3os", "kusanagi", "sophos-utm", "freebsd", "netwiser", "opnsense", - "windows2012", "windows2012-rds", "windows2012-rds-office", "windows2016", "windows2016-rds", "windows2016-rds-office", "windows2016-sql-web", "windows2016-sql-standard", "windows2016-sql-standard-all", "windows2016-sql2017-standard", "windows2016-sql2017-standard-all", @@ -74,8 +67,7 @@ var OSTypeShortNames = []string{ // IsWindows Windowsか func (o ArchiveOSTypes) IsWindows() bool { switch o { - case Windows2012, Windows2012RDS, Windows2012RDSOffice, - Windows2016, Windows2016RDS, Windows2016RDSOffice, + case Windows2016, Windows2016RDS, Windows2016RDSOffice, Windows2016SQLServerWeb, Windows2016SQLServerStandard, Windows2016SQLServerStandardAll, Windows2016SQLServer2017Standard, Windows2016SQLServer2017StandardAll, Windows2019: @@ -88,7 +80,7 @@ func (o ArchiveOSTypes) IsWindows() bool { // IsSupportDiskEdit ディスクの修正機能をフルサポートしているか(Windowsは一部サポートのためfalseを返す) func (o ArchiveOSTypes) IsSupportDiskEdit() bool { switch o { - case CentOS, CentOS6, Ubuntu, Debian, VyOS, CoreOS, RancherOS, Kusanagi, FreeBSD: + case CentOS, CentOS6, Ubuntu, Debian, CoreOS, RancherOS, K3OS, Kusanagi, FreeBSD: return true default: return false @@ -106,12 +98,12 @@ func StrToOSType(osType string) ArchiveOSTypes { return Ubuntu case "debian": return Debian - case "vyos": - return VyOS case "coreos": return CoreOS case "rancheros": return RancherOS + case "k3os": + return K3OS case "kusanagi": return Kusanagi case "sophos-utm": @@ -122,12 +114,6 @@ func StrToOSType(osType string) ArchiveOSTypes { return Netwiser case "opnsense": return OPNsense - case "windows2012": - return Windows2012 - case "windows2012-rds": - return Windows2012RDS - case "windows2012-rds-office": - return Windows2012RDSOffice case "windows2016": return Windows2016 case "windows2016-rds": diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archiveostypes_string.go b/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archiveostypes_string.go index 77d31e27..04235224 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archiveostypes_string.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/ostype/archiveostypes_string.go @@ -4,9 +4,37 @@ package ostype import "strconv" -const _ArchiveOSTypes_name = "CentOSCentOS6UbuntuDebianVyOSCoreOSRancherOSKusanagiSophosUTMFreeBSDNetwiserOPNsenseWindows2012Windows2012RDSWindows2012RDSOfficeWindows2016Windows2016RDSWindows2016RDSOfficeWindows2016SQLServerWebWindows2016SQLServerStandardWindows2016SQLServer2017StandardWindows2016SQLServerStandardAllWindows2016SQLServer2017StandardAllWindows2019Custom" +func _() { + // An "invalid array index" compiler error signifies that the constant values have changed. + // Re-run the stringer command to generate them again. + var x [1]struct{} + _ = x[CentOS-0] + _ = x[CentOS6-1] + _ = x[Ubuntu-2] + _ = x[Debian-3] + _ = x[CoreOS-4] + _ = x[RancherOS-5] + _ = x[K3OS-6] + _ = x[Kusanagi-7] + _ = x[SophosUTM-8] + _ = x[FreeBSD-9] + _ = x[Netwiser-10] + _ = x[OPNsense-11] + _ = x[Windows2016-12] + _ = x[Windows2016RDS-13] + _ = x[Windows2016RDSOffice-14] + _ = x[Windows2016SQLServerWeb-15] + _ = x[Windows2016SQLServerStandard-16] + _ = x[Windows2016SQLServer2017Standard-17] + _ = x[Windows2016SQLServerStandardAll-18] + _ = x[Windows2016SQLServer2017StandardAll-19] + _ = x[Windows2019-20] + _ = x[Custom-21] +} -var _ArchiveOSTypes_index = [...]uint16{0, 6, 13, 19, 25, 29, 35, 44, 52, 61, 68, 76, 84, 95, 109, 129, 140, 154, 174, 197, 225, 257, 288, 323, 334, 340} +const _ArchiveOSTypes_name = "CentOSCentOS6UbuntuDebianCoreOSRancherOSK3OSKusanagiSophosUTMFreeBSDNetwiserOPNsenseWindows2016Windows2016RDSWindows2016RDSOfficeWindows2016SQLServerWebWindows2016SQLServerStandardWindows2016SQLServer2017StandardWindows2016SQLServerStandardAllWindows2016SQLServer2017StandardAllWindows2019Custom" + +var _ArchiveOSTypes_index = [...]uint16{0, 6, 13, 19, 25, 31, 40, 44, 52, 61, 68, 76, 84, 95, 109, 129, 152, 180, 212, 243, 278, 289, 295} func (i ArchiveOSTypes) String() string { if i < 0 || i >= ArchiveOSTypes(len(_ArchiveOSTypes_index)-1) { diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/product_server.go b/vendor/github.com/sacloud/libsacloud/sacloud/product_server.go index 593c342f..db2dc826 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/product_server.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/product_server.go @@ -10,4 +10,5 @@ type ProductServer struct { propMemoryMB // メモリサイズ(MB単位) propServiceClass // サービスクラス Generation PlanGenerations `json:",omitempty"` // 世代 + Commitment ECommitment `json:",omitempty"` } diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/proxylb.go b/vendor/github.com/sacloud/libsacloud/sacloud/proxylb.go index 64523e6a..61d00761 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/proxylb.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/proxylb.go @@ -56,9 +56,11 @@ func CreateNewProxyLB(name string) *ProxyLB { }, Settings: ProxyLBSettings{ ProxyLB: ProxyLBSetting{ - HealthCheck: defaultProxyLBHealthCheck, - SorryServer: ProxyLBSorryServer{}, - Servers: []ProxyLBServer{}, + HealthCheck: defaultProxyLBHealthCheck, + SorryServer: ProxyLBSorryServer{}, + Servers: []ProxyLBServer{}, + LetsEncrypt: ProxyLBACMESetting{}, + StickySession: ProxyLBSessionSetting{}, }, }, } @@ -68,6 +70,10 @@ func CreateNewProxyLB(name string) *ProxyLB { type ProxyLBPlan int var ( + // ProxyLBPlan100 100cpsプラン + ProxyLBPlan100 = ProxyLBPlan(100) + // ProxyLBPlan500 500cpsプラン + ProxyLBPlan500 = ProxyLBPlan(500) // ProxyLBPlan1000 1,000cpsプラン ProxyLBPlan1000 = ProxyLBPlan(1000) // ProxyLBPlan5000 5,000cpsプラン @@ -82,6 +88,8 @@ var ( // AllowProxyLBPlans 有効なプランIDリスト var AllowProxyLBPlans = []int{ + int(ProxyLBPlan100), + int(ProxyLBPlan500), int(ProxyLBPlan1000), int(ProxyLBPlan5000), int(ProxyLBPlan10000), @@ -156,8 +164,8 @@ func (p *ProxyLB) ClearProxyLBServer() { } // AddBindPort バインドポート追加 -func (p *ProxyLB) AddBindPort(mode string, port int) { - p.Settings.ProxyLB.AddBindPort(mode, port) +func (p *ProxyLB) AddBindPort(mode string, port int, redirectToHTTPS, supportHTTP2 bool) { + p.Settings.ProxyLB.AddBindPort(mode, port, redirectToHTTPS, supportHTTP2) } // DeleteBindPort バインドポート削除 @@ -182,10 +190,12 @@ func (p *ProxyLB) DeleteServer(ip string, port int) { // ProxyLBSetting ProxyLBセッティング type ProxyLBSetting struct { - HealthCheck ProxyLBHealthCheck `json:",omitempty"` // ヘルスチェック - SorryServer ProxyLBSorryServer `json:",omitempty"` // ソーリーサーバー - BindPorts []*ProxyLBBindPorts `json:",omitempty"` // プロキシ方式(プロトコル&ポート) - Servers []ProxyLBServer `json:",omitempty"` // サーバー + HealthCheck ProxyLBHealthCheck `json:",omitempty"` // ヘルスチェック + SorryServer ProxyLBSorryServer `json:",omitempty"` // ソーリーサーバー + BindPorts []*ProxyLBBindPorts `json:",omitempty"` // プロキシ方式(プロトコル&ポート) + Servers []ProxyLBServer `json:",omitempty"` // サーバー + LetsEncrypt ProxyLBACMESetting `json:",omitempty"` // Let's encryptでの証明書取得設定 + StickySession ProxyLBSessionSetting `json:",omitempty"` } // ProxyLBSorryServer ソーリーサーバ @@ -195,7 +205,7 @@ type ProxyLBSorryServer struct { } // AddBindPort バインドポート追加 -func (s *ProxyLBSetting) AddBindPort(mode string, port int) { +func (s *ProxyLBSetting) AddBindPort(mode string, port int, redirectToHTTPS, supportHTTP2 bool) { var isExist bool for i := range s.BindPorts { if s.BindPorts[i].ProxyMode == mode && s.BindPorts[i].Port == port { @@ -205,8 +215,10 @@ func (s *ProxyLBSetting) AddBindPort(mode string, port int) { if !isExist { s.BindPorts = append(s.BindPorts, &ProxyLBBindPorts{ - ProxyMode: mode, - Port: port, + ProxyMode: mode, + Port: port, + RedirectToHTTPS: redirectToHTTPS, + SupportHTTP2: supportHTTP2, }) } } @@ -260,15 +272,17 @@ var AllowProxyLBBindModes = []string{"http", "https"} // ProxyLBBindPorts プロキシ方式 type ProxyLBBindPorts struct { - ProxyMode string `json:",omitempty"` // モード(プロトコル) - Port int `json:",omitempty"` // ポート + ProxyMode string `json:",omitempty"` // モード(プロトコル) + Port int `json:",omitempty"` // ポート + RedirectToHTTPS bool `json:"RedirectToHttps"` // HTTPSへのリダイレクト(モードがhttpの場合のみ) + SupportHTTP2 bool `json:"SupportHttp2"` // HTTP/2のサポート(モードがhttpsの場合のみ) } // ProxyLBServer ProxyLB配下のサーバー type ProxyLBServer struct { IPAddress string `json:",omitempty"` // IPアドレス Port int `json:",omitempty"` // ポート - Enabled bool `json:",omitempty"` // 有効/無効 + Enabled bool // 有効/無効 } // NewProxyLBServer ProxyLB配下のサーバ作成 @@ -280,6 +294,21 @@ func NewProxyLBServer(ipaddress string, port int) *ProxyLBServer { } } +// ProxyLBACMESetting Let's Encryptでの証明書取得設定 +type ProxyLBACMESetting struct { + Enabled bool + CommonName string `json:",omitempty"` +} + +// ProxyLBSessionSetting セッション維持機能設定 +type ProxyLBSessionSetting struct { + Enabled bool + Method string `json:",omitempty"` +} + +// ProxyLBStickySessionDefaultMethod セッション維持のデフォルトメソッド(クッキー) +const ProxyLBStickySessionDefaultMethod = "cookie" + // AllowProxyLBHealthCheckProtocols プロキシLBで利用できるヘルスチェックプロトコル var AllowProxyLBHealthCheckProtocols = []string{"http", "tcp"} diff --git a/vendor/github.com/sacloud/libsacloud/sacloud/sim.go b/vendor/github.com/sacloud/libsacloud/sacloud/sim.go index a663b150..165009e3 100644 --- a/vendor/github.com/sacloud/libsacloud/sacloud/sim.go +++ b/vendor/github.com/sacloud/libsacloud/sacloud/sim.go @@ -52,7 +52,7 @@ type SIMInfo struct { RegisteredDate *time.Time `json:"registered_date,omitempty"` ActivatedDate *time.Time `json:"activated_date,omitempty"` DeactivatedDate *time.Time `json:"deactivated_date,omitempty"` - SIMGroupID string `json:"simgroiup_id,omitempty"` + SIMGroupID string `json:"simgroup_id,omitempty"` TrafficBytesOfCurrentMonth *SIMTrafficBytes `json:"traffic_bytes_of_current_month,omitempty"` ConnectedIMEI string `json:"connected_imei,omitempty"` } diff --git a/vendor/github.com/satori/go.uuid/LICENSE b/vendor/github.com/satori/go.uuid/LICENSE deleted file mode 100644 index 926d5498..00000000 --- a/vendor/github.com/satori/go.uuid/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -Copyright (C) 2013-2018 by Maxim Bublis - -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/satori/go.uuid/codec.go b/vendor/github.com/satori/go.uuid/codec.go deleted file mode 100644 index 656892c5..00000000 --- a/vendor/github.com/satori/go.uuid/codec.go +++ /dev/null @@ -1,206 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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 uuid - -import ( - "bytes" - "encoding/hex" - "fmt" -) - -// FromBytes returns UUID converted from raw byte slice input. -// It will return error if the slice isn't 16 bytes long. -func FromBytes(input []byte) (u UUID, err error) { - err = u.UnmarshalBinary(input) - return -} - -// FromBytesOrNil returns UUID converted from raw byte slice input. -// Same behavior as FromBytes, but returns a Nil UUID on error. -func FromBytesOrNil(input []byte) UUID { - uuid, err := FromBytes(input) - if err != nil { - return Nil - } - return uuid -} - -// FromString returns UUID parsed from string input. -// Input is expected in a form accepted by UnmarshalText. -func FromString(input string) (u UUID, err error) { - err = u.UnmarshalText([]byte(input)) - return -} - -// FromStringOrNil returns UUID parsed from string input. -// Same behavior as FromString, but returns a Nil UUID on error. -func FromStringOrNil(input string) UUID { - uuid, err := FromString(input) - if err != nil { - return Nil - } - return uuid -} - -// MarshalText implements the encoding.TextMarshaler interface. -// The encoding is the same as returned by String. -func (u UUID) MarshalText() (text []byte, err error) { - text = []byte(u.String()) - return -} - -// UnmarshalText implements the encoding.TextUnmarshaler interface. -// Following formats are supported: -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8", -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}", -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" -// "6ba7b8109dad11d180b400c04fd430c8" -// ABNF for supported UUID text representation follows: -// uuid := canonical | hashlike | braced | urn -// plain := canonical | hashlike -// canonical := 4hexoct '-' 2hexoct '-' 2hexoct '-' 6hexoct -// hashlike := 12hexoct -// braced := '{' plain '}' -// urn := URN ':' UUID-NID ':' plain -// URN := 'urn' -// UUID-NID := 'uuid' -// 12hexoct := 6hexoct 6hexoct -// 6hexoct := 4hexoct 2hexoct -// 4hexoct := 2hexoct 2hexoct -// 2hexoct := hexoct hexoct -// hexoct := hexdig hexdig -// hexdig := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9' | -// 'a' | 'b' | 'c' | 'd' | 'e' | 'f' | -// 'A' | 'B' | 'C' | 'D' | 'E' | 'F' -func (u *UUID) UnmarshalText(text []byte) (err error) { - switch len(text) { - case 32: - return u.decodeHashLike(text) - case 36: - return u.decodeCanonical(text) - case 38: - return u.decodeBraced(text) - case 41: - fallthrough - case 45: - return u.decodeURN(text) - default: - return fmt.Errorf("uuid: incorrect UUID length: %s", text) - } -} - -// decodeCanonical decodes UUID string in format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8". -func (u *UUID) decodeCanonical(t []byte) (err error) { - if t[8] != '-' || t[13] != '-' || t[18] != '-' || t[23] != '-' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - src := t[:] - dst := u[:] - - for i, byteGroup := range byteGroups { - if i > 0 { - src = src[1:] // skip dash - } - _, err = hex.Decode(dst[:byteGroup/2], src[:byteGroup]) - if err != nil { - return - } - src = src[byteGroup:] - dst = dst[byteGroup/2:] - } - - return -} - -// decodeHashLike decodes UUID string in format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeHashLike(t []byte) (err error) { - src := t[:] - dst := u[:] - - if _, err = hex.Decode(dst, src); err != nil { - return err - } - return -} - -// decodeBraced decodes UUID string in format -// "{6ba7b810-9dad-11d1-80b4-00c04fd430c8}" or in format -// "{6ba7b8109dad11d180b400c04fd430c8}". -func (u *UUID) decodeBraced(t []byte) (err error) { - l := len(t) - - if t[0] != '{' || t[l-1] != '}' { - return fmt.Errorf("uuid: incorrect UUID format %s", t) - } - - return u.decodePlain(t[1 : l-1]) -} - -// decodeURN decodes UUID string in format -// "urn:uuid:6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in format -// "urn:uuid:6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodeURN(t []byte) (err error) { - total := len(t) - - urn_uuid_prefix := t[:9] - - if !bytes.Equal(urn_uuid_prefix, urnPrefix) { - return fmt.Errorf("uuid: incorrect UUID format: %s", t) - } - - return u.decodePlain(t[9:total]) -} - -// decodePlain decodes UUID string in canonical format -// "6ba7b810-9dad-11d1-80b4-00c04fd430c8" or in hash-like format -// "6ba7b8109dad11d180b400c04fd430c8". -func (u *UUID) decodePlain(t []byte) (err error) { - switch len(t) { - case 32: - return u.decodeHashLike(t) - case 36: - return u.decodeCanonical(t) - default: - return fmt.Errorf("uuid: incorrrect UUID length: %s", t) - } -} - -// MarshalBinary implements the encoding.BinaryMarshaler interface. -func (u UUID) MarshalBinary() (data []byte, err error) { - data = u.Bytes() - return -} - -// UnmarshalBinary implements the encoding.BinaryUnmarshaler interface. -// It will return error if the slice isn't 16 bytes long. -func (u *UUID) UnmarshalBinary(data []byte) (err error) { - if len(data) != Size { - err = fmt.Errorf("uuid: UUID must be exactly 16 bytes long, got %d bytes", len(data)) - return - } - copy(u[:], data) - - return -} diff --git a/vendor/github.com/satori/go.uuid/generator.go b/vendor/github.com/satori/go.uuid/generator.go deleted file mode 100644 index 3f2f1da2..00000000 --- a/vendor/github.com/satori/go.uuid/generator.go +++ /dev/null @@ -1,239 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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 uuid - -import ( - "crypto/md5" - "crypto/rand" - "crypto/sha1" - "encoding/binary" - "hash" - "net" - "os" - "sync" - "time" -) - -// Difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and Unix epoch (January 1, 1970). -const epochStart = 122192928000000000 - -var ( - global = newDefaultGenerator() - - epochFunc = unixTimeFunc - posixUID = uint32(os.Getuid()) - posixGID = uint32(os.Getgid()) -) - -// NewV1 returns UUID based on current timestamp and MAC address. -func NewV1() UUID { - return global.NewV1() -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func NewV2(domain byte) UUID { - return global.NewV2(domain) -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func NewV3(ns UUID, name string) UUID { - return global.NewV3(ns, name) -} - -// NewV4 returns random generated UUID. -func NewV4() UUID { - return global.NewV4() -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func NewV5(ns UUID, name string) UUID { - return global.NewV5(ns, name) -} - -// Generator provides interface for generating UUIDs. -type Generator interface { - NewV1() UUID - NewV2(domain byte) UUID - NewV3(ns UUID, name string) UUID - NewV4() UUID - NewV5(ns UUID, name string) UUID -} - -// Default generator implementation. -type generator struct { - storageOnce sync.Once - storageMutex sync.Mutex - - lastTime uint64 - clockSequence uint16 - hardwareAddr [6]byte -} - -func newDefaultGenerator() Generator { - return &generator{} -} - -// NewV1 returns UUID based on current timestamp and MAC address. -func (g *generator) NewV1() UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - binary.BigEndian.PutUint32(u[0:], uint32(timeNow)) - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - - copy(u[10:], hardwareAddr) - - u.SetVersion(V1) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV2 returns DCE Security UUID based on POSIX UID/GID. -func (g *generator) NewV2(domain byte) UUID { - u := UUID{} - - timeNow, clockSeq, hardwareAddr := g.getStorage() - - switch domain { - case DomainPerson: - binary.BigEndian.PutUint32(u[0:], posixUID) - case DomainGroup: - binary.BigEndian.PutUint32(u[0:], posixGID) - } - - binary.BigEndian.PutUint16(u[4:], uint16(timeNow>>32)) - binary.BigEndian.PutUint16(u[6:], uint16(timeNow>>48)) - binary.BigEndian.PutUint16(u[8:], clockSeq) - u[9] = domain - - copy(u[10:], hardwareAddr) - - u.SetVersion(V2) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV3 returns UUID based on MD5 hash of namespace UUID and name. -func (g *generator) NewV3(ns UUID, name string) UUID { - u := newFromHash(md5.New(), ns, name) - u.SetVersion(V3) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV4 returns random generated UUID. -func (g *generator) NewV4() UUID { - u := UUID{} - g.safeRandom(u[:]) - u.SetVersion(V4) - u.SetVariant(VariantRFC4122) - - return u -} - -// NewV5 returns UUID based on SHA-1 hash of namespace UUID and name. -func (g *generator) NewV5(ns UUID, name string) UUID { - u := newFromHash(sha1.New(), ns, name) - u.SetVersion(V5) - u.SetVariant(VariantRFC4122) - - return u -} - -func (g *generator) initStorage() { - g.initClockSequence() - g.initHardwareAddr() -} - -func (g *generator) initClockSequence() { - buf := make([]byte, 2) - g.safeRandom(buf) - g.clockSequence = binary.BigEndian.Uint16(buf) -} - -func (g *generator) initHardwareAddr() { - interfaces, err := net.Interfaces() - if err == nil { - for _, iface := range interfaces { - if len(iface.HardwareAddr) >= 6 { - copy(g.hardwareAddr[:], iface.HardwareAddr) - return - } - } - } - - // Initialize hardwareAddr randomly in case - // of real network interfaces absence - g.safeRandom(g.hardwareAddr[:]) - - // Set multicast bit as recommended in RFC 4122 - g.hardwareAddr[0] |= 0x01 -} - -func (g *generator) safeRandom(dest []byte) { - if _, err := rand.Read(dest); err != nil { - panic(err) - } -} - -// Returns UUID v1/v2 storage state. -// Returns epoch timestamp, clock sequence, and hardware address. -func (g *generator) getStorage() (uint64, uint16, []byte) { - g.storageOnce.Do(g.initStorage) - - g.storageMutex.Lock() - defer g.storageMutex.Unlock() - - timeNow := epochFunc() - // Clock changed backwards since last UUID generation. - // Should increase clock sequence. - if timeNow <= g.lastTime { - g.clockSequence++ - } - g.lastTime = timeNow - - return timeNow, g.clockSequence, g.hardwareAddr[:] -} - -// Returns difference in 100-nanosecond intervals between -// UUID epoch (October 15, 1582) and current time. -// This is default epoch calculation function. -func unixTimeFunc() uint64 { - return epochStart + uint64(time.Now().UnixNano()/100) -} - -// Returns UUID based on hashing of namespace UUID and name. -func newFromHash(h hash.Hash, ns UUID, name string) UUID { - u := UUID{} - h.Write(ns[:]) - h.Write([]byte(name)) - copy(u[:], h.Sum(nil)) - - return u -} diff --git a/vendor/github.com/satori/go.uuid/sql.go b/vendor/github.com/satori/go.uuid/sql.go deleted file mode 100644 index 56759d39..00000000 --- a/vendor/github.com/satori/go.uuid/sql.go +++ /dev/null @@ -1,78 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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 uuid - -import ( - "database/sql/driver" - "fmt" -) - -// Value implements the driver.Valuer interface. -func (u UUID) Value() (driver.Value, error) { - return u.String(), nil -} - -// Scan implements the sql.Scanner interface. -// A 16-byte slice is handled by UnmarshalBinary, while -// a longer byte slice or a string is handled by UnmarshalText. -func (u *UUID) Scan(src interface{}) error { - switch src := src.(type) { - case []byte: - if len(src) == Size { - return u.UnmarshalBinary(src) - } - return u.UnmarshalText(src) - - case string: - return u.UnmarshalText([]byte(src)) - } - - return fmt.Errorf("uuid: cannot convert %T to UUID", src) -} - -// NullUUID can be used with the standard sql package to represent a -// UUID value that can be NULL in the database -type NullUUID struct { - UUID UUID - Valid bool -} - -// Value implements the driver.Valuer interface. -func (u NullUUID) Value() (driver.Value, error) { - if !u.Valid { - return nil, nil - } - // Delegate to UUID Value function - return u.UUID.Value() -} - -// Scan implements the sql.Scanner interface. -func (u *NullUUID) Scan(src interface{}) error { - if src == nil { - u.UUID, u.Valid = Nil, false - return nil - } - - // Delegate to UUID Scan function - u.Valid = true - return u.UUID.Scan(src) -} diff --git a/vendor/github.com/satori/go.uuid/uuid.go b/vendor/github.com/satori/go.uuid/uuid.go deleted file mode 100644 index a2b8e2ca..00000000 --- a/vendor/github.com/satori/go.uuid/uuid.go +++ /dev/null @@ -1,161 +0,0 @@ -// Copyright (C) 2013-2018 by Maxim Bublis -// -// 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 uuid provides implementation of Universally Unique Identifier (UUID). -// Supported versions are 1, 3, 4 and 5 (as specified in RFC 4122) and -// version 2 (as specified in DCE 1.1). -package uuid - -import ( - "bytes" - "encoding/hex" -) - -// Size of a UUID in bytes. -const Size = 16 - -// UUID representation compliant with specification -// described in RFC 4122. -type UUID [Size]byte - -// UUID versions -const ( - _ byte = iota - V1 - V2 - V3 - V4 - V5 -) - -// UUID layout variants. -const ( - VariantNCS byte = iota - VariantRFC4122 - VariantMicrosoft - VariantFuture -) - -// UUID DCE domains. -const ( - DomainPerson = iota - DomainGroup - DomainOrg -) - -// String parse helpers. -var ( - urnPrefix = []byte("urn:uuid:") - byteGroups = []int{8, 4, 4, 4, 12} -) - -// Nil is special form of UUID that is specified to have all -// 128 bits set to zero. -var Nil = UUID{} - -// Predefined namespace UUIDs. -var ( - NamespaceDNS = Must(FromString("6ba7b810-9dad-11d1-80b4-00c04fd430c8")) - NamespaceURL = Must(FromString("6ba7b811-9dad-11d1-80b4-00c04fd430c8")) - NamespaceOID = Must(FromString("6ba7b812-9dad-11d1-80b4-00c04fd430c8")) - NamespaceX500 = Must(FromString("6ba7b814-9dad-11d1-80b4-00c04fd430c8")) -) - -// Equal returns true if u1 and u2 equals, otherwise returns false. -func Equal(u1 UUID, u2 UUID) bool { - return bytes.Equal(u1[:], u2[:]) -} - -// Version returns algorithm version used to generate UUID. -func (u UUID) Version() byte { - return u[6] >> 4 -} - -// Variant returns UUID layout variant. -func (u UUID) Variant() byte { - switch { - case (u[8] >> 7) == 0x00: - return VariantNCS - case (u[8] >> 6) == 0x02: - return VariantRFC4122 - case (u[8] >> 5) == 0x06: - return VariantMicrosoft - case (u[8] >> 5) == 0x07: - fallthrough - default: - return VariantFuture - } -} - -// Bytes returns bytes slice representation of UUID. -func (u UUID) Bytes() []byte { - return u[:] -} - -// Returns canonical string representation of UUID: -// xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx. -func (u UUID) String() string { - buf := make([]byte, 36) - - hex.Encode(buf[0:8], u[0:4]) - buf[8] = '-' - hex.Encode(buf[9:13], u[4:6]) - buf[13] = '-' - hex.Encode(buf[14:18], u[6:8]) - buf[18] = '-' - hex.Encode(buf[19:23], u[8:10]) - buf[23] = '-' - hex.Encode(buf[24:], u[10:]) - - return string(buf) -} - -// SetVersion sets version bits. -func (u *UUID) SetVersion(v byte) { - u[6] = (u[6] & 0x0f) | (v << 4) -} - -// SetVariant sets variant bits. -func (u *UUID) SetVariant(v byte) { - switch v { - case VariantNCS: - u[8] = (u[8]&(0xff>>1) | (0x00 << 7)) - case VariantRFC4122: - u[8] = (u[8]&(0xff>>2) | (0x02 << 6)) - case VariantMicrosoft: - u[8] = (u[8]&(0xff>>3) | (0x06 << 5)) - case VariantFuture: - fallthrough - default: - u[8] = (u[8]&(0xff>>3) | (0x07 << 5)) - } -} - -// Must is a helper that wraps a call to a function returning (UUID, error) -// and panics if the error is non-nil. It is intended for use in variable -// initializations such as -// var packageUUID = uuid.Must(uuid.FromString("123e4567-e89b-12d3-a456-426655440000")); -func Must(u UUID, err error) UUID { - if err != nil { - panic(err) - } - return u -} diff --git a/vendor/github.com/transip/gotransip/domain/api.go b/vendor/github.com/transip/gotransip/domain/api.go index df68db3e..830da852 100644 --- a/vendor/github.com/transip/gotransip/domain/api.go +++ b/vendor/github.com/transip/gotransip/domain/api.go @@ -117,15 +117,19 @@ func GetIsLocked(c gotransip.Client, domainName string) (bool, error) { return v, err } -// Register registers a domain name and will automatically create and sign a proposition for it -func Register(c gotransip.Client, domain Domain) error { +// Register registers a domain name and will automatically create and sign a +// proposition for it. It returns the TransIP proposition number or an error +// when registering the domain fails +func Register(c gotransip.Client, domain Domain) (string, error) { sr := gotransip.SoapRequest{ Service: serviceName, Method: "register", } sr.AddArgument("domain", domain) - return c.Call(sr, nil) + var v string + err := c.Call(sr, &v) + return v, err } // Cancel cancels a domain name, will automatically create and sign a cancellation document @@ -140,8 +144,9 @@ func Cancel(c gotransip.Client, domainName string, endTime gotransip.Cancellatio return c.Call(sr, nil) } -// TransferWithOwnerChange transfers a domain with changing the owner -func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) error { +// TransferWithOwnerChange transfers a domain with changing the owner. It returns +// the TransIP proposition number or an error when transferring the domain fails +func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) (string, error) { sr := gotransip.SoapRequest{ Service: serviceName, Method: "transferWithOwnerChange", @@ -149,11 +154,15 @@ func TransferWithOwnerChange(c gotransip.Client, domain, authCode string) error sr.AddArgument("domain", domain) sr.AddArgument("authCode", authCode) - return c.Call(sr, nil) + var v string + err := c.Call(sr, &v) + return v, err } -// TransferWithoutOwnerChange transfers a domain without changing the owner -func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) error { +// TransferWithoutOwnerChange transfers a domain without changing the owner. It +// returns the TransIP proposition number or an error when transferring the domain +// fails +func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) (string, error) { sr := gotransip.SoapRequest{ Service: serviceName, Method: "transferWithoutOwnerChange", @@ -161,7 +170,9 @@ func TransferWithoutOwnerChange(c gotransip.Client, domain, authCode string) err sr.AddArgument("domain", domain) sr.AddArgument("authCode", authCode) - return c.Call(sr, nil) + var v string + err := c.Call(sr, &v) + return v, err } // SetNameservers starts a nameserver change for this domain, will replace all @@ -203,7 +214,7 @@ func UnsetLock(c gotransip.Client, domainName string) error { // dns entries with the new entries func SetDNSEntries(c gotransip.Client, domainName string, dnsEntries DNSEntries) error { sr := gotransip.SoapRequest{ - Service: serviceName, + Service: dnsServiceName, Method: "setDnsEntries", } sr.AddArgument("domainName", domainName) @@ -312,3 +323,81 @@ func CancelDomainAction(c gotransip.Client, domain string) error { return c.Call(sr, nil) } + +// RequestAuthCode requests the authcode at the registry +func RequestAuthCode(c gotransip.Client, domainName string) (string, error) { + sr := gotransip.SoapRequest{ + Service: serviceName, + Method: "requestAuthCode", + } + sr.AddArgument("domain", domainName) + + var v string + err := c.Call(sr, &v) + return v, err +} + +// Handover a Domain to another TransIP User. Please be aware that this will NOT +// change the owner contact information at the registry. If you want to change +// the domain owner at the registry, then you should execute a 'SetOwner'. +func Handover(c gotransip.Client, domainName, targetAccountName string) error { + sr := gotransip.SoapRequest{ + Service: serviceName, + Method: "handover", + } + sr.AddArgument("domainName", domainName) + sr.AddArgument("targetAccountname", targetAccountName) + + return c.Call(sr, nil) +} + +// CanEditDNSSec checks if the DNSSec entries of a domain can be updated. +func CanEditDNSSec(c gotransip.Client, domainName string) (bool, error) { + sr := gotransip.SoapRequest{ + Service: dnsServiceName, + Method: "canEditDnsSec", + } + sr.AddArgument("domainName", domainName) + + var v bool + err := c.Call(sr, &v) + return v, err +} + +// GetDNSSecEntries returns DNSSec entries for given domain name +func GetDNSSecEntries(c gotransip.Client, domainName string) (DNSSecEntries, error) { + sr := gotransip.SoapRequest{ + Service: dnsServiceName, + Method: "getDnsSecEntries", + } + sr.AddArgument("domainName", domainName) + + var v struct { + V DNSSecEntries `xml:"item"` + } + err := c.Call(sr, &v) + return v.V, err +} + +// SetDNSSecEntries sets new DNSSec entries for a domain, replacing the current ones. +func SetDNSSecEntries(c gotransip.Client, domainName string, dnssecKeyEntrySet DNSSecEntries) error { + sr := gotransip.SoapRequest{ + Service: dnsServiceName, + Method: "setDnsSecEntries", + } + sr.AddArgument("domainName", domainName) + sr.AddArgument("dnssecKeyEntrySet", dnssecKeyEntrySet) + + return c.Call(sr, nil) +} + +// RemoveAllDNSSecEntries removes all the DNSSec entries from a domain. +func RemoveAllDNSSecEntries(c gotransip.Client, domainName string) error { + sr := gotransip.SoapRequest{ + Service: dnsServiceName, + Method: "removeAllDnsSecEntries", + } + sr.AddArgument("domainName", domainName) + + return c.Call(sr, nil) +} diff --git a/vendor/github.com/transip/gotransip/domain/domain.go b/vendor/github.com/transip/gotransip/domain/domain.go index a3b5e4b8..ca6a0741 100644 --- a/vendor/github.com/transip/gotransip/domain/domain.go +++ b/vendor/github.com/transip/gotransip/domain/domain.go @@ -9,7 +9,8 @@ import ( ) const ( - serviceName string = "DomainService" + serviceName string = "DomainService" + dnsServiceName string = "DnsService" ) // Domain represents a Transip_Domain object @@ -240,6 +241,98 @@ func (d DNSEntries) EncodeArgs(key string) string { return fmt.Sprintf("%s", output, key) } +// DNSSecAlgorithm represents the possible types of DNSSec algorithms +type DNSSecAlgorithm int + +const ( + // DNSSecAlgorithmDSA represents DSA + DNSSecAlgorithmDSA DNSSecAlgorithm = iota + 3 + _ + // DNSSecAlgorithmRSASHA1 represents RSASHA1 + DNSSecAlgorithmRSASHA1 + // DNSSecAlgorithmDSANSEC3SHA1 represents DSANSEC3SHA1 + DNSSecAlgorithmDSANSEC3SHA1 + // DNSSecAlgorithmRSASHA1NSEC3SHA1 represents RSASHA1NSEC3SHA1 + DNSSecAlgorithmRSASHA1NSEC3SHA1 + // DNSSecAlgorithmRSASHA256 represents RSASHA256 + DNSSecAlgorithmRSASHA256 + // DNSSecAlgorithmRSASHA512 represents RSASHA512 + DNSSecAlgorithmRSASHA512 DNSSecAlgorithm = iota + 4 + _ + // DNSSecAlgorithmECCGOST represents ECCGOST + DNSSecAlgorithmECCGOST + // DNSSecAlgorithmECDSAP256SHA256 represents ECDSAP256SHA256 + DNSSecAlgorithmECDSAP256SHA256 + // DNSSecAlgorithmECDSAP384SHA384 represents ECDSAP384SHA384 + DNSSecAlgorithmECDSAP384SHA384 + // DNSSecAlgorithmED25519 represents ED25519 + DNSSecAlgorithmED25519 + // DNSSecAlgorithmED448 represents ED448 + DNSSecAlgorithmED448 +) + +// DNSSecFlag represents the possible types of DNSSec flags +type DNSSecFlag int + +const ( + // DNSSecFlagNone means no flag is set + DNSSecFlagNone DNSSecFlag = 0 + // DNSSecFlagZSK means this is a Zone Signing Key + DNSSecFlagZSK DNSSecFlag = 256 + // DNSSecFlagKSK means this is a Key Signing Key + DNSSecFlagKSK DNSSecFlag = 257 +) + +// DNSSecEntry represents a Transip_DnsSecEntry object as described at +// https://api.transip.nl/docs/transip.nl/class-Transip_DnsSecEntry.html +type DNSSecEntry struct { + KeyTag int `xml:"keyTag"` + Flags DNSSecFlag `xml:"flags"` + Algorithm DNSSecAlgorithm `xml:"algorithm"` + PublicKey string `xml:"publicKey"` +} + +// DNSSecEntries is just an array of DNSSecEntry +// basically only here so it can implement paramsEncoder +type DNSSecEntries []DNSSecEntry + +// EncodeParams returns DNSSecEntries parameters ready to be used for constructing +// a signature +// the order of parameters added here has to match the order in the WSDL as +// described at http://api.transip.nl/wsdl/?service=DnsService +func (d DNSSecEntries) EncodeParams(prm gotransip.ParamsContainer, prefix string) { + if len(d) == 0 { + prm.Add("anything", nil) + return + } + + if len(prefix) == 0 { + prefix = fmt.Sprintf("%d", prm.Len()) + } + + for i, e := range d { + prm.Add(fmt.Sprintf("%s[%d][keyTag]", prefix, i), fmt.Sprintf("%d", e.KeyTag)) + prm.Add(fmt.Sprintf("%s[%d][flags]", prefix, i), fmt.Sprintf("%d", e.Flags)) + prm.Add(fmt.Sprintf("%s[%d][algorithm]", prefix, i), fmt.Sprintf("%d", e.Algorithm)) + prm.Add(fmt.Sprintf("%s[%d][publicKey]", prefix, i), e.PublicKey) + } +} + +// EncodeArgs returns Entries XML body ready to be passed in the SOAP call +func (d DNSSecEntries) EncodeArgs(key string) string { + output := fmt.Sprintf(`<%s SOAP-ENC:arrayType="ns1:DnsSecEntry[%d]" xsi:type="ns1:ArrayOfDnsSecEntry">`, key, len(d)) + "\n" + for _, e := range d { + output += fmt.Sprintf(` + %d + %d + %d + %s + `, e.KeyTag, e.Flags, e.Algorithm, e.PublicKey) + "\n" + } + + return fmt.Sprintf("%s", output, key) +} + // Status reflects the current status of a domain in a check result type Status string @@ -298,14 +391,14 @@ func (b Branding) EncodeParams(prm gotransip.ParamsContainer, prefix string) { // EncodeArgs returns Branding XML body ready to be passed in the SOAP call func (b Branding) EncodeArgs(key string) string { return fmt.Sprintf(` - %s - %s - %s - %s - %s - %s - %s - `, b.CompanyName, b.SupportEmail, b.CompanyURL, b.TermsOfUsageURL, b.BannerLine1, b.BannerLine2, b.BannerLine3) + %s + %s + %s + %s + %s + %s + %s +`, b.CompanyName, b.SupportEmail, b.CompanyURL, b.TermsOfUsageURL, b.BannerLine1, b.BannerLine2, b.BannerLine3) } // Action reflects the available actions to perform on a domain diff --git a/vendor/go.opencensus.io/opencensus.go b/vendor/go.opencensus.io/opencensus.go index d2565f1e..2d9c089a 100644 --- a/vendor/go.opencensus.io/opencensus.go +++ b/vendor/go.opencensus.io/opencensus.go @@ -17,5 +17,5 @@ package opencensus // import "go.opencensus.io" // Version is the current release version of OpenCensus in use. func Version() string { - return "0.21.0" + return "0.19.3" } diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/client.go b/vendor/go.opencensus.io/plugin/ocgrpc/client.go new file mode 100644 index 00000000..a6c466ae --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/client.go @@ -0,0 +1,56 @@ +// Copyright 2018, OpenCensus 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 ocgrpc + +import ( + "go.opencensus.io/trace" + "golang.org/x/net/context" + + "google.golang.org/grpc/stats" +) + +// ClientHandler implements a gRPC stats.Handler for recording OpenCensus stats and +// traces. Use with gRPC clients only. +type ClientHandler struct { + // StartOptions allows configuring the StartOptions used to create new spans. + // + // StartOptions.SpanKind will always be set to trace.SpanKindClient + // for spans started by this handler. + StartOptions trace.StartOptions +} + +// HandleConn exists to satisfy gRPC stats.Handler. +func (c *ClientHandler) HandleConn(ctx context.Context, cs stats.ConnStats) { + // no-op +} + +// TagConn exists to satisfy gRPC stats.Handler. +func (c *ClientHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context { + // no-op + return ctx +} + +// HandleRPC implements per-RPC tracing and stats instrumentation. +func (c *ClientHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + traceHandleRPC(ctx, rs) + statsHandleRPC(ctx, rs) +} + +// TagRPC implements per-RPC context management. +func (c *ClientHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context { + ctx = c.traceTagRPC(ctx, rti) + ctx = c.statsTagRPC(ctx, rti) + return ctx +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/client_metrics.go b/vendor/go.opencensus.io/plugin/ocgrpc/client_metrics.go new file mode 100644 index 00000000..abe978b6 --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/client_metrics.go @@ -0,0 +1,107 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" +) + +// The following variables are measures are recorded by ClientHandler: +var ( + ClientSentMessagesPerRPC = stats.Int64("grpc.io/client/sent_messages_per_rpc", "Number of messages sent in the RPC (always 1 for non-streaming RPCs).", stats.UnitDimensionless) + ClientSentBytesPerRPC = stats.Int64("grpc.io/client/sent_bytes_per_rpc", "Total bytes sent across all request messages per RPC.", stats.UnitBytes) + ClientReceivedMessagesPerRPC = stats.Int64("grpc.io/client/received_messages_per_rpc", "Number of response messages received per RPC (always 1 for non-streaming RPCs).", stats.UnitDimensionless) + ClientReceivedBytesPerRPC = stats.Int64("grpc.io/client/received_bytes_per_rpc", "Total bytes received across all response messages per RPC.", stats.UnitBytes) + ClientRoundtripLatency = stats.Float64("grpc.io/client/roundtrip_latency", "Time between first byte of request sent to last byte of response received, or terminal error.", stats.UnitMilliseconds) + ClientServerLatency = stats.Float64("grpc.io/client/server_latency", `Propagated from the server and should have the same value as "grpc.io/server/latency".`, stats.UnitMilliseconds) +) + +// Predefined views may be registered to collect data for the above measures. +// As always, you may also define your own custom views over measures collected by this +// package. These are declared as a convenience only; none are registered by +// default. +var ( + ClientSentBytesPerRPCView = &view.View{ + Measure: ClientSentBytesPerRPC, + Name: "grpc.io/client/sent_bytes_per_rpc", + Description: "Distribution of bytes sent per RPC, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultBytesDistribution, + } + + ClientReceivedBytesPerRPCView = &view.View{ + Measure: ClientReceivedBytesPerRPC, + Name: "grpc.io/client/received_bytes_per_rpc", + Description: "Distribution of bytes received per RPC, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultBytesDistribution, + } + + ClientRoundtripLatencyView = &view.View{ + Measure: ClientRoundtripLatency, + Name: "grpc.io/client/roundtrip_latency", + Description: "Distribution of round-trip latency, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultMillisecondsDistribution, + } + + ClientCompletedRPCsView = &view.View{ + Measure: ClientRoundtripLatency, + Name: "grpc.io/client/completed_rpcs", + Description: "Count of RPCs by method and status.", + TagKeys: []tag.Key{KeyClientMethod, KeyClientStatus}, + Aggregation: view.Count(), + } + + ClientSentMessagesPerRPCView = &view.View{ + Measure: ClientSentMessagesPerRPC, + Name: "grpc.io/client/sent_messages_per_rpc", + Description: "Distribution of sent messages count per RPC, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultMessageCountDistribution, + } + + ClientReceivedMessagesPerRPCView = &view.View{ + Measure: ClientReceivedMessagesPerRPC, + Name: "grpc.io/client/received_messages_per_rpc", + Description: "Distribution of received messages count per RPC, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultMessageCountDistribution, + } + + ClientServerLatencyView = &view.View{ + Measure: ClientServerLatency, + Name: "grpc.io/client/server_latency", + Description: "Distribution of server latency as viewed by client, by method.", + TagKeys: []tag.Key{KeyClientMethod}, + Aggregation: DefaultMillisecondsDistribution, + } +) + +// DefaultClientViews are the default client views provided by this package. +var DefaultClientViews = []*view.View{ + ClientSentBytesPerRPCView, + ClientReceivedBytesPerRPCView, + ClientRoundtripLatencyView, + ClientCompletedRPCsView, +} + +// TODO(jbd): Add roundtrip_latency, uncompressed_request_bytes, uncompressed_response_bytes, request_count, response_count. +// TODO(acetechnologist): This is temporary and will need to be replaced by a +// mechanism to load these defaults from a common repository/config shared by +// all supported languages. Likely a serialized protobuf of these defaults. diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/client_stats_handler.go b/vendor/go.opencensus.io/plugin/ocgrpc/client_stats_handler.go new file mode 100644 index 00000000..303c607f --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/client_stats_handler.go @@ -0,0 +1,49 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "time" + + "go.opencensus.io/tag" + "golang.org/x/net/context" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/stats" +) + +// statsTagRPC gets the tag.Map populated by the application code, serializes +// its tags into the GRPC metadata in order to be sent to the server. +func (h *ClientHandler) statsTagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { + startTime := time.Now() + if info == nil { + if grpclog.V(2) { + grpclog.Infof("clientHandler.TagRPC called with nil info.", info.FullMethodName) + } + return ctx + } + + d := &rpcData{ + startTime: startTime, + method: info.FullMethodName, + } + ts := tag.FromContext(ctx) + if ts != nil { + encoded := tag.Encode(ts) + ctx = stats.SetTags(ctx, encoded) + } + + return context.WithValue(ctx, rpcDataKey, d) +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/doc.go b/vendor/go.opencensus.io/plugin/ocgrpc/doc.go new file mode 100644 index 00000000..1370323f --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/doc.go @@ -0,0 +1,19 @@ +// Copyright 2017, OpenCensus 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 ocgrpc contains OpenCensus stats and trace +// integrations for gRPC. +// +// Use ServerHandler for servers and ClientHandler for clients. +package ocgrpc // import "go.opencensus.io/plugin/ocgrpc" diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/server.go b/vendor/go.opencensus.io/plugin/ocgrpc/server.go new file mode 100644 index 00000000..b67b3e2b --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/server.go @@ -0,0 +1,80 @@ +// Copyright 2018, OpenCensus 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 ocgrpc + +import ( + "go.opencensus.io/trace" + "golang.org/x/net/context" + + "google.golang.org/grpc/stats" +) + +// ServerHandler implements gRPC stats.Handler recording OpenCensus stats and +// traces. Use with gRPC servers. +// +// When installed (see Example), tracing metadata is read from inbound RPCs +// by default. If no tracing metadata is present, or if the tracing metadata is +// present but the SpanContext isn't sampled, then a new trace may be started +// (as determined by Sampler). +type ServerHandler struct { + // IsPublicEndpoint may be set to true to always start a new trace around + // each RPC. Any SpanContext in the RPC metadata will be added as a linked + // span instead of making it the parent of the span created around the + // server RPC. + // + // Be aware that if you leave this false (the default) on a public-facing + // server, callers will be able to send tracing metadata in gRPC headers + // and trigger traces in your backend. + IsPublicEndpoint bool + + // StartOptions to use for to spans started around RPCs handled by this server. + // + // These will apply even if there is tracing metadata already + // present on the inbound RPC but the SpanContext is not sampled. This + // ensures that each service has some opportunity to be traced. If you would + // like to not add any additional traces for this gRPC service, set: + // + // StartOptions.Sampler = trace.ProbabilitySampler(0.0) + // + // StartOptions.SpanKind will always be set to trace.SpanKindServer + // for spans started by this handler. + StartOptions trace.StartOptions +} + +var _ stats.Handler = (*ServerHandler)(nil) + +// HandleConn exists to satisfy gRPC stats.Handler. +func (s *ServerHandler) HandleConn(ctx context.Context, cs stats.ConnStats) { + // no-op +} + +// TagConn exists to satisfy gRPC stats.Handler. +func (s *ServerHandler) TagConn(ctx context.Context, cti *stats.ConnTagInfo) context.Context { + // no-op + return ctx +} + +// HandleRPC implements per-RPC tracing and stats instrumentation. +func (s *ServerHandler) HandleRPC(ctx context.Context, rs stats.RPCStats) { + traceHandleRPC(ctx, rs) + statsHandleRPC(ctx, rs) +} + +// TagRPC implements per-RPC context management. +func (s *ServerHandler) TagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context { + ctx = s.traceTagRPC(ctx, rti) + ctx = s.statsTagRPC(ctx, rti) + return ctx +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/server_metrics.go b/vendor/go.opencensus.io/plugin/ocgrpc/server_metrics.go new file mode 100644 index 00000000..609d9ed2 --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/server_metrics.go @@ -0,0 +1,97 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" +) + +// The following variables are measures are recorded by ServerHandler: +var ( + ServerReceivedMessagesPerRPC = stats.Int64("grpc.io/server/received_messages_per_rpc", "Number of messages received in each RPC. Has value 1 for non-streaming RPCs.", stats.UnitDimensionless) + ServerReceivedBytesPerRPC = stats.Int64("grpc.io/server/received_bytes_per_rpc", "Total bytes received across all messages per RPC.", stats.UnitBytes) + ServerSentMessagesPerRPC = stats.Int64("grpc.io/server/sent_messages_per_rpc", "Number of messages sent in each RPC. Has value 1 for non-streaming RPCs.", stats.UnitDimensionless) + ServerSentBytesPerRPC = stats.Int64("grpc.io/server/sent_bytes_per_rpc", "Total bytes sent in across all response messages per RPC.", stats.UnitBytes) + ServerLatency = stats.Float64("grpc.io/server/server_latency", "Time between first byte of request received to last byte of response sent, or terminal error.", stats.UnitMilliseconds) +) + +// TODO(acetechnologist): This is temporary and will need to be replaced by a +// mechanism to load these defaults from a common repository/config shared by +// all supported languages. Likely a serialized protobuf of these defaults. + +// Predefined views may be registered to collect data for the above measures. +// As always, you may also define your own custom views over measures collected by this +// package. These are declared as a convenience only; none are registered by +// default. +var ( + ServerReceivedBytesPerRPCView = &view.View{ + Name: "grpc.io/server/received_bytes_per_rpc", + Description: "Distribution of received bytes per RPC, by method.", + Measure: ServerReceivedBytesPerRPC, + TagKeys: []tag.Key{KeyServerMethod}, + Aggregation: DefaultBytesDistribution, + } + + ServerSentBytesPerRPCView = &view.View{ + Name: "grpc.io/server/sent_bytes_per_rpc", + Description: "Distribution of total sent bytes per RPC, by method.", + Measure: ServerSentBytesPerRPC, + TagKeys: []tag.Key{KeyServerMethod}, + Aggregation: DefaultBytesDistribution, + } + + ServerLatencyView = &view.View{ + Name: "grpc.io/server/server_latency", + Description: "Distribution of server latency in milliseconds, by method.", + TagKeys: []tag.Key{KeyServerMethod}, + Measure: ServerLatency, + Aggregation: DefaultMillisecondsDistribution, + } + + ServerCompletedRPCsView = &view.View{ + Name: "grpc.io/server/completed_rpcs", + Description: "Count of RPCs by method and status.", + TagKeys: []tag.Key{KeyServerMethod, KeyServerStatus}, + Measure: ServerLatency, + Aggregation: view.Count(), + } + + ServerReceivedMessagesPerRPCView = &view.View{ + Name: "grpc.io/server/received_messages_per_rpc", + Description: "Distribution of messages received count per RPC, by method.", + TagKeys: []tag.Key{KeyServerMethod}, + Measure: ServerReceivedMessagesPerRPC, + Aggregation: DefaultMessageCountDistribution, + } + + ServerSentMessagesPerRPCView = &view.View{ + Name: "grpc.io/server/sent_messages_per_rpc", + Description: "Distribution of messages sent count per RPC, by method.", + TagKeys: []tag.Key{KeyServerMethod}, + Measure: ServerSentMessagesPerRPC, + Aggregation: DefaultMessageCountDistribution, + } +) + +// DefaultServerViews are the default server views provided by this package. +var DefaultServerViews = []*view.View{ + ServerReceivedBytesPerRPCView, + ServerSentBytesPerRPCView, + ServerLatencyView, + ServerCompletedRPCsView, +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/server_stats_handler.go b/vendor/go.opencensus.io/plugin/ocgrpc/server_stats_handler.go new file mode 100644 index 00000000..7847c1a9 --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/server_stats_handler.go @@ -0,0 +1,63 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "time" + + "golang.org/x/net/context" + + "go.opencensus.io/tag" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/stats" +) + +// statsTagRPC gets the metadata from gRPC context, extracts the encoded tags from +// it and creates a new tag.Map and puts them into the returned context. +func (h *ServerHandler) statsTagRPC(ctx context.Context, info *stats.RPCTagInfo) context.Context { + startTime := time.Now() + if info == nil { + if grpclog.V(2) { + grpclog.Infof("opencensus: TagRPC called with nil info.") + } + return ctx + } + d := &rpcData{ + startTime: startTime, + method: info.FullMethodName, + } + propagated := h.extractPropagatedTags(ctx) + ctx = tag.NewContext(ctx, propagated) + ctx, _ = tag.New(ctx, tag.Upsert(KeyServerMethod, methodName(info.FullMethodName))) + return context.WithValue(ctx, rpcDataKey, d) +} + +// extractPropagatedTags creates a new tag map containing the tags extracted from the +// gRPC metadata. +func (h *ServerHandler) extractPropagatedTags(ctx context.Context) *tag.Map { + buf := stats.Tags(ctx) + if buf == nil { + return nil + } + propagated, err := tag.Decode(buf) + if err != nil { + if grpclog.V(2) { + grpclog.Warningf("opencensus: Failed to decode tags from gRPC metadata failed to decode: %v", err) + } + return nil + } + return propagated +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/stats_common.go b/vendor/go.opencensus.io/plugin/ocgrpc/stats_common.go new file mode 100644 index 00000000..e9991fe0 --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/stats_common.go @@ -0,0 +1,208 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "context" + "strconv" + "strings" + "sync/atomic" + "time" + + ocstats "go.opencensus.io/stats" + "go.opencensus.io/stats/view" + "go.opencensus.io/tag" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/status" +) + +type grpcInstrumentationKey string + +// rpcData holds the instrumentation RPC data that is needed between the start +// and end of an call. It holds the info that this package needs to keep track +// of between the various GRPC events. +type rpcData struct { + // reqCount and respCount has to be the first words + // in order to be 64-aligned on 32-bit architectures. + sentCount, sentBytes, recvCount, recvBytes int64 // access atomically + + // startTime represents the time at which TagRPC was invoked at the + // beginning of an RPC. It is an appoximation of the time when the + // application code invoked GRPC code. + startTime time.Time + method string +} + +// The following variables define the default hard-coded auxiliary data used by +// both the default GRPC client and GRPC server metrics. +var ( + DefaultBytesDistribution = view.Distribution(1024, 2048, 4096, 16384, 65536, 262144, 1048576, 4194304, 16777216, 67108864, 268435456, 1073741824, 4294967296) + DefaultMillisecondsDistribution = view.Distribution(0.01, 0.05, 0.1, 0.3, 0.6, 0.8, 1, 2, 3, 4, 5, 6, 8, 10, 13, 16, 20, 25, 30, 40, 50, 65, 80, 100, 130, 160, 200, 250, 300, 400, 500, 650, 800, 1000, 2000, 5000, 10000, 20000, 50000, 100000) + DefaultMessageCountDistribution = view.Distribution(1, 2, 4, 8, 16, 32, 64, 128, 256, 512, 1024, 2048, 4096, 8192, 16384, 32768, 65536) +) + +// Server tags are applied to the context used to process each RPC, as well as +// the measures at the end of each RPC. +var ( + KeyServerMethod, _ = tag.NewKey("grpc_server_method") + KeyServerStatus, _ = tag.NewKey("grpc_server_status") +) + +// Client tags are applied to measures at the end of each RPC. +var ( + KeyClientMethod, _ = tag.NewKey("grpc_client_method") + KeyClientStatus, _ = tag.NewKey("grpc_client_status") +) + +var ( + rpcDataKey = grpcInstrumentationKey("opencensus-rpcData") +) + +func methodName(fullname string) string { + return strings.TrimLeft(fullname, "/") +} + +// statsHandleRPC processes the RPC events. +func statsHandleRPC(ctx context.Context, s stats.RPCStats) { + switch st := s.(type) { + case *stats.Begin, *stats.OutHeader, *stats.InHeader, *stats.InTrailer, *stats.OutTrailer: + // do nothing for client + case *stats.OutPayload: + handleRPCOutPayload(ctx, st) + case *stats.InPayload: + handleRPCInPayload(ctx, st) + case *stats.End: + handleRPCEnd(ctx, st) + default: + grpclog.Infof("unexpected stats: %T", st) + } +} + +func handleRPCOutPayload(ctx context.Context, s *stats.OutPayload) { + d, ok := ctx.Value(rpcDataKey).(*rpcData) + if !ok { + if grpclog.V(2) { + grpclog.Infoln("Failed to retrieve *rpcData from context.") + } + return + } + + atomic.AddInt64(&d.sentBytes, int64(s.Length)) + atomic.AddInt64(&d.sentCount, 1) +} + +func handleRPCInPayload(ctx context.Context, s *stats.InPayload) { + d, ok := ctx.Value(rpcDataKey).(*rpcData) + if !ok { + if grpclog.V(2) { + grpclog.Infoln("Failed to retrieve *rpcData from context.") + } + return + } + + atomic.AddInt64(&d.recvBytes, int64(s.Length)) + atomic.AddInt64(&d.recvCount, 1) +} + +func handleRPCEnd(ctx context.Context, s *stats.End) { + d, ok := ctx.Value(rpcDataKey).(*rpcData) + if !ok { + if grpclog.V(2) { + grpclog.Infoln("Failed to retrieve *rpcData from context.") + } + return + } + + elapsedTime := time.Since(d.startTime) + + var st string + if s.Error != nil { + s, ok := status.FromError(s.Error) + if ok { + st = statusCodeToString(s) + } + } else { + st = "OK" + } + + latencyMillis := float64(elapsedTime) / float64(time.Millisecond) + if s.Client { + ocstats.RecordWithTags(ctx, + []tag.Mutator{ + tag.Upsert(KeyClientMethod, methodName(d.method)), + tag.Upsert(KeyClientStatus, st), + }, + ClientSentBytesPerRPC.M(atomic.LoadInt64(&d.sentBytes)), + ClientSentMessagesPerRPC.M(atomic.LoadInt64(&d.sentCount)), + ClientReceivedMessagesPerRPC.M(atomic.LoadInt64(&d.recvCount)), + ClientReceivedBytesPerRPC.M(atomic.LoadInt64(&d.recvBytes)), + ClientRoundtripLatency.M(latencyMillis)) + } else { + ocstats.RecordWithTags(ctx, + []tag.Mutator{ + tag.Upsert(KeyServerStatus, st), + }, + ServerSentBytesPerRPC.M(atomic.LoadInt64(&d.sentBytes)), + ServerSentMessagesPerRPC.M(atomic.LoadInt64(&d.sentCount)), + ServerReceivedMessagesPerRPC.M(atomic.LoadInt64(&d.recvCount)), + ServerReceivedBytesPerRPC.M(atomic.LoadInt64(&d.recvBytes)), + ServerLatency.M(latencyMillis)) + } +} + +func statusCodeToString(s *status.Status) string { + // see https://github.com/grpc/grpc/blob/master/doc/statuscodes.md + switch c := s.Code(); c { + case codes.OK: + return "OK" + case codes.Canceled: + return "CANCELLED" + case codes.Unknown: + return "UNKNOWN" + case codes.InvalidArgument: + return "INVALID_ARGUMENT" + case codes.DeadlineExceeded: + return "DEADLINE_EXCEEDED" + case codes.NotFound: + return "NOT_FOUND" + case codes.AlreadyExists: + return "ALREADY_EXISTS" + case codes.PermissionDenied: + return "PERMISSION_DENIED" + case codes.ResourceExhausted: + return "RESOURCE_EXHAUSTED" + case codes.FailedPrecondition: + return "FAILED_PRECONDITION" + case codes.Aborted: + return "ABORTED" + case codes.OutOfRange: + return "OUT_OF_RANGE" + case codes.Unimplemented: + return "UNIMPLEMENTED" + case codes.Internal: + return "INTERNAL" + case codes.Unavailable: + return "UNAVAILABLE" + case codes.DataLoss: + return "DATA_LOSS" + case codes.Unauthenticated: + return "UNAUTHENTICATED" + default: + return "CODE_" + strconv.FormatInt(int64(c), 10) + } +} diff --git a/vendor/go.opencensus.io/plugin/ocgrpc/trace_common.go b/vendor/go.opencensus.io/plugin/ocgrpc/trace_common.go new file mode 100644 index 00000000..720f381c --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ocgrpc/trace_common.go @@ -0,0 +1,107 @@ +// Copyright 2017, OpenCensus 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 ocgrpc + +import ( + "strings" + + "google.golang.org/grpc/codes" + + "go.opencensus.io/trace" + "go.opencensus.io/trace/propagation" + "golang.org/x/net/context" + "google.golang.org/grpc/metadata" + "google.golang.org/grpc/stats" + "google.golang.org/grpc/status" +) + +const traceContextKey = "grpc-trace-bin" + +// TagRPC creates a new trace span for the client side of the RPC. +// +// It returns ctx with the new trace span added and a serialization of the +// SpanContext added to the outgoing gRPC metadata. +func (c *ClientHandler) traceTagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context { + name := strings.TrimPrefix(rti.FullMethodName, "/") + name = strings.Replace(name, "/", ".", -1) + ctx, span := trace.StartSpan(ctx, name, + trace.WithSampler(c.StartOptions.Sampler), + trace.WithSpanKind(trace.SpanKindClient)) // span is ended by traceHandleRPC + traceContextBinary := propagation.Binary(span.SpanContext()) + return metadata.AppendToOutgoingContext(ctx, traceContextKey, string(traceContextBinary)) +} + +// TagRPC creates a new trace span for the server side of the RPC. +// +// It checks the incoming gRPC metadata in ctx for a SpanContext, and if +// it finds one, uses that SpanContext as the parent context of the new span. +// +// It returns ctx, with the new trace span added. +func (s *ServerHandler) traceTagRPC(ctx context.Context, rti *stats.RPCTagInfo) context.Context { + md, _ := metadata.FromIncomingContext(ctx) + name := strings.TrimPrefix(rti.FullMethodName, "/") + name = strings.Replace(name, "/", ".", -1) + traceContext := md[traceContextKey] + var ( + parent trace.SpanContext + haveParent bool + ) + if len(traceContext) > 0 { + // Metadata with keys ending in -bin are actually binary. They are base64 + // encoded before being put on the wire, see: + // https://github.com/grpc/grpc-go/blob/08d6261/Documentation/grpc-metadata.md#storing-binary-data-in-metadata + traceContextBinary := []byte(traceContext[0]) + parent, haveParent = propagation.FromBinary(traceContextBinary) + if haveParent && !s.IsPublicEndpoint { + ctx, _ := trace.StartSpanWithRemoteParent(ctx, name, parent, + trace.WithSpanKind(trace.SpanKindServer), + trace.WithSampler(s.StartOptions.Sampler), + ) + return ctx + } + } + ctx, span := trace.StartSpan(ctx, name, + trace.WithSpanKind(trace.SpanKindServer), + trace.WithSampler(s.StartOptions.Sampler)) + if haveParent { + span.AddLink(trace.Link{TraceID: parent.TraceID, SpanID: parent.SpanID, Type: trace.LinkTypeChild}) + } + return ctx +} + +func traceHandleRPC(ctx context.Context, rs stats.RPCStats) { + span := trace.FromContext(ctx) + // TODO: compressed and uncompressed sizes are not populated in every message. + switch rs := rs.(type) { + case *stats.Begin: + span.AddAttributes( + trace.BoolAttribute("Client", rs.Client), + trace.BoolAttribute("FailFast", rs.FailFast)) + case *stats.InPayload: + span.AddMessageReceiveEvent(0 /* TODO: messageID */, int64(rs.Length), int64(rs.WireLength)) + case *stats.OutPayload: + span.AddMessageSendEvent(0, int64(rs.Length), int64(rs.WireLength)) + case *stats.End: + if rs.Error != nil { + s, ok := status.FromError(rs.Error) + if ok { + span.SetStatus(trace.Status{Code: int32(s.Code()), Message: s.Message()}) + } else { + span.SetStatus(trace.Status{Code: int32(codes.Internal), Message: rs.Error.Error()}) + } + } + span.End() + } +} diff --git a/vendor/go.opencensus.io/plugin/ochttp/propagation/tracecontext/propagation.go b/vendor/go.opencensus.io/plugin/ochttp/propagation/tracecontext/propagation.go new file mode 100644 index 00000000..65ab1e99 --- /dev/null +++ b/vendor/go.opencensus.io/plugin/ochttp/propagation/tracecontext/propagation.go @@ -0,0 +1,187 @@ +// Copyright 2018, OpenCensus 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 tracecontext contains HTTP propagator for TraceContext standard. +// See https://github.com/w3c/distributed-tracing for more information. +package tracecontext // import "go.opencensus.io/plugin/ochttp/propagation/tracecontext" + +import ( + "encoding/hex" + "fmt" + "net/http" + "net/textproto" + "regexp" + "strings" + + "go.opencensus.io/trace" + "go.opencensus.io/trace/propagation" + "go.opencensus.io/trace/tracestate" +) + +const ( + supportedVersion = 0 + maxVersion = 254 + maxTracestateLen = 512 + traceparentHeader = "traceparent" + tracestateHeader = "tracestate" + trimOWSRegexFmt = `^[\x09\x20]*(.*[^\x20\x09])[\x09\x20]*$` +) + +var trimOWSRegExp = regexp.MustCompile(trimOWSRegexFmt) + +var _ propagation.HTTPFormat = (*HTTPFormat)(nil) + +// HTTPFormat implements the TraceContext trace propagation format. +type HTTPFormat struct{} + +// SpanContextFromRequest extracts a span context from incoming requests. +func (f *HTTPFormat) SpanContextFromRequest(req *http.Request) (sc trace.SpanContext, ok bool) { + h, ok := getRequestHeader(req, traceparentHeader, false) + if !ok { + return trace.SpanContext{}, false + } + sections := strings.Split(h, "-") + if len(sections) < 4 { + return trace.SpanContext{}, false + } + + if len(sections[0]) != 2 { + return trace.SpanContext{}, false + } + ver, err := hex.DecodeString(sections[0]) + if err != nil { + return trace.SpanContext{}, false + } + version := int(ver[0]) + if version > maxVersion { + return trace.SpanContext{}, false + } + + if version == 0 && len(sections) != 4 { + return trace.SpanContext{}, false + } + + if len(sections[1]) != 32 { + return trace.SpanContext{}, false + } + tid, err := hex.DecodeString(sections[1]) + if err != nil { + return trace.SpanContext{}, false + } + copy(sc.TraceID[:], tid) + + if len(sections[2]) != 16 { + return trace.SpanContext{}, false + } + sid, err := hex.DecodeString(sections[2]) + if err != nil { + return trace.SpanContext{}, false + } + copy(sc.SpanID[:], sid) + + opts, err := hex.DecodeString(sections[3]) + if err != nil || len(opts) < 1 { + return trace.SpanContext{}, false + } + sc.TraceOptions = trace.TraceOptions(opts[0]) + + // Don't allow all zero trace or span ID. + if sc.TraceID == [16]byte{} || sc.SpanID == [8]byte{} { + return trace.SpanContext{}, false + } + + sc.Tracestate = tracestateFromRequest(req) + return sc, true +} + +// getRequestHeader returns a combined header field according to RFC7230 section 3.2.2. +// If commaSeparated is true, multiple header fields with the same field name using be +// combined using ",". +// If no header was found using the given name, "ok" would be false. +// If more than one headers was found using the given name, while commaSeparated is false, +// "ok" would be false. +func getRequestHeader(req *http.Request, name string, commaSeparated bool) (hdr string, ok bool) { + v := req.Header[textproto.CanonicalMIMEHeaderKey(name)] + switch len(v) { + case 0: + return "", false + case 1: + return v[0], true + default: + return strings.Join(v, ","), commaSeparated + } +} + +// TODO(rghetia): return an empty Tracestate when parsing tracestate header encounters an error. +// Revisit to return additional boolean value to indicate parsing error when following issues +// are resolved. +// https://github.com/w3c/distributed-tracing/issues/172 +// https://github.com/w3c/distributed-tracing/issues/175 +func tracestateFromRequest(req *http.Request) *tracestate.Tracestate { + h, _ := getRequestHeader(req, tracestateHeader, true) + if h == "" { + return nil + } + + var entries []tracestate.Entry + pairs := strings.Split(h, ",") + hdrLenWithoutOWS := len(pairs) - 1 // Number of commas + for _, pair := range pairs { + matches := trimOWSRegExp.FindStringSubmatch(pair) + if matches == nil { + return nil + } + pair = matches[1] + hdrLenWithoutOWS += len(pair) + if hdrLenWithoutOWS > maxTracestateLen { + return nil + } + kv := strings.Split(pair, "=") + if len(kv) != 2 { + return nil + } + entries = append(entries, tracestate.Entry{Key: kv[0], Value: kv[1]}) + } + ts, err := tracestate.New(nil, entries...) + if err != nil { + return nil + } + + return ts +} + +func tracestateToRequest(sc trace.SpanContext, req *http.Request) { + var pairs = make([]string, 0, len(sc.Tracestate.Entries())) + if sc.Tracestate != nil { + for _, entry := range sc.Tracestate.Entries() { + pairs = append(pairs, strings.Join([]string{entry.Key, entry.Value}, "=")) + } + h := strings.Join(pairs, ",") + + if h != "" && len(h) <= maxTracestateLen { + req.Header.Set(tracestateHeader, h) + } + } +} + +// SpanContextToRequest modifies the given request to include traceparent and tracestate headers. +func (f *HTTPFormat) SpanContextToRequest(sc trace.SpanContext, req *http.Request) { + h := fmt.Sprintf("%x-%x-%x-%x", + []byte{supportedVersion}, + sc.TraceID[:], + sc.SpanID[:], + []byte{byte(sc.TraceOptions)}) + req.Header.Set(traceparentHeader, h) + tracestateToRequest(sc, req) +} diff --git a/vendor/golang.org/x/sync/AUTHORS b/vendor/golang.org/x/sync/AUTHORS new file mode 100644 index 00000000..15167cd7 --- /dev/null +++ b/vendor/golang.org/x/sync/AUTHORS @@ -0,0 +1,3 @@ +# 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/sync/CONTRIBUTORS b/vendor/golang.org/x/sync/CONTRIBUTORS new file mode 100644 index 00000000..1c4577e9 --- /dev/null +++ b/vendor/golang.org/x/sync/CONTRIBUTORS @@ -0,0 +1,3 @@ +# 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/sync/LICENSE b/vendor/golang.org/x/sync/LICENSE new file mode 100644 index 00000000..6a66aea5 --- /dev/null +++ b/vendor/golang.org/x/sync/LICENSE @@ -0,0 +1,27 @@ +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/sync/PATENTS b/vendor/golang.org/x/sync/PATENTS new file mode 100644 index 00000000..73309904 --- /dev/null +++ b/vendor/golang.org/x/sync/PATENTS @@ -0,0 +1,22 @@ +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/sync/semaphore/semaphore.go b/vendor/golang.org/x/sync/semaphore/semaphore.go new file mode 100644 index 00000000..7f096fef --- /dev/null +++ b/vendor/golang.org/x/sync/semaphore/semaphore.go @@ -0,0 +1,127 @@ +// 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 semaphore provides a weighted semaphore implementation. +package semaphore // import "golang.org/x/sync/semaphore" + +import ( + "container/list" + "context" + "sync" +) + +type waiter struct { + n int64 + ready chan<- struct{} // Closed when semaphore acquired. +} + +// NewWeighted creates a new weighted semaphore with the given +// maximum combined weight for concurrent access. +func NewWeighted(n int64) *Weighted { + w := &Weighted{size: n} + return w +} + +// Weighted provides a way to bound concurrent access to a resource. +// The callers can request access with a given weight. +type Weighted struct { + size int64 + cur int64 + mu sync.Mutex + waiters list.List +} + +// Acquire acquires the semaphore with a weight of n, blocking until resources +// are available or ctx is done. On success, returns nil. On failure, returns +// ctx.Err() and leaves the semaphore unchanged. +// +// If ctx is already done, Acquire may still succeed without blocking. +func (s *Weighted) Acquire(ctx context.Context, n int64) error { + s.mu.Lock() + if s.size-s.cur >= n && s.waiters.Len() == 0 { + s.cur += n + s.mu.Unlock() + return nil + } + + if n > s.size { + // Don't make other Acquire calls block on one that's doomed to fail. + s.mu.Unlock() + <-ctx.Done() + return ctx.Err() + } + + ready := make(chan struct{}) + w := waiter{n: n, ready: ready} + elem := s.waiters.PushBack(w) + s.mu.Unlock() + + select { + case <-ctx.Done(): + err := ctx.Err() + s.mu.Lock() + select { + case <-ready: + // Acquired the semaphore after we were canceled. Rather than trying to + // fix up the queue, just pretend we didn't notice the cancelation. + err = nil + default: + s.waiters.Remove(elem) + } + s.mu.Unlock() + return err + + case <-ready: + return nil + } +} + +// TryAcquire acquires the semaphore with a weight of n without blocking. +// On success, returns true. On failure, returns false and leaves the semaphore unchanged. +func (s *Weighted) TryAcquire(n int64) bool { + s.mu.Lock() + success := s.size-s.cur >= n && s.waiters.Len() == 0 + if success { + s.cur += n + } + s.mu.Unlock() + return success +} + +// Release releases the semaphore with a weight of n. +func (s *Weighted) Release(n int64) { + s.mu.Lock() + s.cur -= n + if s.cur < 0 { + s.mu.Unlock() + panic("semaphore: released more than held") + } + for { + next := s.waiters.Front() + if next == nil { + break // No more waiters blocked. + } + + w := next.Value.(waiter) + if s.size-s.cur < w.n { + // Not enough tokens for the next waiter. We could keep going (to try to + // find a waiter with a smaller request), but under load that could cause + // starvation for large requests; instead, we leave all remaining waiters + // blocked. + // + // Consider a semaphore used as a read-write lock, with N tokens, N + // readers, and one writer. Each reader can Acquire(1) to obtain a read + // lock. The writer can Acquire(N) to obtain a write lock, excluding all + // of the readers. If we allow the readers to jump ahead in the queue, + // the writer will starve — there is always one token available for every + // reader. + break + } + + s.cur += w.n + s.waiters.Remove(next) + close(w.ready) + } + s.mu.Unlock() +} diff --git a/vendor/google.golang.org/api/support/bundler/bundler.go b/vendor/google.golang.org/api/support/bundler/bundler.go new file mode 100644 index 00000000..c5532711 --- /dev/null +++ b/vendor/google.golang.org/api/support/bundler/bundler.go @@ -0,0 +1,349 @@ +// Copyright 2016 Google LLC +// +// 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 bundler supports bundling (batching) of items. Bundling amortizes an +// action with fixed costs over multiple items. For example, if an API provides +// an RPC that accepts a list of items as input, but clients would prefer +// adding items one at a time, then a Bundler can accept individual items from +// the client and bundle many of them into a single RPC. +// +// This package is experimental and subject to change without notice. +package bundler + +import ( + "context" + "errors" + "math" + "reflect" + "sync" + "time" + + "golang.org/x/sync/semaphore" +) + +const ( + DefaultDelayThreshold = time.Second + DefaultBundleCountThreshold = 10 + DefaultBundleByteThreshold = 1e6 // 1M + DefaultBufferedByteLimit = 1e9 // 1G +) + +var ( + // ErrOverflow indicates that Bundler's stored bytes exceeds its BufferedByteLimit. + ErrOverflow = errors.New("bundler reached buffered byte limit") + + // ErrOversizedItem indicates that an item's size exceeds the maximum bundle size. + ErrOversizedItem = errors.New("item size exceeds bundle byte limit") +) + +// A Bundler collects items added to it into a bundle until the bundle +// exceeds a given size, then calls a user-provided function to handle the bundle. +type Bundler struct { + // Starting from the time that the first message is added to a bundle, once + // this delay has passed, handle the bundle. The default is DefaultDelayThreshold. + DelayThreshold time.Duration + + // Once a bundle has this many items, handle the bundle. Since only one + // item at a time is added to a bundle, no bundle will exceed this + // threshold, so it also serves as a limit. The default is + // DefaultBundleCountThreshold. + BundleCountThreshold int + + // Once the number of bytes in current bundle reaches this threshold, handle + // the bundle. The default is DefaultBundleByteThreshold. This triggers handling, + // but does not cap the total size of a bundle. + BundleByteThreshold int + + // The maximum size of a bundle, in bytes. Zero means unlimited. + BundleByteLimit int + + // The maximum number of bytes that the Bundler will keep in memory before + // returning ErrOverflow. The default is DefaultBufferedByteLimit. + BufferedByteLimit int + + // The maximum number of handler invocations that can be running at once. + // The default is 1. + HandlerLimit int + + handler func(interface{}) // called to handle a bundle + itemSliceZero reflect.Value // nil (zero value) for slice of items + flushTimer *time.Timer // implements DelayThreshold + + mu sync.Mutex + sem *semaphore.Weighted // enforces BufferedByteLimit + semOnce sync.Once + curBundle bundle // incoming items added to this bundle + + // Each bundle is assigned a unique ticket that determines the order in which the + // handler is called. The ticket is assigned with mu locked, but waiting for tickets + // to be handled is done via mu2 and cond, below. + nextTicket uint64 // next ticket to be assigned + + mu2 sync.Mutex + cond *sync.Cond + nextHandled uint64 // next ticket to be handled + + // In this implementation, active uses space proportional to HandlerLimit, and + // waitUntilAllHandled takes time proportional to HandlerLimit each time an acquire + // or release occurs, so large values of HandlerLimit max may cause performance + // issues. + active map[uint64]bool // tickets of bundles actively being handled +} + +type bundle struct { + items reflect.Value // slice of item type + size int // size in bytes of all items +} + +// NewBundler creates a new Bundler. +// +// itemExample is a value of the type that will be bundled. For example, if you +// want to create bundles of *Entry, you could pass &Entry{} for itemExample. +// +// handler is a function that will be called on each bundle. If itemExample is +// of type T, the argument to handler is of type []T. handler is always called +// sequentially for each bundle, and never in parallel. +// +// Configure the Bundler by setting its thresholds and limits before calling +// any of its methods. +func NewBundler(itemExample interface{}, handler func(interface{})) *Bundler { + b := &Bundler{ + DelayThreshold: DefaultDelayThreshold, + BundleCountThreshold: DefaultBundleCountThreshold, + BundleByteThreshold: DefaultBundleByteThreshold, + BufferedByteLimit: DefaultBufferedByteLimit, + HandlerLimit: 1, + + handler: handler, + itemSliceZero: reflect.Zero(reflect.SliceOf(reflect.TypeOf(itemExample))), + active: map[uint64]bool{}, + } + b.curBundle.items = b.itemSliceZero + b.cond = sync.NewCond(&b.mu2) + return b +} + +func (b *Bundler) initSemaphores() { + // Create the semaphores lazily, because the user may set limits + // after NewBundler. + b.semOnce.Do(func() { + b.sem = semaphore.NewWeighted(int64(b.BufferedByteLimit)) + }) +} + +// Add adds item to the current bundle. It marks the bundle for handling and +// starts a new one if any of the thresholds or limits are exceeded. +// +// If the item's size exceeds the maximum bundle size (Bundler.BundleByteLimit), then +// the item can never be handled. Add returns ErrOversizedItem in this case. +// +// If adding the item would exceed the maximum memory allowed +// (Bundler.BufferedByteLimit) or an AddWait call is blocked waiting for +// memory, Add returns ErrOverflow. +// +// Add never blocks. +func (b *Bundler) Add(item interface{}, size int) error { + // If this item exceeds the maximum size of a bundle, + // we can never send it. + if b.BundleByteLimit > 0 && size > b.BundleByteLimit { + return ErrOversizedItem + } + // If adding this item would exceed our allotted memory + // footprint, we can't accept it. + // (TryAcquire also returns false if anything is waiting on the semaphore, + // so calls to Add and AddWait shouldn't be mixed.) + b.initSemaphores() + if !b.sem.TryAcquire(int64(size)) { + return ErrOverflow + } + b.add(item, size) + return nil +} + +// add adds item to the current bundle. It marks the bundle for handling and +// starts a new one if any of the thresholds or limits are exceeded. +func (b *Bundler) add(item interface{}, size int) { + b.mu.Lock() + defer b.mu.Unlock() + + // If adding this item to the current bundle would cause it to exceed the + // maximum bundle size, close the current bundle and start a new one. + if b.BundleByteLimit > 0 && b.curBundle.size+size > b.BundleByteLimit { + b.startFlushLocked() + } + // Add the item. + b.curBundle.items = reflect.Append(b.curBundle.items, reflect.ValueOf(item)) + b.curBundle.size += size + + // Start a timer to flush the item if one isn't already running. + // startFlushLocked clears the timer and closes the bundle at the same time, + // so we only allocate a new timer for the first item in each bundle. + // (We could try to call Reset on the timer instead, but that would add a lot + // of complexity to the code just to save one small allocation.) + if b.flushTimer == nil { + b.flushTimer = time.AfterFunc(b.DelayThreshold, b.Flush) + } + + // If the current bundle equals the count threshold, close it. + if b.curBundle.items.Len() == b.BundleCountThreshold { + b.startFlushLocked() + } + // If the current bundle equals or exceeds the byte threshold, close it. + if b.curBundle.size >= b.BundleByteThreshold { + b.startFlushLocked() + } +} + +// AddWait adds item to the current bundle. It marks the bundle for handling and +// starts a new one if any of the thresholds or limits are exceeded. +// +// If the item's size exceeds the maximum bundle size (Bundler.BundleByteLimit), then +// the item can never be handled. AddWait returns ErrOversizedItem in this case. +// +// If adding the item would exceed the maximum memory allowed (Bundler.BufferedByteLimit), +// AddWait blocks until space is available or ctx is done. +// +// Calls to Add and AddWait should not be mixed on the same Bundler. +func (b *Bundler) AddWait(ctx context.Context, item interface{}, size int) error { + // If this item exceeds the maximum size of a bundle, + // we can never send it. + if b.BundleByteLimit > 0 && size > b.BundleByteLimit { + return ErrOversizedItem + } + // If adding this item would exceed our allotted memory footprint, block + // until space is available. The semaphore is FIFO, so there will be no + // starvation. + b.initSemaphores() + if err := b.sem.Acquire(ctx, int64(size)); err != nil { + return err + } + // Here, we've reserved space for item. Other goroutines can call AddWait + // and even acquire space, but no one can take away our reservation + // (assuming sem.Release is used correctly). So there is no race condition + // resulting from locking the mutex after sem.Acquire returns. + b.add(item, size) + return nil +} + +// Flush invokes the handler for all remaining items in the Bundler and waits +// for it to return. +func (b *Bundler) Flush() { + b.mu.Lock() + b.startFlushLocked() + // Here, all bundles with tickets < b.nextTicket are + // either finished or active. Those are the ones + // we want to wait for. + t := b.nextTicket + b.mu.Unlock() + b.initSemaphores() + b.waitUntilAllHandled(t) +} + +func (b *Bundler) startFlushLocked() { + if b.flushTimer != nil { + b.flushTimer.Stop() + b.flushTimer = nil + } + if b.curBundle.items.Len() == 0 { + return + } + // Here, both semaphores must have been initialized. + bun := b.curBundle + b.curBundle = bundle{items: b.itemSliceZero} + ticket := b.nextTicket + b.nextTicket++ + go func() { + defer func() { + b.sem.Release(int64(bun.size)) + b.release(ticket) + }() + b.acquire(ticket) + b.handler(bun.items.Interface()) + }() +} + +// acquire blocks until ticket is the next to be served, then returns. In order for N +// acquire calls to return, the tickets must be in the range [0, N). A ticket must +// not be presented to acquire more than once. +func (b *Bundler) acquire(ticket uint64) { + b.mu2.Lock() + defer b.mu2.Unlock() + if ticket < b.nextHandled { + panic("bundler: acquire: arg too small") + } + for !(ticket == b.nextHandled && len(b.active) < b.HandlerLimit) { + b.cond.Wait() + } + // Here, + // ticket == b.nextHandled: the caller is the next one to be handled; + // and len(b.active) < b.HandlerLimit: there is space available. + b.active[ticket] = true + b.nextHandled++ + // Broadcast, not Signal: although at most one acquire waiter can make progress, + // there might be waiters in waitUntilAllHandled. + b.cond.Broadcast() +} + +// If a ticket is used for a call to acquire, it must later be passed to release. A +// ticket must not be presented to release more than once. +func (b *Bundler) release(ticket uint64) { + b.mu2.Lock() + defer b.mu2.Unlock() + if !b.active[ticket] { + panic("bundler: release: not an active ticket") + } + delete(b.active, ticket) + b.cond.Broadcast() +} + +// waitUntilAllHandled blocks until all tickets < n have called release, meaning +// all bundles with tickets < n have been handled. +func (b *Bundler) waitUntilAllHandled(n uint64) { + // Proof of correctness of this function. + // "N is acquired" means acquire(N) has returned. + // "N is released" means release(N) has returned. + // 1. If N is acquired, N-1 is acquired. + // Follows from the loop test in acquire, and the fact + // that nextHandled is incremented by 1. + // 2. If nextHandled >= N, then N-1 is acquired. + // Because we only increment nextHandled to N after N-1 is acquired. + // 3. If nextHandled >= N, then all n < N is acquired. + // Follows from #1 and #2. + // 4. If N is acquired and N is not in active, then N is released. + // Because we put N in active before acquire returns, and only + // remove it when it is released. + // Let min(active) be the smallest member of active, or infinity if active is empty. + // 5. If nextHandled >= N and N <= min(active), then all n < N is released. + // From nextHandled >= N and #3, all n < N is acquired. + // N <= min(active) implies n < min(active) for all n < N. So all n < N is not in active. + // So from #4, all n < N is released. + // The loop test below is the antecedent of #5. + b.mu2.Lock() + defer b.mu2.Unlock() + for !(b.nextHandled >= n && n <= min(b.active)) { + b.cond.Wait() + } +} + +// min returns the minimum value of the set s, or the largest uint64 if +// s is empty. +func min(s map[uint64]bool) uint64 { + var m uint64 = math.MaxUint64 + for n := range s { + if n < m { + m = n + } + } + return m +} diff --git a/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go new file mode 100644 index 00000000..26021b0f --- /dev/null +++ b/vendor/google.golang.org/genproto/googleapis/api/httpbody/httpbody.pb.go @@ -0,0 +1,142 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/api/httpbody.proto + +package httpbody // import "google.golang.org/genproto/googleapis/api/httpbody" + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" +import any "github.com/golang/protobuf/ptypes/any" + +// 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 + +// Message that represents an arbitrary HTTP body. It should only be used for +// payload formats that can't be represented as JSON, such as raw binary or +// an HTML page. +// +// +// This message can be used both in streaming and non-streaming API methods in +// the request as well as the response. +// +// It can be used as a top-level request field, which is convenient if one +// wants to extract parameters from either the URL or HTTP template into the +// request fields and also want access to the raw HTTP body. +// +// Example: +// +// message GetResourceRequest { +// // A unique request id. +// string request_id = 1; +// +// // The raw HTTP body is bound to this field. +// google.api.HttpBody http_body = 2; +// } +// +// service ResourceService { +// rpc GetResource(GetResourceRequest) returns (google.api.HttpBody); +// rpc UpdateResource(google.api.HttpBody) returns +// (google.protobuf.Empty); +// } +// +// Example with streaming methods: +// +// service CaldavService { +// rpc GetCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// rpc UpdateCalendar(stream google.api.HttpBody) +// returns (stream google.api.HttpBody); +// } +// +// Use of this type only changes how the request and response bodies are +// handled, all other features will continue to work unchanged. +type HttpBody struct { + // The HTTP Content-Type header value specifying the content type of the body. + ContentType string `protobuf:"bytes,1,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"` + // The HTTP request/response body as raw binary. + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + // Application specific response metadata. Must be set in the first response + // for streaming APIs. + Extensions []*any.Any `protobuf:"bytes,3,rep,name=extensions,proto3" json:"extensions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *HttpBody) Reset() { *m = HttpBody{} } +func (m *HttpBody) String() string { return proto.CompactTextString(m) } +func (*HttpBody) ProtoMessage() {} +func (*HttpBody) Descriptor() ([]byte, []int) { + return fileDescriptor_httpbody_45db50668f1dc1dc, []int{0} +} +func (m *HttpBody) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_HttpBody.Unmarshal(m, b) +} +func (m *HttpBody) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_HttpBody.Marshal(b, m, deterministic) +} +func (dst *HttpBody) XXX_Merge(src proto.Message) { + xxx_messageInfo_HttpBody.Merge(dst, src) +} +func (m *HttpBody) XXX_Size() int { + return xxx_messageInfo_HttpBody.Size(m) +} +func (m *HttpBody) XXX_DiscardUnknown() { + xxx_messageInfo_HttpBody.DiscardUnknown(m) +} + +var xxx_messageInfo_HttpBody proto.InternalMessageInfo + +func (m *HttpBody) GetContentType() string { + if m != nil { + return m.ContentType + } + return "" +} + +func (m *HttpBody) GetData() []byte { + if m != nil { + return m.Data + } + return nil +} + +func (m *HttpBody) GetExtensions() []*any.Any { + if m != nil { + return m.Extensions + } + return nil +} + +func init() { + proto.RegisterType((*HttpBody)(nil), "google.api.HttpBody") +} + +func init() { proto.RegisterFile("google/api/httpbody.proto", fileDescriptor_httpbody_45db50668f1dc1dc) } + +var fileDescriptor_httpbody_45db50668f1dc1dc = []byte{ + // 229 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x8f, 0x31, 0x4f, 0xc3, 0x30, + 0x10, 0x85, 0xe5, 0xb6, 0x42, 0x70, 0x2d, 0x0c, 0x16, 0x43, 0x60, 0x0a, 0x4c, 0x99, 0x6c, 0x09, + 0xd8, 0x3a, 0x35, 0x0b, 0xb0, 0x45, 0x11, 0x13, 0x0b, 0x72, 0x1a, 0xe3, 0x46, 0x2a, 0x77, 0xa7, + 0xe6, 0x10, 0xf8, 0xef, 0xf0, 0x2b, 0x19, 0x11, 0x69, 0x2c, 0xe8, 0xf6, 0xe4, 0xef, 0x3d, 0xbf, + 0x77, 0x70, 0x11, 0x88, 0xc2, 0xd6, 0x5b, 0xc7, 0x9d, 0xdd, 0x88, 0x70, 0x43, 0x6d, 0x34, 0xbc, + 0x23, 0x21, 0x0d, 0x7b, 0x64, 0x1c, 0x77, 0x97, 0xc9, 0x36, 0x90, 0xe6, 0xfd, 0xd5, 0x3a, 0x1c, + 0x6d, 0xd7, 0x1f, 0x70, 0xfc, 0x20, 0xc2, 0x25, 0xb5, 0x51, 0x5f, 0xc1, 0x62, 0x4d, 0x28, 0x1e, + 0xe5, 0x45, 0x22, 0xfb, 0x4c, 0xe5, 0xaa, 0x38, 0xa9, 0xe7, 0xe3, 0xdb, 0x53, 0x64, 0xaf, 0x35, + 0xcc, 0x5a, 0x27, 0x2e, 0x9b, 0xe4, 0xaa, 0x58, 0xd4, 0x83, 0xd6, 0x77, 0x00, 0xfe, 0x53, 0x3c, + 0xf6, 0x1d, 0x61, 0x9f, 0x4d, 0xf3, 0x69, 0x31, 0xbf, 0x39, 0x37, 0x63, 0x7d, 0xaa, 0x34, 0x2b, + 0x8c, 0xf5, 0x3f, 0x5f, 0xb9, 0x81, 0xb3, 0x35, 0xbd, 0x99, 0xbf, 0x95, 0xe5, 0x69, 0x1a, 0x52, + 0xfd, 0x66, 0x2a, 0xf5, 0xbc, 0x1c, 0x61, 0xa0, 0xad, 0xc3, 0x60, 0x68, 0x17, 0x6c, 0xf0, 0x38, + 0xfc, 0x68, 0xf7, 0xc8, 0x71, 0xd7, 0x1f, 0x1c, 0xbf, 0x4c, 0xe2, 0x5b, 0xa9, 0xaf, 0xc9, 0xec, + 0x7e, 0x55, 0x3d, 0x36, 0x47, 0x43, 0xe2, 0xf6, 0x27, 0x00, 0x00, 0xff, 0xff, 0x78, 0xb9, 0x16, + 0x2b, 0x2d, 0x01, 0x00, 0x00, +} diff --git a/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go b/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go new file mode 100644 index 00000000..86886693 --- /dev/null +++ b/vendor/google.golang.org/genproto/protobuf/field_mask/field_mask.pb.go @@ -0,0 +1,280 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// source: google/protobuf/field_mask.proto + +package field_mask // import "google.golang.org/genproto/protobuf/field_mask" + +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 + +// `FieldMask` represents a set of symbolic field paths, for example: +// +// paths: "f.a" +// paths: "f.b.d" +// +// Here `f` represents a field in some root message, `a` and `b` +// fields in the message found in `f`, and `d` a field found in the +// message in `f.b`. +// +// Field masks are used to specify a subset of fields that should be +// returned by a get operation or modified by an update operation. +// Field masks also have a custom JSON encoding (see below). +// +// # Field Masks in Projections +// +// When used in the context of a projection, a response message or +// sub-message is filtered by the API to only contain those fields as +// specified in the mask. For example, if the mask in the previous +// example is applied to a response message as follows: +// +// f { +// a : 22 +// b { +// d : 1 +// x : 2 +// } +// y : 13 +// } +// z: 8 +// +// The result will not contain specific values for fields x,y and z +// (their value will be set to the default, and omitted in proto text +// output): +// +// +// f { +// a : 22 +// b { +// d : 1 +// } +// } +// +// A repeated field is not allowed except at the last position of a +// paths string. +// +// If a FieldMask object is not present in a get operation, the +// operation applies to all fields (as if a FieldMask of all fields +// had been specified). +// +// Note that a field mask does not necessarily apply to the +// top-level response message. In case of a REST get operation, the +// field mask applies directly to the response, but in case of a REST +// list operation, the mask instead applies to each individual message +// in the returned resource list. In case of a REST custom method, +// other definitions may be used. Where the mask applies will be +// clearly documented together with its declaration in the API. In +// any case, the effect on the returned resource/resources is required +// behavior for APIs. +// +// # Field Masks in Update Operations +// +// A field mask in update operations specifies which fields of the +// targeted resource are going to be updated. The API is required +// to only change the values of the fields as specified in the mask +// and leave the others untouched. If a resource is passed in to +// describe the updated values, the API ignores the values of all +// fields not covered by the mask. +// +// If a repeated field is specified for an update operation, new values will +// be appended to the existing repeated field in the target resource. Note that +// a repeated field is only allowed in the last position of a `paths` string. +// +// If a sub-message is specified in the last position of the field mask for an +// update operation, then new value will be merged into the existing sub-message +// in the target resource. +// +// For example, given the target message: +// +// f { +// b { +// d: 1 +// x: 2 +// } +// c: [1] +// } +// +// And an update message: +// +// f { +// b { +// d: 10 +// } +// c: [2] +// } +// +// then if the field mask is: +// +// paths: ["f.b", "f.c"] +// +// then the result will be: +// +// f { +// b { +// d: 10 +// x: 2 +// } +// c: [1, 2] +// } +// +// An implementation may provide options to override this default behavior for +// repeated and message fields. +// +// In order to reset a field's value to the default, the field must +// be in the mask and set to the default value in the provided resource. +// Hence, in order to reset all fields of a resource, provide a default +// instance of the resource and set all fields in the mask, or do +// not provide a mask as described below. +// +// If a field mask is not present on update, the operation applies to +// all fields (as if a field mask of all fields has been specified). +// Note that in the presence of schema evolution, this may mean that +// fields the client does not know and has therefore not filled into +// the request will be reset to their default. If this is unwanted +// behavior, a specific service may require a client to always specify +// a field mask, producing an error if not. +// +// As with get operations, the location of the resource which +// describes the updated values in the request message depends on the +// operation kind. In any case, the effect of the field mask is +// required to be honored by the API. +// +// ## Considerations for HTTP REST +// +// The HTTP kind of an update operation which uses a field mask must +// be set to PATCH instead of PUT in order to satisfy HTTP semantics +// (PUT must only be used for full updates). +// +// # JSON Encoding of Field Masks +// +// In JSON, a field mask is encoded as a single string where paths are +// separated by a comma. Fields name in each path are converted +// to/from lower-camel naming conventions. +// +// As an example, consider the following message declarations: +// +// message Profile { +// User user = 1; +// Photo photo = 2; +// } +// message User { +// string display_name = 1; +// string address = 2; +// } +// +// In proto a field mask for `Profile` may look as such: +// +// mask { +// paths: "user.display_name" +// paths: "photo" +// } +// +// In JSON, the same mask is represented as below: +// +// { +// mask: "user.displayName,photo" +// } +// +// # Field Masks and Oneof Fields +// +// Field masks treat fields in oneofs just as regular fields. Consider the +// following message: +// +// message SampleMessage { +// oneof test_oneof { +// string name = 4; +// SubMessage sub_message = 9; +// } +// } +// +// The field mask can be: +// +// mask { +// paths: "name" +// } +// +// Or: +// +// mask { +// paths: "sub_message" +// } +// +// Note that oneof type names ("test_oneof" in this case) cannot be used in +// paths. +// +// ## Field Mask Verification +// +// The implementation of any API method which has a FieldMask type field in the +// request should verify the included field paths, and return an +// `INVALID_ARGUMENT` error if any path is duplicated or unmappable. +type FieldMask struct { + // The set of field mask paths. + Paths []string `protobuf:"bytes,1,rep,name=paths,proto3" json:"paths,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *FieldMask) Reset() { *m = FieldMask{} } +func (m *FieldMask) String() string { return proto.CompactTextString(m) } +func (*FieldMask) ProtoMessage() {} +func (*FieldMask) Descriptor() ([]byte, []int) { + return fileDescriptor_field_mask_02a8b0c0831edcce, []int{0} +} +func (m *FieldMask) XXX_Unmarshal(b []byte) error { + return xxx_messageInfo_FieldMask.Unmarshal(m, b) +} +func (m *FieldMask) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + return xxx_messageInfo_FieldMask.Marshal(b, m, deterministic) +} +func (dst *FieldMask) XXX_Merge(src proto.Message) { + xxx_messageInfo_FieldMask.Merge(dst, src) +} +func (m *FieldMask) XXX_Size() int { + return xxx_messageInfo_FieldMask.Size(m) +} +func (m *FieldMask) XXX_DiscardUnknown() { + xxx_messageInfo_FieldMask.DiscardUnknown(m) +} + +var xxx_messageInfo_FieldMask proto.InternalMessageInfo + +func (m *FieldMask) GetPaths() []string { + if m != nil { + return m.Paths + } + return nil +} + +func init() { + proto.RegisterType((*FieldMask)(nil), "google.protobuf.FieldMask") +} + +func init() { + proto.RegisterFile("google/protobuf/field_mask.proto", fileDescriptor_field_mask_02a8b0c0831edcce) +} + +var fileDescriptor_field_mask_02a8b0c0831edcce = []byte{ + // 175 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x48, 0xcf, 0xcf, 0x4f, + 0xcf, 0x49, 0xd5, 0x2f, 0x28, 0xca, 0x2f, 0xc9, 0x4f, 0x2a, 0x4d, 0xd3, 0x4f, 0xcb, 0x4c, 0xcd, + 0x49, 0x89, 0xcf, 0x4d, 0x2c, 0xce, 0xd6, 0x03, 0x8b, 0x09, 0xf1, 0x43, 0x54, 0xe8, 0xc1, 0x54, + 0x28, 0x29, 0x72, 0x71, 0xba, 0x81, 0x14, 0xf9, 0x26, 0x16, 0x67, 0x0b, 0x89, 0x70, 0xb1, 0x16, + 0x24, 0x96, 0x64, 0x14, 0x4b, 0x30, 0x2a, 0x30, 0x6b, 0x70, 0x06, 0x41, 0x38, 0x4e, 0x3d, 0x8c, + 0x5c, 0xc2, 0xc9, 0xf9, 0xb9, 0x7a, 0x68, 0x5a, 0x9d, 0xf8, 0xe0, 0x1a, 0x03, 0x40, 0x42, 0x01, + 0x8c, 0x51, 0x96, 0x50, 0x25, 0xe9, 0xf9, 0x39, 0x89, 0x79, 0xe9, 0x7a, 0xf9, 0x45, 0xe9, 0xfa, + 0xe9, 0xa9, 0x79, 0x60, 0x0d, 0xd8, 0xdc, 0x64, 0x8d, 0x60, 0xfe, 0x60, 0x64, 0x5c, 0xc4, 0xc4, + 0xec, 0x1e, 0xe0, 0xb4, 0x8a, 0x49, 0xce, 0x1d, 0x62, 0x48, 0x00, 0x54, 0x83, 0x5e, 0x78, 0x6a, + 0x4e, 0x8e, 0x77, 0x5e, 0x7e, 0x79, 0x5e, 0x48, 0x65, 0x41, 0x6a, 0x71, 0x12, 0x1b, 0xd8, 0x24, + 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfd, 0xda, 0xb7, 0xa8, 0xed, 0x00, 0x00, 0x00, +} diff --git a/vendor/gopkg.in/square/go-jose.v2/asymmetric.go b/vendor/gopkg.in/square/go-jose.v2/asymmetric.go index 5272648f..67935561 100644 --- a/vendor/gopkg.in/square/go-jose.v2/asymmetric.go +++ b/vendor/gopkg.in/square/go-jose.v2/asymmetric.go @@ -195,11 +195,11 @@ func (ctx rsaEncrypterVerifier) encryptKey(cek []byte, alg KeyAlgorithm) (recipi func (ctx rsaEncrypterVerifier) encrypt(cek []byte, alg KeyAlgorithm) ([]byte, error) { switch alg { case RSA1_5: - return rsa.EncryptPKCS1v15(randReader, ctx.publicKey, cek) + return rsa.EncryptPKCS1v15(RandReader, ctx.publicKey, cek) case RSA_OAEP: - return rsa.EncryptOAEP(sha1.New(), randReader, ctx.publicKey, cek, []byte{}) + return rsa.EncryptOAEP(sha1.New(), RandReader, ctx.publicKey, cek, []byte{}) case RSA_OAEP_256: - return rsa.EncryptOAEP(sha256.New(), randReader, ctx.publicKey, cek, []byte{}) + return rsa.EncryptOAEP(sha256.New(), RandReader, ctx.publicKey, cek, []byte{}) } return nil, ErrUnsupportedAlgorithm @@ -285,9 +285,9 @@ func (ctx rsaDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm switch alg { case RS256, RS384, RS512: - out, err = rsa.SignPKCS1v15(randReader, ctx.privateKey, hash, hashed) + out, err = rsa.SignPKCS1v15(RandReader, ctx.privateKey, hash, hashed) case PS256, PS384, PS512: - out, err = rsa.SignPSS(randReader, ctx.privateKey, hash, hashed, &rsa.PSSOptions{ + out, err = rsa.SignPSS(RandReader, ctx.privateKey, hash, hashed, &rsa.PSSOptions{ SaltLength: rsa.PSSSaltLengthAuto, }) } @@ -388,7 +388,7 @@ func (ctx ecKeyGenerator) keySize() int { // Get a content encryption key for ECDH-ES func (ctx ecKeyGenerator) genKey() ([]byte, rawHeader, error) { - priv, err := ecdsa.GenerateKey(ctx.publicKey.Curve, randReader) + priv, err := ecdsa.GenerateKey(ctx.publicKey.Curve, RandReader) if err != nil { return nil, rawHeader{}, err } @@ -472,7 +472,7 @@ func (ctx edDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) return Signature{}, ErrUnsupportedAlgorithm } - sig, err := ctx.privateKey.Sign(randReader, payload, crypto.Hash(0)) + sig, err := ctx.privateKey.Sign(RandReader, payload, crypto.Hash(0)) if err != nil { return Signature{}, err } @@ -522,7 +522,7 @@ func (ctx ecDecrypterSigner) signPayload(payload []byte, alg SignatureAlgorithm) _, _ = hasher.Write(payload) hashed := hasher.Sum(nil) - r, s, err := ecdsa.Sign(randReader, ctx.privateKey, hashed) + r, s, err := ecdsa.Sign(RandReader, ctx.privateKey, hashed) if err != nil { return Signature{}, err } diff --git a/vendor/gopkg.in/square/go-jose.v2/crypter.go b/vendor/gopkg.in/square/go-jose.v2/crypter.go index 9ee44f8b..c45c7120 100644 --- a/vendor/gopkg.in/square/go-jose.v2/crypter.go +++ b/vendor/gopkg.in/square/go-jose.v2/crypter.go @@ -151,6 +151,9 @@ func NewEncrypter(enc ContentEncryption, rcpt Recipient, opts *EncrypterOptions) if reflect.TypeOf(rawKey) != reflect.TypeOf([]byte{}) { return nil, ErrUnsupportedKeyType } + if encrypter.cipher.keySize() != len(rawKey.([]byte)) { + return nil, ErrInvalidKeySize + } encrypter.keyGenerator = staticKeyGenerator{ key: rawKey.([]byte), } diff --git a/vendor/gopkg.in/square/go-jose.v2/jwk.go b/vendor/gopkg.in/square/go-jose.v2/jwk.go index 2dfd5d50..6cb8adb8 100644 --- a/vendor/gopkg.in/square/go-jose.v2/jwk.go +++ b/vendor/gopkg.in/square/go-jose.v2/jwk.go @@ -230,7 +230,7 @@ func (k *JSONWebKey) Thumbprint(hash crypto.Hash) ([]byte, error) { case *rsa.PrivateKey: input, err = rsaThumbprintInput(key.N, key.E) case ed25519.PrivateKey: - input, err = edThumbprintInput(ed25519.PublicKey(key[0:32])) + input, err = edThumbprintInput(ed25519.PublicKey(key[32:])) default: return nil, fmt.Errorf("square/go-jose: unknown key type '%s'", reflect.TypeOf(key)) } @@ -353,6 +353,17 @@ func (key rawJSONWebKey) ecPublicKey() (*ecdsa.PublicKey, error) { return nil, errors.New("square/go-jose: invalid EC key, missing x/y values") } + // The length of this octet string MUST be the full size of a coordinate for + // the curve specified in the "crv" parameter. + // https://tools.ietf.org/html/rfc7518#section-6.2.1.2 + if curveSize(curve) != len(key.X.data) { + return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for x") + } + + if curveSize(curve) != len(key.Y.data) { + return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for y") + } + x := key.X.bigInt() y := key.Y.bigInt() @@ -410,8 +421,8 @@ func (key rawJSONWebKey) edPrivateKey() (ed25519.PrivateKey, error) { } privateKey := make([]byte, ed25519.PrivateKeySize) - copy(privateKey[0:32], key.X.bytes()) - copy(privateKey[32:], key.D.bytes()) + copy(privateKey[0:32], key.D.bytes()) + copy(privateKey[32:], key.X.bytes()) rv := ed25519.PrivateKey(privateKey) return rv, nil } @@ -472,9 +483,9 @@ func (key rawJSONWebKey) rsaPrivateKey() (*rsa.PrivateKey, error) { } func fromEdPrivateKey(ed ed25519.PrivateKey) (*rawJSONWebKey, error) { - raw := fromEdPublicKey(ed25519.PublicKey(ed[0:32])) + raw := fromEdPublicKey(ed25519.PublicKey(ed[32:])) - raw.D = newBuffer(ed[32:]) + raw.D = newBuffer(ed[0:32]) return raw, nil } @@ -519,6 +530,22 @@ func (key rawJSONWebKey) ecPrivateKey() (*ecdsa.PrivateKey, error) { return nil, fmt.Errorf("square/go-jose: invalid EC private key, missing x/y/d values") } + // The length of this octet string MUST be the full size of a coordinate for + // the curve specified in the "crv" parameter. + // https://tools.ietf.org/html/rfc7518#section-6.2.1.2 + if curveSize(curve) != len(key.X.data) { + return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for x") + } + + if curveSize(curve) != len(key.Y.data) { + return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for y") + } + + // https://tools.ietf.org/html/rfc7518#section-6.2.2.1 + if dSize(curve) != len(key.D.data) { + return nil, fmt.Errorf("square/go-jose: invalid EC private key, wrong length for d") + } + x := key.X.bigInt() y := key.Y.bigInt() @@ -546,11 +573,26 @@ func fromEcPrivateKey(ec *ecdsa.PrivateKey) (*rawJSONWebKey, error) { return nil, fmt.Errorf("square/go-jose: invalid EC private key") } - raw.D = newBuffer(ec.D.Bytes()) + raw.D = newFixedSizeBuffer(ec.D.Bytes(), dSize(ec.PublicKey.Curve)) return raw, nil } +// dSize returns the size in octets for the "d" member of an elliptic curve +// private key. +// The length of this octet string MUST be ceiling(log-base-2(n)/8) +// octets (where n is the order of the curve). +// https://tools.ietf.org/html/rfc7518#section-6.2.2.1 +func dSize(curve elliptic.Curve) int { + order := curve.Params().P + bitLen := order.BitLen() + size := bitLen / 8 + if bitLen%8 != 0 { + size = size + 1 + } + return size +} + func fromSymmetricKey(key []byte) (*rawJSONWebKey, error) { return &rawJSONWebKey{ Kty: "oct", diff --git a/vendor/gopkg.in/square/go-jose.v2/shared.go b/vendor/gopkg.in/square/go-jose.v2/shared.go index b3ac932b..b0a6255e 100644 --- a/vendor/gopkg.in/square/go-jose.v2/shared.go +++ b/vendor/gopkg.in/square/go-jose.v2/shared.go @@ -58,6 +58,11 @@ var ( // an RSA private key with more than two primes. ErrUnsupportedKeyType = errors.New("square/go-jose: unsupported key type/format") + // ErrInvalidKeySize indicates that the given key is not the correct size + // for the selected algorithm. This can occur, for example, when trying to + // encrypt with AES-256 but passing only a 128-bit key as input. + ErrInvalidKeySize = errors.New("square/go-jose: invalid key size for algorithm") + // ErrNotSupported serialization of object is not supported. This occurs when // trying to compact-serialize an object which can't be represented in // compact form. diff --git a/vendor/gopkg.in/square/go-jose.v2/symmetric.go b/vendor/gopkg.in/square/go-jose.v2/symmetric.go index 09b63cef..264a0fe3 100644 --- a/vendor/gopkg.in/square/go-jose.v2/symmetric.go +++ b/vendor/gopkg.in/square/go-jose.v2/symmetric.go @@ -35,7 +35,7 @@ import ( ) // Random reader (stubbed out in tests) -var randReader = rand.Reader +var RandReader = rand.Reader const ( // RFC7518 recommends a minimum of 1,000 iterations: @@ -103,7 +103,7 @@ func newAESGCM(keySize int) contentCipher { func newAESCBC(keySize int) contentCipher { return &aeadContentCipher{ keyBytes: keySize * 2, - authtagBytes: 16, + authtagBytes: keySize, getAead: func(key []byte) (cipher.AEAD, error) { return josecipher.NewCBCHMAC(key, aes.NewCipher) }, @@ -148,7 +148,7 @@ func getPbkdf2Params(alg KeyAlgorithm) (int, func() hash.Hash) { // getRandomSalt generates a new salt of the given size. func getRandomSalt(size int) ([]byte, error) { salt := make([]byte, size) - _, err := io.ReadFull(randReader, salt) + _, err := io.ReadFull(RandReader, salt) if err != nil { return nil, err } @@ -193,7 +193,7 @@ func newSymmetricSigner(sigAlg SignatureAlgorithm, key []byte) (recipientSigInfo // Generate a random key for the given content cipher func (ctx randomKeyGenerator) genKey() ([]byte, rawHeader, error) { key := make([]byte, ctx.size) - _, err := io.ReadFull(randReader, key) + _, err := io.ReadFull(RandReader, key) if err != nil { return nil, rawHeader{}, err } @@ -233,7 +233,7 @@ func (ctx aeadContentCipher) encrypt(key, aad, pt []byte) (*aeadParts, error) { // Initialize a new nonce iv := make([]byte, aead.NonceSize()) - _, err = io.ReadFull(randReader, iv) + _, err = io.ReadFull(RandReader, iv) if err != nil { return nil, err }